diff --git a/template_variables/.gitattributes b/template_variables/.gitattributes new file mode 100755 index 000000000..4d75d5900 --- /dev/null +++ b/template_variables/.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/template_variables/.gitignore b/template_variables/.gitignore new file mode 100755 index 000000000..8ac3f51d4 --- /dev/null +++ b/template_variables/.gitignore @@ -0,0 +1,7 @@ +.python-version +.DS_Store +venv/ +src/*.egg-info/ +__pycache__/ +.pytest_cache/ +.python-version` diff --git a/template_variables/README.md b/template_variables/README.md index 39dbd896e..3958f265c 100755 --- a/template_variables/README.md +++ b/template_variables/README.md @@ -12,34 +12,27 @@ pip install git+https://github.com/epilot-dev/sdk-python.git#subdirectory=templa ```python import epilot -from epilot.models import operations, shared +from epilot.models import shared s = epilot.Epilot( security=shared.Security( - epilot_auth="Bearer YOUR_BEARER_TOKEN_HERE", + epilot_auth="", ), ) - req = shared.CustomVariable( - config={ - "deserunt": "porro", - "nulla": "id", - "vero": "perspiciatis", - }, - created_at="2022-04-19T12:41:43.662Z", - created_by="100042", - helper_logic="return param1 * param2;", + config=shared.CustomVariableConfig(), + created_at='2022-04-19T12:41:43.662Z', + created_by='100042', + helper_logic='return param1 * param2;', helper_params=[ - "nihil", - "fuga", - "facilis", - "eum", + 'param1', + 'param2', ], - id="rbse777b-3cf8-4bff-bb0c-253fd1123250", - key="my_custom_table", - name="My Custom table", - template=" + id='rbse777b-3cf8-4bff-bb0c-253fd1123250', + key='my_custom_table', + name='My Custom table', + template='
{{#each table_config.header.columns as |column|}} @@ -59,7 +52,7 @@ req = shared.CustomVariable( {{/if}} {{#each @root.table_config.header.columns as |column|}} {{#if column.enable}} - {{#if (eq column.id 'item')}} + {{#if (eq column.id \'item\')}} {{/if}} - {{#if (eq column.id 'quantity')}} + {{#if (eq column.id \'quantity\')}} {{/if}} - {{#if (eq column.id 'tax')}} + {{#if (eq column.id \'tax\')}} {{/if}} - {{#if (eq column.id 'unit_amount')}} + {{#if (eq column.id \'unit_amount\')}} {{/if}} - {{#if (eq column.id 'net_total')}} + {{#if (eq column.id \'net_total\')}} {{/if}} - {{#if (eq column.id 'amount_tax')}} + {{#if (eq column.id \'amount_tax\')}} {{/if}} - {{#if (eq column.id 'gross_total')}} + {{#if (eq column.id \'gross_total\')}} {{/if}} - {{#if (isColumnEnabled @root.table_config 'net_total')}} + {{#if (isColumnEnabled @root.table_config \'net_total\')}} {{#if @root.table_config.footer.net_total.enable}} {{/if}} @@ -145,39 +138,401 @@ req = shared.CustomVariable(
{{#if @root.table_config.body.product_name.enable}} @@ -75,41 +68,41 @@ req = shared.CustomVariable( {{/if}} {{product.price.quantity}} {{product.price.tax_rate}} {{product.price.unit_amount_net}} {{product.price.amount_subtotal}} {{product.price.amount_tax}} {{product.price.amount_total}} {{#if @root.table_config.body.payment_type.enable}} - {{#if (eq product.price.type 'recurring')}} + {{#if (eq product.price.type \'recurring\')}}
{{product.price.billing_period}} {{/if}} @@ -128,7 +121,7 @@ req = shared.CustomVariable( {{#if @root.table_config.footer.payment_type.enable}}
{{item.billing_period}}{{item.amount_subtotal}}
-", - type="order_table", - updated_at="2022-04-20T12:41:43.662Z", - updated_by="100042", +', + type=shared.CustomVariableType.CUSTOM, + updated_at='2022-04-20T12:41:43.662Z', + updated_by='100042', ) - + res = s.custom_variables.create_custom_variable(req) if res.status_code == 200: # handle response + pass ``` -## SDK Available Operations +## Available Resources and Operations -### custom_variables +### [custom_variables](docs/sdks/customvariables/README.md) -* `create_custom_variable` - Create custom variable -* `delete_custom_variable` - Delete custom variable -* `get_blue_print_table_config` - Get default table config -* `get_custom_variable` - Get custom variable -* `get_custom_variables` - Get custom variables -* `update_custom_variable` - Update custom variable +* [create_custom_variable](docs/sdks/customvariables/README.md#create_custom_variable) - Create custom variable +* [delete_custom_variable](docs/sdks/customvariables/README.md#delete_custom_variable) - Delete custom variable +* [get_blue_print_table_config](docs/sdks/customvariables/README.md#get_blue_print_table_config) - Get default table config +* [get_custom_variable](docs/sdks/customvariables/README.md#get_custom_variable) - Get custom variable +* [get_custom_variables](docs/sdks/customvariables/README.md#get_custom_variables) - Get custom variables +* [update_custom_variable](docs/sdks/customvariables/README.md#update_custom_variable) - Update custom variable -### variables +### [variables](docs/sdks/variables/README.md) -* `generate_q_rcode` - generateQRcode -* `get_categories` - getCategories -* `get_variable_context` - getVariableContext -* `replace_templates` - replaceTemplates -* `search_variables` - searchVariables +* [generate_q_rcode](docs/sdks/variables/README.md#generate_q_rcode) - generateQRcode +* [get_categories](docs/sdks/variables/README.md#get_categories) - getCategories +* [get_variable_context](docs/sdks/variables/README.md#get_variable_context) - getVariableContext +* [replace_templates](docs/sdks/variables/README.md#replace_templates) - replaceTemplates +* [search_variables](docs/sdks/variables/README.md#search_variables) - searchVariables + + + + + + + + + +# 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://template-variables-api.sls.epilot.io` | None | + +For example: + + +```python +import epilot +from epilot.models import shared + +s = epilot.Epilot( + security=shared.Security( + epilot_auth="", + ), + server_idx=0 +) + +req = shared.CustomVariable( + config=shared.CustomVariableConfig(), + created_at='2022-04-19T12:41:43.662Z', + created_by='100042', + helper_logic='return param1 * param2;', + helper_params=[ + 'param1', + 'param2', + ], + id='rbse777b-3cf8-4bff-bb0c-253fd1123250', + key='my_custom_table', + name='My Custom table', + template=' + + + {{#each table_config.header.columns as |column|}} + {{#if column.enable}} + + {{/if}} + {{/each}} + + + + + {{#each order.products as |product|}} + {{#if @last}} + + {{else}} + + {{/if}} + {{#each @root.table_config.header.columns as |column|}} + {{#if column.enable}} + {{#if (eq column.id \'item\')}} + + + {{/if}} + {{#if (eq column.id \'quantity\')}} + + + {{/if}} + {{#if (eq column.id \'tax\')}} + + + {{/if}} + {{#if (eq column.id \'unit_amount\')}} + + + {{/if}} + {{#if (eq column.id \'net_total\')}} + + + {{/if}} + {{#if (eq column.id \'amount_tax\')}} + + + {{/if}} + {{#if (eq column.id \'gross_total\')}} + + + {{/if}} + {{/if}} + {{/each}} + + {{/each}} + + {{#if table_config.footer.gross_total.enable}} + {{#each order.total_details.recurrences as |item|}} + + + {{#if @root.table_config.footer.payment_type.enable}} + + {{/if}} + {{#if (isColumnEnabled @root.table_config \'net_total\')}} + {{#if @root.table_config.footer.net_total.enable}} + + {{/if}} + {{/if}} + + + {{/each}} + {{/if}} + + +
{{column._label}}
+ {{#if @root.table_config.body.product_name.enable}} + {{product.name}} + {{/if}} + {{#if @root.table_config.body.price_description.enable}} +
+ {{product.price.description}} + {{/if}} + {{#if @root.table_config.body.product_description.enable}} +
+ {{product.description}} + {{/if}} +
{{product.price.quantity}} + + {{product.price.tax_rate}} + + {{product.price.unit_amount_net}} + + {{product.price.amount_subtotal}} + + {{product.price.amount_tax}} + + {{product.price.amount_total}} + {{#if @root.table_config.body.payment_type.enable}} + {{#if (eq product.price.type \'recurring\')}} +
+ {{product.price.billing_period}} + {{/if}} + {{/if}} +
{{item.billing_period}}{{item.amount_subtotal}}{{item.amount_total}} + {{#if @root.table_config.footer.amount_tax.enable}} +
+ {{item.full_amount_tax}} + {{/if}} +
+', + type=shared.CustomVariableType.CUSTOM, + updated_at='2022-04-20T12:41:43.662Z', + updated_by='100042', +) + +res = s.custom_variables.create_custom_variable(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( + security=shared.Security( + epilot_auth="", + ), + server_url="https://template-variables-api.sls.epilot.io" +) + +req = shared.CustomVariable( + config=shared.CustomVariableConfig(), + created_at='2022-04-19T12:41:43.662Z', + created_by='100042', + helper_logic='return param1 * param2;', + helper_params=[ + 'param1', + 'param2', + ], + id='rbse777b-3cf8-4bff-bb0c-253fd1123250', + key='my_custom_table', + name='My Custom table', + template=' + + + {{#each table_config.header.columns as |column|}} + {{#if column.enable}} + + {{/if}} + {{/each}} + + + + + {{#each order.products as |product|}} + {{#if @last}} + + {{else}} + + {{/if}} + {{#each @root.table_config.header.columns as |column|}} + {{#if column.enable}} + {{#if (eq column.id \'item\')}} + + + {{/if}} + {{#if (eq column.id \'quantity\')}} + + + {{/if}} + {{#if (eq column.id \'tax\')}} + + + {{/if}} + {{#if (eq column.id \'unit_amount\')}} + + + {{/if}} + {{#if (eq column.id \'net_total\')}} + + + {{/if}} + {{#if (eq column.id \'amount_tax\')}} + + + {{/if}} + {{#if (eq column.id \'gross_total\')}} + + + {{/if}} + {{/if}} + {{/each}} + + {{/each}} + + {{#if table_config.footer.gross_total.enable}} + {{#each order.total_details.recurrences as |item|}} + + + {{#if @root.table_config.footer.payment_type.enable}} + + {{/if}} + {{#if (isColumnEnabled @root.table_config \'net_total\')}} + {{#if @root.table_config.footer.net_total.enable}} + + {{/if}} + {{/if}} + + + {{/each}} + {{/if}} + + +
{{column._label}}
+ {{#if @root.table_config.body.product_name.enable}} + {{product.name}} + {{/if}} + {{#if @root.table_config.body.price_description.enable}} +
+ {{product.price.description}} + {{/if}} + {{#if @root.table_config.body.product_description.enable}} +
+ {{product.description}} + {{/if}} +
{{product.price.quantity}} + + {{product.price.tax_rate}} + + {{product.price.unit_amount_net}} + + {{product.price.amount_subtotal}} + + {{product.price.amount_tax}} + + {{product.price.amount_total}} + {{#if @root.table_config.body.payment_type.enable}} + {{#if (eq product.price.type \'recurring\')}} +
+ {{product.price.billing_period}} + {{/if}} + {{/if}} +
{{item.billing_period}}{{item.amount_subtotal}}{{item.amount_total}} + {{#if @root.table_config.footer.amount_tax.enable}} +
+ {{item.full_amount_tax}} + {{/if}} +
+', + type=shared.CustomVariableType.CUSTOM, + updated_at='2022-04-20T12:41:43.662Z', + updated_by='100042', +) + +res = s.custom_variables.create_custom_variable(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/template_variables/RELEASES.md b/template_variables/RELEASES.md index 6b443894d..0d96444b1 100644 --- a/template_variables/RELEASES.md +++ b/template_variables/RELEASES.md @@ -34,4 +34,564 @@ Based on: ### Changes Based on: - OpenAPI Doc 1.0.0 https://docs.api.epilot.io/template-variables.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:33:29 +### Changes +Based on: +- OpenAPI Doc 1.0.0 https://docs.api.epilot.io/template-variables.yaml +- Speakeasy CLI 1.19.3 (2.16.7) https://github.com/speakeasy-api/speakeasy + +## 2023-04-06 01:23:40 +### Changes +Based on: +- OpenAPI Doc 1.0.0 https://docs.api.epilot.io/template-variables.yaml +- Speakeasy CLI 1.19.6 (2.17.8) https://github.com/speakeasy-api/speakeasy + +## 2023-04-12 01:25:11 +### Changes +Based on: +- OpenAPI Doc 1.0.0 https://docs.api.epilot.io/template-variables.yaml +- Speakeasy CLI 1.19.7 (2.17.9) https://github.com/speakeasy-api/speakeasy + +## 2023-04-14 01:24:57 +### Changes +Based on: +- OpenAPI Doc 1.0.0 https://docs.api.epilot.io/template-variables.yaml +- Speakeasy CLI 1.20.0 (2.18.0) https://github.com/speakeasy-api/speakeasy + +## 2023-04-18 01:24:47 +### Changes +Based on: +- OpenAPI Doc 1.0.0 https://docs.api.epilot.io/template-variables.yaml +- Speakeasy CLI 1.20.1 (2.18.1) https://github.com/speakeasy-api/speakeasy + +## 2023-04-19 01:27:35 +### Changes +Based on: +- OpenAPI Doc 1.0.0 https://docs.api.epilot.io/template-variables.yaml +- Speakeasy CLI 1.20.2 (2.18.2) https://github.com/speakeasy-api/speakeasy + +## 2023-04-21 01:24:38 +### Changes +Based on: +- OpenAPI Doc 1.0.0 https://docs.api.epilot.io/template-variables.yaml +- Speakeasy CLI 1.21.4 (2.19.1) https://github.com/speakeasy-api/speakeasy + +## 2023-04-22 01:25:55 +### Changes +Based on: +- OpenAPI Doc 1.0.0 https://docs.api.epilot.io/template-variables.yaml +- Speakeasy CLI 1.22.1 (2.20.1) https://github.com/speakeasy-api/speakeasy + +## 2023-04-26 01:25:35 +### Changes +Based on: +- OpenAPI Doc 1.0.0 https://docs.api.epilot.io/template-variables.yaml +- Speakeasy CLI 1.23.1 (2.21.1) https://github.com/speakeasy-api/speakeasy + +## 2023-04-27 01:33:48 +### Changes +Based on: +- OpenAPI Doc 1.0.0 https://docs.api.epilot.io/template-variables.yaml +- Speakeasy CLI 1.25.1 (2.22.0) https://github.com/speakeasy-api/speakeasy + +## 2023-04-28 01:33:51 +### Changes +Based on: +- OpenAPI Doc 1.0.0 https://docs.api.epilot.io/template-variables.yaml +- Speakeasy CLI 1.26.2 (2.23.2) https://github.com/speakeasy-api/speakeasy + +## 2023-04-29 01:25:42 +### Changes +Based on: +- OpenAPI Doc 1.0.0 https://docs.api.epilot.io/template-variables.yaml +- Speakeasy CLI 1.26.4 (2.23.4) https://github.com/speakeasy-api/speakeasy + +## 2023-05-02 01:26:26 +### Changes +Based on: +- OpenAPI Doc 1.0.0 https://docs.api.epilot.io/template-variables.yaml +- Speakeasy CLI 1.26.5 (2.23.6) https://github.com/speakeasy-api/speakeasy + +## 2023-05-03 01:27:03 +### Changes +Based on: +- OpenAPI Doc 1.0.0 https://docs.api.epilot.io/template-variables.yaml +- Speakeasy CLI 1.27.0 (2.24.0) https://github.com/speakeasy-api/speakeasy + +## 2023-05-05 01:20:19 +### Changes +Based on: +- OpenAPI Doc 1.0.0 https://docs.api.epilot.io/template-variables.yaml +- Speakeasy CLI 1.29.0 (2.26.0) https://github.com/speakeasy-api/speakeasy + +## 2023-05-06 01:21:45 +### Changes +Based on: +- OpenAPI Doc 1.0.0 https://docs.api.epilot.io/template-variables.yaml +- Speakeasy CLI 1.29.1 (2.26.1) https://github.com/speakeasy-api/speakeasy + +## 2023-05-10 01:24:09 +### Changes +Based on: +- OpenAPI Doc 1.0.0 https://docs.api.epilot.io/template-variables.yaml +- Speakeasy CLI 1.29.2 (2.26.2) https://github.com/speakeasy-api/speakeasy + +## 2023-05-11 01:25:46 +### Changes +Based on: +- OpenAPI Doc 1.0.0 https://docs.api.epilot.io/template-variables.yaml +- Speakeasy CLI 1.30.0 (2.26.3) https://github.com/speakeasy-api/speakeasy + +## 2023-05-12 01:25:21 +### Changes +Based on: +- OpenAPI Doc 1.0.0 https://docs.api.epilot.io/template-variables.yaml +- Speakeasy CLI 1.30.1 (2.26.4) https://github.com/speakeasy-api/speakeasy + +## 2023-05-13 01:24:00 +### Changes +Based on: +- OpenAPI Doc 1.0.0 https://docs.api.epilot.io/template-variables.yaml +- Speakeasy CLI 1.31.1 (2.27.0) https://github.com/speakeasy-api/speakeasy + +## 2023-05-16 01:35:18 +### Changes +Based on: +- OpenAPI Doc 1.0.0 https://docs.api.epilot.io/template-variables.yaml +- Speakeasy CLI 1.32.0 (2.28.0) https://github.com/speakeasy-api/speakeasy + +## 2023-05-17 01:35:36 +### Changes +Based on: +- OpenAPI Doc 1.0.0 https://docs.api.epilot.io/template-variables.yaml +- Speakeasy CLI 1.33.2 (2.29.0) https://github.com/speakeasy-api/speakeasy + +## 2023-05-18 01:26:40 +### Changes +Based on: +- OpenAPI Doc 1.0.0 https://docs.api.epilot.io/template-variables.yaml +- Speakeasy CLI 1.34.0 (2.30.0) https://github.com/speakeasy-api/speakeasy + +## 2023-05-19 01:34:05 +### Changes +Based on: +- OpenAPI Doc 1.0.0 https://docs.api.epilot.io/template-variables.yaml +- Speakeasy CLI 1.35.0 (2.31.0) https://github.com/speakeasy-api/speakeasy + +## 2023-05-23 01:35:15 +### Changes +Based on: +- OpenAPI Doc 1.0.0 https://docs.api.epilot.io/template-variables.yaml +- Speakeasy CLI 1.37.5 (2.32.2) https://github.com/speakeasy-api/speakeasy + +## 2023-05-27 01:33:25 +### Changes +Based on: +- OpenAPI Doc 1.0.0 https://docs.api.epilot.io/template-variables.yaml +- Speakeasy CLI 1.39.0 (2.32.7) https://github.com/speakeasy-api/speakeasy + +## 2023-06-01 02:08:32 +### Changes +Based on: +- OpenAPI Doc 1.0.0 https://docs.api.epilot.io/template-variables.yaml +- Speakeasy CLI 1.40.2 (2.34.2) https://github.com/speakeasy-api/speakeasy + +## 2023-06-02 01:51:27 +### Changes +Based on: +- OpenAPI Doc 1.0.0 https://docs.api.epilot.io/template-variables.yaml +- Speakeasy CLI 1.40.3 (2.34.7) https://github.com/speakeasy-api/speakeasy + +## 2023-06-03 01:48:01 +### Changes +Based on: +- OpenAPI Doc 1.0.0 https://docs.api.epilot.io/template-variables.yaml +- Speakeasy CLI 1.43.0 (2.35.3) https://github.com/speakeasy-api/speakeasy + +## 2023-06-07 01:54:17 +### Changes +Based on: +- OpenAPI Doc 1.0.0 https://docs.api.epilot.io/template-variables.yaml +- Speakeasy CLI 1.44.2 (2.35.9) https://github.com/speakeasy-api/speakeasy + +## 2023-06-08 01:51:35 +### Changes +Based on: +- OpenAPI Doc 1.0.0 https://docs.api.epilot.io/template-variables.yaml +- Speakeasy CLI 1.45.0 (2.37.0) https://github.com/speakeasy-api/speakeasy + +## 2023-06-09 01:51:27 +### Changes +Based on: +- OpenAPI Doc 1.0.0 https://docs.api.epilot.io/template-variables.yaml +- Speakeasy CLI 1.45.2 (2.37.2) https://github.com/speakeasy-api/speakeasy + +## 2023-06-10 01:42:32 +### Changes +Based on: +- OpenAPI Doc 1.0.0 https://docs.api.epilot.io/template-variables.yaml +- Speakeasy CLI 1.47.0 (2.39.0) https://github.com/speakeasy-api/speakeasy + +## 2023-06-11 01:59:14 +### Changes +Based on: +- OpenAPI Doc 1.0.0 https://docs.api.epilot.io/template-variables.yaml +- Speakeasy CLI 1.47.1 (2.39.2) https://github.com/speakeasy-api/speakeasy + +## 2023-06-14 01:43:28 +### Changes +Based on: +- OpenAPI Doc 1.0.0 https://docs.api.epilot.io/template-variables.yaml +- Speakeasy CLI 1.47.3 (2.40.1) https://github.com/speakeasy-api/speakeasy + +## 2023-06-16 01:43:36 +### Changes +Based on: +- OpenAPI Doc 1.0.0 https://docs.api.epilot.io/template-variables.yaml +- Speakeasy CLI 1.48.0 (2.41.1) https://github.com/speakeasy-api/speakeasy + +## 2023-06-20 01:38:44 +### Changes +Based on: +- OpenAPI Doc 1.0.0 https://docs.api.epilot.io/template-variables.yaml +- Speakeasy CLI 1.49.0 (2.41.4) https://github.com/speakeasy-api/speakeasy + +## 2023-06-21 01:40:06 +### Changes +Based on: +- OpenAPI Doc 1.0.0 https://docs.api.epilot.io/template-variables.yaml +- Speakeasy CLI 1.49.1 (2.41.5) https://github.com/speakeasy-api/speakeasy + +## 2023-06-23 01:55:05 +### Changes +Based on: +- OpenAPI Doc 1.0.0 https://docs.api.epilot.io/template-variables.yaml +- Speakeasy CLI 1.50.1 (2.43.2) https://github.com/speakeasy-api/speakeasy + +## 2023-06-27 01:56:41 +### Changes +Based on: +- OpenAPI Doc 1.0.0 https://docs.api.epilot.io/template-variables.yaml +- Speakeasy CLI 1.51.1 (2.50.2) https://github.com/speakeasy-api/speakeasy + +## 2023-06-29 01:51:31 +### Changes +Based on: +- OpenAPI Doc 1.0.0 https://docs.api.epilot.io/template-variables.yaml +- Speakeasy CLI 1.51.3 (2.52.2) https://github.com/speakeasy-api/speakeasy + +## 2023-07-01 02:01:26 +### Changes +Based on: +- OpenAPI Doc 1.0.0 https://docs.api.epilot.io/template-variables.yaml +- Speakeasy CLI 1.52.0 (2.55.0) https://github.com/speakeasy-api/speakeasy + +## 2023-07-06 01:57:38 +### Changes +Based on: +- OpenAPI Doc 1.0.0 https://docs.api.epilot.io/template-variables.yaml +- Speakeasy CLI 1.52.2 (2.57.2) https://github.com/speakeasy-api/speakeasy + +## 2023-07-07 01:55:13 +### Changes +Based on: +- OpenAPI Doc 1.0.0 https://docs.api.epilot.io/template-variables.yaml +- Speakeasy CLI 1.53.0 (2.58.0) https://github.com/speakeasy-api/speakeasy + +## 2023-07-08 01:54:07 +### Changes +Based on: +- OpenAPI Doc 1.0.0 https://docs.api.epilot.io/template-variables.yaml +- Speakeasy CLI 1.53.1 (2.58.2) https://github.com/speakeasy-api/speakeasy + +## 2023-07-11 01:47:26 +### Changes +Based on: +- OpenAPI Doc 1.0.0 https://docs.api.epilot.io/template-variables.yaml +- Speakeasy CLI 1.56.0 (2.61.0) https://github.com/speakeasy-api/speakeasy + +## 2023-07-12 01:55:37 +### Changes +Based on: +- OpenAPI Doc 1.0.0 https://docs.api.epilot.io/template-variables.yaml +- Speakeasy CLI 1.56.4 (2.61.5) https://github.com/speakeasy-api/speakeasy + +## 2023-07-13 01:58:03 +### Changes +Based on: +- OpenAPI Doc 1.0.0 https://docs.api.epilot.io/template-variables.yaml +- Speakeasy CLI 1.57.0 (2.62.1) https://github.com/speakeasy-api/speakeasy + +## 2023-07-14 01:57:57 +### Changes +Based on: +- OpenAPI Doc 1.0.0 https://docs.api.epilot.io/template-variables.yaml +- Speakeasy CLI 1.59.0 (2.65.0) https://github.com/speakeasy-api/speakeasy + +## 2023-07-17 02:00:59 +### Changes +Based on: +- OpenAPI Doc 1.0.0 https://docs.api.epilot.io/template-variables.yaml +- Speakeasy CLI 1.60.0 (2.66.0) https://github.com/speakeasy-api/speakeasy + +## 2023-07-18 02:05:30 +### Changes +Based on: +- OpenAPI Doc 1.0.0 https://docs.api.epilot.io/template-variables.yaml +- Speakeasy CLI 1.61.0 (2.70.0) https://github.com/speakeasy-api/speakeasy + +## 2023-07-19 02:54:00 +### Changes +Based on: +- OpenAPI Doc 1.0.0 https://docs.api.epilot.io/template-variables.yaml +- Speakeasy CLI 1.62.1 (2.70.2) https://github.com/speakeasy-api/speakeasy + +## 2023-07-22 01:35:37 +### Changes +Based on: +- OpenAPI Doc 1.0.0 https://docs.api.epilot.io/template-variables.yaml +- Speakeasy CLI 1.64.0 (2.71.0) https://github.com/speakeasy-api/speakeasy + +## 2023-07-26 01:39:14 +### Changes +Based on: +- OpenAPI Doc 1.0.0 https://docs.api.epilot.io/template-variables.yaml +- Speakeasy CLI 1.65.0 (2.73.0) https://github.com/speakeasy-api/speakeasy + +## 2023-07-27 01:21:29 +### Changes +Based on: +- OpenAPI Doc 1.0.0 https://docs.api.epilot.io/template-variables.yaml +- Speakeasy CLI 1.65.1 (2.73.1) https://github.com/speakeasy-api/speakeasy + +## 2023-07-28 01:22:34 +### Changes +Based on: +- OpenAPI Doc 1.0.0 https://docs.api.epilot.io/template-variables.yaml +- Speakeasy CLI 1.65.2 (2.75.1) https://github.com/speakeasy-api/speakeasy + +## 2023-08-01 01:41:19 +### Changes +Based on: +- OpenAPI Doc 1.0.0 https://docs.api.epilot.io/template-variables.yaml +- Speakeasy CLI 1.66.1 (2.75.2) https://github.com/speakeasy-api/speakeasy + +## 2023-08-03 01:24:11 +### Changes +Based on: +- OpenAPI Doc 1.0.0 https://docs.api.epilot.io/template-variables.yaml +- Speakeasy CLI 1.68.1 (2.77.1) https://github.com/speakeasy-api/speakeasy + +## 2023-08-04 01:24:55 +### Changes +Based on: +- OpenAPI Doc 1.0.0 https://docs.api.epilot.io/template-variables.yaml +- Speakeasy CLI 1.68.3 (2.81.1) https://github.com/speakeasy-api/speakeasy + +## 2023-08-08 01:22:08 +### Changes +Based on: +- OpenAPI Doc 1.0.0 https://docs.api.epilot.io/template-variables.yaml +- Speakeasy CLI 1.69.1 (2.82.0) https://github.com/speakeasy-api/speakeasy + +## 2023-08-15 01:11:39 +### Changes +Based on: +- OpenAPI Doc 1.0.0 https://docs.api.epilot.io/template-variables.yaml +- Speakeasy CLI 1.72.0 (2.84.1) https://github.com/speakeasy-api/speakeasy +### Generated +- [python v1.41.0] template_variables + +## 2023-08-19 01:09:13 +### Changes +Based on: +- OpenAPI Doc 1.0.0 https://docs.api.epilot.io/template-variables.yaml +- Speakeasy CLI 1.74.3 (2.86.6) https://github.com/speakeasy-api/speakeasy +### Generated +- [python v1.41.1] template_variables + +## 2023-08-24 01:11:21 +### Changes +Based on: +- OpenAPI Doc 1.0.0 https://docs.api.epilot.io/template-variables.yaml +- Speakeasy CLI 1.74.9 (2.86.10) https://github.com/speakeasy-api/speakeasy +### Generated +- [python v1.41.2] template_variables + +## 2023-08-25 01:13:01 +### Changes +Based on: +- OpenAPI Doc 1.0.0 https://docs.api.epilot.io/template-variables.yaml +- Speakeasy CLI 1.74.11 (2.87.1) https://github.com/speakeasy-api/speakeasy +### Generated +- [python v1.41.3] template_variables + +## 2023-08-26 01:10:05 +### Changes +Based on: +- OpenAPI Doc 1.0.0 https://docs.api.epilot.io/template-variables.yaml +- Speakeasy CLI 1.74.16 (2.88.2) https://github.com/speakeasy-api/speakeasy +### Generated +- [python v1.42.0] template_variables + +## 2023-08-29 01:13:32 +### Changes +Based on: +- OpenAPI Doc 1.0.0 https://docs.api.epilot.io/template-variables.yaml +- Speakeasy CLI 1.74.17 (2.88.5) https://github.com/speakeasy-api/speakeasy +### Generated +- [python v1.42.1] template_variables + +## 2023-08-31 01:13:39 +### Changes +Based on: +- OpenAPI Doc 1.0.0 https://docs.api.epilot.io/template-variables.yaml +- Speakeasy CLI 1.76.1 (2.89.1) https://github.com/speakeasy-api/speakeasy +### Generated +- [python v1.43.0] template_variables + +## 2023-09-01 01:18:03 +### Changes +Based on: +- OpenAPI Doc 1.0.0 https://docs.api.epilot.io/template-variables.yaml +- Speakeasy CLI 1.77.0 (2.91.2) https://github.com/speakeasy-api/speakeasy +### Generated +- [python v1.44.0] template_variables + +## 2023-09-02 01:10:49 +### Changes +Based on: +- OpenAPI Doc 1.0.0 https://docs.api.epilot.io/template-variables.yaml +- Speakeasy CLI 1.77.2 (2.93.0) https://github.com/speakeasy-api/speakeasy +### Generated +- [python v1.44.1] template_variables + +## 2023-09-05 01:11:57 +### Changes +Based on: +- OpenAPI Doc 1.0.0 https://docs.api.epilot.io/template-variables.yaml +- Speakeasy CLI 1.78.3 (2.96.3) https://github.com/speakeasy-api/speakeasy +### Generated +- [python v1.44.2] template_variables + +## 2023-09-12 01:11:48 +### Changes +Based on: +- OpenAPI Doc 1.0.0 https://docs.api.epilot.io/template-variables.yaml +- Speakeasy CLI 1.82.5 (2.108.3) https://github.com/speakeasy-api/speakeasy +### Generated +- [python v1.44.3] template_variables + +## 2023-09-16 01:12:04 +### Changes +Based on: +- OpenAPI Doc 1.0.0 https://docs.api.epilot.io/template-variables.yaml +- Speakeasy CLI 1.86.0 (2.115.2) https://github.com/speakeasy-api/speakeasy +### Generated +- [python v1.44.4] template_variables + +## 2023-09-20 01:14:05 +### Changes +Based on: +- OpenAPI Doc 1.0.0 https://docs.api.epilot.io/template-variables.yaml +- Speakeasy CLI 1.88.0 (2.118.1) https://github.com/speakeasy-api/speakeasy +### Generated +- [python v1.44.5] template_variables + +## 2023-09-26 01:15:06 +### Changes +Based on: +- OpenAPI Doc 1.0.0 https://docs.api.epilot.io/template-variables.yaml +- Speakeasy CLI 1.91.0 (2.129.1) https://github.com/speakeasy-api/speakeasy +### Generated +- [python v1.45.0] template_variables + +## 2023-09-27 01:14:59 +### Changes +Based on: +- OpenAPI Doc 1.0.0 https://docs.api.epilot.io/template-variables.yaml +- Speakeasy CLI 1.91.2 (2.131.1) https://github.com/speakeasy-api/speakeasy +### Generated +- [python v1.45.1] template_variables + +## 2023-09-29 01:14:25 +### Changes +Based on: +- OpenAPI Doc 1.0.0 https://docs.api.epilot.io/template-variables.yaml +- Speakeasy CLI 1.91.3 (2.139.1) https://github.com/speakeasy-api/speakeasy +### Generated +- [python v1.46.0] template_variables + +## 2023-10-01 01:23:52 +### Changes +Based on: +- OpenAPI Doc 1.0.0 https://docs.api.epilot.io/template-variables.yaml +- Speakeasy CLI 1.92.2 (2.142.2) https://github.com/speakeasy-api/speakeasy +### Generated +- [python v1.47.0] template_variables + +## 2023-10-02 01:15:14 +### Changes +Based on: +- OpenAPI Doc 1.0.0 https://docs.api.epilot.io/template-variables.yaml +- Speakeasy CLI 1.92.3 (2.143.2) https://github.com/speakeasy-api/speakeasy +### Generated +- [python v1.47.1] template_variables + +## 2023-10-05 01:15:04 +### Changes +Based on: +- OpenAPI Doc 1.0.0 https://docs.api.epilot.io/template-variables.yaml +- Speakeasy CLI 1.94.0 (2.147.0) https://github.com/speakeasy-api/speakeasy +### Generated +- [python v1.47.2] template_variables + +## 2023-10-07 01:14:03 +### Changes +Based on: +- OpenAPI Doc 1.0.0 https://docs.api.epilot.io/template-variables.yaml +- Speakeasy CLI 1.96.1 (2.150.0) https://github.com/speakeasy-api/speakeasy +### Generated +- [python v1.48.0] template_variables + +## 2023-10-13 01:16:47 +### Changes +Based on: +- OpenAPI Doc 1.0.0 https://docs.api.epilot.io/template-variables.yaml +- Speakeasy CLI 1.99.1 (2.154.1) https://github.com/speakeasy-api/speakeasy +### Generated +- [python v1.48.1] template_variables + +## 2023-10-18 01:15:21 +### Changes +Based on: +- OpenAPI Doc 1.0.0 https://docs.api.epilot.io/template-variables.yaml +- Speakeasy CLI 1.101.0 (2.161.0) https://github.com/speakeasy-api/speakeasy +### Generated +- [python v2.0.0] template_variables + +## 2023-10-20 01:14:46 +### Changes +Based on: +- OpenAPI Doc 1.0.0 https://docs.api.epilot.io/template-variables.yaml +- Speakeasy CLI 1.101.0 (2.161.0) https://github.com/speakeasy-api/speakeasy +### Generated +- [python v2.0.1] template_variables + +## 2023-10-21 01:12:41 +### Changes +Based on: +- OpenAPI Doc 1.0.0 https://docs.api.epilot.io/template-variables.yaml +- Speakeasy CLI 1.104.0 (2.169.0) https://github.com/speakeasy-api/speakeasy +### Generated +- [python v2.1.0] template_variables + +## 2023-10-28 01:12:01 +### Changes +Based on: +- OpenAPI Doc 1.0.0 https://docs.api.epilot.io/template-variables.yaml +- Speakeasy CLI 1.109.0 (2.173.0) https://github.com/speakeasy-api/speakeasy +### Generated +- [python v2.1.1] template_variables \ No newline at end of file diff --git a/template_variables/USAGE.md b/template_variables/USAGE.md index abcb76fe3..3d821cd23 100755 --- a/template_variables/USAGE.md +++ b/template_variables/USAGE.md @@ -1,34 +1,29 @@ + + ```python import epilot -from epilot.models import operations, shared +from epilot.models import shared s = epilot.Epilot( security=shared.Security( - epilot_auth="Bearer YOUR_BEARER_TOKEN_HERE", + epilot_auth="", ), ) - req = shared.CustomVariable( - config={ - "deserunt": "porro", - "nulla": "id", - "vero": "perspiciatis", - }, - created_at="2022-04-19T12:41:43.662Z", - created_by="100042", - helper_logic="return param1 * param2;", + config=shared.CustomVariableConfig(), + created_at='2022-04-19T12:41:43.662Z', + created_by='100042', + helper_logic='return param1 * param2;', helper_params=[ - "nihil", - "fuga", - "facilis", - "eum", + 'param1', + 'param2', ], - id="rbse777b-3cf8-4bff-bb0c-253fd1123250", - key="my_custom_table", - name="My Custom table", - template=" + id='rbse777b-3cf8-4bff-bb0c-253fd1123250', + key='my_custom_table', + name='My Custom table', + template='
{{#each table_config.header.columns as |column|}} @@ -48,7 +43,7 @@ req = shared.CustomVariable( {{/if}} {{#each @root.table_config.header.columns as |column|}} {{#if column.enable}} - {{#if (eq column.id 'item')}} + {{#if (eq column.id \'item\')}} {{/if}} - {{#if (eq column.id 'quantity')}} + {{#if (eq column.id \'quantity\')}} {{/if}} - {{#if (eq column.id 'tax')}} + {{#if (eq column.id \'tax\')}} {{/if}} - {{#if (eq column.id 'unit_amount')}} + {{#if (eq column.id \'unit_amount\')}} {{/if}} - {{#if (eq column.id 'net_total')}} + {{#if (eq column.id \'net_total\')}} {{/if}} - {{#if (eq column.id 'amount_tax')}} + {{#if (eq column.id \'amount_tax\')}} {{/if}} - {{#if (eq column.id 'gross_total')}} + {{#if (eq column.id \'gross_total\')}} {{/if}} - {{#if (isColumnEnabled @root.table_config 'net_total')}} + {{#if (isColumnEnabled @root.table_config \'net_total\')}} {{#if @root.table_config.footer.net_total.enable}} {{/if}} @@ -134,15 +129,16 @@ req = shared.CustomVariable(
{{#if @root.table_config.body.product_name.enable}} @@ -64,41 +59,41 @@ req = shared.CustomVariable( {{/if}} {{product.price.quantity}} {{product.price.tax_rate}} {{product.price.unit_amount_net}} {{product.price.amount_subtotal}} {{product.price.amount_tax}} {{product.price.amount_total}} {{#if @root.table_config.body.payment_type.enable}} - {{#if (eq product.price.type 'recurring')}} + {{#if (eq product.price.type \'recurring\')}}
{{product.price.billing_period}} {{/if}} @@ -117,7 +112,7 @@ req = shared.CustomVariable( {{#if @root.table_config.footer.payment_type.enable}}
{{item.billing_period}}{{item.amount_subtotal}}
-", - type="order_table", - updated_at="2022-04-20T12:41:43.662Z", - updated_by="100042", +', + type=shared.CustomVariableType.CUSTOM, + updated_at='2022-04-20T12:41:43.662Z', + updated_by='100042', ) - + res = s.custom_variables.create_custom_variable(req) if res.status_code == 200: # handle response + pass ``` \ No newline at end of file diff --git a/template_variables/docs/models/operations/createcustomvariableresponse.md b/template_variables/docs/models/operations/createcustomvariableresponse.md new file mode 100755 index 000000000..e299c214b --- /dev/null +++ b/template_variables/docs/models/operations/createcustomvariableresponse.md @@ -0,0 +1,10 @@ +# CreateCustomVariableResponse + + +## 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/template_variables/docs/models/operations/deletecustomvariablerequest.md b/template_variables/docs/models/operations/deletecustomvariablerequest.md new file mode 100755 index 000000000..e1d80ec54 --- /dev/null +++ b/template_variables/docs/models/operations/deletecustomvariablerequest.md @@ -0,0 +1,8 @@ +# DeleteCustomVariableRequest + + +## Fields + +| Field | Type | Required | Description | +| ------------------ | ------------------ | ------------------ | ------------------ | +| `id` | *str* | :heavy_check_mark: | Custom vairable ID | \ No newline at end of file diff --git a/template_variables/docs/models/operations/deletecustomvariableresponse.md b/template_variables/docs/models/operations/deletecustomvariableresponse.md new file mode 100755 index 000000000..c2430b586 --- /dev/null +++ b/template_variables/docs/models/operations/deletecustomvariableresponse.md @@ -0,0 +1,10 @@ +# DeleteCustomVariableResponse + + +## 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/template_variables/docs/models/operations/generateqrcoderequest.md b/template_variables/docs/models/operations/generateqrcoderequest.md new file mode 100755 index 000000000..058d7f0fc --- /dev/null +++ b/template_variables/docs/models/operations/generateqrcoderequest.md @@ -0,0 +1,8 @@ +# GenerateQRcodeRequest + + +## Fields + +| Field | Type | Required | Description | +| ---------------------- | ---------------------- | ---------------------- | ---------------------- | +| `qrdata` | *Optional[str]* | :heavy_minus_sign: | Payload of the QR code | \ No newline at end of file diff --git a/template_variables/docs/models/operations/generateqrcoderesponse.md b/template_variables/docs/models/operations/generateqrcoderesponse.md new file mode 100755 index 000000000..9777a0b8d --- /dev/null +++ b/template_variables/docs/models/operations/generateqrcoderesponse.md @@ -0,0 +1,10 @@ +# GenerateQRcodeResponse + + +## 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/template_variables/docs/models/operations/getblueprinttableconfigresponse.md b/template_variables/docs/models/operations/getblueprinttableconfigresponse.md new file mode 100755 index 000000000..74ceda0ed --- /dev/null +++ b/template_variables/docs/models/operations/getblueprinttableconfigresponse.md @@ -0,0 +1,11 @@ +# GetBluePrintTableConfigResponse + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------- | +| `content_type` | *str* | :heavy_check_mark: | HTTP response content type for this operation | +| `custom_variable` | [Optional[shared.CustomVariable]](../../models/shared/customvariable.md) | :heavy_minus_sign: | Success | +| `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/template_variables/docs/models/operations/getcategorieslang.md b/template_variables/docs/models/operations/getcategorieslang.md new file mode 100755 index 000000000..3fabe10f7 --- /dev/null +++ b/template_variables/docs/models/operations/getcategorieslang.md @@ -0,0 +1,11 @@ +# GetCategoriesLang + +Language + + +## Values + +| Name | Value | +| ----- | ----- | +| `EN` | en | +| `DE` | de | \ No newline at end of file diff --git a/template_variables/docs/models/operations/getcategoriesrequest.md b/template_variables/docs/models/operations/getcategoriesrequest.md new file mode 100755 index 000000000..d215ed7ae --- /dev/null +++ b/template_variables/docs/models/operations/getcategoriesrequest.md @@ -0,0 +1,8 @@ +# GetCategoriesRequest + + +## Fields + +| Field | Type | Required | Description | Example | +| --------------------------------------------------------------------------- | --------------------------------------------------------------------------- | --------------------------------------------------------------------------- | --------------------------------------------------------------------------- | --------------------------------------------------------------------------- | +| `lang` | [Optional[GetCategoriesLang]](../../models/operations/getcategorieslang.md) | :heavy_minus_sign: | Language | de | \ No newline at end of file diff --git a/template_variables/docs/models/operations/getcategoriesresponse.md b/template_variables/docs/models/operations/getcategoriesresponse.md new file mode 100755 index 000000000..f6e2e4103 --- /dev/null +++ b/template_variables/docs/models/operations/getcategoriesresponse.md @@ -0,0 +1,11 @@ +# GetCategoriesResponse + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------- | +| `category_results` | List[[shared.CategoryResult](../../models/shared/categoryresult.md)] | :heavy_minus_sign: | ok | +| `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/template_variables/docs/models/operations/getcustomvariablerequest.md b/template_variables/docs/models/operations/getcustomvariablerequest.md new file mode 100755 index 000000000..bbf2995d8 --- /dev/null +++ b/template_variables/docs/models/operations/getcustomvariablerequest.md @@ -0,0 +1,8 @@ +# GetCustomVariableRequest + + +## Fields + +| Field | Type | Required | Description | +| ------------------ | ------------------ | ------------------ | ------------------ | +| `id` | *str* | :heavy_check_mark: | Custom vairable ID | \ No newline at end of file diff --git a/template_variables/docs/models/operations/getcustomvariableresponse.md b/template_variables/docs/models/operations/getcustomvariableresponse.md new file mode 100755 index 000000000..16be26387 --- /dev/null +++ b/template_variables/docs/models/operations/getcustomvariableresponse.md @@ -0,0 +1,11 @@ +# GetCustomVariableResponse + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------- | +| `content_type` | *str* | :heavy_check_mark: | HTTP response content type for this operation | +| `custom_variable` | [Optional[shared.CustomVariable]](../../models/shared/customvariable.md) | :heavy_minus_sign: | Success | +| `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/template_variables/docs/models/operations/getcustomvariablesresponse.md b/template_variables/docs/models/operations/getcustomvariablesresponse.md new file mode 100755 index 000000000..998b8b63a --- /dev/null +++ b/template_variables/docs/models/operations/getcustomvariablesresponse.md @@ -0,0 +1,11 @@ +# GetCustomVariablesResponse + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------- | +| `content_type` | *str* | :heavy_check_mark: | HTTP response content type for this operation | +| `custom_variables` | List[[shared.CustomVariable](../../models/shared/customvariable.md)] | :heavy_minus_sign: | Success | +| `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/template_variables/docs/models/operations/getvariablecontextrequestbody.md b/template_variables/docs/models/operations/getvariablecontextrequestbody.md new file mode 100755 index 000000000..0076f586b --- /dev/null +++ b/template_variables/docs/models/operations/getvariablecontextrequestbody.md @@ -0,0 +1,8 @@ +# GetVariableContextRequestBody + + +## Fields + +| Field | Type | Required | Description | +| -------------------------------------------------------------------------------- | -------------------------------------------------------------------------------- | -------------------------------------------------------------------------------- | -------------------------------------------------------------------------------- | +| `parameters` | [Optional[shared.VariableParameters]](../../models/shared/variableparameters.md) | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/template_variables/docs/models/operations/getvariablecontextresponse.md b/template_variables/docs/models/operations/getvariablecontextresponse.md new file mode 100755 index 000000000..c1bd00835 --- /dev/null +++ b/template_variables/docs/models/operations/getvariablecontextresponse.md @@ -0,0 +1,11 @@ +# GetVariableContextResponse + + +## 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 | +| `variable_context` | [Optional[shared.VariableContext]](../../models/shared/variablecontext.md) | :heavy_minus_sign: | ok | \ No newline at end of file diff --git a/template_variables/docs/models/operations/replacetemplates200applicationjson.md b/template_variables/docs/models/operations/replacetemplates200applicationjson.md new file mode 100755 index 000000000..617f0ca70 --- /dev/null +++ b/template_variables/docs/models/operations/replacetemplates200applicationjson.md @@ -0,0 +1,10 @@ +# ReplaceTemplates200ApplicationJSON + +ok + + +## Fields + +| Field | Type | Required | Description | Example | +| ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `outputs` | List[*str*] | :heavy_minus_sign: | N/A | "[Brand Name GmbH] Order confirmation",
"Hello Customer Name

Brand Name GmbH
Brand Name
imprint
"]
| \ No newline at end of file diff --git a/template_variables/docs/models/operations/replacetemplatesrequestbody.md b/template_variables/docs/models/operations/replacetemplatesrequestbody.md new file mode 100755 index 000000000..e574f2121 --- /dev/null +++ b/template_variables/docs/models/operations/replacetemplatesrequestbody.md @@ -0,0 +1,9 @@ +# ReplaceTemplatesRequestBody + + +## Fields + +| Field | Type | Required | Description | Example | +| -------------------------------------------------------------------------------- | -------------------------------------------------------------------------------- | -------------------------------------------------------------------------------- | -------------------------------------------------------------------------------- | -------------------------------------------------------------------------------- | +| `inputs` | List[*str*] | :heavy_minus_sign: | N/A | Hello, {{contact.first_name}}!

{{{brand.signature}}}
| +| `parameters` | [Optional[shared.VariableParameters]](../../models/shared/variableparameters.md) | :heavy_minus_sign: | N/A | | \ No newline at end of file diff --git a/template_variables/docs/models/operations/replacetemplatesresponse.md b/template_variables/docs/models/operations/replacetemplatesresponse.md new file mode 100755 index 000000000..8d90c194e --- /dev/null +++ b/template_variables/docs/models/operations/replacetemplatesresponse.md @@ -0,0 +1,11 @@ +# ReplaceTemplatesResponse + + +## 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 | +| `replace_templates_200_application_json_object` | [Optional[ReplaceTemplates200ApplicationJSON]](../../models/operations/replacetemplates200applicationjson.md) | :heavy_minus_sign: | ok | \ No newline at end of file diff --git a/template_variables/docs/models/operations/searchvariablesrequestbody.md b/template_variables/docs/models/operations/searchvariablesrequestbody.md new file mode 100755 index 000000000..12174d7cd --- /dev/null +++ b/template_variables/docs/models/operations/searchvariablesrequestbody.md @@ -0,0 +1,13 @@ +# SearchVariablesRequestBody + + +## Fields + +| Field | Type | Required | Description | Example | +| ----------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------- | +| `entity_schemas` | List[*str*] | :heavy_minus_sign: | N/A | contact | +| `from_` | *Optional[int]* | :heavy_minus_sign: | N/A | | +| `lang` | [Optional[SearchVariablesRequestBodyLang]](../../models/operations/searchvariablesrequestbodylang.md) | :heavy_minus_sign: | N/A | | +| `query` | *str* | :heavy_check_mark: | Search string | logo | +| `size` | *Optional[int]* | :heavy_minus_sign: | N/A | | +| `template_type` | [shared.TemplateType](../../models/shared/templatetype.md) | :heavy_check_mark: | N/A | | \ No newline at end of file diff --git a/template_variables/docs/models/operations/searchvariablesrequestbodylang.md b/template_variables/docs/models/operations/searchvariablesrequestbodylang.md new file mode 100755 index 000000000..a406e971b --- /dev/null +++ b/template_variables/docs/models/operations/searchvariablesrequestbodylang.md @@ -0,0 +1,9 @@ +# SearchVariablesRequestBodyLang + + +## Values + +| Name | Value | +| ----- | ----- | +| `EN` | en | +| `DE` | de | \ No newline at end of file diff --git a/template_variables/docs/models/operations/searchvariablesresponse.md b/template_variables/docs/models/operations/searchvariablesresponse.md new file mode 100755 index 000000000..fb665ae2d --- /dev/null +++ b/template_variables/docs/models/operations/searchvariablesresponse.md @@ -0,0 +1,11 @@ +# SearchVariablesResponse + + +## 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 | +| `variable_results` | List[[shared.VariableResult](../../models/shared/variableresult.md)] | :heavy_minus_sign: | ok | \ No newline at end of file diff --git a/template_variables/docs/models/operations/updatecustomvariablerequest.md b/template_variables/docs/models/operations/updatecustomvariablerequest.md new file mode 100755 index 000000000..2f3bdd89f --- /dev/null +++ b/template_variables/docs/models/operations/updatecustomvariablerequest.md @@ -0,0 +1,9 @@ +# UpdateCustomVariableRequest + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------ | ------------------------------------------------------------------------ | ------------------------------------------------------------------------ | ------------------------------------------------------------------------ | +| `custom_variable` | [Optional[shared.CustomVariable]](../../models/shared/customvariable.md) | :heavy_minus_sign: | N/A | +| `id` | *str* | :heavy_check_mark: | Custom variable ID | \ No newline at end of file diff --git a/template_variables/docs/models/operations/updatecustomvariableresponse.md b/template_variables/docs/models/operations/updatecustomvariableresponse.md new file mode 100755 index 000000000..d06f02ab5 --- /dev/null +++ b/template_variables/docs/models/operations/updatecustomvariableresponse.md @@ -0,0 +1,10 @@ +# UpdateCustomVariableResponse + + +## 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/template_variables/docs/models/shared/categoryresult.md b/template_variables/docs/models/shared/categoryresult.md new file mode 100755 index 000000000..043c42d1c --- /dev/null +++ b/template_variables/docs/models/shared/categoryresult.md @@ -0,0 +1,9 @@ +# CategoryResult + + +## Fields + +| Field | Type | Required | Description | Example | +| ------------------ | ------------------ | ------------------ | ------------------ | ------------------ | +| `category` | *Optional[str]* | :heavy_minus_sign: | N/A | contact | +| `description` | *Optional[str]* | :heavy_minus_sign: | N/A | Contact | \ No newline at end of file diff --git a/template_variables/docs/models/shared/customvariable.md b/template_variables/docs/models/shared/customvariable.md new file mode 100755 index 000000000..fd1b445b3 --- /dev/null +++ b/template_variables/docs/models/shared/customvariable.md @@ -0,0 +1,19 @@ +# CustomVariable + + +## Fields + +| Field | Type | Required | Description | Example | +| ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `config` | [Optional[CustomVariableConfig]](../../models/shared/customvariableconfig.md) | :heavy_minus_sign: | Variable configuration | | +| `created_at` | *Optional[str]* | :heavy_minus_sign: | Creation time | 2022-04-19T12:41:43.662Z | +| `created_by` | *Optional[str]* | :heavy_minus_sign: | Created by | 100042 | +| `helper_logic` | *Optional[str]* | :heavy_minus_sign: | The helper function logic | return param1 * param2; | +| `helper_params` | List[*str*] | :heavy_minus_sign: | The helper function parameter's names | param1,param2 | +| `id` | *Optional[str]* | :heavy_minus_sign: | ID | rbse777b-3cf8-4bff-bb0c-253fd1123250 | +| `key` | *Optional[str]* | :heavy_minus_sign: | The key which is used for Handlebar variable syntax {{key}} | my_custom_table | +| `name` | *Optional[str]* | :heavy_minus_sign: | Custom variable name | My Custom table | +| `template` | *Optional[str]* | :heavy_minus_sign: | Handlebar template that used to generate the variable content |


{{#each table_config.header.columns as \|column\|}}
{{#if column.enable}}

{{/if}}
{{/each}}




{{#each order.products as \|product\|}}
{{#if @last}}

{{else}}

{{/if}}
{{#each @root.table_config.header.columns as \|column\|}}
{{#if column.enable}}
{{#if (eq column.id 'item')}}


{{/if}}
{{#if (eq column.id 'quantity')}}


{{/if}}
{{#if (eq column.id 'tax')}}


{{/if}}
{{#if (eq column.id 'unit_amount')}}


{{/if}}
{{#if (eq column.id 'net_total')}}


{{/if}}
{{#if (eq column.id 'amount_tax')}}


{{/if}}
{{#if (eq column.id 'gross_total')}}


{{/if}}
{{/if}}
{{/each}}

{{/each}}

{{#if table_config.footer.gross_total.enable}}
{{#each order.total_details.recurrences as \|item\|}}


{{#if @root.table_config.footer.payment_type.enable}}

{{/if}}
{{#if (isColumnEnabled @root.table_config 'net_total')}}
{{#if @root.table_config.footer.net_total.enable}}

{{/if}}
{{/if}}


{{/each}}
{{/if}}


{{column._label}}

{{#if @root.table_config.body.product_name.enable}}
{{product.name}}
{{/if}}
{{#if @root.table_config.body.price_description.enable}}


{{product.price.description}}
{{/if}}
{{#if @root.table_config.body.product_description.enable}}


{{product.description}}
{{/if}}
{{product.price.quantity}}

{{product.price.tax_rate}}

{{product.price.unit_amount_net}}

{{product.price.amount_subtotal}}

{{product.price.amount_tax}}

{{product.price.amount_total}}
{{#if @root.table_config.body.payment_type.enable}}
{{#if (eq product.price.type 'recurring')}}


{{product.price.billing_period}}
{{/if}}
{{/if}}
{{item.billing_period}} {{item.amount_subtotal}} {{item.amount_total}}
{{#if @root.table_config.footer.amount_tax.enable}}


{{item.full_amount_tax}}
{{/if}}

| +| `type` | [Optional[CustomVariableType]](../../models/shared/customvariabletype.md) | :heavy_minus_sign: | Custom variable type | rbse777b-3cf8-4bff-bb0c-253fd1123250 | +| `updated_at` | *Optional[str]* | :heavy_minus_sign: | Last update time | 2022-04-20T12:41:43.662Z | +| `updated_by` | *Optional[str]* | :heavy_minus_sign: | Updated by | 100042 | \ No newline at end of file diff --git a/template_variables/docs/models/shared/customvariableconfig.md b/template_variables/docs/models/shared/customvariableconfig.md new file mode 100755 index 000000000..b07567a82 --- /dev/null +++ b/template_variables/docs/models/shared/customvariableconfig.md @@ -0,0 +1,9 @@ +# CustomVariableConfig + +Variable configuration + + +## Fields + +| Field | Type | Required | Description | +| ----------- | ----------- | ----------- | ----------- | \ No newline at end of file diff --git a/template_variables/docs/models/shared/customvariabletype.md b/template_variables/docs/models/shared/customvariabletype.md new file mode 100755 index 000000000..a69ae106d --- /dev/null +++ b/template_variables/docs/models/shared/customvariabletype.md @@ -0,0 +1,11 @@ +# CustomVariableType + +Custom variable type + + +## Values + +| Name | Value | +| ------------- | ------------- | +| `ORDER_TABLE` | order_table | +| `CUSTOM` | custom | \ No newline at end of file diff --git a/template_variables/docs/models/shared/externalcustomvariable.md b/template_variables/docs/models/shared/externalcustomvariable.md new file mode 100755 index 000000000..3d08742ad --- /dev/null +++ b/template_variables/docs/models/shared/externalcustomvariable.md @@ -0,0 +1,9 @@ +# ExternalCustomVariable + + +## Fields + +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------- | +| `value` | *Optional[str]* | :heavy_minus_sign: | N/A | https://partner.epilot.cloud/activate-account?user_name=htny.pct%2Btet%40gmail.com&confirmation_code=EdXPRW19 | +| `variable` | *Optional[str]* | :heavy_minus_sign: | N/A | {{craftsmen.invitation_link}} | \ No newline at end of file diff --git a/template_variables/docs/models/shared/security.md b/template_variables/docs/models/shared/security.md new file mode 100755 index 000000000..f06333390 --- /dev/null +++ b/template_variables/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/template_variables/docs/models/shared/templatetype.md b/template_variables/docs/models/shared/templatetype.md new file mode 100755 index 000000000..d6ed07125 --- /dev/null +++ b/template_variables/docs/models/shared/templatetype.md @@ -0,0 +1,9 @@ +# TemplateType + + +## Values + +| Name | Value | +| ---------- | ---------- | +| `EMAIL` | email | +| `DOCUMENT` | document | \ No newline at end of file diff --git a/template_variables/docs/models/shared/variablecontext.md b/template_variables/docs/models/shared/variablecontext.md new file mode 100755 index 000000000..eb4b35f30 --- /dev/null +++ b/template_variables/docs/models/shared/variablecontext.md @@ -0,0 +1,11 @@ +# VariableContext + + +## Fields + +| Field | Type | Required | Description | Example | +| --------------------------------------------------------- | --------------------------------------------------------- | --------------------------------------------------------- | --------------------------------------------------------- | --------------------------------------------------------- | +| `brand` | Dict[str, *Any*] | :heavy_minus_sign: | N/A | [object Object] | +| `contact` | Dict[str, *Any*] | :heavy_minus_sign: | N/A | [object Object] | +| `main` | Dict[str, *Any*] | :heavy_minus_sign: | N/A | [object Object] | +| `unsubscribe_url` | *Optional[str]* | :heavy_minus_sign: | N/A | https://consent.sls.epilot.io/v1/unsubscribe?token=abc123 | \ No newline at end of file diff --git a/template_variables/docs/models/shared/variableparameters.md b/template_variables/docs/models/shared/variableparameters.md new file mode 100755 index 000000000..605dd4598 --- /dev/null +++ b/template_variables/docs/models/shared/variableparameters.md @@ -0,0 +1,18 @@ +# VariableParameters + + +## Fields + +| Field | Type | Required | Description | Example | +| --------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------- | +| `brand_id` | *Optional[float]* | :heavy_minus_sign: | Brand ID | 123451 | +| `context_data` | [Optional[VariableParametersContextData]](../../models/shared/variableparameterscontextdata.md) | :heavy_minus_sign: | If context data is avaialble, this data will be used for variable replace. | | +| `custom_variables` | List[[ExternalCustomVariable](../../models/shared/externalcustomvariable.md)] | :heavy_minus_sign: | Custom variables with specified values form other services. | | +| `language` | [Optional[VariableParametersLanguage]](../../models/shared/variableparameterslanguage.md) | :heavy_minus_sign: | N/A | | +| `main_entity_id` | *Optional[str]* | :heavy_minus_sign: | The main entity ID. Use main entity in order to use the variable without schema slug prefix - or just pass directly to other object ID. | 63753437-c9e2-4e83-82bb-b1c666514561 | +| `template_name` | *Optional[str]* | :heavy_minus_sign: | The name of email template | | +| `template_tags` | List[*str*] | :heavy_minus_sign: | The tags of email template | | +| `template_type` | [TemplateType](../../models/shared/templatetype.md) | :heavy_check_mark: | N/A | | +| `user_id` | *Optional[str]* | :heavy_minus_sign: | User ID | 50001 | +| `user_org_id` | *Optional[str]* | :heavy_minus_sign: | Organization ID of the user | 729224 | +| `variables_version` | *Optional[str]* | :heavy_minus_sign: | The version of the variables syntax supported. Default is 1.0 | 2 | \ No newline at end of file diff --git a/template_variables/docs/models/shared/variableparameterscontextdata.md b/template_variables/docs/models/shared/variableparameterscontextdata.md new file mode 100755 index 000000000..27a8d5428 --- /dev/null +++ b/template_variables/docs/models/shared/variableparameterscontextdata.md @@ -0,0 +1,9 @@ +# VariableParametersContextData + +If context data is avaialble, this data will be used for variable replace. + + +## Fields + +| Field | Type | Required | Description | +| ----------- | ----------- | ----------- | ----------- | \ No newline at end of file diff --git a/template_variables/docs/models/shared/variableparameterslanguage.md b/template_variables/docs/models/shared/variableparameterslanguage.md new file mode 100755 index 000000000..2604d75ed --- /dev/null +++ b/template_variables/docs/models/shared/variableparameterslanguage.md @@ -0,0 +1,9 @@ +# VariableParametersLanguage + + +## Values + +| Name | Value | +| ----- | ----- | +| `EN` | en | +| `DE` | de | \ No newline at end of file diff --git a/template_variables/docs/models/shared/variableresult.md b/template_variables/docs/models/shared/variableresult.md new file mode 100755 index 000000000..b640b9f77 --- /dev/null +++ b/template_variables/docs/models/shared/variableresult.md @@ -0,0 +1,12 @@ +# VariableResult + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------- | ------------------------------------------------------------------------- | ------------------------------------------------------------------------- | ------------------------------------------------------------------------- | +| `description` | *Optional[str]* | :heavy_minus_sign: | Variable description | +| `group` | *Optional[str]* | :heavy_minus_sign: | Variable group | +| `insert` | *Optional[str]* | :heavy_minus_sign: | The value which is used to insert to template | +| `qrdata` | *Optional[str]* | :heavy_minus_sign: | Payload for the QR data | +| `type` | [Optional[VariableResultType]](../../models/shared/variableresulttype.md) | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/template_variables/docs/models/shared/variableresulttype.md b/template_variables/docs/models/shared/variableresulttype.md new file mode 100755 index 000000000..a4605a78b --- /dev/null +++ b/template_variables/docs/models/shared/variableresulttype.md @@ -0,0 +1,9 @@ +# VariableResultType + + +## Values + +| Name | Value | +| --------- | --------- | +| `SIMPLE` | simple | +| `PARTIAL` | partial | \ No newline at end of file diff --git a/template_variables/docs/sdks/customvariables/README.md b/template_variables/docs/sdks/customvariables/README.md new file mode 100755 index 000000000..860021bc0 --- /dev/null +++ b/template_variables/docs/sdks/customvariables/README.md @@ -0,0 +1,470 @@ +# CustomVariables +(*custom_variables*) + +### Available Operations + +* [create_custom_variable](#create_custom_variable) - Create custom variable +* [delete_custom_variable](#delete_custom_variable) - Delete custom variable +* [get_blue_print_table_config](#get_blue_print_table_config) - Get default table config +* [get_custom_variable](#get_custom_variable) - Get custom variable +* [get_custom_variables](#get_custom_variables) - Get custom variables +* [update_custom_variable](#update_custom_variable) - Update custom variable + +## create_custom_variable + +Create custom variable + +### Example Usage + +```python +import epilot +from epilot.models import shared + +s = epilot.Epilot( + security=shared.Security( + epilot_auth="", + ), +) + +req = shared.CustomVariable( + config=shared.CustomVariableConfig(), + created_at='2022-04-19T12:41:43.662Z', + created_by='100042', + helper_logic='return param1 * param2;', + helper_params=[ + 'param1', + 'param2', + ], + id='rbse777b-3cf8-4bff-bb0c-253fd1123250', + key='my_custom_table', + name='My Custom table', + template=' + + + {{#each table_config.header.columns as |column|}} + {{#if column.enable}} + + {{/if}} + {{/each}} + + + + + {{#each order.products as |product|}} + {{#if @last}} + + {{else}} + + {{/if}} + {{#each @root.table_config.header.columns as |column|}} + {{#if column.enable}} + {{#if (eq column.id \'item\')}} + + + {{/if}} + {{#if (eq column.id \'quantity\')}} + + + {{/if}} + {{#if (eq column.id \'tax\')}} + + + {{/if}} + {{#if (eq column.id \'unit_amount\')}} + + + {{/if}} + {{#if (eq column.id \'net_total\')}} + + + {{/if}} + {{#if (eq column.id \'amount_tax\')}} + + + {{/if}} + {{#if (eq column.id \'gross_total\')}} + + + {{/if}} + {{/if}} + {{/each}} + + {{/each}} + + {{#if table_config.footer.gross_total.enable}} + {{#each order.total_details.recurrences as |item|}} + + + {{#if @root.table_config.footer.payment_type.enable}} + + {{/if}} + {{#if (isColumnEnabled @root.table_config \'net_total\')}} + {{#if @root.table_config.footer.net_total.enable}} + + {{/if}} + {{/if}} + + + {{/each}} + {{/if}} + + +
{{column._label}}
+ {{#if @root.table_config.body.product_name.enable}} + {{product.name}} + {{/if}} + {{#if @root.table_config.body.price_description.enable}} +
+ {{product.price.description}} + {{/if}} + {{#if @root.table_config.body.product_description.enable}} +
+ {{product.description}} + {{/if}} +
{{product.price.quantity}} + + {{product.price.tax_rate}} + + {{product.price.unit_amount_net}} + + {{product.price.amount_subtotal}} + + {{product.price.amount_tax}} + + {{product.price.amount_total}} + {{#if @root.table_config.body.payment_type.enable}} + {{#if (eq product.price.type \'recurring\')}} +
+ {{product.price.billing_period}} + {{/if}} + {{/if}} +
{{item.billing_period}}{{item.amount_subtotal}}{{item.amount_total}} + {{#if @root.table_config.footer.amount_tax.enable}} +
+ {{item.full_amount_tax}} + {{/if}} +
+', + type=shared.CustomVariableType.CUSTOM, + updated_at='2022-04-20T12:41:43.662Z', + updated_by='100042', +) + +res = s.custom_variables.create_custom_variable(req) + +if res.status_code == 200: + # handle response + pass +``` + +### Parameters + +| Parameter | Type | Required | Description | +| -------------------------------------------------------------- | -------------------------------------------------------------- | -------------------------------------------------------------- | -------------------------------------------------------------- | +| `request` | [shared.CustomVariable](../../models/shared/customvariable.md) | :heavy_check_mark: | The request object to use for the request. | + + +### Response + +**[operations.CreateCustomVariableResponse](../../models/operations/createcustomvariableresponse.md)** + + +## delete_custom_variable + +Immediately and permanently deletes a custom variable + +### Example Usage + +```python +import epilot +from epilot.models import operations, shared + +s = epilot.Epilot( + security=shared.Security( + epilot_auth="", + ), +) + +req = operations.DeleteCustomVariableRequest( + id='', +) + +res = s.custom_variables.delete_custom_variable(req) + +if res.status_code == 200: + # handle response + pass +``` + +### Parameters + +| Parameter | Type | Required | Description | +| ------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------ | +| `request` | [operations.DeleteCustomVariableRequest](../../models/operations/deletecustomvariablerequest.md) | :heavy_check_mark: | The request object to use for the request. | + + +### Response + +**[operations.DeleteCustomVariableResponse](../../models/operations/deletecustomvariableresponse.md)** + + +## get_blue_print_table_config + +Get default table config + +### Example Usage + +```python +import epilot +from epilot.models import shared + +s = epilot.Epilot( + security=shared.Security( + epilot_auth="", + ), +) + + +res = s.custom_variables.get_blue_print_table_config() + +if res.custom_variable is not None: + # handle response + pass +``` + + +### Response + +**[operations.GetBluePrintTableConfigResponse](../../models/operations/getblueprinttableconfigresponse.md)** + + +## get_custom_variable + +Get custom variable + +### Example Usage + +```python +import epilot +from epilot.models import operations, shared + +s = epilot.Epilot( + security=shared.Security( + epilot_auth="", + ), +) + +req = operations.GetCustomVariableRequest( + id='', +) + +res = s.custom_variables.get_custom_variable(req) + +if res.custom_variable is not None: + # handle response + pass +``` + +### Parameters + +| Parameter | Type | Required | Description | +| ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------ | +| `request` | [operations.GetCustomVariableRequest](../../models/operations/getcustomvariablerequest.md) | :heavy_check_mark: | The request object to use for the request. | + + +### Response + +**[operations.GetCustomVariableResponse](../../models/operations/getcustomvariableresponse.md)** + + +## get_custom_variables + +Get all custom variables of organization + +### Example Usage + +```python +import epilot +from epilot.models import shared + +s = epilot.Epilot( + security=shared.Security( + epilot_auth="", + ), +) + + +res = s.custom_variables.get_custom_variables() + +if res.custom_variables is not None: + # handle response + pass +``` + + +### Response + +**[operations.GetCustomVariablesResponse](../../models/operations/getcustomvariablesresponse.md)** + + +## update_custom_variable + +Update custom variable + +### Example Usage + +```python +import epilot +from epilot.models import operations, shared + +s = epilot.Epilot( + security=shared.Security( + epilot_auth="", + ), +) + +req = operations.UpdateCustomVariableRequest( + custom_variable=shared.CustomVariable( + config=shared.CustomVariableConfig(), + created_at='2022-04-19T12:41:43.662Z', + created_by='100042', + helper_logic='return param1 * param2;', + helper_params=[ + 'param1', + 'param2', + ], + id='rbse777b-3cf8-4bff-bb0c-253fd1123250', + key='my_custom_table', + name='My Custom table', + template=' + + + {{#each table_config.header.columns as |column|}} + {{#if column.enable}} + + {{/if}} + {{/each}} + + + + + {{#each order.products as |product|}} + {{#if @last}} + + {{else}} + + {{/if}} + {{#each @root.table_config.header.columns as |column|}} + {{#if column.enable}} + {{#if (eq column.id \'item\')}} + + + {{/if}} + {{#if (eq column.id \'quantity\')}} + + + {{/if}} + {{#if (eq column.id \'tax\')}} + + + {{/if}} + {{#if (eq column.id \'unit_amount\')}} + + + {{/if}} + {{#if (eq column.id \'net_total\')}} + + + {{/if}} + {{#if (eq column.id \'amount_tax\')}} + + + {{/if}} + {{#if (eq column.id \'gross_total\')}} + + + {{/if}} + {{/if}} + {{/each}} + + {{/each}} + + {{#if table_config.footer.gross_total.enable}} + {{#each order.total_details.recurrences as |item|}} + + + {{#if @root.table_config.footer.payment_type.enable}} + + {{/if}} + {{#if (isColumnEnabled @root.table_config \'net_total\')}} + {{#if @root.table_config.footer.net_total.enable}} + + {{/if}} + {{/if}} + + + {{/each}} + {{/if}} + + +
{{column._label}}
+ {{#if @root.table_config.body.product_name.enable}} + {{product.name}} + {{/if}} + {{#if @root.table_config.body.price_description.enable}} +
+ {{product.price.description}} + {{/if}} + {{#if @root.table_config.body.product_description.enable}} +
+ {{product.description}} + {{/if}} +
{{product.price.quantity}} + + {{product.price.tax_rate}} + + {{product.price.unit_amount_net}} + + {{product.price.amount_subtotal}} + + {{product.price.amount_tax}} + + {{product.price.amount_total}} + {{#if @root.table_config.body.payment_type.enable}} + {{#if (eq product.price.type \'recurring\')}} +
+ {{product.price.billing_period}} + {{/if}} + {{/if}} +
{{item.billing_period}}{{item.amount_subtotal}}{{item.amount_total}} + {{#if @root.table_config.footer.amount_tax.enable}} +
+ {{item.full_amount_tax}} + {{/if}} +
+ ', + type=shared.CustomVariableType.CUSTOM, + updated_at='2022-04-20T12:41:43.662Z', + updated_by='100042', + ), + id='', +) + +res = s.custom_variables.update_custom_variable(req) + +if res.status_code == 200: + # handle response + pass +``` + +### Parameters + +| Parameter | Type | Required | Description | +| ------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------ | +| `request` | [operations.UpdateCustomVariableRequest](../../models/operations/updatecustomvariablerequest.md) | :heavy_check_mark: | The request object to use for the request. | + + +### Response + +**[operations.UpdateCustomVariableResponse](../../models/operations/updatecustomvariableresponse.md)** + diff --git a/template_variables/docs/sdks/epilot/README.md b/template_variables/docs/sdks/epilot/README.md new file mode 100755 index 000000000..06007ebbc --- /dev/null +++ b/template_variables/docs/sdks/epilot/README.md @@ -0,0 +1,9 @@ +# Epilot SDK + + +## Overview + +Template Variables API: API to provide variables for email and document templates. + +### Available Operations + diff --git a/template_variables/docs/sdks/variables/README.md b/template_variables/docs/sdks/variables/README.md new file mode 100755 index 000000000..40df651bf --- /dev/null +++ b/template_variables/docs/sdks/variables/README.md @@ -0,0 +1,316 @@ +# Variables +(*variables*) + +## Overview + +Variables + +### Available Operations + +* [generate_q_rcode](#generate_q_rcode) - generateQRcode +* [get_categories](#get_categories) - getCategories +* [get_variable_context](#get_variable_context) - getVariableContext +* [replace_templates](#replace_templates) - replaceTemplates +* [search_variables](#search_variables) - searchVariables + +## generate_q_rcode + +Generate QR Code for the given payload + +### Example Usage + +```python +import epilot +from epilot.models import operations, shared + +s = epilot.Epilot( + security=shared.Security( + epilot_auth="", + ), +) + +req = operations.GenerateQRcodeRequest() + +res = s.variables.generate_q_rcode(req) + +if res.status_code == 200: + # handle response + pass +``` + +### Parameters + +| Parameter | Type | Required | Description | +| ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | +| `request` | [operations.GenerateQRcodeRequest](../../models/operations/generateqrcoderequest.md) | :heavy_check_mark: | The request object to use for the request. | + + +### Response + +**[operations.GenerateQRcodeResponse](../../models/operations/generateqrcoderesponse.md)** + + +## get_categories + +Get all template variable categories + +### Example Usage + +```python +import epilot +from epilot.models import operations, shared + +s = epilot.Epilot( + security=shared.Security( + epilot_auth="", + ), +) + +req = operations.GetCategoriesRequest( + lang=operations.GetCategoriesLang.DE, +) + +res = s.variables.get_categories(req) + +if res.category_results is not None: + # handle response + pass +``` + +### Parameters + +| Parameter | Type | Required | Description | +| ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | +| `request` | [operations.GetCategoriesRequest](../../models/operations/getcategoriesrequest.md) | :heavy_check_mark: | The request object to use for the request. | + + +### Response + +**[operations.GetCategoriesResponse](../../models/operations/getcategoriesresponse.md)** + + +## get_variable_context + +Get full variable context + +Calls Entity API, User API, Brand API and others to construct full context object used for template variable replace + + +### Example Usage + +```python +import epilot +from epilot.models import operations, shared + +s = epilot.Epilot( + security=shared.Security( + epilot_auth="", + ), +) + +req = operations.GetVariableContextRequestBody( + parameters=shared.VariableParameters( + brand_id=123451, + context_data=shared.VariableParametersContextData(), + custom_variables=[ + shared.ExternalCustomVariable( + value='https://partner.epilot.cloud/activate-account?user_name=htny.pct%2Btet%40gmail.com&confirmation_code=EdXPRW19', + variable='{{craftsmen.invitation_link}}', + ), + ], + main_entity_id='63753437-c9e2-4e83-82bb-b1c666514561', + template_tags=[ + 'string', + ], + template_type=shared.TemplateType.EMAIL, + user_id='50001', + user_org_id='729224', + variables_version='2', + ), +) + +res = s.variables.get_variable_context(req) + +if res.variable_context is not None: + # handle response + pass +``` + +### Parameters + +| Parameter | Type | Required | Description | +| ---------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- | +| `request` | [operations.GetVariableContextRequestBody](../../models/operations/getvariablecontextrequestbody.md) | :heavy_check_mark: | The request object to use for the request. | + + +### Response + +**[operations.GetVariableContextResponse](../../models/operations/getvariablecontextresponse.md)** + + +## replace_templates + +Replace variables in handlebars templates + +Takes in an array of input templates and outputs the output text with replaced variables + + +### Example Usage + +```python +import epilot +from epilot.models import operations, shared + +s = epilot.Epilot( + security=shared.Security( + epilot_auth="", + ), +) + +req = operations.ReplaceTemplatesRequestBody( + inputs=[ + 'H', + 'e', + 'l', + 'l', + 'o', + ',', + ' ', + '{', + '{', + 'c', + 'o', + 'n', + 't', + 'a', + 'c', + 't', + '.', + 'f', + 'i', + 'r', + 's', + 't', + '_', + 'n', + 'a', + 'm', + 'e', + '}', + '}', + '!', + ' + ', + ' + ', + '{', + '{', + '{', + 'b', + 'r', + 'a', + 'n', + 'd', + '.', + 's', + 'i', + 'g', + 'n', + 'a', + 't', + 'u', + 'r', + 'e', + '}', + '}', + '}', + ' + ', + ], + parameters=shared.VariableParameters( + brand_id=123451, + context_data=shared.VariableParametersContextData(), + custom_variables=[ + shared.ExternalCustomVariable( + value='https://partner.epilot.cloud/activate-account?user_name=htny.pct%2Btet%40gmail.com&confirmation_code=EdXPRW19', + variable='{{craftsmen.invitation_link}}', + ), + ], + main_entity_id='63753437-c9e2-4e83-82bb-b1c666514561', + template_tags=[ + 'string', + ], + template_type=shared.TemplateType.EMAIL, + user_id='50001', + user_org_id='729224', + variables_version='2', + ), +) + +res = s.variables.replace_templates(req) + +if res.replace_templates_200_application_json_object is not None: + # handle response + pass +``` + +### Parameters + +| Parameter | Type | Required | Description | +| ------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------ | +| `request` | [operations.ReplaceTemplatesRequestBody](../../models/operations/replacetemplatesrequestbody.md) | :heavy_check_mark: | The request object to use for the request. | + + +### Response + +**[operations.ReplaceTemplatesResponse](../../models/operations/replacetemplatesresponse.md)** + + +## search_variables + +Search variables + +### Example Usage + +```python +import epilot +from epilot.models import operations, shared + +s = epilot.Epilot( + security=shared.Security( + epilot_auth="", + ), +) + +req = operations.SearchVariablesRequestBody( + entity_schemas=[ + 'c', + 'o', + 'n', + 't', + 'a', + 'c', + 't', + ], + query='logo', + template_type=shared.TemplateType.DOCUMENT, +) + +res = s.variables.search_variables(req) + +if res.variable_results is not None: + # handle response + pass +``` + +### Parameters + +| Parameter | Type | Required | Description | +| ---------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- | +| `request` | [operations.SearchVariablesRequestBody](../../models/operations/searchvariablesrequestbody.md) | :heavy_check_mark: | The request object to use for the request. | + + +### Response + +**[operations.SearchVariablesResponse](../../models/operations/searchvariablesresponse.md)** + diff --git a/template_variables/files.gen b/template_variables/files.gen index fedb99593..0e1278756 100755 --- a/template_variables/files.gen +++ b/template_variables/files.gen @@ -1,3 +1,4 @@ +src/epilot/sdkconfiguration.py src/epilot/custom_variables.py src/epilot/variables.py src/epilot/sdk.py @@ -5,6 +6,7 @@ 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 @@ -24,9 +26,49 @@ src/epilot/models/shared/customvariable.py src/epilot/models/shared/categoryresult.py src/epilot/models/shared/variablecontext.py src/epilot/models/shared/variableparameters.py -src/epilot/models/shared/templatetype_enum.py +src/epilot/models/shared/templatetype.py src/epilot/models/shared/externalcustomvariable.py src/epilot/models/shared/variableresult.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/createcustomvariableresponse.md +docs/models/operations/deletecustomvariablerequest.md +docs/models/operations/deletecustomvariableresponse.md +docs/models/operations/getblueprinttableconfigresponse.md +docs/models/operations/getcustomvariablerequest.md +docs/models/operations/getcustomvariableresponse.md +docs/models/operations/getcustomvariablesresponse.md +docs/models/operations/updatecustomvariablerequest.md +docs/models/operations/updatecustomvariableresponse.md +docs/models/operations/generateqrcoderequest.md +docs/models/operations/generateqrcoderesponse.md +docs/models/operations/getcategorieslang.md +docs/models/operations/getcategoriesrequest.md +docs/models/operations/getcategoriesresponse.md +docs/models/operations/getvariablecontextrequestbody.md +docs/models/operations/getvariablecontextresponse.md +docs/models/operations/replacetemplatesrequestbody.md +docs/models/operations/replacetemplates200applicationjson.md +docs/models/operations/replacetemplatesresponse.md +docs/models/operations/searchvariablesrequestbodylang.md +docs/models/operations/searchvariablesrequestbody.md +docs/models/operations/searchvariablesresponse.md +docs/models/shared/customvariableconfig.md +docs/models/shared/customvariabletype.md +docs/models/shared/customvariable.md +docs/models/shared/categoryresult.md +docs/models/shared/variablecontext.md +docs/models/shared/variableparameterscontextdata.md +docs/models/shared/variableparameterslanguage.md +docs/models/shared/variableparameters.md +docs/models/shared/templatetype.md +docs/models/shared/externalcustomvariable.md +docs/models/shared/variableresulttype.md +docs/models/shared/variableresult.md +docs/models/shared/security.md +docs/sdks/epilot/README.md +docs/sdks/customvariables/README.md +docs/sdks/variables/README.md +.gitattributes \ No newline at end of file diff --git a/template_variables/gen.yaml b/template_variables/gen.yaml index e2cd3c1a9..f56202584 100644 --- a/template_variables/gen.yaml +++ b/template_variables/gen.yaml @@ -1,16 +1,25 @@ configVersion: 1.0.0 management: - docChecksum: 14e2961bd134888671409e73ce503882 + docChecksum: 99fb691be183dc477e82f74876feafbf 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=template_variables + maxMethodParams: 0 packageName: epilot-template-variables + repoSubDirectory: template_variables diff --git a/template_variables/pylintrc b/template_variables/pylintrc index 79b8008d0..1ed32214e 100755 --- a/template_variables/pylintrc +++ b/template_variables/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 @@ -439,7 +434,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 @@ -620,7 +621,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/template_variables/setup.py b/template_variables/setup.py index 59b02d846..57a8e4115 100755 --- a/template_variables/setup.py +++ b/template_variables/setup.py @@ -10,30 +10,31 @@ setuptools.setup( name="epilot-template-variables", - 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/template_variables/src/epilot/__init__.py b/template_variables/src/epilot/__init__.py index b9e232018..e6c0deeb6 100755 --- a/template_variables/src/epilot/__init__.py +++ b/template_variables/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/template_variables/src/epilot/custom_variables.py b/template_variables/src/epilot/custom_variables.py index 694b42779..8583ce9eb 100755 --- a/template_variables/src/epilot/custom_variables.py +++ b/template_variables/src/epilot/custom_variables.py @@ -1,84 +1,78 @@ """Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT.""" -import requests as requests_http -from . import utils -from epilot.models import operations, shared -from typing import Optional +from .sdkconfiguration import SDKConfiguration +from epilot import utils +from epilot.models import errors, operations, shared +from typing import List, Optional class CustomVariables: - _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 create_custom_variable(self, request: shared.CustomVariable) -> operations.CreateCustomVariableResponse: r"""Create custom variable Create custom variable """ - base_url = self._server_url - - url = base_url.removesuffix('/') + '/v1/custom-variables' + base_url = utils.template_url(*self.sdk_configuration.get_server_details()) + url = base_url + '/v1/custom-variables' 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._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') res = operations.CreateCustomVariableResponse(status_code=http_res.status_code, content_type=content_type, raw_response=http_res) - if http_res.status_code in [201, 403]: - pass return res + def delete_custom_variable(self, request: operations.DeleteCustomVariableRequest) -> operations.DeleteCustomVariableResponse: r"""Delete custom variable Immediately and permanently deletes a custom variable """ - base_url = self._server_url + base_url = utils.template_url(*self.sdk_configuration.get_server_details()) url = utils.generate_url(operations.DeleteCustomVariableRequest, base_url, '/v1/custom-variables/{id}', request) + headers = {} + headers['Accept'] = '*/*' + headers['user-agent'] = self.sdk_configuration.user_agent + client = self.sdk_configuration.security_client - client = self._security_client - - http_res = client.request('DELETE', url) + http_res = client.request('DELETE', url, headers=headers) content_type = http_res.headers.get('Content-Type') res = operations.DeleteCustomVariableResponse(status_code=http_res.status_code, content_type=content_type, raw_response=http_res) - if http_res.status_code in [204, 403]: - pass return res + def get_blue_print_table_config(self) -> operations.GetBluePrintTableConfigResponse: r"""Get default table config Get default table config """ - base_url = self._server_url - - url = base_url.removesuffix('/') + '/v1/custom-variables/order-table-blueprint' + base_url = utils.template_url(*self.sdk_configuration.get_server_details()) + url = base_url + '/v1/custom-variables/order-table-blueprint' + headers = {} + 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('GET', url) + http_res = client.request('GET', url, headers=headers) content_type = http_res.headers.get('Content-Type') res = operations.GetBluePrintTableConfigResponse(status_code=http_res.status_code, content_type=content_type, raw_response=http_res) @@ -87,23 +81,28 @@ def get_blue_print_table_config(self) -> operations.GetBluePrintTableConfigRespo if utils.match_content_type(content_type, 'application/json'): out = utils.unmarshal_json(http_res.text, Optional[shared.CustomVariable]) res.custom_variable = out + else: + raise errors.SDKError(f'unknown content-type received: {content_type}', http_res.status_code, http_res.text, http_res) elif http_res.status_code == 403: pass return res + def get_custom_variable(self, request: operations.GetCustomVariableRequest) -> operations.GetCustomVariableResponse: r"""Get custom variable Get custom variable """ - base_url = self._server_url + base_url = utils.template_url(*self.sdk_configuration.get_server_details()) url = utils.generate_url(operations.GetCustomVariableRequest, base_url, '/v1/custom-variables/{id}', request) + headers = {} + headers['Accept'] = 'application/json' + headers['user-agent'] = self.sdk_configuration.user_agent + client = self.sdk_configuration.security_client - client = self._security_client - - http_res = client.request('GET', url) + http_res = client.request('GET', url, headers=headers) content_type = http_res.headers.get('Content-Type') res = operations.GetCustomVariableResponse(status_code=http_res.status_code, content_type=content_type, raw_response=http_res) @@ -112,58 +111,65 @@ def get_custom_variable(self, request: operations.GetCustomVariableRequest) -> o if utils.match_content_type(content_type, 'application/json'): out = utils.unmarshal_json(http_res.text, Optional[shared.CustomVariable]) res.custom_variable = out + else: + raise errors.SDKError(f'unknown content-type received: {content_type}', http_res.status_code, http_res.text, http_res) elif http_res.status_code in [403, 404]: pass return res + def get_custom_variables(self) -> operations.GetCustomVariablesResponse: r"""Get custom variables Get all custom variables of organization """ - base_url = self._server_url - - url = base_url.removesuffix('/') + '/v1/custom-variables' + base_url = utils.template_url(*self.sdk_configuration.get_server_details()) + url = base_url + '/v1/custom-variables' + headers = {} + 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('GET', url) + http_res = client.request('GET', url, headers=headers) content_type = http_res.headers.get('Content-Type') res = operations.GetCustomVariablesResponse(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[list[shared.CustomVariable]]) + out = utils.unmarshal_json(http_res.text, Optional[List[shared.CustomVariable]]) res.custom_variables = out + else: + raise errors.SDKError(f'unknown content-type received: {content_type}', http_res.status_code, http_res.text, http_res) elif http_res.status_code == 403: pass return res + def update_custom_variable(self, request: operations.UpdateCustomVariableRequest) -> operations.UpdateCustomVariableResponse: r"""Update custom variable Update custom variable """ - base_url = self._server_url + base_url = utils.template_url(*self.sdk_configuration.get_server_details()) url = utils.generate_url(operations.UpdateCustomVariableRequest, base_url, '/v1/custom-variables/{id}', request) - headers = {} - req_content_type, data, form = utils.serialize_request_body(request, "custom_variable", 'json') + req_content_type, data, form = utils.serialize_request_body(request, "custom_variable", 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._security_client + client = self.sdk_configuration.security_client http_res = client.request('PUT', url, data=data, files=form, headers=headers) content_type = http_res.headers.get('Content-Type') res = operations.UpdateCustomVariableResponse(status_code=http_res.status_code, content_type=content_type, raw_response=http_res) - if http_res.status_code in [200, 403]: - pass return res diff --git a/template_variables/src/epilot/models/__init__.py b/template_variables/src/epilot/models/__init__.py index 889f8adcf..36628d6cc 100755 --- a/template_variables/src/epilot/models/__init__.py +++ b/template_variables/src/epilot/models/__init__.py @@ -1,2 +1,3 @@ """Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT.""" +# __init__.py diff --git a/template_variables/src/epilot/models/errors/__init__.py b/template_variables/src/epilot/models/errors/__init__.py new file mode 100755 index 000000000..cfd848441 --- /dev/null +++ b/template_variables/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/template_variables/src/epilot/models/errors/sdkerror.py b/template_variables/src/epilot/models/errors/sdkerror.py new file mode 100755 index 000000000..6bb02bbd6 --- /dev/null +++ b/template_variables/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/template_variables/src/epilot/models/operations/__init__.py b/template_variables/src/epilot/models/operations/__init__.py index 7a3197048..31cbd6607 100755 --- a/template_variables/src/epilot/models/operations/__init__.py +++ b/template_variables/src/epilot/models/operations/__init__.py @@ -12,4 +12,4 @@ from .searchvariables import * from .updatecustomvariable import * -__all__ = ["CreateCustomVariableResponse","DeleteCustomVariableRequest","DeleteCustomVariableResponse","GenerateQRcodeRequest","GenerateQRcodeResponse","GetBluePrintTableConfigResponse","GetCategoriesLangEnum","GetCategoriesRequest","GetCategoriesResponse","GetCustomVariableRequest","GetCustomVariableResponse","GetCustomVariablesResponse","GetVariableContextRequestBody","GetVariableContextResponse","ReplaceTemplates200ApplicationJSON","ReplaceTemplatesRequestBody","ReplaceTemplatesResponse","SearchVariablesRequestBody","SearchVariablesRequestBodyLangEnum","SearchVariablesResponse","UpdateCustomVariableRequest","UpdateCustomVariableResponse"] +__all__ = ["CreateCustomVariableResponse","DeleteCustomVariableRequest","DeleteCustomVariableResponse","GenerateQRcodeRequest","GenerateQRcodeResponse","GetBluePrintTableConfigResponse","GetCategoriesLang","GetCategoriesRequest","GetCategoriesResponse","GetCustomVariableRequest","GetCustomVariableResponse","GetCustomVariablesResponse","GetVariableContextRequestBody","GetVariableContextResponse","ReplaceTemplates200ApplicationJSON","ReplaceTemplatesRequestBody","ReplaceTemplatesResponse","SearchVariablesRequestBody","SearchVariablesRequestBodyLang","SearchVariablesResponse","UpdateCustomVariableRequest","UpdateCustomVariableResponse"] diff --git a/template_variables/src/epilot/models/operations/createcustomvariable.py b/template_variables/src/epilot/models/operations/createcustomvariable.py index 8adbc8008..8b1fe63b5 100755 --- a/template_variables/src/epilot/models/operations/createcustomvariable.py +++ b/template_variables/src/epilot/models/operations/createcustomvariable.py @@ -8,8 +8,11 @@ @dataclasses.dataclass class CreateCustomVariableResponse: + 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/template_variables/src/epilot/models/operations/deletecustomvariable.py b/template_variables/src/epilot/models/operations/deletecustomvariable.py index 9915f50a3..d3df8e64e 100755 --- a/template_variables/src/epilot/models/operations/deletecustomvariable.py +++ b/template_variables/src/epilot/models/operations/deletecustomvariable.py @@ -8,15 +8,19 @@ @dataclasses.dataclass class DeleteCustomVariableRequest: - id: str = dataclasses.field(metadata={'path_param': { 'field_name': 'id', 'style': 'simple', 'explode': False }}) - r"""Custom vairable ID""" + r"""Custom vairable ID""" + + @dataclasses.dataclass class DeleteCustomVariableResponse: + 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/template_variables/src/epilot/models/operations/generateqrcode.py b/template_variables/src/epilot/models/operations/generateqrcode.py index 8e360c885..35087ec86 100755 --- a/template_variables/src/epilot/models/operations/generateqrcode.py +++ b/template_variables/src/epilot/models/operations/generateqrcode.py @@ -8,15 +8,19 @@ @dataclasses.dataclass class GenerateQRcodeRequest: + qrdata: Optional[str] = dataclasses.field(default='{{table_order_items}}', metadata={'query_param': { 'field_name': 'qrdata', 'style': 'form', 'explode': True }}) + r"""Payload of the QR code""" - qrdata: Optional[str] = dataclasses.field(default=None, metadata={'query_param': { 'field_name': 'qrdata', 'style': 'form', 'explode': True }}) - r"""Payload of the QR code""" - + + @dataclasses.dataclass class GenerateQRcodeResponse: + 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/template_variables/src/epilot/models/operations/getblueprinttableconfig.py b/template_variables/src/epilot/models/operations/getblueprinttableconfig.py index 25afa8caf..5a35c51d7 100755 --- a/template_variables/src/epilot/models/operations/getblueprinttableconfig.py +++ b/template_variables/src/epilot/models/operations/getblueprinttableconfig.py @@ -9,10 +9,13 @@ @dataclasses.dataclass class GetBluePrintTableConfigResponse: - - 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""" custom_variable: Optional[shared_customvariable.CustomVariable] = dataclasses.field(default=None) - r"""Success""" - raw_response: Optional[requests_http.Response] = dataclasses.field(default=None) - \ No newline at end of file + r"""Success""" + raw_response: Optional[requests_http.Response] = dataclasses.field(default=None) + r"""Raw HTTP response; suitable for custom response parsing""" + + diff --git a/template_variables/src/epilot/models/operations/getcategories.py b/template_variables/src/epilot/models/operations/getcategories.py index 2dd603e8e..6d0711735 100755 --- a/template_variables/src/epilot/models/operations/getcategories.py +++ b/template_variables/src/epilot/models/operations/getcategories.py @@ -5,27 +5,31 @@ import requests as requests_http from ..shared import categoryresult as shared_categoryresult from enum import Enum -from typing import Optional +from typing import List, Optional -class GetCategoriesLangEnum(str, Enum): +class GetCategoriesLang(str, Enum): r"""Language""" - EN = "en" - DE = "de" + EN = 'en' + DE = 'de' @dataclasses.dataclass class GetCategoriesRequest: + lang: Optional[GetCategoriesLang] = dataclasses.field(default=None, metadata={'query_param': { 'field_name': 'lang', 'style': 'form', 'explode': True }}) + r"""Language""" - lang: Optional[GetCategoriesLangEnum] = dataclasses.field(default=None, metadata={'query_param': { 'field_name': 'lang', 'style': 'form', 'explode': True }}) - r"""Language""" - + + @dataclasses.dataclass class GetCategoriesResponse: + 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""" + category_results: Optional[List[shared_categoryresult.CategoryResult]] = dataclasses.field(default=None) + r"""ok""" + 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() - category_results: Optional[list[shared_categoryresult.CategoryResult]] = dataclasses.field(default=None) - r"""ok""" - raw_response: Optional[requests_http.Response] = dataclasses.field(default=None) - \ No newline at end of file + diff --git a/template_variables/src/epilot/models/operations/getcustomvariable.py b/template_variables/src/epilot/models/operations/getcustomvariable.py index 7478f617a..6452d7a4a 100755 --- a/template_variables/src/epilot/models/operations/getcustomvariable.py +++ b/template_variables/src/epilot/models/operations/getcustomvariable.py @@ -9,17 +9,21 @@ @dataclasses.dataclass class GetCustomVariableRequest: - id: str = dataclasses.field(metadata={'path_param': { 'field_name': 'id', 'style': 'simple', 'explode': False }}) - r"""Custom vairable ID""" + r"""Custom vairable ID""" + + @dataclasses.dataclass class GetCustomVariableResponse: - - 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""" custom_variable: Optional[shared_customvariable.CustomVariable] = dataclasses.field(default=None) - r"""Success""" - raw_response: Optional[requests_http.Response] = dataclasses.field(default=None) - \ No newline at end of file + r"""Success""" + raw_response: Optional[requests_http.Response] = dataclasses.field(default=None) + r"""Raw HTTP response; suitable for custom response parsing""" + + diff --git a/template_variables/src/epilot/models/operations/getcustomvariables.py b/template_variables/src/epilot/models/operations/getcustomvariables.py index e3c0c1017..298a26a45 100755 --- a/template_variables/src/epilot/models/operations/getcustomvariables.py +++ b/template_variables/src/epilot/models/operations/getcustomvariables.py @@ -4,15 +4,18 @@ import dataclasses import requests as requests_http from ..shared import customvariable as shared_customvariable -from typing import Optional +from typing import List, Optional @dataclasses.dataclass class GetCustomVariablesResponse: + 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""" + custom_variables: Optional[List[shared_customvariable.CustomVariable]] = dataclasses.field(default=None) + r"""Success""" + 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() - custom_variables: Optional[list[shared_customvariable.CustomVariable]] = dataclasses.field(default=None) - r"""Success""" - raw_response: Optional[requests_http.Response] = dataclasses.field(default=None) - \ No newline at end of file + diff --git a/template_variables/src/epilot/models/operations/getvariablecontext.py b/template_variables/src/epilot/models/operations/getvariablecontext.py index 2583cc584..1b74838db 100755 --- a/template_variables/src/epilot/models/operations/getvariablecontext.py +++ b/template_variables/src/epilot/models/operations/getvariablecontext.py @@ -13,16 +13,20 @@ @dataclass_json(undefined=Undefined.EXCLUDE) @dataclasses.dataclass class GetVariableContextRequestBody: + parameters: Optional[shared_variableparameters.VariableParameters] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('parameters'), 'exclude': lambda f: f is None }}) - parameters: Optional[shared_variableparameters.VariableParameters] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('parameters'), 'exclude': lambda f: f is None }}) - + + @dataclasses.dataclass class GetVariableContextResponse: - - content_type: str = dataclasses.field() - status_code: int = dataclasses.field() - raw_response: Optional[requests_http.Response] = dataclasses.field(default=None) + 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""" variable_context: Optional[shared_variablecontext.VariableContext] = dataclasses.field(default=None) - r"""ok""" - \ No newline at end of file + r"""ok""" + + diff --git a/template_variables/src/epilot/models/operations/replacetemplates.py b/template_variables/src/epilot/models/operations/replacetemplates.py index c8a02e00c..6e722e50f 100755 --- a/template_variables/src/epilot/models/operations/replacetemplates.py +++ b/template_variables/src/epilot/models/operations/replacetemplates.py @@ -6,31 +6,36 @@ from ..shared import variableparameters as shared_variableparameters from dataclasses_json import Undefined, dataclass_json from epilot import utils -from typing import Optional +from typing import List, Optional @dataclass_json(undefined=Undefined.EXCLUDE) @dataclasses.dataclass class ReplaceTemplatesRequestBody: + inputs: Optional[List[str]] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('inputs'), 'exclude': lambda f: f is None }}) + parameters: Optional[shared_variableparameters.VariableParameters] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('parameters'), 'exclude': lambda f: f is None }}) - inputs: Optional[list[str]] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('inputs'), 'exclude': lambda f: f is None }}) - parameters: Optional[shared_variableparameters.VariableParameters] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('parameters'), 'exclude': lambda f: f is None }}) - + + @dataclass_json(undefined=Undefined.EXCLUDE) @dataclasses.dataclass class ReplaceTemplates200ApplicationJSON: r"""ok""" + outputs: Optional[List[str]] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('outputs'), 'exclude': lambda f: f is None }}) - outputs: Optional[list[str]] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('outputs'), 'exclude': lambda f: f is None }}) - + + @dataclasses.dataclass class ReplaceTemplatesResponse: - - content_type: str = dataclasses.field() - status_code: int = dataclasses.field() - raw_response: Optional[requests_http.Response] = dataclasses.field(default=None) + 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""" replace_templates_200_application_json_object: Optional[ReplaceTemplates200ApplicationJSON] = dataclasses.field(default=None) - r"""ok""" - \ No newline at end of file + r"""ok""" + + diff --git a/template_variables/src/epilot/models/operations/searchvariables.py b/template_variables/src/epilot/models/operations/searchvariables.py index 26ceb11e9..5ccc9f422 100755 --- a/template_variables/src/epilot/models/operations/searchvariables.py +++ b/template_variables/src/epilot/models/operations/searchvariables.py @@ -3,37 +3,41 @@ from __future__ import annotations import dataclasses import requests as requests_http -from ..shared import templatetype_enum as shared_templatetype_enum +from ..shared import templatetype as shared_templatetype from ..shared import variableresult as shared_variableresult from dataclasses_json import Undefined, dataclass_json from enum import Enum from epilot import utils -from typing import Optional +from typing import List, Optional -class SearchVariablesRequestBodyLangEnum(str, Enum): - EN = "en" - DE = "de" +class SearchVariablesRequestBodyLang(str, Enum): + EN = 'en' + DE = 'de' @dataclass_json(undefined=Undefined.EXCLUDE) @dataclasses.dataclass class SearchVariablesRequestBody: - query: str = dataclasses.field(metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('query') }}) - r"""Search string""" - template_type: shared_templatetype_enum.TemplateTypeEnum = dataclasses.field(metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('template_type') }}) - entity_schemas: Optional[list[str]] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('entity_schemas'), 'exclude': lambda f: f is None }}) - from_: Optional[int] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('from'), 'exclude': lambda f: f is None }}) - lang: Optional[SearchVariablesRequestBodyLangEnum] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('lang'), 'exclude': lambda f: f is None }}) - size: Optional[int] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('size'), 'exclude': lambda f: f is None }}) + r"""Search string""" + template_type: shared_templatetype.TemplateType = dataclasses.field(metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('template_type') }}) + entity_schemas: Optional[List[str]] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('entity_schemas'), 'exclude': lambda f: f is None }}) + from_: Optional[int] = dataclasses.field(default=0, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('from'), 'exclude': lambda f: f is None }}) + lang: Optional[SearchVariablesRequestBodyLang] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('lang'), 'exclude': lambda f: f is None }}) + size: Optional[int] = dataclasses.field(default=25, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('size'), 'exclude': lambda f: f is None }}) + + @dataclasses.dataclass class SearchVariablesResponse: + 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""" + variable_results: Optional[List[shared_variableresult.VariableResult]] = dataclasses.field(default=None) + r"""ok""" - content_type: str = dataclasses.field() - status_code: int = dataclasses.field() - raw_response: Optional[requests_http.Response] = dataclasses.field(default=None) - variable_results: Optional[list[shared_variableresult.VariableResult]] = dataclasses.field(default=None) - r"""ok""" - \ No newline at end of file + diff --git a/template_variables/src/epilot/models/operations/updatecustomvariable.py b/template_variables/src/epilot/models/operations/updatecustomvariable.py index ddc0124e0..9a4a5ee34 100755 --- a/template_variables/src/epilot/models/operations/updatecustomvariable.py +++ b/template_variables/src/epilot/models/operations/updatecustomvariable.py @@ -9,16 +9,20 @@ @dataclasses.dataclass class UpdateCustomVariableRequest: - id: str = dataclasses.field(metadata={'path_param': { 'field_name': 'id', 'style': 'simple', 'explode': False }}) - r"""Custom variable ID""" - custom_variable: Optional[shared_customvariable.CustomVariable] = dataclasses.field(default=None, metadata={'request': { 'media_type': 'application/json' }}) + r"""Custom variable ID""" + custom_variable: Optional[shared_customvariable.CustomVariable] = dataclasses.field(default=None, metadata={'request': { 'media_type': 'application/json' }}) + + @dataclasses.dataclass class UpdateCustomVariableResponse: + 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/template_variables/src/epilot/models/shared/__init__.py b/template_variables/src/epilot/models/shared/__init__.py index ec472dceb..2f0d97ab2 100755 --- a/template_variables/src/epilot/models/shared/__init__.py +++ b/template_variables/src/epilot/models/shared/__init__.py @@ -4,9 +4,9 @@ from .customvariable import * from .externalcustomvariable import * from .security import * -from .templatetype_enum import * +from .templatetype import * from .variablecontext import * from .variableparameters import * from .variableresult import * -__all__ = ["CategoryResult","CustomVariable","CustomVariableTypeEnum","ExternalCustomVariable","Security","TemplateTypeEnum","VariableContext","VariableParameters","VariableParametersLanguageEnum","VariableResult","VariableResultTypeEnum"] +__all__ = ["CategoryResult","CustomVariable","CustomVariableConfig","CustomVariableType","ExternalCustomVariable","Security","TemplateType","VariableContext","VariableParameters","VariableParametersContextData","VariableParametersLanguage","VariableResult","VariableResultType"] diff --git a/template_variables/src/epilot/models/shared/categoryresult.py b/template_variables/src/epilot/models/shared/categoryresult.py index 77ca5f503..7be1841dd 100755 --- a/template_variables/src/epilot/models/shared/categoryresult.py +++ b/template_variables/src/epilot/models/shared/categoryresult.py @@ -10,7 +10,7 @@ @dataclass_json(undefined=Undefined.EXCLUDE) @dataclasses.dataclass class CategoryResult: + category: Optional[str] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('category'), '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 }}) - category: Optional[str] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('category'), '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 }}) - \ No newline at end of file + diff --git a/template_variables/src/epilot/models/shared/customvariable.py b/template_variables/src/epilot/models/shared/customvariable.py index 77da1887f..be866151a 100755 --- a/template_variables/src/epilot/models/shared/customvariable.py +++ b/template_variables/src/epilot/models/shared/customvariable.py @@ -5,41 +5,47 @@ from dataclasses_json import Undefined, dataclass_json from enum import Enum from epilot import utils -from typing import Any, Optional +from typing import List, Optional -class CustomVariableTypeEnum(str, Enum): + +@dataclasses.dataclass +class CustomVariableConfig: + r"""Variable configuration""" + + + +class CustomVariableType(str, Enum): r"""Custom variable type""" - ORDER_TABLE = "order_table" - CUSTOM = "custom" + ORDER_TABLE = 'order_table' + CUSTOM = 'custom' @dataclass_json(undefined=Undefined.EXCLUDE) @dataclasses.dataclass class CustomVariable: - r"""Success""" - - config: Optional[dict[str, Any]] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('config'), 'exclude': lambda f: f is None }}) - r"""Variable configuration""" + config: Optional[CustomVariableConfig] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('config'), 'exclude': lambda f: f is None }}) + r"""Variable configuration""" created_at: Optional[str] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('created_at'), 'exclude': lambda f: f is None }}) - r"""Creation time""" + r"""Creation time""" created_by: Optional[str] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('created_by'), 'exclude': lambda f: f is None }}) - r"""Created by""" + r"""Created by""" helper_logic: Optional[str] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('helper_logic'), 'exclude': lambda f: f is None }}) - r"""The helper function logic""" - helper_params: Optional[list[str]] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('helper_params'), 'exclude': lambda f: f is None }}) - r"""The helper function parameter's names""" + r"""The helper function logic""" + helper_params: Optional[List[str]] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('helper_params'), 'exclude': lambda f: f is None }}) + r"""The helper function parameter's names""" id: Optional[str] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('id'), 'exclude': lambda f: f is None }}) - r"""ID""" + r"""ID""" key: Optional[str] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('key'), 'exclude': lambda f: f is None }}) - r"""The key which is used for Handlebar variable syntax {{key}}""" + r"""The key which is used for Handlebar variable syntax {{key}}""" name: Optional[str] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('name'), 'exclude': lambda f: f is None }}) - r"""Custom variable name""" + r"""Custom variable name""" template: Optional[str] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('template'), 'exclude': lambda f: f is None }}) - r"""Handlebar template that used to generate the variable content""" - type: Optional[CustomVariableTypeEnum] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('type'), 'exclude': lambda f: f is None }}) - r"""Custom variable type""" + r"""Handlebar template that used to generate the variable content""" + type: Optional[CustomVariableType] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('type'), 'exclude': lambda f: f is None }}) + r"""Custom variable type""" updated_at: Optional[str] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('updated_at'), 'exclude': lambda f: f is None }}) - r"""Last update time""" + r"""Last update time""" updated_by: Optional[str] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('updated_by'), 'exclude': lambda f: f is None }}) - r"""Updated by""" - \ No newline at end of file + r"""Updated by""" + + diff --git a/template_variables/src/epilot/models/shared/externalcustomvariable.py b/template_variables/src/epilot/models/shared/externalcustomvariable.py index fe478c518..f2fd0bac7 100755 --- a/template_variables/src/epilot/models/shared/externalcustomvariable.py +++ b/template_variables/src/epilot/models/shared/externalcustomvariable.py @@ -10,7 +10,7 @@ @dataclass_json(undefined=Undefined.EXCLUDE) @dataclasses.dataclass class ExternalCustomVariable: + value: Optional[str] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('value'), 'exclude': lambda f: f is None }}) + variable: Optional[str] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('variable'), 'exclude': lambda f: f is None }}) - value: Optional[str] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('value'), 'exclude': lambda f: f is None }}) - variable: Optional[str] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('variable'), 'exclude': lambda f: f is None }}) - \ No newline at end of file + diff --git a/template_variables/src/epilot/models/shared/security.py b/template_variables/src/epilot/models/shared/security.py index cca0d01c8..bb832caeb 100755 --- a/template_variables/src/epilot/models/shared/security.py +++ b/template_variables/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/template_variables/src/epilot/models/shared/templatetype_enum.py b/template_variables/src/epilot/models/shared/templatetype.py similarity index 62% rename from template_variables/src/epilot/models/shared/templatetype_enum.py rename to template_variables/src/epilot/models/shared/templatetype.py index b584f7dcb..a86659010 100755 --- a/template_variables/src/epilot/models/shared/templatetype_enum.py +++ b/template_variables/src/epilot/models/shared/templatetype.py @@ -3,6 +3,6 @@ from __future__ import annotations from enum import Enum -class TemplateTypeEnum(str, Enum): - EMAIL = "email" - DOCUMENT = "document" +class TemplateType(str, Enum): + EMAIL = 'email' + DOCUMENT = 'document' diff --git a/template_variables/src/epilot/models/shared/variablecontext.py b/template_variables/src/epilot/models/shared/variablecontext.py index c1b1dfb92..2efede057 100755 --- a/template_variables/src/epilot/models/shared/variablecontext.py +++ b/template_variables/src/epilot/models/shared/variablecontext.py @@ -4,16 +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 VariableContext: - r"""ok""" + brand: Optional[Dict[str, Any]] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('brand'), 'exclude': lambda f: f is None }}) + contact: Optional[Dict[str, Any]] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('contact'), 'exclude': lambda f: f is None }}) + main: Optional[Dict[str, Any]] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('main'), 'exclude': lambda f: f is None }}) + unsubscribe_url: Optional[str] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('unsubscribe_url'), 'exclude': lambda f: f is None }}) - brand: Optional[dict[str, Any]] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('brand'), 'exclude': lambda f: f is None }}) - contact: Optional[dict[str, Any]] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('contact'), 'exclude': lambda f: f is None }}) - main: Optional[dict[str, Any]] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('main'), 'exclude': lambda f: f is None }}) - unsubscribe_url: Optional[str] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('unsubscribe_url'), 'exclude': lambda f: f is None }}) - \ No newline at end of file + diff --git a/template_variables/src/epilot/models/shared/variableparameters.py b/template_variables/src/epilot/models/shared/variableparameters.py index 46b36be3f..b3241f596 100755 --- a/template_variables/src/epilot/models/shared/variableparameters.py +++ b/template_variables/src/epilot/models/shared/variableparameters.py @@ -3,35 +3,46 @@ from __future__ import annotations import dataclasses from ..shared import externalcustomvariable as shared_externalcustomvariable -from ..shared import templatetype_enum as shared_templatetype_enum +from ..shared import templatetype as shared_templatetype from dataclasses_json import Undefined, dataclass_json from enum import Enum from epilot import utils -from typing import Any, Optional +from typing import List, Optional -class VariableParametersLanguageEnum(str, Enum): - EN = "en" - DE = "de" + +@dataclasses.dataclass +class VariableParametersContextData: + r"""If context data is avaialble, this data will be used for variable replace.""" + + + +class VariableParametersLanguage(str, Enum): + EN = 'en' + DE = 'de' @dataclass_json(undefined=Undefined.EXCLUDE) @dataclasses.dataclass class VariableParameters: - - template_type: shared_templatetype_enum.TemplateTypeEnum = dataclasses.field(metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('template_type') }}) - brand_id: Optional[float] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('brand_id'), 'exclude': lambda f: f is None }}) - r"""Brand ID""" - context_data: Optional[dict[str, Any]] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('context_data'), 'exclude': lambda f: f is None }}) - r"""If context data is avaialble, this data will be used for variable replace.""" - custom_variables: Optional[list[shared_externalcustomvariable.ExternalCustomVariable]] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('custom_variables'), 'exclude': lambda f: f is None }}) - r"""Custom variables with specified values form other services.""" - language: Optional[VariableParametersLanguageEnum] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('language'), 'exclude': lambda f: f is None }}) + template_type: shared_templatetype.TemplateType = dataclasses.field(metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('template_type') }}) + brand_id: Optional[float] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('brand_id') }}) + r"""Brand ID""" + context_data: Optional[VariableParametersContextData] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('context_data'), 'exclude': lambda f: f is None }}) + r"""If context data is avaialble, this data will be used for variable replace.""" + custom_variables: Optional[List[shared_externalcustomvariable.ExternalCustomVariable]] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('custom_variables'), 'exclude': lambda f: f is None }}) + r"""Custom variables with specified values form other services.""" + language: Optional[VariableParametersLanguage] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('language'), 'exclude': lambda f: f is None }}) main_entity_id: Optional[str] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('main_entity_id'), 'exclude': lambda f: f is None }}) - r"""The main entity ID. Use main entity in order to use the variable without schema slug prefix - or just pass directly to other object ID.""" + r"""The main entity ID. Use main entity in order to use the variable without schema slug prefix - or just pass directly to other object ID.""" template_name: Optional[str] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('template_name'), 'exclude': lambda f: f is None }}) - r"""The name of email template""" - template_tags: Optional[list[str]] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('template_tags'), 'exclude': lambda f: f is None }}) - r"""The tags of email template""" - 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""" - \ No newline at end of file + r"""The name of email template""" + template_tags: Optional[List[str]] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('template_tags'), 'exclude': lambda f: f is None }}) + r"""The tags of email template""" + user_id: Optional[str] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('user_id') }}) + r"""User ID""" + user_org_id: Optional[str] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('user_org_id') }}) + r"""Organization ID of the user""" + variables_version: Optional[str] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('variables_version'), 'exclude': lambda f: f is None }}) + r"""The version of the variables syntax supported. Default is 1.0""" + + diff --git a/template_variables/src/epilot/models/shared/variableresult.py b/template_variables/src/epilot/models/shared/variableresult.py index d616a0d89..912b297bf 100755 --- a/template_variables/src/epilot/models/shared/variableresult.py +++ b/template_variables/src/epilot/models/shared/variableresult.py @@ -7,22 +7,22 @@ from epilot import utils from typing import Optional -class VariableResultTypeEnum(str, Enum): - SIMPLE = "simple" - PARTIAL = "partial" +class VariableResultType(str, Enum): + SIMPLE = 'simple' + PARTIAL = 'partial' @dataclass_json(undefined=Undefined.EXCLUDE) @dataclasses.dataclass class VariableResult: - description: Optional[str] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('description'), 'exclude': lambda f: f is None }}) - r"""Variable description""" + r"""Variable description""" group: Optional[str] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('group'), 'exclude': lambda f: f is None }}) - r"""Variable group""" + r"""Variable group""" insert: Optional[str] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('insert'), 'exclude': lambda f: f is None }}) - r"""The value which is used to insert to template""" + r"""The value which is used to insert to template""" qrdata: Optional[str] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('qrdata'), 'exclude': lambda f: f is None }}) - r"""Payload for the QR data""" - type: Optional[VariableResultTypeEnum] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('type'), 'exclude': lambda f: f is None }}) - \ No newline at end of file + r"""Payload for the QR data""" + type: Optional[VariableResultType] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('type'), 'exclude': lambda f: f is None }}) + + diff --git a/template_variables/src/epilot/sdk.py b/template_variables/src/epilot/sdk.py index 53ea97cd1..d5f12bca4 100755 --- a/template_variables/src/epilot/sdk.py +++ b/template_variables/src/epilot/sdk.py @@ -1,80 +1,60 @@ """Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT.""" import requests as requests_http -from . import utils from .custom_variables import CustomVariables +from .sdkconfiguration import SDKConfiguration from .variables import Variables +from epilot import utils from epilot.models import shared - -SERVERS = [ - "https://template-variables-api.sls.epilot.io", -] -"""Contains the list of servers available to the SDK""" +from typing import Dict class Epilot: - r"""API to provide variables for email and document templates.""" + r"""Template Variables API: API to provide variables for email and document templates.""" custom_variables: CustomVariables variables: Variables r"""Variables""" - _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.custom_variables = CustomVariables( - self._client, - self._security_client, - self._server_url, - self._language, - self._sdk_version, - self._gen_version - ) - - self.variables = Variables( - self._client, - self._security_client, - self._server_url, - self._language, - self._sdk_version, - self._gen_version - ) - + self.custom_variables = CustomVariables(self.sdk_configuration) + self.variables = Variables(self.sdk_configuration) \ No newline at end of file diff --git a/template_variables/src/epilot/sdkconfiguration.py b/template_variables/src/epilot/sdkconfiguration.py new file mode 100755 index 000000000..b2d0f797e --- /dev/null +++ b/template_variables/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://template-variables-api.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-template-variables' + 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/template_variables/src/epilot/utils/retries.py b/template_variables/src/epilot/utils/retries.py index c6251d948..25f49a1f2 100755 --- a/template_variables/src/epilot/utils/retries.py +++ b/template_variables/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/template_variables/src/epilot/utils/utils.py b/template_variables/src/epilot/utils/utils.py index 9d4fba324..3ab126104 100755 --- a/template_variables/src/epilot/utils/utils.py +++ b/template_variables/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 diff --git a/template_variables/src/epilot/variables.py b/template_variables/src/epilot/variables.py index 0158755dd..cc7ddebee 100755 --- a/template_variables/src/epilot/variables.py +++ b/template_variables/src/epilot/variables.py @@ -1,90 +1,87 @@ """Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT.""" -import requests as requests_http -from . import utils -from epilot.models import operations, shared -from typing import Optional +from .sdkconfiguration import SDKConfiguration +from epilot import utils +from epilot.models import errors, operations, shared +from typing import List, Optional class Variables: r"""Variables""" - _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_q_rcode(self, request: operations.GenerateQRcodeRequest) -> operations.GenerateQRcodeResponse: r"""generateQRcode Generate QR Code for the given payload """ - base_url = self._server_url - - url = base_url.removesuffix('/') + '/v1/template-variables/qrcode:generate' + base_url = utils.template_url(*self.sdk_configuration.get_server_details()) + url = base_url + '/v1/template-variables/qrcode:generate' + headers = {} query_params = utils.get_query_params(operations.GenerateQRcodeRequest, request) + headers['Accept'] = '*/*' + headers['user-agent'] = self.sdk_configuration.user_agent - client = self._security_client + client = self.sdk_configuration.security_client - http_res = client.request('GET', url, params=query_params) + http_res = client.request('GET', url, params=query_params, headers=headers) content_type = http_res.headers.get('Content-Type') res = operations.GenerateQRcodeResponse(status_code=http_res.status_code, content_type=content_type, raw_response=http_res) - if http_res.status_code == 200: - pass return res + def get_categories(self, request: operations.GetCategoriesRequest) -> operations.GetCategoriesResponse: r"""getCategories Get all template variable categories """ - base_url = self._server_url - - url = base_url.removesuffix('/') + '/v1/template-variables/categories' + base_url = utils.template_url(*self.sdk_configuration.get_server_details()) + url = base_url + '/v1/template-variables/categories' + headers = {} query_params = utils.get_query_params(operations.GetCategoriesRequest, request) + 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('GET', url, params=query_params) + http_res = client.request('GET', url, params=query_params, headers=headers) content_type = http_res.headers.get('Content-Type') res = operations.GetCategoriesResponse(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[list[shared.CategoryResult]]) + out = utils.unmarshal_json(http_res.text, Optional[List[shared.CategoryResult]]) res.category_results = out + else: + raise errors.SDKError(f'unknown content-type received: {content_type}', http_res.status_code, http_res.text, http_res) return res + def get_variable_context(self, request: operations.GetVariableContextRequestBody) -> operations.GetVariableContextResponse: r"""getVariableContext Get full variable context - + Calls Entity API, User API, Brand API and others to construct full context object used for template variable replace - """ - base_url = self._server_url - - url = base_url.removesuffix('/') + '/v1/template-variables:context' + base_url = utils.template_url(*self.sdk_configuration.get_server_details()) + url = base_url + '/v1/template-variables:context' 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') @@ -95,26 +92,29 @@ def get_variable_context(self, request: operations.GetVariableContextRequestBody if utils.match_content_type(content_type, 'application/json'): out = utils.unmarshal_json(http_res.text, Optional[shared.VariableContext]) res.variable_context = out + else: + raise errors.SDKError(f'unknown content-type received: {content_type}', http_res.status_code, http_res.text, http_res) return res + def replace_templates(self, request: operations.ReplaceTemplatesRequestBody) -> operations.ReplaceTemplatesResponse: r"""replaceTemplates Replace variables in handlebars templates - + Takes in an array of input templates and outputs the output text with replaced variables - """ - base_url = self._server_url - - url = base_url.removesuffix('/') + '/v1/template-variables:replace' + base_url = utils.template_url(*self.sdk_configuration.get_server_details()) + url = base_url + '/v1/template-variables:replace' 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') @@ -125,23 +125,27 @@ def replace_templates(self, request: operations.ReplaceTemplatesRequestBody) -> if utils.match_content_type(content_type, 'application/json'): out = utils.unmarshal_json(http_res.text, Optional[operations.ReplaceTemplates200ApplicationJSON]) res.replace_templates_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 search_variables(self, request: operations.SearchVariablesRequestBody) -> operations.SearchVariablesResponse: r"""searchVariables Search variables """ - base_url = self._server_url - - url = base_url.removesuffix('/') + '/v1/template-variables:search' + base_url = utils.template_url(*self.sdk_configuration.get_server_details()) + url = base_url + '/v1/template-variables:search' 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') @@ -150,8 +154,10 @@ def search_variables(self, request: operations.SearchVariablesRequestBody) -> op if http_res.status_code == 200: if utils.match_content_type(content_type, 'application/json'): - out = utils.unmarshal_json(http_res.text, Optional[list[shared.VariableResult]]) + out = utils.unmarshal_json(http_res.text, Optional[List[shared.VariableResult]]) res.variable_results = out + else: + raise errors.SDKError(f'unknown content-type received: {content_type}', http_res.status_code, http_res.text, http_res) return res