diff --git a/document/.gitattributes b/document/.gitattributes
new file mode 100755
index 000000000..4d75d5900
--- /dev/null
+++ b/document/.gitattributes
@@ -0,0 +1,2 @@
+# This allows generated code to be indexed correctly
+*.py linguist-generated=false
\ No newline at end of file
diff --git a/document/.gitignore b/document/.gitignore
new file mode 100755
index 000000000..8ac3f51d4
--- /dev/null
+++ b/document/.gitignore
@@ -0,0 +1,7 @@
+.python-version
+.DS_Store
+venv/
+src/*.egg-info/
+__pycache__/
+.pytest_cache/
+.python-version`
diff --git a/document/README.md b/document/README.md
index d9f5437d5..1df7dcf1c 100755
--- a/document/README.md
+++ b/document/README.md
@@ -16,38 +16,178 @@ from epilot.models import operations, shared
s = epilot.Epilot(
security=shared.Security(
- epilot_auth="Bearer YOUR_BEARER_TOKEN_HERE",
+ epilot_auth="",
),
)
-
req = operations.GenerateDocumentRequestBody(
- context_entity_id="bcd0aab9-b544-42b0-8bfb-6d449d02eacc",
- language="de",
+ context_entity_id='bcd0aab9-b544-42b0-8bfb-6d449d02eacc',
+ language='de',
template_document=operations.GenerateDocumentRequestBodyTemplateDocument(
- filename="my-template-{{order.order_number}}.docx",
+ filename='my-template-{{order.order_number}}.docx',
s3ref=shared.S3Reference(
- bucket="document-api-prod",
- key="uploads/my-template.pdf",
+ bucket='document-api-prod',
+ key='uploads/my-template.pdf',
),
),
- user_id="100321",
+ user_id='100321',
)
-
+
res = s.documents.generate_document(req)
if res.generate_document_200_application_json_object is not None:
# handle response
+ pass
```
-## SDK Available Operations
+## Available Resources and Operations
-### documents
+### [documents](docs/sdks/documents/README.md)
-* `generate_document` - generateDocument
+* [generate_document](docs/sdks/documents/README.md#generate_document) - generateDocument
+* [generate_document_v2](docs/sdks/documents/README.md#generate_document_v2) - generateDocumentV2
+
+
+
+
+
+
+
+
+
+# Pagination
+
+Some of the endpoints in this SDK support pagination. To use pagination, you make your SDK calls as usual, but the
+returned response object will have a `Next` method that can be called to pull down the next group of results. If the
+return value of `Next` is `None`, then there are no more pages to be fetched.
+
+Here's an example of one such pagination call:
+
+
+
+
+
+# Error Handling
+
+Handling errors in your SDK should largely match your expectations. All operations return a response object or raise an error. If Error objects are specified in your OpenAPI Spec, the SDK will raise the appropriate Error type.
+
+
+
+
+
+
+
+# Server Selection
+
+## Select Server by Index
+
+You can override the default server globally by passing a server index to the `server_idx: int` optional parameter when initializing the SDK client instance. The selected server will then be used as the default on the operations that use it. This table lists the indexes associated with the available servers:
+
+| # | Server | Variables |
+| - | ------ | --------- |
+| 0 | `https://document.sls.epilot.io` | None |
+
+For example:
+
+
+```python
+import epilot
+from epilot.models import operations, shared
+
+s = epilot.Epilot(
+ security=shared.Security(
+ epilot_auth="",
+ ),
+ server_idx=0
+)
+
+req = operations.GenerateDocumentRequestBody(
+ context_entity_id='bcd0aab9-b544-42b0-8bfb-6d449d02eacc',
+ language='de',
+ template_document=operations.GenerateDocumentRequestBodyTemplateDocument(
+ filename='my-template-{{order.order_number}}.docx',
+ s3ref=shared.S3Reference(
+ bucket='document-api-prod',
+ key='uploads/my-template.pdf',
+ ),
+ ),
+ user_id='100321',
+)
+
+res = s.documents.generate_document(req)
+
+if res.generate_document_200_application_json_object is not None:
+ # handle response
+ pass
+```
+
+
+## Override Server URL Per-Client
+
+The default server can also be overridden globally by passing a URL to the `server_url: str` optional parameter when initializing the SDK client instance. For example:
+
+
+```python
+import epilot
+from epilot.models import operations, shared
+
+s = epilot.Epilot(
+ security=shared.Security(
+ epilot_auth="",
+ ),
+ server_url="https://document.sls.epilot.io"
+)
+
+req = operations.GenerateDocumentRequestBody(
+ context_entity_id='bcd0aab9-b544-42b0-8bfb-6d449d02eacc',
+ language='de',
+ template_document=operations.GenerateDocumentRequestBodyTemplateDocument(
+ filename='my-template-{{order.order_number}}.docx',
+ s3ref=shared.S3Reference(
+ bucket='document-api-prod',
+ key='uploads/my-template.pdf',
+ ),
+ ),
+ user_id='100321',
+)
+
+res = s.documents.generate_document(req)
+
+if res.generate_document_200_application_json_object is not None:
+ # handle response
+ pass
+```
+
+
+
+
+
+# Custom HTTP Client
+
+The Python SDK makes API calls using the (requests)[https://pypi.org/project/requests/] HTTP library. In order to provide a convenient way to configure timeouts, cookies, proxies, custom headers, and other low-level configuration, you can initialize the SDK client with a custom `requests.Session` object.
+
+
+For example, you could specify a header for every request that your sdk makes as follows:
+
+```python
+import epilot
+import requests
+
+http_client = requests.Session()
+http_client.headers.update({'x-custom-header': 'someValue'})
+s = epilot.Epilot(client: http_client)
+```
+
+
+
+
+
+
+
+
### SDK Generated by [Speakeasy](https://docs.speakeasyapi.dev/docs/using-speakeasy/client-sdks)
diff --git a/document/RELEASES.md b/document/RELEASES.md
index a6066d95f..0ed0d4be3 100644
--- a/document/RELEASES.md
+++ b/document/RELEASES.md
@@ -34,4 +34,554 @@ Based on:
### Changes
Based on:
- OpenAPI Doc 1.0.0 https://docs.api.epilot.io/document.yaml
-- Speakeasy CLI 1.19.2 (2.16.5) https://github.com/speakeasy-api/speakeasy
\ No newline at end of file
+- Speakeasy CLI 1.19.2 (2.16.5) https://github.com/speakeasy-api/speakeasy
+
+## 2023-04-01 01:02:24
+### Changes
+Based on:
+- OpenAPI Doc 1.0.0 https://docs.api.epilot.io/document.yaml
+- Speakeasy CLI 1.19.3 (2.16.7) https://github.com/speakeasy-api/speakeasy
+
+## 2023-04-06 00:57:37
+### Changes
+Based on:
+- OpenAPI Doc 1.0.0 https://docs.api.epilot.io/document.yaml
+- Speakeasy CLI 1.19.6 (2.17.8) https://github.com/speakeasy-api/speakeasy
+
+## 2023-04-07 00:55:50
+### Changes
+Based on:
+- OpenAPI Doc 1.0.0 https://docs.api.epilot.io/document.yaml
+- Speakeasy CLI 1.19.6 (2.17.8) https://github.com/speakeasy-api/speakeasy
+
+## 2023-04-12 00:59:44
+### Changes
+Based on:
+- OpenAPI Doc 1.0.0 https://docs.api.epilot.io/document.yaml
+- Speakeasy CLI 1.19.7 (2.17.9) https://github.com/speakeasy-api/speakeasy
+
+## 2023-04-14 00:59:26
+### Changes
+Based on:
+- OpenAPI Doc 1.0.0 https://docs.api.epilot.io/document.yaml
+- Speakeasy CLI 1.20.0 (2.18.0) https://github.com/speakeasy-api/speakeasy
+
+## 2023-04-18 00:58:31
+### Changes
+Based on:
+- OpenAPI Doc 1.0.0 https://docs.api.epilot.io/document.yaml
+- Speakeasy CLI 1.20.1 (2.18.1) https://github.com/speakeasy-api/speakeasy
+
+## 2023-04-19 01:01:59
+### Changes
+Based on:
+- OpenAPI Doc 1.0.0 https://docs.api.epilot.io/document.yaml
+- Speakeasy CLI 1.20.2 (2.18.2) https://github.com/speakeasy-api/speakeasy
+
+## 2023-04-21 00:59:36
+### Changes
+Based on:
+- OpenAPI Doc 1.0.0 https://docs.api.epilot.io/document.yaml
+- Speakeasy CLI 1.21.4 (2.19.1) https://github.com/speakeasy-api/speakeasy
+
+## 2023-04-22 01:00:36
+### Changes
+Based on:
+- OpenAPI Doc 1.0.0 https://docs.api.epilot.io/document.yaml
+- Speakeasy CLI 1.22.1 (2.20.1) https://github.com/speakeasy-api/speakeasy
+
+## 2023-04-26 01:00:36
+### Changes
+Based on:
+- OpenAPI Doc 1.0.0 https://docs.api.epilot.io/document.yaml
+- Speakeasy CLI 1.23.1 (2.21.1) https://github.com/speakeasy-api/speakeasy
+
+## 2023-04-27 01:02:37
+### Changes
+Based on:
+- OpenAPI Doc 1.0.0 https://docs.api.epilot.io/document.yaml
+- Speakeasy CLI 1.25.1 (2.22.0) https://github.com/speakeasy-api/speakeasy
+
+## 2023-04-28 01:02:20
+### Changes
+Based on:
+- OpenAPI Doc 1.0.0 https://docs.api.epilot.io/document.yaml
+- Speakeasy CLI 1.26.2 (2.23.2) https://github.com/speakeasy-api/speakeasy
+
+## 2023-04-29 00:59:20
+### Changes
+Based on:
+- OpenAPI Doc 1.0.0 https://docs.api.epilot.io/document.yaml
+- Speakeasy CLI 1.26.4 (2.23.4) https://github.com/speakeasy-api/speakeasy
+
+## 2023-05-02 01:01:45
+### Changes
+Based on:
+- OpenAPI Doc 1.0.0 https://docs.api.epilot.io/document.yaml
+- Speakeasy CLI 1.26.5 (2.23.6) https://github.com/speakeasy-api/speakeasy
+
+## 2023-05-03 01:00:50
+### Changes
+Based on:
+- OpenAPI Doc 1.0.0 https://docs.api.epilot.io/document.yaml
+- Speakeasy CLI 1.27.0 (2.24.0) https://github.com/speakeasy-api/speakeasy
+
+## 2023-05-05 00:56:08
+### Changes
+Based on:
+- OpenAPI Doc 1.0.0 https://docs.api.epilot.io/document.yaml
+- Speakeasy CLI 1.29.0 (2.26.0) https://github.com/speakeasy-api/speakeasy
+
+## 2023-05-06 00:56:44
+### Changes
+Based on:
+- OpenAPI Doc 1.0.0 https://docs.api.epilot.io/document.yaml
+- Speakeasy CLI 1.29.1 (2.26.1) https://github.com/speakeasy-api/speakeasy
+
+## 2023-05-10 00:59:39
+### Changes
+Based on:
+- OpenAPI Doc 1.0.0 https://docs.api.epilot.io/document.yaml
+- Speakeasy CLI 1.29.2 (2.26.2) https://github.com/speakeasy-api/speakeasy
+
+## 2023-05-11 01:00:44
+### Changes
+Based on:
+- OpenAPI Doc 1.0.0 https://docs.api.epilot.io/document.yaml
+- Speakeasy CLI 1.30.0 (2.26.3) https://github.com/speakeasy-api/speakeasy
+
+## 2023-05-12 01:00:22
+### Changes
+Based on:
+- OpenAPI Doc 1.0.0 https://docs.api.epilot.io/document.yaml
+- Speakeasy CLI 1.30.1 (2.26.4) https://github.com/speakeasy-api/speakeasy
+
+## 2023-05-13 00:58:37
+### Changes
+Based on:
+- OpenAPI Doc 1.0.0 https://docs.api.epilot.io/document.yaml
+- Speakeasy CLI 1.31.1 (2.27.0) https://github.com/speakeasy-api/speakeasy
+
+## 2023-05-16 01:01:55
+### Changes
+Based on:
+- OpenAPI Doc 1.0.0 https://docs.api.epilot.io/document.yaml
+- Speakeasy CLI 1.32.0 (2.28.0) https://github.com/speakeasy-api/speakeasy
+
+## 2023-05-17 01:03:26
+### Changes
+Based on:
+- OpenAPI Doc 1.0.0 https://docs.api.epilot.io/document.yaml
+- Speakeasy CLI 1.33.2 (2.29.0) https://github.com/speakeasy-api/speakeasy
+
+## 2023-05-18 01:00:48
+### Changes
+Based on:
+- OpenAPI Doc 1.0.0 https://docs.api.epilot.io/document.yaml
+- Speakeasy CLI 1.34.0 (2.30.0) https://github.com/speakeasy-api/speakeasy
+
+## 2023-05-19 01:02:20
+### Changes
+Based on:
+- OpenAPI Doc 1.0.0 https://docs.api.epilot.io/document.yaml
+- Speakeasy CLI 1.35.0 (2.31.0) https://github.com/speakeasy-api/speakeasy
+
+## 2023-05-23 01:01:22
+### Changes
+Based on:
+- OpenAPI Doc 1.0.0 https://docs.api.epilot.io/document.yaml
+- Speakeasy CLI 1.37.5 (2.32.2) https://github.com/speakeasy-api/speakeasy
+
+## 2023-05-27 01:03:15
+### Changes
+Based on:
+- OpenAPI Doc 1.0.0 https://docs.api.epilot.io/document.yaml
+- Speakeasy CLI 1.39.0 (2.32.7) https://github.com/speakeasy-api/speakeasy
+
+## 2023-06-01 01:23:47
+### Changes
+Based on:
+- OpenAPI Doc 1.0.0 https://docs.api.epilot.io/document.yaml
+- Speakeasy CLI 1.40.2 (2.34.2) https://github.com/speakeasy-api/speakeasy
+
+## 2023-06-02 01:11:39
+### Changes
+Based on:
+- OpenAPI Doc 1.0.0 https://docs.api.epilot.io/document.yaml
+- Speakeasy CLI 1.40.3 (2.34.7) https://github.com/speakeasy-api/speakeasy
+
+## 2023-06-03 01:10:19
+### Changes
+Based on:
+- OpenAPI Doc 1.0.0 https://docs.api.epilot.io/document.yaml
+- Speakeasy CLI 1.43.0 (2.35.3) https://github.com/speakeasy-api/speakeasy
+
+## 2023-06-07 01:12:56
+### Changes
+Based on:
+- OpenAPI Doc 1.0.0 https://docs.api.epilot.io/document.yaml
+- Speakeasy CLI 1.44.2 (2.35.9) https://github.com/speakeasy-api/speakeasy
+
+## 2023-06-08 01:11:42
+### Changes
+Based on:
+- OpenAPI Doc 1.0.0 https://docs.api.epilot.io/document.yaml
+- Speakeasy CLI 1.45.0 (2.37.0) https://github.com/speakeasy-api/speakeasy
+
+## 2023-06-09 01:15:36
+### Changes
+Based on:
+- OpenAPI Doc 1.0.0 https://docs.api.epilot.io/document.yaml
+- Speakeasy CLI 1.45.2 (2.37.2) https://github.com/speakeasy-api/speakeasy
+
+## 2023-06-10 01:05:41
+### Changes
+Based on:
+- OpenAPI Doc 1.0.0 https://docs.api.epilot.io/document.yaml
+- Speakeasy CLI 1.47.0 (2.39.0) https://github.com/speakeasy-api/speakeasy
+
+## 2023-06-11 01:17:33
+### Changes
+Based on:
+- OpenAPI Doc 1.0.0 https://docs.api.epilot.io/document.yaml
+- Speakeasy CLI 1.47.1 (2.39.2) https://github.com/speakeasy-api/speakeasy
+
+## 2023-06-14 01:07:27
+### Changes
+Based on:
+- OpenAPI Doc 1.0.0 https://docs.api.epilot.io/document.yaml
+- Speakeasy CLI 1.47.3 (2.40.1) https://github.com/speakeasy-api/speakeasy
+
+## 2023-06-16 01:08:28
+### Changes
+Based on:
+- OpenAPI Doc 1.0.0 https://docs.api.epilot.io/document.yaml
+- Speakeasy CLI 1.48.0 (2.41.1) https://github.com/speakeasy-api/speakeasy
+
+## 2023-06-20 01:06:16
+### Changes
+Based on:
+- OpenAPI Doc 1.0.0 https://docs.api.epilot.io/document.yaml
+- Speakeasy CLI 1.49.0 (2.41.4) https://github.com/speakeasy-api/speakeasy
+
+## 2023-06-21 01:08:09
+### Changes
+Based on:
+- OpenAPI Doc 1.0.0 https://docs.api.epilot.io/document.yaml
+- Speakeasy CLI 1.49.1 (2.41.5) https://github.com/speakeasy-api/speakeasy
+
+## 2023-06-23 01:16:19
+### Changes
+Based on:
+- OpenAPI Doc 1.0.0 https://docs.api.epilot.io/document.yaml
+- Speakeasy CLI 1.50.1 (2.43.2) https://github.com/speakeasy-api/speakeasy
+
+## 2023-06-27 01:17:24
+### Changes
+Based on:
+- OpenAPI Doc 1.0.0 https://docs.api.epilot.io/document.yaml
+- Speakeasy CLI 1.51.1 (2.50.2) https://github.com/speakeasy-api/speakeasy
+
+## 2023-06-29 01:15:05
+### Changes
+Based on:
+- OpenAPI Doc 1.0.0 https://docs.api.epilot.io/document.yaml
+- Speakeasy CLI 1.51.3 (2.52.2) https://github.com/speakeasy-api/speakeasy
+
+## 2023-07-01 01:22:47
+### Changes
+Based on:
+- OpenAPI Doc 1.0.0 https://docs.api.epilot.io/document.yaml
+- Speakeasy CLI 1.52.0 (2.55.0) https://github.com/speakeasy-api/speakeasy
+
+## 2023-07-06 01:18:26
+### Changes
+Based on:
+- OpenAPI Doc 1.0.0 https://docs.api.epilot.io/document.yaml
+- Speakeasy CLI 1.52.2 (2.57.2) https://github.com/speakeasy-api/speakeasy
+
+## 2023-07-07 01:19:07
+### Changes
+Based on:
+- OpenAPI Doc 1.0.0 https://docs.api.epilot.io/document.yaml
+- Speakeasy CLI 1.53.0 (2.58.0) https://github.com/speakeasy-api/speakeasy
+
+## 2023-07-08 01:17:34
+### Changes
+Based on:
+- OpenAPI Doc 1.0.0 https://docs.api.epilot.io/document.yaml
+- Speakeasy CLI 1.53.1 (2.58.2) https://github.com/speakeasy-api/speakeasy
+
+## 2023-07-11 01:10:00
+### Changes
+Based on:
+- OpenAPI Doc 1.0.0 https://docs.api.epilot.io/document.yaml
+- Speakeasy CLI 1.56.0 (2.61.0) https://github.com/speakeasy-api/speakeasy
+
+## 2023-07-12 01:15:48
+### Changes
+Based on:
+- OpenAPI Doc 1.0.0 https://docs.api.epilot.io/document.yaml
+- Speakeasy CLI 1.56.4 (2.61.5) https://github.com/speakeasy-api/speakeasy
+
+## 2023-07-13 01:18:50
+### Changes
+Based on:
+- OpenAPI Doc 1.0.0 https://docs.api.epilot.io/document.yaml
+- Speakeasy CLI 1.57.0 (2.62.1) https://github.com/speakeasy-api/speakeasy
+
+## 2023-07-14 01:18:12
+### Changes
+Based on:
+- OpenAPI Doc 1.0.0 https://docs.api.epilot.io/document.yaml
+- Speakeasy CLI 1.59.0 (2.65.0) https://github.com/speakeasy-api/speakeasy
+
+## 2023-07-17 01:19:27
+### Changes
+Based on:
+- OpenAPI Doc 1.0.0 https://docs.api.epilot.io/document.yaml
+- Speakeasy CLI 1.60.0 (2.66.0) https://github.com/speakeasy-api/speakeasy
+
+## 2023-07-18 01:39:32
+### Changes
+Based on:
+- OpenAPI Doc 1.0.0 https://docs.api.epilot.io/document.yaml
+- Speakeasy CLI 1.61.0 (2.70.0) https://github.com/speakeasy-api/speakeasy
+
+## 2023-07-19 02:18:08
+### Changes
+Based on:
+- OpenAPI Doc 1.0.0 https://docs.api.epilot.io/document.yaml
+- Speakeasy CLI 1.62.1 (2.70.2) https://github.com/speakeasy-api/speakeasy
+
+## 2023-07-22 01:06:13
+### Changes
+Based on:
+- OpenAPI Doc 1.0.0 https://docs.api.epilot.io/document.yaml
+- Speakeasy CLI 1.64.0 (2.71.0) https://github.com/speakeasy-api/speakeasy
+
+## 2023-07-26 01:05:59
+### Changes
+Based on:
+- OpenAPI Doc 1.0.0 https://docs.api.epilot.io/document.yaml
+- Speakeasy CLI 1.65.0 (2.73.0) https://github.com/speakeasy-api/speakeasy
+
+## 2023-07-27 00:58:57
+### Changes
+Based on:
+- OpenAPI Doc 1.0.0 https://docs.api.epilot.io/document.yaml
+- Speakeasy CLI 1.65.1 (2.73.1) https://github.com/speakeasy-api/speakeasy
+
+## 2023-07-28 01:00:13
+### Changes
+Based on:
+- OpenAPI Doc 1.0.0 https://docs.api.epilot.io/document.yaml
+- Speakeasy CLI 1.65.2 (2.75.1) https://github.com/speakeasy-api/speakeasy
+
+## 2023-08-01 01:07:13
+### Changes
+Based on:
+- OpenAPI Doc 1.0.0 https://docs.api.epilot.io/document.yaml
+- Speakeasy CLI 1.66.1 (2.75.2) https://github.com/speakeasy-api/speakeasy
+
+## 2023-08-03 01:01:25
+### Changes
+Based on:
+- OpenAPI Doc 1.0.0 https://docs.api.epilot.io/document.yaml
+- Speakeasy CLI 1.68.1 (2.77.1) https://github.com/speakeasy-api/speakeasy
+
+## 2023-08-04 01:03:05
+### Changes
+Based on:
+- OpenAPI Doc 1.0.0 https://docs.api.epilot.io/document.yaml
+- Speakeasy CLI 1.68.3 (2.81.1) https://github.com/speakeasy-api/speakeasy
+
+## 2023-08-08 00:59:49
+### Changes
+Based on:
+- OpenAPI Doc 1.0.0 https://docs.api.epilot.io/document.yaml
+- Speakeasy CLI 1.69.1 (2.82.0) https://github.com/speakeasy-api/speakeasy
+
+## 2023-08-15 00:50:58
+### Changes
+Based on:
+- OpenAPI Doc 1.0.0 https://docs.api.epilot.io/document.yaml
+- Speakeasy CLI 1.72.0 (2.84.1) https://github.com/speakeasy-api/speakeasy
+### Generated
+- [python v1.41.0] document
+
+## 2023-08-19 00:48:52
+### Changes
+Based on:
+- OpenAPI Doc 1.0.0 https://docs.api.epilot.io/document.yaml
+- Speakeasy CLI 1.74.3 (2.86.6) https://github.com/speakeasy-api/speakeasy
+### Generated
+- [python v1.41.1] document
+
+## 2023-08-25 00:51:47
+### Changes
+Based on:
+- OpenAPI Doc 1.0.0 https://docs.api.epilot.io/document.yaml
+- Speakeasy CLI 1.74.11 (2.87.1) https://github.com/speakeasy-api/speakeasy
+### Generated
+- [python v1.41.2] document
+
+## 2023-08-26 00:49:36
+### Changes
+Based on:
+- OpenAPI Doc 1.0.0 https://docs.api.epilot.io/document.yaml
+- Speakeasy CLI 1.74.16 (2.88.2) https://github.com/speakeasy-api/speakeasy
+### Generated
+- [python v1.42.0] document
+
+## 2023-08-29 00:52:07
+### Changes
+Based on:
+- OpenAPI Doc 1.0.0 https://docs.api.epilot.io/document.yaml
+- Speakeasy CLI 1.74.17 (2.88.5) https://github.com/speakeasy-api/speakeasy
+### Generated
+- [python v1.42.1] document
+
+## 2023-08-31 00:52:06
+### Changes
+Based on:
+- OpenAPI Doc 1.0.0 https://docs.api.epilot.io/document.yaml
+- Speakeasy CLI 1.76.1 (2.89.1) https://github.com/speakeasy-api/speakeasy
+### Generated
+- [python v1.43.0] document
+
+## 2023-09-01 00:55:30
+### Changes
+Based on:
+- OpenAPI Doc 1.0.0 https://docs.api.epilot.io/document.yaml
+- Speakeasy CLI 1.77.0 (2.91.2) https://github.com/speakeasy-api/speakeasy
+### Generated
+- [python v1.44.0] document
+
+## 2023-09-02 00:50:01
+### Changes
+Based on:
+- OpenAPI Doc 1.0.0 https://docs.api.epilot.io/document.yaml
+- Speakeasy CLI 1.77.2 (2.93.0) https://github.com/speakeasy-api/speakeasy
+### Generated
+- [python v1.44.1] document
+
+## 2023-09-05 00:51:08
+### Changes
+Based on:
+- OpenAPI Doc 1.0.0 https://docs.api.epilot.io/document.yaml
+- Speakeasy CLI 1.78.3 (2.96.3) https://github.com/speakeasy-api/speakeasy
+### Generated
+- [python v1.44.2] document
+
+## 2023-09-12 00:50:48
+### Changes
+Based on:
+- OpenAPI Doc 1.0.0 https://docs.api.epilot.io/document.yaml
+- Speakeasy CLI 1.82.5 (2.108.3) https://github.com/speakeasy-api/speakeasy
+### Generated
+- [python v1.44.3] document
+
+## 2023-09-16 00:51:15
+### Changes
+Based on:
+- OpenAPI Doc 1.0.0 https://docs.api.epilot.io/document.yaml
+- Speakeasy CLI 1.86.0 (2.115.2) https://github.com/speakeasy-api/speakeasy
+### Generated
+- [python v1.44.4] document
+
+## 2023-09-20 00:52:36
+### Changes
+Based on:
+- OpenAPI Doc 1.0.0 https://docs.api.epilot.io/document.yaml
+- Speakeasy CLI 1.88.0 (2.118.1) https://github.com/speakeasy-api/speakeasy
+### Generated
+- [python v1.44.5] document
+
+## 2023-09-26 00:53:24
+### Changes
+Based on:
+- OpenAPI Doc 1.0.0 https://docs.api.epilot.io/document.yaml
+- Speakeasy CLI 1.91.0 (2.129.1) https://github.com/speakeasy-api/speakeasy
+### Generated
+- [python v1.45.0] document
+
+## 2023-09-27 00:53:14
+### Changes
+Based on:
+- OpenAPI Doc 1.0.0 https://docs.api.epilot.io/document.yaml
+- Speakeasy CLI 1.91.2 (2.131.1) https://github.com/speakeasy-api/speakeasy
+### Generated
+- [python v1.45.1] document
+
+## 2023-09-29 00:53:06
+### Changes
+Based on:
+- OpenAPI Doc 1.0.0 https://docs.api.epilot.io/document.yaml
+- Speakeasy CLI 1.91.3 (2.139.1) https://github.com/speakeasy-api/speakeasy
+### Generated
+- [python v1.46.0] document
+
+## 2023-10-01 00:59:58
+### Changes
+Based on:
+- OpenAPI Doc 1.0.0 https://docs.api.epilot.io/document.yaml
+- Speakeasy CLI 1.92.2 (2.142.2) https://github.com/speakeasy-api/speakeasy
+### Generated
+- [python v1.47.0] document
+
+## 2023-10-02 00:53:50
+### Changes
+Based on:
+- OpenAPI Doc 1.0.0 https://docs.api.epilot.io/document.yaml
+- Speakeasy CLI 1.92.3 (2.143.2) https://github.com/speakeasy-api/speakeasy
+### Generated
+- [python v1.47.1] document
+
+## 2023-10-05 00:53:10
+### Changes
+Based on:
+- OpenAPI Doc 1.0.0 https://docs.api.epilot.io/document.yaml
+- Speakeasy CLI 1.94.0 (2.147.0) https://github.com/speakeasy-api/speakeasy
+### Generated
+- [python v1.47.2] document
+
+## 2023-10-07 00:52:29
+### Changes
+Based on:
+- OpenAPI Doc 1.0.0 https://docs.api.epilot.io/document.yaml
+- Speakeasy CLI 1.96.1 (2.150.0) https://github.com/speakeasy-api/speakeasy
+### Generated
+- [python v1.48.0] document
+
+## 2023-10-13 00:54:38
+### Changes
+Based on:
+- OpenAPI Doc 1.0.0 https://docs.api.epilot.io/document.yaml
+- Speakeasy CLI 1.99.1 (2.154.1) https://github.com/speakeasy-api/speakeasy
+### Generated
+- [python v1.48.1] document
+
+## 2023-10-18 00:53:29
+### Changes
+Based on:
+- OpenAPI Doc 1.0.0 https://docs.api.epilot.io/document.yaml
+- Speakeasy CLI 1.101.0 (2.161.0) https://github.com/speakeasy-api/speakeasy
+### Generated
+- [python v2.0.0] document
+
+## 2023-10-21 00:51:35
+### Changes
+Based on:
+- OpenAPI Doc 1.0.0 https://docs.api.epilot.io/document.yaml
+- Speakeasy CLI 1.104.0 (2.169.0) https://github.com/speakeasy-api/speakeasy
+### Generated
+- [python v2.1.0] document
+
+## 2023-10-28 00:51:20
+### Changes
+Based on:
+- OpenAPI Doc 1.0.0 https://docs.api.epilot.io/document.yaml
+- Speakeasy CLI 1.109.0 (2.173.0) https://github.com/speakeasy-api/speakeasy
+### Generated
+- [python v2.1.1] document
\ No newline at end of file
diff --git a/document/USAGE.md b/document/USAGE.md
index 7b2b27cc9..58c306f7e 100755
--- a/document/USAGE.md
+++ b/document/USAGE.md
@@ -1,31 +1,33 @@
+
+
```python
import epilot
from epilot.models import operations, shared
s = epilot.Epilot(
security=shared.Security(
- epilot_auth="Bearer YOUR_BEARER_TOKEN_HERE",
+ epilot_auth="",
),
)
-
req = operations.GenerateDocumentRequestBody(
- context_entity_id="bcd0aab9-b544-42b0-8bfb-6d449d02eacc",
- language="de",
+ context_entity_id='bcd0aab9-b544-42b0-8bfb-6d449d02eacc',
+ language='de',
template_document=operations.GenerateDocumentRequestBodyTemplateDocument(
- filename="my-template-{{order.order_number}}.docx",
+ filename='my-template-{{order.order_number}}.docx',
s3ref=shared.S3Reference(
- bucket="document-api-prod",
- key="uploads/my-template.pdf",
+ bucket='document-api-prod',
+ key='uploads/my-template.pdf',
),
),
- user_id="100321",
+ user_id='100321',
)
-
+
res = s.documents.generate_document(req)
if res.generate_document_200_application_json_object is not None:
# handle response
+ pass
```
\ No newline at end of file
diff --git a/document/docs/models/operations/generatedocument200applicationjson.md b/document/docs/models/operations/generatedocument200applicationjson.md
new file mode 100755
index 000000000..5ce865139
--- /dev/null
+++ b/document/docs/models/operations/generatedocument200applicationjson.md
@@ -0,0 +1,11 @@
+# GenerateDocument200ApplicationJSON
+
+Generated document output
+
+
+## Fields
+
+| Field | Type | Required | Description | Example |
+| ----------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------- |
+| `output_document` | [Optional[GenerateDocument200ApplicationJSONOutputDocument]](../../models/operations/generatedocument200applicationjsonoutputdocument.md) | :heavy_minus_sign: | N/A | |
+| `preview_url` | *Optional[str]* | :heavy_minus_sign: | Pre-signed S3 GET URL for preview | https://document-api-prod.s3.eu-central-1.amazonaws.com/preview/my-template-OR-001.pdf |
\ No newline at end of file
diff --git a/document/docs/models/operations/generatedocument200applicationjsonoutputdocument.md b/document/docs/models/operations/generatedocument200applicationjsonoutputdocument.md
new file mode 100755
index 000000000..7a49270ea
--- /dev/null
+++ b/document/docs/models/operations/generatedocument200applicationjsonoutputdocument.md
@@ -0,0 +1,9 @@
+# GenerateDocument200ApplicationJSONOutputDocument
+
+
+## Fields
+
+| Field | Type | Required | Description | Example |
+| ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ |
+| `filename` | *Optional[str]* | :heavy_minus_sign: | Generated document filename | my-template-OR-001.pdf |
+| `s3ref` | [Optional[shared.S3Reference]](../../models/shared/s3reference.md) | :heavy_minus_sign: | N/A | |
\ No newline at end of file
diff --git a/document/docs/models/operations/generatedocumentrequestbody.md b/document/docs/models/operations/generatedocumentrequestbody.md
new file mode 100755
index 000000000..ef5f64d80
--- /dev/null
+++ b/document/docs/models/operations/generatedocumentrequestbody.md
@@ -0,0 +1,11 @@
+# GenerateDocumentRequestBody
+
+
+## Fields
+
+| Field | Type | Required | Description | Example |
+| --------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------- |
+| `context_entity_id` | *Optional[str]* | :heavy_minus_sign: | Entity to use for variable context | bcd0aab9-b544-42b0-8bfb-6d449d02eacc |
+| `language` | *Optional[str]* | :heavy_minus_sign: | Language to use | de |
+| `template_document` | [GenerateDocumentRequestBodyTemplateDocument](../../models/operations/generatedocumentrequestbodytemplatedocument.md) | :heavy_check_mark: | Input template document | |
+| `user_id` | *Optional[str]* | :heavy_minus_sign: | User Id for variable context | 100321 |
\ No newline at end of file
diff --git a/document/docs/models/operations/generatedocumentrequestbodytemplatedocument.md b/document/docs/models/operations/generatedocumentrequestbodytemplatedocument.md
new file mode 100755
index 000000000..baca2675b
--- /dev/null
+++ b/document/docs/models/operations/generatedocumentrequestbodytemplatedocument.md
@@ -0,0 +1,11 @@
+# GenerateDocumentRequestBodyTemplateDocument
+
+Input template document
+
+
+## Fields
+
+| Field | Type | Required | Description | Example |
+| ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ |
+| `filename` | *Optional[str]* | :heavy_minus_sign: | Document original filename | my-template-{{order.order_number}}.docx |
+| `s3ref` | [Optional[shared.S3Reference]](../../models/shared/s3reference.md) | :heavy_minus_sign: | N/A | |
\ No newline at end of file
diff --git a/document/docs/models/operations/generatedocumentresponse.md b/document/docs/models/operations/generatedocumentresponse.md
new file mode 100755
index 000000000..a53c87eab
--- /dev/null
+++ b/document/docs/models/operations/generatedocumentresponse.md
@@ -0,0 +1,11 @@
+# GenerateDocumentResponse
+
+
+## Fields
+
+| Field | Type | Required | Description |
+| ------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------- |
+| `content_type` | *str* | :heavy_check_mark: | HTTP response content type for this operation |
+| `status_code` | *int* | :heavy_check_mark: | HTTP response status code for this operation |
+| `raw_response` | [requests.Response](https://requests.readthedocs.io/en/latest/api/#requests.Response) | :heavy_minus_sign: | Raw HTTP response; suitable for custom response parsing |
+| `generate_document_200_application_json_object` | [Optional[GenerateDocument200ApplicationJSON]](../../models/operations/generatedocument200applicationjson.md) | :heavy_minus_sign: | Generated document output |
\ No newline at end of file
diff --git a/document/docs/models/operations/generatedocumentv2200applicationjson.md b/document/docs/models/operations/generatedocumentv2200applicationjson.md
new file mode 100755
index 000000000..fdeefeafb
--- /dev/null
+++ b/document/docs/models/operations/generatedocumentv2200applicationjson.md
@@ -0,0 +1,15 @@
+# GenerateDocumentV2200ApplicationJSON
+
+Generated document output
+
+
+## Fields
+
+| Field | Type | Required | Description |
+| ----------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------- |
+| `docx_output` | [Optional[GenerateDocumentV2200ApplicationJSONDocxOutput]](../../models/operations/generatedocumentv2200applicationjsondocxoutput.md) | :heavy_minus_sign: | N/A |
+| `job_id` | *Optional[str]* | :heavy_minus_sign: | N/A |
+| `job_status` | [Optional[GenerateDocumentV2200ApplicationJSONJobStatus]](../../models/operations/generatedocumentv2200applicationjsonjobstatus.md) | :heavy_minus_sign: | Status of the job |
+| `message` | *Optional[str]* | :heavy_minus_sign: | A message explaining the progress |
+| `pdf_output` | [Optional[GenerateDocumentV2200ApplicationJSONPdfOutput]](../../models/operations/generatedocumentv2200applicationjsonpdfoutput.md) | :heavy_minus_sign: | N/A |
+| `variable_payload` | [Optional[GenerateDocumentV2200ApplicationJSONVariablePayload]](../../models/operations/generatedocumentv2200applicationjsonvariablepayload.md) | :heavy_minus_sign: | List of variables and its corresponding replaced values from the document template |
\ No newline at end of file
diff --git a/document/docs/models/operations/generatedocumentv2200applicationjsondocxoutput.md b/document/docs/models/operations/generatedocumentv2200applicationjsondocxoutput.md
new file mode 100755
index 000000000..bcb556461
--- /dev/null
+++ b/document/docs/models/operations/generatedocumentv2200applicationjsondocxoutput.md
@@ -0,0 +1,9 @@
+# GenerateDocumentV2200ApplicationJSONDocxOutput
+
+
+## Fields
+
+| Field | Type | Required | Description | Example |
+| ----------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------- |
+| `output_document` | [Optional[GenerateDocumentV2200ApplicationJSONDocxOutputOutputDocument]](../../models/operations/generatedocumentv2200applicationjsondocxoutputoutputdocument.md) | :heavy_minus_sign: | N/A | |
+| `preview_url` | *Optional[str]* | :heavy_minus_sign: | Pre-signed S3 GET URL for DOCX preview | https://document-api-prod.s3.eu-central-1.amazonaws.com/preview/my-template-OR-001.docx |
\ No newline at end of file
diff --git a/document/docs/models/operations/generatedocumentv2200applicationjsondocxoutputoutputdocument.md b/document/docs/models/operations/generatedocumentv2200applicationjsondocxoutputoutputdocument.md
new file mode 100755
index 000000000..a5554287f
--- /dev/null
+++ b/document/docs/models/operations/generatedocumentv2200applicationjsondocxoutputoutputdocument.md
@@ -0,0 +1,9 @@
+# GenerateDocumentV2200ApplicationJSONDocxOutputOutputDocument
+
+
+## Fields
+
+| Field | Type | Required | Description | Example |
+| ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ |
+| `filename` | *Optional[str]* | :heavy_minus_sign: | Generated document filename for DOCX | my-template-OR-001.docx |
+| `s3ref` | [Optional[shared.S3Reference]](../../models/shared/s3reference.md) | :heavy_minus_sign: | N/A | |
\ No newline at end of file
diff --git a/document/docs/models/operations/generatedocumentv2200applicationjsonjobstatus.md b/document/docs/models/operations/generatedocumentv2200applicationjsonjobstatus.md
new file mode 100755
index 000000000..ef77f21af
--- /dev/null
+++ b/document/docs/models/operations/generatedocumentv2200applicationjsonjobstatus.md
@@ -0,0 +1,13 @@
+# GenerateDocumentV2200ApplicationJSONJobStatus
+
+Status of the job
+
+
+## Values
+
+| Name | Value |
+| ------------ | ------------ |
+| `STARTED` | STARTED |
+| `PROCESSING` | PROCESSING |
+| `SUCCESS` | SUCCESS |
+| `FAILED` | FAILED |
\ No newline at end of file
diff --git a/document/docs/models/operations/generatedocumentv2200applicationjsonpdfoutput.md b/document/docs/models/operations/generatedocumentv2200applicationjsonpdfoutput.md
new file mode 100755
index 000000000..8c3f453f9
--- /dev/null
+++ b/document/docs/models/operations/generatedocumentv2200applicationjsonpdfoutput.md
@@ -0,0 +1,9 @@
+# GenerateDocumentV2200ApplicationJSONPdfOutput
+
+
+## Fields
+
+| Field | Type | Required | Description | Example |
+| --------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------- |
+| `output_document` | [Optional[GenerateDocumentV2200ApplicationJSONPdfOutputOutputDocument]](../../models/operations/generatedocumentv2200applicationjsonpdfoutputoutputdocument.md) | :heavy_minus_sign: | N/A | |
+| `preview_url` | *Optional[str]* | :heavy_minus_sign: | Pre-signed S3 GET URL for PDF preview | https://document-api-prod.s3.eu-central-1.amazonaws.com/preview/my-template-OR-001.pdf |
\ No newline at end of file
diff --git a/document/docs/models/operations/generatedocumentv2200applicationjsonpdfoutputoutputdocument.md b/document/docs/models/operations/generatedocumentv2200applicationjsonpdfoutputoutputdocument.md
new file mode 100755
index 000000000..8e6ba8c0f
--- /dev/null
+++ b/document/docs/models/operations/generatedocumentv2200applicationjsonpdfoutputoutputdocument.md
@@ -0,0 +1,9 @@
+# GenerateDocumentV2200ApplicationJSONPdfOutputOutputDocument
+
+
+## Fields
+
+| Field | Type | Required | Description | Example |
+| ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ |
+| `filename` | *Optional[str]* | :heavy_minus_sign: | Generated document filename for PDF | my-template-OR-001.pdf |
+| `s3ref` | [Optional[shared.S3Reference]](../../models/shared/s3reference.md) | :heavy_minus_sign: | N/A | |
\ No newline at end of file
diff --git a/document/docs/models/operations/generatedocumentv2200applicationjsonvariablepayload.md b/document/docs/models/operations/generatedocumentv2200applicationjsonvariablepayload.md
new file mode 100755
index 000000000..fb4de1087
--- /dev/null
+++ b/document/docs/models/operations/generatedocumentv2200applicationjsonvariablepayload.md
@@ -0,0 +1,10 @@
+# GenerateDocumentV2200ApplicationJSONVariablePayload
+
+List of variables and its corresponding replaced values from the document template
+
+
+## Fields
+
+| Field | Type | Required | Description |
+| ----------------------- | ----------------------- | ----------------------- | ----------------------- |
+| `additional_properties` | *Optional[str]* | :heavy_minus_sign: | N/A |
\ No newline at end of file
diff --git a/document/docs/models/operations/generatedocumentv2mode.md b/document/docs/models/operations/generatedocumentv2mode.md
new file mode 100755
index 000000000..6e8c4ec4f
--- /dev/null
+++ b/document/docs/models/operations/generatedocumentv2mode.md
@@ -0,0 +1,14 @@
+# GenerateDocumentV2Mode
+
+Type of mode used for document generation flow.
+Partial - Will have a intermediate step for users to validate and replace the variable values before generating the final document.
+Full - Goes through all the steps for the full generation of final document
+
+
+
+## Values
+
+| Name | Value |
+| -------------------- | -------------------- |
+| `PARTIAL_GENERATION` | partial_generation |
+| `FULL_GENERATION` | full_generation |
\ No newline at end of file
diff --git a/document/docs/models/operations/generatedocumentv2request.md b/document/docs/models/operations/generatedocumentv2request.md
new file mode 100755
index 000000000..de07f8652
--- /dev/null
+++ b/document/docs/models/operations/generatedocumentv2request.md
@@ -0,0 +1,10 @@
+# GenerateDocumentV2Request
+
+
+## Fields
+
+| Field | Type | Required | Description |
+| ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
+| `request_body` | [Optional[GenerateDocumentV2RequestBody]](../../models/operations/generatedocumentv2requestbody.md) | :heavy_minus_sign: | N/A |
+| `job_id` | *Optional[str]* | :heavy_minus_sign: | Job ID for tracking the status of document generation action |
+| `mode` | [Optional[GenerateDocumentV2Mode]](../../models/operations/generatedocumentv2mode.md) | :heavy_minus_sign: | Type of mode used for document generation flow.
Partial - Will have a intermediate step for users to validate and replace the variable values before generating the final document.
Full - Goes through all the steps for the full generation of final document
|
\ No newline at end of file
diff --git a/document/docs/models/operations/generatedocumentv2requestbody.md b/document/docs/models/operations/generatedocumentv2requestbody.md
new file mode 100755
index 000000000..5e6af6ed5
--- /dev/null
+++ b/document/docs/models/operations/generatedocumentv2requestbody.md
@@ -0,0 +1,12 @@
+# GenerateDocumentV2RequestBody
+
+
+## Fields
+
+| Field | Type | Required | Description | Example |
+| --------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------- |
+| `context_entity_id` | *Optional[str]* | :heavy_minus_sign: | Entity to use for variable context | bcd0aab9-b544-42b0-8bfb-6d449d02eacc |
+| `language` | [Optional[GenerateDocumentV2RequestBodyLanguage]](../../models/operations/generatedocumentv2requestbodylanguage.md) | :heavy_minus_sign: | Language to use | de |
+| `template_document` | [GenerateDocumentV2RequestBodyTemplateDocument](../../models/operations/generatedocumentv2requestbodytemplatedocument.md) | :heavy_check_mark: | Input template document | |
+| `user_id` | *Optional[str]* | :heavy_minus_sign: | User Id for variable context | 100321 |
+| `variable_payload` | [Optional[GenerateDocumentV2RequestBodyVariablePayload]](../../models/operations/generatedocumentv2requestbodyvariablepayload.md) | :heavy_minus_sign: | Custom values for variables in the template. Takes the higher precedence than others. | |
\ No newline at end of file
diff --git a/document/docs/models/operations/generatedocumentv2requestbodylanguage.md b/document/docs/models/operations/generatedocumentv2requestbodylanguage.md
new file mode 100755
index 000000000..3a911aa25
--- /dev/null
+++ b/document/docs/models/operations/generatedocumentv2requestbodylanguage.md
@@ -0,0 +1,11 @@
+# GenerateDocumentV2RequestBodyLanguage
+
+Language to use
+
+
+## Values
+
+| Name | Value |
+| ----- | ----- |
+| `EN` | en |
+| `DE` | de |
\ No newline at end of file
diff --git a/document/docs/models/operations/generatedocumentv2requestbodytemplatedocument.md b/document/docs/models/operations/generatedocumentv2requestbodytemplatedocument.md
new file mode 100755
index 000000000..7674cee01
--- /dev/null
+++ b/document/docs/models/operations/generatedocumentv2requestbodytemplatedocument.md
@@ -0,0 +1,11 @@
+# GenerateDocumentV2RequestBodyTemplateDocument
+
+Input template document
+
+
+## Fields
+
+| Field | Type | Required | Description | Example |
+| ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ |
+| `filename` | *Optional[str]* | :heavy_minus_sign: | Document original filename | my-template-{{order.order_number}}.docx |
+| `s3ref` | [Optional[shared.S3Reference]](../../models/shared/s3reference.md) | :heavy_minus_sign: | N/A | |
\ No newline at end of file
diff --git a/document/docs/models/operations/generatedocumentv2requestbodyvariablepayload.md b/document/docs/models/operations/generatedocumentv2requestbodyvariablepayload.md
new file mode 100755
index 000000000..5fe6c3ba6
--- /dev/null
+++ b/document/docs/models/operations/generatedocumentv2requestbodyvariablepayload.md
@@ -0,0 +1,10 @@
+# GenerateDocumentV2RequestBodyVariablePayload
+
+Custom values for variables in the template. Takes the higher precedence than others.
+
+
+## Fields
+
+| Field | Type | Required | Description |
+| ----------------------- | ----------------------- | ----------------------- | ----------------------- |
+| `additional_properties` | *Optional[str]* | :heavy_minus_sign: | N/A |
\ No newline at end of file
diff --git a/document/docs/models/operations/generatedocumentv2response.md b/document/docs/models/operations/generatedocumentv2response.md
new file mode 100755
index 000000000..3e1029823
--- /dev/null
+++ b/document/docs/models/operations/generatedocumentv2response.md
@@ -0,0 +1,11 @@
+# GenerateDocumentV2Response
+
+
+## Fields
+
+| Field | Type | Required | Description |
+| ----------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------- |
+| `content_type` | *str* | :heavy_check_mark: | HTTP response content type for this operation |
+| `status_code` | *int* | :heavy_check_mark: | HTTP response status code for this operation |
+| `raw_response` | [requests.Response](https://requests.readthedocs.io/en/latest/api/#requests.Response) | :heavy_minus_sign: | Raw HTTP response; suitable for custom response parsing |
+| `generate_document_v2_200_application_json_object` | [Optional[GenerateDocumentV2200ApplicationJSON]](../../models/operations/generatedocumentv2200applicationjson.md) | :heavy_minus_sign: | Generated document output |
\ No newline at end of file
diff --git a/document/docs/models/shared/s3reference.md b/document/docs/models/shared/s3reference.md
new file mode 100755
index 000000000..ef2fc6fcd
--- /dev/null
+++ b/document/docs/models/shared/s3reference.md
@@ -0,0 +1,9 @@
+# S3Reference
+
+
+## Fields
+
+| Field | Type | Required | Description | Example |
+| ----------------------- | ----------------------- | ----------------------- | ----------------------- | ----------------------- |
+| `bucket` | *str* | :heavy_check_mark: | N/A | document-api-prod |
+| `key` | *str* | :heavy_check_mark: | N/A | uploads/my-template.pdf |
\ No newline at end of file
diff --git a/document/docs/models/shared/security.md b/document/docs/models/shared/security.md
new file mode 100755
index 000000000..f06333390
--- /dev/null
+++ b/document/docs/models/shared/security.md
@@ -0,0 +1,8 @@
+# Security
+
+
+## Fields
+
+| Field | Type | Required | Description | Example |
+| ------------------ | ------------------ | ------------------ | ------------------ | ------------------ |
+| `epilot_auth` | *str* | :heavy_check_mark: | N/A | |
\ No newline at end of file
diff --git a/document/docs/sdks/documents/README.md b/document/docs/sdks/documents/README.md
new file mode 100755
index 000000000..cf27a78cb
--- /dev/null
+++ b/document/docs/sdks/documents/README.md
@@ -0,0 +1,129 @@
+# Documents
+(*documents*)
+
+## Overview
+
+Document Generation
+
+### Available Operations
+
+* [generate_document](#generate_document) - generateDocument
+* [generate_document_v2](#generate_document_v2) - generateDocumentV2
+
+## generate_document
+
+Builds document generated from input document with variables.
+
+Supported input document types:
+- .docx
+
+Supported output document types:
+- .pdf
+
+Uses [Template Variables API](https://docs.epilot.io/api/template-variables) to replace variables in the document.
+
+
+### Example Usage
+
+```python
+import epilot
+from epilot.models import operations, shared
+
+s = epilot.Epilot(
+ security=shared.Security(
+ epilot_auth="",
+ ),
+)
+
+req = operations.GenerateDocumentRequestBody(
+ context_entity_id='bcd0aab9-b544-42b0-8bfb-6d449d02eacc',
+ language='de',
+ template_document=operations.GenerateDocumentRequestBodyTemplateDocument(
+ filename='my-template-{{order.order_number}}.docx',
+ s3ref=shared.S3Reference(
+ bucket='document-api-prod',
+ key='uploads/my-template.pdf',
+ ),
+ ),
+ user_id='100321',
+)
+
+res = s.documents.generate_document(req)
+
+if res.generate_document_200_application_json_object is not None:
+ # handle response
+ pass
+```
+
+### Parameters
+
+| Parameter | Type | Required | Description |
+| ------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------ |
+| `request` | [operations.GenerateDocumentRequestBody](../../models/operations/generatedocumentrequestbody.md) | :heavy_check_mark: | The request object to use for the request. |
+
+
+### Response
+
+**[operations.GenerateDocumentResponse](../../models/operations/generatedocumentresponse.md)**
+
+
+## generate_document_v2
+
+Builds document generated from input document with variables.
+
+Supported input document types:
+- .docx
+
+Supported output document types:
+- .pdf
+- .docx but limited to only text based variables
+
+Uses [Template Variables API](https://docs.epilot.io/api/template-variables) to replace variables in the document.
+
+
+### Example Usage
+
+```python
+import epilot
+from epilot.models import operations, shared
+
+s = epilot.Epilot(
+ security=shared.Security(
+ epilot_auth="",
+ ),
+)
+
+req = operations.GenerateDocumentV2Request(
+ request_body=operations.GenerateDocumentV2RequestBody(
+ context_entity_id='bcd0aab9-b544-42b0-8bfb-6d449d02eacc',
+ language=operations.GenerateDocumentV2RequestBodyLanguage.DE,
+ template_document=operations.GenerateDocumentV2RequestBodyTemplateDocument(
+ filename='my-template-{{order.order_number}}.docx',
+ s3ref=shared.S3Reference(
+ bucket='document-api-prod',
+ key='uploads/my-template.pdf',
+ ),
+ ),
+ user_id='100321',
+ variable_payload=operations.GenerateDocumentV2RequestBodyVariablePayload(),
+ ),
+)
+
+res = s.documents.generate_document_v2(req)
+
+if res.generate_document_v2_200_application_json_object is not None:
+ # handle response
+ pass
+```
+
+### Parameters
+
+| Parameter | Type | Required | Description |
+| -------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------- |
+| `request` | [operations.GenerateDocumentV2Request](../../models/operations/generatedocumentv2request.md) | :heavy_check_mark: | The request object to use for the request. |
+
+
+### Response
+
+**[operations.GenerateDocumentV2Response](../../models/operations/generatedocumentv2response.md)**
+
diff --git a/document/docs/sdks/epilot/README.md b/document/docs/sdks/epilot/README.md
new file mode 100755
index 000000000..3fa583376
--- /dev/null
+++ b/document/docs/sdks/epilot/README.md
@@ -0,0 +1,12 @@
+# Epilot SDK
+
+
+## Overview
+
+Document API: Generate documents with epilot data
+
+[Feature Documentation](https://docs.epilot.io/docs/files/document-generation)
+
+
+### Available Operations
+
diff --git a/document/files.gen b/document/files.gen
index a629947ca..0d5b5f59f 100755
--- a/document/files.gen
+++ b/document/files.gen
@@ -1,15 +1,43 @@
+src/epilot/sdkconfiguration.py
src/epilot/documents.py
src/epilot/sdk.py
pylintrc
setup.py
src/epilot/__init__.py
src/epilot/models/__init__.py
+src/epilot/models/errors/sdkerror.py
src/epilot/utils/__init__.py
src/epilot/utils/retries.py
src/epilot/utils/utils.py
src/epilot/models/operations/generatedocument.py
+src/epilot/models/operations/generatedocumentv2.py
src/epilot/models/operations/__init__.py
src/epilot/models/shared/s3reference.py
src/epilot/models/shared/security.py
src/epilot/models/shared/__init__.py
-USAGE.md
\ No newline at end of file
+src/epilot/models/errors/__init__.py
+USAGE.md
+docs/models/operations/generatedocumentrequestbodytemplatedocument.md
+docs/models/operations/generatedocumentrequestbody.md
+docs/models/operations/generatedocument200applicationjsonoutputdocument.md
+docs/models/operations/generatedocument200applicationjson.md
+docs/models/operations/generatedocumentresponse.md
+docs/models/operations/generatedocumentv2requestbodylanguage.md
+docs/models/operations/generatedocumentv2requestbodytemplatedocument.md
+docs/models/operations/generatedocumentv2requestbodyvariablepayload.md
+docs/models/operations/generatedocumentv2requestbody.md
+docs/models/operations/generatedocumentv2mode.md
+docs/models/operations/generatedocumentv2request.md
+docs/models/operations/generatedocumentv2200applicationjsondocxoutputoutputdocument.md
+docs/models/operations/generatedocumentv2200applicationjsondocxoutput.md
+docs/models/operations/generatedocumentv2200applicationjsonjobstatus.md
+docs/models/operations/generatedocumentv2200applicationjsonpdfoutputoutputdocument.md
+docs/models/operations/generatedocumentv2200applicationjsonpdfoutput.md
+docs/models/operations/generatedocumentv2200applicationjsonvariablepayload.md
+docs/models/operations/generatedocumentv2200applicationjson.md
+docs/models/operations/generatedocumentv2response.md
+docs/models/shared/s3reference.md
+docs/models/shared/security.md
+docs/sdks/epilot/README.md
+docs/sdks/documents/README.md
+.gitattributes
\ No newline at end of file
diff --git a/document/gen.yaml b/document/gen.yaml
index 6da6ae8fe..4535c4225 100644
--- a/document/gen.yaml
+++ b/document/gen.yaml
@@ -1,16 +1,25 @@
configVersion: 1.0.0
management:
- docChecksum: 8fe5464a1ad4d46ff34f4097ba4129f3
+ docChecksum: 6ac9612fc93de607d06a524eefab68ee
docVersion: 1.0.0
- speakeasyVersion: 1.19.2
- generationVersion: 2.16.5
+ speakeasyVersion: 1.109.0
+ generationVersion: 2.173.0
generation:
- telemetryEnabled: false
+ repoURL: https://github.com/epilot-dev/sdk-python.git
sdkClassName: epilot
- sdkFlattening: true
singleTagPerOp: false
+ telemetryEnabled: false
+features:
+ python:
+ core: 3.3.1
+ globalSecurity: 2.82.0
+ globalServerURLs: 2.82.0
python:
- version: 1.2.2
+ version: 2.1.1
author: epilot
description: Python Client SDK for Epilot
+ flattenGlobalSecurity: false
+ installationURL: https://github.com/epilot-dev/sdk-python.git#subdirectory=document
+ maxMethodParams: 0
packageName: epilot-document
+ repoSubDirectory: document
diff --git a/document/pylintrc b/document/pylintrc
index 81c63b93f..d5760436d 100755
--- a/document/pylintrc
+++ b/document/pylintrc
@@ -88,7 +88,7 @@ persistent=yes
# Minimum Python version to use for version dependent checks. Will default to
# the version used to run pylint.
-py-version=3.9
+py-version=3.8
# Discover python modules and packages in the file system subtree.
recursive=no
@@ -116,20 +116,15 @@ argument-naming-style=snake_case
#argument-rgx=
# Naming style matching correct attribute names.
-attr-naming-style=snake_case
+#attr-naming-style=snake_case
# Regular expression matching correct attribute names. Overrides attr-naming-
# style. If left empty, attribute names will be checked with the set naming
# style.
-#attr-rgx=
+attr-rgx=[^\W\d][^\W]*|__.*__$
# Bad variable names which should always be refused, separated by a comma.
-bad-names=foo,
- bar,
- baz,
- toto,
- tutu,
- tata
+bad-names=
# Bad variable names regexes, separated by a comma. If names match any regex,
# they will always be refused
@@ -438,7 +433,13 @@ disable=raw-checker-failed,
trailing-newlines,
too-many-public-methods,
too-many-locals,
- too-many-lines
+ too-many-lines,
+ using-constant-test,
+ too-many-statements,
+ cyclic-import,
+ too-many-nested-blocks,
+ too-many-boolean-expressions,
+ no-else-raise
# Enable the message, report, category or checker with the given id(s). You can
# either give multiple identifier separated by comma (,) or put this option
@@ -619,7 +620,7 @@ additional-builtins=
allow-global-unused-variables=yes
# List of names allowed to shadow builtins
-allowed-redefined-builtins=
+allowed-redefined-builtins=id,object
# List of strings which can identify a callback function by name. A callback
# name must start or end with one of those strings.
diff --git a/document/setup.py b/document/setup.py
index 965ca9e0f..e48b9d27a 100755
--- a/document/setup.py
+++ b/document/setup.py
@@ -10,30 +10,31 @@
setuptools.setup(
name="epilot-document",
- version="1.2.2",
+ version="2.1.1",
author="epilot",
description="Python Client SDK for Epilot",
long_description=long_description,
long_description_content_type="text/markdown",
packages=setuptools.find_packages(where="src"),
install_requires=[
- "certifi==2022.12.07",
- "charset-normalizer==2.1.1",
- "dataclasses-json-speakeasy==0.5.8",
- "idna==3.3",
- "marshmallow==3.17.1",
- "marshmallow-enum==1.5.1",
- "mypy-extensions==0.4.3",
- "packaging==21.3",
- "pyparsing==3.0.9",
- "python-dateutil==2.8.2",
- "requests==2.28.1",
- "six==1.16.0",
- "typing-inspect==0.8.0",
- "typing_extensions==4.3.0",
- "urllib3==1.26.12",
- "pylint==2.16.2",
+ "certifi>=2023.7.22",
+ "charset-normalizer>=3.2.0",
+ "dataclasses-json>=0.6.1",
+ "idna>=3.4",
+ "jsonpath-python>=1.0.6 ",
+ "marshmallow>=3.19.0",
+ "mypy-extensions>=1.0.0",
+ "packaging>=23.1",
+ "python-dateutil>=2.8.2",
+ "requests>=2.31.0",
+ "six>=1.16.0",
+ "typing-inspect>=0.9.0",
+ "typing_extensions>=4.7.1",
+ "urllib3>=2.0.4",
],
+ extras_require={
+ "dev":["pylint==2.16.2"]
+ },
package_dir={'': 'src'},
- python_requires='>=3.9'
+ python_requires='>=3.8'
)
diff --git a/document/src/epilot/__init__.py b/document/src/epilot/__init__.py
index b9e232018..e6c0deeb6 100755
--- a/document/src/epilot/__init__.py
+++ b/document/src/epilot/__init__.py
@@ -1,3 +1,4 @@
"""Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT."""
from .sdk import *
+from .sdkconfiguration import *
diff --git a/document/src/epilot/documents.py b/document/src/epilot/documents.py
index 9ae2c0b45..14d8855c5 100755
--- a/document/src/epilot/documents.py
+++ b/document/src/epilot/documents.py
@@ -1,50 +1,41 @@
"""Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT."""
-import requests as requests_http
-from . import utils
-from epilot.models import operations
+from .sdkconfiguration import SDKConfiguration
+from epilot import utils
+from epilot.models import errors, operations
from typing import Optional
class Documents:
r"""Document Generation"""
- _client: requests_http.Session
- _security_client: requests_http.Session
- _server_url: str
- _language: str
- _sdk_version: str
- _gen_version: str
-
- def __init__(self, client: requests_http.Session, security_client: requests_http.Session, server_url: str, language: str, sdk_version: str, gen_version: str) -> None:
- self._client = client
- self._security_client = security_client
- self._server_url = server_url
- self._language = language
- self._sdk_version = sdk_version
- self._gen_version = gen_version
+ sdk_configuration: SDKConfiguration
+
+ def __init__(self, sdk_config: SDKConfiguration) -> None:
+ self.sdk_configuration = sdk_config
+
def generate_document(self, request: operations.GenerateDocumentRequestBody) -> operations.GenerateDocumentResponse:
r"""generateDocument
Builds document generated from input document with variables.
-
+
Supported input document types:
- .docx
-
+
Supported output document types:
- .pdf
-
+
Uses [Template Variables API](https://docs.epilot.io/api/template-variables) to replace variables in the document.
-
"""
- base_url = self._server_url
-
- url = base_url.removesuffix('/') + '/v1/documents:generate'
+ base_url = utils.template_url(*self.sdk_configuration.get_server_details())
+ url = base_url + '/v1/documents:generate'
headers = {}
- req_content_type, data, form = utils.serialize_request_body(request, "request", 'json')
+ req_content_type, data, form = utils.serialize_request_body(request, "request", False, True, 'json')
if req_content_type not in ('multipart/form-data', 'multipart/mixed'):
headers['content-type'] = req_content_type
+ headers['Accept'] = 'application/json'
+ headers['user-agent'] = self.sdk_configuration.user_agent
- client = self._security_client
+ client = self.sdk_configuration.security_client
http_res = client.request('POST', url, data=data, files=form, headers=headers)
content_type = http_res.headers.get('Content-Type')
@@ -55,6 +46,49 @@ def generate_document(self, request: operations.GenerateDocumentRequestBody) ->
if utils.match_content_type(content_type, 'application/json'):
out = utils.unmarshal_json(http_res.text, Optional[operations.GenerateDocument200ApplicationJSON])
res.generate_document_200_application_json_object = out
+ else:
+ raise errors.SDKError(f'unknown content-type received: {content_type}', http_res.status_code, http_res.text, http_res)
+
+ return res
+
+
+ def generate_document_v2(self, request: operations.GenerateDocumentV2Request) -> operations.GenerateDocumentV2Response:
+ r"""generateDocumentV2
+ Builds document generated from input document with variables.
+
+ Supported input document types:
+ - .docx
+
+ Supported output document types:
+ - .pdf
+ - .docx but limited to only text based variables
+
+ Uses [Template Variables API](https://docs.epilot.io/api/template-variables) to replace variables in the document.
+ """
+ base_url = utils.template_url(*self.sdk_configuration.get_server_details())
+
+ url = base_url + '/v2/documents:generate'
+ headers = {}
+ req_content_type, data, form = utils.serialize_request_body(request, "request_body", False, True, 'json')
+ if req_content_type not in ('multipart/form-data', 'multipart/mixed'):
+ headers['content-type'] = req_content_type
+ query_params = utils.get_query_params(operations.GenerateDocumentV2Request, request)
+ headers['Accept'] = 'application/json'
+ headers['user-agent'] = self.sdk_configuration.user_agent
+
+ client = self.sdk_configuration.security_client
+
+ http_res = client.request('POST', url, params=query_params, data=data, files=form, headers=headers)
+ content_type = http_res.headers.get('Content-Type')
+
+ res = operations.GenerateDocumentV2Response(status_code=http_res.status_code, content_type=content_type, raw_response=http_res)
+
+ if http_res.status_code == 200:
+ if utils.match_content_type(content_type, 'application/json'):
+ out = utils.unmarshal_json(http_res.text, Optional[operations.GenerateDocumentV2200ApplicationJSON])
+ res.generate_document_v2_200_application_json_object = out
+ else:
+ raise errors.SDKError(f'unknown content-type received: {content_type}', http_res.status_code, http_res.text, http_res)
return res
diff --git a/document/src/epilot/models/__init__.py b/document/src/epilot/models/__init__.py
index 889f8adcf..36628d6cc 100755
--- a/document/src/epilot/models/__init__.py
+++ b/document/src/epilot/models/__init__.py
@@ -1,2 +1,3 @@
"""Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT."""
+# __init__.py
diff --git a/document/src/epilot/models/errors/__init__.py b/document/src/epilot/models/errors/__init__.py
new file mode 100755
index 000000000..cfd848441
--- /dev/null
+++ b/document/src/epilot/models/errors/__init__.py
@@ -0,0 +1,4 @@
+"""Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT."""
+
+from .sdkerror import SDKError
+__all__ = ["SDKError"]
diff --git a/document/src/epilot/models/errors/sdkerror.py b/document/src/epilot/models/errors/sdkerror.py
new file mode 100755
index 000000000..6bb02bbd6
--- /dev/null
+++ b/document/src/epilot/models/errors/sdkerror.py
@@ -0,0 +1,24 @@
+"""Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT."""
+
+import requests as requests_http
+
+
+class SDKError(Exception):
+ """Represents an error returned by the API."""
+ message: str
+ status_code: int
+ body: str
+ raw_response: requests_http.Response
+
+ def __init__(self, message: str, status_code: int, body: str, raw_response: requests_http.Response):
+ self.message = message
+ self.status_code = status_code
+ self.body = body
+ self.raw_response = raw_response
+
+ def __str__(self):
+ body = ''
+ if len(self.body) > 0:
+ body = f'\n{self.body}'
+
+ return f'{self.message}: Status {self.status_code}{body}'
diff --git a/document/src/epilot/models/operations/__init__.py b/document/src/epilot/models/operations/__init__.py
index 6e6164cc2..ba2e489b1 100755
--- a/document/src/epilot/models/operations/__init__.py
+++ b/document/src/epilot/models/operations/__init__.py
@@ -1,5 +1,6 @@
"""Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT."""
from .generatedocument import *
+from .generatedocumentv2 import *
-__all__ = ["GenerateDocument200ApplicationJSON","GenerateDocument200ApplicationJSONOutputDocument","GenerateDocumentRequestBody","GenerateDocumentRequestBodyTemplateDocument","GenerateDocumentResponse"]
+__all__ = ["GenerateDocument200ApplicationJSON","GenerateDocument200ApplicationJSONOutputDocument","GenerateDocumentRequestBody","GenerateDocumentRequestBodyTemplateDocument","GenerateDocumentResponse","GenerateDocumentV2200ApplicationJSON","GenerateDocumentV2200ApplicationJSONDocxOutput","GenerateDocumentV2200ApplicationJSONDocxOutputOutputDocument","GenerateDocumentV2200ApplicationJSONJobStatus","GenerateDocumentV2200ApplicationJSONPdfOutput","GenerateDocumentV2200ApplicationJSONPdfOutputOutputDocument","GenerateDocumentV2200ApplicationJSONVariablePayload","GenerateDocumentV2Mode","GenerateDocumentV2Request","GenerateDocumentV2RequestBody","GenerateDocumentV2RequestBodyLanguage","GenerateDocumentV2RequestBodyTemplateDocument","GenerateDocumentV2RequestBodyVariablePayload","GenerateDocumentV2Response"]
diff --git a/document/src/epilot/models/operations/generatedocument.py b/document/src/epilot/models/operations/generatedocument.py
index 903edcef8..f123343ba 100755
--- a/document/src/epilot/models/operations/generatedocument.py
+++ b/document/src/epilot/models/operations/generatedocument.py
@@ -13,51 +13,58 @@
@dataclasses.dataclass
class GenerateDocumentRequestBodyTemplateDocument:
r"""Input template document"""
-
filename: Optional[str] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('filename'), 'exclude': lambda f: f is None }})
- r"""Document original filename"""
- s3ref: Optional[shared_s3reference.S3Reference] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('s3ref'), 'exclude': lambda f: f is None }})
+ r"""Document original filename"""
+ s3ref: Optional[shared_s3reference.S3Reference] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('s3ref'), 'exclude': lambda f: f is None }})
+
+
@dataclass_json(undefined=Undefined.EXCLUDE)
@dataclasses.dataclass
class GenerateDocumentRequestBody:
-
template_document: GenerateDocumentRequestBodyTemplateDocument = dataclasses.field(metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('template_document') }})
- r"""Input template document"""
+ r"""Input template document"""
context_entity_id: Optional[str] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('context_entity_id'), 'exclude': lambda f: f is None }})
- r"""Entity to use for variable context"""
- language: Optional[str] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('language'), 'exclude': lambda f: f is None }})
- r"""Language to use"""
+ r"""Entity to use for variable context"""
+ language: Optional[str] = dataclasses.field(default='en', metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('language'), 'exclude': lambda f: f is None }})
+ r"""Language to use"""
user_id: Optional[str] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('user_id'), 'exclude': lambda f: f is None }})
- r"""User Id for variable context"""
+ r"""User Id for variable context"""
+
+
@dataclass_json(undefined=Undefined.EXCLUDE)
@dataclasses.dataclass
class GenerateDocument200ApplicationJSONOutputDocument:
-
filename: Optional[str] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('filename'), 'exclude': lambda f: f is None }})
- r"""Generated document filename"""
- s3ref: Optional[shared_s3reference.S3Reference] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('s3ref'), 'exclude': lambda f: f is None }})
+ r"""Generated document filename"""
+ s3ref: Optional[shared_s3reference.S3Reference] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('s3ref'), 'exclude': lambda f: f is None }})
+
+
@dataclass_json(undefined=Undefined.EXCLUDE)
@dataclasses.dataclass
class GenerateDocument200ApplicationJSON:
r"""Generated document output"""
-
- output_document: Optional[GenerateDocument200ApplicationJSONOutputDocument] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('output_document'), 'exclude': lambda f: f is None }})
+ output_document: Optional[GenerateDocument200ApplicationJSONOutputDocument] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('output_document'), 'exclude': lambda f: f is None }})
preview_url: Optional[str] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('preview_url'), 'exclude': lambda f: f is None }})
- r"""Pre-signed S3 GET URL for preview"""
+ r"""Pre-signed S3 GET URL for preview"""
+
+
@dataclasses.dataclass
class GenerateDocumentResponse:
-
- content_type: str = dataclasses.field()
- status_code: int = dataclasses.field()
+ content_type: str = dataclasses.field()
+ r"""HTTP response content type for this operation"""
+ status_code: int = dataclasses.field()
+ r"""HTTP response status code for this operation"""
generate_document_200_application_json_object: Optional[GenerateDocument200ApplicationJSON] = dataclasses.field(default=None)
- r"""Generated document output"""
- raw_response: Optional[requests_http.Response] = dataclasses.field(default=None)
-
\ No newline at end of file
+ r"""Generated document output"""
+ raw_response: Optional[requests_http.Response] = dataclasses.field(default=None)
+ r"""Raw HTTP response; suitable for custom response parsing"""
+
+
diff --git a/document/src/epilot/models/operations/generatedocumentv2.py b/document/src/epilot/models/operations/generatedocumentv2.py
new file mode 100755
index 000000000..119785aaf
--- /dev/null
+++ b/document/src/epilot/models/operations/generatedocumentv2.py
@@ -0,0 +1,161 @@
+"""Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT."""
+
+from __future__ import annotations
+import dataclasses
+import requests as requests_http
+from ..shared import s3reference as shared_s3reference
+from dataclasses_json import Undefined, dataclass_json
+from enum import Enum
+from epilot import utils
+from typing import Optional
+
+class GenerateDocumentV2RequestBodyLanguage(str, Enum):
+ r"""Language to use"""
+ EN = 'en'
+ DE = 'de'
+
+
+@dataclass_json(undefined=Undefined.EXCLUDE)
+@dataclasses.dataclass
+class GenerateDocumentV2RequestBodyTemplateDocument:
+ r"""Input template document"""
+ filename: Optional[str] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('filename'), 'exclude': lambda f: f is None }})
+ r"""Document original filename"""
+ s3ref: Optional[shared_s3reference.S3Reference] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('s3ref'), 'exclude': lambda f: f is None }})
+
+
+
+
+@dataclass_json(undefined=Undefined.EXCLUDE)
+@dataclasses.dataclass
+class GenerateDocumentV2RequestBodyVariablePayload:
+ r"""Custom values for variables in the template. Takes the higher precedence than others."""
+ additional_properties: Optional[str] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('additionalProperties'), 'exclude': lambda f: f is None }})
+
+
+
+
+@dataclass_json(undefined=Undefined.EXCLUDE)
+@dataclasses.dataclass
+class GenerateDocumentV2RequestBody:
+ template_document: GenerateDocumentV2RequestBodyTemplateDocument = dataclasses.field(metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('template_document') }})
+ r"""Input template document"""
+ context_entity_id: Optional[str] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('context_entity_id'), 'exclude': lambda f: f is None }})
+ r"""Entity to use for variable context"""
+ language: Optional[GenerateDocumentV2RequestBodyLanguage] = dataclasses.field(default=GenerateDocumentV2RequestBodyLanguage.EN, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('language'), 'exclude': lambda f: f is None }})
+ r"""Language to use"""
+ user_id: Optional[str] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('user_id'), 'exclude': lambda f: f is None }})
+ r"""User Id for variable context"""
+ variable_payload: Optional[GenerateDocumentV2RequestBodyVariablePayload] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('variable_payload'), 'exclude': lambda f: f is None }})
+ r"""Custom values for variables in the template. Takes the higher precedence than others."""
+
+
+
+class GenerateDocumentV2Mode(str, Enum):
+ r"""Type of mode used for document generation flow.
+ Partial - Will have a intermediate step for users to validate and replace the variable values before generating the final document.
+ Full - Goes through all the steps for the full generation of final document
+ """
+ PARTIAL_GENERATION = 'partial_generation'
+ FULL_GENERATION = 'full_generation'
+
+
+@dataclasses.dataclass
+class GenerateDocumentV2Request:
+ job_id: Optional[str] = dataclasses.field(default=None, metadata={'query_param': { 'field_name': 'job_id', 'style': 'form', 'explode': True }})
+ r"""Job ID for tracking the status of document generation action"""
+ mode: Optional[GenerateDocumentV2Mode] = dataclasses.field(default=GenerateDocumentV2Mode.undefined, metadata={'query_param': { 'field_name': 'mode', 'style': 'form', 'explode': True }})
+ r"""Type of mode used for document generation flow.
+ Partial - Will have a intermediate step for users to validate and replace the variable values before generating the final document.
+ Full - Goes through all the steps for the full generation of final document
+ """
+ request_body: Optional[GenerateDocumentV2RequestBody] = dataclasses.field(default=None, metadata={'request': { 'media_type': 'application/json' }})
+
+
+
+
+@dataclass_json(undefined=Undefined.EXCLUDE)
+@dataclasses.dataclass
+class GenerateDocumentV2200ApplicationJSONDocxOutputOutputDocument:
+ filename: Optional[str] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('filename'), 'exclude': lambda f: f is None }})
+ r"""Generated document filename for DOCX"""
+ s3ref: Optional[shared_s3reference.S3Reference] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('s3ref'), 'exclude': lambda f: f is None }})
+
+
+
+
+@dataclass_json(undefined=Undefined.EXCLUDE)
+@dataclasses.dataclass
+class GenerateDocumentV2200ApplicationJSONDocxOutput:
+ output_document: Optional[GenerateDocumentV2200ApplicationJSONDocxOutputOutputDocument] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('output_document'), 'exclude': lambda f: f is None }})
+ preview_url: Optional[str] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('preview_url'), 'exclude': lambda f: f is None }})
+ r"""Pre-signed S3 GET URL for DOCX preview"""
+
+
+
+class GenerateDocumentV2200ApplicationJSONJobStatus(str, Enum):
+ r"""Status of the job"""
+ STARTED = 'STARTED'
+ PROCESSING = 'PROCESSING'
+ SUCCESS = 'SUCCESS'
+ FAILED = 'FAILED'
+
+
+@dataclass_json(undefined=Undefined.EXCLUDE)
+@dataclasses.dataclass
+class GenerateDocumentV2200ApplicationJSONPdfOutputOutputDocument:
+ filename: Optional[str] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('filename'), 'exclude': lambda f: f is None }})
+ r"""Generated document filename for PDF"""
+ s3ref: Optional[shared_s3reference.S3Reference] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('s3ref'), 'exclude': lambda f: f is None }})
+
+
+
+
+@dataclass_json(undefined=Undefined.EXCLUDE)
+@dataclasses.dataclass
+class GenerateDocumentV2200ApplicationJSONPdfOutput:
+ output_document: Optional[GenerateDocumentV2200ApplicationJSONPdfOutputOutputDocument] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('output_document'), 'exclude': lambda f: f is None }})
+ preview_url: Optional[str] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('preview_url'), 'exclude': lambda f: f is None }})
+ r"""Pre-signed S3 GET URL for PDF preview"""
+
+
+
+
+@dataclass_json(undefined=Undefined.EXCLUDE)
+@dataclasses.dataclass
+class GenerateDocumentV2200ApplicationJSONVariablePayload:
+ r"""List of variables and its corresponding replaced values from the document template"""
+ additional_properties: Optional[str] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('additionalProperties'), 'exclude': lambda f: f is None }})
+
+
+
+
+@dataclass_json(undefined=Undefined.EXCLUDE)
+@dataclasses.dataclass
+class GenerateDocumentV2200ApplicationJSON:
+ r"""Generated document output"""
+ docx_output: Optional[GenerateDocumentV2200ApplicationJSONDocxOutput] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('docx_output'), 'exclude': lambda f: f is None }})
+ job_id: Optional[str] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('job_id'), 'exclude': lambda f: f is None }})
+ job_status: Optional[GenerateDocumentV2200ApplicationJSONJobStatus] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('job_status'), 'exclude': lambda f: f is None }})
+ r"""Status of the job"""
+ message: Optional[str] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('message'), 'exclude': lambda f: f is None }})
+ r"""A message explaining the progress"""
+ pdf_output: Optional[GenerateDocumentV2200ApplicationJSONPdfOutput] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('pdf_output'), 'exclude': lambda f: f is None }})
+ variable_payload: Optional[GenerateDocumentV2200ApplicationJSONVariablePayload] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('variable_payload'), 'exclude': lambda f: f is None }})
+ r"""List of variables and its corresponding replaced values from the document template"""
+
+
+
+
+@dataclasses.dataclass
+class GenerateDocumentV2Response:
+ content_type: str = dataclasses.field()
+ r"""HTTP response content type for this operation"""
+ status_code: int = dataclasses.field()
+ r"""HTTP response status code for this operation"""
+ generate_document_v2_200_application_json_object: Optional[GenerateDocumentV2200ApplicationJSON] = dataclasses.field(default=None)
+ r"""Generated document output"""
+ raw_response: Optional[requests_http.Response] = dataclasses.field(default=None)
+ r"""Raw HTTP response; suitable for custom response parsing"""
+
+
diff --git a/document/src/epilot/models/shared/s3reference.py b/document/src/epilot/models/shared/s3reference.py
index a6848b7e0..3be71c8e3 100755
--- a/document/src/epilot/models/shared/s3reference.py
+++ b/document/src/epilot/models/shared/s3reference.py
@@ -9,7 +9,7 @@
@dataclass_json(undefined=Undefined.EXCLUDE)
@dataclasses.dataclass
class S3Reference:
+ bucket: str = dataclasses.field(metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('bucket') }})
+ key: str = dataclasses.field(metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('key') }})
- bucket: str = dataclasses.field(metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('bucket') }})
- key: str = dataclasses.field(metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('key') }})
-
\ No newline at end of file
+
diff --git a/document/src/epilot/models/shared/security.py b/document/src/epilot/models/shared/security.py
index cca0d01c8..bb832caeb 100755
--- a/document/src/epilot/models/shared/security.py
+++ b/document/src/epilot/models/shared/security.py
@@ -6,6 +6,6 @@
@dataclasses.dataclass
class Security:
+ epilot_auth: str = dataclasses.field(metadata={'security': { 'scheme': True, 'type': 'http', 'sub_type': 'bearer', 'field_name': 'Authorization' }})
- epilot_auth: str = dataclasses.field(metadata={'security': { 'scheme': True, 'type': 'http', 'sub_type': 'bearer', 'field_name': 'Authorization' }})
-
\ No newline at end of file
+
diff --git a/document/src/epilot/sdk.py b/document/src/epilot/sdk.py
index 32052cc4b..55483d03b 100755
--- a/document/src/epilot/sdk.py
+++ b/document/src/epilot/sdk.py
@@ -1,73 +1,60 @@
"""Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT."""
import requests as requests_http
-from . import utils
from .documents import Documents
+from .sdkconfiguration import SDKConfiguration
+from epilot import utils
from epilot.models import shared
-
-SERVERS = [
- "https://document.sls.epilot.io",
-]
-"""Contains the list of servers available to the SDK"""
+from typing import Dict
class Epilot:
- r"""Generate documents with epilot data
-
+ r"""Document API: Generate documents with epilot data
+
[Feature Documentation](https://docs.epilot.io/docs/files/document-generation)
-
"""
documents: Documents
r"""Document Generation"""
- _client: requests_http.Session
- _security_client: requests_http.Session
- _server_url: str = SERVERS[0]
- _language: str = "python"
- _sdk_version: str = "1.2.2"
- _gen_version: str = "2.16.5"
+ sdk_configuration: SDKConfiguration
def __init__(self,
security: shared.Security = None,
+ server_idx: int = None,
server_url: str = None,
- url_params: dict[str, str] = None,
- client: requests_http.Session = None
+ url_params: Dict[str, str] = None,
+ client: requests_http.Session = None,
+ retry_config: utils.RetryConfig = None
) -> None:
"""Instantiates the SDK configuring it with the provided parameters.
:param security: The security details required for authentication
:type security: shared.Security
+ :param server_idx: The index of the server to use for all operations
+ :type server_idx: int
:param server_url: The server URL to use for all operations
:type server_url: str
:param url_params: Parameters to optionally template the server URL with
- :type url_params: dict[str, str]
+ :type url_params: Dict[str, str]
:param client: The requests.Session HTTP client to use for all operations
- :type client: requests_http.Session
+ :type client: requests_http.Session
+ :param retry_config: The utils.RetryConfig to use globally
+ :type retry_config: utils.RetryConfig
"""
- self._client = requests_http.Session()
+ if client is None:
+ client = requests_http.Session()
- if server_url is not None:
- if url_params is not None:
- self._server_url = utils.template_url(server_url, url_params)
- else:
- self._server_url = server_url
-
- if client is not None:
- self._client = client
+ security_client = utils.configure_security_client(client, security)
- self._security_client = utils.configure_security_client(self._client, security)
+ if server_url is not None:
+ if url_params is not None:
+ server_url = utils.template_url(server_url, url_params)
+ self.sdk_configuration = SDKConfiguration(client, security_client, server_url, server_idx, retry_config=retry_config)
+
self._init_sdks()
def _init_sdks(self):
- self.documents = Documents(
- self._client,
- self._security_client,
- self._server_url,
- self._language,
- self._sdk_version,
- self._gen_version
- )
-
+ self.documents = Documents(self.sdk_configuration)
\ No newline at end of file
diff --git a/document/src/epilot/sdkconfiguration.py b/document/src/epilot/sdkconfiguration.py
new file mode 100755
index 000000000..57a0b8773
--- /dev/null
+++ b/document/src/epilot/sdkconfiguration.py
@@ -0,0 +1,34 @@
+"""Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT."""
+
+import requests
+from dataclasses import dataclass
+from typing import Dict, Tuple
+from .utils.retries import RetryConfig
+from .utils import utils
+
+
+SERVERS = [
+ 'https://document.sls.epilot.io',
+]
+"""Contains the list of servers available to the SDK"""
+
+@dataclass
+class SDKConfiguration:
+ client: requests.Session
+ security_client: requests.Session
+ server_url: str = ''
+ server_idx: int = 0
+ language: str = 'python'
+ openapi_doc_version: str = '1.0.0'
+ sdk_version: str = '2.1.1'
+ gen_version: str = '2.173.0'
+ user_agent: str = 'speakeasy-sdk/python 2.1.1 2.173.0 1.0.0 epilot-document'
+ retry_config: RetryConfig = None
+
+ def get_server_details(self) -> Tuple[str, Dict[str, str]]:
+ if self.server_url:
+ return utils.remove_suffix(self.server_url, '/'), {}
+ if self.server_idx is None:
+ self.server_idx = 0
+
+ return SERVERS[self.server_idx], {}
diff --git a/document/src/epilot/utils/retries.py b/document/src/epilot/utils/retries.py
index c6251d948..25f49a1f2 100755
--- a/document/src/epilot/utils/retries.py
+++ b/document/src/epilot/utils/retries.py
@@ -2,6 +2,7 @@
import random
import time
+from typing import List
import requests
@@ -24,16 +25,17 @@ class RetryConfig:
backoff: BackoffStrategy
retry_connection_errors: bool
- def __init__(self, strategy: str, retry_connection_errors: bool):
+ def __init__(self, strategy: str, backoff: BackoffStrategy, retry_connection_errors: bool):
self.strategy = strategy
+ self.backoff = backoff
self.retry_connection_errors = retry_connection_errors
class Retries:
config: RetryConfig
- status_codes: list[str]
+ status_codes: List[str]
- def __init__(self, config: RetryConfig, status_codes: list[str]):
+ def __init__(self, config: RetryConfig, status_codes: List[str]):
self.config = config
self.status_codes = status_codes
diff --git a/document/src/epilot/utils/utils.py b/document/src/epilot/utils/utils.py
index 9d4fba324..3ab126104 100755
--- a/document/src/epilot/utils/utils.py
+++ b/document/src/epilot/utils/utils.py
@@ -3,11 +3,14 @@
import base64
import json
import re
+import sys
from dataclasses import Field, dataclass, fields, is_dataclass, make_dataclass
from datetime import date, datetime
+from decimal import Decimal
from email.message import Message
from enum import Enum
-from typing import Any, Callable, Optional, Tuple, Union, get_args, get_origin
+from typing import (Any, Callable, Dict, List, Optional, Tuple, Union,
+ get_args, get_origin)
from xmlrpc.client import boolean
import dateutil.parser
@@ -17,14 +20,14 @@
class SecurityClient:
client: requests.Session
- query_params: dict[str, str] = {}
+ query_params: Dict[str, str] = {}
def __init__(self, client: requests.Session):
self.client = client
def request(self, method, url, **kwargs):
params = kwargs.get('params', {})
- kwargs["params"] = self.query_params | params
+ kwargs["params"] = {**self.query_params, **params}
return self.client.request(method, url, **kwargs)
@@ -67,7 +70,7 @@ def _parse_security_option(client: SecurityClient, option: dataclass):
client, metadata, getattr(option, opt_field.name))
-def _parse_security_scheme(client: SecurityClient, scheme_metadata: dict, scheme: any):
+def _parse_security_scheme(client: SecurityClient, scheme_metadata: Dict, scheme: any):
scheme_type = scheme_metadata.get('type')
sub_type = scheme_metadata.get('sub_type')
@@ -91,7 +94,7 @@ def _parse_security_scheme(client: SecurityClient, scheme_metadata: dict, scheme
client, scheme_metadata, scheme_metadata, scheme)
-def _parse_security_scheme_value(client: SecurityClient, scheme_metadata: dict, security_metadata: dict, value: any):
+def _parse_security_scheme_value(client: SecurityClient, scheme_metadata: Dict, security_metadata: Dict, value: any):
scheme_type = scheme_metadata.get('type')
sub_type = scheme_metadata.get('sub_type')
@@ -112,7 +115,8 @@ def _parse_security_scheme_value(client: SecurityClient, scheme_metadata: dict,
client.client.headers[header_name] = value
elif scheme_type == 'http':
if sub_type == 'bearer':
- client.client.headers[header_name] = value
+ client.client.headers[header_name] = value.lower().startswith(
+ 'bearer ') and value or f'Bearer {value}'
else:
raise Exception('not supported')
else:
@@ -141,7 +145,8 @@ def _parse_basic_auth_scheme(client: SecurityClient, scheme: dataclass):
client.client.headers['Authorization'] = f'Basic {base64.b64encode(data).decode()}'
-def generate_url(clazz: type, server_url: str, path: str, path_params: dataclass, gbls: dict[str, dict[str, dict[str, Any]]] = None) -> str:
+def generate_url(clazz: type, server_url: str, path: str, path_params: dataclass,
+ gbls: Dict[str, Dict[str, Dict[str, Any]]] = None) -> str:
path_param_fields: Tuple[Field, ...] = fields(clazz)
for field in path_param_fields:
request_metadata = field.metadata.get('request')
@@ -152,71 +157,80 @@ def generate_url(clazz: type, server_url: str, path: str, path_params: dataclass
if param_metadata is None:
continue
- if param_metadata.get('style', 'simple') == 'simple':
- param = getattr(
- path_params, field.name) if path_params is not None else None
- param = _populate_from_globals(
- field.name, param, 'pathParam', gbls)
-
- if param is None:
- continue
-
- if isinstance(param, list):
- pp_vals: list[str] = []
- for pp_val in param:
- if pp_val is None:
- continue
- pp_vals.append(_val_to_string(pp_val))
- path = path.replace(
- '{' + param_metadata.get('field_name', field.name) + '}', ",".join(pp_vals), 1)
- elif isinstance(param, dict):
- pp_vals: list[str] = []
- for pp_key in param:
- if param[pp_key] is None:
- continue
- if param_metadata.get('explode'):
- pp_vals.append(
- f"{pp_key}={_val_to_string(param[pp_key])}")
- else:
- pp_vals.append(
- f"{pp_key},{_val_to_string(param[pp_key])}")
- path = path.replace(
- '{' + param_metadata.get('field_name', field.name) + '}', ",".join(pp_vals), 1)
- elif not isinstance(param, (str, int, float, complex, bool)):
- pp_vals: list[str] = []
- param_fields: Tuple[Field, ...] = fields(param)
- for param_field in param_fields:
- param_value_metadata = param_field.metadata.get(
- 'path_param')
- if not param_value_metadata:
- continue
+ param = getattr(
+ path_params, field.name) if path_params is not None else None
+ param = _populate_from_globals(
+ field.name, param, 'pathParam', gbls)
- parm_name = param_value_metadata.get(
- 'field_name', field.name)
+ if param is None:
+ continue
- param_field_val = getattr(param, param_field.name)
- if param_field_val is None:
- continue
- if param_metadata.get('explode'):
- pp_vals.append(
- f"{parm_name}={_val_to_string(param_field_val)}")
- else:
- pp_vals.append(
- f"{parm_name},{_val_to_string(param_field_val)}")
- path = path.replace(
- '{' + param_metadata.get('field_name', field.name) + '}', ",".join(pp_vals), 1)
- else:
+ f_name = param_metadata.get("field_name", field.name)
+ serialization = param_metadata.get('serialization', '')
+ if serialization != '':
+ serialized_params = _get_serialized_params(
+ param_metadata, f_name, param)
+ for key, value in serialized_params.items():
path = path.replace(
- '{' + param_metadata.get('field_name', field.name) + '}', _val_to_string(param), 1)
+ '{' + key + '}', value, 1)
+ else:
+ if param_metadata.get('style', 'simple') == 'simple':
+ if isinstance(param, List):
+ pp_vals: List[str] = []
+ for pp_val in param:
+ if pp_val is None:
+ continue
+ pp_vals.append(_val_to_string(pp_val))
+ path = path.replace(
+ '{' + param_metadata.get('field_name', field.name) + '}', ",".join(pp_vals), 1)
+ elif isinstance(param, Dict):
+ pp_vals: List[str] = []
+ for pp_key in param:
+ if param[pp_key] is None:
+ continue
+ if param_metadata.get('explode'):
+ pp_vals.append(
+ f"{pp_key}={_val_to_string(param[pp_key])}")
+ else:
+ pp_vals.append(
+ f"{pp_key},{_val_to_string(param[pp_key])}")
+ path = path.replace(
+ '{' + param_metadata.get('field_name', field.name) + '}', ",".join(pp_vals), 1)
+ elif not isinstance(param, (str, int, float, complex, bool, Decimal)):
+ pp_vals: List[str] = []
+ param_fields: Tuple[Field, ...] = fields(param)
+ for param_field in param_fields:
+ param_value_metadata = param_field.metadata.get(
+ 'path_param')
+ if not param_value_metadata:
+ continue
+
+ parm_name = param_value_metadata.get(
+ 'field_name', field.name)
+
+ param_field_val = getattr(param, param_field.name)
+ if param_field_val is None:
+ continue
+ if param_metadata.get('explode'):
+ pp_vals.append(
+ f"{parm_name}={_val_to_string(param_field_val)}")
+ else:
+ pp_vals.append(
+ f"{parm_name},{_val_to_string(param_field_val)}")
+ path = path.replace(
+ '{' + param_metadata.get('field_name', field.name) + '}', ",".join(pp_vals), 1)
+ else:
+ path = path.replace(
+ '{' + param_metadata.get('field_name', field.name) + '}', _val_to_string(param), 1)
- return server_url.removesuffix("/") + path
+ return remove_suffix(server_url, '/') + path
def is_optional(field):
return get_origin(field) is Union and type(None) in get_args(field)
-def template_url(url_with_params: str, params: dict[str, str]) -> str:
+def template_url(url_with_params: str, params: Dict[str, str]) -> str:
for key, value in params.items():
url_with_params = url_with_params.replace(
'{' + key + '}', value)
@@ -224,8 +238,9 @@ def template_url(url_with_params: str, params: dict[str, str]) -> str:
return url_with_params
-def get_query_params(clazz: type, query_params: dataclass, gbls: dict[str, dict[str, dict[str, Any]]] = None) -> dict[str, list[str]]:
- params: dict[str, list[str]] = {}
+def get_query_params(clazz: type, query_params: dataclass, gbls: Dict[str, Dict[str, Dict[str, Any]]] = None) -> Dict[
+ str, List[str]]:
+ params: Dict[str, List[str]] = {}
param_fields: Tuple[Field, ...] = fields(clazz)
for field in param_fields:
@@ -246,26 +261,33 @@ def get_query_params(clazz: type, query_params: dataclass, gbls: dict[str, dict[
f_name = metadata.get("field_name")
serialization = metadata.get('serialization', '')
if serialization != '':
- params = params | _get_serialized_query_params(
- metadata, f_name, value)
+ serialized_parms = _get_serialized_params(metadata, f_name, value)
+ for key, value in serialized_parms.items():
+ if key in params:
+ params[key].extend(value)
+ else:
+ params[key] = [value]
else:
style = metadata.get('style', 'form')
if style == 'deepObject':
- params = params | _get_deep_object_query_params(
- metadata, f_name, value)
+ params = {**params, **_get_deep_object_query_params(
+ metadata, f_name, value)}
elif style == 'form':
- params = params | _get_form_query_params(
- metadata, f_name, value)
+ params = {**params, **_get_delimited_query_params(
+ metadata, f_name, value, ",")}
+ elif style == 'pipeDelimited':
+ params = {**params, **_get_delimited_query_params(
+ metadata, f_name, value, "|")}
else:
raise Exception('not yet implemented')
return params
-def get_headers(headers_params: dataclass) -> dict[str, str]:
+def get_headers(headers_params: dataclass) -> Dict[str, str]:
if headers_params is None:
return {}
- headers: dict[str, str] = {}
+ headers: Dict[str, str] = {}
param_fields: Tuple[Field, ...] = fields(headers_params)
for field in param_fields:
@@ -282,8 +304,8 @@ def get_headers(headers_params: dataclass) -> dict[str, str]:
return headers
-def _get_serialized_query_params(metadata: dict, field_name: str, obj: any) -> dict[str, list[str]]:
- params: dict[str, list[str]] = {}
+def _get_serialized_params(metadata: Dict, field_name: str, obj: any) -> Dict[str, str]:
+ params: Dict[str, str] = {}
serialization = metadata.get('serialization', '')
if serialization == 'json':
@@ -292,8 +314,8 @@ def _get_serialized_query_params(metadata: dict, field_name: str, obj: any) -> d
return params
-def _get_deep_object_query_params(metadata: dict, field_name: str, obj: any) -> dict[str, list[str]]:
- params: dict[str, list[str]] = {}
+def _get_deep_object_query_params(metadata: Dict, field_name: str, obj: any) -> Dict[str, List[str]]:
+ params: Dict[str, List[str]] = {}
if obj is None:
return params
@@ -309,27 +331,30 @@ def _get_deep_object_query_params(metadata: dict, field_name: str, obj: any) ->
if obj_val is None:
continue
- if isinstance(obj_val, list):
+ if isinstance(obj_val, List):
for val in obj_val:
if val is None:
continue
- if params.get(f'{metadata.get("field_name", field_name)}[{obj_param_metadata.get("field_name", obj_field.name)}]') is None:
- params[f'{metadata.get("field_name", field_name)}[{obj_param_metadata.get("field_name", obj_field.name)}]'] = [
+ if params.get(
+ f'{metadata.get("field_name", field_name)}[{obj_param_metadata.get("field_name", obj_field.name)}]') is None:
+ params[
+ f'{metadata.get("field_name", field_name)}[{obj_param_metadata.get("field_name", obj_field.name)}]'] = [
]
params[
- f'{metadata.get("field_name", field_name)}[{obj_param_metadata.get("field_name", obj_field.name)}]'].append(_val_to_string(val))
+ f'{metadata.get("field_name", field_name)}[{obj_param_metadata.get("field_name", obj_field.name)}]'].append(
+ _val_to_string(val))
else:
params[
f'{metadata.get("field_name", field_name)}[{obj_param_metadata.get("field_name", obj_field.name)}]'] = [
_val_to_string(obj_val)]
- elif isinstance(obj, dict):
+ elif isinstance(obj, Dict):
for key, value in obj.items():
if value is None:
continue
- if isinstance(value, list):
+ if isinstance(value, List):
for val in value:
if val is None:
continue
@@ -355,28 +380,36 @@ def _get_query_param_field_name(obj_field: Field) -> str:
return obj_param_metadata.get("field_name", obj_field.name)
-def _get_form_query_params(metadata: dict, field_name: str, obj: any) -> dict[str, list[str]]:
- return _populate_form(field_name, metadata.get("explode", True), obj, _get_query_param_field_name)
+def _get_delimited_query_params(metadata: Dict, field_name: str, obj: any, delimiter: str) -> Dict[
+ str, List[str]]:
+ return _populate_form(field_name, metadata.get("explode", True), obj, _get_query_param_field_name, delimiter)
SERIALIZATION_METHOD_TO_CONTENT_TYPE = {
- 'json': 'application/json',
- 'form': 'application/x-www-form-urlencoded',
+ 'json': 'application/json',
+ 'form': 'application/x-www-form-urlencoded',
'multipart': 'multipart/form-data',
- 'raw': 'application/octet-stream',
- 'string': 'text/plain',
+ 'raw': 'application/octet-stream',
+ 'string': 'text/plain',
}
-def serialize_request_body(request: dataclass, request_field_name: str, serialization_method: str) -> Tuple[str, any, any]:
+def serialize_request_body(request: dataclass, request_field_name: str, nullable: bool, optional: bool, serialization_method: str, encoder=None) -> Tuple[
+ str, any, any]:
if request is None:
- return None, None, None, None
+ if not nullable and optional:
+ return None, None, None
if not is_dataclass(request) or not hasattr(request, request_field_name):
- return serialize_content_type(request_field_name, SERIALIZATION_METHOD_TO_CONTENT_TYPE[serialization_method], request)
+ return serialize_content_type(request_field_name, SERIALIZATION_METHOD_TO_CONTENT_TYPE[serialization_method],
+ request, encoder)
request_val = getattr(request, request_field_name)
+ if request_val is None:
+ if not nullable and optional:
+ return None, None, None
+
request_fields: Tuple[Field, ...] = fields(request)
request_metadata = None
@@ -388,12 +421,13 @@ def serialize_request_body(request: dataclass, request_field_name: str, serializ
if request_metadata is None:
raise Exception('invalid request type')
- return serialize_content_type(request_field_name, request_metadata.get('media_type', 'application/octet-stream'), request_val)
+ return serialize_content_type(request_field_name, request_metadata.get('media_type', 'application/octet-stream'),
+ request_val)
-def serialize_content_type(field_name: str, media_type: str, request: dataclass) -> Tuple[str, any, list[list[any]]]:
+def serialize_content_type(field_name: str, media_type: str, request: dataclass, encoder=None) -> Tuple[str, any, List[List[any]]]:
if re.match(r'(application|text)\/.*?\+*json.*', media_type) is not None:
- return media_type, marshal_json(request), None
+ return media_type, marshal_json(request, encoder), None
if re.match(r'multipart\/.*', media_type) is not None:
return serialize_multipart_form(media_type, request)
if re.match(r'application\/x-www-form-urlencoded.*', media_type) is not None:
@@ -407,8 +441,8 @@ def serialize_content_type(field_name: str, media_type: str, request: dataclass)
f"invalid request body type {type(request)} for mediaType {media_type}")
-def serialize_multipart_form(media_type: str, request: dataclass) -> Tuple[str, any, list[list[any]]]:
- form: list[list[any]] = []
+def serialize_multipart_form(media_type: str, request: dataclass) -> Tuple[str, any, List[List[any]]]:
+ form: List[List[any]] = []
request_fields = fields(request)
for field in request_fields:
@@ -449,7 +483,7 @@ def serialize_multipart_form(media_type: str, request: dataclass) -> Tuple[str,
else:
field_name = field_metadata.get(
"field_name", field.name)
- if isinstance(val, list):
+ if isinstance(val, List):
for value in val:
if value is None:
continue
@@ -460,8 +494,8 @@ def serialize_multipart_form(media_type: str, request: dataclass) -> Tuple[str,
return media_type, None, form
-def serialize_dict(original: dict, explode: bool, field_name, existing: Optional[dict[str, list[str]]]) -> dict[
- str, list[str]]:
+def serialize_dict(original: Dict, explode: bool, field_name, existing: Optional[Dict[str, List[str]]]) -> Dict[
+ str, List[str]]:
if existing is None:
existing = []
@@ -481,8 +515,8 @@ def serialize_dict(original: dict, explode: bool, field_name, existing: Optional
return existing
-def serialize_form_data(field_name: str, data: dataclass) -> dict[str, any]:
- form: dict[str, list[str]] = {}
+def serialize_form_data(field_name: str, data: dataclass) -> Dict[str, any]:
+ form: Dict[str, List[str]] = {}
if is_dataclass(data):
for field in fields(data):
@@ -500,12 +534,12 @@ def serialize_form_data(field_name: str, data: dataclass) -> dict[str, any]:
form[field_name] = [marshal_json(val)]
else:
if metadata.get('style', 'form') == 'form':
- form = form | _populate_form(
- field_name, metadata.get('explode', True), val, _get_form_field_name)
+ form = {**form, **_populate_form(
+ field_name, metadata.get('explode', True), val, _get_form_field_name, ",")}
else:
raise Exception(
f'Invalid form style for field {field.name}')
- elif isinstance(data, dict):
+ elif isinstance(data, Dict):
for key, value in data.items():
form[key] = [_val_to_string(value)]
else:
@@ -523,8 +557,9 @@ def _get_form_field_name(obj_field: Field) -> str:
return obj_param_metadata.get("field_name", obj_field.name)
-def _populate_form(field_name: str, explode: boolean, obj: any, get_field_name_func: Callable) -> dict[str, list[str]]:
- params: dict[str, list[str]] = {}
+def _populate_form(field_name: str, explode: boolean, obj: any, get_field_name_func: Callable, delimiter: str) -> \
+ Dict[str, List[str]]:
+ params: Dict[str, List[str]] = {}
if obj is None:
return params
@@ -546,11 +581,11 @@ def _populate_form(field_name: str, explode: boolean, obj: any, get_field_name_f
params[obj_field_name] = [_val_to_string(val)]
else:
items.append(
- f'{obj_field_name},{_val_to_string(val)}')
+ f'{obj_field_name}{delimiter}{_val_to_string(val)}')
if len(items) > 0:
- params[field_name] = [','.join(items)]
- elif isinstance(obj, dict):
+ params[field_name] = [delimiter.join(items)]
+ elif isinstance(obj, Dict):
items = []
for key, value in obj.items():
if value is None:
@@ -559,11 +594,11 @@ def _populate_form(field_name: str, explode: boolean, obj: any, get_field_name_f
if explode:
params[key] = _val_to_string(value)
else:
- items.append(f'{key},{_val_to_string(value)}')
+ items.append(f'{key}{delimiter}{_val_to_string(value)}')
if len(items) > 0:
- params[field_name] = [','.join(items)]
- elif isinstance(obj, list):
+ params[field_name] = [delimiter.join(items)]
+ elif isinstance(obj, List):
items = []
for value in obj:
@@ -578,7 +613,8 @@ def _populate_form(field_name: str, explode: boolean, obj: any, get_field_name_f
items.append(_val_to_string(value))
if len(items) > 0:
- params[field_name] = [','.join([str(item) for item in items])]
+ params[field_name] = [delimiter.join(
+ [str(item) for item in items])]
else:
params[field_name] = [_val_to_string(obj)]
@@ -616,7 +652,7 @@ def _serialize_header(explode: bool, obj: any) -> str:
if len(items) > 0:
return ','.join(items)
- elif isinstance(obj, dict):
+ elif isinstance(obj, Dict):
items = []
for key, value in obj.items():
@@ -631,7 +667,7 @@ def _serialize_header(explode: bool, obj: any) -> str:
if len(items) > 0:
return ','.join([str(item) for item in items])
- elif isinstance(obj, list):
+ elif isinstance(obj, List):
items = []
for value in obj:
@@ -648,20 +684,28 @@ def _serialize_header(explode: bool, obj: any) -> str:
return ''
-def unmarshal_json(data, typ):
- unmarhsal = make_dataclass('Unmarhsal', [('res', typ)],
+def unmarshal_json(data, typ, decoder=None):
+ unmarshal = make_dataclass('Unmarshal', [('res', typ)],
bases=(DataClassJsonMixin,))
json_dict = json.loads(data)
- out = unmarhsal.from_dict({"res": json_dict})
- return out.res
+ try:
+ out = unmarshal.from_dict({"res": json_dict})
+ except AttributeError as attr_err:
+ raise AttributeError(
+ f'unable to unmarshal {data} as {typ}') from attr_err
+
+ return out.res if decoder is None else decoder(out.res)
-def marshal_json(val):
+def marshal_json(val, encoder=None):
marshal = make_dataclass('Marshal', [('res', type(val))],
bases=(DataClassJsonMixin,))
marshaller = marshal(res=val)
json_dict = marshaller.to_dict()
- return json.dumps(json_dict["res"])
+
+ val = json_dict["res"] if encoder is None else encoder(json_dict["res"])
+
+ return json.dumps(val)
def match_content_type(content_type: str, pattern: str) -> boolean:
@@ -705,6 +749,106 @@ def datefromisoformat(date_str: str):
return dateutil.parser.parse(date_str).date()
+def bigintencoder(optional: bool):
+ def bigintencode(val: int):
+ if optional and val is None:
+ return None
+ return str(val)
+
+ return bigintencode
+
+
+def bigintdecoder(val):
+ if isinstance(val, float):
+ raise ValueError(f"{val} is a float")
+ return int(val)
+
+
+def decimalencoder(optional: bool, as_str: bool):
+ def decimalencode(val: Decimal):
+ if optional and val is None:
+ return None
+
+ if as_str:
+ return str(val)
+
+ return float(val)
+
+ return decimalencode
+
+
+def decimaldecoder(val):
+ return Decimal(str(val))
+
+
+def map_encoder(optional: bool, value_encoder: Callable):
+ def map_encode(val: Dict):
+ if optional and val is None:
+ return None
+
+ encoded = {}
+ for key, value in val.items():
+ encoded[key] = value_encoder(value)
+
+ return encoded
+
+ return map_encode
+
+
+def map_decoder(value_decoder: Callable):
+ def map_decode(val: Dict):
+ decoded = {}
+ for key, value in val.items():
+ decoded[key] = value_decoder(value)
+
+ return decoded
+
+ return map_decode
+
+
+def list_encoder(optional: bool, value_encoder: Callable):
+ def list_encode(val: List):
+ if optional and val is None:
+ return None
+
+ encoded = []
+ for value in val:
+ encoded.append(value_encoder(value))
+
+ return encoded
+
+ return list_encode
+
+
+def list_decoder(value_decoder: Callable):
+ def list_decode(val: List):
+ decoded = []
+ for value in val:
+ decoded.append(value_decoder(value))
+
+ return decoded
+
+ return list_decode
+
+def union_encoder(all_encoders: Dict[str, Callable]):
+ def selective_encoder(val: any):
+ if type(val) in all_encoders:
+ return all_encoders[type(val)](val)
+ return val
+ return selective_encoder
+
+def union_decoder(all_decoders: List[Callable]):
+ def selective_decoder(val: any):
+ decoded = val
+ for decoder in all_decoders:
+ try:
+ decoded = decoder(val)
+ break
+ except (TypeError, ValueError):
+ continue
+ return decoded
+ return selective_decoder
+
def get_field_name(name):
def override(_, _field_name=name):
return _field_name
@@ -718,12 +862,12 @@ def _val_to_string(val):
if isinstance(val, datetime):
return val.isoformat().replace('+00:00', 'Z')
if isinstance(val, Enum):
- return val.value
+ return str(val.value)
return str(val)
-def _populate_from_globals(param_name: str, value: any, param_type: str, gbls: dict[str, dict[str, dict[str, Any]]]):
+def _populate_from_globals(param_name: str, value: any, param_type: str, gbls: Dict[str, Dict[str, Dict[str, Any]]]):
if value is None and gbls is not None:
if 'parameters' in gbls:
if param_type in gbls['parameters']:
@@ -733,3 +877,16 @@ def _populate_from_globals(param_name: str, value: any, param_type: str, gbls: d
value = global_value
return value
+
+
+def decoder_with_discriminator(field_name):
+ def decode_fx(obj):
+ kls = getattr(sys.modules['sdk.models.shared'], obj[field_name])
+ return unmarshal_json(json.dumps(obj), kls)
+ return decode_fx
+
+
+def remove_suffix(input_string, suffix):
+ if suffix and input_string.endswith(suffix):
+ return input_string[:-len(suffix)]
+ return input_string