diff --git a/.speakeasy/gen.lock b/.speakeasy/gen.lock index bb6303d..e6994be 100644 --- a/.speakeasy/gen.lock +++ b/.speakeasy/gen.lock @@ -1,12 +1,12 @@ lockVersion: 2.0.0 id: 45f3018a-30de-4d91-ab55-1ad3f43bb6de management: - docChecksum: bdfe61952033bd2227060e206083b4aa + docChecksum: 6c94ad8e3e080570f4cc4e7acc8299f5 docVersion: 1.0.0 - speakeasyVersion: 1.405.6 - generationVersion: 2.428.1 - releaseVersion: 0.10.6 - configChecksum: eee95f8fdd1db73006a00153b53647bb + speakeasyVersion: 1.405.9 + generationVersion: 2.429.0 + releaseVersion: 1.0.1 + configChecksum: eaad5d2fe7a3aa72234da152f45e42e0 features: terraform: additionalDependencies: 0.1.0 @@ -145,7 +145,7 @@ examples: application/json: {"inputs": ["Hello, {{contact.first_name}}!\n\n{{{brand.signature}}}\n"], "parameters": {"template_type": "email", "main_entity_id": "63753437-c9e2-4e83-82bb-b1c666514561", "brand_id": 123451, "user_id": "50001", "user_org_id": "729224", "custom_variables": [{"variable": "{{craftsmen.invitation_link}}", "value": "https://partner.epilot.cloud/activate-account?user_name=htny.pct%2Btet%40gmail.com&confirmation_code=EdXPRW19"}], "variables_version": "2"}} responses: "200": - application/json: {"outputs": ["\"[Brand Name GmbH] Order confirmation\",\n\"Hello Customer Name \n\nBrand Name GmbH\n\"Brand\nimprint\n\"]\n"]} + application/json: {"outputs": ["\"[Brand Name GmbH] Order confirmation\",\n\"Hello Customer Name\n\nBrand Name GmbH\n\"Brand\nimprint\n\"]\n"]} getCustomVariables: speakeasy-default-get-custom-variables: responses: @@ -155,6 +155,9 @@ examples: speakeasy-default-create-custom-variable: requestBody: application/json: {"id": "rbse777b-3cf8-4bff-bb0c-253fd1123250", "type": "custom", "name": "My Custom table", "key": "my_custom_table", "helper_params": ["param1", "param2"], "helper_logic": "return param1 * param2;", "template": "\n \n \n {{#each table_config.header.columns as |column|}}\n {{#if column.enable}}\n \n {{/if}}\n {{/each}}\n \n \n \n \n {{#each order.products as |product|}}\n {{#if @last}}\n \n {{else}}\n \n {{/if}}\n {{#each @root.table_config.header.columns as |column|}}\n {{#if column.enable}}\n {{#if (eq column.id 'item')}}\n \n \n {{/if}}\n {{#if (eq column.id 'quantity')}}\n \n \n {{/if}}\n {{#if (eq column.id 'tax')}}\n \n \n {{/if}}\n {{#if (eq column.id 'unit_amount')}}\n \n \n {{/if}}\n {{#if (eq column.id 'net_total')}}\n \n \n {{/if}}\n {{#if (eq column.id 'amount_tax')}}\n \n \n {{/if}}\n {{#if (eq column.id 'gross_total')}}\n \n \n {{/if}}\n {{/if}}\n {{/each}}\n \n {{/each}}\n \n {{#if table_config.footer.gross_total.enable}}\n {{#each order.total_details.recurrences as |item|}}\n \n \n {{#if @root.table_config.footer.payment_type.enable}}\n \n {{/if}}\n {{#if (isColumnEnabled @root.table_config 'net_total')}}\n {{#if @root.table_config.footer.net_total.enable}}\n \n {{/if}}\n {{/if}}\n \n \n {{/each}}\n {{/if}}\n \n \n
{{column._label}}
\n {{#if @root.table_config.body.product_name.enable}}\n {{product.name}}\n {{/if}}\n {{#if @root.table_config.body.price_description.enable}}\n
\n {{product.price.description}}\n {{/if}}\n {{#if @root.table_config.body.product_description.enable}}\n
\n {{product.description}}\n {{/if}}\n
{{product.price.quantity}}\n \n {{product.price.tax_rate}}\n \n {{product.price.unit_amount_net}}\n \n {{product.price.amount_subtotal}}\n \n {{product.price.amount_tax}}\n \n {{product.price.amount_total}}\n {{#if @root.table_config.body.payment_type.enable}}\n {{#if (eq product.price.type 'recurring')}}\n
\n {{product.price.billing_period}}\n {{/if}}\n {{/if}}\n
{{item.billing_period}}{{item.amount_subtotal}}{{item.amount_total}}\n {{#if @root.table_config.footer.amount_tax.enable}}\n
\n {{item.full_amount_tax}}\n {{/if}}\n
\n", "created_at": "2022-04-19T12:41:43.662Z", "created_by": "100042", "updated_at": "2022-04-20T12:41:43.662Z", "updated_by": "100042"} + responses: + "201": + application/json: {"id": "rbse777b-3cf8-4bff-bb0c-253fd1123250", "name": "My Custom table", "key": "my_custom_table", "helper_params": ["param1", "param2"], "helper_logic": "return param1 * param2;", "template": "\n \n \n {{#each table_config.header.columns as |column|}}\n {{#if column.enable}}\n \n {{/if}}\n {{/each}}\n \n \n \n \n {{#each order.products as |product|}}\n {{#if @last}}\n \n {{else}}\n \n {{/if}}\n {{#each @root.table_config.header.columns as |column|}}\n {{#if column.enable}}\n {{#if (eq column.id 'item')}}\n \n \n {{/if}}\n {{#if (eq column.id 'quantity')}}\n \n \n {{/if}}\n {{#if (eq column.id 'tax')}}\n \n \n {{/if}}\n {{#if (eq column.id 'unit_amount')}}\n \n \n {{/if}}\n {{#if (eq column.id 'net_total')}}\n \n \n {{/if}}\n {{#if (eq column.id 'amount_tax')}}\n \n \n {{/if}}\n {{#if (eq column.id 'gross_total')}}\n \n \n {{/if}}\n {{/if}}\n {{/each}}\n \n {{/each}}\n \n {{#if table_config.footer.gross_total.enable}}\n {{#each order.total_details.recurrences as |item|}}\n \n \n {{#if @root.table_config.footer.payment_type.enable}}\n \n {{/if}}\n {{#if (isColumnEnabled @root.table_config 'net_total')}}\n {{#if @root.table_config.footer.net_total.enable}}\n \n {{/if}}\n {{/if}}\n \n \n {{/each}}\n {{/if}}\n \n \n
{{column._label}}
\n {{#if @root.table_config.body.product_name.enable}}\n {{product.name}}\n {{/if}}\n {{#if @root.table_config.body.price_description.enable}}\n
\n {{product.price.description}}\n {{/if}}\n {{#if @root.table_config.body.product_description.enable}}\n
\n {{product.description}}\n {{/if}}\n
{{product.price.quantity}}\n \n {{product.price.tax_rate}}\n \n {{product.price.unit_amount_net}}\n \n {{product.price.amount_subtotal}}\n \n {{product.price.amount_tax}}\n \n {{product.price.amount_total}}\n {{#if @root.table_config.body.payment_type.enable}}\n {{#if (eq product.price.type 'recurring')}}\n
\n {{product.price.billing_period}}\n {{/if}}\n {{/if}}\n
{{item.billing_period}}{{item.amount_subtotal}}{{item.amount_total}}\n {{#if @root.table_config.footer.amount_tax.enable}}\n
\n {{item.full_amount_tax}}\n {{/if}}\n
\n", "created_at": "2022-04-19T12:41:43.662Z", "created_by": "100042", "updated_at": "2022-04-20T12:41:43.662Z", "updated_by": "100042"} searchCustomVariables: speakeasy-default-search-custom-variables: requestBody: @@ -169,6 +172,9 @@ examples: id: "rbse777b-3cf8-4bff-bb0c-253fd1123250" requestBody: application/json: {"id": "rbse777b-3cf8-4bff-bb0c-253fd1123250", "type": "custom", "name": "My Custom table", "key": "my_custom_table", "helper_params": ["param1", "param2"], "helper_logic": "return param1 * param2;", "template": "\n \n \n {{#each table_config.header.columns as |column|}}\n {{#if column.enable}}\n \n {{/if}}\n {{/each}}\n \n \n \n \n {{#each order.products as |product|}}\n {{#if @last}}\n \n {{else}}\n \n {{/if}}\n {{#each @root.table_config.header.columns as |column|}}\n {{#if column.enable}}\n {{#if (eq column.id 'item')}}\n \n \n {{/if}}\n {{#if (eq column.id 'quantity')}}\n \n \n {{/if}}\n {{#if (eq column.id 'tax')}}\n \n \n {{/if}}\n {{#if (eq column.id 'unit_amount')}}\n \n \n {{/if}}\n {{#if (eq column.id 'net_total')}}\n \n \n {{/if}}\n {{#if (eq column.id 'amount_tax')}}\n \n \n {{/if}}\n {{#if (eq column.id 'gross_total')}}\n \n \n {{/if}}\n {{/if}}\n {{/each}}\n \n {{/each}}\n \n {{#if table_config.footer.gross_total.enable}}\n {{#each order.total_details.recurrences as |item|}}\n \n \n {{#if @root.table_config.footer.payment_type.enable}}\n \n {{/if}}\n {{#if (isColumnEnabled @root.table_config 'net_total')}}\n {{#if @root.table_config.footer.net_total.enable}}\n \n {{/if}}\n {{/if}}\n \n \n {{/each}}\n {{/if}}\n \n \n
{{column._label}}
\n {{#if @root.table_config.body.product_name.enable}}\n {{product.name}}\n {{/if}}\n {{#if @root.table_config.body.price_description.enable}}\n
\n {{product.price.description}}\n {{/if}}\n {{#if @root.table_config.body.product_description.enable}}\n
\n {{product.description}}\n {{/if}}\n
{{product.price.quantity}}\n \n {{product.price.tax_rate}}\n \n {{product.price.unit_amount_net}}\n \n {{product.price.amount_subtotal}}\n \n {{product.price.amount_tax}}\n \n {{product.price.amount_total}}\n {{#if @root.table_config.body.payment_type.enable}}\n {{#if (eq product.price.type 'recurring')}}\n
\n {{product.price.billing_period}}\n {{/if}}\n {{/if}}\n
{{item.billing_period}}{{item.amount_subtotal}}{{item.amount_total}}\n {{#if @root.table_config.footer.amount_tax.enable}}\n
\n {{item.full_amount_tax}}\n {{/if}}\n
\n", "created_at": "2022-04-19T12:41:43.662Z", "created_by": "100042", "updated_at": "2022-04-20T12:41:43.662Z", "updated_by": "100042"} + responses: + "200": + application/json: {"id": "rbse777b-3cf8-4bff-bb0c-253fd1123250", "name": "My Custom table", "key": "my_custom_table", "helper_params": ["param1", "param2"], "helper_logic": "return param1 * param2;", "template": "\n \n \n {{#each table_config.header.columns as |column|}}\n {{#if column.enable}}\n \n {{/if}}\n {{/each}}\n \n \n \n \n {{#each order.products as |product|}}\n {{#if @last}}\n \n {{else}}\n \n {{/if}}\n {{#each @root.table_config.header.columns as |column|}}\n {{#if column.enable}}\n {{#if (eq column.id 'item')}}\n \n \n {{/if}}\n {{#if (eq column.id 'quantity')}}\n \n \n {{/if}}\n {{#if (eq column.id 'tax')}}\n \n \n {{/if}}\n {{#if (eq column.id 'unit_amount')}}\n \n \n {{/if}}\n {{#if (eq column.id 'net_total')}}\n \n \n {{/if}}\n {{#if (eq column.id 'amount_tax')}}\n \n \n {{/if}}\n {{#if (eq column.id 'gross_total')}}\n \n \n {{/if}}\n {{/if}}\n {{/each}}\n \n {{/each}}\n \n {{#if table_config.footer.gross_total.enable}}\n {{#each order.total_details.recurrences as |item|}}\n \n \n {{#if @root.table_config.footer.payment_type.enable}}\n \n {{/if}}\n {{#if (isColumnEnabled @root.table_config 'net_total')}}\n {{#if @root.table_config.footer.net_total.enable}}\n \n {{/if}}\n {{/if}}\n \n \n {{/each}}\n {{/if}}\n \n \n
{{column._label}}
\n {{#if @root.table_config.body.product_name.enable}}\n {{product.name}}\n {{/if}}\n {{#if @root.table_config.body.price_description.enable}}\n
\n {{product.price.description}}\n {{/if}}\n {{#if @root.table_config.body.product_description.enable}}\n
\n {{product.description}}\n {{/if}}\n
{{product.price.quantity}}\n \n {{product.price.tax_rate}}\n \n {{product.price.unit_amount_net}}\n \n {{product.price.amount_subtotal}}\n \n {{product.price.amount_tax}}\n \n {{product.price.amount_total}}\n {{#if @root.table_config.body.payment_type.enable}}\n {{#if (eq product.price.type 'recurring')}}\n
\n {{product.price.billing_period}}\n {{/if}}\n {{/if}}\n
{{item.billing_period}}{{item.amount_subtotal}}{{item.amount_total}}\n {{#if @root.table_config.footer.amount_tax.enable}}\n
\n {{item.full_amount_tax}}\n {{/if}}\n
\n", "created_at": "2022-04-19T12:41:43.662Z", "created_by": "100042", "updated_at": "2022-04-20T12:41:43.662Z", "updated_by": "100042"} getCustomVariable: "": parameters: diff --git a/README.md b/README.md index 79d12b3..0906f9f 100644 --- a/README.md +++ b/README.md @@ -42,7 +42,7 @@ terraform { required_providers { epilot-custom-variable = { source = "epilot-dev/epilot-custom-variable" - version = "0.10.6" + version = "1.0.1" } } } diff --git a/docs/index.md b/docs/index.md index 208d2f6..dded641 100644 --- a/docs/index.md +++ b/docs/index.md @@ -17,7 +17,7 @@ terraform { required_providers { epilot-custom-variable = { source = "epilot-dev/epilot-custom-variable" - version = "0.10.6" + version = "1.0.0" } } } diff --git a/docs/resources/custom_variable.md b/docs/resources/custom_variable.md index fc00ec8..b4c7263 100644 --- a/docs/resources/custom_variable.md +++ b/docs/resources/custom_variable.md @@ -30,7 +30,7 @@ resource "epilot-custom-variable_custom_variable" "my_customvariable" { "..." ] template = "\n \n \n {{#each table_config.header.columns as |column|}}\n {{#if column.enable}}\n \n {{/if}}\n {{/each}}\n \n \n \n \n {{#each order.products as |product|}}\n {{#if @last}}\n \n {{else}}\n \n {{/if}}\n {{#each @root.table_config.header.columns as |column|}}\n {{#if column.enable}}\n {{#if (eq column.id 'item')}}\n \n \n {{/if}}\n {{#if (eq column.id 'quantity')}}\n \n \n {{/if}}\n {{#if (eq column.id 'tax')}}\n \n \n {{/if}}\n {{#if (eq column.id 'unit_amount')}}\n \n \n {{/if}}\n {{#if (eq column.id 'net_total')}}\n \n \n {{/if}}\n {{#if (eq column.id 'amount_tax')}}\n \n \n {{/if}}\n {{#if (eq column.id 'gross_total')}}\n \n \n {{/if}}\n {{/if}}\n {{/each}}\n \n {{/each}}\n \n {{#if table_config.footer.gross_total.enable}}\n {{#each order.total_details.recurrences as |item|}}\n \n \n {{#if @root.table_config.footer.payment_type.enable}}\n \n {{/if}}\n {{#if (isColumnEnabled @root.table_config 'net_total')}}\n {{#if @root.table_config.footer.net_total.enable}}\n \n {{/if}}\n {{/if}}\n \n \n {{/each}}\n {{/if}}\n \n \n
{{column._label}}
\n {{#if @root.table_config.body.product_name.enable}}\n {{product.name}}\n {{/if}}\n {{#if @root.table_config.body.price_description.enable}}\n
\n {{product.price.description}}\n {{/if}}\n {{#if @root.table_config.body.product_description.enable}}\n
\n {{product.description}}\n {{/if}}\n
{{product.price.quantity}}\n \n {{product.price.tax_rate}}\n \n {{product.price.unit_amount_net}}\n \n {{product.price.amount_subtotal}}\n \n {{product.price.amount_tax}}\n \n {{product.price.amount_total}}\n {{#if @root.table_config.body.payment_type.enable}}\n {{#if (eq product.price.type 'recurring')}}\n
\n {{product.price.billing_period}}\n {{/if}}\n {{/if}}\n
{{item.billing_period}}{{item.amount_subtotal}}{{item.amount_total}}\n {{#if @root.table_config.footer.amount_tax.enable}}\n
\n {{item.full_amount_tax}}\n {{/if}}\n
\n" - type = "rbse777b-3cf8-4bff-bb0c-253fd1123250" + type = "custom" updated_at = "2022-04-20T12:41:43.662Z" updated_by = 100042 } @@ -51,7 +51,7 @@ resource "epilot-custom-variable_custom_variable" "my_customvariable" { - `name` (String) Custom variable name. Requires replacement if changed. - `tags` (List of String) The tags of custom variable. Requires replacement if changed. - `template` (String) Handlebar template that used to generate the variable content. Requires replacement if changed. -- `type` (String) Custom variable type. must be one of ["order_table", "custom"]; Requires replacement if changed. +- `type` (String) Custom variable type. must be one of ["order_table", "custom", "journey_link"]; Requires replacement if changed. - `updated_at` (String) Last update time. Requires replacement if changed. - `updated_by` (String) Updated by. Requires replacement if changed. diff --git a/examples/provider/provider.tf b/examples/provider/provider.tf index 1022f53..bcac82c 100644 --- a/examples/provider/provider.tf +++ b/examples/provider/provider.tf @@ -2,24 +2,11 @@ terraform { required_providers { epilot-custom-variable = { source = "epilot-dev/epilot-custom-variable" - version = "0.10.6" + version = "1.0.1" } } } -variable "epilot_auth" { - type = string -} -variable "custom_variables_api_url" { - type = string - default = "https://template-variables-api.dev.sls.epilot.io" -} - provider "epilot-custom-variable" { - epilot_auth = var.epilot_auth - server_url = var.custom_variables_api_url -} - -resource "epilot-variable_custom_variable" "my_variable" { - # (resource arguments) + # Configuration options } \ No newline at end of file diff --git a/examples/resources/epilot-custom-variable_custom_variable/resource.tf b/examples/resources/epilot-custom-variable_custom_variable/resource.tf index c0ef55e..cfef26f 100644 --- a/examples/resources/epilot-custom-variable_custom_variable/resource.tf +++ b/examples/resources/epilot-custom-variable_custom_variable/resource.tf @@ -15,7 +15,7 @@ resource "epilot-custom-variable_custom_variable" "my_customvariable" { "..." ] template = "\n \n \n {{#each table_config.header.columns as |column|}}\n {{#if column.enable}}\n \n {{/if}}\n {{/each}}\n \n \n \n \n {{#each order.products as |product|}}\n {{#if @last}}\n \n {{else}}\n \n {{/if}}\n {{#each @root.table_config.header.columns as |column|}}\n {{#if column.enable}}\n {{#if (eq column.id 'item')}}\n \n \n {{/if}}\n {{#if (eq column.id 'quantity')}}\n \n \n {{/if}}\n {{#if (eq column.id 'tax')}}\n \n \n {{/if}}\n {{#if (eq column.id 'unit_amount')}}\n \n \n {{/if}}\n {{#if (eq column.id 'net_total')}}\n \n \n {{/if}}\n {{#if (eq column.id 'amount_tax')}}\n \n \n {{/if}}\n {{#if (eq column.id 'gross_total')}}\n \n \n {{/if}}\n {{/if}}\n {{/each}}\n \n {{/each}}\n \n {{#if table_config.footer.gross_total.enable}}\n {{#each order.total_details.recurrences as |item|}}\n \n \n {{#if @root.table_config.footer.payment_type.enable}}\n \n {{/if}}\n {{#if (isColumnEnabled @root.table_config 'net_total')}}\n {{#if @root.table_config.footer.net_total.enable}}\n \n {{/if}}\n {{/if}}\n \n \n {{/each}}\n {{/if}}\n \n \n
{{column._label}}
\n {{#if @root.table_config.body.product_name.enable}}\n {{product.name}}\n {{/if}}\n {{#if @root.table_config.body.price_description.enable}}\n
\n {{product.price.description}}\n {{/if}}\n {{#if @root.table_config.body.product_description.enable}}\n
\n {{product.description}}\n {{/if}}\n
{{product.price.quantity}}\n \n {{product.price.tax_rate}}\n \n {{product.price.unit_amount_net}}\n \n {{product.price.amount_subtotal}}\n \n {{product.price.amount_tax}}\n \n {{product.price.amount_total}}\n {{#if @root.table_config.body.payment_type.enable}}\n {{#if (eq product.price.type 'recurring')}}\n
\n {{product.price.billing_period}}\n {{/if}}\n {{/if}}\n
{{item.billing_period}}{{item.amount_subtotal}}{{item.amount_total}}\n {{#if @root.table_config.footer.amount_tax.enable}}\n
\n {{item.full_amount_tax}}\n {{/if}}\n
\n" - type = "rbse777b-3cf8-4bff-bb0c-253fd1123250" + type = "custom" updated_at = "2022-04-20T12:41:43.662Z" updated_by = 100042 } \ No newline at end of file diff --git a/examples/tests/provider.tf b/examples/tests/provider.tf new file mode 100644 index 0000000..1d13b74 --- /dev/null +++ b/examples/tests/provider.tf @@ -0,0 +1,26 @@ +terraform { + required_providers { + epilot-custom-variable = { + source = "epilot-dev/epilot-custom-variable" + version = "1.0.0" + } + } +} + +variable "epilot_auth" { + type = string +} +variable "custom_variables_api_url" { + type = string + default = "https://template-variables-api.dev.sls.epilot.io" +} + +provider "epilot-custom-variable" { + epilot_auth = var.epilot_auth + server_url = var.custom_variables_api_url +} + +# import { +# to = epilot-custom-variable_custom_variable.my_variable +# id = "25bad807-bf36-4ce4-8aca-27b6420597ac" +# } \ No newline at end of file diff --git a/examples/tests/variables.tf b/examples/tests/variables.tf new file mode 100644 index 0000000..b6e4acb --- /dev/null +++ b/examples/tests/variables.tf @@ -0,0 +1,15 @@ +# __generated__ by Terraform +# Please review these resources and move them into your main configuration files. + +# __generated__ by Terraform from "25bad807-bf36-4ce4-8aca-27b6420597ac" +resource "epilot-custom-variable_custom_variable" "my_variable" { + config = { + } + helper_logic = null + helper_params = [] + key = "test_manifest_3" + name = "test manifest 3" + tags = [] + template = "Hello, world!" + type = "custom" +} diff --git a/final.yaml b/final.yaml index 1725521..b5ae009 100644 --- a/final.yaml +++ b/final.yaml @@ -10,7 +10,7 @@ security: - EpilotAuth: [] - EpilotOrg: [] paths: - /v1/template-variables/categories: + "/v1/template-variables/categories": get: operationId: getCategories summary: getCategories @@ -21,16 +21,16 @@ paths: - name: lang in: query schema: - $ref: '#/components/schemas/Language' + $ref: "#/components/schemas/Language" responses: - '200': + "200": description: ok content: application/json: schema: type: array items: - $ref: '#/components/schemas/CategoryResult' + $ref: "#/components/schemas/CategoryResult" example: - category: contact description: Contact @@ -38,7 +38,7 @@ paths: description: Account - category: organization description: Organization - /v1/template-variables:search: + "/v1/template-variables:search": post: operationId: searchVariables summary: searchVariables @@ -52,7 +52,7 @@ paths: type: object properties: template_type: - $ref: '#/components/schemas/TemplateType' + $ref: "#/components/schemas/TemplateType" query: type: string description: Search string @@ -64,7 +64,7 @@ paths: type: integer default: 25 lang: - $ref: '#/components/schemas/Language' + $ref: "#/components/schemas/Language" entity_schemas: type: array items: @@ -75,44 +75,44 @@ paths: - template_type - query responses: - '200': + "200": description: ok content: application/json: schema: type: array items: - $ref: '#/components/schemas/VariableResult' + $ref: "#/components/schemas/VariableResult" example: - - group: Personal Details - insert: '{{account.name}}' - description: Company name - type: simple - - group: Personal Details - insert: '{{account.tax_id}}' - description: Tax ID - type: simple - - group: Address details - qrdata: '{{account.address_details}}' - description: Address Details - type: partial - - group: Address Details - insert: '{{account.address.street}}' - description: Address - Street name - type: simple - - group: Address Details - insert: '{{account.address.street_number}}' - description: Address - Street number - type: simple - - group: Address Details - insert: '{{account.address.postal_code}}' - description: Address - Postal code - type: simple - - group: Address Details - insert: '{{account.address.city}}' - description: Address - City - type: simple - /v1/template-variables:context: + - group: "Personal Details" + insert: "{{account.name}}" + description: "Company name" + type: "simple" + - group: "Personal Details" + insert: "{{account.tax_id}}" + description: "Tax ID" + type: "simple" + - group: "Address details" + qrdata: "{{account.address_details}}" + description: "Address Details" + type: "partial" + - group: "Address Details" + insert: "{{account.address.street}}" + description: "Address - Street name" + type: "simple" + - group: "Address Details" + insert: "{{account.address.street_number}}" + description: "Address - Street number" + type: "simple" + - group: "Address Details" + insert: "{{account.address.postal_code}}" + description: "Address - Postal code" + type: "simple" + - group: "Address Details" + insert: "{{account.address.city}}" + description: "Address - City" + type: "simple" + "/v1/template-variables:context": post: operationId: getVariableContext summary: getVariableContext @@ -129,15 +129,15 @@ paths: type: object properties: parameters: - $ref: '#/components/schemas/VariableParameters' + $ref: "#/components/schemas/VariableParameters" responses: - '200': + "200": description: ok content: application/json: schema: - $ref: '#/components/schemas/VariableContext' - /v1/template-variables:replace: + $ref: "#/components/schemas/VariableContext" + "/v1/template-variables:replace": post: operationId: replaceTemplates summary: replaceTemplates @@ -162,9 +162,9 @@ paths: {{{brand.signature}}} parameters: - $ref: '#/components/schemas/VariableParameters' + $ref: "#/components/schemas/VariableParameters" responses: - '200': + "200": description: ok content: application/json: @@ -175,8 +175,15 @@ paths: type: array items: type: string - example: "\"[Brand Name GmbH] Order confirmation\",\n\"Hello Customer Name \n\nBrand Name GmbH\n\"Brand\nimprint\n\"]\n" - /v1/custom-variables: + example: | + "[Brand Name GmbH] Order confirmation", + "Hello Customer Name + + Brand Name GmbH + Brand Name + imprint + "] + "/v1/custom-variables": get: operationId: getCustomVariables summary: Get custom variables @@ -184,15 +191,15 @@ paths: tags: - Custom variables responses: - '200': + 200: description: Success content: application/json: schema: type: array items: - $ref: '#/components/schemas/CustomVariable' - '403': + $ref: "#/components/schemas/CustomVariable" + 403: description: Forbidden post: operationId: createCustomVariable @@ -204,14 +211,20 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/CustomVariable' + $ref: "#/components/schemas/CustomVariable" responses: - '201': + 201: description: Success - '403': + content: + application/json: + schema: + $ref: "#/components/schemas/CustomVariable" + 403: description: Forbidden + 409: + description: Conflict - Custom variable with the same key already exists x-speakeasy-entity-operation: CustomVariable#create - /v1/custom-variables:search: + "/v1/custom-variables:search": post: operationId: searchCustomVariables summary: searchCustomVariables @@ -222,9 +235,9 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/CustomVariablesSearchParams' + $ref: "#/components/schemas/CustomVariablesSearchParams" responses: - '200': + 200: description: Success content: application/json: @@ -234,14 +247,14 @@ paths: results: type: array items: - $ref: '#/components/schemas/CustomVariable' + $ref: "#/components/schemas/CustomVariable" hits: type: integer description: Total number of results example: 100 - '403': + 403: description: Forbidden - /v1/custom-variables/{id}: + "/v1/custom-variables/{id}": put: operationId: updateCustomVariable summary: Update custom variable @@ -260,12 +273,18 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/CustomVariable' + $ref: "#/components/schemas/CustomVariable" responses: - '200': + 200: description: Success - '403': + content: + application/json: + schema: + $ref: "#/components/schemas/CustomVariable" + 403: description: Forbidden + 409: + description: Conflict - Custom variable with the same key already exists get: operationId: getCustomVariable summary: Get custom variable @@ -281,15 +300,15 @@ paths: type: string example: rbse777b-3cf8-4bff-bb0c-253fd1123250 responses: - '200': + 200: description: Success content: application/json: schema: - $ref: '#/components/schemas/CustomVariable' - '403': + $ref: "#/components/schemas/CustomVariable" + 403: description: Forbidden - '404': + 404: description: Not found x-speakeasy-entity-operation: CustomVariable#get delete: @@ -307,12 +326,12 @@ paths: type: string example: rbse777b-3cf8-4bff-bb0c-253fd1123250 responses: - '204': + 204: description: Success - '403': + 403: description: Forbidden x-speakeasy-entity-operation: CustomVariable#delete - /v1/custom-variables/order-table-blueprint: + "/v1/custom-variables/order-table-blueprint": get: operationId: getBluePrintTableConfig summary: Get default table config @@ -320,13 +339,13 @@ paths: tags: - Custom variables responses: - '200': + 200: description: Success content: application/json: schema: - $ref: '#/components/schemas/CustomVariable' - '403': + $ref: "#/components/schemas/CustomVariable" + 403: description: Forbidden components: securitySchemes: @@ -349,9 +368,9 @@ components: type: object properties: template_type: - $ref: '#/components/schemas/TemplateType' + $ref: "#/components/schemas/TemplateType" language: - $ref: '#/components/schemas/Language' + $ref: "#/components/schemas/Language" main_entity_id: type: string format: uuid @@ -376,7 +395,7 @@ components: type: array description: Custom variables with specified values form other services. items: - $ref: '#/components/schemas/ExternalCustomVariable' + $ref: "#/components/schemas/ExternalCustomVariable" context_data: type: object description: If context data is avaialble, this data will be used for variable replace. @@ -423,6 +442,7 @@ components: enum: - order_table - custom + - journey_link tags: type: array description: The tags of custom variable @@ -457,22 +477,22 @@ components: properties: unsubscribe_url: type: string - example: https://consent.sls.epilot.io/v1/unsubscribe?token=abc123 + example: "https://consent.sls.epilot.io/v1/unsubscribe?token=abc123" main: type: object additionalProperties: true example: - $ref: '#/components/examples/ExampleMain/value' + $ref: "#/components/examples/ExampleMain/value" contact: type: object additionalProperties: true example: - $ref: '#/components/examples/ExampleContactEntity/value' + $ref: "#/components/examples/ExampleContactEntity/value" brand: type: object additionalProperties: true example: - $ref: '#/components/examples/ExampleBrand/value' + $ref: "#/components/examples/ExampleBrand/value" TemplateType: type: string enum: @@ -497,7 +517,7 @@ components: properties: variable: type: string - example: '{{craftsmen.invitation_link}}' + example: "{{craftsmen.invitation_link}}" value: type: string example: https://partner.epilot.cloud/activate-account?user_name=htny.pct%2Btet%40gmail.com&confirmation_code=EdXPRW19 @@ -514,7 +534,7 @@ components: enum: - order_table - custom - example: rbse777b-3cf8-4bff-bb0c-253fd1123250 + - journey_link name: type: string description: Custom variable name @@ -544,7 +564,7 @@ components: type: object description: Variable configuration example: - $ref: '#/components/examples/TableConfig/value' + $ref: "#/components/examples/TableConfig/value" template: type: string description: Handlebar template that used to generate the variable content @@ -681,36 +701,30 @@ components: last_name: Customer title: Prof. salutation: Ms. / Mrs. - birthdate: '2018-03-03' + birthdate: "2018-03-03" email: - email: contact.primary@domain.com - _tags: - - primary + _tags: ["primary"] - email: sale@domain.com phone: - - phone: '+49123456789' - _tags: - - primary - - support - - phone: '+49504305025' + - phone: "+49123456789" + _tags: ["primary", "support"] + - phone: "+49504305025" address: - - _tags: - - primary - - delivery + - _tags: ["primary", "delivery"] country: Germany city: Köln - postal_code: '50825' + postal_code: "50825" street: Im Mediapark - street_number: 8a - additional_info: 11th floor - - _tags: - - billing + street_number: "8a" + additional_info: "11th floor" + - _tags: ["billing"] country: Finland city: Köln - postal_code: '50670' + postal_code: "50670" street: Im Mediapark - street_number: 8a - additional_info: '' + street_number: "8a" + additional_info: "" account: - status: Active _id: c8d20ff6-df7a-465a-a26e-e5d28c2a3f79 @@ -718,25 +732,20 @@ components: name: name email: - email: account.primary@domain.com - _tags: - - primary + _tags: ["primary"] - email: account.sale@domain.com phone: - - phone: '+49123456789' - _tags: - - primary - - support - - phone: '+49504305025' + - phone: "+49123456789" + _tags: ["primary", "support"] + - phone: "+49504305025" address: - - _tags: - - primary - - delivery + - _tags: ["primary", "delivery"] country: Germany city: Köln - postal_code: '50825' + postal_code: "50825" street: Im Mediapark - street_number: 8a - additional_info: 11th floor + street_number: "8a" + additional_info: "11th floor" ExampleContactEntity: value: _id: 03be777b-3cf8-4bff-bb0c-253fd1128479 @@ -746,36 +755,30 @@ components: last_name: Customer title: Prof. salutation: Ms. / Mrs. - birthdate: '2018-03-03' + birthdate: "2018-03-03" email: - email: contact.primary@domain.com - _tags: - - primary + _tags: ["primary"] - email: sale@domain.com phone: - - phone: '+49123456789' - _tags: - - primary - - support - - phone: '+49504305025' + - phone: "+49123456789" + _tags: ["primary", "support"] + - phone: "+49504305025" address: - - _tags: - - primary - - delivery + - _tags: ["primary", "delivery"] country: Germany city: Köln - postal_code: '50825' + postal_code: "50825" street: Im Mediapark - street_number: 8a - additional_info: 11th floor - - _tags: - - billing + street_number: "8a" + additional_info: "11th floor" + - _tags: ["billing"] country: Finland city: Köln - postal_code: '50670' + postal_code: "50670" street: Im Mediapark - street_number: 8a - additional_info: '' + street_number: "8a" + additional_info: "" account: - status: Active _id: c8d20ff6-df7a-465a-a26e-e5d28c2a3f79 @@ -783,25 +786,20 @@ components: name: name email: - email: account.primary@domain.com - _tags: - - primary + _tags: ["primary"] - email: account.sale@domain.com phone: - - phone: '+49123456789' - _tags: - - primary - - support - - phone: '+49504305025' + - phone: "+49123456789" + _tags: ["primary", "support"] + - phone: "+49504305025" address: - - _tags: - - primary - - delivery + - _tags: ["primary", "delivery"] country: Germany city: KölnSS - postal_code: '50825' + postal_code: "50825" street: Im Mediapark - street_number: 8a - additional_info: 11th floor + street_number: "8a" + additional_info: "11th floor" ExampleAccountEntity: value: _id: c8d20ff6-df7a-465a-a26e-e5d28c2a3f79 @@ -810,69 +808,57 @@ components: tax_id: 123abc email: - email: account.primary@domain.com - _tags: - - primary + _tags: ["primary"] - email: account.sale@domain.com phone: - - phone: '+49123456789' - _tags: - - primary - - support - - phone: '+49504305025' + - phone: "+49123456789" + _tags: ["primary", "support"] + - phone: "+49504305025" address: - - _tags: - - primary - - delivery + - _tags: ["primary", "delivery"] country: Germany city: Köln - postal_code: '50825' + postal_code: "50825" street: Im Mediapark - street_number: 8a - additional_info: 11th floor - - _tags: - - billing + street_number: "8a" + additional_info: "11th floor" + - _tags: ["billing"] country: Finland city: Köln - postal_code: '50670' + postal_code: "50670" street: Im Mediapark - street_number: 8a - additional_info: '' + street_number: "8a" + additional_info: "" contacts: customer_number: 123 first_name: Example last_name: Customer title: Prof. salutation: Ms. / Mrs. - birthdate: '2018-03-03' + birthdate: "2018-03-03" email: - email: contact.primary@domain.com - _tags: - - primary + _tags: ["primary"] - email: sale@domain.com phone: - - phone: '+49123456789' - _tags: - - primary - - support - - phone: '+49504305025' + - phone: "+49123456789" + _tags: ["primary", "support"] + - phone: "+49504305025" address: - - _tags: - - primary - - delivery + - _tags: ["primary", "delivery"] country: Germany city: Köln - postal_code: '50825' + postal_code: "50825" street: Im Mediapark - street_number: 8a - additional_info: 11th floor - - _tags: - - billing + street_number: "8a" + additional_info: "11th floor" + - _tags: ["billing"] country: Finland city: Köln - postal_code: '50670' + postal_code: "50670" street: Im Mediapark - street_number: 8a - additional_info: '' + street_number: "8a" + additional_info: "" ExampleProductEntity: value: _id: fa5292c8-2d0a-44c6-95e8-929e98bd5001 @@ -883,55 +869,55 @@ components: unitLabel: Unit label shippable: true priceOptions: - - unitAmount: EUR 349,99 - type: One Time - sales_tax": Standard (19%) - tax_behavior: Exclusive (Price amount excludes Tax) - description: My additional options 1 - billingScheme: Per Unit - tiersMode: Standard - _id: d6d1148c-7d6f-4c09-9bba-07d217ecebbc - _schema: price - _org: '749660' - _created_at: '2021-10-13T04:04:46.845Z' - _updated_at: '2021-10-13T04:04:46.845Z' - _title: My additional options 1 - entity_id: d6d1148c-7d6f-4c09-9bba-07d217ecebbc - - unitAmount: EUR 99,999.45 - type: Recurring - billingPeriod: Monthly + - unitAmount: "EUR 349,99" + type: "One Time" + sales_tax": "Standard (19%)" + tax_behavior: "Exclusive (Price amount excludes Tax)" + description: "My additional options 1" + billingScheme: "Per Unit" + tiersMode: "Standard" + _id: "d6d1148c-7d6f-4c09-9bba-07d217ecebbc" + _schema: "price" + _org: "749660" + _created_at: "2021-10-13T04:04:46.845Z" + _updated_at: "2021-10-13T04:04:46.845Z" + _title: "My additional options 1" + entity_id: "d6d1148c-7d6f-4c09-9bba-07d217ecebbc" + - unitAmount: "EUR 99,999.45" + type: "Recurring" + billingPeriod: "Monthly" active: true - sales_tax: Standard (19%) - tax_behavior: Inclusive (Price amount includes Tax) - description: The fear - billingScheme: Per Unit - tiersMode: Standard - _id: 27516b31-dc5a-432f-9ad8-d3678962e104 - _schema: price - _org: '749660' - _created_at: '2021-10-13T04:05:52.023Z' - _updated_at: '2021-10-13T04:05:52.023Z' - _title: The fear - entity_id: 27516b31-dc5a-432f-9ad8-d3678962e104 + sales_tax: "Standard (19%)" + tax_behavior: "Inclusive (Price amount includes Tax)" + description: "The fear" + billingScheme: "Per Unit" + tiersMode: "Standard" + _id: "27516b31-dc5a-432f-9ad8-d3678962e104" + _schema: "price" + _org: "749660" + _created_at: "2021-10-13T04:05:52.023Z" + _updated_at: "2021-10-13T04:05:52.023Z" + _title: "The fear" + entity_id: "27516b31-dc5a-432f-9ad8-d3678962e104" ExampleOrganization: value: - id: '123450' + id: "123450" name: Organization name description: This is description email: my.organization@domain.com phone: + 49 8888 888 website: www.my-website.org street: Im Mediapark - street_number: 8a + street_number: "8a" city: Köln - postal_code: '50670' + postal_code: "50670" country: Finland - signature: Organization signature + signature: "Organization signature" ExampleBrand: value: id: 123453 name: Brand name - signature: Signature + signature: "Signature" ExampleUser: value: id: 123452 @@ -941,226 +927,223 @@ components: phone: + 49 8888 888 ExampleCustomVariables: value: - - variable: - '[object Object]': null + - variable: {? {invitationLink: ''} : ''} value: https://partner.epilot.cloud/activate-account?user_name=htny.pct%2Btet%40gmail.com&confirmation_code=EdXPRW19 TableConfig: value: header: style: - color: '#222' - background: '#fff' - font-size: 16px - font-family: '' - padding-bottom: 4px - font-weight: bold - border: none !important - text-align: left + color: "#222" + background: "#fff" + font-size: "16px" + font-family: "" + padding-bottom: "4px" + font-weight: "bold" + border: "none !important" + text-align: "left" columns: - - id: item + - id: "item" index: 0 label: - en: Item - de: Produkt + en: "Item" + de: "Produkt" enable: true draggable: true style: - padding-left: 10px - max-width: 30% - - id: quantity + padding-left: "10px" + max-width: "30%" + - id: "quantity" index: 1 label: - en: Quanity - de: Menge + en: "Quanity" + de: "Menge" enable: true draggable: true style: - min-width: 60px - width: 30% - - id: tax + min-width: "60px" + width: "30%" + - id: "tax" index: 2 label: - en: Tax Rate - de: Steuerrate + en: "Tax Rate" + de: "Steuerrate" enable: true draggable: true style: - min-width: 60px - width: 30% - - id: unit_amount + min-width: "60px" + width: "30%" + - id: "unit_amount" index: 3 label: - en: Unit Net Price - de: Nettopreis + en: "Unit Net Price" + de: "Nettopreis" enable: true draggable: true style: - min-width: 60px - width: 30% - - id: net_total + min-width: "60px" + width: "30%" + - id: "net_total" index: 4 label: - en: Net total - de: Nettosumme + en: "Net total" + de: "Nettosumme" enable: true, draggable: true style: - min-width: 60px - width: 30% - - id: gross_total + min-width: "60px" + width: "30%" + - id: "gross_total" index: 5 label: - en: Total - de: Gesamt + en: "Total" + de: "Gesamt" enable: true draggable: true style: - min-width: 60px - width: 30% + min-width: "60px" + width: "30%" body: product_name: - parent_column: item + parent_column: "item" enable: true style: - color: '#222' - background: '#fff' - font-size: 14px - font-family: '' - font-weight: bold - font-style: normal - padding-top: 16px - padding-bottom: 8px - border: none !important - vertical-align: top - text-align: left - max-width: 30% - padding-left: 10px + color: "#222" + background: "#fff" + "font-size": "14px" + "font-family": "" + "font-weight": "bold" + "font-style": "normal" + "padding-top": "16px" + "padding-bottom": "8px" + border: "none !important" + "vertical-align": "top" + "text-align": "left" + "max-width": "30%" + "padding-left": "10px" price_description: - parent_column: item + parent_column: "item" enable: true style: - color: '#222' - background: '#fff' - font-size: 12px - font-family: '' - font-weight: normal - font-style: normal - text-align: left - max-width: 30% + color: "#222" + background: "#fff" + "font-size": "12px" + "font-family": "" + "font-weight": "normal" + "font-style": "normal" + "text-align": "left" + "max-width": "30%" product_description: - parent_column: item + parent_column: "item" enable: true style: - color: '#222' - background: '#fff' - font-size: 12px - font-family: '' - font-weight: normal - font-style: normal - text-align: left - max-width: 30% + color: "#222" + background: "#fff" + "font-size": "12px" + "font-family": "" + "font-weight": "normal" + "font-style": "normal" + "text-align": "left" + "max-width": "30%" quantity: enable: true style: - color: '#222' - background: '#fff' - font-size: 12px - font-family: '' - font-weight: normal - font-style: normal - text-align: left - max-width: 30% + color: "#222" + background: "#fff" + "font-size": "12px" + "font-family": "" + "font-weight": "normal" + "font-style": "normal" + "text-align": "left" + "max-width": "30%" tax: enable: true style: - color: '#222' - background: '#fff' - font-size: 12px - font-family: '' - font-weight: normal - font-style: normal - text-align: left - max-width: 30% + color: "#222" + background: "#fff" + "font-size": "12px" + "font-family": "" + "font-weight": "normal" + "font-style": "normal" + "text-align": "left" + "max-width": "30%" unit_amount: enable: true style: - color: '#222' - background: '#fff' - font-size: 12px - font-family: '' - font-weight: normal - font-style: normal - text-align: left - max-width: 30% + color: "#222" + background: "#fff" + "font-size": "12px" + "font-family": "" + "font-weight": "normal" + "font-style": "normal" + "text-align": "left" + "max-width": "30%" net_total: enable: true style: - color: '#222' - background: '#fff' - font-size: 12px - font-family: '' - font-weight: normal - font-style: normal - text-align: left - max-width: 30% + color: "#222" + background: "#fff" + "font-size": "12px" + "font-family": "" + "font-weight": "normal" + "font-style": "normal" + "text-align": "left" + "max-width": "30%" gross_total: enable: true style: - color: '#222' - background: '#fff' - font-size: 12px - font-family: '' - font-weight: normal - font-style: normal - text-align: left - max-width: 30% + color: "#222" + background: "#fff" + "font-size": "12px" + "font-family": "" + "font-weight": "normal" + "font-style": "normal" + "text-align": "left" + "max-width": "30%" footer: payment_type: enable: true style: - color: '#222' - background: '#fff' - font-size: 12px - font-family: '' - font-weight: normal - font-style: normal - text-align: left - max-width: 30% + color: "#222" + background: "#fff" + "font-size": "12px" + "font-family": "" + "font-weight": "normal" + "font-style": "normal" + "text-align": "left" + "max-width": "30%" net_total: enable: true style: - color: '#222' - background: '#fff' - font-size: 12px - font-family: '' - font-weight: normal - font-style: normal - text-align: left - max-width: 30% + color: "#222" + background: "#fff" + "font-size": "12px" + "font-family": "" + "font-weight": "normal" + "font-style": "normal" + "text-align": "left" + "max-width": "30%" amount_tax: enable: true style: - color: '#222' - background: '#fff' - font-size: 12px - font-family: '' - font-weight: normal - font-style: normal - text-align: left - max-width: 30% + color: "#222" + background: "#fff" + "font-size": "12px" + "font-family": "" + "font-weight": "normal" + "font-style": "normal" + "text-align": "left" + "max-width": "30%" gross_total: enable: true style: - color: '#222' - background: '#fff' - font-size: 12px - font-family: '' - font-weight: normal - font-style: normal - text-align: left - max-width: 30% -servers: - - url: https://template-variables-api.sls.epilot.io + color: "#222" + background: "#fff" + "font-size": "12px" + "font-family": "" + "font-weight": "normal" + "font-style": "normal" + "text-align": "left" + "max-width": "30%" x-speakeasy-retries: strategy: backoff backoff: diff --git a/gen.yaml b/gen.yaml index 7fc4492..7076e2b 100644 --- a/gen.yaml +++ b/gen.yaml @@ -1,5 +1,6 @@ configVersion: 2.0.0 generation: + baseServerUrl: https://template-variables-api.sls.epilot.io sdkClassName: SDK maintainOpenAPIOrder: true usageSnippets: @@ -29,7 +30,7 @@ go: outputModelSuffix: output packageName: openapi terraform: - version: 1.0.0 + version: 1.0.1 additionalDataSources: [] additionalDependencies: {} additionalResources: [] diff --git a/internal/provider/customvariable_resource.go b/internal/provider/customvariable_resource.go index 8ec7c49..e8ad0a9 100644 --- a/internal/provider/customvariable_resource.go +++ b/internal/provider/customvariable_resource.go @@ -161,11 +161,12 @@ func (r *CustomVariableResource) Schema(ctx context.Context, req resource.Schema stringplanmodifier.RequiresReplaceIfConfigured(), speakeasy_stringplanmodifier.SuppressDiff(speakeasy_stringplanmodifier.ExplicitSuppress), }, - Description: `Custom variable type. must be one of ["order_table", "custom"]; Requires replacement if changed.`, + Description: `Custom variable type. must be one of ["order_table", "custom", "journey_link"]; Requires replacement if changed.`, Validators: []validator.String{ stringvalidator.OneOf( "order_table", "custom", + "journey_link", ), }, }, @@ -246,6 +247,11 @@ func (r *CustomVariableResource) Create(ctx context.Context, req resource.Create resp.Diagnostics.AddError(fmt.Sprintf("unexpected response from API. Got an unexpected response code %v", res.StatusCode), debugResponse(res.RawResponse)) return } + if !(res.CustomVariable != nil) { + resp.Diagnostics.AddError("unexpected response from API. Got an unexpected response body", debugResponse(res.RawResponse)) + return + } + data.RefreshFromSharedCustomVariable(res.CustomVariable) refreshPlan(ctx, plan, &data, resp.Diagnostics) // Save updated data into Terraform state diff --git a/internal/sdk/customvariables.go b/internal/sdk/customvariables.go index 0af47f5..706bad6 100644 --- a/internal/sdk/customvariables.go +++ b/internal/sdk/customvariables.go @@ -270,7 +270,7 @@ func (s *CustomVariables) CreateCustomVariable(ctx context.Context, request *sha if err != nil { return nil, fmt.Errorf("error creating request: %w", err) } - req.Header.Set("Accept", "*/*") + req.Header.Set("Accept", "application/json") req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) req.Header.Set("Content-Type", reqContentType) @@ -387,8 +387,30 @@ func (s *CustomVariables) CreateCustomVariable(ctx context.Context, request *sha switch { case httpRes.StatusCode == 201: - fallthrough + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + + var out shared.CustomVariable + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + res.CustomVariable = &out + default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + + return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) + } case httpRes.StatusCode == 403: + fallthrough + case httpRes.StatusCode == 409: default: rawBody, err := getRawBody() if err != nil { @@ -650,7 +672,7 @@ func (s *CustomVariables) UpdateCustomVariable(ctx context.Context, request oper if err != nil { return nil, fmt.Errorf("error creating request: %w", err) } - req.Header.Set("Accept", "*/*") + req.Header.Set("Accept", "application/json") req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) req.Header.Set("Content-Type", reqContentType) @@ -767,8 +789,30 @@ func (s *CustomVariables) UpdateCustomVariable(ctx context.Context, request oper switch { case httpRes.StatusCode == 200: - fallthrough + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + + var out shared.CustomVariable + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + res.CustomVariable = &out + default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + + return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) + } case httpRes.StatusCode == 403: + fallthrough + case httpRes.StatusCode == 409: default: rawBody, err := getRawBody() if err != nil { diff --git a/internal/sdk/models/operations/createcustomvariable.go b/internal/sdk/models/operations/createcustomvariable.go index eb02928..747fd05 100644 --- a/internal/sdk/models/operations/createcustomvariable.go +++ b/internal/sdk/models/operations/createcustomvariable.go @@ -3,6 +3,7 @@ package operations import ( + "github.com/epilot-dev/terraform-provider-epilot-custom-variable/internal/sdk/models/shared" "net/http" ) @@ -13,6 +14,8 @@ type CreateCustomVariableResponse struct { StatusCode int // Raw HTTP response; suitable for custom response parsing RawResponse *http.Response + // Success + CustomVariable *shared.CustomVariable } func (o *CreateCustomVariableResponse) GetContentType() string { @@ -35,3 +38,10 @@ func (o *CreateCustomVariableResponse) GetRawResponse() *http.Response { } return o.RawResponse } + +func (o *CreateCustomVariableResponse) GetCustomVariable() *shared.CustomVariable { + if o == nil { + return nil + } + return o.CustomVariable +} diff --git a/internal/sdk/models/operations/updatecustomvariable.go b/internal/sdk/models/operations/updatecustomvariable.go index 27c3aed..d2ec6d3 100644 --- a/internal/sdk/models/operations/updatecustomvariable.go +++ b/internal/sdk/models/operations/updatecustomvariable.go @@ -34,6 +34,8 @@ type UpdateCustomVariableResponse struct { StatusCode int // Raw HTTP response; suitable for custom response parsing RawResponse *http.Response + // Success + CustomVariable *shared.CustomVariable } func (o *UpdateCustomVariableResponse) GetContentType() string { @@ -56,3 +58,10 @@ func (o *UpdateCustomVariableResponse) GetRawResponse() *http.Response { } return o.RawResponse } + +func (o *UpdateCustomVariableResponse) GetCustomVariable() *shared.CustomVariable { + if o == nil { + return nil + } + return o.CustomVariable +} diff --git a/internal/sdk/models/shared/customvariable.go b/internal/sdk/models/shared/customvariable.go index f3cf302..ed32ea9 100644 --- a/internal/sdk/models/shared/customvariable.go +++ b/internal/sdk/models/shared/customvariable.go @@ -11,8 +11,9 @@ import ( type CustomVariableType string const ( - CustomVariableTypeOrderTable CustomVariableType = "order_table" - CustomVariableTypeCustom CustomVariableType = "custom" + CustomVariableTypeOrderTable CustomVariableType = "order_table" + CustomVariableTypeCustom CustomVariableType = "custom" + CustomVariableTypeJourneyLink CustomVariableType = "journey_link" ) func (e CustomVariableType) ToPointer() *CustomVariableType { @@ -27,6 +28,8 @@ func (e *CustomVariableType) UnmarshalJSON(data []byte) error { case "order_table": fallthrough case "custom": + fallthrough + case "journey_link": *e = CustomVariableType(v) return nil default: diff --git a/internal/sdk/models/shared/customvariablessearchparams.go b/internal/sdk/models/shared/customvariablessearchparams.go index 6746835..ce039f8 100644 --- a/internal/sdk/models/shared/customvariablessearchparams.go +++ b/internal/sdk/models/shared/customvariablessearchparams.go @@ -12,8 +12,9 @@ import ( type CustomVariablesSearchParamsType string const ( - CustomVariablesSearchParamsTypeOrderTable CustomVariablesSearchParamsType = "order_table" - CustomVariablesSearchParamsTypeCustom CustomVariablesSearchParamsType = "custom" + CustomVariablesSearchParamsTypeOrderTable CustomVariablesSearchParamsType = "order_table" + CustomVariablesSearchParamsTypeCustom CustomVariablesSearchParamsType = "custom" + CustomVariablesSearchParamsTypeJourneyLink CustomVariablesSearchParamsType = "journey_link" ) func (e CustomVariablesSearchParamsType) ToPointer() *CustomVariablesSearchParamsType { @@ -28,6 +29,8 @@ func (e *CustomVariablesSearchParamsType) UnmarshalJSON(data []byte) error { case "order_table": fallthrough case "custom": + fallthrough + case "journey_link": *e = CustomVariablesSearchParamsType(v) return nil default: diff --git a/internal/sdk/sdk.go b/internal/sdk/sdk.go index e43e5a5..151251b 100644 --- a/internal/sdk/sdk.go +++ b/internal/sdk/sdk.go @@ -150,8 +150,8 @@ func New(opts ...SDKOption) *SDK { Language: "go", OpenAPIDocVersion: "1.0.0", SDKVersion: "0.0.1", - GenVersion: "2.428.1", - UserAgent: "speakeasy-sdk/go 0.0.1 2.428.1 1.0.0 github.com/epilot-dev/terraform-provider-epilot-custom-variable/internal/sdk", + GenVersion: "2.429.0", + UserAgent: "speakeasy-sdk/go 0.0.1 2.429.0 1.0.0 github.com/epilot-dev/terraform-provider-epilot-custom-variable/internal/sdk", Hooks: hooks.New(), }, }