diff --git a/submission/.gitattributes b/submission/.gitattributes
new file mode 100755
index 000000000..4d75d5900
--- /dev/null
+++ b/submission/.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/submission/.gitignore b/submission/.gitignore
new file mode 100755
index 000000000..8ac3f51d4
--- /dev/null
+++ b/submission/.gitignore
@@ -0,0 +1,7 @@
+.python-version
+.DS_Store
+venv/
+src/*.egg-info/
+__pycache__/
+.pytest_cache/
+.python-version`
diff --git a/submission/README.md b/submission/README.md
index 815eaf538..2b5832782 100755
--- a/submission/README.md
+++ b/submission/README.md
@@ -12,65 +12,282 @@ pip install git+https://github.com/epilot-dev/sdk-python.git#subdirectory=submis
```python
import epilot
-from epilot.models import operations, shared
+from epilot.models import shared
s = epilot.Epilot()
-
req = shared.SubmissionPayload(
ivy_opportunity_ids=[
- "deserunt",
- "porro",
- "nulla",
+ 'string',
],
entities=[
- {
- "perspiciatis": "nulla",
- "nihil": "fuga",
- "facilis": "eum",
- "iusto": "ullam",
- },
- {
- "inventore": "sapiente",
- "enim": "eum",
- "voluptatum": "autem",
- "vel": "non",
- },
- {
- "similique": "reprehenderit",
- "molestiae": "quo",
- },
+ shared.SubmissionEntity(
+ additional_properties={
+ "contact_last_name": 'string',
+ "contact_email": 'string',
+ "request": 'string',
+ "files": 'string',
+ "_schema": 'string',
+ "description": 'string',
+ "contact_first_name": 'string',
+ },
+ schema=shared.SubmissionEntitySchema.SUBMISSION,
+ files=[
+ shared.SubmissionEntityFiles(
+ additional_properties={
+ "key": 'string',
+ },
+ tags=[
+ 'string',
+ ],
+ relation_tags=[
+ 'string',
+ ],
+ s3ref=shared.S3Reference(
+ bucket='epilot-user-content',
+ key='temp/123/4d689aeb-1497-4410-a9fe-b36ca9ac4389/document.pdf',
+ ),
+ ),
+ ],
+ ),
],
- journey_submit_id="123",
+ journey_submit_id='123',
opt_ins=[
shared.OptIn(
- identifier="example@email.com",
+ identifier='example@email.com',
meta={
- "dicta": "est",
- "voluptatem": "consequatur",
+ "key": 'string',
},
- topic="EMAIL_MARKETING",
+ topic='EMAIL_MARKETING',
),
],
- organization_id="123",
- source_id="ce99875f-fba9-4fe2-a8f9-afaf52059051",
- source_type="journey",
+ organization_id='123',
+ source_id='ce99875f-fba9-4fe2-a8f9-afaf52059051',
+ source_type='journey',
)
-
+
res = s.submissions.create_submission(req)
if res.status_code == 200:
# handle response
+ pass
```
-## SDK Available Operations
+## Available Resources and Operations
-### submissions
+### [submissions](docs/sdks/submissions/README.md)
-* `create_submission` - createSubmission
+* [create_submission](docs/sdks/submissions/README.md#create_submission) - createSubmission
+
+
+
+
+
+
+
+
+
+# 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://submission.sls.epilot.io` | None |
+
+For example:
+
+
+```python
+import epilot
+from epilot.models import shared
+
+s = epilot.Epilot(
+ server_idx=0
+)
+
+req = shared.SubmissionPayload(
+ ivy_opportunity_ids=[
+ 'string',
+ ],
+ entities=[
+ shared.SubmissionEntity(
+ additional_properties={
+ "contact_first_name": 'string',
+ "contact_last_name": 'string',
+ "contact_email": 'string',
+ "request": 'string',
+ "files": 'string',
+ "_schema": 'string',
+ "description": 'string',
+ },
+ schema=shared.SubmissionEntitySchema.SUBMISSION,
+ files=[
+ shared.SubmissionEntityFiles(
+ additional_properties={
+ "key": 'string',
+ },
+ tags=[
+ 'string',
+ ],
+ relation_tags=[
+ 'string',
+ ],
+ s3ref=shared.S3Reference(
+ bucket='epilot-user-content',
+ key='temp/123/4d689aeb-1497-4410-a9fe-b36ca9ac4389/document.pdf',
+ ),
+ ),
+ ],
+ ),
+ ],
+ journey_submit_id='123',
+ opt_ins=[
+ shared.OptIn(
+ identifier='example@email.com',
+ meta={
+ "key": 'string',
+ },
+ topic='EMAIL_MARKETING',
+ ),
+ ],
+ organization_id='123',
+ source_id='ce99875f-fba9-4fe2-a8f9-afaf52059051',
+ source_type='journey',
+)
+
+res = s.submissions.create_submission(req)
+
+if res.status_code == 200:
+ # 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 shared
+
+s = epilot.Epilot(
+ server_url="https://submission.sls.epilot.io"
+)
+
+req = shared.SubmissionPayload(
+ ivy_opportunity_ids=[
+ 'string',
+ ],
+ entities=[
+ shared.SubmissionEntity(
+ additional_properties={
+ "contact_first_name": 'string',
+ "contact_last_name": 'string',
+ "contact_email": 'string',
+ "request": 'string',
+ "files": 'string',
+ "_schema": 'string',
+ "description": 'string',
+ },
+ schema=shared.SubmissionEntitySchema.SUBMISSION,
+ files=[
+ shared.SubmissionEntityFiles(
+ additional_properties={
+ "key": 'string',
+ },
+ tags=[
+ 'string',
+ ],
+ relation_tags=[
+ 'string',
+ ],
+ s3ref=shared.S3Reference(
+ bucket='epilot-user-content',
+ key='temp/123/4d689aeb-1497-4410-a9fe-b36ca9ac4389/document.pdf',
+ ),
+ ),
+ ],
+ ),
+ ],
+ journey_submit_id='123',
+ opt_ins=[
+ shared.OptIn(
+ identifier='example@email.com',
+ meta={
+ "key": 'string',
+ },
+ topic='EMAIL_MARKETING',
+ ),
+ ],
+ organization_id='123',
+ source_id='ce99875f-fba9-4fe2-a8f9-afaf52059051',
+ source_type='journey',
+)
+
+res = s.submissions.create_submission(req)
+
+if res.status_code == 200:
+ # 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/submission/RELEASES.md b/submission/RELEASES.md
index 2ba9053d4..75faf0d1b 100644
--- a/submission/RELEASES.md
+++ b/submission/RELEASES.md
@@ -34,4 +34,554 @@ Based on:
### Changes
Based on:
- OpenAPI Doc 1.0.0 https://docs.api.epilot.io/submission-api.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:24:03
+### Changes
+Based on:
+- OpenAPI Doc 1.0.0 https://docs.api.epilot.io/submission-api.yaml
+- Speakeasy CLI 1.19.3 (2.16.7) https://github.com/speakeasy-api/speakeasy
+
+## 2023-04-06 01:19:06
+### Changes
+Based on:
+- OpenAPI Doc 1.0.0 https://docs.api.epilot.io/submission-api.yaml
+- Speakeasy CLI 1.19.6 (2.17.8) https://github.com/speakeasy-api/speakeasy
+
+## 2023-04-12 01:21:08
+### Changes
+Based on:
+- OpenAPI Doc 1.0.0 https://docs.api.epilot.io/submission-api.yaml
+- Speakeasy CLI 1.19.7 (2.17.9) https://github.com/speakeasy-api/speakeasy
+
+## 2023-04-14 01:20:36
+### Changes
+Based on:
+- OpenAPI Doc 1.0.0 https://docs.api.epilot.io/submission-api.yaml
+- Speakeasy CLI 1.20.0 (2.18.0) https://github.com/speakeasy-api/speakeasy
+
+## 2023-04-18 01:20:19
+### Changes
+Based on:
+- OpenAPI Doc 1.0.0 https://docs.api.epilot.io/submission-api.yaml
+- Speakeasy CLI 1.20.1 (2.18.1) https://github.com/speakeasy-api/speakeasy
+
+## 2023-04-19 01:22:40
+### Changes
+Based on:
+- OpenAPI Doc 1.0.0 https://docs.api.epilot.io/submission-api.yaml
+- Speakeasy CLI 1.20.2 (2.18.2) https://github.com/speakeasy-api/speakeasy
+
+## 2023-04-21 01:20:32
+### Changes
+Based on:
+- OpenAPI Doc 1.0.0 https://docs.api.epilot.io/submission-api.yaml
+- Speakeasy CLI 1.21.4 (2.19.1) https://github.com/speakeasy-api/speakeasy
+
+## 2023-04-22 01:21:49
+### Changes
+Based on:
+- OpenAPI Doc 1.0.0 https://docs.api.epilot.io/submission-api.yaml
+- Speakeasy CLI 1.22.1 (2.20.1) https://github.com/speakeasy-api/speakeasy
+
+## 2023-04-26 01:21:31
+### Changes
+Based on:
+- OpenAPI Doc 1.0.0 https://docs.api.epilot.io/submission-api.yaml
+- Speakeasy CLI 1.23.1 (2.21.1) https://github.com/speakeasy-api/speakeasy
+
+## 2023-04-27 01:22:26
+### Changes
+Based on:
+- OpenAPI Doc 1.0.0 https://docs.api.epilot.io/submission-api.yaml
+- Speakeasy CLI 1.25.1 (2.22.0) https://github.com/speakeasy-api/speakeasy
+
+## 2023-04-28 01:23:21
+### Changes
+Based on:
+- OpenAPI Doc 1.0.0 https://docs.api.epilot.io/submission-api.yaml
+- Speakeasy CLI 1.26.2 (2.23.2) https://github.com/speakeasy-api/speakeasy
+
+## 2023-04-29 01:21:10
+### Changes
+Based on:
+- OpenAPI Doc 1.0.0 https://docs.api.epilot.io/submission-api.yaml
+- Speakeasy CLI 1.26.4 (2.23.4) https://github.com/speakeasy-api/speakeasy
+
+## 2023-05-02 01:22:13
+### Changes
+Based on:
+- OpenAPI Doc 1.0.0 https://docs.api.epilot.io/submission-api.yaml
+- Speakeasy CLI 1.26.5 (2.23.6) https://github.com/speakeasy-api/speakeasy
+
+## 2023-05-03 01:22:31
+### Changes
+Based on:
+- OpenAPI Doc 1.0.0 https://docs.api.epilot.io/submission-api.yaml
+- Speakeasy CLI 1.27.0 (2.24.0) https://github.com/speakeasy-api/speakeasy
+
+## 2023-05-05 01:15:28
+### Changes
+Based on:
+- OpenAPI Doc 1.0.0 https://docs.api.epilot.io/submission-api.yaml
+- Speakeasy CLI 1.29.0 (2.26.0) https://github.com/speakeasy-api/speakeasy
+
+## 2023-05-06 01:17:22
+### Changes
+Based on:
+- OpenAPI Doc 1.0.0 https://docs.api.epilot.io/submission-api.yaml
+- Speakeasy CLI 1.29.1 (2.26.1) https://github.com/speakeasy-api/speakeasy
+
+## 2023-05-10 01:20:14
+### Changes
+Based on:
+- OpenAPI Doc 1.0.0 https://docs.api.epilot.io/submission-api.yaml
+- Speakeasy CLI 1.29.2 (2.26.2) https://github.com/speakeasy-api/speakeasy
+
+## 2023-05-11 01:21:39
+### Changes
+Based on:
+- OpenAPI Doc 1.0.0 https://docs.api.epilot.io/submission-api.yaml
+- Speakeasy CLI 1.30.0 (2.26.3) https://github.com/speakeasy-api/speakeasy
+
+## 2023-05-12 01:21:12
+### Changes
+Based on:
+- OpenAPI Doc 1.0.0 https://docs.api.epilot.io/submission-api.yaml
+- Speakeasy CLI 1.30.1 (2.26.4) https://github.com/speakeasy-api/speakeasy
+
+## 2023-05-13 01:19:56
+### Changes
+Based on:
+- OpenAPI Doc 1.0.0 https://docs.api.epilot.io/submission-api.yaml
+- Speakeasy CLI 1.31.1 (2.27.0) https://github.com/speakeasy-api/speakeasy
+
+## 2023-05-16 01:23:43
+### Changes
+Based on:
+- OpenAPI Doc 1.0.0 https://docs.api.epilot.io/submission-api.yaml
+- Speakeasy CLI 1.32.0 (2.28.0) https://github.com/speakeasy-api/speakeasy
+
+## 2023-05-17 01:24:02
+### Changes
+Based on:
+- OpenAPI Doc 1.0.0 https://docs.api.epilot.io/submission-api.yaml
+- Speakeasy CLI 1.33.2 (2.29.0) https://github.com/speakeasy-api/speakeasy
+
+## 2023-05-18 01:22:12
+### Changes
+Based on:
+- OpenAPI Doc 1.0.0 https://docs.api.epilot.io/submission-api.yaml
+- Speakeasy CLI 1.34.0 (2.30.0) https://github.com/speakeasy-api/speakeasy
+
+## 2023-05-19 01:23:12
+### Changes
+Based on:
+- OpenAPI Doc 1.0.0 https://docs.api.epilot.io/submission-api.yaml
+- Speakeasy CLI 1.35.0 (2.31.0) https://github.com/speakeasy-api/speakeasy
+
+## 2023-05-23 01:23:13
+### Changes
+Based on:
+- OpenAPI Doc 1.0.0 https://docs.api.epilot.io/submission-api.yaml
+- Speakeasy CLI 1.37.5 (2.32.2) https://github.com/speakeasy-api/speakeasy
+
+## 2023-05-27 01:23:14
+### Changes
+Based on:
+- OpenAPI Doc 1.0.0 https://docs.api.epilot.io/submission-api.yaml
+- Speakeasy CLI 1.39.0 (2.32.7) https://github.com/speakeasy-api/speakeasy
+
+## 2023-06-01 02:03:13
+### Changes
+Based on:
+- OpenAPI Doc 1.0.0 https://docs.api.epilot.io/submission-api.yaml
+- Speakeasy CLI 1.40.2 (2.34.2) https://github.com/speakeasy-api/speakeasy
+
+## 2023-06-02 01:46:01
+### Changes
+Based on:
+- OpenAPI Doc 1.0.0 https://docs.api.epilot.io/submission-api.yaml
+- Speakeasy CLI 1.40.3 (2.34.7) https://github.com/speakeasy-api/speakeasy
+
+## 2023-06-03 01:43:14
+### Changes
+Based on:
+- OpenAPI Doc 1.0.0 https://docs.api.epilot.io/submission-api.yaml
+- Speakeasy CLI 1.43.0 (2.35.3) https://github.com/speakeasy-api/speakeasy
+
+## 2023-06-07 01:48:41
+### Changes
+Based on:
+- OpenAPI Doc 1.0.0 https://docs.api.epilot.io/submission-api.yaml
+- Speakeasy CLI 1.44.2 (2.35.9) https://github.com/speakeasy-api/speakeasy
+
+## 2023-06-08 01:45:58
+### Changes
+Based on:
+- OpenAPI Doc 1.0.0 https://docs.api.epilot.io/submission-api.yaml
+- Speakeasy CLI 1.45.0 (2.37.0) https://github.com/speakeasy-api/speakeasy
+
+## 2023-06-09 01:46:21
+### Changes
+Based on:
+- OpenAPI Doc 1.0.0 https://docs.api.epilot.io/submission-api.yaml
+- Speakeasy CLI 1.45.2 (2.37.2) https://github.com/speakeasy-api/speakeasy
+
+## 2023-06-10 01:37:10
+### Changes
+Based on:
+- OpenAPI Doc 1.0.0 https://docs.api.epilot.io/submission-api.yaml
+- Speakeasy CLI 1.47.0 (2.39.0) https://github.com/speakeasy-api/speakeasy
+
+## 2023-06-11 01:53:33
+### Changes
+Based on:
+- OpenAPI Doc 1.0.0 https://docs.api.epilot.io/submission-api.yaml
+- Speakeasy CLI 1.47.1 (2.39.2) https://github.com/speakeasy-api/speakeasy
+
+## 2023-06-14 01:38:57
+### Changes
+Based on:
+- OpenAPI Doc 1.0.0 https://docs.api.epilot.io/submission-api.yaml
+- Speakeasy CLI 1.47.3 (2.40.1) https://github.com/speakeasy-api/speakeasy
+
+## 2023-06-16 01:39:08
+### Changes
+Based on:
+- OpenAPI Doc 1.0.0 https://docs.api.epilot.io/submission-api.yaml
+- Speakeasy CLI 1.48.0 (2.41.1) https://github.com/speakeasy-api/speakeasy
+
+## 2023-06-20 01:34:21
+### Changes
+Based on:
+- OpenAPI Doc 1.0.0 https://docs.api.epilot.io/submission-api.yaml
+- Speakeasy CLI 1.49.0 (2.41.4) https://github.com/speakeasy-api/speakeasy
+
+## 2023-06-21 01:35:44
+### Changes
+Based on:
+- OpenAPI Doc 1.0.0 https://docs.api.epilot.io/submission-api.yaml
+- Speakeasy CLI 1.49.1 (2.41.5) https://github.com/speakeasy-api/speakeasy
+
+## 2023-06-23 01:49:23
+### Changes
+Based on:
+- OpenAPI Doc 1.0.0 https://docs.api.epilot.io/submission-api.yaml
+- Speakeasy CLI 1.50.1 (2.43.2) https://github.com/speakeasy-api/speakeasy
+
+## 2023-06-27 01:51:43
+### Changes
+Based on:
+- OpenAPI Doc 1.0.0 https://docs.api.epilot.io/submission-api.yaml
+- Speakeasy CLI 1.51.1 (2.50.2) https://github.com/speakeasy-api/speakeasy
+
+## 2023-06-29 01:46:41
+### Changes
+Based on:
+- OpenAPI Doc 1.0.0 https://docs.api.epilot.io/submission-api.yaml
+- Speakeasy CLI 1.51.3 (2.52.2) https://github.com/speakeasy-api/speakeasy
+
+## 2023-06-30 01:45:21
+### Changes
+Based on:
+- OpenAPI Doc 1.0.0 https://docs.api.epilot.io/submission-api.yaml
+- Speakeasy CLI 1.51.3 (2.52.2) https://github.com/speakeasy-api/speakeasy
+
+## 2023-07-01 01:56:12
+### Changes
+Based on:
+- OpenAPI Doc 1.0.0 https://docs.api.epilot.io/submission-api.yaml
+- Speakeasy CLI 1.52.0 (2.55.0) https://github.com/speakeasy-api/speakeasy
+
+## 2023-07-06 01:51:36
+### Changes
+Based on:
+- OpenAPI Doc 1.0.0 https://docs.api.epilot.io/submission-api.yaml
+- Speakeasy CLI 1.52.2 (2.57.2) https://github.com/speakeasy-api/speakeasy
+
+## 2023-07-07 01:50:03
+### Changes
+Based on:
+- OpenAPI Doc 1.0.0 https://docs.api.epilot.io/submission-api.yaml
+- Speakeasy CLI 1.53.0 (2.58.0) https://github.com/speakeasy-api/speakeasy
+
+## 2023-07-08 01:48:49
+### Changes
+Based on:
+- OpenAPI Doc 1.0.0 https://docs.api.epilot.io/submission-api.yaml
+- Speakeasy CLI 1.53.1 (2.58.2) https://github.com/speakeasy-api/speakeasy
+
+## 2023-07-11 01:42:05
+### Changes
+Based on:
+- OpenAPI Doc 1.0.0 https://docs.api.epilot.io/submission-api.yaml
+- Speakeasy CLI 1.56.0 (2.61.0) https://github.com/speakeasy-api/speakeasy
+
+## 2023-07-12 01:50:37
+### Changes
+Based on:
+- OpenAPI Doc 1.0.0 https://docs.api.epilot.io/submission-api.yaml
+- Speakeasy CLI 1.56.4 (2.61.5) https://github.com/speakeasy-api/speakeasy
+
+## 2023-07-13 01:52:49
+### Changes
+Based on:
+- OpenAPI Doc 1.0.0 https://docs.api.epilot.io/submission-api.yaml
+- Speakeasy CLI 1.57.0 (2.62.1) https://github.com/speakeasy-api/speakeasy
+
+## 2023-07-14 01:52:46
+### Changes
+Based on:
+- OpenAPI Doc 1.0.0 https://docs.api.epilot.io/submission-api.yaml
+- Speakeasy CLI 1.59.0 (2.65.0) https://github.com/speakeasy-api/speakeasy
+
+## 2023-07-17 01:55:42
+### Changes
+Based on:
+- OpenAPI Doc 1.0.0 https://docs.api.epilot.io/submission-api.yaml
+- Speakeasy CLI 1.60.0 (2.66.0) https://github.com/speakeasy-api/speakeasy
+
+## 2023-07-18 02:00:43
+### Changes
+Based on:
+- OpenAPI Doc 1.0.0 https://docs.api.epilot.io/submission-api.yaml
+- Speakeasy CLI 1.61.0 (2.70.0) https://github.com/speakeasy-api/speakeasy
+
+## 2023-07-19 02:49:19
+### Changes
+Based on:
+- OpenAPI Doc 1.0.0 https://docs.api.epilot.io/submission-api.yaml
+- Speakeasy CLI 1.62.1 (2.70.2) https://github.com/speakeasy-api/speakeasy
+
+## 2023-07-22 01:25:53
+### Changes
+Based on:
+- OpenAPI Doc 1.0.0 https://docs.api.epilot.io/submission-api.yaml
+- Speakeasy CLI 1.64.0 (2.71.0) https://github.com/speakeasy-api/speakeasy
+
+## 2023-07-26 01:34:10
+### Changes
+Based on:
+- OpenAPI Doc 1.0.0 https://docs.api.epilot.io/submission-api.yaml
+- Speakeasy CLI 1.65.0 (2.73.0) https://github.com/speakeasy-api/speakeasy
+
+## 2023-07-27 01:16:18
+### Changes
+Based on:
+- OpenAPI Doc 1.0.0 https://docs.api.epilot.io/submission-api.yaml
+- Speakeasy CLI 1.65.1 (2.73.1) https://github.com/speakeasy-api/speakeasy
+
+## 2023-07-28 01:18:48
+### Changes
+Based on:
+- OpenAPI Doc 1.0.0 https://docs.api.epilot.io/submission-api.yaml
+- Speakeasy CLI 1.65.2 (2.75.1) https://github.com/speakeasy-api/speakeasy
+
+## 2023-08-01 01:34:30
+### Changes
+Based on:
+- OpenAPI Doc 1.0.0 https://docs.api.epilot.io/submission-api.yaml
+- Speakeasy CLI 1.66.1 (2.75.2) https://github.com/speakeasy-api/speakeasy
+
+## 2023-08-03 01:19:31
+### Changes
+Based on:
+- OpenAPI Doc 1.0.0 https://docs.api.epilot.io/submission-api.yaml
+- Speakeasy CLI 1.68.1 (2.77.1) https://github.com/speakeasy-api/speakeasy
+
+## 2023-08-04 01:21:08
+### Changes
+Based on:
+- OpenAPI Doc 1.0.0 https://docs.api.epilot.io/submission-api.yaml
+- Speakeasy CLI 1.68.3 (2.81.1) https://github.com/speakeasy-api/speakeasy
+
+## 2023-08-08 01:18:09
+### Changes
+Based on:
+- OpenAPI Doc 1.0.0 https://docs.api.epilot.io/submission-api.yaml
+- Speakeasy CLI 1.69.1 (2.82.0) https://github.com/speakeasy-api/speakeasy
+
+## 2023-08-15 01:07:36
+### Changes
+Based on:
+- OpenAPI Doc 1.0.0 https://docs.api.epilot.io/submission-api.yaml
+- Speakeasy CLI 1.72.0 (2.84.1) https://github.com/speakeasy-api/speakeasy
+### Generated
+- [python v1.41.0] submission
+
+## 2023-08-19 01:05:28
+### Changes
+Based on:
+- OpenAPI Doc 1.0.0 https://docs.api.epilot.io/submission-api.yaml
+- Speakeasy CLI 1.74.3 (2.86.6) https://github.com/speakeasy-api/speakeasy
+### Generated
+- [python v1.41.1] submission
+
+## 2023-08-25 01:09:04
+### Changes
+Based on:
+- OpenAPI Doc 1.0.0 https://docs.api.epilot.io/submission-api.yaml
+- Speakeasy CLI 1.74.11 (2.87.1) https://github.com/speakeasy-api/speakeasy
+### Generated
+- [python v1.41.2] submission
+
+## 2023-08-26 01:06:10
+### Changes
+Based on:
+- OpenAPI Doc 1.0.0 https://docs.api.epilot.io/submission-api.yaml
+- Speakeasy CLI 1.74.16 (2.88.2) https://github.com/speakeasy-api/speakeasy
+### Generated
+- [python v1.42.0] submission
+
+## 2023-08-29 01:09:28
+### Changes
+Based on:
+- OpenAPI Doc 1.0.0 https://docs.api.epilot.io/submission-api.yaml
+- Speakeasy CLI 1.74.17 (2.88.5) https://github.com/speakeasy-api/speakeasy
+### Generated
+- [python v1.42.1] submission
+
+## 2023-08-31 01:09:31
+### Changes
+Based on:
+- OpenAPI Doc 1.0.0 https://docs.api.epilot.io/submission-api.yaml
+- Speakeasy CLI 1.76.1 (2.89.1) https://github.com/speakeasy-api/speakeasy
+### Generated
+- [python v1.43.0] submission
+
+## 2023-09-01 01:13:58
+### Changes
+Based on:
+- OpenAPI Doc 1.0.0 https://docs.api.epilot.io/submission-api.yaml
+- Speakeasy CLI 1.77.0 (2.91.2) https://github.com/speakeasy-api/speakeasy
+### Generated
+- [python v1.44.0] submission
+
+## 2023-09-02 01:06:49
+### Changes
+Based on:
+- OpenAPI Doc 1.0.0 https://docs.api.epilot.io/submission-api.yaml
+- Speakeasy CLI 1.77.2 (2.93.0) https://github.com/speakeasy-api/speakeasy
+### Generated
+- [python v1.44.1] submission
+
+## 2023-09-05 01:08:07
+### Changes
+Based on:
+- OpenAPI Doc 1.0.0 https://docs.api.epilot.io/submission-api.yaml
+- Speakeasy CLI 1.78.3 (2.96.3) https://github.com/speakeasy-api/speakeasy
+### Generated
+- [python v1.44.2] submission
+
+## 2023-09-12 01:07:57
+### Changes
+Based on:
+- OpenAPI Doc 1.0.0 https://docs.api.epilot.io/submission-api.yaml
+- Speakeasy CLI 1.82.5 (2.108.3) https://github.com/speakeasy-api/speakeasy
+### Generated
+- [python v1.44.3] submission
+
+## 2023-09-16 01:08:13
+### Changes
+Based on:
+- OpenAPI Doc 1.0.0 https://docs.api.epilot.io/submission-api.yaml
+- Speakeasy CLI 1.86.0 (2.115.2) https://github.com/speakeasy-api/speakeasy
+### Generated
+- [python v1.44.4] submission
+
+## 2023-09-20 01:09:59
+### Changes
+Based on:
+- OpenAPI Doc 1.0.0 https://docs.api.epilot.io/submission-api.yaml
+- Speakeasy CLI 1.88.0 (2.118.1) https://github.com/speakeasy-api/speakeasy
+### Generated
+- [python v1.44.5] submission
+
+## 2023-09-26 01:10:45
+### Changes
+Based on:
+- OpenAPI Doc 1.0.0 https://docs.api.epilot.io/submission-api.yaml
+- Speakeasy CLI 1.91.0 (2.129.1) https://github.com/speakeasy-api/speakeasy
+### Generated
+- [python v1.45.0] submission
+
+## 2023-09-27 01:10:45
+### Changes
+Based on:
+- OpenAPI Doc 1.0.0 https://docs.api.epilot.io/submission-api.yaml
+- Speakeasy CLI 1.91.2 (2.131.1) https://github.com/speakeasy-api/speakeasy
+### Generated
+- [python v1.45.1] submission
+
+## 2023-09-29 01:10:31
+### Changes
+Based on:
+- OpenAPI Doc 1.0.0 https://docs.api.epilot.io/submission-api.yaml
+- Speakeasy CLI 1.91.3 (2.139.1) https://github.com/speakeasy-api/speakeasy
+### Generated
+- [python v1.46.0] submission
+
+## 2023-10-01 01:19:16
+### Changes
+Based on:
+- OpenAPI Doc 1.0.0 https://docs.api.epilot.io/submission-api.yaml
+- Speakeasy CLI 1.92.2 (2.142.2) https://github.com/speakeasy-api/speakeasy
+### Generated
+- [python v1.47.0] submission
+
+## 2023-10-02 01:11:11
+### Changes
+Based on:
+- OpenAPI Doc 1.0.0 https://docs.api.epilot.io/submission-api.yaml
+- Speakeasy CLI 1.92.3 (2.143.2) https://github.com/speakeasy-api/speakeasy
+### Generated
+- [python v1.47.1] submission
+
+## 2023-10-05 01:11:01
+### Changes
+Based on:
+- OpenAPI Doc 1.0.0 https://docs.api.epilot.io/submission-api.yaml
+- Speakeasy CLI 1.94.0 (2.147.0) https://github.com/speakeasy-api/speakeasy
+### Generated
+- [python v1.47.2] submission
+
+## 2023-10-07 01:09:45
+### Changes
+Based on:
+- OpenAPI Doc 1.0.0 https://docs.api.epilot.io/submission-api.yaml
+- Speakeasy CLI 1.96.1 (2.150.0) https://github.com/speakeasy-api/speakeasy
+### Generated
+- [python v1.47.3] submission
+
+## 2023-10-13 01:12:40
+### Changes
+Based on:
+- OpenAPI Doc 1.0.0 https://docs.api.epilot.io/submission-api.yaml
+- Speakeasy CLI 1.99.1 (2.154.1) https://github.com/speakeasy-api/speakeasy
+### Generated
+- [python v1.47.4] submission
+
+## 2023-10-18 01:11:12
+### Changes
+Based on:
+- OpenAPI Doc 1.0.0 https://docs.api.epilot.io/submission-api.yaml
+- Speakeasy CLI 1.101.0 (2.161.0) https://github.com/speakeasy-api/speakeasy
+### Generated
+- [python v2.0.0] submission
+
+## 2023-10-21 01:08:42
+### Changes
+Based on:
+- OpenAPI Doc 1.0.0 https://docs.api.epilot.io/submission-api.yaml
+- Speakeasy CLI 1.104.0 (2.169.0) https://github.com/speakeasy-api/speakeasy
+### Generated
+- [python v2.1.0] submission
+
+## 2023-10-28 01:08:09
+### Changes
+Based on:
+- OpenAPI Doc 1.0.0 https://docs.api.epilot.io/submission-api.yaml
+- Speakeasy CLI 1.109.0 (2.173.0) https://github.com/speakeasy-api/speakeasy
+### Generated
+- [python v2.1.1] submission
\ No newline at end of file
diff --git a/submission/USAGE.md b/submission/USAGE.md
index f99c11640..06080290f 100755
--- a/submission/USAGE.md
+++ b/submission/USAGE.md
@@ -1,54 +1,66 @@
+
+
```python
import epilot
-from epilot.models import operations, shared
+from epilot.models import shared
s = epilot.Epilot()
-
req = shared.SubmissionPayload(
ivy_opportunity_ids=[
- "deserunt",
- "porro",
- "nulla",
+ 'string',
],
entities=[
- {
- "perspiciatis": "nulla",
- "nihil": "fuga",
- "facilis": "eum",
- "iusto": "ullam",
- },
- {
- "inventore": "sapiente",
- "enim": "eum",
- "voluptatum": "autem",
- "vel": "non",
- },
- {
- "similique": "reprehenderit",
- "molestiae": "quo",
- },
+ shared.SubmissionEntity(
+ additional_properties={
+ "request": 'string',
+ "files": 'string',
+ "_schema": 'string',
+ "description": 'string',
+ "contact_first_name": 'string',
+ "contact_last_name": 'string',
+ "contact_email": 'string',
+ },
+ schema=shared.SubmissionEntitySchema.SUBMISSION,
+ files=[
+ shared.SubmissionEntityFiles(
+ additional_properties={
+ "key": 'string',
+ },
+ tags=[
+ 'string',
+ ],
+ relation_tags=[
+ 'string',
+ ],
+ s3ref=shared.S3Reference(
+ bucket='epilot-user-content',
+ key='temp/123/4d689aeb-1497-4410-a9fe-b36ca9ac4389/document.pdf',
+ ),
+ ),
+ ],
+ ),
],
- journey_submit_id="123",
+ journey_submit_id='123',
opt_ins=[
shared.OptIn(
- identifier="example@email.com",
+ identifier='example@email.com',
meta={
- "dicta": "est",
- "voluptatem": "consequatur",
+ "key": 'string',
},
- topic="EMAIL_MARKETING",
+ topic='EMAIL_MARKETING',
),
],
- organization_id="123",
- source_id="ce99875f-fba9-4fe2-a8f9-afaf52059051",
- source_type="journey",
+ organization_id='123',
+ source_id='ce99875f-fba9-4fe2-a8f9-afaf52059051',
+ source_type='journey',
)
-
+
res = s.submissions.create_submission(req)
if res.status_code == 200:
# handle response
+ pass
```
\ No newline at end of file
diff --git a/submission/docs/models/operations/createsubmissionresponse.md b/submission/docs/models/operations/createsubmissionresponse.md
new file mode 100755
index 000000000..21f3631da
--- /dev/null
+++ b/submission/docs/models/operations/createsubmissionresponse.md
@@ -0,0 +1,10 @@
+# CreateSubmissionResponse
+
+
+## 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 |
\ No newline at end of file
diff --git a/submission/docs/models/shared/optin.md b/submission/docs/models/shared/optin.md
new file mode 100755
index 000000000..14c95bda5
--- /dev/null
+++ b/submission/docs/models/shared/optin.md
@@ -0,0 +1,10 @@
+# OptIn
+
+
+## Fields
+
+| Field | Type | Required | Description | Example |
+| ------------------ | ------------------ | ------------------ | ------------------ | ------------------ |
+| `identifier` | *Optional[str]* | :heavy_minus_sign: | Consent identifier | example@email.com |
+| `meta` | Dict[str, *Any*] | :heavy_minus_sign: | N/A | |
+| `topic` | *Optional[str]* | :heavy_minus_sign: | N/A | EMAIL_MARKETING |
\ No newline at end of file
diff --git a/submission/docs/models/shared/s3reference.md b/submission/docs/models/shared/s3reference.md
new file mode 100755
index 000000000..75994bcaf
--- /dev/null
+++ b/submission/docs/models/shared/s3reference.md
@@ -0,0 +1,11 @@
+# S3Reference
+
+S3 Reference from File API
+
+
+## Fields
+
+| Field | Type | Required | Description | Example |
+| ---------------------------------------------------------- | ---------------------------------------------------------- | ---------------------------------------------------------- | ---------------------------------------------------------- | ---------------------------------------------------------- |
+| `bucket` | *str* | :heavy_check_mark: | N/A | epilot-user-content |
+| `key` | *str* | :heavy_check_mark: | N/A | temp/123/4d689aeb-1497-4410-a9fe-b36ca9ac4389/document.pdf |
\ No newline at end of file
diff --git a/submission/docs/models/shared/submissionentity.md b/submission/docs/models/shared/submissionentity.md
new file mode 100755
index 000000000..7c0cd1839
--- /dev/null
+++ b/submission/docs/models/shared/submissionentity.md
@@ -0,0 +1,13 @@
+# SubmissionEntity
+
+The submission entity to create
+
+
+## Fields
+
+| Field | Type | Required | Description | Example |
+| --------------------------------------------------------------------------- | --------------------------------------------------------------------------- | --------------------------------------------------------------------------- | --------------------------------------------------------------------------- | --------------------------------------------------------------------------- |
+| `additional_properties` | Dict[str, *Any*] | :heavy_minus_sign: | N/A | [object Object] |
+| `schema` | [SubmissionEntitySchema](../../models/shared/submissionentityschema.md) | :heavy_check_mark: | N/A | |
+| `description` | *Optional[str]* | :heavy_minus_sign: | Readable description of the submission. Will be used as the title if passed | |
+| `files` | List[[SubmissionEntityFiles](../../models/shared/submissionentityfiles.md)] | :heavy_minus_sign: | Files to attach to Submission Entity as a relation (s3refs from File API)
| |
\ No newline at end of file
diff --git a/submission/docs/models/shared/submissionentityfiles.md b/submission/docs/models/shared/submissionentityfiles.md
new file mode 100755
index 000000000..9360a587e
--- /dev/null
+++ b/submission/docs/models/shared/submissionentityfiles.md
@@ -0,0 +1,12 @@
+# SubmissionEntityFiles
+
+
+## Fields
+
+| Field | Type | Required | Description |
+| ------------------------------------------------- | ------------------------------------------------- | ------------------------------------------------- | ------------------------------------------------- |
+| `additional_properties` | Dict[str, *Any*] | :heavy_minus_sign: | N/A |
+| `tags` | List[*str*] | :heavy_minus_sign: | List of tags for File entities |
+| `filename` | *Optional[str]* | :heavy_minus_sign: | Override the file name |
+| `relation_tags` | List[*str*] | :heavy_minus_sign: | List of relation labels for File attachments |
+| `s3ref` | [S3Reference](../../models/shared/s3reference.md) | :heavy_check_mark: | S3 Reference from File API |
\ No newline at end of file
diff --git a/submission/docs/models/shared/submissionentityschema.md b/submission/docs/models/shared/submissionentityschema.md
new file mode 100755
index 000000000..18534392a
--- /dev/null
+++ b/submission/docs/models/shared/submissionentityschema.md
@@ -0,0 +1,8 @@
+# SubmissionEntitySchema
+
+
+## Values
+
+| Name | Value |
+| ------------ | ------------ |
+| `SUBMISSION` | submission |
\ No newline at end of file
diff --git a/submission/docs/models/shared/submissionpayload.md b/submission/docs/models/shared/submissionpayload.md
new file mode 100755
index 000000000..2e35c39ee
--- /dev/null
+++ b/submission/docs/models/shared/submissionpayload.md
@@ -0,0 +1,16 @@
+# SubmissionPayload
+
+Holds content and meta information
+
+
+## Fields
+
+| Field | Type | Required | Description | Example |
+| ---------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------- |
+| ~~`ivy_opportunity_ids`~~ | List[*str*] | :heavy_minus_sign: | : warning: ** DEPRECATED **: This will be removed in a future release, please migrate away from it as soon as possible.
Related Ivy Opportunity Ids | |
+| `entities` | List[[SubmissionEntity](../../models/shared/submissionentity.md)] | :heavy_check_mark: | Entities to create from submission
| |
+| `journey_submit_id` | *Optional[str]* | :heavy_minus_sign: | journey submit uid | 123 |
+| `opt_ins` | List[[OptIn](../../models/shared/optin.md)] | :heavy_minus_sign: | Opt-ins to create from submission
| |
+| `organization_id` | *str* | :heavy_check_mark: | organization id | 123 |
+| `source_id` | *str* | :heavy_check_mark: | identifier for source e.g. journey ID or frontend ID | ce99875f-fba9-4fe2-a8f9-afaf52059051 |
+| `source_type` | *str* | :heavy_check_mark: | type of source, e.g. journey or frontend | journey |
\ No newline at end of file
diff --git a/submission/docs/sdks/epilot/README.md b/submission/docs/sdks/epilot/README.md
new file mode 100755
index 000000000..20e90c244
--- /dev/null
+++ b/submission/docs/sdks/epilot/README.md
@@ -0,0 +1,10 @@
+# Epilot SDK
+
+
+## Overview
+
+Submission API: Use this API to handle submissions entities from external sources e.g. journeys and frontends
+
+
+### Available Operations
+
diff --git a/submission/docs/sdks/submissions/README.md b/submission/docs/sdks/submissions/README.md
new file mode 100755
index 000000000..d5554602f
--- /dev/null
+++ b/submission/docs/sdks/submissions/README.md
@@ -0,0 +1,92 @@
+# Submissions
+(*submissions*)
+
+## Overview
+
+Journey Submission
+
+### Available Operations
+
+* [create_submission](#create_submission) - createSubmission
+
+## create_submission
+
+Creates a submission from a public facing Journey
+
+
+### Example Usage
+
+```python
+import epilot
+from epilot.models import shared
+
+s = epilot.Epilot()
+
+req = shared.SubmissionPayload(
+ ivy_opportunity_ids=[
+ 'string',
+ ],
+ entities=[
+ shared.SubmissionEntity(
+ additional_properties={
+ "description": 'string',
+ "contact_first_name": 'string',
+ "contact_last_name": 'string',
+ "contact_email": 'string',
+ "request": 'string',
+ "files": 'string',
+ "_schema": 'string',
+ },
+ schema=shared.SubmissionEntitySchema.SUBMISSION,
+ files=[
+ shared.SubmissionEntityFiles(
+ additional_properties={
+ "key": 'string',
+ },
+ tags=[
+ 'string',
+ ],
+ relation_tags=[
+ 'string',
+ ],
+ s3ref=shared.S3Reference(
+ bucket='epilot-user-content',
+ key='temp/123/4d689aeb-1497-4410-a9fe-b36ca9ac4389/document.pdf',
+ ),
+ ),
+ ],
+ ),
+ ],
+ journey_submit_id='123',
+ opt_ins=[
+ shared.OptIn(
+ identifier='example@email.com',
+ meta={
+ "key": 'string',
+ },
+ topic='EMAIL_MARKETING',
+ ),
+ ],
+ organization_id='123',
+ source_id='ce99875f-fba9-4fe2-a8f9-afaf52059051',
+ source_type='journey',
+)
+
+res = s.submissions.create_submission(req)
+
+if res.status_code == 200:
+ # handle response
+ pass
+```
+
+### Parameters
+
+| Parameter | Type | Required | Description |
+| -------------------------------------------------------------------- | -------------------------------------------------------------------- | -------------------------------------------------------------------- | -------------------------------------------------------------------- |
+| `request` | [shared.SubmissionPayload](../../models/shared/submissionpayload.md) | :heavy_check_mark: | The request object to use for the request. |
+
+
+### Response
+
+**[operations.CreateSubmissionResponse](../../models/operations/createsubmissionresponse.md)**
+
diff --git a/submission/files.gen b/submission/files.gen
index b0ef2f2a1..21881ce5e 100755
--- a/submission/files.gen
+++ b/submission/files.gen
@@ -1,9 +1,11 @@
+src/epilot/sdkconfiguration.py
src/epilot/submissions.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
@@ -11,5 +13,18 @@ src/epilot/models/operations/createsubmission.py
src/epilot/models/operations/__init__.py
src/epilot/models/shared/submissionpayload.py
src/epilot/models/shared/optin.py
+src/epilot/models/shared/submissionentity.py
+src/epilot/models/shared/s3reference.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/createsubmissionresponse.md
+docs/models/shared/submissionpayload.md
+docs/models/shared/optin.md
+docs/models/shared/submissionentityschema.md
+docs/models/shared/submissionentityfiles.md
+docs/models/shared/submissionentity.md
+docs/models/shared/s3reference.md
+docs/sdks/epilot/README.md
+docs/sdks/submissions/README.md
+.gitattributes
\ No newline at end of file
diff --git a/submission/gen.yaml b/submission/gen.yaml
index 789de5f7c..24d083723 100644
--- a/submission/gen.yaml
+++ b/submission/gen.yaml
@@ -1,16 +1,26 @@
configVersion: 1.0.0
management:
- docChecksum: 89cb5b3bf127d6ae2e1c29fa5742affa
+ docChecksum: 3e73a0b032d576778d71b4b1bce49714
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:
+ additionalProperties: 0.1.0
+ core: 3.3.1
+ deprecations: 2.81.1
+ globalServerURLs: 2.82.0
python:
- version: 1.2.2
+ version: 2.1.1
author: epilot
description: Python Client SDK for Epilot
+ flattenGlobalSecurity: true
+ installationURL: https://github.com/epilot-dev/sdk-python.git#subdirectory=submission
+ maxMethodParams: 0
packageName: epilot-submission
+ repoSubDirectory: submission
diff --git a/submission/pylintrc b/submission/pylintrc
index 81c63b93f..d5760436d 100755
--- a/submission/pylintrc
+++ b/submission/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/submission/setup.py b/submission/setup.py
index a6a164c94..f45ef3c1e 100755
--- a/submission/setup.py
+++ b/submission/setup.py
@@ -10,30 +10,31 @@
setuptools.setup(
name="epilot-submission",
- 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/submission/src/epilot/__init__.py b/submission/src/epilot/__init__.py
index b9e232018..e6c0deeb6 100755
--- a/submission/src/epilot/__init__.py
+++ b/submission/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/submission/src/epilot/models/__init__.py b/submission/src/epilot/models/__init__.py
index 889f8adcf..36628d6cc 100755
--- a/submission/src/epilot/models/__init__.py
+++ b/submission/src/epilot/models/__init__.py
@@ -1,2 +1,3 @@
"""Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT."""
+# __init__.py
diff --git a/submission/src/epilot/models/errors/__init__.py b/submission/src/epilot/models/errors/__init__.py
new file mode 100755
index 000000000..cfd848441
--- /dev/null
+++ b/submission/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/submission/src/epilot/models/errors/sdkerror.py b/submission/src/epilot/models/errors/sdkerror.py
new file mode 100755
index 000000000..6bb02bbd6
--- /dev/null
+++ b/submission/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/submission/src/epilot/models/operations/createsubmission.py b/submission/src/epilot/models/operations/createsubmission.py
index 64112745c..820d15671 100755
--- a/submission/src/epilot/models/operations/createsubmission.py
+++ b/submission/src/epilot/models/operations/createsubmission.py
@@ -8,8 +8,11 @@
@dataclasses.dataclass
class CreateSubmissionResponse:
+ 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"""
+ raw_response: Optional[requests_http.Response] = dataclasses.field(default=None)
+ r"""Raw HTTP response; suitable for custom response parsing"""
- content_type: str = dataclasses.field()
- status_code: int = dataclasses.field()
- raw_response: Optional[requests_http.Response] = dataclasses.field(default=None)
-
\ No newline at end of file
+
diff --git a/submission/src/epilot/models/shared/__init__.py b/submission/src/epilot/models/shared/__init__.py
index 36a4fdd7a..389ea771a 100755
--- a/submission/src/epilot/models/shared/__init__.py
+++ b/submission/src/epilot/models/shared/__init__.py
@@ -1,6 +1,8 @@
"""Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT."""
from .optin import *
+from .s3reference import *
+from .submissionentity import *
from .submissionpayload import *
-__all__ = ["OptIn","SubmissionPayload"]
+__all__ = ["OptIn","S3Reference","SubmissionEntity","SubmissionEntityFiles","SubmissionEntitySchema","SubmissionPayload"]
diff --git a/submission/src/epilot/models/shared/optin.py b/submission/src/epilot/models/shared/optin.py
index 4e148ae0f..f6ef3e31f 100755
--- a/submission/src/epilot/models/shared/optin.py
+++ b/submission/src/epilot/models/shared/optin.py
@@ -4,15 +4,15 @@
import dataclasses
from dataclasses_json import Undefined, dataclass_json
from epilot import utils
-from typing import Any, Optional
+from typing import Any, Dict, Optional
@dataclass_json(undefined=Undefined.EXCLUDE)
@dataclasses.dataclass
class OptIn:
-
identifier: Optional[str] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('identifier'), 'exclude': lambda f: f is None }})
- r"""Consent identifier"""
- meta: Optional[dict[str, Any]] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('meta'), 'exclude': lambda f: f is None }})
- topic: Optional[str] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('topic'), 'exclude': lambda f: f is None }})
-
\ No newline at end of file
+ r"""Consent identifier"""
+ meta: Optional[Dict[str, Any]] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('meta'), 'exclude': lambda f: f is None }})
+ topic: Optional[str] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('topic'), 'exclude': lambda f: f is None }})
+
+
diff --git a/submission/src/epilot/models/shared/s3reference.py b/submission/src/epilot/models/shared/s3reference.py
new file mode 100755
index 000000000..5e7156d04
--- /dev/null
+++ b/submission/src/epilot/models/shared/s3reference.py
@@ -0,0 +1,16 @@
+"""Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT."""
+
+from __future__ import annotations
+import dataclasses
+from dataclasses_json import Undefined, dataclass_json
+from epilot import utils
+
+
+@dataclass_json(undefined=Undefined.EXCLUDE)
+@dataclasses.dataclass
+class S3Reference:
+ r"""S3 Reference from File API"""
+ 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') }})
+
+
diff --git a/submission/src/epilot/models/shared/submissionentity.py b/submission/src/epilot/models/shared/submissionentity.py
new file mode 100755
index 000000000..4a4c433c4
--- /dev/null
+++ b/submission/src/epilot/models/shared/submissionentity.py
@@ -0,0 +1,42 @@
+"""Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT."""
+
+from __future__ import annotations
+import dataclasses
+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 Any, Dict, List, Optional
+
+class SubmissionEntitySchema(str, Enum):
+ SUBMISSION = 'submission'
+
+
+@dataclass_json(undefined=Undefined.EXCLUDE)
+@dataclasses.dataclass
+class SubmissionEntityFiles:
+ s3ref: shared_s3reference.S3Reference = dataclasses.field(metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('s3ref') }})
+ r"""S3 Reference from File API"""
+ tags: Optional[List[str]] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('_tags'), 'exclude': lambda f: f is None }})
+ r"""List of tags for File entities"""
+ additional_properties: Optional[Dict[str, Any]] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'exclude': lambda f: f is None }})
+ filename: Optional[str] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('filename'), 'exclude': lambda f: f is None }})
+ r"""Override the file name"""
+ relation_tags: Optional[List[str]] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('relation_tags'), 'exclude': lambda f: f is None }})
+ r"""List of relation labels for File attachments"""
+
+
+
+
+@dataclass_json(undefined=Undefined.EXCLUDE)
+@dataclasses.dataclass
+class SubmissionEntity:
+ r"""The submission entity to create"""
+ schema: SubmissionEntitySchema = dataclasses.field(metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('_schema') }})
+ additional_properties: Optional[Dict[str, Any]] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'exclude': lambda f: f is None }})
+ description: Optional[str] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('description'), 'exclude': lambda f: f is None }})
+ r"""Readable description of the submission. Will be used as the title if passed"""
+ files: Optional[List[SubmissionEntityFiles]] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('files'), 'exclude': lambda f: f is None }})
+ r"""Files to attach to Submission Entity as a relation (s3refs from File API)"""
+
+
diff --git a/submission/src/epilot/models/shared/submissionpayload.py b/submission/src/epilot/models/shared/submissionpayload.py
index be943dc72..23b53c30a 100755
--- a/submission/src/epilot/models/shared/submissionpayload.py
+++ b/submission/src/epilot/models/shared/submissionpayload.py
@@ -3,32 +3,32 @@
from __future__ import annotations
import dataclasses
from ..shared import optin as shared_optin
+from ..shared import submissionentity as shared_submissionentity
from dataclasses_json import Undefined, dataclass_json
from epilot import utils
-from typing import Any, Optional
+from typing import List, Optional
@dataclass_json(undefined=Undefined.EXCLUDE)
@dataclasses.dataclass
class SubmissionPayload:
r"""Holds content and meta information"""
-
- entities: list[dict[str, Any]] = dataclasses.field(metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('entities') }})
- r"""Entities to create from submission
-
- """
+ entities: List[shared_submissionentity.SubmissionEntity] = dataclasses.field(metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('entities') }})
+ r"""Entities to create from submission"""
organization_id: str = dataclasses.field(metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('organization_id') }})
- r"""organization id"""
+ r"""organization id"""
source_id: str = dataclasses.field(metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('source_id') }})
- r"""identifier for source e.g. journey ID or frontend ID"""
+ r"""identifier for source e.g. journey ID or frontend ID"""
source_type: str = dataclasses.field(metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('source_type') }})
- r"""type of source, e.g. journey or frontend"""
- ivy_opportunity_ids: Optional[list[str]] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('_ivy_opportunity_ids'), 'exclude': lambda f: f is None }})
- r"""Related Ivy Opportunity Ids"""
+ r"""type of source, e.g. journey or frontend"""
+ ivy_opportunity_ids: Optional[List[str]] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('_ivy_opportunity_ids'), 'exclude': lambda f: f is None }})
+ r"""Related Ivy Opportunity Ids
+
+ Deprecated field: This will be removed in a future release, please migrate away from it as soon as possible.
+ """
journey_submit_id: Optional[str] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('journey_submit_id'), 'exclude': lambda f: f is None }})
- r"""journey submit uid"""
- opt_ins: Optional[list[shared_optin.OptIn]] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('opt_ins'), 'exclude': lambda f: f is None }})
- r"""Opt-ins to create from submission
+ r"""journey submit uid"""
+ opt_ins: Optional[List[shared_optin.OptIn]] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('opt_ins'), 'exclude': lambda f: f is None }})
+ r"""Opt-ins to create from submission"""
- """
-
\ No newline at end of file
+
diff --git a/submission/src/epilot/sdk.py b/submission/src/epilot/sdk.py
index 8e8a4c1d5..947522d3c 100755
--- a/submission/src/epilot/sdk.py
+++ b/submission/src/epilot/sdk.py
@@ -1,67 +1,51 @@
"""Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT."""
import requests as requests_http
-from . import utils
+from .sdkconfiguration import SDKConfiguration
from .submissions import Submissions
-
-SERVERS = [
- "https://submission.sls.epilot.io",
-]
-"""Contains the list of servers available to the SDK"""
+from epilot import utils
+from typing import Dict
class Epilot:
- r"""Use this API to handle submissions entities from external sources e.g. journeys and frontends
-
- """
+ r"""Submission API: Use this API to handle submissions entities from external sources e.g. journeys and frontends"""
submissions: Submissions
r"""Journey Submission"""
- _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,
+ 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 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()
+ security_client = client
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
-
- self._security_client = self._client
-
+ 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.submissions = Submissions(
- self._client,
- self._security_client,
- self._server_url,
- self._language,
- self._sdk_version,
- self._gen_version
- )
-
+ self.submissions = Submissions(self.sdk_configuration)
\ No newline at end of file
diff --git a/submission/src/epilot/sdkconfiguration.py b/submission/src/epilot/sdkconfiguration.py
new file mode 100755
index 000000000..a8f194abd
--- /dev/null
+++ b/submission/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://submission.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-submission'
+ 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/submission/src/epilot/submissions.py b/submission/src/epilot/submissions.py
index 7feafdcff..96bbe8a0c 100755
--- a/submission/src/epilot/submissions.py
+++ b/submission/src/epilot/submissions.py
@@ -1,49 +1,38 @@
"""Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT."""
-import requests as requests_http
-from . import utils
+from .sdkconfiguration import SDKConfiguration
+from epilot import utils
from epilot.models import operations, shared
class Submissions:
r"""Journey Submission"""
- _client: requests_http.Session
- _security_client: requests_http.Session
- _server_url: str
- _language: str
- _sdk_version: str
- _gen_version: str
+ sdk_configuration: SDKConfiguration
- 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
+ def __init__(self, sdk_config: SDKConfiguration) -> None:
+ self.sdk_configuration = sdk_config
+
def create_submission(self, request: shared.SubmissionPayload) -> operations.CreateSubmissionResponse:
r"""createSubmission
Creates a submission from a public facing Journey
-
"""
- base_url = self._server_url
-
- url = base_url.removesuffix('/') + '/v1/submission/submissions'
+ base_url = utils.template_url(*self.sdk_configuration.get_server_details())
+ url = base_url + '/v1/submission/submissions'
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'] = '*/*'
+ headers['user-agent'] = self.sdk_configuration.user_agent
- client = self._client
+ client = self.sdk_configuration.client
http_res = client.request('POST', url, data=data, files=form, headers=headers)
content_type = http_res.headers.get('Content-Type')
res = operations.CreateSubmissionResponse(status_code=http_res.status_code, content_type=content_type, raw_response=http_res)
- if http_res.status_code == 201:
- pass
return res
diff --git a/submission/src/epilot/utils/retries.py b/submission/src/epilot/utils/retries.py
index c6251d948..25f49a1f2 100755
--- a/submission/src/epilot/utils/retries.py
+++ b/submission/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/submission/src/epilot/utils/utils.py b/submission/src/epilot/utils/utils.py
index 9d4fba324..3ab126104 100755
--- a/submission/src/epilot/utils/utils.py
+++ b/submission/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