diff --git a/.speakeasy/gen.lock b/.speakeasy/gen.lock index 909aff8..1b8cc2b 100755 --- a/.speakeasy/gen.lock +++ b/.speakeasy/gen.lock @@ -1,12 +1,12 @@ lockVersion: 2.0.0 id: 5a857039-7f4b-42d5-86fd-449767242ed2 management: - docChecksum: 49ed280caef5eeece793d407c91311b9 + docChecksum: d59d7d805e3440a2b3fc9350ab9c87b9 docVersion: 1.0.0 - speakeasyVersion: internal - generationVersion: 2.230.1 - releaseVersion: 0.6.0 - configChecksum: 7343b8d7750f297d93a3e264e8b3bccf + speakeasyVersion: 1.346.0 + generationVersion: 2.379.3 + releaseVersion: 0.7.0 + configChecksum: d31a4e2b4f3485ff79942468af450a99 repoURL: https://github.com/epilot-dev/terraform-provider-epilot-product.git repoSubDirectory: . published: true @@ -20,16 +20,71 @@ features: globalServerURLs: 2.82.0 unions: 2.85.0 terraform: - constsAndDefaults: 0.1.2 - core: 3.8.1 - globalSecurity: 2.81.2 + additionalDependencies: 0.1.0 + constsAndDefaults: 0.1.4 + core: 3.24.3 + globalSecurity: 2.81.6 globalServerURLs: 2.82.1 - unions: 2.81.7 + nullables: 0.0.0 generatedFiles: - internal/sdk/price.go - internal/sdk/product.go - internal/sdk/tax.go - internal/sdk/sdk.go + - internal/sdk/models/errors/sdkerror.go + - internal/sdk/retry/config.go + - internal/sdk/types/bigint.go + - internal/sdk/types/date.go + - internal/sdk/types/datetime.go + - internal/sdk/types/decimal.go + - internal/sdk/types/pointers.go + - internal/sdk/internal/utils/contenttype.go + - internal/sdk/internal/utils/form.go + - internal/sdk/internal/utils/headers.go + - internal/sdk/internal/utils/json.go + - internal/sdk/internal/utils/pathparams.go + - internal/sdk/internal/utils/queryparams.go + - internal/sdk/internal/utils/requestbody.go + - internal/sdk/internal/utils/retries.go + - internal/sdk/internal/utils/security.go + - internal/sdk/internal/utils/utils.go + - internal/sdk/models/operations/createprice.go + - internal/sdk/models/operations/deleteprice.go + - internal/sdk/models/operations/getprice.go + - internal/sdk/models/operations/patchprice.go + - internal/sdk/models/operations/updateprice.go + - internal/sdk/models/operations/createproduct.go + - internal/sdk/models/operations/deleteproduct.go + - internal/sdk/models/operations/getproduct.go + - internal/sdk/models/operations/patchproduct.go + - internal/sdk/models/operations/updateproduct.go + - internal/sdk/models/operations/createtax.go + - internal/sdk/models/operations/deletetax.go + - internal/sdk/models/operations/gettax.go + - internal/sdk/models/operations/patchtax.go + - internal/sdk/models/operations/updatetax.go + - internal/sdk/models/shared/servererror.go + - internal/sdk/models/shared/price.go + - internal/sdk/models/shared/pricetier.go + - internal/sdk/models/shared/pricetierdisplaymode.go + - internal/sdk/models/shared/pricecomponentrelation.go + - internal/sdk/models/shared/clienterror.go + - internal/sdk/models/shared/pricecreate.go + - internal/sdk/models/shared/pricepatch.go + - internal/sdk/models/shared/product.go + - internal/sdk/models/shared/baserelation.go + - internal/sdk/models/shared/productcreate.go + - internal/sdk/models/shared/productpatch.go + - internal/sdk/models/shared/tax.go + - internal/sdk/models/shared/taxcreate.go + - internal/sdk/models/shared/taxpatch.go + - internal/sdk/models/shared/security.go + - internal/sdk/.gitignore + - internal/sdk/models/operations/options.go + - internal/sdk/.gitattributes + - internal/sdk/internal/hooks/registration.go + - internal/sdk/internal/hooks/hooks.go + - internal/sdk/CONTRIBUTING.md - examples/README.md - go.mod - go.sum @@ -58,22 +113,6 @@ generatedFiles: - internal/provider/reflect/slice.go - internal/provider/reflect/struct.go - internal/provider/utils.go - - internal/sdk/pkg/models/sdkerrors/sdkerror.go - - internal/sdk/pkg/types/bigint.go - - internal/sdk/pkg/types/date.go - - internal/sdk/pkg/types/datetime.go - - internal/sdk/pkg/types/decimal.go - - internal/sdk/pkg/types/pointers.go - - internal/sdk/pkg/utils/contenttype.go - - internal/sdk/pkg/utils/form.go - - internal/sdk/pkg/utils/headers.go - - internal/sdk/pkg/utils/json.go - - internal/sdk/pkg/utils/pathparams.go - - internal/sdk/pkg/utils/queryparams.go - - internal/sdk/pkg/utils/requestbody.go - - internal/sdk/pkg/utils/retries.go - - internal/sdk/pkg/utils/security.go - - internal/sdk/pkg/utils/utils.go - internal/validators/DateValidator.go - internal/validators/ExactlyOneChild.go - internal/validators/JSONParseValidator.go @@ -90,49 +129,23 @@ generatedFiles: - main.go - terraform-registry-manifest.json - tools/tools.go - - internal/sdk/pkg/models/operations/createprice.go - - internal/sdk/pkg/models/operations/deleteprice.go - - internal/sdk/pkg/models/operations/getprice.go - - internal/sdk/pkg/models/operations/patchprice.go - - internal/sdk/pkg/models/operations/updateprice.go - - internal/sdk/pkg/models/operations/createproduct.go - - internal/sdk/pkg/models/operations/deleteproduct.go - - internal/sdk/pkg/models/operations/getproduct.go - - internal/sdk/pkg/models/operations/patchproduct.go - - internal/sdk/pkg/models/operations/updateproduct.go - - internal/sdk/pkg/models/operations/createtax.go - - internal/sdk/pkg/models/operations/deletetax.go - - internal/sdk/pkg/models/operations/gettax.go - - internal/sdk/pkg/models/operations/patchtax.go - - internal/sdk/pkg/models/operations/updatetax.go - - internal/sdk/pkg/models/shared/servererror.go - - internal/sdk/pkg/models/shared/price.go - - internal/sdk/pkg/models/shared/pricetier.go - - internal/sdk/pkg/models/shared/pricetierdisplaymode.go - - internal/sdk/pkg/models/shared/clienterror.go - - internal/sdk/pkg/models/shared/pricecreate.go - - internal/sdk/pkg/models/shared/pricepatch.go - - internal/sdk/pkg/models/shared/product.go - - internal/sdk/pkg/models/shared/baserelation.go - - internal/sdk/pkg/models/shared/productcreate.go - - internal/sdk/pkg/models/shared/productpatch.go - - internal/sdk/pkg/models/shared/tax.go - - internal/sdk/pkg/models/shared/taxcreate.go - - internal/sdk/pkg/models/shared/taxpatch.go - - internal/sdk/pkg/models/shared/security.go - - internal/provider/type_price_tier.go - - internal/provider/type_price_create_unit.go - - internal/provider/type_dollar_relation.go - - internal/provider/type_base_relation.go + - internal/provider/types/price_component_relation.go + - internal/provider/types/price_create_price_components.go + - internal/provider/types/price_tier.go + - internal/provider/types/dollar_relation.go + - internal/provider/types/base_relation.go - USAGE.md - internal/provider/provider.go - examples/provider/provider.tf + - examples/resources/epilot-product_price/import.sh - internal/provider/price_resource.go - internal/provider/price_resource_sdk.go - examples/resources/epilot-product_price/resource.tf + - examples/resources/epilot-product_product/import.sh - internal/provider/product_resource.go - internal/provider/product_resource_sdk.go - examples/resources/epilot-product_product/resource.tf + - examples/resources/epilot-product_tax/import.sh - internal/provider/tax_resource.go - internal/provider/tax_resource_sdk.go - examples/resources/epilot-product_tax/resource.tf @@ -146,3 +159,4 @@ generatedFiles: - internal/provider/tax_data_source_sdk.go - examples/data-sources/epilot-product_tax/data-source.tf - .gitattributes + - CONTRIBUTING.md diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..d585717 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,26 @@ +# Contributing to This Repository + +Thank you for your interest in contributing to this repository. Please note that this repository contains generated code. As such, we do not accept direct changes or pull requests. Instead, we encourage you to follow the guidelines below to report issues and suggest improvements. + +## How to Report Issues + +If you encounter any bugs or have suggestions for improvements, please open an issue on GitHub. When reporting an issue, please provide as much detail as possible to help us reproduce the problem. This includes: + +- A clear and descriptive title +- Steps to reproduce the issue +- Expected and actual behavior +- Any relevant logs, screenshots, or error messages +- Information about your environment (e.g., operating system, software versions) + - For example can be collected using the `npx envinfo` command from your terminal if you have Node.js installed + +## Issue Triage and Upstream Fixes + +We will review and triage issues as quickly as possible. Our goal is to address bugs and incorporate improvements in the upstream source code. Fixes will be included in the next generation of the generated code. + +## Contact + +If you have any questions or need further assistance, please feel free to reach out by opening an issue. + +Thank you for your understanding and cooperation! + +The Maintainers diff --git a/README.md b/README.md index fd776a9..8019a48 100644 --- a/README.md +++ b/README.md @@ -64,7 +64,7 @@ terraform { required_providers { epilot-product = { source = "epilot-dev/epilot-product" - version = "0.6.0" + version = "0.7.0" } } } diff --git a/docs/data-sources/price.md b/docs/data-sources/price.md deleted file mode 100644 index fe78d91..0000000 --- a/docs/data-sources/price.md +++ /dev/null @@ -1,114 +0,0 @@ ---- -# generated by https://github.com/hashicorp/terraform-plugin-docs -page_title: "epilot-product_price Data Source - terraform-provider-epilot-product" -subcategory: "" -description: |- - Price DataSource ---- - -# epilot-product_price (Data Source) - -Price DataSource - -## Example Usage - -```terraform -data "epilot-product_price" "my_price" { - hydrate = true - id = "123e4567-e89b-12d3-a456-426614174000" -} -``` - - -## Schema - -### Required - -- `id` (String) The price id - -### Optional - -- `hydrate` (Boolean) Hydrates entities in relations when passed true - -### Read-Only - -- `acl` (Attributes) Access control list (ACL) for an entity. Defines sharing access to external orgs or users. (see [below for nested schema](#nestedatt--acl)) -- `active` (Boolean) Whether the price can be used for new purchases. -- `billing_duration_amount` (Number) The billing period duration -- `billing_duration_unit` (String) The billing period duration unit. must be one of ["weeks", "months", "years"] -- `created_at` (String) -- `description` (String) A brief description of the price. -- `is_composite_price` (Boolean) The flag for prices that contain price components. -- `is_tax_inclusive` (Boolean) Specifies whether the price is considered `inclusive` of taxes or not. Default: false -- `long_description` (String) A detailed description of the price. This is shown on the order document and order table. Multi-line supported. -- `notice_time_amount` (Number) The notice period duration -- `notice_time_unit` (String) The notice period duration unit. must be one of ["weeks", "months", "years"] -- `org` (String) Organization Id the entity belongs to -- `owners` (Attributes List) (see [below for nested schema](#nestedatt--owners)) -- `price_display_in_journeys` (String) Defines the way the price amount is display in epilot journeys. must be one of ["show_price", "show_as_starting_price", "show_as_on_request"] -- `pricing_model` (String) Describes how to compute the price per period. Either `per_unit`, `tiered_graduated` or `tiered_volume`. -- `per_unit` indicates that the fixed amount (specified in unit_amount or unit_amount_decimal) will be charged per unit in quantity -- `tiered_graduated` indicates that the unit pricing will be computed using tiers attribute. The customer pays the price per unit in every range their purchase rises through. -- `tiered_volume` indicates that the unit pricing will be computed using tiers attribute. The customer pays the same unit price for all purchased units. -- `tiered_flatfee` While similar to tiered_volume, tiered flat fee charges for the same price (flat) for the entire range instead using the unit price to multiply the quantity. - -must be one of ["per_unit", "tiered_volume", "tiered_graduated", "tiered_flatfee"]; Default: "per_unit" -- `renewal_duration_amount` (Number) The renewal period duration -- `renewal_duration_unit` (String) The renewal period duration unit. must be one of ["weeks", "months", "years"] -- `schema` (String) -- `tags` (List of String) -- `tax` (String) Parsed as JSON. -- `termination_time_amount` (Number) The termination period duration -- `termination_time_unit` (String) The termination period duration unit. must be one of ["weeks", "months", "years"] -- `tiers` (Attributes List) Defines an array of tiers. Each tier has an upper bound, an unit amount and a flat fee. (see [below for nested schema](#nestedatt--tiers)) -- `title` (String) -- `type` (String) One of `one_time` or `recurring` depending on whether the price is for a one-time purchase or a recurring (subscription) purchase. must be one of ["one_time", "recurring"]; Default: "one_time" -- `unit` (Attributes) The unit of measurement used for display purposes and possibly for calculations when the price is variable. (see [below for nested schema](#nestedatt--unit)) -- `unit_amount` (Number) The unit amount in cents to be charged, represented as a whole integer if possible. -- `unit_amount_currency` (String) Three-letter ISO currency code, in lowercase. -- `unit_amount_decimal` (String) The unit amount in cents to be charged, represented as a decimal string with at most 12 decimal places. -- `updated_at` (String) -- `variable_price` (Boolean) The flag for prices that can be influenced by external variables such as user input. Default: false - - -### Nested Schema for `acl` - -Read-Only: - -- `additional_properties` (String) Parsed as JSON. -- `delete` (List of String) -- `edit` (List of String) -- `view` (List of String) - - - -### Nested Schema for `owners` - -Read-Only: - -- `org_id` (String) -- `user_id` (String) - - - -### Nested Schema for `tiers` - -Read-Only: - -- `display_mode` (String) must be one of ["hidden", "on_request"] -- `flat_fee_amount` (Number) -- `flat_fee_amount_decimal` (String) -- `unit_amount` (Number) -- `unit_amount_decimal` (String) -- `up_to` (Number) - - - -### Nested Schema for `unit` - -Read-Only: - -- `one` (String) built-in units. must be one of ["kw", "kwh", "m", "m2", "l", "cubic-meter", "cubic-meter-h", "ls", "a", "kva", "w", "wp", "kwp"] -- `str` (String) - - diff --git a/docs/data-sources/product.md b/docs/data-sources/product.md deleted file mode 100644 index cce7469..0000000 --- a/docs/data-sources/product.md +++ /dev/null @@ -1,68 +0,0 @@ ---- -# generated by https://github.com/hashicorp/terraform-plugin-docs -page_title: "epilot-product_product Data Source - terraform-provider-epilot-product" -subcategory: "" -description: |- - Product DataSource ---- - -# epilot-product_product (Data Source) - -Product DataSource - -## Example Usage - -```terraform -data "epilot-product_product" "my_product" { - hydrate = true - id = "123e4567-e89b-12d3-a456-426614174000" -} -``` - - -## Schema - -### Required - -- `id` (String) The product id - -### Optional - -- `hydrate` (Boolean) Hydrates entities in relations when passed true - -### Read-Only - -- `active` (Boolean) -- `code` (String) The product code -- `description` (String) A description of the product. Multi-line supported. -- `feature` (List of String) -- `internal_name` (String) Not visible to customers, only in internal tables -- `name` (String) The description for the product -- `price_options` (Attributes) (see [below for nested schema](#nestedatt--price_options)) -- `product_downloads` (String) Parsed as JSON. -- `product_images` (String) Parsed as JSON. -- `type` (String) The type of Product: - -| type | description | -|----| ----| -| `product` | Represents a physical good | -| `service` | Represents a service or virtual product | - -must be one of ["product", "service"]; Default: "product" - - -### Nested Schema for `price_options` - -Read-Only: - -- `dollar_relation` (Attributes List) (see [below for nested schema](#nestedatt--price_options--dollar_relation)) - - -### Nested Schema for `price_options.dollar_relation` - -Read-Only: - -- `entity_id` (String) -- `tags` (List of String) - - diff --git a/docs/data-sources/tax.md b/docs/data-sources/tax.md deleted file mode 100644 index 56ab92c..0000000 --- a/docs/data-sources/tax.md +++ /dev/null @@ -1,68 +0,0 @@ ---- -# generated by https://github.com/hashicorp/terraform-plugin-docs -page_title: "epilot-product_tax Data Source - terraform-provider-epilot-product" -subcategory: "" -description: |- - Tax DataSource ---- - -# epilot-product_tax (Data Source) - -Tax DataSource - -## Example Usage - -```terraform -data "epilot-product_tax" "my_tax" { - hydrate = false - id = "123e4567-e89b-12d3-a456-426614174000" -} -``` - - -## Schema - -### Required - -- `id` (String) The tax id - -### Optional - -- `hydrate` (Boolean) Hydrates entities in relations when passed true - -### Read-Only - -- `acl` (Attributes) Access control list (ACL) for an entity. Defines sharing access to external orgs or users. (see [below for nested schema](#nestedatt--acl)) -- `active` (Boolean) -- `created_at` (String) -- `description` (String) -- `org` (String) Organization Id the entity belongs to -- `owners` (Attributes List) (see [below for nested schema](#nestedatt--owners)) -- `rate` (String) -- `region` (String) must be one of ["DE", "AT", "CH"] -- `schema` (String) -- `tags` (List of String) -- `title` (String) -- `type` (String) must be one of ["VAT", "Custom"] -- `updated_at` (String) - - -### Nested Schema for `acl` - -Read-Only: - -- `additional_properties` (String) Parsed as JSON. -- `delete` (List of String) -- `edit` (List of String) -- `view` (List of String) - - - -### Nested Schema for `owners` - -Read-Only: - -- `org_id` (String) -- `user_id` (String) - - diff --git a/docs/index.md b/docs/index.md deleted file mode 100644 index 42127fb..0000000 --- a/docs/index.md +++ /dev/null @@ -1,37 +0,0 @@ ---- -# generated by https://github.com/hashicorp/terraform-plugin-docs -page_title: "epilot-product Provider" -subcategory: "" -description: |- - ---- - -# epilot-product Provider - - - -## Example Usage - -```terraform -terraform { - required_providers { - epilot-product = { - source = "epilot-dev/epilot-product" - version = "0.5.6" - } - } -} - -provider "epilot-product" { - # Configuration options -} -``` - - -## Schema - -### Optional - -- `epilot_auth` (String, Sensitive) -- `epilot_org` (String, Sensitive) -- `server_url` (String) Server URL (defaults to https://product.sls.epilot.io) diff --git a/docs/resources/price.md b/docs/resources/price.md deleted file mode 100644 index c70aeb8..0000000 --- a/docs/resources/price.md +++ /dev/null @@ -1,132 +0,0 @@ ---- -# generated by https://github.com/hashicorp/terraform-plugin-docs -page_title: "epilot-product_price Resource - terraform-provider-epilot-product" -subcategory: "" -description: |- - Price Resource ---- - -# epilot-product_price (Resource) - -Price Resource - -## Example Usage - -```terraform -resource "epilot-product_price" "my_price" { - active = true - billing_duration_amount = 66.76 - billing_duration_unit = "weeks" - description = "...my_description..." - is_composite_price = false - is_tax_inclusive = true - long_description = "...my_long_description..." - notice_time_amount = 2.66 - notice_time_unit = "months" - price_display_in_journeys = "show_as_starting_price" - pricing_model = "per_unit" - renewal_duration_amount = 66.53 - renewal_duration_unit = "months" - tax = "{ \"see\": \"documentation\" }" - termination_time_amount = 20 - termination_time_unit = "weeks" - type = "recurring" - unit_amount = 84.62 - unit_amount_currency = "EUR" - unit_amount_decimal = "...my_unit_amount_decimal..." - variable_price = false -} -``` - - -## Schema - -### Required - -- `active` (Boolean) Whether the price can be used for new purchases. -- `description` (String) A brief description of the price. - -### Optional - -- `billing_duration_amount` (Number) The billing period duration -- `billing_duration_unit` (String) The billing period duration unit. must be one of ["weeks", "months", "years"] -- `is_composite_price` (Boolean) The flag for prices that contain price components. -- `is_tax_inclusive` (Boolean) Specifies whether the price is considered `inclusive` of taxes or not. Default: false -- `long_description` (String) A detailed description of the price. This is shown on the order document and order table. Multi-line supported. -- `notice_time_amount` (Number) The notice period duration -- `notice_time_unit` (String) The notice period duration unit. must be one of ["weeks", "months", "years"] -- `price_display_in_journeys` (String) Defines the way the price amount is display in epilot journeys. must be one of ["show_price", "show_as_starting_price", "show_as_on_request"] -- `pricing_model` (String) Describes how to compute the price per period. Either `per_unit`, `tiered_graduated` or `tiered_volume`. -- `per_unit` indicates that the fixed amount (specified in unit_amount or unit_amount_decimal) will be charged per unit in quantity -- `tiered_graduated` indicates that the unit pricing will be computed using tiers attribute. The customer pays the price per unit in every range their purchase rises through. -- `tiered_volume` indicates that the unit pricing will be computed using tiers attribute. The customer pays the same unit price for all purchased units. -- `tiered_flatfee` While similar to tiered_volume, tiered flat fee charges for the same price (flat) for the entire range instead using the unit price to multiply the quantity. - -must be one of ["per_unit", "tiered_volume", "tiered_graduated", "tiered_flatfee"]; Default: "per_unit" -- `renewal_duration_amount` (Number) The renewal period duration -- `renewal_duration_unit` (String) The renewal period duration unit. must be one of ["weeks", "months", "years"] -- `tax` (String) Parsed as JSON. -- `termination_time_amount` (Number) The termination period duration -- `termination_time_unit` (String) The termination period duration unit. must be one of ["weeks", "months", "years"] -- `tiers` (Attributes List) Defines an array of tiers. Each tier has an upper bound, an unit amount and a flat fee. (see [below for nested schema](#nestedatt--tiers)) -- `type` (String) One of `one_time` or `recurring` depending on whether the price is for a one-time purchase or a recurring (subscription) purchase. must be one of ["one_time", "recurring"]; Default: "one_time" -- `unit` (Attributes) The unit of measurement used for display purposes and possibly for calculations when the price is variable. (see [below for nested schema](#nestedatt--unit)) -- `unit_amount` (Number) The unit amount in cents to be charged, represented as a whole integer if possible. -- `unit_amount_currency` (String) Three-letter ISO currency code, in lowercase. -- `unit_amount_decimal` (String) The unit amount in cents to be charged, represented as a decimal string with at most 12 decimal places. -- `variable_price` (Boolean) The flag for prices that can be influenced by external variables such as user input. Default: false - -### Read-Only - -- `acl` (Attributes) Access control list (ACL) for an entity. Defines sharing access to external orgs or users. (see [below for nested schema](#nestedatt--acl)) -- `created_at` (String) -- `id` (String) The price id -- `org` (String) Organization Id the entity belongs to -- `owners` (Attributes List) (see [below for nested schema](#nestedatt--owners)) -- `schema` (String) -- `tags` (List of String) -- `title` (String) -- `updated_at` (String) - - -### Nested Schema for `tiers` - -Optional: - -- `display_mode` (String) must be one of ["hidden", "on_request"] -- `flat_fee_amount` (Number) -- `flat_fee_amount_decimal` (String) -- `unit_amount` (Number) -- `unit_amount_decimal` (String) -- `up_to` (Number) - - - -### Nested Schema for `unit` - -Optional: - -- `one` (String) built-in units. must be one of ["kw", "kwh", "m", "m2", "l", "cubic-meter", "cubic-meter-h", "ls", "a", "kva", "w", "wp", "kwp"] -- `str` (String) - - - -### Nested Schema for `acl` - -Read-Only: - -- `additional_properties` (String) Parsed as JSON. -- `delete` (List of String) -- `edit` (List of String) -- `view` (List of String) - - - -### Nested Schema for `owners` - -Read-Only: - -- `org_id` (String) -- `user_id` (String) - - diff --git a/docs/resources/product.md b/docs/resources/product.md deleted file mode 100644 index 3d4de07..0000000 --- a/docs/resources/product.md +++ /dev/null @@ -1,73 +0,0 @@ ---- -# generated by https://github.com/hashicorp/terraform-plugin-docs -page_title: "epilot-product_product Resource - terraform-provider-epilot-product" -subcategory: "" -description: |- - Product Resource ---- - -# epilot-product_product (Resource) - -Product Resource - -## Example Usage - -```terraform -resource "epilot-product_product" "my_product" { - active = true - code = "...my_code..." - description = "...my_description..." - internal_name = "...my_internal_name..." - name = "Juan Morar Jr." - product_downloads = "{ \"see\": \"documentation\" }" - product_images = "{ \"see\": \"documentation\" }" - type = "product" -} -``` - - -## Schema - -### Required - -- `active` (Boolean) -- `name` (String) The description for the product - -### Optional - -- `code` (String) The product code -- `description` (String) A description of the product. Multi-line supported. -- `feature` (List of String) -- `internal_name` (String) Not visible to customers, only in internal tables -- `price_options` (Attributes) (see [below for nested schema](#nestedatt--price_options)) -- `product_downloads` (String) Parsed as JSON. -- `product_images` (String) Parsed as JSON. -- `type` (String) The type of Product: - -| type | description | -|----| ----| -| `product` | Represents a physical good | -| `service` | Represents a service or virtual product | - -must be one of ["product", "service"]; Default: "product" - -### Read-Only - -- `id` (String) The product id - - -### Nested Schema for `price_options` - -Optional: - -- `dollar_relation` (Attributes List) (see [below for nested schema](#nestedatt--price_options--dollar_relation)) - - -### Nested Schema for `price_options.dollar_relation` - -Optional: - -- `entity_id` (String) -- `tags` (List of String) - - diff --git a/docs/resources/tax.md b/docs/resources/tax.md deleted file mode 100644 index 2ba62a4..0000000 --- a/docs/resources/tax.md +++ /dev/null @@ -1,70 +0,0 @@ ---- -# generated by https://github.com/hashicorp/terraform-plugin-docs -page_title: "epilot-product_tax Resource - terraform-provider-epilot-product" -subcategory: "" -description: |- - Tax Resource ---- - -# epilot-product_tax (Resource) - -Tax Resource - -## Example Usage - -```terraform -resource "epilot-product_tax" "my_tax" { - active = true - description = "...my_description..." - rate = "...my_rate..." - region = "AT" - type = "VAT" -} -``` - - -## Schema - -### Required - -- `active` (Boolean) -- `rate` (String) -- `region` (String) must be one of ["DE", "AT", "CH"] -- `type` (String) must be one of ["VAT", "Custom"] - -### Optional - -- `description` (String) - -### Read-Only - -- `acl` (Attributes) Access control list (ACL) for an entity. Defines sharing access to external orgs or users. (see [below for nested schema](#nestedatt--acl)) -- `created_at` (String) -- `id` (String) The tax id -- `org` (String) Organization Id the entity belongs to -- `owners` (Attributes List) (see [below for nested schema](#nestedatt--owners)) -- `schema` (String) -- `tags` (List of String) -- `title` (String) -- `updated_at` (String) - - -### Nested Schema for `acl` - -Read-Only: - -- `additional_properties` (String) Parsed as JSON. -- `delete` (List of String) -- `edit` (List of String) -- `view` (List of String) - - - -### Nested Schema for `owners` - -Read-Only: - -- `org_id` (String) -- `user_id` (String) - - diff --git a/examples/data-sources/epilot-product_price/data-source.tf b/examples/data-sources/epilot-product_price/data-source.tf index b9363db..a138214 100644 --- a/examples/data-sources/epilot-product_price/data-source.tf +++ b/examples/data-sources/epilot-product_price/data-source.tf @@ -1,4 +1,4 @@ data "epilot-product_price" "my_price" { - hydrate = true - id = "123e4567-e89b-12d3-a456-426614174000" + hydrate = false + price_id = "123e4567-e89b-12d3-a456-426614174000" } \ No newline at end of file diff --git a/examples/data-sources/epilot-product_product/data-source.tf b/examples/data-sources/epilot-product_product/data-source.tf index c4fb92f..692cb8f 100644 --- a/examples/data-sources/epilot-product_product/data-source.tf +++ b/examples/data-sources/epilot-product_product/data-source.tf @@ -1,4 +1,4 @@ data "epilot-product_product" "my_product" { - hydrate = true - id = "123e4567-e89b-12d3-a456-426614174000" + hydrate = true + product_id = "123e4567-e89b-12d3-a456-426614174000" } \ No newline at end of file diff --git a/examples/data-sources/epilot-product_tax/data-source.tf b/examples/data-sources/epilot-product_tax/data-source.tf index 5fe8ea9..f6feb82 100644 --- a/examples/data-sources/epilot-product_tax/data-source.tf +++ b/examples/data-sources/epilot-product_tax/data-source.tf @@ -1,4 +1,4 @@ data "epilot-product_tax" "my_tax" { - hydrate = false - id = "123e4567-e89b-12d3-a456-426614174000" + hydrate = true + tax_id = "123e4567-e89b-12d3-a456-426614174000" } \ No newline at end of file diff --git a/examples/pricetest/res.tf b/examples/pricetest/res.tf new file mode 100644 index 0000000..5e665ab --- /dev/null +++ b/examples/pricetest/res.tf @@ -0,0 +1,27 @@ +resource "epilot-product_price" "my_price" { + +} + +terraform { + required_providers { + epilot-product = { + source = "epilot-dev/epilot-product" + version = "0.7.0" + } + } +} + +variable epilot_auth { + type = string +} + +variable server_url { + type = string +} + + +provider "epilot-product" { + # Configuration options + epilot_auth= var.epilot_auth + server_url= var.server_url +} \ No newline at end of file diff --git a/examples/provider/provider.tf b/examples/provider/provider.tf index 0532c47..fc9beb7 100644 --- a/examples/provider/provider.tf +++ b/examples/provider/provider.tf @@ -2,7 +2,7 @@ terraform { required_providers { epilot-product = { source = "epilot-dev/epilot-product" - version = "0.6.0" + version = "0.7.0" } } } diff --git a/examples/resources/epilot-product_price/import.sh b/examples/resources/epilot-product_price/import.sh new file mode 100644 index 0000000..c9cf333 --- /dev/null +++ b/examples/resources/epilot-product_price/import.sh @@ -0,0 +1 @@ +terraform import epilot-product_price.my_epilot-product_price "123e4567-e89b-12d3-a456-426614174000" diff --git a/examples/resources/epilot-product_price/provider.tf b/examples/resources/epilot-product_price/provider.tf deleted file mode 100644 index dbefaf8..0000000 --- a/examples/resources/epilot-product_price/provider.tf +++ /dev/null @@ -1,17 +0,0 @@ -terraform { - required_providers { - epilot-product = { - source = "epilot-dev/epilot-product" - version = "0.4.1" - } - } -} - -variable epilot_auth { - type = string -} - -provider "epilot-product" { - # Configuration options - epilot_auth = var.epilot_auth -} \ No newline at end of file diff --git a/examples/resources/epilot-product_price/resource.tf b/examples/resources/epilot-product_price/resource.tf index c60c84e..9b4fc79 100644 --- a/examples/resources/epilot-product_price/resource.tf +++ b/examples/resources/epilot-product_price/resource.tf @@ -9,14 +9,16 @@ resource "epilot-product_price" "my_price" { notice_time_amount = 2.66 notice_time_unit = "months" price_display_in_journeys = "show_as_starting_price" - pricing_model = "per_unit" - renewal_duration_amount = 66.53 - renewal_duration_unit = "months" + price_id = "123e4567-e89b-12d3-a456-426614174000" + pricing_model = "tiered_graduated" + renewal_duration_amount = 66.62 + renewal_duration_unit = "weeks" tax = "{ \"see\": \"documentation\" }" - termination_time_amount = 20 - termination_time_unit = "weeks" - type = "recurring" - unit_amount = 84.62 + termination_time_amount = 44.65 + termination_time_unit = "years" + type = "one_time" + unit = "...my_unit..." + unit_amount = 40.89 unit_amount_currency = "EUR" unit_amount_decimal = "...my_unit_amount_decimal..." variable_price = false diff --git a/examples/resources/epilot-product_product/import.sh b/examples/resources/epilot-product_product/import.sh new file mode 100644 index 0000000..34d83f0 --- /dev/null +++ b/examples/resources/epilot-product_product/import.sh @@ -0,0 +1 @@ +terraform import epilot-product_product.my_epilot-product_product "123e4567-e89b-12d3-a456-426614174000" diff --git a/examples/resources/epilot-product_product/provider.tf b/examples/resources/epilot-product_product/provider.tf deleted file mode 100644 index ccb88b9..0000000 --- a/examples/resources/epilot-product_product/provider.tf +++ /dev/null @@ -1,17 +0,0 @@ -terraform { - required_providers { - epilot-product = { - source = "epilot-dev/epilot-product" - version = "0.6.0" - } - } -} - -variable epilot_auth { - type = string -} - -provider "epilot-product" { - # Configuration options - epilot_auth = var.epilot_auth -} \ No newline at end of file diff --git a/examples/resources/epilot-product_product/resource.tf b/examples/resources/epilot-product_product/resource.tf index 9238110..870f5b0 100644 --- a/examples/resources/epilot-product_product/resource.tf +++ b/examples/resources/epilot-product_product/resource.tf @@ -3,8 +3,9 @@ resource "epilot-product_product" "my_product" { code = "...my_code..." description = "...my_description..." internal_name = "...my_internal_name..." - name = "Juan Morar Jr." + name = "Bradford Osinski" product_downloads = "{ \"see\": \"documentation\" }" product_images = "{ \"see\": \"documentation\" }" + product_id = "123e4567-e89b-12d3-a456-426614174000" type = "product" } \ No newline at end of file diff --git a/examples/resources/epilot-product_tax/import.sh b/examples/resources/epilot-product_tax/import.sh new file mode 100644 index 0000000..1549643 --- /dev/null +++ b/examples/resources/epilot-product_tax/import.sh @@ -0,0 +1 @@ +terraform import epilot-product_tax.my_epilot-product_tax "123e4567-e89b-12d3-a456-426614174000" diff --git a/examples/resources/epilot-product_tax/provider.tf b/examples/resources/epilot-product_tax/provider.tf deleted file mode 100644 index dbefaf8..0000000 --- a/examples/resources/epilot-product_tax/provider.tf +++ /dev/null @@ -1,17 +0,0 @@ -terraform { - required_providers { - epilot-product = { - source = "epilot-dev/epilot-product" - version = "0.4.1" - } - } -} - -variable epilot_auth { - type = string -} - -provider "epilot-product" { - # Configuration options - epilot_auth = var.epilot_auth -} \ No newline at end of file diff --git a/examples/resources/epilot-product_tax/resource.tf b/examples/resources/epilot-product_tax/resource.tf index 020aace..f632345 100644 --- a/examples/resources/epilot-product_tax/resource.tf +++ b/examples/resources/epilot-product_tax/resource.tf @@ -1,7 +1,8 @@ resource "epilot-product_tax" "my_tax" { - active = true + active = false description = "...my_description..." rate = "...my_rate..." region = "AT" + tax_id = "123e4567-e89b-12d3-a456-426614174000" type = "VAT" } \ No newline at end of file diff --git a/examples/test/bla.tf b/examples/test/bla.tf deleted file mode 100644 index 567713f..0000000 --- a/examples/test/bla.tf +++ /dev/null @@ -1,41 +0,0 @@ -terraform { - required_providers { - # epilot-journey = { - # source = "epilot-dev/epilot-journey" - # version = "0.3.0" - # } - epilot-product = { - source = "epilot-dev/epilot-product" - version = "0.6.0" - } - } -} - -variable "epilot_auth" { - type = string -} - -# provider "epilot-journey" { -# # Configuration options -# epilot_auth = var.epilot_auth -# } - -provider "epilot-product" { - # Configuration options - epilot_auth = var.epilot_auth -} - -# import { -# to = epilot-product_product.s_product -# id = "103f1186-7f7c-42d1-8891-00868a589cf3" -# # } - - -# resource "epilot-product_product" "s_product" { -# } - - - -# resource "epilot-product_tax" "s_tax" { -# # (resource arguments) -# } \ No newline at end of file diff --git a/examples/test/main.tf b/examples/test/main.tf deleted file mode 100644 index f12ee28..0000000 --- a/examples/test/main.tf +++ /dev/null @@ -1,36 +0,0 @@ -# # epilot-product_product.s_product: -# resource "epilot-product_product" "s_product" { -# acl = { -# delete = [ -# "org_66", -# ] -# edit = [ -# "org_66", -# ] -# view = [ -# "org_66", -# ] -# } -# active = true -# created_at = "2024-02-07T14:44:33.799Z" -# id = "103f1186-7f7c-42d1-8891-00868a589cf3" -# name = "Product PH - Heating" -# org = "66" -# owners = [ -# { -# org_id = "66" -# user_id = "77701" -# }, -# ] -# price_options = { -# dollar_relation = [ -# { -# entity_id = "cbcf02eb-bfca-4317-912b-7f4db997a739" -# }, -# ] -# } -# schema = "product" -# title = "Product PH - Heating" -# type = "product" -# updated_at = "2024-02-07T14:44:33.799Z" -# } diff --git a/examples/test/resource.tf b/examples/test/resource.tf deleted file mode 100644 index 50bfdb5..0000000 --- a/examples/test/resource.tf +++ /dev/null @@ -1,22 +0,0 @@ -# epilot-product_product.s_product: -resource "epilot-product_product" "s_product" { - active = true - internal_name = "Price testing" - name = "Night storage heating tariff" - price_options = { - dollar_relation = [ - { - entity_id = "f6194ac9-eb96-49e3-a21a-9ee9d19420b9" - }, - ] - } - type = "product" -} - -# epilot-product_tax.s_tax: -resource "epilot-product_tax" "s_tax" { - active = true - rate = "0" - region = "DE" - type = "VAT" -} diff --git a/gen.yaml b/gen.yaml index 71a8500..b8466e1 100644 --- a/gen.yaml +++ b/gen.yaml @@ -5,6 +5,10 @@ generation: optionalPropertyRendering: withExample fixes: nameResolutionDec2023: false + parameterOrderingFeb2024: false + requestResponseComponentNamesFeb2024: false + auth: + oAuth2ClientCredentialsEnabled: false telemetryEnabled: false go: version: 0.0.1 @@ -23,8 +27,13 @@ go: outputModelSuffix: output packageName: openapi terraform: - version: 0.6.0 + version: 0.7.0 + additionalDataSources: [] + additionalDependencies: {} + additionalResources: [] + allowUnknownFieldsInWeakUnions: false author: epilot-dev + environmentVariables: [] imports: option: openapi paths: diff --git a/go.mod b/go.mod index 43edc04..15452ae 100644 --- a/go.mod +++ b/go.mod @@ -1,13 +1,16 @@ module github.com/epilot-dev/terraform-provider-epilot-product -go 1.18 +go 1.21 + +toolchain go1.21.6 require ( github.com/cenkalti/backoff/v4 v4.2.0 github.com/ericlagergren/decimal v0.0.0-20221120152707-495c53812d05 - github.com/hashicorp/terraform-plugin-framework v1.3.5 - github.com/hashicorp/terraform-plugin-go v0.18.0 - github.com/spyzhov/ajson v0.9.0 + github.com/hashicorp/terraform-plugin-docs v0.13.0 + github.com/hashicorp/terraform-plugin-framework v1.7.0 + github.com/hashicorp/terraform-plugin-framework-validators v0.10.0 + github.com/hashicorp/terraform-plugin-go v0.22.1 ) require ( @@ -19,21 +22,22 @@ require ( github.com/bgentry/speakeasy v0.1.0 // indirect github.com/fatih/color v1.13.0 // indirect github.com/golang/protobuf v1.5.3 // indirect - github.com/google/uuid v1.3.0 // indirect + github.com/google/uuid v1.6.0 // indirect github.com/hashicorp/errwrap v1.1.0 // indirect github.com/hashicorp/go-checkpoint v0.5.0 // indirect github.com/hashicorp/go-cleanhttp v0.5.2 // indirect github.com/hashicorp/go-hclog v1.5.0 // indirect github.com/hashicorp/go-multierror v1.1.1 // indirect - github.com/hashicorp/go-plugin v1.4.10 // indirect + github.com/hashicorp/go-plugin v1.6.0 // indirect github.com/hashicorp/go-uuid v1.0.3 // indirect github.com/hashicorp/go-version v1.6.0 // indirect github.com/hashicorp/hc-install v0.4.0 // indirect github.com/hashicorp/terraform-exec v0.17.2 // indirect github.com/hashicorp/terraform-json v0.14.0 // indirect github.com/hashicorp/terraform-plugin-log v0.9.0 // indirect - github.com/hashicorp/terraform-registry-address v0.2.1 // indirect + github.com/hashicorp/terraform-registry-address v0.2.3 // indirect github.com/hashicorp/terraform-svchost v0.1.1 // indirect + github.com/hashicorp/yamux v0.1.1 // indirect github.com/huandu/xstrings v1.3.2 // indirect github.com/imdario/mergo v0.3.13 // indirect github.com/mattn/go-colorable v0.1.12 // indirect @@ -47,20 +51,14 @@ require ( github.com/russross/blackfriday v1.6.0 // indirect github.com/shopspring/decimal v1.3.1 // indirect github.com/spf13/cast v1.5.0 // indirect - github.com/vmihailenco/msgpack/v5 v5.3.5 // indirect + github.com/vmihailenco/msgpack/v5 v5.4.1 // indirect github.com/vmihailenco/tagparser/v2 v2.0.0 // indirect github.com/zclconf/go-cty v1.13.1 // indirect - golang.org/x/crypto v0.10.0 // indirect - golang.org/x/net v0.11.0 // indirect - golang.org/x/sys v0.9.0 // indirect - golang.org/x/text v0.10.0 // indirect - google.golang.org/grpc v1.56.1 // indirect - google.golang.org/protobuf v1.31.0 // indirect -) - -require ( - github.com/hashicorp/terraform-plugin-docs v0.13.0 - github.com/hashicorp/terraform-plugin-framework-validators v0.10.0 - github.com/hashicorp/yamux v0.0.0-20181012175058-2f1d1f20f75d // indirect - google.golang.org/genproto v0.0.0-20230410155749-daa745c078e1 // indirect + golang.org/x/crypto v0.18.0 // indirect + golang.org/x/net v0.20.0 // indirect + golang.org/x/sys v0.16.0 // indirect + golang.org/x/text v0.14.0 // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20240123012728-ef4313101c80 // indirect + google.golang.org/grpc v1.62.1 // indirect + google.golang.org/protobuf v1.33.0 // indirect ) diff --git a/go.sum b/go.sum index 853448b..417aa41 100644 --- a/go.sum +++ b/go.sum @@ -23,6 +23,8 @@ github.com/armon/go-radix v1.0.0/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgI github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5/go.mod h1:wHh0iHkYZB8zMSxRWpUBQtwG5a7fFgvEO+odwuTv2gs= github.com/bgentry/speakeasy v0.1.0 h1:ByYyxL9InA1OWqxJqqp2A5pYHUrCiAL6K3J+LKSsQkY= github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs= +github.com/bufbuild/protocompile v0.4.0 h1:LbFKd2XowZvQ/kajzguUp2DC9UEIQhIq77fZZlaQsNA= +github.com/bufbuild/protocompile v0.4.0/go.mod h1:3v93+mbWn/v3xzN+31nwkJfrEpAUwp+BagBSZWx+TP8= github.com/cenkalti/backoff/v4 v4.2.0 h1:HN5dHm3WBOgndBH6E8V0q2jIYIR3s9yglV8k/+MN3u4= github.com/cenkalti/backoff/v4 v4.2.0/go.mod h1:Y3VNntkOUPxTVeUxJ/G5vcM//AlwfmyYozVcomhLiZE= github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= @@ -38,6 +40,7 @@ github.com/fatih/color v1.13.0 h1:8LOYc1KYPPmyKMuN8QV2DNRWNbLo6LZ0iLs8+mlH53w= github.com/fatih/color v1.13.0/go.mod h1:kLAiJbzzSOZDVNGyDpeOxJ47H46qBXwg5ILebYFFOfk= github.com/flynn/go-shlex v0.0.0-20150515145356-3f9db97f8568/go.mod h1:xEzjJPgXI435gkrCt3MPfRiAkVrwSbHsst4LCFVfpJc= github.com/frankban/quicktest v1.14.3 h1:FJKSZTDHjyhriyC81FLQ0LY93eSai0ZyR/ZIkd3ZUKE= +github.com/frankban/quicktest v1.14.3/go.mod h1:mgiwOwqx65TmIk1wJ6Q7wvnVMocbUorkibMOrVTHZps= github.com/gliderlabs/ssh v0.2.2/go.mod h1:U7qILu1NlMHj9FlMhZLlkCdDnU1DBEAqr0aevW3Awn0= github.com/go-git/gcfg v1.5.0 h1:Q5ViNfGF8zFgyJWPqYwA7qGFoMTEiBmdlkcfRmpIMa4= github.com/go-git/gcfg v1.5.0/go.mod h1:5m20vg6GwYabIxaOonVkTdrILxQMpEShl1xiMF4ua+E= @@ -57,11 +60,12 @@ github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMyw github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.8/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= -github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= +github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= +github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I= -github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= +github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= github.com/hashicorp/errwrap v1.1.0 h1:OxrOeh75EUXMY8TBjag2fzXGZ40LB6IKw45YeGUDY2I= github.com/hashicorp/errwrap v1.1.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= @@ -75,8 +79,8 @@ github.com/hashicorp/go-hclog v1.5.0/go.mod h1:W4Qnvbt70Wk/zYJryRzDRU/4r0kIg0PVH github.com/hashicorp/go-multierror v1.0.0/go.mod h1:dHtQlpGsu+cZNNAkkCN/P3hoUDHhCYQXV3UM06sGGrk= github.com/hashicorp/go-multierror v1.1.1 h1:H5DkEtf6CXdFp0N0Em5UCwQpXMWke8IA0+lD48awMYo= github.com/hashicorp/go-multierror v1.1.1/go.mod h1:iw975J/qwKPdAO1clOe2L8331t/9/fmwbPZ6JB6eMoM= -github.com/hashicorp/go-plugin v1.4.10 h1:xUbmA4jC6Dq163/fWcp8P3JuHilrHHMLNRxzGQJ9hNk= -github.com/hashicorp/go-plugin v1.4.10/go.mod h1:6/1TEzT0eQznvI/gV2CM29DLSkAK/e58mUWKVsPaph0= +github.com/hashicorp/go-plugin v1.6.0 h1:wgd4KxHJTVGGqWBq4QPB1i5BZNEx9BR8+OFmHDmTk8A= +github.com/hashicorp/go-plugin v1.6.0/go.mod h1:lBS5MtSSBZk0SHc66KACcjjlU6WzEVP/8pwz68aMkCI= github.com/hashicorp/go-uuid v1.0.0/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= github.com/hashicorp/go-uuid v1.0.3 h1:2gKiV6YVmrJ1i2CKKa9obLvRieoRGviZFL26PcT/Co8= github.com/hashicorp/go-uuid v1.0.3/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= @@ -91,20 +95,20 @@ github.com/hashicorp/terraform-json v0.14.0 h1:sh9iZ1Y8IFJLx+xQiKHGud6/TSUCM0N8e github.com/hashicorp/terraform-json v0.14.0/go.mod h1:5A9HIWPkk4e5aeeXIBbkcOvaZbIYnAIkEyqP2pNSckM= github.com/hashicorp/terraform-plugin-docs v0.13.0 h1:6e+VIWsVGb6jYJewfzq2ok2smPzZrt1Wlm9koLeKazY= github.com/hashicorp/terraform-plugin-docs v0.13.0/go.mod h1:W0oCmHAjIlTHBbvtppWHe8fLfZ2BznQbuv8+UD8OucQ= -github.com/hashicorp/terraform-plugin-framework v1.3.5 h1:FJ6s3CVWVAxlhiF/jhy6hzs4AnPHiflsp9KgzTGl1wo= -github.com/hashicorp/terraform-plugin-framework v1.3.5/go.mod h1:2gGDpWiTI0irr9NSTLFAKlTi6KwGti3AoU19rFqU30o= +github.com/hashicorp/terraform-plugin-framework v1.7.0 h1:wOULbVmfONnJo9iq7/q+iBOBJul5vRovaYJIu2cY/Pw= +github.com/hashicorp/terraform-plugin-framework v1.7.0/go.mod h1:jY9Id+3KbZ17OMpulgnWLSfwxNVYSoYBQFTgsx044CI= github.com/hashicorp/terraform-plugin-framework-validators v0.10.0 h1:4L0tmy/8esP6OcvocVymw52lY0HyQ5OxB7VNl7k4bS0= github.com/hashicorp/terraform-plugin-framework-validators v0.10.0/go.mod h1:qdQJCdimB9JeX2YwOpItEu+IrfoJjWQ5PhLpAOMDQAE= -github.com/hashicorp/terraform-plugin-go v0.18.0 h1:IwTkOS9cOW1ehLd/rG0y+u/TGLK9y6fGoBjXVUquzpE= -github.com/hashicorp/terraform-plugin-go v0.18.0/go.mod h1:l7VK+2u5Kf2y+A+742GX0ouLut3gttudmvMgN0PA74Y= +github.com/hashicorp/terraform-plugin-go v0.22.1 h1:iTS7WHNVrn7uhe3cojtvWWn83cm2Z6ryIUDTRO0EV7w= +github.com/hashicorp/terraform-plugin-go v0.22.1/go.mod h1:qrjnqRghvQ6KnDbB12XeZ4FluclYwptntoWCr9QaXTI= github.com/hashicorp/terraform-plugin-log v0.9.0 h1:i7hOA+vdAItN1/7UrfBqBwvYPQ9TFvymaRGZED3FCV0= github.com/hashicorp/terraform-plugin-log v0.9.0/go.mod h1:rKL8egZQ/eXSyDqzLUuwUYLVdlYeamldAHSxjUFADow= -github.com/hashicorp/terraform-registry-address v0.2.1 h1:QuTf6oJ1+WSflJw6WYOHhLgwUiQ0FrROpHPYFtwTYWM= -github.com/hashicorp/terraform-registry-address v0.2.1/go.mod h1:BSE9fIFzp0qWsJUUyGquo4ldV9k2n+psif6NYkBRS3Y= +github.com/hashicorp/terraform-registry-address v0.2.3 h1:2TAiKJ1A3MAkZlH1YI/aTVcLZRu7JseiXNRHbOAyoTI= +github.com/hashicorp/terraform-registry-address v0.2.3/go.mod h1:lFHA76T8jfQteVfT7caREqguFrW3c4MFSPhZB7HHgUM= github.com/hashicorp/terraform-svchost v0.1.1 h1:EZZimZ1GxdqFRinZ1tpJwVxxt49xc/S52uzrw4x0jKQ= github.com/hashicorp/terraform-svchost v0.1.1/go.mod h1:mNsjQfZyf/Jhz35v6/0LWcv26+X7JPS+buii2c9/ctc= -github.com/hashicorp/yamux v0.0.0-20181012175058-2f1d1f20f75d h1:kJCB4vdITiW1eC1vq2e6IsrXKrZit1bv/TDYFGMp4BQ= -github.com/hashicorp/yamux v0.0.0-20181012175058-2f1d1f20f75d/go.mod h1:+NfK9FKeTrX5uv1uIXGdwYDTeHna2qgaIlx54MXqjAM= +github.com/hashicorp/yamux v0.1.1 h1:yrQxtgseBDrq9Y652vSRDvsKCJKOUD+GzTS4Y0Y8pvE= +github.com/hashicorp/yamux v0.1.1/go.mod h1:CtWFDAQgb7dxtzFs4tWbplKIe2jSi3+5vKbgIO0SLnQ= github.com/huandu/xstrings v1.3.1/go.mod h1:y5/lhBue+AyNmUVz9RLU9xbLR0o4KIIExikq4ovT0aE= github.com/huandu/xstrings v1.3.2 h1:L18LIDzqlW6xN2rEkpdV8+oL/IXWJ1APd+vsdYy4Wdw= github.com/huandu/xstrings v1.3.2/go.mod h1:y5/lhBue+AyNmUVz9RLU9xbLR0o4KIIExikq4ovT0aE= @@ -115,13 +119,15 @@ github.com/imdario/mergo v0.3.13/go.mod h1:4lJ1jqUDcsbIECGy0RUJAXNIhg+6ocWgb1ALK github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 h1:BQSFePA1RWJOlocH6Fxy8MmwDt+yVQYULKfN0RoTN8A= github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99/go.mod h1:1lJo3i6rXxKeerYnT8Nvf0QmHCRC1n8sfWVwXF2Frvo= github.com/jessevdk/go-flags v1.5.0/go.mod h1:Fw0T6WPc1dYxT4mKEZRfG5kJhaTDP9pj1c2EWnYs/m4= -github.com/jhump/protoreflect v1.6.0 h1:h5jfMVslIg6l29nsMs0D8Wj17RDVdNYti0vDN/PZZoE= +github.com/jhump/protoreflect v1.15.1 h1:HUMERORf3I3ZdX05WaQ6MIpd/NJ434hTp5YiKgfCL6c= +github.com/jhump/protoreflect v1.15.1/go.mod h1:jD/2GMKKE6OqX8qTjhADU1e6DShO+gavG9e0Q693nKo= github.com/kevinburke/ssh_config v0.0.0-20201106050909-4977a11b4351 h1:DowS9hvgyYSX4TO5NpyC606/Z4SxnNYbT+WX27or6Ck= github.com/kevinburke/ssh_config v0.0.0-20201106050909-4977a11b4351/go.mod h1:CT57kijsi8u/K/BOFA39wgDQJ9CxiF4nAY/ojJ6r6mM= github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= github.com/kr/pretty v0.3.0 h1:WgNl7dwNpEZ6jJ9k1snq4pZsg7DOEN8hP9Xw0Tsjwk0= +github.com/kr/pretty v0.3.0/go.mod h1:640gp4NfQd8pI5XOwp5fnNeVWj67G7CFk/SaSQn7NBk= github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= @@ -159,11 +165,13 @@ github.com/posener/complete v1.1.1/go.mod h1:em0nMJCgc9GFtwrmVmEMR/ZL6WyhyjMBndr github.com/posener/complete v1.2.3 h1:NP0eAhjcjImqslEwo/1hq7gpajME0fTLTezBKDqfXqo= github.com/posener/complete v1.2.3/go.mod h1:WZIdtGGp+qx0sLrYKtIRAruyNpv6hFCicSgv7Sy7s/s= github.com/rogpeppe/go-internal v1.6.1 h1:/FiVV8dS/e+YqF2JvO3yXRFbBLTIuSDkuC7aBOAvL+k= +github.com/rogpeppe/go-internal v1.6.1/go.mod h1:xXDCJY+GAPziupqXw64V24skbSoqbTEfhy4qGm1nDQc= github.com/russross/blackfriday v1.6.0 h1:KqfZb0pUVN2lYqZUYRddxF4OR8ZMURnJIG5Y3VRLtww= github.com/russross/blackfriday v1.6.0/go.mod h1:ti0ldHuxg49ri4ksnFxlkCfN+hvslNlmVHqNRXXJNAY= github.com/sebdah/goldie v1.0.0/go.mod h1:jXP4hmWywNEwZzhMuv2ccnqTSFpuq8iyQhtQdkkZBH4= github.com/sergi/go-diff v1.1.0/go.mod h1:STckp+ISIX8hZLjrqAeVduY0gWCT9IjLuqbuNXdaHfM= github.com/sergi/go-diff v1.2.0 h1:XU+rvMAioB0UC3q1MFrIQy4Vo5/4VsRDQQXHsEya6xQ= +github.com/sergi/go-diff v1.2.0/go.mod h1:STckp+ISIX8hZLjrqAeVduY0gWCT9IjLuqbuNXdaHfM= github.com/shopspring/decimal v1.2.0/go.mod h1:DKyhrW/HYNuLGql+MJL6WCR6knT2jwCFRcu2hWCYk4o= github.com/shopspring/decimal v1.3.1 h1:2Usl1nmF/WZucqkFZhnfFYxxxu8LG21F6nPQBE5gKV8= github.com/shopspring/decimal v1.3.1/go.mod h1:DKyhrW/HYNuLGql+MJL6WCR6knT2jwCFRcu2hWCYk4o= @@ -171,8 +179,6 @@ github.com/sirupsen/logrus v1.4.1/go.mod h1:ni0Sbl8bgC9z8RoU9G6nDWqqs/fq4eDPysMB github.com/spf13/cast v1.3.1/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE= github.com/spf13/cast v1.5.0 h1:rj3WzYc11XZaIZMPKmwP96zkFEnnAmV8s6XbB2aY32w= github.com/spf13/cast v1.5.0/go.mod h1:SpXXQ5YoyJw6s3/6cMTQuxvgRl3PCJiyaX9p6b155UU= -github.com/spyzhov/ajson v0.9.0 h1:tF46gJGOenYVj+k9K1U1XpCxVWhmiyY5PsVCAs1+OJ0= -github.com/spyzhov/ajson v0.9.0/go.mod h1:a6oSw0MMb7Z5aD2tPoPO+jq11ETKgXUr2XktHdT8Wt8= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= @@ -185,8 +191,8 @@ github.com/stretchr/testify v1.7.2 h1:4jaiDzPyXQvSd7D0EjG45355tLlV3VOECpq10pLC+8 github.com/stretchr/testify v1.7.2/go.mod h1:R6va5+xMeoiuVRoj+gSkQ7d3FALtqAAGI1FQKckRals= github.com/vmihailenco/msgpack v3.3.3+incompatible/go.mod h1:fy3FlTQTDXWkZ7Bh6AcGMlsjHatGryHQYUTf1ShIgkk= github.com/vmihailenco/msgpack/v4 v4.3.12/go.mod h1:gborTTJjAo/GWTqqRjrLCn9pgNN+NXzzngzBKDPIqw4= -github.com/vmihailenco/msgpack/v5 v5.3.5 h1:5gO0H1iULLWGhs2H5tbAHIZTV8/cYafcFOr9znI5mJU= -github.com/vmihailenco/msgpack/v5 v5.3.5/go.mod h1:7xyJ9e+0+9SaZT0Wt1RGleJXzli6Q/V5KbhBonMG9jc= +github.com/vmihailenco/msgpack/v5 v5.4.1 h1:cQriyiUvjTwOHg8QZaPihLWeRAAVoCpE00IUPn0Bjt8= +github.com/vmihailenco/msgpack/v5 v5.4.1/go.mod h1:GaZTsDaehaPpQVyxrf5mtQlH+pc21PIudVV/E3rRQok= github.com/vmihailenco/tagparser v0.1.1/go.mod h1:OeAg3pn3UbLjkWt+rN9oFYB6u/cQgqMEUPoW2WPyhdI= github.com/vmihailenco/tagparser/v2 v2.0.0 h1:y09buUbR+b5aycVFQs/g70pqKVZNBmxwAhO7/IwNM9g= github.com/vmihailenco/tagparser/v2 v2.0.0/go.mod h1:Wri+At7QHww0WTrCBeu4J6bNtoV6mEfg5OIWRZA9qds= @@ -204,16 +210,16 @@ golang.org/x/crypto v0.0.0-20200820211705-5c72a883971a/go.mod h1:LzIPMQfyMNhhGPh golang.org/x/crypto v0.0.0-20210322153248-0c34fe9e7dc2/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4= golang.org/x/crypto v0.0.0-20210421170649-83a5a9bb288b/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4= golang.org/x/crypto v0.0.0-20210616213533-5ff15b29337e/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= -golang.org/x/crypto v0.10.0 h1:LKqV2xt9+kDzSTfOhx4FrkEBcMrAgHSYgzywV9zcGmM= -golang.org/x/crypto v0.10.0/go.mod h1:o4eNf7Ede1fv+hwOwZsTHl9EsPFO6q6ZvYR8vYfY45I= +golang.org/x/crypto v0.18.0 h1:PGVlW0xEltQnzFZ55hkuX5+KLyrMYhHld1YHO4AKcdc= +golang.org/x/crypto v0.18.0/go.mod h1:R0j02AL6hcrfOiy9T4ZYp/rcWeMxM3L6QYxlOuEG1mg= golang.org/x/net v0.0.0-20180811021610-c39426892332/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks= golang.org/x/net v0.0.0-20200301022130-244492dfa37a/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20210326060303-6b1517762897/go.mod h1:uSPa2vr4CLtc/ILN5odXGNXS6mhrKVzTaCXzk9m6W3k= -golang.org/x/net v0.11.0 h1:Gi2tvZIJyBtO9SDr1q9h5hEQCp/4L2RQ+ar0qjx2oNU= -golang.org/x/net v0.11.0/go.mod h1:2L/ixqYpgIVXmeoSA/4Lu7BzTG4KIyPIryS4IsOd1oQ= +golang.org/x/net v0.20.0 h1:aCL9BSgETF1k+blQaYUBx9hJ9LOGP3gAVemcZlf1Kpo= +golang.org/x/net v0.20.0/go.mod h1:z8BVo6PvndSri0LbOE3hAn0apkU+1YvI6E70E9jsnvY= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= @@ -231,27 +237,27 @@ golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210927094055-39ccf1dd6fa6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220503163025-988cb79eb6c6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.9.0 h1:KS/R3tvhPqvJvwcKfnBHJwwthS11LRhmM5D59eEXa0s= -golang.org/x/sys v0.9.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.16.0 h1:xWw16ngr6ZMtmxDyKyIgsE93KNKz5HKmMa3b8ALHidU= +golang.org/x/sys v0.16.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.10.0 h1:UpjohKhiEgNc0CSauXmwYftY1+LlaC75SJwh0SgCX58= -golang.org/x/text v0.10.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= +golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ= +golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= google.golang.org/appengine v1.6.5/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= -google.golang.org/genproto v0.0.0-20230410155749-daa745c078e1 h1:KpwkzHKEF7B9Zxg18WzOa7djJ+Ha5DzthMyZYQfEn2A= -google.golang.org/genproto v0.0.0-20230410155749-daa745c078e1/go.mod h1:nKE/iIaLqn2bQwXBg8f1g2Ylh6r5MN5CmZvuzZCgsCU= -google.golang.org/grpc v1.56.1 h1:z0dNfjIl0VpaZ9iSVjA6daGatAYwPGstTjt5vkRMFkQ= -google.golang.org/grpc v1.56.1/go.mod h1:I9bI3vqKfayGqPUAwGdOSu7kt6oIJLixfffKrpXqQ9s= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240123012728-ef4313101c80 h1:AjyfHzEPEFp/NpvfN5g+KDla3EMojjhRVZc1i7cj+oM= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240123012728-ef4313101c80/go.mod h1:PAREbraiVEVGVdTZsVWjSbbTtSyGbAgIIvni8a8CD5s= +google.golang.org/grpc v1.62.1 h1:B4n+nfKzOICUXMgyrNd19h/I9oH0L1pizfk1d4zSgTk= +google.golang.org/grpc v1.62.1/go.mod h1:IWTG0VlJLCh1SkC58F7np9ka9mx/WNkjl4PGJaiq+QE= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= -google.golang.org/protobuf v1.31.0 h1:g0LDEJHgrBl9N9r17Ru3sqWhkIx2NB67okBHPwC7hs8= -google.golang.org/protobuf v1.31.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= +google.golang.org/protobuf v1.33.0 h1:uNO2rsAINq/JlFpSdYEKIZ0uKD/R9cpdv0T+yoGwGmI= +google.golang.org/protobuf v1.33.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= diff --git a/internal/planmodifiers/boolplanmodifier/suppress_diff.go b/internal/planmodifiers/boolplanmodifier/suppress_diff.go index 5ec8f96..da0d9e8 100644 --- a/internal/planmodifiers/boolplanmodifier/suppress_diff.go +++ b/internal/planmodifiers/boolplanmodifier/suppress_diff.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasyapi.com). DO NOT EDIT. package boolplanmodifier diff --git a/internal/planmodifiers/float64planmodifier/suppress_diff.go b/internal/planmodifiers/float64planmodifier/suppress_diff.go index b623b4f..ecde6f3 100644 --- a/internal/planmodifiers/float64planmodifier/suppress_diff.go +++ b/internal/planmodifiers/float64planmodifier/suppress_diff.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasyapi.com). DO NOT EDIT. package float64planmodifier diff --git a/internal/planmodifiers/int64planmodifier/suppress_diff.go b/internal/planmodifiers/int64planmodifier/suppress_diff.go index 7d838b3..99b75a0 100644 --- a/internal/planmodifiers/int64planmodifier/suppress_diff.go +++ b/internal/planmodifiers/int64planmodifier/suppress_diff.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasyapi.com). DO NOT EDIT. package int64planmodifier diff --git a/internal/planmodifiers/listplanmodifier/suppress_diff.go b/internal/planmodifiers/listplanmodifier/suppress_diff.go index a2e64ba..deb664c 100644 --- a/internal/planmodifiers/listplanmodifier/suppress_diff.go +++ b/internal/planmodifiers/listplanmodifier/suppress_diff.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasyapi.com). DO NOT EDIT. package listplanmodifier diff --git a/internal/planmodifiers/mapplanmodifier/suppress_diff.go b/internal/planmodifiers/mapplanmodifier/suppress_diff.go index 3a693d7..6924e50 100644 --- a/internal/planmodifiers/mapplanmodifier/suppress_diff.go +++ b/internal/planmodifiers/mapplanmodifier/suppress_diff.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasyapi.com). DO NOT EDIT. package mapplanmodifier diff --git a/internal/planmodifiers/numberplanmodifier/suppress_diff.go b/internal/planmodifiers/numberplanmodifier/suppress_diff.go index add1829..d9b832a 100644 --- a/internal/planmodifiers/numberplanmodifier/suppress_diff.go +++ b/internal/planmodifiers/numberplanmodifier/suppress_diff.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasyapi.com). DO NOT EDIT. package numberplanmodifier diff --git a/internal/planmodifiers/objectplanmodifier/suppress_diff.go b/internal/planmodifiers/objectplanmodifier/suppress_diff.go index 4075dd0..73bd635 100644 --- a/internal/planmodifiers/objectplanmodifier/suppress_diff.go +++ b/internal/planmodifiers/objectplanmodifier/suppress_diff.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasyapi.com). DO NOT EDIT. package objectplanmodifier diff --git a/internal/planmodifiers/setplanmodifier/suppress_diff.go b/internal/planmodifiers/setplanmodifier/suppress_diff.go index 32e1174..fd2c2c8 100644 --- a/internal/planmodifiers/setplanmodifier/suppress_diff.go +++ b/internal/planmodifiers/setplanmodifier/suppress_diff.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasyapi.com). DO NOT EDIT. package setplanmodifier diff --git a/internal/planmodifiers/stringplanmodifier/suppress_diff.go b/internal/planmodifiers/stringplanmodifier/suppress_diff.go index 360583d..4bcfdff 100644 --- a/internal/planmodifiers/stringplanmodifier/suppress_diff.go +++ b/internal/planmodifiers/stringplanmodifier/suppress_diff.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasyapi.com). DO NOT EDIT. package stringplanmodifier diff --git a/internal/planmodifiers/utils/state_check.go b/internal/planmodifiers/utils/state_check.go index 66d9150..6b126bf 100644 --- a/internal/planmodifiers/utils/state_check.go +++ b/internal/planmodifiers/utils/state_check.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasyapi.com). DO NOT EDIT. package utils diff --git a/internal/provider/price_data_source.go b/internal/provider/price_data_source.go index ab5bc4f..e8282cb 100644 --- a/internal/provider/price_data_source.go +++ b/internal/provider/price_data_source.go @@ -1,12 +1,13 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasyapi.com). DO NOT EDIT. package provider import ( "context" "fmt" + tfTypes "github.com/epilot-dev/terraform-provider-epilot-product/internal/provider/types" "github.com/epilot-dev/terraform-provider-epilot-product/internal/sdk" - "github.com/epilot-dev/terraform-provider-epilot-product/internal/sdk/pkg/models/operations" + "github.com/epilot-dev/terraform-provider-epilot-product/internal/sdk/models/operations" "github.com/hashicorp/terraform-plugin-framework/datasource" "github.com/hashicorp/terraform-plugin-framework/datasource/schema" "github.com/hashicorp/terraform-plugin-framework/types" @@ -28,31 +29,32 @@ type PriceDataSource struct { // PriceDataSourceModel describes the data model. type PriceDataSourceModel struct { - Active types.Bool `tfsdk:"active"` - BillingDurationAmount types.Number `tfsdk:"billing_duration_amount"` - BillingDurationUnit types.String `tfsdk:"billing_duration_unit"` - Description types.String `tfsdk:"description"` - Hydrate types.Bool `tfsdk:"hydrate"` - ID types.String `tfsdk:"id"` - IsCompositePrice types.Bool `tfsdk:"is_composite_price"` - IsTaxInclusive types.Bool `tfsdk:"is_tax_inclusive"` - LongDescription types.String `tfsdk:"long_description"` - NoticeTimeAmount types.Number `tfsdk:"notice_time_amount"` - NoticeTimeUnit types.String `tfsdk:"notice_time_unit"` - PriceDisplayInJourneys types.String `tfsdk:"price_display_in_journeys"` - PricingModel types.String `tfsdk:"pricing_model"` - RenewalDurationAmount types.Number `tfsdk:"renewal_duration_amount"` - RenewalDurationUnit types.String `tfsdk:"renewal_duration_unit"` - Tax types.String `tfsdk:"tax"` - TerminationTimeAmount types.Number `tfsdk:"termination_time_amount"` - TerminationTimeUnit types.String `tfsdk:"termination_time_unit"` - Tiers []PriceTier `tfsdk:"tiers"` - Type types.String `tfsdk:"type"` - Unit *PriceCreateUnit `tfsdk:"unit"` - UnitAmount types.Number `tfsdk:"unit_amount"` - UnitAmountCurrency types.String `tfsdk:"unit_amount_currency"` - UnitAmountDecimal types.String `tfsdk:"unit_amount_decimal"` - VariablePrice types.Bool `tfsdk:"variable_price"` + Active types.Bool `tfsdk:"active"` + BillingDurationAmount types.Number `tfsdk:"billing_duration_amount"` + BillingDurationUnit types.String `tfsdk:"billing_duration_unit"` + Description types.String `tfsdk:"description"` + Hydrate types.Bool `tfsdk:"hydrate"` + ID types.String `tfsdk:"id"` + IsCompositePrice types.Bool `tfsdk:"is_composite_price"` + IsTaxInclusive types.Bool `tfsdk:"is_tax_inclusive"` + LongDescription types.String `tfsdk:"long_description"` + NoticeTimeAmount types.Number `tfsdk:"notice_time_amount"` + NoticeTimeUnit types.String `tfsdk:"notice_time_unit"` + PriceComponents *tfTypes.PriceCreatePriceComponents `tfsdk:"price_components"` + PriceDisplayInJourneys types.String `tfsdk:"price_display_in_journeys"` + PricingModel types.String `tfsdk:"pricing_model"` + RenewalDurationAmount types.Number `tfsdk:"renewal_duration_amount"` + RenewalDurationUnit types.String `tfsdk:"renewal_duration_unit"` + Tax types.String `tfsdk:"tax"` + TerminationTimeAmount types.Number `tfsdk:"termination_time_amount"` + TerminationTimeUnit types.String `tfsdk:"termination_time_unit"` + Tiers []tfTypes.PriceTier `tfsdk:"tiers"` + Type types.String `tfsdk:"type"` + Unit types.String `tfsdk:"unit"` + UnitAmount types.Number `tfsdk:"unit_amount"` + UnitAmountCurrency types.String `tfsdk:"unit_amount_currency"` + UnitAmountDecimal types.String `tfsdk:"unit_amount_decimal"` + VariablePrice types.Bool `tfsdk:"variable_price"` } // Metadata returns the data source type name. @@ -87,8 +89,7 @@ func (r *PriceDataSource) Schema(ctx context.Context, req datasource.SchemaReque Description: `Hydrates entities in relations when passed true`, }, "id": schema.StringAttribute{ - Required: true, - Description: `The price id`, + Computed: true, }, "is_composite_price": schema.BoolAttribute{ Computed: true, @@ -96,7 +97,7 @@ func (r *PriceDataSource) Schema(ctx context.Context, req datasource.SchemaReque }, "is_tax_inclusive": schema.BoolAttribute{ Computed: true, - Description: `Specifies whether the price is considered ` + "`" + `inclusive` + "`" + ` of taxes or not. Default: false`, + Description: `Specifies whether the price is considered ` + "`" + `inclusive` + "`" + ` of taxes or not.`, }, "long_description": schema.StringAttribute{ Computed: true, @@ -110,6 +111,28 @@ func (r *PriceDataSource) Schema(ctx context.Context, req datasource.SchemaReque Computed: true, Description: `The notice period duration unit. must be one of ["weeks", "months", "years"]`, }, + "price_components": schema.SingleNestedAttribute{ + Computed: true, + Attributes: map[string]schema.Attribute{ + "dollar_relation": schema.ListNestedAttribute{ + Computed: true, + NestedObject: schema.NestedAttributeObject{ + Attributes: map[string]schema.Attribute{ + "tags": schema.ListAttribute{ + Computed: true, + ElementType: types.StringType, + Description: `An arbitrary set of tags attached to the composite price - component relation`, + }, + "entity_id": schema.StringAttribute{ + Computed: true, + Description: `The id of the price component`, + }, + }, + }, + }, + }, + Description: `A set of [price](/api/pricing#tag/simple_price_schema) components that define the composite price.`, + }, "price_display_in_journeys": schema.StringAttribute{ Computed: true, Description: `Defines the way the price amount is display in epilot journeys. must be one of ["show_price", "show_as_starting_price", "show_as_on_request"]`, @@ -122,7 +145,7 @@ func (r *PriceDataSource) Schema(ctx context.Context, req datasource.SchemaReque `- ` + "`" + `tiered_volume` + "`" + ` indicates that the unit pricing will be computed using tiers attribute. The customer pays the same unit price for all purchased units.` + "\n" + `- ` + "`" + `tiered_flatfee` + "`" + ` While similar to tiered_volume, tiered flat fee charges for the same price (flat) for the entire range instead using the unit price to multiply the quantity.` + "\n" + `` + "\n" + - `must be one of ["per_unit", "tiered_volume", "tiered_graduated", "tiered_flatfee"]; Default: "per_unit"`, + `must be one of ["per_unit", "tiered_volume", "tiered_graduated", "tiered_flatfee"]`, }, "renewal_duration_amount": schema.NumberAttribute{ Computed: true, @@ -174,19 +197,10 @@ func (r *PriceDataSource) Schema(ctx context.Context, req datasource.SchemaReque }, "type": schema.StringAttribute{ Computed: true, - Description: `One of ` + "`" + `one_time` + "`" + ` or ` + "`" + `recurring` + "`" + ` depending on whether the price is for a one-time purchase or a recurring (subscription) purchase. must be one of ["one_time", "recurring"]; Default: "one_time"`, + Description: `One of ` + "`" + `one_time` + "`" + ` or ` + "`" + `recurring` + "`" + ` depending on whether the price is for a one-time purchase or a recurring (subscription) purchase. must be one of ["one_time", "recurring"]`, }, - "unit": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "str": schema.StringAttribute{ - Computed: true, - }, - "one": schema.StringAttribute{ - Computed: true, - Description: `built-in units. must be one of ["kw", "kwh", "m", "m2", "l", "cubic-meter", "cubic-meter-h", "ls", "a", "kva", "w", "wp", "kwp"]`, - }, - }, + "unit": schema.StringAttribute{ + Computed: true, Description: `The unit of measurement used for display purposes and possibly for calculations when the price is variable.`, }, "unit_amount": schema.NumberAttribute{ @@ -203,7 +217,7 @@ func (r *PriceDataSource) Schema(ctx context.Context, req datasource.SchemaReque }, "variable_price": schema.BoolAttribute{ Computed: true, - Description: `The flag for prices that can be influenced by external variables such as user input. Default: false`, + Description: `The flag for prices that can be influenced by external variables such as user input.`, }, }, } @@ -270,12 +284,16 @@ func (r *PriceDataSource) Read(ctx context.Context, req datasource.ReadRequest, resp.Diagnostics.AddError("unexpected response from API", fmt.Sprintf("%v", res)) return } + if res.StatusCode == 404 { + resp.State.RemoveResource(ctx) + return + } if res.StatusCode != 200 { resp.Diagnostics.AddError(fmt.Sprintf("unexpected response from API. Got an unexpected response code %v", res.StatusCode), debugResponse(res.RawResponse)) return } - if res.Price == nil { - resp.Diagnostics.AddError("unexpected response from API. No response body", debugResponse(res.RawResponse)) + if !(res.Price != nil) { + resp.Diagnostics.AddError("unexpected response from API. Got an unexpected response body", debugResponse(res.RawResponse)) return } data.RefreshFromSharedPrice(res.Price) diff --git a/internal/provider/price_data_source_sdk.go b/internal/provider/price_data_source_sdk.go index a0bff82..0b6a6ee 100644 --- a/internal/provider/price_data_source_sdk.go +++ b/internal/provider/price_data_source_sdk.go @@ -1,141 +1,154 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasyapi.com). DO NOT EDIT. package provider import ( "encoding/json" - "github.com/epilot-dev/terraform-provider-epilot-product/internal/sdk/pkg/models/shared" + tfTypes "github.com/epilot-dev/terraform-provider-epilot-product/internal/provider/types" + "github.com/epilot-dev/terraform-provider-epilot-product/internal/sdk/models/shared" "github.com/hashicorp/terraform-plugin-framework/types" "math/big" ) func (r *PriceDataSourceModel) RefreshFromSharedPrice(resp *shared.Price) { - r.Active = types.BoolValue(resp.Active) - if resp.BillingDurationAmount != nil { - r.BillingDurationAmount = types.NumberValue(big.NewFloat(float64(*resp.BillingDurationAmount))) - } else { - r.BillingDurationAmount = types.NumberNull() - } - if resp.BillingDurationUnit != nil { - r.BillingDurationUnit = types.StringValue(string(*resp.BillingDurationUnit)) - } else { - r.BillingDurationUnit = types.StringNull() - } - r.Description = types.StringValue(resp.Description) - r.ID = types.StringValue(resp.ID) - r.IsCompositePrice = types.BoolPointerValue(resp.IsCompositePrice) - r.IsTaxInclusive = types.BoolPointerValue(resp.IsTaxInclusive) - r.LongDescription = types.StringPointerValue(resp.LongDescription) - if resp.NoticeTimeAmount != nil { - r.NoticeTimeAmount = types.NumberValue(big.NewFloat(float64(*resp.NoticeTimeAmount))) - } else { - r.NoticeTimeAmount = types.NumberNull() - } - if resp.NoticeTimeUnit != nil { - r.NoticeTimeUnit = types.StringValue(string(*resp.NoticeTimeUnit)) - } else { - r.NoticeTimeUnit = types.StringNull() - } - if resp.PriceDisplayInJourneys != nil { - r.PriceDisplayInJourneys = types.StringValue(string(*resp.PriceDisplayInJourneys)) - } else { - r.PriceDisplayInJourneys = types.StringNull() - } - if resp.PricingModel != nil { - r.PricingModel = types.StringValue(string(*resp.PricingModel)) - } else { - r.PricingModel = types.StringNull() - } - if resp.RenewalDurationAmount != nil { - r.RenewalDurationAmount = types.NumberValue(big.NewFloat(float64(*resp.RenewalDurationAmount))) - } else { - r.RenewalDurationAmount = types.NumberNull() - } - if resp.RenewalDurationUnit != nil { - r.RenewalDurationUnit = types.StringValue(string(*resp.RenewalDurationUnit)) - } else { - r.RenewalDurationUnit = types.StringNull() - } - if resp.Tax == nil { - r.Tax = types.StringNull() - } else { - taxResult, _ := json.Marshal(resp.Tax) - r.Tax = types.StringValue(string(taxResult)) - } - if resp.TerminationTimeAmount != nil { - r.TerminationTimeAmount = types.NumberValue(big.NewFloat(float64(*resp.TerminationTimeAmount))) - } else { - r.TerminationTimeAmount = types.NumberNull() - } - if resp.TerminationTimeUnit != nil { - r.TerminationTimeUnit = types.StringValue(string(*resp.TerminationTimeUnit)) - } else { - r.TerminationTimeUnit = types.StringNull() - } - if len(r.Tiers) > len(resp.Tiers) { - r.Tiers = r.Tiers[:len(resp.Tiers)] - } - for tiersCount, tiersItem := range resp.Tiers { - var tiers1 PriceTier - if tiersItem.DisplayMode != nil { - tiers1.DisplayMode = types.StringValue(string(*tiersItem.DisplayMode)) + if resp != nil { + r.ID = types.StringValue(resp.ID) + r.Active = types.BoolValue(resp.Active) + if resp.BillingDurationAmount != nil { + r.BillingDurationAmount = types.NumberValue(big.NewFloat(float64(*resp.BillingDurationAmount))) } else { - tiers1.DisplayMode = types.StringNull() + r.BillingDurationAmount = types.NumberNull() } - if tiersItem.FlatFeeAmount != nil { - tiers1.FlatFeeAmount = types.NumberValue(big.NewFloat(float64(*tiersItem.FlatFeeAmount))) + if resp.BillingDurationUnit != nil { + r.BillingDurationUnit = types.StringValue(string(*resp.BillingDurationUnit)) } else { - tiers1.FlatFeeAmount = types.NumberNull() + r.BillingDurationUnit = types.StringNull() } - tiers1.FlatFeeAmountDecimal = types.StringPointerValue(tiersItem.FlatFeeAmountDecimal) - if tiersItem.UnitAmount != nil { - tiers1.UnitAmount = types.NumberValue(big.NewFloat(float64(*tiersItem.UnitAmount))) + r.Description = types.StringValue(resp.Description) + r.IsCompositePrice = types.BoolPointerValue(resp.IsCompositePrice) + r.IsTaxInclusive = types.BoolPointerValue(resp.IsTaxInclusive) + r.LongDescription = types.StringPointerValue(resp.LongDescription) + if resp.NoticeTimeAmount != nil { + r.NoticeTimeAmount = types.NumberValue(big.NewFloat(float64(*resp.NoticeTimeAmount))) } else { - tiers1.UnitAmount = types.NumberNull() + r.NoticeTimeAmount = types.NumberNull() } - tiers1.UnitAmountDecimal = types.StringPointerValue(tiersItem.UnitAmountDecimal) - if tiersItem.UpTo != nil { - tiers1.UpTo = types.NumberValue(big.NewFloat(float64(*tiersItem.UpTo))) + if resp.NoticeTimeUnit != nil { + r.NoticeTimeUnit = types.StringValue(string(*resp.NoticeTimeUnit)) } else { - tiers1.UpTo = types.NumberNull() + r.NoticeTimeUnit = types.StringNull() } - if tiersCount+1 > len(r.Tiers) { - r.Tiers = append(r.Tiers, tiers1) + if resp.PriceComponents == nil { + r.PriceComponents = nil } else { - r.Tiers[tiersCount].DisplayMode = tiers1.DisplayMode - r.Tiers[tiersCount].FlatFeeAmount = tiers1.FlatFeeAmount - r.Tiers[tiersCount].FlatFeeAmountDecimal = tiers1.FlatFeeAmountDecimal - r.Tiers[tiersCount].UnitAmount = tiers1.UnitAmount - r.Tiers[tiersCount].UnitAmountDecimal = tiers1.UnitAmountDecimal - r.Tiers[tiersCount].UpTo = tiers1.UpTo + r.PriceComponents = &tfTypes.PriceCreatePriceComponents{} + r.PriceComponents.DollarRelation = []tfTypes.PriceComponentRelation{} + if len(r.PriceComponents.DollarRelation) > len(resp.PriceComponents.DollarRelation) { + r.PriceComponents.DollarRelation = r.PriceComponents.DollarRelation[:len(resp.PriceComponents.DollarRelation)] + } + for dollarRelationCount, dollarRelationItem := range resp.PriceComponents.DollarRelation { + var dollarRelation1 tfTypes.PriceComponentRelation + dollarRelation1.Tags = []types.String{} + for _, v := range dollarRelationItem.Tags { + dollarRelation1.Tags = append(dollarRelation1.Tags, types.StringValue(v)) + } + dollarRelation1.EntityID = types.StringPointerValue(dollarRelationItem.EntityID) + if dollarRelationCount+1 > len(r.PriceComponents.DollarRelation) { + r.PriceComponents.DollarRelation = append(r.PriceComponents.DollarRelation, dollarRelation1) + } else { + r.PriceComponents.DollarRelation[dollarRelationCount].Tags = dollarRelation1.Tags + r.PriceComponents.DollarRelation[dollarRelationCount].EntityID = dollarRelation1.EntityID + } + } } - } - if resp.Type != nil { - r.Type = types.StringValue(string(*resp.Type)) - } else { - r.Type = types.StringNull() - } - if resp.Unit == nil { - r.Unit = nil - } else { - r.Unit = &PriceCreateUnit{} - if resp.Unit.Str != nil { - r.Unit.Str = types.StringPointerValue(resp.Unit.Str) - } - if resp.Unit.One != nil { - if resp.Unit.One != nil { - r.Unit.One = types.StringValue(string(*resp.Unit.One)) + if resp.PriceDisplayInJourneys != nil { + r.PriceDisplayInJourneys = types.StringValue(string(*resp.PriceDisplayInJourneys)) + } else { + r.PriceDisplayInJourneys = types.StringNull() + } + if resp.PricingModel != nil { + r.PricingModel = types.StringValue(string(*resp.PricingModel)) + } else { + r.PricingModel = types.StringNull() + } + if resp.RenewalDurationAmount != nil { + r.RenewalDurationAmount = types.NumberValue(big.NewFloat(float64(*resp.RenewalDurationAmount))) + } else { + r.RenewalDurationAmount = types.NumberNull() + } + if resp.RenewalDurationUnit != nil { + r.RenewalDurationUnit = types.StringValue(string(*resp.RenewalDurationUnit)) + } else { + r.RenewalDurationUnit = types.StringNull() + } + if resp.Tax == nil { + r.Tax = types.StringNull() + } else { + taxResult, _ := json.Marshal(resp.Tax) + r.Tax = types.StringValue(string(taxResult)) + } + if resp.TerminationTimeAmount != nil { + r.TerminationTimeAmount = types.NumberValue(big.NewFloat(float64(*resp.TerminationTimeAmount))) + } else { + r.TerminationTimeAmount = types.NumberNull() + } + if resp.TerminationTimeUnit != nil { + r.TerminationTimeUnit = types.StringValue(string(*resp.TerminationTimeUnit)) + } else { + r.TerminationTimeUnit = types.StringNull() + } + r.Tiers = []tfTypes.PriceTier{} + if len(r.Tiers) > len(resp.Tiers) { + r.Tiers = r.Tiers[:len(resp.Tiers)] + } + for tiersCount, tiersItem := range resp.Tiers { + var tiers1 tfTypes.PriceTier + if tiersItem.DisplayMode != nil { + tiers1.DisplayMode = types.StringValue(string(*tiersItem.DisplayMode)) + } else { + tiers1.DisplayMode = types.StringNull() + } + if tiersItem.FlatFeeAmount != nil { + tiers1.FlatFeeAmount = types.NumberValue(big.NewFloat(float64(*tiersItem.FlatFeeAmount))) } else { - r.Unit.One = types.StringNull() + tiers1.FlatFeeAmount = types.NumberNull() + } + tiers1.FlatFeeAmountDecimal = types.StringPointerValue(tiersItem.FlatFeeAmountDecimal) + if tiersItem.UnitAmount != nil { + tiers1.UnitAmount = types.NumberValue(big.NewFloat(float64(*tiersItem.UnitAmount))) + } else { + tiers1.UnitAmount = types.NumberNull() + } + tiers1.UnitAmountDecimal = types.StringPointerValue(tiersItem.UnitAmountDecimal) + if tiersItem.UpTo != nil { + tiers1.UpTo = types.NumberValue(big.NewFloat(float64(*tiersItem.UpTo))) + } else { + tiers1.UpTo = types.NumberNull() + } + if tiersCount+1 > len(r.Tiers) { + r.Tiers = append(r.Tiers, tiers1) + } else { + r.Tiers[tiersCount].DisplayMode = tiers1.DisplayMode + r.Tiers[tiersCount].FlatFeeAmount = tiers1.FlatFeeAmount + r.Tiers[tiersCount].FlatFeeAmountDecimal = tiers1.FlatFeeAmountDecimal + r.Tiers[tiersCount].UnitAmount = tiers1.UnitAmount + r.Tiers[tiersCount].UnitAmountDecimal = tiers1.UnitAmountDecimal + r.Tiers[tiersCount].UpTo = tiers1.UpTo } } + if resp.Type != nil { + r.Type = types.StringValue(string(*resp.Type)) + } else { + r.Type = types.StringNull() + } + r.Unit = types.StringPointerValue(resp.Unit) + if resp.UnitAmount != nil { + r.UnitAmount = types.NumberValue(big.NewFloat(float64(*resp.UnitAmount))) + } else { + r.UnitAmount = types.NumberNull() + } + r.UnitAmountCurrency = types.StringPointerValue(resp.UnitAmountCurrency) + r.UnitAmountDecimal = types.StringPointerValue(resp.UnitAmountDecimal) + r.VariablePrice = types.BoolPointerValue(resp.VariablePrice) } - if resp.UnitAmount != nil { - r.UnitAmount = types.NumberValue(big.NewFloat(float64(*resp.UnitAmount))) - } else { - r.UnitAmount = types.NumberNull() - } - r.UnitAmountCurrency = types.StringPointerValue(resp.UnitAmountCurrency) - r.UnitAmountDecimal = types.StringPointerValue(resp.UnitAmountDecimal) - r.VariablePrice = types.BoolPointerValue(resp.VariablePrice) } diff --git a/internal/provider/price_resource.go b/internal/provider/price_resource.go index ba0980f..3ad19ff 100644 --- a/internal/provider/price_resource.go +++ b/internal/provider/price_resource.go @@ -1,17 +1,20 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasyapi.com). DO NOT EDIT. package provider import ( "context" "fmt" + tfTypes "github.com/epilot-dev/terraform-provider-epilot-product/internal/provider/types" "github.com/epilot-dev/terraform-provider-epilot-product/internal/sdk" - "github.com/epilot-dev/terraform-provider-epilot-product/internal/sdk/pkg/models/operations" + "github.com/epilot-dev/terraform-provider-epilot-product/internal/sdk/models/operations" "github.com/epilot-dev/terraform-provider-epilot-product/internal/validators" "github.com/hashicorp/terraform-plugin-framework-validators/stringvalidator" "github.com/hashicorp/terraform-plugin-framework/path" "github.com/hashicorp/terraform-plugin-framework/resource" "github.com/hashicorp/terraform-plugin-framework/resource/schema" + "github.com/hashicorp/terraform-plugin-framework/resource/schema/booldefault" + "github.com/hashicorp/terraform-plugin-framework/resource/schema/stringdefault" "github.com/hashicorp/terraform-plugin-framework/schema/validator" "github.com/hashicorp/terraform-plugin-framework/types" "github.com/hashicorp/terraform-plugin-framework/types/basetypes" @@ -32,30 +35,31 @@ type PriceResource struct { // PriceResourceModel describes the resource data model. type PriceResourceModel struct { - ID types.String `tfsdk:"id"` - Active types.Bool `tfsdk:"active"` - BillingDurationAmount types.Number `tfsdk:"billing_duration_amount"` - BillingDurationUnit types.String `tfsdk:"billing_duration_unit"` - Description types.String `tfsdk:"description"` - IsCompositePrice types.Bool `tfsdk:"is_composite_price"` - IsTaxInclusive types.Bool `tfsdk:"is_tax_inclusive"` - LongDescription types.String `tfsdk:"long_description"` - NoticeTimeAmount types.Number `tfsdk:"notice_time_amount"` - NoticeTimeUnit types.String `tfsdk:"notice_time_unit"` - PriceDisplayInJourneys types.String `tfsdk:"price_display_in_journeys"` - PricingModel types.String `tfsdk:"pricing_model"` - RenewalDurationAmount types.Number `tfsdk:"renewal_duration_amount"` - RenewalDurationUnit types.String `tfsdk:"renewal_duration_unit"` - Tax types.String `tfsdk:"tax"` - TerminationTimeAmount types.Number `tfsdk:"termination_time_amount"` - TerminationTimeUnit types.String `tfsdk:"termination_time_unit"` - Tiers []PriceTier `tfsdk:"tiers"` - Type types.String `tfsdk:"type"` - Unit *PriceCreateUnit `tfsdk:"unit"` - UnitAmount types.Number `tfsdk:"unit_amount"` - UnitAmountCurrency types.String `tfsdk:"unit_amount_currency"` - UnitAmountDecimal types.String `tfsdk:"unit_amount_decimal"` - VariablePrice types.Bool `tfsdk:"variable_price"` + Active types.Bool `tfsdk:"active"` + BillingDurationAmount types.Number `tfsdk:"billing_duration_amount"` + BillingDurationUnit types.String `tfsdk:"billing_duration_unit"` + Description types.String `tfsdk:"description"` + ID types.String `tfsdk:"id"` + IsCompositePrice types.Bool `tfsdk:"is_composite_price"` + IsTaxInclusive types.Bool `tfsdk:"is_tax_inclusive"` + LongDescription types.String `tfsdk:"long_description"` + NoticeTimeAmount types.Number `tfsdk:"notice_time_amount"` + NoticeTimeUnit types.String `tfsdk:"notice_time_unit"` + PriceComponents *tfTypes.PriceCreatePriceComponents `tfsdk:"price_components"` + PriceDisplayInJourneys types.String `tfsdk:"price_display_in_journeys"` + PricingModel types.String `tfsdk:"pricing_model"` + RenewalDurationAmount types.Number `tfsdk:"renewal_duration_amount"` + RenewalDurationUnit types.String `tfsdk:"renewal_duration_unit"` + Tax types.String `tfsdk:"tax"` + TerminationTimeAmount types.Number `tfsdk:"termination_time_amount"` + TerminationTimeUnit types.String `tfsdk:"termination_time_unit"` + Tiers []tfTypes.PriceTier `tfsdk:"tiers"` + Type types.String `tfsdk:"type"` + Unit types.String `tfsdk:"unit"` + UnitAmount types.Number `tfsdk:"unit_amount"` + UnitAmountCurrency types.String `tfsdk:"unit_amount_currency"` + UnitAmountDecimal types.String `tfsdk:"unit_amount_decimal"` + VariablePrice types.Bool `tfsdk:"variable_price"` } func (r *PriceResource) Metadata(ctx context.Context, req resource.MetadataRequest, resp *resource.MetadataResponse) { @@ -65,12 +69,7 @@ func (r *PriceResource) Metadata(ctx context.Context, req resource.MetadataReque func (r *PriceResource) Schema(ctx context.Context, req resource.SchemaRequest, resp *resource.SchemaResponse) { resp.Schema = schema.Schema{ MarkdownDescription: "Price Resource", - Attributes: map[string]schema.Attribute{ - "id": schema.StringAttribute{ - Computed: true, - Description: `The price id`, - }, "active": schema.BoolAttribute{ Required: true, Description: `Whether the price can be used for new purchases.`, @@ -96,6 +95,9 @@ func (r *PriceResource) Schema(ctx context.Context, req resource.SchemaRequest, Required: true, Description: `A brief description of the price.`, }, + "id": schema.StringAttribute{ + Computed: true, + }, "is_composite_price": schema.BoolAttribute{ Computed: true, Optional: true, @@ -104,6 +106,7 @@ func (r *PriceResource) Schema(ctx context.Context, req resource.SchemaRequest, "is_tax_inclusive": schema.BoolAttribute{ Computed: true, Optional: true, + Default: booldefault.StaticBool(false), Description: `Specifies whether the price is considered ` + "`" + `inclusive` + "`" + ` of taxes or not. Default: false`, }, "long_description": schema.StringAttribute{ @@ -128,6 +131,32 @@ func (r *PriceResource) Schema(ctx context.Context, req resource.SchemaRequest, ), }, }, + "price_components": schema.SingleNestedAttribute{ + Computed: true, + Optional: true, + Attributes: map[string]schema.Attribute{ + "dollar_relation": schema.ListNestedAttribute{ + Computed: true, + Optional: true, + NestedObject: schema.NestedAttributeObject{ + Attributes: map[string]schema.Attribute{ + "tags": schema.ListAttribute{ + Computed: true, + Optional: true, + ElementType: types.StringType, + Description: `An arbitrary set of tags attached to the composite price - component relation`, + }, + "entity_id": schema.StringAttribute{ + Computed: true, + Optional: true, + Description: `The id of the price component`, + }, + }, + }, + }, + }, + Description: `A set of [price](/api/pricing#tag/simple_price_schema) components that define the composite price.`, + }, "price_display_in_journeys": schema.StringAttribute{ Computed: true, Optional: true, @@ -143,6 +172,7 @@ func (r *PriceResource) Schema(ctx context.Context, req resource.SchemaRequest, "pricing_model": schema.StringAttribute{ Computed: true, Optional: true, + Default: stringdefault.StaticString("per_unit"), MarkdownDescription: `Describes how to compute the price per period. Either ` + "`" + `per_unit` + "`" + `, ` + "`" + `tiered_graduated` + "`" + ` or ` + "`" + `tiered_volume` + "`" + `.` + "\n" + `- ` + "`" + `per_unit` + "`" + ` indicates that the fixed amount (specified in unit_amount or unit_amount_decimal) will be charged per unit in quantity` + "\n" + `- ` + "`" + `tiered_graduated` + "`" + ` indicates that the unit pricing will be computed using tiers attribute. The customer pays the price per unit in every range their purchase rises through.` + "\n" + @@ -245,6 +275,7 @@ func (r *PriceResource) Schema(ctx context.Context, req resource.SchemaRequest, "type": schema.StringAttribute{ Computed: true, Optional: true, + Default: stringdefault.StaticString("one_time"), Description: `One of ` + "`" + `one_time` + "`" + ` or ` + "`" + `recurring` + "`" + ` depending on whether the price is for a one-time purchase or a recurring (subscription) purchase. must be one of ["one_time", "recurring"]; Default: "one_time"`, Validators: []validator.String{ stringvalidator.OneOf( @@ -253,41 +284,10 @@ func (r *PriceResource) Schema(ctx context.Context, req resource.SchemaRequest, ), }, }, - "unit": schema.SingleNestedAttribute{ - Computed: true, - Optional: true, - Attributes: map[string]schema.Attribute{ - "str": schema.StringAttribute{ - Computed: true, - Optional: true, - }, - "one": schema.StringAttribute{ - Computed: true, - Optional: true, - Description: `built-in units. must be one of ["kw", "kwh", "m", "m2", "l", "cubic-meter", "cubic-meter-h", "ls", "a", "kva", "w", "wp", "kwp"]`, - Validators: []validator.String{ - stringvalidator.OneOf( - "kw", - "kwh", - "m", - "m2", - "l", - "cubic-meter", - "cubic-meter-h", - "ls", - "a", - "kva", - "w", - "wp", - "kwp", - ), - }, - }, - }, + "unit": schema.StringAttribute{ + Computed: true, + Optional: true, Description: `The unit of measurement used for display purposes and possibly for calculations when the price is variable.`, - Validators: []validator.Object{ - validators.ExactlyOneChild(), - }, }, "unit_amount": schema.NumberAttribute{ Computed: true, @@ -307,6 +307,7 @@ func (r *PriceResource) Schema(ctx context.Context, req resource.SchemaRequest, "variable_price": schema.BoolAttribute{ Computed: true, Optional: true, + Default: booldefault.StaticBool(false), Description: `The flag for prices that can be influenced by external variables such as user input. Default: false`, }, }, @@ -368,8 +369,8 @@ func (r *PriceResource) Create(ctx context.Context, req resource.CreateRequest, resp.Diagnostics.AddError(fmt.Sprintf("unexpected response from API. Got an unexpected response code %v", res.StatusCode), debugResponse(res.RawResponse)) return } - if res.Price == nil { - resp.Diagnostics.AddError("unexpected response from API. No response body", debugResponse(res.RawResponse)) + if !(res.Price != nil) { + resp.Diagnostics.AddError("unexpected response from API. Got an unexpected response body", debugResponse(res.RawResponse)) return } data.RefreshFromSharedPrice(res.Price) @@ -397,6 +398,9 @@ func (r *PriceResource) Read(ctx context.Context, req resource.ReadRequest, resp return } + // read.price.hydrateread.price.hydrate impedance mismatch: "boolean" != "class"trace=["Price#create.req"] + // {"Examples":[],"Format":"","Output":false,"EventStreamEnvelope":false,"Enum":null,"IsComponent":true,"ItemType":null,"ResolvedModel":"PriceCreate","Truncated":false,"ContextStack":[{"Type":"refType","Identifier":"Schemas","Used":false,"MustUse":false},{"Type":"refName","Identifier":"PriceCreate","Used":false,"MustUse":false},{"Type":"component","Identifier":"true","Used":false,"MustUse":false}],"Type":"class","ResponseEnvelope":false,"OutputLocation":"models/shared","Comments":null,"Original":{"Name":"PriceCreate","OriginalName":"PriceCreate","ContextStack":[{"Type":"refType","Identifier":"Schemas","Used":false,"MustUse":false},{"Type":"refName","Identifier":"PriceCreate","Used":false,"MustUse":false},{"Type":"component","Identifier":"true","Used":false,"MustUse":false}],"Type":"class","ItemType":null,"Fields":[{"Name":"active","OriginalName":"active","Type":{"Name":"","OriginalName":"","ContextStack":[],"Type":"boolean","ItemType":null,"Fields":[],"Validations":{"MinItems":null,"MinLength":null,"Minimum":null,"MaxItems":null,"MaxLength":null,"Maximum":null,"Pattern":null,"UniqueItems":null},"AssociatedTypes":[],"Enum":null,"Scope":"","IsComponent":false,"Truncated":false,"Comments":null,"Input":false,"Output":false,"Extensions":{},"Examples":[],"Format":"","Discriminator":null,"ComplexAny":false,"OutputLocation":"","ResolvedModel":"","EventStreamEnvelope":false,"ResponseEnvelope":false},"Comments":{"Summary":"","Description":"Whether the price can be used for new purchases.","ExternalDocs":null,"ExtendedComments":{},"Deprecated":false,"DeprecationReplacement":"","DeprecationMessage":""},"Annotations":[{"Ignore":false,"FieldName":"active"}],"Nullable":false,"Optional":false,"SerializationMethod":null,"ErrorMessage":false,"Const":null,"Default":null,"IsAdditionalProperties":false,"ParameterIndex":null},{"Name":"billing_duration_amount","OriginalName":"billing_duration_amount","Type":{"Name":"","OriginalName":"","ContextStack":[],"Type":"number","ItemType":null,"Fields":[],"Validations":{"MinItems":null,"MinLength":null,"Minimum":null,"MaxItems":null,"MaxLength":null,"Maximum":null,"Pattern":null,"UniqueItems":null},"AssociatedTypes":[],"Enum":null,"Scope":"","IsComponent":false,"Truncated":false,"Comments":null,"Input":false,"Output":false,"Extensions":{},"Examples":[],"Format":"","Discriminator":null,"ComplexAny":false,"OutputLocation":"","ResolvedModel":"","EventStreamEnvelope":false,"ResponseEnvelope":false},"Comments":{"Summary":"","Description":"The billing period duration","ExternalDocs":null,"ExtendedComments":{},"Deprecated":false,"DeprecationReplacement":"","DeprecationMessage":""},"Annotations":[{"Ignore":false,"FieldName":"billing_duration_amount"}],"Nullable":false,"Optional":true,"SerializationMethod":null,"ErrorMessage":false,"Const":null,"Default":null,"IsAdditionalProperties":false,"ParameterIndex":null},{"Name":"billing_duration_unit","OriginalName":"billing_duration_unit","Type":{"Name":"PriceCreate_billing_duration_unit","OriginalName":"billing_duration_unit","ContextStack":[{"Type":"refType","Identifier":"Schemas","Used":false,"MustUse":false},{"Type":"refName","Identifier":"PriceCreate","Used":true,"MustUse":false}],"Type":"enum","ItemType":null,"Fields":[],"Validations":{"MinItems":null,"MinLength":null,"Minimum":null,"MaxItems":null,"MaxLength":null,"Maximum":null,"Pattern":null,"UniqueItems":null},"AssociatedTypes":[],"Enum":{"Type":{"Name":"","OriginalName":"","ContextStack":[],"Type":"string","ItemType":null,"Fields":[],"Validations":{"MinItems":null,"MinLength":null,"Minimum":null,"MaxItems":null,"MaxLength":null,"Maximum":null,"Pattern":null,"UniqueItems":null},"AssociatedTypes":[],"Enum":null,"Scope":"","IsComponent":false,"Truncated":false,"Comments":null,"Input":false,"Output":false,"Extensions":{},"Examples":[],"Format":"","Discriminator":null,"ComplexAny":false,"OutputLocation":"","ResolvedModel":"","EventStreamEnvelope":false,"ResponseEnvelope":false},"Values":["weeks","months","years"],"Names":[],"Open":false,"Format":""},"Scope":"shared","IsComponent":false,"Truncated":false,"Comments":{"Summary":"","Description":"The billing period duration unit","ExternalDocs":null,"ExtendedComments":{},"Deprecated":false,"DeprecationReplacement":"","DeprecationMessage":""},"Input":false,"Output":false,"Extensions":{},"Examples":[],"Format":"","Discriminator":null,"ComplexAny":false,"OutputLocation":"models/shared","ResolvedModel":"PriceCreate","EventStreamEnvelope":false,"ResponseEnvelope":false},"Comments":{"Summary":"","Description":"The billing period duration unit","ExternalDocs":null,"ExtendedComments":{},"Deprecated":false,"DeprecationReplacement":"","DeprecationMessage":""},"Annotations":[{"Ignore":false,"FieldName":"billing_duration_unit"}],"Nullable":false,"Optional":true,"SerializationMethod":null,"ErrorMessage":false,"Const":null,"Default":null,"IsAdditionalProperties":false,"ParameterIndex":null},{"Name":"description","OriginalName":"description","Type":{"Name":"","OriginalName":"","ContextStack":[],"Type":"string","ItemType":null,"Fields":[],"Validations":{"MinItems":null,"MinLength":null,"Minimum":null,"MaxItems":null,"MaxLength":null,"Maximum":null,"Pattern":null,"UniqueItems":null},"AssociatedTypes":[],"Enum":null,"Scope":"","IsComponent":false,"Truncated":false,"Comments":null,"Input":false,"Output":false,"Extensions":{},"Examples":[],"Format":"","Discriminator":null,"ComplexAny":false,"OutputLocation":"","ResolvedModel":"","EventStreamEnvelope":false,"ResponseEnvelope":false},"Comments":{"Summary":"","Description":"A brief description of the price.","ExternalDocs":null,"ExtendedComments":{},"Deprecated":false,"DeprecationReplacement":"","DeprecationMessage":""},"Annotations":[{"Ignore":false,"FieldName":"description"}],"Nullable":false,"Optional":false,"SerializationMethod":null,"ErrorMessage":false,"Const":null,"Default":null,"IsAdditionalProperties":false,"ParameterIndex":null},{"Name":"is_composite_price","OriginalName":"is_composite_price","Type":{"Name":"","OriginalName":"","ContextStack":[],"Type":"boolean","ItemType":null,"Fields":[],"Validations":{"MinItems":null,"MinLength":null,"Minimum":null,"MaxItems":null,"MaxLength":null,"Maximum":null,"Pattern":null,"UniqueItems":null},"AssociatedTypes":[],"Enum":null,"Scope":"","IsComponent":false,"Truncated":false,"Comments":null,"Input":false,"Output":false,"Extensions":{},"Examples":[],"Format":"","Discriminator":null,"ComplexAny":false,"OutputLocation":"","ResolvedModel":"","EventStreamEnvelope":false,"ResponseEnvelope":false},"Comments":{"Summary":"","Description":"The flag for prices that contain price components.","ExternalDocs":null,"ExtendedComments":{},"Deprecated":false,"DeprecationReplacement":"","DeprecationMessage":""},"Annotations":[{"Ignore":false,"FieldName":"is_composite_price"}],"Nullable":false,"Optional":true,"SerializationMethod":null,"ErrorMessage":false,"Const":null,"Default":null,"IsAdditionalProperties":false,"ParameterIndex":null},{"Name":"is_tax_inclusive","OriginalName":"is_tax_inclusive","Type":{"Name":"","OriginalName":"","ContextStack":[],"Type":"boolean","ItemType":null,"Fields":[],"Validations":{"MinItems":null,"MinLength":null,"Minimum":null,"MaxItems":null,"MaxLength":null,"Maximum":null,"Pattern":null,"UniqueItems":null},"AssociatedTypes":[],"Enum":null,"Scope":"","IsComponent":false,"Truncated":false,"Comments":null,"Input":false,"Output":false,"Extensions":{},"Examples":[],"Format":"","Discriminator":null,"ComplexAny":false,"OutputLocation":"","ResolvedModel":"","EventStreamEnvelope":false,"ResponseEnvelope":false},"Comments":{"Summary":"","Description":"Specifies whether the price is considered `inclusive` of taxes or not.","ExternalDocs":null,"ExtendedComments":{},"Deprecated":false,"DeprecationReplacement":"","DeprecationMessage":""},"Annotations":[{"Ignore":false,"FieldName":"is_tax_inclusive"}],"Nullable":false,"Optional":true,"SerializationMethod":null,"ErrorMessage":false,"Const":null,"Default":{"Value":false},"IsAdditionalProperties":false,"ParameterIndex":null},{"Name":"long_description","OriginalName":"long_description","Type":{"Name":"","OriginalName":"","ContextStack":[],"Type":"string","ItemType":null,"Fields":[],"Validations":{"MinItems":null,"MinLength":null,"Minimum":null,"MaxItems":null,"MaxLength":null,"Maximum":null,"Pattern":null,"UniqueItems":null},"AssociatedTypes":[],"Enum":null,"Scope":"","IsComponent":false,"Truncated":false,"Comments":null,"Input":false,"Output":false,"Extensions":{},"Examples":[],"Format":"","Discriminator":null,"ComplexAny":false,"OutputLocation":"","ResolvedModel":"","EventStreamEnvelope":false,"ResponseEnvelope":false},"Comments":{"Summary":"","Description":"A detailed description of the price. This is shown on the order document and order table. Multi-line supported.","ExternalDocs":null,"ExtendedComments":{},"Deprecated":false,"DeprecationReplacement":"","DeprecationMessage":""},"Annotations":[{"Ignore":false,"FieldName":"long_description"}],"Nullable":false,"Optional":true,"SerializationMethod":null,"ErrorMessage":false,"Const":null,"Default":null,"IsAdditionalProperties":false,"ParameterIndex":null},{"Name":"notice_time_amount","OriginalName":"notice_time_amount","Type":{"Name":"","OriginalName":"","ContextStack":[],"Type":"number","ItemType":null,"Fields":[],"Validations":{"MinItems":null,"MinLength":null,"Minimum":null,"MaxItems":null,"MaxLength":null,"Maximum":null,"Pattern":null,"UniqueItems":null},"AssociatedTypes":[],"Enum":null,"Scope":"","IsComponent":false,"Truncated":false,"Comments":null,"Input":false,"Output":false,"Extensions":{},"Examples":[],"Format":"","Discriminator":null,"ComplexAny":false,"OutputLocation":"","ResolvedModel":"","EventStreamEnvelope":false,"ResponseEnvelope":false},"Comments":{"Summary":"","Description":"The notice period duration","ExternalDocs":null,"ExtendedComments":{},"Deprecated":false,"DeprecationReplacement":"","DeprecationMessage":""},"Annotations":[{"Ignore":false,"FieldName":"notice_time_amount"}],"Nullable":false,"Optional":true,"SerializationMethod":null,"ErrorMessage":false,"Const":null,"Default":null,"IsAdditionalProperties":false,"ParameterIndex":null},{"Name":"notice_time_unit","OriginalName":"notice_time_unit","Type":{"Name":"PriceCreate_notice_time_unit","OriginalName":"notice_time_unit","ContextStack":[{"Type":"refType","Identifier":"Schemas","Used":false,"MustUse":false},{"Type":"refName","Identifier":"PriceCreate","Used":true,"MustUse":false}],"Type":"enum","ItemType":null,"Fields":[],"Validations":{"MinItems":null,"MinLength":null,"Minimum":null,"MaxItems":null,"MaxLength":null,"Maximum":null,"Pattern":null,"UniqueItems":null},"AssociatedTypes":[],"Enum":{"Type":{"Name":"","OriginalName":"","ContextStack":[],"Type":"string","ItemType":null,"Fields":[],"Validations":{"MinItems":null,"MinLength":null,"Minimum":null,"MaxItems":null,"MaxLength":null,"Maximum":null,"Pattern":null,"UniqueItems":null},"AssociatedTypes":[],"Enum":null,"Scope":"","IsComponent":false,"Truncated":false,"Comments":null,"Input":false,"Output":false,"Extensions":{},"Examples":[],"Format":"","Discriminator":null,"ComplexAny":false,"OutputLocation":"","ResolvedModel":"","EventStreamEnvelope":false,"ResponseEnvelope":false},"Values":["weeks","months","years"],"Names":[],"Open":false,"Format":""},"Scope":"shared","IsComponent":false,"Truncated":false,"Comments":{"Summary":"","Description":"The notice period duration unit","ExternalDocs":null,"ExtendedComments":{},"Deprecated":false,"DeprecationReplacement":"","DeprecationMessage":""},"Input":false,"Output":false,"Extensions":{},"Examples":[],"Format":"","Discriminator":null,"ComplexAny":false,"OutputLocation":"models/shared","ResolvedModel":"PriceCreate","EventStreamEnvelope":false,"ResponseEnvelope":false},"Comments":{"Summary":"","Description":"The notice period duration unit","ExternalDocs":null,"ExtendedComments":{},"Deprecated":false,"DeprecationReplacement":"","DeprecationMessage":""},"Annotations":[{"Ignore":false,"FieldName":"notice_time_unit"}],"Nullable":false,"Optional":true,"SerializationMethod":null,"ErrorMessage":false,"Const":null,"Default":null,"IsAdditionalProperties":false,"ParameterIndex":null},{"Name":"price_components","OriginalName":"price_components","Type":{"Name":"PriceCreate_price_components","OriginalName":"price_components","ContextStack":[{"Type":"refType","Identifier":"Schemas","Used":false,"MustUse":false},{"Type":"refName","Identifier":"PriceCreate","Used":true,"MustUse":false}],"Type":"class","ItemType":null,"Fields":[{"Name":"$relation","OriginalName":"$relation","Type":{"Name":"","OriginalName":"","ContextStack":[],"Type":"array","ItemType":{"Name":"PriceComponentRelation","OriginalName":"PriceComponentRelation","ContextStack":[{"Type":"refType","Identifier":"Schemas","Used":false,"MustUse":false},{"Type":"refName","Identifier":"PriceComponentRelation","Used":false,"MustUse":false},{"Type":"component","Identifier":"true","Used":false,"MustUse":false}],"Type":"class","ItemType":null,"Fields":[{"Name":"_tags","OriginalName":"_tags","Type":{"Name":"","OriginalName":"","ContextStack":[],"Type":"array","ItemType":{"Name":"","OriginalName":"","ContextStack":[],"Type":"string","ItemType":null,"Fields":[],"Validations":{"MinItems":null,"MinLength":null,"Minimum":null,"MaxItems":null,"MaxLength":null,"Maximum":null,"Pattern":null,"UniqueItems":null},"AssociatedTypes":[],"Enum":null,"Scope":"","IsComponent":false,"Truncated":false,"Comments":null,"Input":false,"Output":false,"Extensions":{},"Examples":[],"Format":"","Discriminator":null,"ComplexAny":false,"OutputLocation":"","ResolvedModel":"","EventStreamEnvelope":false,"ResponseEnvelope":false},"Fields":[],"Validations":{"MinItems":null,"MinLength":null,"Minimum":null,"MaxItems":null,"MaxLength":null,"Maximum":null,"Pattern":null,"UniqueItems":null},"AssociatedTypes":[],"Enum":null,"Scope":"","IsComponent":false,"Truncated":false,"Comments":null,"Input":false,"Output":false,"Extensions":{},"Examples":[],"Format":"","Discriminator":null,"ComplexAny":false,"OutputLocation":"","ResolvedModel":"","EventStreamEnvelope":false,"ResponseEnvelope":false},"Comments":{"Summary":"","Description":"An arbitrary set of tags attached to the composite price - component relation","ExternalDocs":null,"ExtendedComments":{},"Deprecated":false,"DeprecationReplacement":"","DeprecationMessage":""},"Annotations":[{"Ignore":false,"FieldName":"_tags"}],"Nullable":false,"Optional":true,"SerializationMethod":null,"ErrorMessage":false,"Const":null,"Default":null,"IsAdditionalProperties":false,"ParameterIndex":null},{"Name":"entity_id","OriginalName":"entity_id","Type":{"Name":"","OriginalName":"","ContextStack":[],"Type":"string","ItemType":null,"Fields":[],"Validations":{"MinItems":null,"MinLength":null,"Minimum":null,"MaxItems":null,"MaxLength":null,"Maximum":null,"Pattern":null,"UniqueItems":null},"AssociatedTypes":[],"Enum":null,"Scope":"","IsComponent":false,"Truncated":false,"Comments":null,"Input":false,"Output":false,"Extensions":{},"Examples":[],"Format":"","Discriminator":null,"ComplexAny":false,"OutputLocation":"","ResolvedModel":"","EventStreamEnvelope":false,"ResponseEnvelope":false},"Comments":{"Summary":"","Description":"The id of the price component","ExternalDocs":null,"ExtendedComments":{},"Deprecated":false,"DeprecationReplacement":"","DeprecationMessage":""},"Annotations":[{"Ignore":false,"FieldName":"entity_id"}],"Nullable":false,"Optional":true,"SerializationMethod":null,"ErrorMessage":false,"Const":null,"Default":null,"IsAdditionalProperties":false,"ParameterIndex":null}],"Validations":{"MinItems":null,"MinLength":null,"Minimum":null,"MaxItems":null,"MaxLength":null,"Maximum":null,"Pattern":null,"UniqueItems":null},"AssociatedTypes":[],"Enum":null,"Scope":"shared","IsComponent":true,"Truncated":false,"Comments":null,"Input":false,"Output":false,"Extensions":{},"Examples":[],"Format":"","Discriminator":null,"ComplexAny":false,"OutputLocation":"models/shared","ResolvedModel":"PriceComponentRelation","EventStreamEnvelope":false,"ResponseEnvelope":false},"Fields":[],"Validations":{"MinItems":null,"MinLength":null,"Minimum":null,"MaxItems":null,"MaxLength":null,"Maximum":null,"Pattern":null,"UniqueItems":null},"AssociatedTypes":[],"Enum":null,"Scope":"","IsComponent":false,"Truncated":false,"Comments":null,"Input":false,"Output":false,"Extensions":{},"Examples":[],"Format":"","Discriminator":null,"ComplexAny":false,"OutputLocation":"","ResolvedModel":"","EventStreamEnvelope":false,"ResponseEnvelope":false},"Comments":null,"Annotations":[{"Ignore":false,"FieldName":"$relation"}],"Nullable":false,"Optional":true,"SerializationMethod":null,"ErrorMessage":false,"Const":null,"Default":null,"IsAdditionalProperties":false,"ParameterIndex":null}],"Validations":{"MinItems":null,"MinLength":null,"Minimum":null,"MaxItems":null,"MaxLength":null,"Maximum":null,"Pattern":null,"UniqueItems":null},"AssociatedTypes":[],"Enum":null,"Scope":"shared","IsComponent":false,"Truncated":false,"Comments":{"Summary":"","Description":"A set of [price](/api/pricing#tag/simple_price_schema) components that define the composite price.","ExternalDocs":null,"ExtendedComments":{},"Deprecated":false,"DeprecationReplacement":"","DeprecationMessage":""},"Input":false,"Output":false,"Extensions":{},"Examples":[],"Format":"","Discriminator":null,"ComplexAny":false,"OutputLocation":"models/shared","ResolvedModel":"PriceCreate","EventStreamEnvelope":false,"ResponseEnvelope":false},"Comments":{"Summary":"","Description":"A set of [price](/api/pricing#tag/simple_price_schema) components that define the composite price.","ExternalDocs":null,"ExtendedComments":{},"Deprecated":false,"DeprecationReplacement":"","DeprecationMessage":""},"Annotations":[{"Ignore":false,"FieldName":"price_components"}],"Nullable":false,"Optional":true,"SerializationMethod":null,"ErrorMessage":false,"Const":null,"Default":null,"IsAdditionalProperties":false,"ParameterIndex":null},{"Name":"price_display_in_journeys","OriginalName":"price_display_in_journeys","Type":{"Name":"PriceCreate_price_display_in_journeys","OriginalName":"price_display_in_journeys","ContextStack":[{"Type":"refType","Identifier":"Schemas","Used":false,"MustUse":false},{"Type":"refName","Identifier":"PriceCreate","Used":true,"MustUse":false}],"Type":"enum","ItemType":null,"Fields":[],"Validations":{"MinItems":null,"MinLength":null,"Minimum":null,"MaxItems":null,"MaxLength":null,"Maximum":null,"Pattern":null,"UniqueItems":null},"AssociatedTypes":[],"Enum":{"Type":{"Name":"","OriginalName":"","ContextStack":[],"Type":"string","ItemType":null,"Fields":[],"Validations":{"MinItems":null,"MinLength":null,"Minimum":null,"MaxItems":null,"MaxLength":null,"Maximum":null,"Pattern":null,"UniqueItems":null},"AssociatedTypes":[],"Enum":null,"Scope":"","IsComponent":false,"Truncated":false,"Comments":null,"Input":false,"Output":false,"Extensions":{},"Examples":[],"Format":"","Discriminator":null,"ComplexAny":false,"OutputLocation":"","ResolvedModel":"","EventStreamEnvelope":false,"ResponseEnvelope":false},"Values":["show_price","show_as_starting_price","show_as_on_request"],"Names":[],"Open":false,"Format":""},"Scope":"shared","IsComponent":false,"Truncated":false,"Comments":{"Summary":"","Description":"Defines the way the price amount is display in epilot journeys.","ExternalDocs":null,"ExtendedComments":{},"Deprecated":false,"DeprecationReplacement":"","DeprecationMessage":""},"Input":false,"Output":false,"Extensions":{},"Examples":[],"Format":"","Discriminator":null,"ComplexAny":false,"OutputLocation":"models/shared","ResolvedModel":"PriceCreate","EventStreamEnvelope":false,"ResponseEnvelope":false},"Comments":{"Summary":"","Description":"Defines the way the price amount is display in epilot journeys.","ExternalDocs":null,"ExtendedComments":{},"Deprecated":false,"DeprecationReplacement":"","DeprecationMessage":""},"Annotations":[{"Ignore":false,"FieldName":"price_display_in_journeys"}],"Nullable":false,"Optional":true,"SerializationMethod":null,"ErrorMessage":false,"Const":null,"Default":null,"IsAdditionalProperties":false,"ParameterIndex":null},{"Name":"pricing_model","OriginalName":"pricing_model","Type":{"Name":"PriceCreate_pricing_model","OriginalName":"pricing_model","ContextStack":[{"Type":"refType","Identifier":"Schemas","Used":false,"MustUse":false},{"Type":"refName","Identifier":"PriceCreate","Used":true,"MustUse":false}],"Type":"enum","ItemType":null,"Fields":[],"Validations":{"MinItems":null,"MinLength":null,"Minimum":null,"MaxItems":null,"MaxLength":null,"Maximum":null,"Pattern":null,"UniqueItems":null},"AssociatedTypes":[],"Enum":{"Type":{"Name":"","OriginalName":"","ContextStack":[],"Type":"string","ItemType":null,"Fields":[],"Validations":{"MinItems":null,"MinLength":null,"Minimum":null,"MaxItems":null,"MaxLength":null,"Maximum":null,"Pattern":null,"UniqueItems":null},"AssociatedTypes":[],"Enum":null,"Scope":"","IsComponent":false,"Truncated":false,"Comments":null,"Input":false,"Output":false,"Extensions":{},"Examples":[],"Format":"","Discriminator":null,"ComplexAny":false,"OutputLocation":"","ResolvedModel":"","EventStreamEnvelope":false,"ResponseEnvelope":false},"Values":["per_unit","tiered_volume","tiered_graduated","tiered_flatfee"],"Names":[],"Open":false,"Format":""},"Scope":"shared","IsComponent":false,"Truncated":false,"Comments":{"Summary":"","Description":"Describes how to compute the price per period. Either `per_unit`, `tiered_graduated` or `tiered_volume`.\n- `per_unit` indicates that the fixed amount (specified in unit_amount or unit_amount_decimal) will be charged per unit in quantity\n- `tiered_graduated` indicates that the unit pricing will be computed using tiers attribute. The customer pays the price per unit in every range their purchase rises through.\n- `tiered_volume` indicates that the unit pricing will be computed using tiers attribute. The customer pays the same unit price for all purchased units.\n- `tiered_flatfee` While similar to tiered_volume, tiered flat fee charges for the same price (flat) for the entire range instead using the unit price to multiply the quantity.\n","ExternalDocs":null,"ExtendedComments":{},"Deprecated":false,"DeprecationReplacement":"","DeprecationMessage":""},"Input":false,"Output":false,"Extensions":{},"Examples":[],"Format":"","Discriminator":null,"ComplexAny":false,"OutputLocation":"models/shared","ResolvedModel":"PriceCreate","EventStreamEnvelope":false,"ResponseEnvelope":false},"Comments":{"Summary":"","Description":"Describes how to compute the price per period. Either `per_unit`, `tiered_graduated` or `tiered_volume`.\n- `per_unit` indicates that the fixed amount (specified in unit_amount or unit_amount_decimal) will be charged per unit in quantity\n- `tiered_graduated` indicates that the unit pricing will be computed using tiers attribute. The customer pays the price per unit in every range their purchase rises through.\n- `tiered_volume` indicates that the unit pricing will be computed using tiers attribute. The customer pays the same unit price for all purchased units.\n- `tiered_flatfee` While similar to tiered_volume, tiered flat fee charges for the same price (flat) for the entire range instead using the unit price to multiply the quantity.\n","ExternalDocs":null,"ExtendedComments":{},"Deprecated":false,"DeprecationReplacement":"","DeprecationMessage":""},"Annotations":[{"Ignore":false,"FieldName":"pricing_model"}],"Nullable":false,"Optional":true,"SerializationMethod":null,"ErrorMessage":false,"Const":null,"Default":{"Value":"per_unit"},"IsAdditionalProperties":false,"ParameterIndex":null},{"Name":"renewal_duration_amount","OriginalName":"renewal_duration_amount","Type":{"Name":"","OriginalName":"","ContextStack":[],"Type":"number","ItemType":null,"Fields":[],"Validations":{"MinItems":null,"MinLength":null,"Minimum":null,"MaxItems":null,"MaxLength":null,"Maximum":null,"Pattern":null,"UniqueItems":null},"AssociatedTypes":[],"Enum":null,"Scope":"","IsComponent":false,"Truncated":false,"Comments":null,"Input":false,"Output":false,"Extensions":{},"Examples":[],"Format":"","Discriminator":null,"ComplexAny":false,"OutputLocation":"","ResolvedModel":"","EventStreamEnvelope":false,"ResponseEnvelope":false},"Comments":{"Summary":"","Description":"The renewal period duration","ExternalDocs":null,"ExtendedComments":{},"Deprecated":false,"DeprecationReplacement":"","DeprecationMessage":""},"Annotations":[{"Ignore":false,"FieldName":"renewal_duration_amount"}],"Nullable":false,"Optional":true,"SerializationMethod":null,"ErrorMessage":false,"Const":null,"Default":null,"IsAdditionalProperties":false,"ParameterIndex":null},{"Name":"renewal_duration_unit","OriginalName":"renewal_duration_unit","Type":{"Name":"PriceCreate_renewal_duration_unit","OriginalName":"renewal_duration_unit","ContextStack":[{"Type":"refType","Identifier":"Schemas","Used":false,"MustUse":false},{"Type":"refName","Identifier":"PriceCreate","Used":true,"MustUse":false}],"Type":"enum","ItemType":null,"Fields":[],"Validations":{"MinItems":null,"MinLength":null,"Minimum":null,"MaxItems":null,"MaxLength":null,"Maximum":null,"Pattern":null,"UniqueItems":null},"AssociatedTypes":[],"Enum":{"Type":{"Name":"","OriginalName":"","ContextStack":[],"Type":"string","ItemType":null,"Fields":[],"Validations":{"MinItems":null,"MinLength":null,"Minimum":null,"MaxItems":null,"MaxLength":null,"Maximum":null,"Pattern":null,"UniqueItems":null},"AssociatedTypes":[],"Enum":null,"Scope":"","IsComponent":false,"Truncated":false,"Comments":null,"Input":false,"Output":false,"Extensions":{},"Examples":[],"Format":"","Discriminator":null,"ComplexAny":false,"OutputLocation":"","ResolvedModel":"","EventStreamEnvelope":false,"ResponseEnvelope":false},"Values":["weeks","months","years"],"Names":[],"Open":false,"Format":""},"Scope":"shared","IsComponent":false,"Truncated":false,"Comments":{"Summary":"","Description":"The renewal period duration unit","ExternalDocs":null,"ExtendedComments":{},"Deprecated":false,"DeprecationReplacement":"","DeprecationMessage":""},"Input":false,"Output":false,"Extensions":{},"Examples":[],"Format":"","Discriminator":null,"ComplexAny":false,"OutputLocation":"models/shared","ResolvedModel":"PriceCreate","EventStreamEnvelope":false,"ResponseEnvelope":false},"Comments":{"Summary":"","Description":"The renewal period duration unit","ExternalDocs":null,"ExtendedComments":{},"Deprecated":false,"DeprecationReplacement":"","DeprecationMessage":""},"Annotations":[{"Ignore":false,"FieldName":"renewal_duration_unit"}],"Nullable":false,"Optional":true,"SerializationMethod":null,"ErrorMessage":false,"Const":null,"Default":null,"IsAdditionalProperties":false,"ParameterIndex":null},{"Name":"tax","OriginalName":"tax","Type":{"Name":"","OriginalName":"","ContextStack":[],"Type":"any","ItemType":null,"Fields":[],"Validations":{"MinItems":null,"MinLength":null,"Minimum":null,"MaxItems":null,"MaxLength":null,"Maximum":null,"Pattern":null,"UniqueItems":null},"AssociatedTypes":[],"Enum":null,"Scope":"","IsComponent":false,"Truncated":false,"Comments":null,"Input":false,"Output":false,"Extensions":{},"Examples":[],"Format":"","Discriminator":null,"ComplexAny":false,"OutputLocation":"","ResolvedModel":"","EventStreamEnvelope":false,"ResponseEnvelope":false},"Comments":null,"Annotations":[{"Ignore":false,"FieldName":"tax"}],"Nullable":false,"Optional":true,"SerializationMethod":null,"ErrorMessage":false,"Const":null,"Default":null,"IsAdditionalProperties":false,"ParameterIndex":null},{"Name":"termination_time_amount","OriginalName":"termination_time_amount","Type":{"Name":"","OriginalName":"","ContextStack":[],"Type":"number","ItemType":null,"Fields":[],"Validations":{"MinItems":null,"MinLength":null,"Minimum":null,"MaxItems":null,"MaxLength":null,"Maximum":null,"Pattern":null,"UniqueItems":null},"AssociatedTypes":[],"Enum":null,"Scope":"","IsComponent":false,"Truncated":false,"Comments":null,"Input":false,"Output":false,"Extensions":{},"Examples":[],"Format":"","Discriminator":null,"ComplexAny":false,"OutputLocation":"","ResolvedModel":"","EventStreamEnvelope":false,"ResponseEnvelope":false},"Comments":{"Summary":"","Description":"The termination period duration","ExternalDocs":null,"ExtendedComments":{},"Deprecated":false,"DeprecationReplacement":"","DeprecationMessage":""},"Annotations":[{"Ignore":false,"FieldName":"termination_time_amount"}],"Nullable":false,"Optional":true,"SerializationMethod":null,"ErrorMessage":false,"Const":null,"Default":null,"IsAdditionalProperties":false,"ParameterIndex":null},{"Name":"termination_time_unit","OriginalName":"termination_time_unit","Type":{"Name":"PriceCreate_termination_time_unit","OriginalName":"termination_time_unit","ContextStack":[{"Type":"refType","Identifier":"Schemas","Used":false,"MustUse":false},{"Type":"refName","Identifier":"PriceCreate","Used":true,"MustUse":false}],"Type":"enum","ItemType":null,"Fields":[],"Validations":{"MinItems":null,"MinLength":null,"Minimum":null,"MaxItems":null,"MaxLength":null,"Maximum":null,"Pattern":null,"UniqueItems":null},"AssociatedTypes":[],"Enum":{"Type":{"Name":"","OriginalName":"","ContextStack":[],"Type":"string","ItemType":null,"Fields":[],"Validations":{"MinItems":null,"MinLength":null,"Minimum":null,"MaxItems":null,"MaxLength":null,"Maximum":null,"Pattern":null,"UniqueItems":null},"AssociatedTypes":[],"Enum":null,"Scope":"","IsComponent":false,"Truncated":false,"Comments":null,"Input":false,"Output":false,"Extensions":{},"Examples":[],"Format":"","Discriminator":null,"ComplexAny":false,"OutputLocation":"","ResolvedModel":"","EventStreamEnvelope":false,"ResponseEnvelope":false},"Values":["weeks","months","years"],"Names":[],"Open":false,"Format":""},"Scope":"shared","IsComponent":false,"Truncated":false,"Comments":{"Summary":"","Description":"The termination period duration unit","ExternalDocs":null,"ExtendedComments":{},"Deprecated":false,"DeprecationReplacement":"","DeprecationMessage":""},"Input":false,"Output":false,"Extensions":{},"Examples":[],"Format":"","Discriminator":null,"ComplexAny":false,"OutputLocation":"models/shared","ResolvedModel":"PriceCreate","EventStreamEnvelope":false,"ResponseEnvelope":false},"Comments":{"Summary":"","Description":"The termination period duration unit","ExternalDocs":null,"ExtendedComments":{},"Deprecated":false,"DeprecationReplacement":"","DeprecationMessage":""},"Annotations":[{"Ignore":false,"FieldName":"termination_time_unit"}],"Nullable":false,"Optional":true,"SerializationMethod":null,"ErrorMessage":false,"Const":null,"Default":null,"IsAdditionalProperties":false,"ParameterIndex":null},{"Name":"tiers","OriginalName":"tiers","Type":{"Name":"","OriginalName":"","ContextStack":[],"Type":"array","ItemType":{"Name":"PriceTier","OriginalName":"PriceTier","ContextStack":[{"Type":"refType","Identifier":"Schemas","Used":false,"MustUse":false},{"Type":"refName","Identifier":"PriceTier","Used":false,"MustUse":false},{"Type":"component","Identifier":"true","Used":false,"MustUse":false}],"Type":"class","ItemType":null,"Fields":[{"Name":"display_mode","OriginalName":"display_mode","Type":{"Name":"PriceTierDisplayMode","OriginalName":"PriceTierDisplayMode","ContextStack":[{"Type":"refType","Identifier":"Schemas","Used":false,"MustUse":false},{"Type":"refName","Identifier":"PriceTierDisplayMode","Used":false,"MustUse":false},{"Type":"component","Identifier":"true","Used":false,"MustUse":false}],"Type":"enum","ItemType":null,"Fields":[],"Validations":{"MinItems":null,"MinLength":null,"Minimum":null,"MaxItems":null,"MaxLength":null,"Maximum":null,"Pattern":null,"UniqueItems":null},"AssociatedTypes":[],"Enum":{"Type":{"Name":"","OriginalName":"","ContextStack":[],"Type":"string","ItemType":null,"Fields":[],"Validations":{"MinItems":null,"MinLength":null,"Minimum":null,"MaxItems":null,"MaxLength":null,"Maximum":null,"Pattern":null,"UniqueItems":null},"AssociatedTypes":[],"Enum":null,"Scope":"","IsComponent":false,"Truncated":false,"Comments":null,"Input":false,"Output":false,"Extensions":{},"Examples":[],"Format":"","Discriminator":null,"ComplexAny":false,"OutputLocation":"","ResolvedModel":"","EventStreamEnvelope":false,"ResponseEnvelope":false},"Values":["hidden","on_request"],"Names":[],"Open":false,"Format":""},"Scope":"shared","IsComponent":true,"Truncated":false,"Comments":null,"Input":false,"Output":false,"Extensions":{},"Examples":[],"Format":"","Discriminator":null,"ComplexAny":false,"OutputLocation":"models/shared","ResolvedModel":"PriceTierDisplayMode","EventStreamEnvelope":false,"ResponseEnvelope":false},"Comments":null,"Annotations":[{"Ignore":false,"FieldName":"display_mode"}],"Nullable":false,"Optional":true,"SerializationMethod":null,"ErrorMessage":false,"Const":null,"Default":null,"IsAdditionalProperties":false,"ParameterIndex":null},{"Name":"flat_fee_amount","OriginalName":"flat_fee_amount","Type":{"Name":"","OriginalName":"","ContextStack":[],"Type":"number","ItemType":null,"Fields":[],"Validations":{"MinItems":null,"MinLength":null,"Minimum":null,"MaxItems":null,"MaxLength":null,"Maximum":null,"Pattern":null,"UniqueItems":null},"AssociatedTypes":[],"Enum":null,"Scope":"","IsComponent":false,"Truncated":false,"Comments":null,"Input":false,"Output":false,"Extensions":{},"Examples":[],"Format":"","Discriminator":null,"ComplexAny":false,"OutputLocation":"","ResolvedModel":"","EventStreamEnvelope":false,"ResponseEnvelope":false},"Comments":null,"Annotations":[{"Ignore":false,"FieldName":"flat_fee_amount"}],"Nullable":false,"Optional":true,"SerializationMethod":null,"ErrorMessage":false,"Const":null,"Default":null,"IsAdditionalProperties":false,"ParameterIndex":null},{"Name":"flat_fee_amount_decimal","OriginalName":"flat_fee_amount_decimal","Type":{"Name":"","OriginalName":"","ContextStack":[],"Type":"string","ItemType":null,"Fields":[],"Validations":{"MinItems":null,"MinLength":null,"Minimum":null,"MaxItems":null,"MaxLength":null,"Maximum":null,"Pattern":null,"UniqueItems":null},"AssociatedTypes":[],"Enum":null,"Scope":"","IsComponent":false,"Truncated":false,"Comments":null,"Input":false,"Output":false,"Extensions":{},"Examples":[],"Format":"","Discriminator":null,"ComplexAny":false,"OutputLocation":"","ResolvedModel":"","EventStreamEnvelope":false,"ResponseEnvelope":false},"Comments":null,"Annotations":[{"Ignore":false,"FieldName":"flat_fee_amount_decimal"}],"Nullable":false,"Optional":true,"SerializationMethod":null,"ErrorMessage":false,"Const":null,"Default":null,"IsAdditionalProperties":false,"ParameterIndex":null},{"Name":"unit_amount","OriginalName":"unit_amount","Type":{"Name":"","OriginalName":"","ContextStack":[],"Type":"number","ItemType":null,"Fields":[],"Validations":{"MinItems":null,"MinLength":null,"Minimum":null,"MaxItems":null,"MaxLength":null,"Maximum":null,"Pattern":null,"UniqueItems":null},"AssociatedTypes":[],"Enum":null,"Scope":"","IsComponent":false,"Truncated":false,"Comments":null,"Input":false,"Output":false,"Extensions":{},"Examples":[],"Format":"","Discriminator":null,"ComplexAny":false,"OutputLocation":"","ResolvedModel":"","EventStreamEnvelope":false,"ResponseEnvelope":false},"Comments":null,"Annotations":[{"Ignore":false,"FieldName":"unit_amount"}],"Nullable":false,"Optional":true,"SerializationMethod":null,"ErrorMessage":false,"Const":null,"Default":null,"IsAdditionalProperties":false,"ParameterIndex":null},{"Name":"unit_amount_decimal","OriginalName":"unit_amount_decimal","Type":{"Name":"","OriginalName":"","ContextStack":[],"Type":"string","ItemType":null,"Fields":[],"Validations":{"MinItems":null,"MinLength":null,"Minimum":null,"MaxItems":null,"MaxLength":null,"Maximum":null,"Pattern":null,"UniqueItems":null},"AssociatedTypes":[],"Enum":null,"Scope":"","IsComponent":false,"Truncated":false,"Comments":null,"Input":false,"Output":false,"Extensions":{},"Examples":[],"Format":"","Discriminator":null,"ComplexAny":false,"OutputLocation":"","ResolvedModel":"","EventStreamEnvelope":false,"ResponseEnvelope":false},"Comments":null,"Annotations":[{"Ignore":false,"FieldName":"unit_amount_decimal"}],"Nullable":false,"Optional":true,"SerializationMethod":null,"ErrorMessage":false,"Const":null,"Default":null,"IsAdditionalProperties":false,"ParameterIndex":null},{"Name":"up_to","OriginalName":"up_to","Type":{"Name":"","OriginalName":"","ContextStack":[],"Type":"number","ItemType":null,"Fields":[],"Validations":{"MinItems":null,"MinLength":null,"Minimum":null,"MaxItems":null,"MaxLength":null,"Maximum":null,"Pattern":null,"UniqueItems":null},"AssociatedTypes":[],"Enum":null,"Scope":"","IsComponent":false,"Truncated":false,"Comments":null,"Input":false,"Output":false,"Extensions":{},"Examples":[],"Format":"","Discriminator":null,"ComplexAny":false,"OutputLocation":"","ResolvedModel":"","EventStreamEnvelope":false,"ResponseEnvelope":false},"Comments":null,"Annotations":[{"Ignore":false,"FieldName":"up_to"}],"Nullable":true,"Optional":true,"SerializationMethod":null,"ErrorMessage":false,"Const":null,"Default":null,"IsAdditionalProperties":false,"ParameterIndex":null}],"Validations":{"MinItems":null,"MinLength":null,"Minimum":null,"MaxItems":null,"MaxLength":null,"Maximum":null,"Pattern":null,"UniqueItems":null},"AssociatedTypes":[],"Enum":null,"Scope":"shared","IsComponent":true,"Truncated":false,"Comments":null,"Input":false,"Output":false,"Extensions":{},"Examples":[],"Format":"","Discriminator":null,"ComplexAny":false,"OutputLocation":"models/shared","ResolvedModel":"PriceTier","EventStreamEnvelope":false,"ResponseEnvelope":false},"Fields":[],"Validations":{"MinItems":null,"MinLength":null,"Minimum":null,"MaxItems":null,"MaxLength":null,"Maximum":null,"Pattern":null,"UniqueItems":null},"AssociatedTypes":[],"Enum":null,"Scope":"","IsComponent":false,"Truncated":false,"Comments":null,"Input":false,"Output":false,"Extensions":{},"Examples":[],"Format":"","Discriminator":null,"ComplexAny":false,"OutputLocation":"","ResolvedModel":"","EventStreamEnvelope":false,"ResponseEnvelope":false},"Comments":{"Summary":"","Description":"Defines an array of tiers. Each tier has an upper bound, an unit amount and a flat fee.\n","ExternalDocs":null,"ExtendedComments":{},"Deprecated":false,"DeprecationReplacement":"","DeprecationMessage":""},"Annotations":[{"Ignore":false,"FieldName":"tiers"}],"Nullable":false,"Optional":true,"SerializationMethod":null,"ErrorMessage":false,"Const":null,"Default":null,"IsAdditionalProperties":false,"ParameterIndex":null},{"Name":"type","OriginalName":"type","Type":{"Name":"PriceCreate_type","OriginalName":"type","ContextStack":[{"Type":"refType","Identifier":"Schemas","Used":false,"MustUse":false},{"Type":"refName","Identifier":"PriceCreate","Used":true,"MustUse":false}],"Type":"enum","ItemType":null,"Fields":[],"Validations":{"MinItems":null,"MinLength":null,"Minimum":null,"MaxItems":null,"MaxLength":null,"Maximum":null,"Pattern":null,"UniqueItems":null},"AssociatedTypes":[],"Enum":{"Type":{"Name":"","OriginalName":"","ContextStack":[],"Type":"string","ItemType":null,"Fields":[],"Validations":{"MinItems":null,"MinLength":null,"Minimum":null,"MaxItems":null,"MaxLength":null,"Maximum":null,"Pattern":null,"UniqueItems":null},"AssociatedTypes":[],"Enum":null,"Scope":"","IsComponent":false,"Truncated":false,"Comments":null,"Input":false,"Output":false,"Extensions":{},"Examples":[],"Format":"","Discriminator":null,"ComplexAny":false,"OutputLocation":"","ResolvedModel":"","EventStreamEnvelope":false,"ResponseEnvelope":false},"Values":["one_time","recurring"],"Names":[],"Open":false,"Format":""},"Scope":"shared","IsComponent":false,"Truncated":false,"Comments":{"Summary":"","Description":"One of `one_time` or `recurring` depending on whether the price is for a one-time purchase or a recurring (subscription) purchase.","ExternalDocs":null,"ExtendedComments":{},"Deprecated":false,"DeprecationReplacement":"","DeprecationMessage":""},"Input":false,"Output":false,"Extensions":{},"Examples":[],"Format":"","Discriminator":null,"ComplexAny":false,"OutputLocation":"models/shared","ResolvedModel":"PriceCreate","EventStreamEnvelope":false,"ResponseEnvelope":false},"Comments":{"Summary":"","Description":"One of `one_time` or `recurring` depending on whether the price is for a one-time purchase or a recurring (subscription) purchase.","ExternalDocs":null,"ExtendedComments":{},"Deprecated":false,"DeprecationReplacement":"","DeprecationMessage":""},"Annotations":[{"Ignore":false,"FieldName":"type"}],"Nullable":false,"Optional":true,"SerializationMethod":null,"ErrorMessage":false,"Const":null,"Default":{"Value":"one_time"},"IsAdditionalProperties":false,"ParameterIndex":null},{"Name":"unit","OriginalName":"unit","Type":{"Name":"","OriginalName":"","ContextStack":[],"Type":"string","ItemType":null,"Fields":[],"Validations":{"MinItems":null,"MinLength":null,"Minimum":null,"MaxItems":null,"MaxLength":null,"Maximum":null,"Pattern":null,"UniqueItems":null},"AssociatedTypes":[],"Enum":null,"Scope":"","IsComponent":false,"Truncated":false,"Comments":null,"Input":false,"Output":false,"Extensions":{},"Examples":[],"Format":"","Discriminator":null,"ComplexAny":false,"OutputLocation":"","ResolvedModel":"","EventStreamEnvelope":false,"ResponseEnvelope":false},"Comments":{"Summary":"","Description":"The unit of measurement used for display purposes and possibly for calculations when the price is variable.","ExternalDocs":null,"ExtendedComments":{},"Deprecated":false,"DeprecationReplacement":"","DeprecationMessage":""},"Annotations":[{"Ignore":false,"FieldName":"unit"}],"Nullable":false,"Optional":true,"SerializationMethod":null,"ErrorMessage":false,"Const":null,"Default":null,"IsAdditionalProperties":false,"ParameterIndex":null},{"Name":"unit_amount","OriginalName":"unit_amount","Type":{"Name":"","OriginalName":"","ContextStack":[],"Type":"number","ItemType":null,"Fields":[],"Validations":{"MinItems":null,"MinLength":null,"Minimum":null,"MaxItems":null,"MaxLength":null,"Maximum":null,"Pattern":null,"UniqueItems":null},"AssociatedTypes":[],"Enum":null,"Scope":"","IsComponent":false,"Truncated":false,"Comments":null,"Input":false,"Output":false,"Extensions":{},"Examples":[],"Format":"","Discriminator":null,"ComplexAny":false,"OutputLocation":"","ResolvedModel":"","EventStreamEnvelope":false,"ResponseEnvelope":false},"Comments":{"Summary":"","Description":"The unit amount in cents to be charged, represented as a whole integer if possible.","ExternalDocs":null,"ExtendedComments":{},"Deprecated":false,"DeprecationReplacement":"","DeprecationMessage":""},"Annotations":[{"Ignore":false,"FieldName":"unit_amount"}],"Nullable":false,"Optional":true,"SerializationMethod":null,"ErrorMessage":false,"Const":null,"Default":null,"IsAdditionalProperties":false,"ParameterIndex":null},{"Name":"unit_amount_currency","OriginalName":"unit_amount_currency","Type":{"Name":"","OriginalName":"","ContextStack":[],"Type":"string","ItemType":null,"Fields":[],"Validations":{"MinItems":null,"MinLength":null,"Minimum":null,"MaxItems":null,"MaxLength":null,"Maximum":null,"Pattern":null,"UniqueItems":null},"AssociatedTypes":[],"Enum":null,"Scope":"","IsComponent":false,"Truncated":false,"Comments":null,"Input":false,"Output":false,"Extensions":{},"Examples":[{}],"Format":"","Discriminator":null,"ComplexAny":false,"OutputLocation":"","ResolvedModel":"","EventStreamEnvelope":false,"ResponseEnvelope":false},"Comments":{"Summary":"","Description":"Three-letter ISO currency code, in lowercase.","ExternalDocs":null,"ExtendedComments":{},"Deprecated":false,"DeprecationReplacement":"","DeprecationMessage":""},"Annotations":[{"Ignore":false,"FieldName":"unit_amount_currency"}],"Nullable":false,"Optional":true,"SerializationMethod":null,"ErrorMessage":false,"Const":null,"Default":null,"IsAdditionalProperties":false,"ParameterIndex":null},{"Name":"unit_amount_decimal","OriginalName":"unit_amount_decimal","Type":{"Name":"","OriginalName":"","ContextStack":[],"Type":"string","ItemType":null,"Fields":[],"Validations":{"MinItems":null,"MinLength":null,"Minimum":null,"MaxItems":null,"MaxLength":null,"Maximum":null,"Pattern":null,"UniqueItems":null},"AssociatedTypes":[],"Enum":null,"Scope":"","IsComponent":false,"Truncated":false,"Comments":null,"Input":false,"Output":false,"Extensions":{},"Examples":[],"Format":"","Discriminator":null,"ComplexAny":false,"OutputLocation":"","ResolvedModel":"","EventStreamEnvelope":false,"ResponseEnvelope":false},"Comments":{"Summary":"","Description":"The unit amount in cents to be charged, represented as a decimal string with at most 12 decimal places.","ExternalDocs":null,"ExtendedComments":{},"Deprecated":false,"DeprecationReplacement":"","DeprecationMessage":""},"Annotations":[{"Ignore":false,"FieldName":"unit_amount_decimal"}],"Nullable":false,"Optional":true,"SerializationMethod":null,"ErrorMessage":false,"Const":null,"Default":null,"IsAdditionalProperties":false,"ParameterIndex":null},{"Name":"variable_price","OriginalName":"variable_price","Type":{"Name":"","OriginalName":"","ContextStack":[],"Type":"boolean","ItemType":null,"Fields":[],"Validations":{"MinItems":null,"MinLength":null,"Minimum":null,"MaxItems":null,"MaxLength":null,"Maximum":null,"Pattern":null,"UniqueItems":null},"AssociatedTypes":[],"Enum":null,"Scope":"","IsComponent":false,"Truncated":false,"Comments":null,"Input":false,"Output":false,"Extensions":{},"Examples":[],"Format":"","Discriminator":null,"ComplexAny":false,"OutputLocation":"","ResolvedModel":"","EventStreamEnvelope":false,"ResponseEnvelope":false},"Comments":{"Summary":"","Description":"The flag for prices that can be influenced by external variables such as user input.","ExternalDocs":null,"ExtendedComments":{},"Deprecated":false,"DeprecationReplacement":"","DeprecationMessage":""},"Annotations":[{"Ignore":false,"FieldName":"variable_price"}],"Nullable":false,"Optional":true,"SerializationMethod":null,"ErrorMessage":false,"Const":null,"Default":{"Value":false},"IsAdditionalProperties":false,"ParameterIndex":null}],"Validations":{"MinItems":null,"MinLength":null,"Minimum":null,"MaxItems":null,"MaxLength":null,"Maximum":null,"Pattern":null,"UniqueItems":null},"AssociatedTypes":[],"Enum":null,"Scope":"shared","IsComponent":true,"Truncated":false,"Comments":null,"Input":false,"Output":false,"Extensions":{"x-speakeasy-entity":"Price"},"Examples":[],"Format":"","Discriminator":null,"ComplexAny":false,"OutputLocation":"models/shared","ResolvedModel":"PriceCreate","EventStreamEnvelope":false,"ResponseEnvelope":false},"Validations":{"MaxItems":null,"MaxLength":null,"Maximum":null,"Pattern":null,"UniqueItems":null,"MinItems":null,"MinLength":null,"Minimum":null},"Name":"Price","AssociatedTypes":[],"CircularReference":null,"Extensions":{"x-speakeasy-in-get-request":true,"x-speakeasy-in-get":true,"x-speakeasy-root":true,"x-speakeasy-entity":"Price","x-speakeasy-trace":{"Price#create.req":true},"x-speakeasy-param-computed":true,"x-untouched":true},"Discriminator":null,"Fields":[{"Type":{"OutputLocation":"","IsComponent":false,"Validations":{"MaxLength":null,"Maximum":null,"Pattern":null,"UniqueItems":null,"MinItems":null,"MinLength":null,"Minimum":null,"MaxItems":null},"ResponseEnvelope":false,"Extensions":{"x-untouched":true,"x-speakeasy-param-readonly":true,"x-speakeasy-in-get":true,"x-speakeasy-trace":{"Price#create.resp.id":true},"x-speakeasy-param-computed":true},"Enum":null,"Output":false,"CircularReference":null,"ContextStack":[],"Fields":[],"EventStreamEnvelope":false,"Scope":"","Original":{"Name":"","OriginalName":"","ContextStack":[],"Type":"string","ItemType":null,"Fields":[],"Validations":{"MinItems":null,"MinLength":null,"Minimum":null,"MaxItems":null,"MaxLength":null,"Maximum":null,"Pattern":null,"UniqueItems":null},"AssociatedTypes":[],"Enum":null,"Scope":"","IsComponent":false,"Truncated":false,"Comments":null,"Input":false,"Output":false,"Extensions":{},"Examples":[{}],"Format":"uuid","Discriminator":null,"ComplexAny":false,"OutputLocation":"","ResolvedModel":"","EventStreamEnvelope":false,"ResponseEnvelope":false},"Input":false,"ItemType":null,"Truncated":false,"Name":"","Type":"string","Comments":null,"Discriminator":null,"Examples":[{}],"Format":"uuid","OriginalName":"","AssociatedTypes":[],"ResolvedModel":""},"Name":"_id","Default":null,"Const":null,"Comments":null,"IsAdditionalProperties":false,"ErrorMessage":false,"OriginalName":"_id","Optional":false,"Annotations":[{"Ignore":false,"FieldName":"_id"}],"Nullable":false},{"Nullable":false,"Default":null,"Const":null,"ErrorMessage":false,"OriginalName":"active","Type":{"Type":"boolean","Discriminator":null,"OutputLocation":"","Format":"","ItemType":null,"ResolvedModel":"","Extensions":{"x-speakeasy-trace":{"Price#create.req.active":true},"x-speakeasy-param-computed":true,"x-untouched":true,"x-speakeasy-in-get":true},"AssociatedTypes":[],"Comments":null,"Input":false,"Fields":[],"IsComponent":false,"CircularReference":null,"ResponseEnvelope":false,"Enum":null,"Truncated":false,"Original":{"Name":"","OriginalName":"","ContextStack":[],"Type":"boolean","ItemType":null,"Fields":[],"Validations":{"MinItems":null,"MinLength":null,"Minimum":null,"MaxItems":null,"MaxLength":null,"Maximum":null,"Pattern":null,"UniqueItems":null},"AssociatedTypes":[],"Enum":null,"Scope":"","IsComponent":false,"Truncated":false,"Comments":null,"Input":false,"Output":false,"Extensions":{},"Examples":[],"Format":"","Discriminator":null,"ComplexAny":false,"OutputLocation":"","ResolvedModel":"","EventStreamEnvelope":false,"ResponseEnvelope":false},"OriginalName":"","EventStreamEnvelope":false,"Name":"","Examples":[],"ContextStack":[],"Output":false,"Scope":"","Validations":{"UniqueItems":null,"MinItems":null,"MinLength":null,"Minimum":null,"MaxItems":null,"MaxLength":null,"Maximum":null,"Pattern":null}},"Name":"active","Optional":false,"Comments":{"Description":"Whether the price can be used for new purchases.","ExternalDocs":null,"Summary":"","Deprecated":false,"DeprecationMessage":"","DeprecationReplacement":""},"Annotations":[{"Ignore":false,"FieldName":"active"}],"IsAdditionalProperties":false},{"Type":{"ContextStack":[],"Discriminator":null,"IsComponent":false,"Format":"","ItemType":null,"Examples":[],"Fields":[],"ResolvedModel":"","OriginalName":"","Enum":null,"Original":{"Name":"","OriginalName":"","ContextStack":[],"Type":"number","ItemType":null,"Fields":[],"Validations":{"MinItems":null,"MinLength":null,"Minimum":null,"MaxItems":null,"MaxLength":null,"Maximum":null,"Pattern":null,"UniqueItems":null},"AssociatedTypes":[],"Enum":null,"Scope":"","IsComponent":false,"Truncated":false,"Comments":null,"Input":false,"Output":false,"Extensions":{},"Examples":[],"Format":"","Discriminator":null,"ComplexAny":false,"OutputLocation":"","ResolvedModel":"","EventStreamEnvelope":false,"ResponseEnvelope":false},"CircularReference":null,"ResponseEnvelope":false,"Output":false,"Type":"number","AssociatedTypes":[],"Comments":null,"OutputLocation":"","Extensions":{"x-untouched":true,"x-speakeasy-in-get":true,"x-speakeasy-trace":{"Price#create.req.billing_duration_amount":true},"x-speakeasy-param-computed":true},"Validations":{"MaxLength":null,"Maximum":null,"Pattern":null,"UniqueItems":null,"MinItems":null,"MinLength":null,"Minimum":null,"MaxItems":null},"Name":"","Truncated":false,"EventStreamEnvelope":false,"Input":false,"Scope":""},"Name":"billing_duration_amount","Nullable":false,"Optional":true,"Default":null,"Annotations":[{"Ignore":false,"FieldName":"billing_duration_amount"}],"OriginalName":"billing_duration_amount","Const":null,"Comments":{"Description":"The billing period duration","ExternalDocs":null,"Summary":"","Deprecated":false,"DeprecationMessage":"","DeprecationReplacement":""},"IsAdditionalProperties":false,"ErrorMessage":false},{"Annotations":[{"Ignore":false,"FieldName":"billing_duration_unit"}],"ErrorMessage":false,"Name":"billing_duration_unit","Nullable":false,"Default":null,"Const":null,"Comments":{"DeprecationReplacement":"","Description":"The billing period duration unit","ExternalDocs":null,"Summary":"","Deprecated":false,"DeprecationMessage":""},"IsAdditionalProperties":false,"OriginalName":"billing_duration_unit","Type":{"IsComponent":false,"ResolvedModel":"PriceCreate","Discriminator":null,"Name":"PriceCreate_billing_duration_unit","Truncated":false,"OutputLocation":"models/shared","Type":"enum","Format":"","OriginalName":"billing_duration_unit","Scope":"shared","CircularReference":null,"Comments":{"Description":"The billing period duration unit","ExternalDocs":null,"ExtendedComments":{},"Deprecated":false,"DeprecationReplacement":"","DeprecationMessage":"","Summary":""},"Fields":[],"Output":false,"EventStreamEnvelope":false,"Original":{"Name":"PriceCreate_billing_duration_unit","OriginalName":"billing_duration_unit","ContextStack":[{"Type":"refType","Identifier":"Schemas","Used":false,"MustUse":false},{"Type":"refName","Identifier":"PriceCreate","Used":true,"MustUse":false}],"Type":"enum","ItemType":null,"Fields":[],"Validations":{"MinItems":null,"MinLength":null,"Minimum":null,"MaxItems":null,"MaxLength":null,"Maximum":null,"Pattern":null,"UniqueItems":null},"AssociatedTypes":[],"Enum":{"Type":{"Name":"","OriginalName":"","ContextStack":[],"Type":"string","ItemType":null,"Fields":[],"Validations":{"MinItems":null,"MinLength":null,"Minimum":null,"MaxItems":null,"MaxLength":null,"Maximum":null,"Pattern":null,"UniqueItems":null},"AssociatedTypes":[],"Enum":null,"Scope":"","IsComponent":false,"Truncated":false,"Comments":null,"Input":false,"Output":false,"Extensions":{},"Examples":[],"Format":"","Discriminator":null,"ComplexAny":false,"OutputLocation":"","ResolvedModel":"","EventStreamEnvelope":false,"ResponseEnvelope":false},"Values":["weeks","months","years"],"Names":[],"Open":false,"Format":""},"Scope":"shared","IsComponent":false,"Truncated":false,"Comments":{"Summary":"","Description":"The billing period duration unit","ExternalDocs":null,"ExtendedComments":{},"Deprecated":false,"DeprecationReplacement":"","DeprecationMessage":""},"Input":false,"Output":false,"Extensions":{},"Examples":[],"Format":"","Discriminator":null,"ComplexAny":false,"OutputLocation":"models/shared","ResolvedModel":"PriceCreate","EventStreamEnvelope":false,"ResponseEnvelope":false},"Extensions":{"x-speakeasy-trace":{"Price#create.req.billing_duration_unit":true},"x-speakeasy-param-computed":true,"x-untouched":true,"x-speakeasy-in-get":true},"AssociatedTypes":[],"Validations":{"MaxLength":null,"Maximum":null,"Pattern":null,"UniqueItems":null,"MinItems":null,"MinLength":null,"Minimum":null,"MaxItems":null},"ResponseEnvelope":false,"ItemType":null,"ContextStack":[{"Type":"refType","Identifier":"Schemas","Used":false,"MustUse":false},{"Type":"refName","Identifier":"PriceCreate","Used":true,"MustUse":false}],"Enum":{"Open":false,"Names":[],"Values":["weeks","months","years"],"Type":{"ResolvedModel":"","AssociatedTypes":[],"Fields":[],"IsComponent":false,"Truncated":false,"Input":false,"ItemType":null,"Discriminator":null,"ContextStack":[],"Type":"string","Enum":null,"CircularReference":null,"ResponseEnvelope":false,"Validations":{"MaxItems":null,"MaxLength":null,"Maximum":null,"Pattern":null,"UniqueItems":null,"MinItems":null,"MinLength":null,"Minimum":null},"EventStreamEnvelope":false,"OriginalName":"","Output":false,"Scope":"","Extensions":{},"Examples":[],"Original":{"Name":"","OriginalName":"","ContextStack":[],"Type":"string","ItemType":null,"Fields":[],"Validations":{"MinItems":null,"MinLength":null,"Minimum":null,"MaxItems":null,"MaxLength":null,"Maximum":null,"Pattern":null,"UniqueItems":null},"AssociatedTypes":[],"Enum":null,"Scope":"","IsComponent":false,"Truncated":false,"Comments":null,"Input":false,"Output":false,"Extensions":{},"Examples":[],"Format":"","Discriminator":null,"ComplexAny":false,"OutputLocation":"","ResolvedModel":"","EventStreamEnvelope":false,"ResponseEnvelope":false},"OutputLocation":"","Name":"","Comments":null,"Format":""}},"Examples":[],"Input":false},"Optional":true},{"Name":"description","Const":null,"Comments":{"ExternalDocs":null,"Summary":"","Deprecated":false,"DeprecationMessage":"","DeprecationReplacement":"","Description":"A brief description of the price."},"Annotations":[{"Ignore":false,"FieldName":"description"}],"IsAdditionalProperties":false,"ErrorMessage":false,"OriginalName":"description","Type":{"Type":"string","Extensions":{"x-speakeasy-trace":{"Price#create.req.description":true},"x-speakeasy-param-computed":true,"x-untouched":true,"x-speakeasy-in-get":true},"AssociatedTypes":[],"Examples":[],"ContextStack":[],"Truncated":false,"Validations":{"MinLength":null,"Minimum":null,"MaxItems":null,"MaxLength":null,"Maximum":null,"Pattern":null,"UniqueItems":null,"MinItems":null},"ResponseEnvelope":false,"Original":{"Name":"","OriginalName":"","ContextStack":[],"Type":"string","ItemType":null,"Fields":[],"Validations":{"MinItems":null,"MinLength":null,"Minimum":null,"MaxItems":null,"MaxLength":null,"Maximum":null,"Pattern":null,"UniqueItems":null},"AssociatedTypes":[],"Enum":null,"Scope":"","IsComponent":false,"Truncated":false,"Comments":null,"Input":false,"Output":false,"Extensions":{},"Examples":[],"Format":"","Discriminator":null,"ComplexAny":false,"OutputLocation":"","ResolvedModel":"","EventStreamEnvelope":false,"ResponseEnvelope":false},"IsComponent":false,"Format":"","OriginalName":"","ResolvedModel":"","ItemType":null,"Fields":[],"Comments":null,"OutputLocation":"","Name":"","Enum":null,"Discriminator":null,"Input":false,"Output":false,"Scope":"","CircularReference":null,"EventStreamEnvelope":false},"Nullable":false,"Optional":false,"Default":null},{"OriginalName":"is_composite_price","Type":{"Discriminator":null,"ItemType":null,"Validations":{"MinItems":null,"MinLength":null,"Minimum":null,"MaxItems":null,"MaxLength":null,"Maximum":null,"Pattern":null,"UniqueItems":null},"Original":{"Name":"","OriginalName":"","ContextStack":[],"Type":"boolean","ItemType":null,"Fields":[],"Validations":{"MinItems":null,"MinLength":null,"Minimum":null,"MaxItems":null,"MaxLength":null,"Maximum":null,"Pattern":null,"UniqueItems":null},"AssociatedTypes":[],"Enum":null,"Scope":"","IsComponent":false,"Truncated":false,"Comments":null,"Input":false,"Output":false,"Extensions":{},"Examples":[],"Format":"","Discriminator":null,"ComplexAny":false,"OutputLocation":"","ResolvedModel":"","EventStreamEnvelope":false,"ResponseEnvelope":false},"OriginalName":"","OutputLocation":"","Format":"","Extensions":{"x-speakeasy-param-computed":true,"x-untouched":true,"x-speakeasy-in-get":true,"x-speakeasy-trace":{"Price#create.req.is_composite_price":true}},"Scope":"","CircularReference":null,"EventStreamEnvelope":false,"ResponseEnvelope":false,"ContextStack":[],"Output":false,"Truncated":false,"Fields":[],"Input":false,"IsComponent":false,"Type":"boolean","Enum":null,"Comments":null,"Examples":[],"ResolvedModel":"","Name":"","AssociatedTypes":[]},"Default":null,"Const":null,"IsAdditionalProperties":false,"ErrorMessage":false,"Name":"is_composite_price","Nullable":false,"Optional":true,"Comments":{"Description":"The flag for prices that contain price components.","ExternalDocs":null,"Summary":"","Deprecated":false,"DeprecationMessage":"","DeprecationReplacement":""},"Annotations":[{"Ignore":false,"FieldName":"is_composite_price"}]},{"Type":{"Input":false,"CircularReference":null,"Fields":[],"Scope":"","Validations":{"MinLength":null,"Minimum":null,"MaxItems":null,"MaxLength":null,"Maximum":null,"Pattern":null,"UniqueItems":null,"MinItems":null},"ResponseEnvelope":false,"Enum":null,"Examples":[],"EventStreamEnvelope":false,"Discriminator":null,"OutputLocation":"","ContextStack":[],"Comments":null,"Output":false,"OriginalName":"","ItemType":null,"ResolvedModel":"","Original":{"Name":"","OriginalName":"","ContextStack":[],"Type":"boolean","ItemType":null,"Fields":[],"Validations":{"MinItems":null,"MinLength":null,"Minimum":null,"MaxItems":null,"MaxLength":null,"Maximum":null,"Pattern":null,"UniqueItems":null},"AssociatedTypes":[],"Enum":null,"Scope":"","IsComponent":false,"Truncated":false,"Comments":null,"Input":false,"Output":false,"Extensions":{},"Examples":[],"Format":"","Discriminator":null,"ComplexAny":false,"OutputLocation":"","ResolvedModel":"","EventStreamEnvelope":false,"ResponseEnvelope":false},"Name":"","Extensions":{"x-speakeasy-in-get":true,"x-speakeasy-trace":{"Price#create.req.is_tax_inclusive":true},"x-speakeasy-param-computed":true,"x-untouched":true},"Format":"","IsComponent":false,"Type":"boolean","AssociatedTypes":[],"Truncated":false},"Name":"is_tax_inclusive","Nullable":false,"Optional":true,"Const":null,"ErrorMessage":false,"OriginalName":"is_tax_inclusive","Default":{"Value":false},"Comments":{"DeprecationReplacement":"","Description":"Specifies whether the price is considered `inclusive` of taxes or not.","ExternalDocs":null,"Summary":"","Deprecated":false,"DeprecationMessage":""},"Annotations":[{"Ignore":false,"FieldName":"is_tax_inclusive"}],"IsAdditionalProperties":false},{"Comments":{"Description":"A detailed description of the price. This is shown on the order document and order table. Multi-line supported.","ExternalDocs":null,"Summary":"","Deprecated":false,"DeprecationMessage":"","DeprecationReplacement":""},"Annotations":[{"Ignore":false,"FieldName":"long_description"}],"ErrorMessage":false,"OriginalName":"long_description","Name":"long_description","Default":null,"Const":null,"Type":{"Discriminator":null,"ItemType":null,"Extensions":{"x-speakeasy-trace":{"Price#create.req.long_description":true},"x-speakeasy-param-computed":true,"x-untouched":true,"x-speakeasy-in-get":true},"Input":false,"OutputLocation":"","Name":"","Examples":[],"IsComponent":false,"ResolvedModel":"","Truncated":false,"OriginalName":"","Type":"string","Comments":null,"Scope":"","Output":false,"CircularReference":null,"EventStreamEnvelope":false,"Original":{"Name":"","OriginalName":"","ContextStack":[],"Type":"string","ItemType":null,"Fields":[],"Validations":{"MinItems":null,"MinLength":null,"Minimum":null,"MaxItems":null,"MaxLength":null,"Maximum":null,"Pattern":null,"UniqueItems":null},"AssociatedTypes":[],"Enum":null,"Scope":"","IsComponent":false,"Truncated":false,"Comments":null,"Input":false,"Output":false,"Extensions":{},"Examples":[],"Format":"","Discriminator":null,"ComplexAny":false,"OutputLocation":"","ResolvedModel":"","EventStreamEnvelope":false,"ResponseEnvelope":false},"ContextStack":[],"AssociatedTypes":[],"Format":"","Validations":{"MinLength":null,"Minimum":null,"MaxItems":null,"MaxLength":null,"Maximum":null,"Pattern":null,"UniqueItems":null,"MinItems":null},"ResponseEnvelope":false,"Enum":null,"Fields":[]},"Nullable":false,"Optional":true,"IsAdditionalProperties":false},{"IsAdditionalProperties":false,"ErrorMessage":false,"OriginalName":"notice_time_amount","Type":{"ResolvedModel":"","Type":"number","Comments":null,"Input":false,"Scope":"","Format":"","OriginalName":"","Enum":null,"Output":false,"Truncated":false,"OutputLocation":"","ContextStack":[],"AssociatedTypes":[],"Extensions":{"x-speakeasy-trace":{"Price#create.req.notice_time_amount":true},"x-speakeasy-param-computed":true,"x-untouched":true,"x-speakeasy-in-get":true},"Fields":[],"ResponseEnvelope":false,"Name":"","Discriminator":null,"ItemType":null,"Validations":{"UniqueItems":null,"MinItems":null,"MinLength":null,"Minimum":null,"MaxItems":null,"MaxLength":null,"Maximum":null,"Pattern":null},"IsComponent":false,"EventStreamEnvelope":false,"Original":{"Name":"","OriginalName":"","ContextStack":[],"Type":"number","ItemType":null,"Fields":[],"Validations":{"MinItems":null,"MinLength":null,"Minimum":null,"MaxItems":null,"MaxLength":null,"Maximum":null,"Pattern":null,"UniqueItems":null},"AssociatedTypes":[],"Enum":null,"Scope":"","IsComponent":false,"Truncated":false,"Comments":null,"Input":false,"Output":false,"Extensions":{},"Examples":[],"Format":"","Discriminator":null,"ComplexAny":false,"OutputLocation":"","ResolvedModel":"","EventStreamEnvelope":false,"ResponseEnvelope":false},"Examples":[],"CircularReference":null},"Name":"notice_time_amount","Optional":true,"Annotations":[{"Ignore":false,"FieldName":"notice_time_amount"}],"Nullable":false,"Default":null,"Const":null,"Comments":{"DeprecationMessage":"","DeprecationReplacement":"","Description":"The notice period duration","ExternalDocs":null,"Summary":"","Deprecated":false}},{"Name":"notice_time_unit","Annotations":[{"Ignore":false,"FieldName":"notice_time_unit"}],"IsAdditionalProperties":false,"ErrorMessage":false,"Comments":{"Deprecated":false,"DeprecationMessage":"","DeprecationReplacement":"","Description":"The notice period duration unit","ExternalDocs":null,"Summary":""},"OriginalName":"notice_time_unit","Type":{"IsComponent":false,"EventStreamEnvelope":false,"ResponseEnvelope":false,"Validations":{"MinItems":null,"MinLength":null,"Minimum":null,"MaxItems":null,"MaxLength":null,"Maximum":null,"Pattern":null,"UniqueItems":null},"ResolvedModel":"PriceCreate","Enum":{"Type":{"Output":false,"OutputLocation":"","Enum":null,"IsComponent":false,"Scope":"","CircularReference":null,"Original":{"Name":"","OriginalName":"","ContextStack":[],"Type":"string","ItemType":null,"Fields":[],"Validations":{"MinItems":null,"MinLength":null,"Minimum":null,"MaxItems":null,"MaxLength":null,"Maximum":null,"Pattern":null,"UniqueItems":null},"AssociatedTypes":[],"Enum":null,"Scope":"","IsComponent":false,"Truncated":false,"Comments":null,"Input":false,"Output":false,"Extensions":{},"Examples":[],"Format":"","Discriminator":null,"ComplexAny":false,"OutputLocation":"","ResolvedModel":"","EventStreamEnvelope":false,"ResponseEnvelope":false},"ContextStack":[],"Type":"string","AssociatedTypes":[],"Name":"","Validations":{"MinItems":null,"MinLength":null,"Minimum":null,"MaxItems":null,"MaxLength":null,"Maximum":null,"Pattern":null,"UniqueItems":null},"ItemType":null,"ResponseEnvelope":false,"Comments":null,"Format":"","OriginalName":"","Examples":[],"Input":false,"Truncated":false,"EventStreamEnvelope":false,"Extensions":{},"Discriminator":null,"Fields":[],"ResolvedModel":""},"Open":false,"Names":[],"Values":["weeks","months","years"]},"OriginalName":"notice_time_unit","Comments":{"Description":"The notice period duration unit","ExternalDocs":null,"ExtendedComments":{},"Deprecated":false,"DeprecationReplacement":"","DeprecationMessage":"","Summary":""},"Discriminator":null,"Fields":[],"CircularReference":null,"Format":"","Output":false,"OutputLocation":"models/shared","Type":"enum","ItemType":null,"Scope":"shared","Examples":[],"Name":"PriceCreate_notice_time_unit","AssociatedTypes":[],"Truncated":false,"Original":{"Name":"PriceCreate_notice_time_unit","OriginalName":"notice_time_unit","ContextStack":[{"Type":"refType","Identifier":"Schemas","Used":false,"MustUse":false},{"Type":"refName","Identifier":"PriceCreate","Used":true,"MustUse":false}],"Type":"enum","ItemType":null,"Fields":[],"Validations":{"MinItems":null,"MinLength":null,"Minimum":null,"MaxItems":null,"MaxLength":null,"Maximum":null,"Pattern":null,"UniqueItems":null},"AssociatedTypes":[],"Enum":{"Type":{"Name":"","OriginalName":"","ContextStack":[],"Type":"string","ItemType":null,"Fields":[],"Validations":{"MinItems":null,"MinLength":null,"Minimum":null,"MaxItems":null,"MaxLength":null,"Maximum":null,"Pattern":null,"UniqueItems":null},"AssociatedTypes":[],"Enum":null,"Scope":"","IsComponent":false,"Truncated":false,"Comments":null,"Input":false,"Output":false,"Extensions":{},"Examples":[],"Format":"","Discriminator":null,"ComplexAny":false,"OutputLocation":"","ResolvedModel":"","EventStreamEnvelope":false,"ResponseEnvelope":false},"Values":["weeks","months","years"],"Names":[],"Open":false,"Format":""},"Scope":"shared","IsComponent":false,"Truncated":false,"Comments":{"Summary":"","Description":"The notice period duration unit","ExternalDocs":null,"ExtendedComments":{},"Deprecated":false,"DeprecationReplacement":"","DeprecationMessage":""},"Input":false,"Output":false,"Extensions":{},"Examples":[],"Format":"","Discriminator":null,"ComplexAny":false,"OutputLocation":"models/shared","ResolvedModel":"PriceCreate","EventStreamEnvelope":false,"ResponseEnvelope":false},"Input":false,"ContextStack":[{"Type":"refType","Identifier":"Schemas","Used":false,"MustUse":false},{"Type":"refName","Identifier":"PriceCreate","Used":true,"MustUse":false}],"Extensions":{"x-speakeasy-trace":{"Price#create.req.notice_time_unit":true},"x-speakeasy-param-computed":true,"x-untouched":true,"x-speakeasy-in-get":true}},"Nullable":false,"Optional":true,"Default":null,"Const":null},{"Annotations":[{"Ignore":false,"FieldName":"price_components"}],"ErrorMessage":false,"Type":{"ResolvedModel":"PriceCreate","OutputLocation":"models/shared","ContextStack":[{"Type":"refType","Identifier":"Schemas","Used":false,"MustUse":false},{"Type":"refName","Identifier":"PriceCreate","Used":true,"MustUse":false}],"AssociatedTypes":[],"Discriminator":null,"IsComponent":false,"Format":"","ItemType":null,"Original":{"Name":"PriceCreate_price_components","OriginalName":"price_components","ContextStack":[{"Type":"refType","Identifier":"Schemas","Used":false,"MustUse":false},{"Type":"refName","Identifier":"PriceCreate","Used":true,"MustUse":false}],"Type":"class","ItemType":null,"Fields":[{"Name":"$relation","OriginalName":"$relation","Type":{"Name":"","OriginalName":"","ContextStack":[],"Type":"array","ItemType":{"Name":"PriceComponentRelation","OriginalName":"PriceComponentRelation","ContextStack":[{"Type":"refType","Identifier":"Schemas","Used":false,"MustUse":false},{"Type":"refName","Identifier":"PriceComponentRelation","Used":false,"MustUse":false},{"Type":"component","Identifier":"true","Used":false,"MustUse":false}],"Type":"class","ItemType":null,"Fields":[{"Name":"_tags","OriginalName":"_tags","Type":{"Name":"","OriginalName":"","ContextStack":[],"Type":"array","ItemType":{"Name":"","OriginalName":"","ContextStack":[],"Type":"string","ItemType":null,"Fields":[],"Validations":{"MinItems":null,"MinLength":null,"Minimum":null,"MaxItems":null,"MaxLength":null,"Maximum":null,"Pattern":null,"UniqueItems":null},"AssociatedTypes":[],"Enum":null,"Scope":"","IsComponent":false,"Truncated":false,"Comments":null,"Input":false,"Output":false,"Extensions":{},"Examples":[],"Format":"","Discriminator":null,"ComplexAny":false,"OutputLocation":"","ResolvedModel":"","EventStreamEnvelope":false,"ResponseEnvelope":false},"Fields":[],"Validations":{"MinItems":null,"MinLength":null,"Minimum":null,"MaxItems":null,"MaxLength":null,"Maximum":null,"Pattern":null,"UniqueItems":null},"AssociatedTypes":[],"Enum":null,"Scope":"","IsComponent":false,"Truncated":false,"Comments":null,"Input":false,"Output":false,"Extensions":{},"Examples":[],"Format":"","Discriminator":null,"ComplexAny":false,"OutputLocation":"","ResolvedModel":"","EventStreamEnvelope":false,"ResponseEnvelope":false},"Comments":{"Summary":"","Description":"An arbitrary set of tags attached to the composite price - component relation","ExternalDocs":null,"ExtendedComments":{},"Deprecated":false,"DeprecationReplacement":"","DeprecationMessage":""},"Annotations":[{"Ignore":false,"FieldName":"_tags"}],"Nullable":false,"Optional":true,"SerializationMethod":null,"ErrorMessage":false,"Const":null,"Default":null,"IsAdditionalProperties":false,"ParameterIndex":null},{"Name":"entity_id","OriginalName":"entity_id","Type":{"Name":"","OriginalName":"","ContextStack":[],"Type":"string","ItemType":null,"Fields":[],"Validations":{"MinItems":null,"MinLength":null,"Minimum":null,"MaxItems":null,"MaxLength":null,"Maximum":null,"Pattern":null,"UniqueItems":null},"AssociatedTypes":[],"Enum":null,"Scope":"","IsComponent":false,"Truncated":false,"Comments":null,"Input":false,"Output":false,"Extensions":{},"Examples":[],"Format":"","Discriminator":null,"ComplexAny":false,"OutputLocation":"","ResolvedModel":"","EventStreamEnvelope":false,"ResponseEnvelope":false},"Comments":{"Summary":"","Description":"The id of the price component","ExternalDocs":null,"ExtendedComments":{},"Deprecated":false,"DeprecationReplacement":"","DeprecationMessage":""},"Annotations":[{"Ignore":false,"FieldName":"entity_id"}],"Nullable":false,"Optional":true,"SerializationMethod":null,"ErrorMessage":false,"Const":null,"Default":null,"IsAdditionalProperties":false,"ParameterIndex":null}],"Validations":{"MinItems":null,"MinLength":null,"Minimum":null,"MaxItems":null,"MaxLength":null,"Maximum":null,"Pattern":null,"UniqueItems":null},"AssociatedTypes":[],"Enum":null,"Scope":"shared","IsComponent":true,"Truncated":false,"Comments":null,"Input":false,"Output":false,"Extensions":{},"Examples":[],"Format":"","Discriminator":null,"ComplexAny":false,"OutputLocation":"models/shared","ResolvedModel":"PriceComponentRelation","EventStreamEnvelope":false,"ResponseEnvelope":false},"Fields":[],"Validations":{"MinItems":null,"MinLength":null,"Minimum":null,"MaxItems":null,"MaxLength":null,"Maximum":null,"Pattern":null,"UniqueItems":null},"AssociatedTypes":[],"Enum":null,"Scope":"","IsComponent":false,"Truncated":false,"Comments":null,"Input":false,"Output":false,"Extensions":{},"Examples":[],"Format":"","Discriminator":null,"ComplexAny":false,"OutputLocation":"","ResolvedModel":"","EventStreamEnvelope":false,"ResponseEnvelope":false},"Comments":null,"Annotations":[{"Ignore":false,"FieldName":"$relation"}],"Nullable":false,"Optional":true,"SerializationMethod":null,"ErrorMessage":false,"Const":null,"Default":null,"IsAdditionalProperties":false,"ParameterIndex":null}],"Validations":{"MinItems":null,"MinLength":null,"Minimum":null,"MaxItems":null,"MaxLength":null,"Maximum":null,"Pattern":null,"UniqueItems":null},"AssociatedTypes":[],"Enum":null,"Scope":"shared","IsComponent":false,"Truncated":false,"Comments":{"Summary":"","Description":"A set of [price](/api/pricing#tag/simple_price_schema) components that define the composite price.","ExternalDocs":null,"ExtendedComments":{},"Deprecated":false,"DeprecationReplacement":"","DeprecationMessage":""},"Input":false,"Output":false,"Extensions":{},"Examples":[],"Format":"","Discriminator":null,"ComplexAny":false,"OutputLocation":"models/shared","ResolvedModel":"PriceCreate","EventStreamEnvelope":false,"ResponseEnvelope":false},"Type":"class","Extensions":{"Symbol":"PriceCreatePriceComponents","x-speakeasy-trace":{"Price#create.req.price_components":true},"x-speakeasy-param-computed":true,"x-untouched":true,"x-speakeasy-in-get":true,"x-speakeasy-parent-require-to-not-null":true},"Comments":{"Deprecated":false,"DeprecationReplacement":"","DeprecationMessage":"","Summary":"","Description":"A set of [price](/api/pricing#tag/simple_price_schema) components that define the composite price.","ExternalDocs":null,"ExtendedComments":{}},"Input":false,"Validations":{"MaxLength":null,"Maximum":null,"Pattern":null,"UniqueItems":null,"MinItems":null,"MinLength":null,"Minimum":null,"MaxItems":null},"EventStreamEnvelope":false,"Name":"PriceCreate_price_components","CircularReference":null,"ResponseEnvelope":false,"Truncated":false,"OriginalName":"price_components","Examples":[],"Fields":[{"ErrorMessage":false,"OriginalName":"$relation","Nullable":false,"Optional":true,"Annotations":[{"Ignore":false,"FieldName":"$relation"}],"Comments":null,"IsAdditionalProperties":false,"Type":{"ContextStack":[],"Enum":null,"Discriminator":null,"Truncated":false,"Validations":{"MinItems":null,"MinLength":null,"Minimum":null,"MaxItems":null,"MaxLength":null,"Maximum":null,"Pattern":null,"UniqueItems":null},"CircularReference":null,"Original":{"Name":"","OriginalName":"","ContextStack":[],"Type":"array","ItemType":{"Name":"PriceComponentRelation","OriginalName":"PriceComponentRelation","ContextStack":[{"Type":"refType","Identifier":"Schemas","Used":false,"MustUse":false},{"Type":"refName","Identifier":"PriceComponentRelation","Used":false,"MustUse":false},{"Type":"component","Identifier":"true","Used":false,"MustUse":false}],"Type":"class","ItemType":null,"Fields":[{"Name":"_tags","OriginalName":"_tags","Type":{"Name":"","OriginalName":"","ContextStack":[],"Type":"array","ItemType":{"Name":"","OriginalName":"","ContextStack":[],"Type":"string","ItemType":null,"Fields":[],"Validations":{"MinItems":null,"MinLength":null,"Minimum":null,"MaxItems":null,"MaxLength":null,"Maximum":null,"Pattern":null,"UniqueItems":null},"AssociatedTypes":[],"Enum":null,"Scope":"","IsComponent":false,"Truncated":false,"Comments":null,"Input":false,"Output":false,"Extensions":{},"Examples":[],"Format":"","Discriminator":null,"ComplexAny":false,"OutputLocation":"","ResolvedModel":"","EventStreamEnvelope":false,"ResponseEnvelope":false},"Fields":[],"Validations":{"MinItems":null,"MinLength":null,"Minimum":null,"MaxItems":null,"MaxLength":null,"Maximum":null,"Pattern":null,"UniqueItems":null},"AssociatedTypes":[],"Enum":null,"Scope":"","IsComponent":false,"Truncated":false,"Comments":null,"Input":false,"Output":false,"Extensions":{},"Examples":[],"Format":"","Discriminator":null,"ComplexAny":false,"OutputLocation":"","ResolvedModel":"","EventStreamEnvelope":false,"ResponseEnvelope":false},"Comments":{"Summary":"","Description":"An arbitrary set of tags attached to the composite price - component relation","ExternalDocs":null,"ExtendedComments":{},"Deprecated":false,"DeprecationReplacement":"","DeprecationMessage":""},"Annotations":[{"Ignore":false,"FieldName":"_tags"}],"Nullable":false,"Optional":true,"SerializationMethod":null,"ErrorMessage":false,"Const":null,"Default":null,"IsAdditionalProperties":false,"ParameterIndex":null},{"Name":"entity_id","OriginalName":"entity_id","Type":{"Name":"","OriginalName":"","ContextStack":[],"Type":"string","ItemType":null,"Fields":[],"Validations":{"MinItems":null,"MinLength":null,"Minimum":null,"MaxItems":null,"MaxLength":null,"Maximum":null,"Pattern":null,"UniqueItems":null},"AssociatedTypes":[],"Enum":null,"Scope":"","IsComponent":false,"Truncated":false,"Comments":null,"Input":false,"Output":false,"Extensions":{},"Examples":[],"Format":"","Discriminator":null,"ComplexAny":false,"OutputLocation":"","ResolvedModel":"","EventStreamEnvelope":false,"ResponseEnvelope":false},"Comments":{"Summary":"","Description":"The id of the price component","ExternalDocs":null,"ExtendedComments":{},"Deprecated":false,"DeprecationReplacement":"","DeprecationMessage":""},"Annotations":[{"Ignore":false,"FieldName":"entity_id"}],"Nullable":false,"Optional":true,"SerializationMethod":null,"ErrorMessage":false,"Const":null,"Default":null,"IsAdditionalProperties":false,"ParameterIndex":null}],"Validations":{"MinItems":null,"MinLength":null,"Minimum":null,"MaxItems":null,"MaxLength":null,"Maximum":null,"Pattern":null,"UniqueItems":null},"AssociatedTypes":[],"Enum":null,"Scope":"shared","IsComponent":true,"Truncated":false,"Comments":null,"Input":false,"Output":false,"Extensions":{},"Examples":[],"Format":"","Discriminator":null,"ComplexAny":false,"OutputLocation":"models/shared","ResolvedModel":"PriceComponentRelation","EventStreamEnvelope":false,"ResponseEnvelope":false},"Fields":[],"Validations":{"MinItems":null,"MinLength":null,"Minimum":null,"MaxItems":null,"MaxLength":null,"Maximum":null,"Pattern":null,"UniqueItems":null},"AssociatedTypes":[],"Enum":null,"Scope":"","IsComponent":false,"Truncated":false,"Comments":null,"Input":false,"Output":false,"Extensions":{},"Examples":[],"Format":"","Discriminator":null,"ComplexAny":false,"OutputLocation":"","ResolvedModel":"","EventStreamEnvelope":false,"ResponseEnvelope":false},"OriginalName":"","AssociatedTypes":[],"Fields":[],"Input":false,"Name":"","Format":"","ItemType":{"Output":false,"Truncated":false,"ItemType":null,"ResponseEnvelope":false,"OutputLocation":"models/shared","Examples":[],"Validations":{"MinItems":null,"MinLength":null,"Minimum":null,"MaxItems":null,"MaxLength":null,"Maximum":null,"Pattern":null,"UniqueItems":null},"Fields":[{"Name":"_tags","Comments":{"ExternalDocs":null,"Summary":"","Deprecated":false,"DeprecationMessage":"","DeprecationReplacement":"","Description":"An arbitrary set of tags attached to the composite price - component relation"},"ErrorMessage":false,"OriginalName":"_tags","Nullable":false,"Optional":true,"Default":null,"Const":null,"Annotations":[{"Ignore":false,"FieldName":"_tags"}],"IsAdditionalProperties":false,"Type":{"OutputLocation":"","AssociatedTypes":[],"Scope":"","Type":"array","Examples":[],"Discriminator":null,"Fields":[],"Format":"","ItemType":{"Validations":{"MinItems":null,"MinLength":null,"Minimum":null,"MaxItems":null,"MaxLength":null,"Maximum":null,"Pattern":null,"UniqueItems":null},"OriginalName":"","Comments":null,"IsComponent":false,"Type":"string","Fields":[],"EventStreamEnvelope":false,"Input":false,"CircularReference":null,"Name":"","Extensions":{"Symbol":"Tags","x-speakeasy-trace":{"Price#create.req.price_components.dollar_relation.[].tags.[]":true},"x-speakeasy-param-computed":true,"x-untouched":true,"x-speakeasy-in-get":true,"x-speakeasy-parent-require-to-not-null":true},"Original":{"Name":"","OriginalName":"","ContextStack":[],"Type":"string","ItemType":null,"Fields":[],"Validations":{"MinItems":null,"MinLength":null,"Minimum":null,"MaxItems":null,"MaxLength":null,"Maximum":null,"Pattern":null,"UniqueItems":null},"AssociatedTypes":[],"Enum":null,"Scope":"","IsComponent":false,"Truncated":false,"Comments":null,"Input":false,"Output":false,"Extensions":{},"Examples":[],"Format":"","Discriminator":null,"ComplexAny":false,"OutputLocation":"","ResolvedModel":"","EventStreamEnvelope":false,"ResponseEnvelope":false},"Enum":null,"ItemType":null,"Scope":"","ResponseEnvelope":false,"AssociatedTypes":[],"Discriminator":null,"Format":"","ResolvedModel":"","OutputLocation":"","ContextStack":[],"Examples":[],"Output":false,"Truncated":false},"Output":false,"OriginalName":"","Comments":null,"Validations":{"MinLength":null,"Minimum":null,"MaxItems":null,"MaxLength":null,"Maximum":null,"Pattern":null,"UniqueItems":null,"MinItems":null},"CircularReference":null,"Input":false,"Truncated":false,"IsComponent":false,"EventStreamEnvelope":false,"Original":{"Name":"","OriginalName":"","ContextStack":[],"Type":"array","ItemType":{"Name":"","OriginalName":"","ContextStack":[],"Type":"string","ItemType":null,"Fields":[],"Validations":{"MinItems":null,"MinLength":null,"Minimum":null,"MaxItems":null,"MaxLength":null,"Maximum":null,"Pattern":null,"UniqueItems":null},"AssociatedTypes":[],"Enum":null,"Scope":"","IsComponent":false,"Truncated":false,"Comments":null,"Input":false,"Output":false,"Extensions":{},"Examples":[],"Format":"","Discriminator":null,"ComplexAny":false,"OutputLocation":"","ResolvedModel":"","EventStreamEnvelope":false,"ResponseEnvelope":false},"Fields":[],"Validations":{"MinItems":null,"MinLength":null,"Minimum":null,"MaxItems":null,"MaxLength":null,"Maximum":null,"Pattern":null,"UniqueItems":null},"AssociatedTypes":[],"Enum":null,"Scope":"","IsComponent":false,"Truncated":false,"Comments":null,"Input":false,"Output":false,"Extensions":{},"Examples":[],"Format":"","Discriminator":null,"ComplexAny":false,"OutputLocation":"","ResolvedModel":"","EventStreamEnvelope":false,"ResponseEnvelope":false},"Name":"","ResponseEnvelope":false,"ContextStack":[],"Extensions":{"x-speakeasy-parent-require-to-not-null":true,"x-speakeasy-trace":{"Price#create.req.price_components.dollar_relation.[].tags":true},"x-speakeasy-param-computed":true,"x-untouched":true,"x-speakeasy-in-get":true},"Enum":null,"ResolvedModel":""}},{"Name":"entity_id","Nullable":false,"Optional":true,"Default":null,"Const":null,"Comments":{"Description":"The id of the price component","ExternalDocs":null,"Summary":"","Deprecated":false,"DeprecationMessage":"","DeprecationReplacement":""},"Annotations":[{"Ignore":false,"FieldName":"entity_id"}],"IsAdditionalProperties":false,"OriginalName":"entity_id","Type":{"ResolvedModel":"","Original":{"Name":"","OriginalName":"","ContextStack":[],"Type":"string","ItemType":null,"Fields":[],"Validations":{"MinItems":null,"MinLength":null,"Minimum":null,"MaxItems":null,"MaxLength":null,"Maximum":null,"Pattern":null,"UniqueItems":null},"AssociatedTypes":[],"Enum":null,"Scope":"","IsComponent":false,"Truncated":false,"Comments":null,"Input":false,"Output":false,"Extensions":{},"Examples":[],"Format":"","Discriminator":null,"ComplexAny":false,"OutputLocation":"","ResolvedModel":"","EventStreamEnvelope":false,"ResponseEnvelope":false},"AssociatedTypes":[],"Examples":[],"Output":false,"OutputLocation":"","Type":"string","Extensions":{"x-speakeasy-trace":{"Price#create.req.price_components.dollar_relation.[].entity_id":true},"x-speakeasy-param-computed":true,"x-untouched":true,"x-speakeasy-in-get":true,"x-speakeasy-parent-require-to-not-null":true},"Format":"","IsComponent":false,"Comments":null,"ItemType":null,"Name":"","Enum":null,"EventStreamEnvelope":false,"ResponseEnvelope":false,"OriginalName":"","Discriminator":null,"Input":false,"CircularReference":null,"ContextStack":[],"Fields":[],"Scope":"","Truncated":false,"Validations":{"Minimum":null,"MaxItems":null,"MaxLength":null,"Maximum":null,"Pattern":null,"UniqueItems":null,"MinItems":null,"MinLength":null}},"ErrorMessage":false}],"Format":"","Input":false,"Extensions":{"Symbol":"PriceComponentRelation","x-speakeasy-trace":{"Price#create.req.price_components.dollar_relation.[]":true},"x-speakeasy-param-computed":true,"x-untouched":true,"x-speakeasy-in-get":true,"x-speakeasy-parent-require-to-not-null":true},"Enum":null,"Discriminator":null,"OriginalName":"PriceComponentRelation","ContextStack":[{"Type":"refType","Identifier":"Schemas","Used":false,"MustUse":false},{"Type":"refName","Identifier":"PriceComponentRelation","Used":false,"MustUse":false},{"Type":"component","Identifier":"true","Used":false,"MustUse":false}],"AssociatedTypes":[],"Scope":"shared","Original":{"Name":"PriceComponentRelation","OriginalName":"PriceComponentRelation","ContextStack":[{"Type":"refType","Identifier":"Schemas","Used":false,"MustUse":false},{"Type":"refName","Identifier":"PriceComponentRelation","Used":false,"MustUse":false},{"Type":"component","Identifier":"true","Used":false,"MustUse":false}],"Type":"class","ItemType":null,"Fields":[{"Name":"_tags","OriginalName":"_tags","Type":{"Name":"","OriginalName":"","ContextStack":[],"Type":"array","ItemType":{"Name":"","OriginalName":"","ContextStack":[],"Type":"string","ItemType":null,"Fields":[],"Validations":{"MinItems":null,"MinLength":null,"Minimum":null,"MaxItems":null,"MaxLength":null,"Maximum":null,"Pattern":null,"UniqueItems":null},"AssociatedTypes":[],"Enum":null,"Scope":"","IsComponent":false,"Truncated":false,"Comments":null,"Input":false,"Output":false,"Extensions":{},"Examples":[],"Format":"","Discriminator":null,"ComplexAny":false,"OutputLocation":"","ResolvedModel":"","EventStreamEnvelope":false,"ResponseEnvelope":false},"Fields":[],"Validations":{"MinItems":null,"MinLength":null,"Minimum":null,"MaxItems":null,"MaxLength":null,"Maximum":null,"Pattern":null,"UniqueItems":null},"AssociatedTypes":[],"Enum":null,"Scope":"","IsComponent":false,"Truncated":false,"Comments":null,"Input":false,"Output":false,"Extensions":{},"Examples":[],"Format":"","Discriminator":null,"ComplexAny":false,"OutputLocation":"","ResolvedModel":"","EventStreamEnvelope":false,"ResponseEnvelope":false},"Comments":{"Summary":"","Description":"An arbitrary set of tags attached to the composite price - component relation","ExternalDocs":null,"ExtendedComments":{},"Deprecated":false,"DeprecationReplacement":"","DeprecationMessage":""},"Annotations":[{"Ignore":false,"FieldName":"_tags"}],"Nullable":false,"Optional":true,"SerializationMethod":null,"ErrorMessage":false,"Const":null,"Default":null,"IsAdditionalProperties":false,"ParameterIndex":null},{"Name":"entity_id","OriginalName":"entity_id","Type":{"Name":"","OriginalName":"","ContextStack":[],"Type":"string","ItemType":null,"Fields":[],"Validations":{"MinItems":null,"MinLength":null,"Minimum":null,"MaxItems":null,"MaxLength":null,"Maximum":null,"Pattern":null,"UniqueItems":null},"AssociatedTypes":[],"Enum":null,"Scope":"","IsComponent":false,"Truncated":false,"Comments":null,"Input":false,"Output":false,"Extensions":{},"Examples":[],"Format":"","Discriminator":null,"ComplexAny":false,"OutputLocation":"","ResolvedModel":"","EventStreamEnvelope":false,"ResponseEnvelope":false},"Comments":{"Summary":"","Description":"The id of the price component","ExternalDocs":null,"ExtendedComments":{},"Deprecated":false,"DeprecationReplacement":"","DeprecationMessage":""},"Annotations":[{"Ignore":false,"FieldName":"entity_id"}],"Nullable":false,"Optional":true,"SerializationMethod":null,"ErrorMessage":false,"Const":null,"Default":null,"IsAdditionalProperties":false,"ParameterIndex":null}],"Validations":{"MinItems":null,"MinLength":null,"Minimum":null,"MaxItems":null,"MaxLength":null,"Maximum":null,"Pattern":null,"UniqueItems":null},"AssociatedTypes":[],"Enum":null,"Scope":"shared","IsComponent":true,"Truncated":false,"Comments":null,"Input":false,"Output":false,"Extensions":{},"Examples":[],"Format":"","Discriminator":null,"ComplexAny":false,"OutputLocation":"models/shared","ResolvedModel":"PriceComponentRelation","EventStreamEnvelope":false,"ResponseEnvelope":false},"Name":"PriceComponentRelation","Comments":null,"IsComponent":true,"CircularReference":null,"EventStreamEnvelope":false,"ResolvedModel":"PriceComponentRelation","Type":"class"},"EventStreamEnvelope":false,"ResponseEnvelope":false,"Scope":"","OutputLocation":"","Examples":[],"ResolvedModel":"","Output":false,"Type":"array","Extensions":{"x-speakeasy-trace":{"Price#create.req.price_components.dollar_relation":true},"x-speakeasy-param-computed":true,"x-untouched":true,"x-speakeasy-in-get":true,"x-speakeasy-parent-require-to-not-null":true},"Comments":null,"IsComponent":false},"Name":"$relation","Default":null,"Const":null}],"Enum":null,"Output":false,"Scope":"shared"},"Nullable":false,"Optional":true,"Const":null,"Comments":{"Summary":"","Deprecated":false,"DeprecationMessage":"","DeprecationReplacement":"","Description":"A set of [price](/api/pricing#tag/simple_price_schema) components that define the composite price.","ExternalDocs":null},"OriginalName":"price_components","Name":"price_components","Default":null,"IsAdditionalProperties":false},{"Default":null,"Comments":{"Deprecated":false,"DeprecationMessage":"","DeprecationReplacement":"","Description":"Defines the way the price amount is display in epilot journeys.","ExternalDocs":null,"Summary":""},"Annotations":[{"Ignore":false,"FieldName":"price_display_in_journeys"}],"OriginalName":"price_display_in_journeys","Type":{"Original":{"Name":"PriceCreate_price_display_in_journeys","OriginalName":"price_display_in_journeys","ContextStack":[{"Type":"refType","Identifier":"Schemas","Used":false,"MustUse":false},{"Type":"refName","Identifier":"PriceCreate","Used":true,"MustUse":false}],"Type":"enum","ItemType":null,"Fields":[],"Validations":{"MinItems":null,"MinLength":null,"Minimum":null,"MaxItems":null,"MaxLength":null,"Maximum":null,"Pattern":null,"UniqueItems":null},"AssociatedTypes":[],"Enum":{"Type":{"Name":"","OriginalName":"","ContextStack":[],"Type":"string","ItemType":null,"Fields":[],"Validations":{"MinItems":null,"MinLength":null,"Minimum":null,"MaxItems":null,"MaxLength":null,"Maximum":null,"Pattern":null,"UniqueItems":null},"AssociatedTypes":[],"Enum":null,"Scope":"","IsComponent":false,"Truncated":false,"Comments":null,"Input":false,"Output":false,"Extensions":{},"Examples":[],"Format":"","Discriminator":null,"ComplexAny":false,"OutputLocation":"","ResolvedModel":"","EventStreamEnvelope":false,"ResponseEnvelope":false},"Values":["show_price","show_as_starting_price","show_as_on_request"],"Names":[],"Open":false,"Format":""},"Scope":"shared","IsComponent":false,"Truncated":false,"Comments":{"Summary":"","Description":"Defines the way the price amount is display in epilot journeys.","ExternalDocs":null,"ExtendedComments":{},"Deprecated":false,"DeprecationReplacement":"","DeprecationMessage":""},"Input":false,"Output":false,"Extensions":{},"Examples":[],"Format":"","Discriminator":null,"ComplexAny":false,"OutputLocation":"models/shared","ResolvedModel":"PriceCreate","EventStreamEnvelope":false,"ResponseEnvelope":false},"Enum":{"Open":false,"Names":[],"Values":["show_price","show_as_starting_price","show_as_on_request"],"Type":{"Original":{"Name":"","OriginalName":"","ContextStack":[],"Type":"string","ItemType":null,"Fields":[],"Validations":{"MinItems":null,"MinLength":null,"Minimum":null,"MaxItems":null,"MaxLength":null,"Maximum":null,"Pattern":null,"UniqueItems":null},"AssociatedTypes":[],"Enum":null,"Scope":"","IsComponent":false,"Truncated":false,"Comments":null,"Input":false,"Output":false,"Extensions":{},"Examples":[],"Format":"","Discriminator":null,"ComplexAny":false,"OutputLocation":"","ResolvedModel":"","EventStreamEnvelope":false,"ResponseEnvelope":false},"OutputLocation":"","AssociatedTypes":[],"Discriminator":null,"IsComponent":false,"Scope":"","Type":"string","Format":"","Output":false,"OriginalName":"","ItemType":null,"CircularReference":null,"EventStreamEnvelope":false,"ContextStack":[],"Enum":null,"Validations":{"MinLength":null,"Minimum":null,"MaxItems":null,"MaxLength":null,"Maximum":null,"Pattern":null,"UniqueItems":null,"MinItems":null},"ResponseEnvelope":false,"Extensions":{},"Name":"","Comments":null,"Examples":[],"Fields":[],"Input":false,"Truncated":false,"ResolvedModel":""}},"AssociatedTypes":[],"Input":false,"IsComponent":false,"Type":"enum","Extensions":{"x-speakeasy-trace":{"Price#create.req.price_display_in_journeys":true},"x-speakeasy-param-computed":true,"x-untouched":true,"x-speakeasy-in-get":true},"Output":false,"Truncated":false,"Scope":"shared","EventStreamEnvelope":false,"ContextStack":[{"Type":"refType","Identifier":"Schemas","Used":false,"MustUse":false},{"Type":"refName","Identifier":"PriceCreate","Used":true,"MustUse":false}],"Discriminator":null,"Fields":[],"OriginalName":"price_display_in_journeys","Name":"PriceCreate_price_display_in_journeys","CircularReference":null,"Validations":{"MinLength":null,"Minimum":null,"MaxItems":null,"MaxLength":null,"Maximum":null,"Pattern":null,"UniqueItems":null,"MinItems":null},"ResponseEnvelope":false,"ResolvedModel":"PriceCreate","Comments":{"DeprecationReplacement":"","DeprecationMessage":"","Summary":"","Description":"Defines the way the price amount is display in epilot journeys.","ExternalDocs":null,"ExtendedComments":{},"Deprecated":false},"Format":"","ItemType":null,"Examples":[],"OutputLocation":"models/shared"},"Name":"price_display_in_journeys","Nullable":false,"Optional":true,"Const":null,"IsAdditionalProperties":false,"ErrorMessage":false},{"Type":{"EventStreamEnvelope":false,"Comments":{"DeprecationMessage":"","Summary":"","Description":"The price id","ExternalDocs":null,"ExtendedComments":{},"Deprecated":false,"DeprecationReplacement":""},"CircularReference":null,"AssociatedTypes":[],"Fields":[],"ContextStack":[],"Name":"","Format":"uuid","OutputLocation":"","Extensions":{"x-speakeasy-trace":{"Price#get.req.price_id":true},"x-speakeasy-match":"id"},"Examples":[{}],"Type":"string","Input":false,"Scope":"","ResponseEnvelope":false,"ResolvedModel":"","Truncated":false,"OriginalName":"","Enum":null,"IsComponent":false,"Discriminator":null,"ItemType":null,"Output":false,"Validations":{"MaxLength":null,"Maximum":null,"Pattern":null,"UniqueItems":null,"MinItems":null,"MinLength":null,"Minimum":null,"MaxItems":null},"Original":{"Name":"","OriginalName":"","ContextStack":[],"Type":"string","ItemType":null,"Fields":[],"Validations":{"MinItems":null,"MinLength":null,"Minimum":null,"MaxItems":null,"MaxLength":null,"Maximum":null,"Pattern":null,"UniqueItems":null},"AssociatedTypes":[],"Enum":null,"Scope":"","IsComponent":false,"Truncated":false,"Comments":{"Summary":"","Description":"The price id","ExternalDocs":null,"ExtendedComments":{},"Deprecated":false,"DeprecationReplacement":"","DeprecationMessage":""},"Input":false,"Output":false,"Extensions":{"x-speakeasy-match":"id"},"Examples":[{}],"Format":"uuid","Discriminator":null,"ComplexAny":false,"OutputLocation":"","ResolvedModel":"","EventStreamEnvelope":false,"ResponseEnvelope":false}},"Name":"priceId","Comments":{"Description":"The price id","ExternalDocs":null,"ExtendedComments":{},"Deprecated":false,"DeprecationReplacement":"","DeprecationMessage":"","Summary":""},"ErrorMessage":false,"Const":null,"Annotations":[{"Name":"priceId","Serialization":"","Style":"simple","Explode":false,"FieldType":{"ResolvedModel":"","EventStreamEnvelope":false,"ResponseEnvelope":false,"Name":"","ContextStack":[],"ItemType":null,"Extensions":{"x-speakeasy-match":"id"},"OutputLocation":"","Fields":[],"Enum":null,"IsComponent":false,"ComplexAny":false,"Examples":[{}],"Discriminator":null,"OriginalName":"","Type":"string","Validations":{"UniqueItems":null,"MinItems":null,"MinLength":null,"Minimum":null,"MaxItems":null,"MaxLength":null,"Maximum":null,"Pattern":null},"Output":false,"Input":false,"Format":"uuid","AssociatedTypes":[],"Scope":"","Truncated":false,"Comments":{"ExtendedComments":{},"Deprecated":false,"DeprecationReplacement":"","DeprecationMessage":"","Summary":"","Description":"The price id","ExternalDocs":null}},"Hidden":false,"ParamType":"pathParam"}],"IsAdditionalProperties":false,"OriginalName":"","Nullable":false,"Optional":false,"Default":null},{"Annotations":[{"Ignore":false,"FieldName":"pricing_model"}],"OriginalName":"pricing_model","Optional":true,"Default":{"Value":"per_unit"},"Const":null,"IsAdditionalProperties":false,"ErrorMessage":false,"Type":{"Extensions":{"x-speakeasy-param-computed":true,"x-untouched":true,"x-speakeasy-in-get":true,"x-speakeasy-trace":{"Price#create.req.pricing_model":true}},"AssociatedTypes":[],"Scope":"shared","EventStreamEnvelope":false,"OriginalName":"pricing_model","ContextStack":[{"Type":"refType","Identifier":"Schemas","Used":false,"MustUse":false},{"Type":"refName","Identifier":"PriceCreate","Used":true,"MustUse":false}],"Name":"PriceCreate_pricing_model","Type":"enum","Discriminator":null,"Examples":[],"CircularReference":null,"OutputLocation":"models/shared","Input":false,"Output":false,"Fields":[],"IsComponent":false,"ItemType":null,"Original":{"Name":"PriceCreate_pricing_model","OriginalName":"pricing_model","ContextStack":[{"Type":"refType","Identifier":"Schemas","Used":false,"MustUse":false},{"Type":"refName","Identifier":"PriceCreate","Used":true,"MustUse":false}],"Type":"enum","ItemType":null,"Fields":[],"Validations":{"MinItems":null,"MinLength":null,"Minimum":null,"MaxItems":null,"MaxLength":null,"Maximum":null,"Pattern":null,"UniqueItems":null},"AssociatedTypes":[],"Enum":{"Type":{"Name":"","OriginalName":"","ContextStack":[],"Type":"string","ItemType":null,"Fields":[],"Validations":{"MinItems":null,"MinLength":null,"Minimum":null,"MaxItems":null,"MaxLength":null,"Maximum":null,"Pattern":null,"UniqueItems":null},"AssociatedTypes":[],"Enum":null,"Scope":"","IsComponent":false,"Truncated":false,"Comments":null,"Input":false,"Output":false,"Extensions":{},"Examples":[],"Format":"","Discriminator":null,"ComplexAny":false,"OutputLocation":"","ResolvedModel":"","EventStreamEnvelope":false,"ResponseEnvelope":false},"Values":["per_unit","tiered_volume","tiered_graduated","tiered_flatfee"],"Names":[],"Open":false,"Format":""},"Scope":"shared","IsComponent":false,"Truncated":false,"Comments":{"Summary":"","Description":"Describes how to compute the price per period. Either `per_unit`, `tiered_graduated` or `tiered_volume`.\n- `per_unit` indicates that the fixed amount (specified in unit_amount or unit_amount_decimal) will be charged per unit in quantity\n- `tiered_graduated` indicates that the unit pricing will be computed using tiers attribute. The customer pays the price per unit in every range their purchase rises through.\n- `tiered_volume` indicates that the unit pricing will be computed using tiers attribute. The customer pays the same unit price for all purchased units.\n- `tiered_flatfee` While similar to tiered_volume, tiered flat fee charges for the same price (flat) for the entire range instead using the unit price to multiply the quantity.\n","ExternalDocs":null,"ExtendedComments":{},"Deprecated":false,"DeprecationReplacement":"","DeprecationMessage":""},"Input":false,"Output":false,"Extensions":{},"Examples":[],"Format":"","Discriminator":null,"ComplexAny":false,"OutputLocation":"models/shared","ResolvedModel":"PriceCreate","EventStreamEnvelope":false,"ResponseEnvelope":false},"Enum":{"Type":{"Format":"","Validations":{"Maximum":null,"Pattern":null,"UniqueItems":null,"MinItems":null,"MinLength":null,"Minimum":null,"MaxItems":null,"MaxLength":null},"ContextStack":[],"Extensions":{},"AssociatedTypes":[],"OutputLocation":"","Name":"","ItemType":null,"ResponseEnvelope":false,"Fields":[],"Truncated":false,"ResolvedModel":"","Original":{"Name":"","OriginalName":"","ContextStack":[],"Type":"string","ItemType":null,"Fields":[],"Validations":{"MinItems":null,"MinLength":null,"Minimum":null,"MaxItems":null,"MaxLength":null,"Maximum":null,"Pattern":null,"UniqueItems":null},"AssociatedTypes":[],"Enum":null,"Scope":"","IsComponent":false,"Truncated":false,"Comments":null,"Input":false,"Output":false,"Extensions":{},"Examples":[],"Format":"","Discriminator":null,"ComplexAny":false,"OutputLocation":"","ResolvedModel":"","EventStreamEnvelope":false,"ResponseEnvelope":false},"IsComponent":false,"Input":false,"CircularReference":null,"Discriminator":null,"Examples":[],"OriginalName":"","Type":"string","Output":false,"Scope":"","EventStreamEnvelope":false,"Enum":null,"Comments":null},"Open":false,"Names":[],"Values":["per_unit","tiered_volume","tiered_graduated","tiered_flatfee"]},"Comments":{"DeprecationReplacement":"","DeprecationMessage":"","Summary":"","Description":"Describes how to compute the price per period. Either `per_unit`, `tiered_graduated` or `tiered_volume`.\n- `per_unit` indicates that the fixed amount (specified in unit_amount or unit_amount_decimal) will be charged per unit in quantity\n- `tiered_graduated` indicates that the unit pricing will be computed using tiers attribute. The customer pays the price per unit in every range their purchase rises through.\n- `tiered_volume` indicates that the unit pricing will be computed using tiers attribute. The customer pays the same unit price for all purchased units.\n- `tiered_flatfee` While similar to tiered_volume, tiered flat fee charges for the same price (flat) for the entire range instead using the unit price to multiply the quantity.\n","ExternalDocs":null,"ExtendedComments":{},"Deprecated":false},"Format":"","ResponseEnvelope":false,"ResolvedModel":"PriceCreate","Truncated":false,"Validations":{"MaxLength":null,"Maximum":null,"Pattern":null,"UniqueItems":null,"MinItems":null,"MinLength":null,"Minimum":null,"MaxItems":null}},"Name":"pricing_model","Nullable":false,"Comments":{"Deprecated":false,"DeprecationMessage":"","DeprecationReplacement":"","Description":"Describes how to compute the price per period. Either `per_unit`, `tiered_graduated` or `tiered_volume`.\n- `per_unit` indicates that the fixed amount (specified in unit_amount or unit_amount_decimal) will be charged per unit in quantity\n- `tiered_graduated` indicates that the unit pricing will be computed using tiers attribute. The customer pays the price per unit in every range their purchase rises through.\n- `tiered_volume` indicates that the unit pricing will be computed using tiers attribute. The customer pays the same unit price for all purchased units.\n- `tiered_flatfee` While similar to tiered_volume, tiered flat fee charges for the same price (flat) for the entire range instead using the unit price to multiply the quantity.\n","ExternalDocs":null,"Summary":""}},{"Nullable":false,"Optional":true,"Default":null,"Const":null,"IsAdditionalProperties":false,"Type":{"OutputLocation":"","Enum":null,"Comments":null,"Type":"number","Validations":{"MinItems":null,"MinLength":null,"Minimum":null,"MaxItems":null,"MaxLength":null,"Maximum":null,"Pattern":null,"UniqueItems":null},"Truncated":false,"EventStreamEnvelope":false,"Extensions":{"x-speakeasy-in-get":true,"x-speakeasy-trace":{"Price#create.req.renewal_duration_amount":true},"x-speakeasy-param-computed":true,"x-untouched":true},"Fields":[],"Format":"","Input":false,"Original":{"Name":"","OriginalName":"","ContextStack":[],"Type":"number","ItemType":null,"Fields":[],"Validations":{"MinItems":null,"MinLength":null,"Minimum":null,"MaxItems":null,"MaxLength":null,"Maximum":null,"Pattern":null,"UniqueItems":null},"AssociatedTypes":[],"Enum":null,"Scope":"","IsComponent":false,"Truncated":false,"Comments":null,"Input":false,"Output":false,"Extensions":{},"Examples":[],"Format":"","Discriminator":null,"ComplexAny":false,"OutputLocation":"","ResolvedModel":"","EventStreamEnvelope":false,"ResponseEnvelope":false},"IsComponent":false,"ResponseEnvelope":false,"ContextStack":[],"Name":"","ItemType":null,"Discriminator":null,"Scope":"","ResolvedModel":"","OriginalName":"","AssociatedTypes":[],"CircularReference":null,"Examples":[],"Output":false},"Name":"renewal_duration_amount","Annotations":[{"Ignore":false,"FieldName":"renewal_duration_amount"}],"ErrorMessage":false,"OriginalName":"renewal_duration_amount","Comments":{"Deprecated":false,"DeprecationMessage":"","DeprecationReplacement":"","Description":"The renewal period duration","ExternalDocs":null,"Summary":""}},{"OriginalName":"renewal_duration_unit","Name":"renewal_duration_unit","Optional":true,"Const":null,"Comments":{"DeprecationReplacement":"","Description":"The renewal period duration unit","ExternalDocs":null,"Summary":"","Deprecated":false,"DeprecationMessage":""},"ErrorMessage":false,"Type":{"Original":{"Name":"PriceCreate_renewal_duration_unit","OriginalName":"renewal_duration_unit","ContextStack":[{"Type":"refType","Identifier":"Schemas","Used":false,"MustUse":false},{"Type":"refName","Identifier":"PriceCreate","Used":true,"MustUse":false}],"Type":"enum","ItemType":null,"Fields":[],"Validations":{"MinItems":null,"MinLength":null,"Minimum":null,"MaxItems":null,"MaxLength":null,"Maximum":null,"Pattern":null,"UniqueItems":null},"AssociatedTypes":[],"Enum":{"Type":{"Name":"","OriginalName":"","ContextStack":[],"Type":"string","ItemType":null,"Fields":[],"Validations":{"MinItems":null,"MinLength":null,"Minimum":null,"MaxItems":null,"MaxLength":null,"Maximum":null,"Pattern":null,"UniqueItems":null},"AssociatedTypes":[],"Enum":null,"Scope":"","IsComponent":false,"Truncated":false,"Comments":null,"Input":false,"Output":false,"Extensions":{},"Examples":[],"Format":"","Discriminator":null,"ComplexAny":false,"OutputLocation":"","ResolvedModel":"","EventStreamEnvelope":false,"ResponseEnvelope":false},"Values":["weeks","months","years"],"Names":[],"Open":false,"Format":""},"Scope":"shared","IsComponent":false,"Truncated":false,"Comments":{"Summary":"","Description":"The renewal period duration unit","ExternalDocs":null,"ExtendedComments":{},"Deprecated":false,"DeprecationReplacement":"","DeprecationMessage":""},"Input":false,"Output":false,"Extensions":{},"Examples":[],"Format":"","Discriminator":null,"ComplexAny":false,"OutputLocation":"models/shared","ResolvedModel":"PriceCreate","EventStreamEnvelope":false,"ResponseEnvelope":false},"Type":"enum","AssociatedTypes":[],"IsComponent":false,"Extensions":{"x-untouched":true,"x-speakeasy-in-get":true,"x-speakeasy-trace":{"Price#create.req.renewal_duration_unit":true},"x-speakeasy-param-computed":true},"Truncated":false,"CircularReference":null,"ResolvedModel":"PriceCreate","Input":false,"ItemType":null,"ResponseEnvelope":false,"Comments":{"Deprecated":false,"DeprecationReplacement":"","DeprecationMessage":"","Summary":"","Description":"The renewal period duration unit","ExternalDocs":null,"ExtendedComments":{}},"OutputLocation":"models/shared","Name":"PriceCreate_renewal_duration_unit","Fields":[],"OriginalName":"renewal_duration_unit","ContextStack":[{"Type":"refType","Identifier":"Schemas","Used":false,"MustUse":false},{"Type":"refName","Identifier":"PriceCreate","Used":true,"MustUse":false}],"Enum":{"Names":[],"Values":["weeks","months","years"],"Type":{"EventStreamEnvelope":false,"Input":false,"IsComponent":false,"ResponseEnvelope":false,"ResolvedModel":"","Original":{"Name":"","OriginalName":"","ContextStack":[],"Type":"string","ItemType":null,"Fields":[],"Validations":{"MinItems":null,"MinLength":null,"Minimum":null,"MaxItems":null,"MaxLength":null,"Maximum":null,"Pattern":null,"UniqueItems":null},"AssociatedTypes":[],"Enum":null,"Scope":"","IsComponent":false,"Truncated":false,"Comments":null,"Input":false,"Output":false,"Extensions":{},"Examples":[],"Format":"","Discriminator":null,"ComplexAny":false,"OutputLocation":"","ResolvedModel":"","EventStreamEnvelope":false,"ResponseEnvelope":false},"Type":"string","Comments":null,"ItemType":null,"Output":false,"Extensions":{},"Fields":[],"Name":"","Examples":[],"Discriminator":null,"Validations":{"MaxLength":null,"Maximum":null,"Pattern":null,"UniqueItems":null,"MinItems":null,"MinLength":null,"Minimum":null,"MaxItems":null},"CircularReference":null,"OutputLocation":"","Enum":null,"AssociatedTypes":[],"Format":"","Scope":"","Truncated":false,"OriginalName":"","ContextStack":[]},"Open":false},"Output":false,"Scope":"shared","EventStreamEnvelope":false,"Format":"","Validations":{"UniqueItems":null,"MinItems":null,"MinLength":null,"Minimum":null,"MaxItems":null,"MaxLength":null,"Maximum":null,"Pattern":null},"Discriminator":null,"Examples":[]},"Nullable":false,"Default":null,"Annotations":[{"Ignore":false,"FieldName":"renewal_duration_unit"}],"IsAdditionalProperties":false},{"ErrorMessage":false,"OriginalName":"tax","Name":"tax","Optional":true,"IsAdditionalProperties":false,"Comments":null,"Annotations":[{"Ignore":false,"FieldName":"tax"}],"Type":{"Input":false,"ItemType":null,"Discriminator":null,"EventStreamEnvelope":false,"Original":{"Name":"","OriginalName":"","ContextStack":[],"Type":"any","ItemType":null,"Fields":[],"Validations":{"MinItems":null,"MinLength":null,"Minimum":null,"MaxItems":null,"MaxLength":null,"Maximum":null,"Pattern":null,"UniqueItems":null},"AssociatedTypes":[],"Enum":null,"Scope":"","IsComponent":false,"Truncated":false,"Comments":null,"Input":false,"Output":false,"Extensions":{},"Examples":[],"Format":"","Discriminator":null,"ComplexAny":false,"OutputLocation":"","ResolvedModel":"","EventStreamEnvelope":false,"ResponseEnvelope":false},"Name":"","Type":"any","Validations":{"Maximum":null,"Pattern":null,"UniqueItems":null,"MinItems":null,"MinLength":null,"Minimum":null,"MaxItems":null,"MaxLength":null},"Examples":[],"Output":false,"Extensions":{"x-speakeasy-trace":{"Price#create.req.tax":true},"x-speakeasy-param-computed":true,"x-untouched":true,"x-speakeasy-in-get":true},"Comments":null,"IsComponent":false,"Scope":"","OriginalName":"","ResolvedModel":"","OutputLocation":"","Enum":null,"CircularReference":null,"ResponseEnvelope":false,"Fields":[],"Format":"","AssociatedTypes":[],"ContextStack":[],"Truncated":false},"Nullable":false,"Default":null,"Const":null},{"ErrorMessage":false,"OriginalName":"termination_time_amount","Optional":true,"Default":null,"Annotations":[{"Ignore":false,"FieldName":"termination_time_amount"}],"IsAdditionalProperties":false,"Type":{"ResponseEnvelope":false,"Enum":null,"Fields":[],"Format":"","Scope":"","Original":{"Name":"","OriginalName":"","ContextStack":[],"Type":"number","ItemType":null,"Fields":[],"Validations":{"MinItems":null,"MinLength":null,"Minimum":null,"MaxItems":null,"MaxLength":null,"Maximum":null,"Pattern":null,"UniqueItems":null},"AssociatedTypes":[],"Enum":null,"Scope":"","IsComponent":false,"Truncated":false,"Comments":null,"Input":false,"Output":false,"Extensions":{},"Examples":[],"Format":"","Discriminator":null,"ComplexAny":false,"OutputLocation":"","ResolvedModel":"","EventStreamEnvelope":false,"ResponseEnvelope":false},"Truncated":false,"ContextStack":[],"EventStreamEnvelope":false,"AssociatedTypes":[],"Type":"number","Extensions":{"x-speakeasy-in-get":true,"x-speakeasy-trace":{"Price#create.req.termination_time_amount":true},"x-speakeasy-param-computed":true,"x-untouched":true},"ItemType":null,"CircularReference":null,"OutputLocation":"","Name":"","Comments":null,"Examples":[],"IsComponent":false,"ResolvedModel":"","Input":false,"Validations":{"MinLength":null,"Minimum":null,"MaxItems":null,"MaxLength":null,"Maximum":null,"Pattern":null,"UniqueItems":null,"MinItems":null},"OriginalName":"","Discriminator":null,"Output":false},"Name":"termination_time_amount","Nullable":false,"Const":null,"Comments":{"Description":"The termination period duration","ExternalDocs":null,"Summary":"","Deprecated":false,"DeprecationMessage":"","DeprecationReplacement":""}},{"Const":null,"Annotations":[{"Ignore":false,"FieldName":"termination_time_unit"}],"OriginalName":"termination_time_unit","Optional":true,"Default":null,"Comments":{"Deprecated":false,"DeprecationMessage":"","DeprecationReplacement":"","Description":"The termination period duration unit","ExternalDocs":null,"Summary":""},"IsAdditionalProperties":false,"ErrorMessage":false,"Type":{"Original":{"Name":"PriceCreate_termination_time_unit","OriginalName":"termination_time_unit","ContextStack":[{"Type":"refType","Identifier":"Schemas","Used":false,"MustUse":false},{"Type":"refName","Identifier":"PriceCreate","Used":true,"MustUse":false}],"Type":"enum","ItemType":null,"Fields":[],"Validations":{"MinItems":null,"MinLength":null,"Minimum":null,"MaxItems":null,"MaxLength":null,"Maximum":null,"Pattern":null,"UniqueItems":null},"AssociatedTypes":[],"Enum":{"Type":{"Name":"","OriginalName":"","ContextStack":[],"Type":"string","ItemType":null,"Fields":[],"Validations":{"MinItems":null,"MinLength":null,"Minimum":null,"MaxItems":null,"MaxLength":null,"Maximum":null,"Pattern":null,"UniqueItems":null},"AssociatedTypes":[],"Enum":null,"Scope":"","IsComponent":false,"Truncated":false,"Comments":null,"Input":false,"Output":false,"Extensions":{},"Examples":[],"Format":"","Discriminator":null,"ComplexAny":false,"OutputLocation":"","ResolvedModel":"","EventStreamEnvelope":false,"ResponseEnvelope":false},"Values":["weeks","months","years"],"Names":[],"Open":false,"Format":""},"Scope":"shared","IsComponent":false,"Truncated":false,"Comments":{"Summary":"","Description":"The termination period duration unit","ExternalDocs":null,"ExtendedComments":{},"Deprecated":false,"DeprecationReplacement":"","DeprecationMessage":""},"Input":false,"Output":false,"Extensions":{},"Examples":[],"Format":"","Discriminator":null,"ComplexAny":false,"OutputLocation":"models/shared","ResolvedModel":"PriceCreate","EventStreamEnvelope":false,"ResponseEnvelope":false},"OriginalName":"termination_time_unit","Extensions":{"x-speakeasy-trace":{"Price#create.req.termination_time_unit":true},"x-speakeasy-param-computed":true,"x-untouched":true,"x-speakeasy-in-get":true},"IsComponent":false,"ContextStack":[{"Type":"refType","Identifier":"Schemas","Used":false,"MustUse":false},{"Type":"refName","Identifier":"PriceCreate","Used":true,"MustUse":false}],"AssociatedTypes":[],"Enum":{"Type":{"CircularReference":null,"Extensions":{},"IsComponent":false,"ResolvedModel":"","Enum":null,"AssociatedTypes":[],"EventStreamEnvelope":false,"Output":false,"Comments":null,"Type":"string","Discriminator":null,"Examples":[],"ContextStack":[],"Name":"","ItemType":null,"ResponseEnvelope":false,"Original":{"Name":"","OriginalName":"","ContextStack":[],"Type":"string","ItemType":null,"Fields":[],"Validations":{"MinItems":null,"MinLength":null,"Minimum":null,"MaxItems":null,"MaxLength":null,"Maximum":null,"Pattern":null,"UniqueItems":null},"AssociatedTypes":[],"Enum":null,"Scope":"","IsComponent":false,"Truncated":false,"Comments":null,"Input":false,"Output":false,"Extensions":{},"Examples":[],"Format":"","Discriminator":null,"ComplexAny":false,"OutputLocation":"","ResolvedModel":"","EventStreamEnvelope":false,"ResponseEnvelope":false},"Format":"","Input":false,"Validations":{"MinItems":null,"MinLength":null,"Minimum":null,"MaxItems":null,"MaxLength":null,"Maximum":null,"Pattern":null,"UniqueItems":null},"OriginalName":"","OutputLocation":"","Truncated":false,"Fields":[],"Scope":""},"Open":false,"Names":[],"Values":["weeks","months","years"]},"Comments":{"ExternalDocs":null,"ExtendedComments":{},"Deprecated":false,"DeprecationReplacement":"","DeprecationMessage":"","Summary":"","Description":"The termination period duration unit"},"Fields":[],"ResponseEnvelope":false,"Discriminator":null,"Format":"","Output":false,"OutputLocation":"models/shared","Name":"PriceCreate_termination_time_unit","Validations":{"Minimum":null,"MaxItems":null,"MaxLength":null,"Maximum":null,"Pattern":null,"UniqueItems":null,"MinItems":null,"MinLength":null},"ResolvedModel":"PriceCreate","ItemType":null,"Truncated":false,"CircularReference":null,"Input":false,"EventStreamEnvelope":false,"Type":"enum","Examples":[],"Scope":"shared"},"Name":"termination_time_unit","Nullable":false},{"Type":{"AssociatedTypes":[],"Format":"","Scope":"","Enum":null,"Input":false,"CircularReference":null,"ResponseEnvelope":false,"Discriminator":null,"Output":false,"Validations":{"MinItems":null,"MinLength":null,"Minimum":null,"MaxItems":null,"MaxLength":null,"Maximum":null,"Pattern":null,"UniqueItems":null},"Extensions":{"x-untouched":true,"x-speakeasy-in-get":true,"x-speakeasy-parent-require-to-not-null":true,"x-speakeasy-trace":{"Price#create.req.tiers":true},"x-speakeasy-param-computed":true},"OriginalName":"","OutputLocation":"","Name":"","Type":"array","Examples":[],"ResolvedModel":"","Comments":null,"ItemType":{"Enum":null,"Format":"","CircularReference":null,"ResolvedModel":"PriceTier","OutputLocation":"models/shared","Comments":null,"Validations":{"Minimum":null,"MaxItems":null,"MaxLength":null,"Maximum":null,"Pattern":null,"UniqueItems":null,"MinItems":null,"MinLength":null},"ContextStack":[{"Type":"refType","Identifier":"Schemas","Used":false,"MustUse":false},{"Type":"refName","Identifier":"PriceTier","Used":false,"MustUse":false},{"Type":"component","Identifier":"true","Used":false,"MustUse":false}],"Extensions":{"x-untouched":true,"x-speakeasy-in-get":true,"x-speakeasy-parent-require-to-not-null":true,"Symbol":"PriceTier","x-speakeasy-trace":{"Price#create.req.tiers.[]":true},"x-speakeasy-param-computed":true},"Fields":[{"Annotations":[{"Ignore":false,"FieldName":"display_mode"}],"Type":{"ContextStack":[{"Type":"refType","Identifier":"Schemas","Used":false,"MustUse":false},{"Type":"refName","Identifier":"PriceTierDisplayMode","Used":false,"MustUse":false},{"Type":"component","Identifier":"true","Used":false,"MustUse":false}],"AssociatedTypes":[],"Type":"enum","ResponseEnvelope":false,"Extensions":{"x-speakeasy-parent-require-to-not-null":true,"x-speakeasy-trace":{"Price#create.req.tiers.[].display_mode":true},"x-speakeasy-param-computed":true,"x-untouched":true,"x-speakeasy-in-get":true},"Input":false,"ItemType":null,"Format":"","Validations":{"MinItems":null,"MinLength":null,"Minimum":null,"MaxItems":null,"MaxLength":null,"Maximum":null,"Pattern":null,"UniqueItems":null},"EventStreamEnvelope":false,"Fields":[],"Examples":[],"IsComponent":true,"OriginalName":"PriceTierDisplayMode","OutputLocation":"models/shared","Enum":{"Open":false,"Names":[],"Values":["hidden","on_request"],"Type":{"Truncated":false,"ResponseEnvelope":false,"ResolvedModel":"","OutputLocation":"","ContextStack":[],"Enum":null,"Output":false,"Original":{"Name":"","OriginalName":"","ContextStack":[],"Type":"string","ItemType":null,"Fields":[],"Validations":{"MinItems":null,"MinLength":null,"Minimum":null,"MaxItems":null,"MaxLength":null,"Maximum":null,"Pattern":null,"UniqueItems":null},"AssociatedTypes":[],"Enum":null,"Scope":"","IsComponent":false,"Truncated":false,"Comments":null,"Input":false,"Output":false,"Extensions":{},"Examples":[],"Format":"","Discriminator":null,"ComplexAny":false,"OutputLocation":"","ResolvedModel":"","EventStreamEnvelope":false,"ResponseEnvelope":false},"Extensions":{},"Validations":{"MinLength":null,"Minimum":null,"MaxItems":null,"MaxLength":null,"Maximum":null,"Pattern":null,"UniqueItems":null,"MinItems":null},"ItemType":null,"Scope":"","OriginalName":"","Type":"string","AssociatedTypes":[],"EventStreamEnvelope":false,"Comments":null,"Input":false,"IsComponent":false,"Name":"","Discriminator":null,"Examples":[],"Fields":[],"Format":"","CircularReference":null}},"Comments":null,"Discriminator":null,"ResolvedModel":"PriceTierDisplayMode","Scope":"shared","Truncated":false,"CircularReference":null,"Original":{"Name":"PriceTierDisplayMode","OriginalName":"PriceTierDisplayMode","ContextStack":[{"Type":"refType","Identifier":"Schemas","Used":false,"MustUse":false},{"Type":"refName","Identifier":"PriceTierDisplayMode","Used":false,"MustUse":false},{"Type":"component","Identifier":"true","Used":false,"MustUse":false}],"Type":"enum","ItemType":null,"Fields":[],"Validations":{"MinItems":null,"MinLength":null,"Minimum":null,"MaxItems":null,"MaxLength":null,"Maximum":null,"Pattern":null,"UniqueItems":null},"AssociatedTypes":[],"Enum":{"Type":{"Name":"","OriginalName":"","ContextStack":[],"Type":"string","ItemType":null,"Fields":[],"Validations":{"MinItems":null,"MinLength":null,"Minimum":null,"MaxItems":null,"MaxLength":null,"Maximum":null,"Pattern":null,"UniqueItems":null},"AssociatedTypes":[],"Enum":null,"Scope":"","IsComponent":false,"Truncated":false,"Comments":null,"Input":false,"Output":false,"Extensions":{},"Examples":[],"Format":"","Discriminator":null,"ComplexAny":false,"OutputLocation":"","ResolvedModel":"","EventStreamEnvelope":false,"ResponseEnvelope":false},"Values":["hidden","on_request"],"Names":[],"Open":false,"Format":""},"Scope":"shared","IsComponent":true,"Truncated":false,"Comments":null,"Input":false,"Output":false,"Extensions":{},"Examples":[],"Format":"","Discriminator":null,"ComplexAny":false,"OutputLocation":"models/shared","ResolvedModel":"PriceTierDisplayMode","EventStreamEnvelope":false,"ResponseEnvelope":false},"Name":"PriceTierDisplayMode","Output":false},"Nullable":false,"Default":null,"Const":null,"Comments":null,"OriginalName":"display_mode","Name":"display_mode","Optional":true,"IsAdditionalProperties":false,"ErrorMessage":false},{"Type":{"Type":"number","AssociatedTypes":[],"Input":false,"OriginalName":"","Format":"","Extensions":{"x-speakeasy-in-get":true,"x-speakeasy-parent-require-to-not-null":true,"x-speakeasy-trace":{"Price#create.req.tiers.[].flat_fee_amount":true},"x-speakeasy-param-computed":true,"x-untouched":true},"Examples":[],"Fields":[],"Comments":null,"ItemType":null,"EventStreamEnvelope":false,"ResponseEnvelope":false,"Name":"","ResolvedModel":"","Discriminator":null,"Truncated":false,"CircularReference":null,"ContextStack":[],"IsComponent":false,"Scope":"","Validations":{"Maximum":null,"Pattern":null,"UniqueItems":null,"MinItems":null,"MinLength":null,"Minimum":null,"MaxItems":null,"MaxLength":null},"Output":false,"Original":{"Name":"","OriginalName":"","ContextStack":[],"Type":"number","ItemType":null,"Fields":[],"Validations":{"MinItems":null,"MinLength":null,"Minimum":null,"MaxItems":null,"MaxLength":null,"Maximum":null,"Pattern":null,"UniqueItems":null},"AssociatedTypes":[],"Enum":null,"Scope":"","IsComponent":false,"Truncated":false,"Comments":null,"Input":false,"Output":false,"Extensions":{},"Examples":[],"Format":"","Discriminator":null,"ComplexAny":false,"OutputLocation":"","ResolvedModel":"","EventStreamEnvelope":false,"ResponseEnvelope":false},"OutputLocation":"","Enum":null},"Name":"flat_fee_amount","Nullable":false,"Optional":true,"Default":null,"Const":null,"IsAdditionalProperties":false,"OriginalName":"flat_fee_amount","ErrorMessage":false,"Annotations":[{"Ignore":false,"FieldName":"flat_fee_amount"}],"Comments":null},{"ErrorMessage":false,"Type":{"Comments":null,"IsComponent":false,"Validations":{"UniqueItems":null,"MinItems":null,"MinLength":null,"Minimum":null,"MaxItems":null,"MaxLength":null,"Maximum":null,"Pattern":null},"CircularReference":null,"Original":{"Name":"","OriginalName":"","ContextStack":[],"Type":"string","ItemType":null,"Fields":[],"Validations":{"MinItems":null,"MinLength":null,"Minimum":null,"MaxItems":null,"MaxLength":null,"Maximum":null,"Pattern":null,"UniqueItems":null},"AssociatedTypes":[],"Enum":null,"Scope":"","IsComponent":false,"Truncated":false,"Comments":null,"Input":false,"Output":false,"Extensions":{},"Examples":[],"Format":"","Discriminator":null,"ComplexAny":false,"OutputLocation":"","ResolvedModel":"","EventStreamEnvelope":false,"ResponseEnvelope":false},"Extensions":{"x-speakeasy-trace":{"Price#create.req.tiers.[].flat_fee_amount_decimal":true},"x-speakeasy-param-computed":true,"x-untouched":true,"x-speakeasy-in-get":true,"x-speakeasy-parent-require-to-not-null":true},"Format":"","Truncated":false,"EventStreamEnvelope":false,"OriginalName":"","Output":false,"Name":"","Type":"string","Input":false,"Scope":"","ContextStack":[],"Enum":null,"Discriminator":null,"ResponseEnvelope":false,"Examples":[],"ItemType":null,"ResolvedModel":"","OutputLocation":"","AssociatedTypes":[],"Fields":[]},"Nullable":false,"Const":null,"Comments":null,"Annotations":[{"Ignore":false,"FieldName":"flat_fee_amount_decimal"}],"OriginalName":"flat_fee_amount_decimal","Name":"flat_fee_amount_decimal","Optional":true,"Default":null,"IsAdditionalProperties":false},{"Comments":null,"Type":{"Name":"","Discriminator":null,"ContextStack":[],"AssociatedTypes":[],"Fields":[],"Input":false,"ResolvedModel":"","Original":{"Name":"","OriginalName":"","ContextStack":[],"Type":"number","ItemType":null,"Fields":[],"Validations":{"MinItems":null,"MinLength":null,"Minimum":null,"MaxItems":null,"MaxLength":null,"Maximum":null,"Pattern":null,"UniqueItems":null},"AssociatedTypes":[],"Enum":null,"Scope":"","IsComponent":false,"Truncated":false,"Comments":null,"Input":false,"Output":false,"Extensions":{},"Examples":[],"Format":"","Discriminator":null,"ComplexAny":false,"OutputLocation":"","ResolvedModel":"","EventStreamEnvelope":false,"ResponseEnvelope":false},"EventStreamEnvelope":false,"Scope":"","ResponseEnvelope":false,"Format":"","Extensions":{"x-untouched":true,"x-speakeasy-in-get":true,"x-speakeasy-parent-require-to-not-null":true,"x-speakeasy-trace":{"Price#create.req.tiers.[].unit_amount":true},"x-speakeasy-param-computed":true},"Examples":[],"Validations":{"Minimum":null,"MaxItems":null,"MaxLength":null,"Maximum":null,"Pattern":null,"UniqueItems":null,"MinItems":null,"MinLength":null},"CircularReference":null,"OriginalName":"","Comments":null,"Enum":null,"IsComponent":false,"ItemType":null,"Output":false,"Truncated":false,"OutputLocation":"","Type":"number"},"Nullable":false,"Optional":true,"Default":null,"Const":null,"OriginalName":"unit_amount","Name":"unit_amount","Annotations":[{"Ignore":false,"FieldName":"unit_amount"}],"IsAdditionalProperties":false,"ErrorMessage":false},{"Comments":null,"IsAdditionalProperties":false,"ErrorMessage":false,"Name":"unit_amount_decimal","Nullable":false,"Optional":true,"Const":null,"Annotations":[{"Ignore":false,"FieldName":"unit_amount_decimal"}],"OriginalName":"unit_amount_decimal","Type":{"ResolvedModel":"","Extensions":{"x-speakeasy-trace":{"Price#create.req.tiers.[].unit_amount_decimal":true},"x-speakeasy-param-computed":true,"x-untouched":true,"x-speakeasy-in-get":true,"x-speakeasy-parent-require-to-not-null":true},"Comments":null,"ItemType":null,"Output":false,"AssociatedTypes":[],"ContextStack":[],"Name":"","Format":"","OutputLocation":"","Examples":[],"Input":false,"Truncated":false,"ResponseEnvelope":false,"Enum":null,"Discriminator":null,"Scope":"","EventStreamEnvelope":false,"OriginalName":"","CircularReference":null,"Original":{"Name":"","OriginalName":"","ContextStack":[],"Type":"string","ItemType":null,"Fields":[],"Validations":{"MinItems":null,"MinLength":null,"Minimum":null,"MaxItems":null,"MaxLength":null,"Maximum":null,"Pattern":null,"UniqueItems":null},"AssociatedTypes":[],"Enum":null,"Scope":"","IsComponent":false,"Truncated":false,"Comments":null,"Input":false,"Output":false,"Extensions":{},"Examples":[],"Format":"","Discriminator":null,"ComplexAny":false,"OutputLocation":"","ResolvedModel":"","EventStreamEnvelope":false,"ResponseEnvelope":false},"Fields":[],"IsComponent":false,"Validations":{"MinItems":null,"MinLength":null,"Minimum":null,"MaxItems":null,"MaxLength":null,"Maximum":null,"Pattern":null,"UniqueItems":null},"Type":"string"},"Default":null},{"Optional":true,"Default":null,"Const":null,"Comments":null,"Annotations":[{"Ignore":false,"FieldName":"up_to"}],"IsAdditionalProperties":false,"OriginalName":"up_to","Type":{"EventStreamEnvelope":false,"OriginalName":"","AssociatedTypes":[],"Input":false,"ContextStack":[],"Truncated":false,"Type":"number","ItemType":null,"ResponseEnvelope":false,"CircularReference":null,"Extensions":{"x-speakeasy-param-computed":true,"x-untouched":true,"x-speakeasy-in-get":true,"x-speakeasy-parent-require-to-not-null":true,"x-speakeasy-trace":{"Price#create.req.tiers.[].up_to":true}},"Fields":[],"Format":"","IsComponent":false,"ResolvedModel":"","OutputLocation":"","Comments":null,"Discriminator":null,"Examples":[],"Validations":{"MaxItems":null,"MaxLength":null,"Maximum":null,"Pattern":null,"UniqueItems":null,"MinItems":null,"MinLength":null,"Minimum":null},"Scope":"","Original":{"Name":"","OriginalName":"","ContextStack":[],"Type":"number","ItemType":null,"Fields":[],"Validations":{"MinItems":null,"MinLength":null,"Minimum":null,"MaxItems":null,"MaxLength":null,"Maximum":null,"Pattern":null,"UniqueItems":null},"AssociatedTypes":[],"Enum":null,"Scope":"","IsComponent":false,"Truncated":false,"Comments":null,"Input":false,"Output":false,"Extensions":{},"Examples":[],"Format":"","Discriminator":null,"ComplexAny":false,"OutputLocation":"","ResolvedModel":"","EventStreamEnvelope":false,"ResponseEnvelope":false},"Name":"","Enum":null,"Output":false},"Name":"up_to","Nullable":true,"ErrorMessage":false}],"EventStreamEnvelope":false,"OriginalName":"PriceTier","Examples":[],"Scope":"shared","Original":{"Name":"PriceTier","OriginalName":"PriceTier","ContextStack":[{"Type":"refType","Identifier":"Schemas","Used":false,"MustUse":false},{"Type":"refName","Identifier":"PriceTier","Used":false,"MustUse":false},{"Type":"component","Identifier":"true","Used":false,"MustUse":false}],"Type":"class","ItemType":null,"Fields":[{"Name":"display_mode","OriginalName":"display_mode","Type":{"Name":"PriceTierDisplayMode","OriginalName":"PriceTierDisplayMode","ContextStack":[{"Type":"refType","Identifier":"Schemas","Used":false,"MustUse":false},{"Type":"refName","Identifier":"PriceTierDisplayMode","Used":false,"MustUse":false},{"Type":"component","Identifier":"true","Used":false,"MustUse":false}],"Type":"enum","ItemType":null,"Fields":[],"Validations":{"MinItems":null,"MinLength":null,"Minimum":null,"MaxItems":null,"MaxLength":null,"Maximum":null,"Pattern":null,"UniqueItems":null},"AssociatedTypes":[],"Enum":{"Type":{"Name":"","OriginalName":"","ContextStack":[],"Type":"string","ItemType":null,"Fields":[],"Validations":{"MinItems":null,"MinLength":null,"Minimum":null,"MaxItems":null,"MaxLength":null,"Maximum":null,"Pattern":null,"UniqueItems":null},"AssociatedTypes":[],"Enum":null,"Scope":"","IsComponent":false,"Truncated":false,"Comments":null,"Input":false,"Output":false,"Extensions":{},"Examples":[],"Format":"","Discriminator":null,"ComplexAny":false,"OutputLocation":"","ResolvedModel":"","EventStreamEnvelope":false,"ResponseEnvelope":false},"Values":["hidden","on_request"],"Names":[],"Open":false,"Format":""},"Scope":"shared","IsComponent":true,"Truncated":false,"Comments":null,"Input":false,"Output":false,"Extensions":{},"Examples":[],"Format":"","Discriminator":null,"ComplexAny":false,"OutputLocation":"models/shared","ResolvedModel":"PriceTierDisplayMode","EventStreamEnvelope":false,"ResponseEnvelope":false},"Comments":null,"Annotations":[{"Ignore":false,"FieldName":"display_mode"}],"Nullable":false,"Optional":true,"SerializationMethod":null,"ErrorMessage":false,"Const":null,"Default":null,"IsAdditionalProperties":false,"ParameterIndex":null},{"Name":"flat_fee_amount","OriginalName":"flat_fee_amount","Type":{"Name":"","OriginalName":"","ContextStack":[],"Type":"number","ItemType":null,"Fields":[],"Validations":{"MinItems":null,"MinLength":null,"Minimum":null,"MaxItems":null,"MaxLength":null,"Maximum":null,"Pattern":null,"UniqueItems":null},"AssociatedTypes":[],"Enum":null,"Scope":"","IsComponent":false,"Truncated":false,"Comments":null,"Input":false,"Output":false,"Extensions":{},"Examples":[],"Format":"","Discriminator":null,"ComplexAny":false,"OutputLocation":"","ResolvedModel":"","EventStreamEnvelope":false,"ResponseEnvelope":false},"Comments":null,"Annotations":[{"Ignore":false,"FieldName":"flat_fee_amount"}],"Nullable":false,"Optional":true,"SerializationMethod":null,"ErrorMessage":false,"Const":null,"Default":null,"IsAdditionalProperties":false,"ParameterIndex":null},{"Name":"flat_fee_amount_decimal","OriginalName":"flat_fee_amount_decimal","Type":{"Name":"","OriginalName":"","ContextStack":[],"Type":"string","ItemType":null,"Fields":[],"Validations":{"MinItems":null,"MinLength":null,"Minimum":null,"MaxItems":null,"MaxLength":null,"Maximum":null,"Pattern":null,"UniqueItems":null},"AssociatedTypes":[],"Enum":null,"Scope":"","IsComponent":false,"Truncated":false,"Comments":null,"Input":false,"Output":false,"Extensions":{},"Examples":[],"Format":"","Discriminator":null,"ComplexAny":false,"OutputLocation":"","ResolvedModel":"","EventStreamEnvelope":false,"ResponseEnvelope":false},"Comments":null,"Annotations":[{"Ignore":false,"FieldName":"flat_fee_amount_decimal"}],"Nullable":false,"Optional":true,"SerializationMethod":null,"ErrorMessage":false,"Const":null,"Default":null,"IsAdditionalProperties":false,"ParameterIndex":null},{"Name":"unit_amount","OriginalName":"unit_amount","Type":{"Name":"","OriginalName":"","ContextStack":[],"Type":"number","ItemType":null,"Fields":[],"Validations":{"MinItems":null,"MinLength":null,"Minimum":null,"MaxItems":null,"MaxLength":null,"Maximum":null,"Pattern":null,"UniqueItems":null},"AssociatedTypes":[],"Enum":null,"Scope":"","IsComponent":false,"Truncated":false,"Comments":null,"Input":false,"Output":false,"Extensions":{},"Examples":[],"Format":"","Discriminator":null,"ComplexAny":false,"OutputLocation":"","ResolvedModel":"","EventStreamEnvelope":false,"ResponseEnvelope":false},"Comments":null,"Annotations":[{"Ignore":false,"FieldName":"unit_amount"}],"Nullable":false,"Optional":true,"SerializationMethod":null,"ErrorMessage":false,"Const":null,"Default":null,"IsAdditionalProperties":false,"ParameterIndex":null},{"Name":"unit_amount_decimal","OriginalName":"unit_amount_decimal","Type":{"Name":"","OriginalName":"","ContextStack":[],"Type":"string","ItemType":null,"Fields":[],"Validations":{"MinItems":null,"MinLength":null,"Minimum":null,"MaxItems":null,"MaxLength":null,"Maximum":null,"Pattern":null,"UniqueItems":null},"AssociatedTypes":[],"Enum":null,"Scope":"","IsComponent":false,"Truncated":false,"Comments":null,"Input":false,"Output":false,"Extensions":{},"Examples":[],"Format":"","Discriminator":null,"ComplexAny":false,"OutputLocation":"","ResolvedModel":"","EventStreamEnvelope":false,"ResponseEnvelope":false},"Comments":null,"Annotations":[{"Ignore":false,"FieldName":"unit_amount_decimal"}],"Nullable":false,"Optional":true,"SerializationMethod":null,"ErrorMessage":false,"Const":null,"Default":null,"IsAdditionalProperties":false,"ParameterIndex":null},{"Name":"up_to","OriginalName":"up_to","Type":{"Name":"","OriginalName":"","ContextStack":[],"Type":"number","ItemType":null,"Fields":[],"Validations":{"MinItems":null,"MinLength":null,"Minimum":null,"MaxItems":null,"MaxLength":null,"Maximum":null,"Pattern":null,"UniqueItems":null},"AssociatedTypes":[],"Enum":null,"Scope":"","IsComponent":false,"Truncated":false,"Comments":null,"Input":false,"Output":false,"Extensions":{},"Examples":[],"Format":"","Discriminator":null,"ComplexAny":false,"OutputLocation":"","ResolvedModel":"","EventStreamEnvelope":false,"ResponseEnvelope":false},"Comments":null,"Annotations":[{"Ignore":false,"FieldName":"up_to"}],"Nullable":true,"Optional":true,"SerializationMethod":null,"ErrorMessage":false,"Const":null,"Default":null,"IsAdditionalProperties":false,"ParameterIndex":null}],"Validations":{"MinItems":null,"MinLength":null,"Minimum":null,"MaxItems":null,"MaxLength":null,"Maximum":null,"Pattern":null,"UniqueItems":null},"AssociatedTypes":[],"Enum":null,"Scope":"shared","IsComponent":true,"Truncated":false,"Comments":null,"Input":false,"Output":false,"Extensions":{},"Examples":[],"Format":"","Discriminator":null,"ComplexAny":false,"OutputLocation":"models/shared","ResolvedModel":"PriceTier","EventStreamEnvelope":false,"ResponseEnvelope":false},"Input":false,"ResponseEnvelope":false,"Type":"class","AssociatedTypes":[],"Truncated":false,"ItemType":null,"Output":false,"Name":"PriceTier","Discriminator":null,"IsComponent":true},"Fields":[],"IsComponent":false,"Truncated":false,"EventStreamEnvelope":false,"Original":{"Name":"","OriginalName":"","ContextStack":[],"Type":"array","ItemType":{"Name":"PriceTier","OriginalName":"PriceTier","ContextStack":[{"Type":"refType","Identifier":"Schemas","Used":false,"MustUse":false},{"Type":"refName","Identifier":"PriceTier","Used":false,"MustUse":false},{"Type":"component","Identifier":"true","Used":false,"MustUse":false}],"Type":"class","ItemType":null,"Fields":[{"Name":"display_mode","OriginalName":"display_mode","Type":{"Name":"PriceTierDisplayMode","OriginalName":"PriceTierDisplayMode","ContextStack":[{"Type":"refType","Identifier":"Schemas","Used":false,"MustUse":false},{"Type":"refName","Identifier":"PriceTierDisplayMode","Used":false,"MustUse":false},{"Type":"component","Identifier":"true","Used":false,"MustUse":false}],"Type":"enum","ItemType":null,"Fields":[],"Validations":{"MinItems":null,"MinLength":null,"Minimum":null,"MaxItems":null,"MaxLength":null,"Maximum":null,"Pattern":null,"UniqueItems":null},"AssociatedTypes":[],"Enum":{"Type":{"Name":"","OriginalName":"","ContextStack":[],"Type":"string","ItemType":null,"Fields":[],"Validations":{"MinItems":null,"MinLength":null,"Minimum":null,"MaxItems":null,"MaxLength":null,"Maximum":null,"Pattern":null,"UniqueItems":null},"AssociatedTypes":[],"Enum":null,"Scope":"","IsComponent":false,"Truncated":false,"Comments":null,"Input":false,"Output":false,"Extensions":{},"Examples":[],"Format":"","Discriminator":null,"ComplexAny":false,"OutputLocation":"","ResolvedModel":"","EventStreamEnvelope":false,"ResponseEnvelope":false},"Values":["hidden","on_request"],"Names":[],"Open":false,"Format":""},"Scope":"shared","IsComponent":true,"Truncated":false,"Comments":null,"Input":false,"Output":false,"Extensions":{},"Examples":[],"Format":"","Discriminator":null,"ComplexAny":false,"OutputLocation":"models/shared","ResolvedModel":"PriceTierDisplayMode","EventStreamEnvelope":false,"ResponseEnvelope":false},"Comments":null,"Annotations":[{"Ignore":false,"FieldName":"display_mode"}],"Nullable":false,"Optional":true,"SerializationMethod":null,"ErrorMessage":false,"Const":null,"Default":null,"IsAdditionalProperties":false,"ParameterIndex":null},{"Name":"flat_fee_amount","OriginalName":"flat_fee_amount","Type":{"Name":"","OriginalName":"","ContextStack":[],"Type":"number","ItemType":null,"Fields":[],"Validations":{"MinItems":null,"MinLength":null,"Minimum":null,"MaxItems":null,"MaxLength":null,"Maximum":null,"Pattern":null,"UniqueItems":null},"AssociatedTypes":[],"Enum":null,"Scope":"","IsComponent":false,"Truncated":false,"Comments":null,"Input":false,"Output":false,"Extensions":{},"Examples":[],"Format":"","Discriminator":null,"ComplexAny":false,"OutputLocation":"","ResolvedModel":"","EventStreamEnvelope":false,"ResponseEnvelope":false},"Comments":null,"Annotations":[{"Ignore":false,"FieldName":"flat_fee_amount"}],"Nullable":false,"Optional":true,"SerializationMethod":null,"ErrorMessage":false,"Const":null,"Default":null,"IsAdditionalProperties":false,"ParameterIndex":null},{"Name":"flat_fee_amount_decimal","OriginalName":"flat_fee_amount_decimal","Type":{"Name":"","OriginalName":"","ContextStack":[],"Type":"string","ItemType":null,"Fields":[],"Validations":{"MinItems":null,"MinLength":null,"Minimum":null,"MaxItems":null,"MaxLength":null,"Maximum":null,"Pattern":null,"UniqueItems":null},"AssociatedTypes":[],"Enum":null,"Scope":"","IsComponent":false,"Truncated":false,"Comments":null,"Input":false,"Output":false,"Extensions":{},"Examples":[],"Format":"","Discriminator":null,"ComplexAny":false,"OutputLocation":"","ResolvedModel":"","EventStreamEnvelope":false,"ResponseEnvelope":false},"Comments":null,"Annotations":[{"Ignore":false,"FieldName":"flat_fee_amount_decimal"}],"Nullable":false,"Optional":true,"SerializationMethod":null,"ErrorMessage":false,"Const":null,"Default":null,"IsAdditionalProperties":false,"ParameterIndex":null},{"Name":"unit_amount","OriginalName":"unit_amount","Type":{"Name":"","OriginalName":"","ContextStack":[],"Type":"number","ItemType":null,"Fields":[],"Validations":{"MinItems":null,"MinLength":null,"Minimum":null,"MaxItems":null,"MaxLength":null,"Maximum":null,"Pattern":null,"UniqueItems":null},"AssociatedTypes":[],"Enum":null,"Scope":"","IsComponent":false,"Truncated":false,"Comments":null,"Input":false,"Output":false,"Extensions":{},"Examples":[],"Format":"","Discriminator":null,"ComplexAny":false,"OutputLocation":"","ResolvedModel":"","EventStreamEnvelope":false,"ResponseEnvelope":false},"Comments":null,"Annotations":[{"Ignore":false,"FieldName":"unit_amount"}],"Nullable":false,"Optional":true,"SerializationMethod":null,"ErrorMessage":false,"Const":null,"Default":null,"IsAdditionalProperties":false,"ParameterIndex":null},{"Name":"unit_amount_decimal","OriginalName":"unit_amount_decimal","Type":{"Name":"","OriginalName":"","ContextStack":[],"Type":"string","ItemType":null,"Fields":[],"Validations":{"MinItems":null,"MinLength":null,"Minimum":null,"MaxItems":null,"MaxLength":null,"Maximum":null,"Pattern":null,"UniqueItems":null},"AssociatedTypes":[],"Enum":null,"Scope":"","IsComponent":false,"Truncated":false,"Comments":null,"Input":false,"Output":false,"Extensions":{},"Examples":[],"Format":"","Discriminator":null,"ComplexAny":false,"OutputLocation":"","ResolvedModel":"","EventStreamEnvelope":false,"ResponseEnvelope":false},"Comments":null,"Annotations":[{"Ignore":false,"FieldName":"unit_amount_decimal"}],"Nullable":false,"Optional":true,"SerializationMethod":null,"ErrorMessage":false,"Const":null,"Default":null,"IsAdditionalProperties":false,"ParameterIndex":null},{"Name":"up_to","OriginalName":"up_to","Type":{"Name":"","OriginalName":"","ContextStack":[],"Type":"number","ItemType":null,"Fields":[],"Validations":{"MinItems":null,"MinLength":null,"Minimum":null,"MaxItems":null,"MaxLength":null,"Maximum":null,"Pattern":null,"UniqueItems":null},"AssociatedTypes":[],"Enum":null,"Scope":"","IsComponent":false,"Truncated":false,"Comments":null,"Input":false,"Output":false,"Extensions":{},"Examples":[],"Format":"","Discriminator":null,"ComplexAny":false,"OutputLocation":"","ResolvedModel":"","EventStreamEnvelope":false,"ResponseEnvelope":false},"Comments":null,"Annotations":[{"Ignore":false,"FieldName":"up_to"}],"Nullable":true,"Optional":true,"SerializationMethod":null,"ErrorMessage":false,"Const":null,"Default":null,"IsAdditionalProperties":false,"ParameterIndex":null}],"Validations":{"MinItems":null,"MinLength":null,"Minimum":null,"MaxItems":null,"MaxLength":null,"Maximum":null,"Pattern":null,"UniqueItems":null},"AssociatedTypes":[],"Enum":null,"Scope":"shared","IsComponent":true,"Truncated":false,"Comments":null,"Input":false,"Output":false,"Extensions":{},"Examples":[],"Format":"","Discriminator":null,"ComplexAny":false,"OutputLocation":"models/shared","ResolvedModel":"PriceTier","EventStreamEnvelope":false,"ResponseEnvelope":false},"Fields":[],"Validations":{"MinItems":null,"MinLength":null,"Minimum":null,"MaxItems":null,"MaxLength":null,"Maximum":null,"Pattern":null,"UniqueItems":null},"AssociatedTypes":[],"Enum":null,"Scope":"","IsComponent":false,"Truncated":false,"Comments":null,"Input":false,"Output":false,"Extensions":{},"Examples":[],"Format":"","Discriminator":null,"ComplexAny":false,"OutputLocation":"","ResolvedModel":"","EventStreamEnvelope":false,"ResponseEnvelope":false},"ContextStack":[]},"Name":"tiers","Nullable":false,"Optional":true,"Comments":{"DeprecationReplacement":"","Description":"Defines an array of tiers. Each tier has an upper bound, an unit amount and a flat fee.\n","ExternalDocs":null,"Summary":"","Deprecated":false,"DeprecationMessage":""},"Annotations":[{"Ignore":false,"FieldName":"tiers"}],"OriginalName":"tiers","Const":null,"IsAdditionalProperties":false,"ErrorMessage":false,"Default":null},{"ErrorMessage":false,"Type":{"ContextStack":[{"Type":"refType","Identifier":"Schemas","Used":false,"MustUse":false},{"Type":"refName","Identifier":"PriceCreate","Used":true,"MustUse":false}],"Input":false,"CircularReference":null,"ResponseEnvelope":false,"Discriminator":null,"Original":{"Name":"PriceCreate_type","OriginalName":"type","ContextStack":[{"Type":"refType","Identifier":"Schemas","Used":false,"MustUse":false},{"Type":"refName","Identifier":"PriceCreate","Used":true,"MustUse":false}],"Type":"enum","ItemType":null,"Fields":[],"Validations":{"MinItems":null,"MinLength":null,"Minimum":null,"MaxItems":null,"MaxLength":null,"Maximum":null,"Pattern":null,"UniqueItems":null},"AssociatedTypes":[],"Enum":{"Type":{"Name":"","OriginalName":"","ContextStack":[],"Type":"string","ItemType":null,"Fields":[],"Validations":{"MinItems":null,"MinLength":null,"Minimum":null,"MaxItems":null,"MaxLength":null,"Maximum":null,"Pattern":null,"UniqueItems":null},"AssociatedTypes":[],"Enum":null,"Scope":"","IsComponent":false,"Truncated":false,"Comments":null,"Input":false,"Output":false,"Extensions":{},"Examples":[],"Format":"","Discriminator":null,"ComplexAny":false,"OutputLocation":"","ResolvedModel":"","EventStreamEnvelope":false,"ResponseEnvelope":false},"Values":["one_time","recurring"],"Names":[],"Open":false,"Format":""},"Scope":"shared","IsComponent":false,"Truncated":false,"Comments":{"Summary":"","Description":"One of `one_time` or `recurring` depending on whether the price is for a one-time purchase or a recurring (subscription) purchase.","ExternalDocs":null,"ExtendedComments":{},"Deprecated":false,"DeprecationReplacement":"","DeprecationMessage":""},"Input":false,"Output":false,"Extensions":{},"Examples":[],"Format":"","Discriminator":null,"ComplexAny":false,"OutputLocation":"models/shared","ResolvedModel":"PriceCreate","EventStreamEnvelope":false,"ResponseEnvelope":false},"Comments":{"ExternalDocs":null,"ExtendedComments":{},"Deprecated":false,"DeprecationReplacement":"","DeprecationMessage":"","Summary":"","Description":"One of `one_time` or `recurring` depending on whether the price is for a one-time purchase or a recurring (subscription) purchase."},"ItemType":null,"Format":"","Output":false,"OutputLocation":"models/shared","Enum":{"Values":["one_time","recurring"],"Type":{"ResponseEnvelope":false,"OutputLocation":"","Examples":[],"Fields":[],"OriginalName":"","CircularReference":null,"EventStreamEnvelope":false,"ResolvedModel":"","ContextStack":[],"AssociatedTypes":[],"Comments":null,"Format":"","Output":false,"Scope":"","Name":"","Extensions":{},"Truncated":false,"Validations":{"Minimum":null,"MaxItems":null,"MaxLength":null,"Maximum":null,"Pattern":null,"UniqueItems":null,"MinItems":null,"MinLength":null},"Type":"string","IsComponent":false,"Discriminator":null,"Input":false,"ItemType":null,"Original":{"Name":"","OriginalName":"","ContextStack":[],"Type":"string","ItemType":null,"Fields":[],"Validations":{"MinItems":null,"MinLength":null,"Minimum":null,"MaxItems":null,"MaxLength":null,"Maximum":null,"Pattern":null,"UniqueItems":null},"AssociatedTypes":[],"Enum":null,"Scope":"","IsComponent":false,"Truncated":false,"Comments":null,"Input":false,"Output":false,"Extensions":{},"Examples":[],"Format":"","Discriminator":null,"ComplexAny":false,"OutputLocation":"","ResolvedModel":"","EventStreamEnvelope":false,"ResponseEnvelope":false},"Enum":null},"Open":false,"Names":[]},"Fields":[],"IsComponent":false,"Scope":"shared","ResolvedModel":"PriceCreate","AssociatedTypes":[],"Truncated":false,"Validations":{"Pattern":null,"UniqueItems":null,"MinItems":null,"MinLength":null,"Minimum":null,"MaxItems":null,"MaxLength":null,"Maximum":null},"OriginalName":"type","Name":"PriceCreate_type","Extensions":{"x-speakeasy-trace":{"Price#create.req.type":true},"x-speakeasy-param-computed":true,"x-untouched":true,"x-speakeasy-in-get":true},"Examples":[],"EventStreamEnvelope":false,"Type":"enum"},"Name":"type","Default":{"Value":"one_time"},"Comments":{"DeprecationMessage":"","DeprecationReplacement":"","Description":"One of `one_time` or `recurring` depending on whether the price is for a one-time purchase or a recurring (subscription) purchase.","ExternalDocs":null,"Summary":"","Deprecated":false},"IsAdditionalProperties":false,"OriginalName":"type","Nullable":false,"Optional":true,"Const":null,"Annotations":[{"Ignore":false,"FieldName":"type"}]},{"Annotations":[{"Ignore":false,"FieldName":"unit"}],"Name":"unit","Comments":{"Deprecated":false,"DeprecationMessage":"","DeprecationReplacement":"","Description":"The unit of measurement used for display purposes and possibly for calculations when the price is variable.","ExternalDocs":null,"Summary":""},"Nullable":false,"Optional":true,"Default":null,"Const":null,"IsAdditionalProperties":false,"ErrorMessage":false,"OriginalName":"unit","Type":{"Type":"string","AssociatedTypes":[],"IsComponent":false,"Output":false,"Truncated":false,"OutputLocation":"","Comments":null,"Name":"","Extensions":{"x-speakeasy-trace":{"Price#create.req.unit":true},"x-speakeasy-param-computed":true,"x-untouched":true,"x-speakeasy-in-get":true},"Format":"","CircularReference":null,"ResponseEnvelope":false,"Original":{"Name":"","OriginalName":"","ContextStack":[],"Type":"string","ItemType":null,"Fields":[],"Validations":{"MinItems":null,"MinLength":null,"Minimum":null,"MaxItems":null,"MaxLength":null,"Maximum":null,"Pattern":null,"UniqueItems":null},"AssociatedTypes":[],"Enum":null,"Scope":"","IsComponent":false,"Truncated":false,"Comments":null,"Input":false,"Output":false,"Extensions":{},"Examples":[],"Format":"","Discriminator":null,"ComplexAny":false,"OutputLocation":"","ResolvedModel":"","EventStreamEnvelope":false,"ResponseEnvelope":false},"ItemType":null,"EventStreamEnvelope":false,"Fields":[],"ContextStack":[],"Enum":null,"OriginalName":"","Examples":[],"ResolvedModel":"","Input":false,"Scope":"","Validations":{"UniqueItems":null,"MinItems":null,"MinLength":null,"Minimum":null,"MaxItems":null,"MaxLength":null,"Maximum":null,"Pattern":null},"Discriminator":null}},{"Name":"unit_amount","Nullable":false,"Comments":{"DeprecationReplacement":"","Description":"The unit amount in cents to be charged, represented as a whole integer if possible.","ExternalDocs":null,"Summary":"","Deprecated":false,"DeprecationMessage":""},"IsAdditionalProperties":false,"Const":null,"Annotations":[{"Ignore":false,"FieldName":"unit_amount"}],"ErrorMessage":false,"OriginalName":"unit_amount","Type":{"EventStreamEnvelope":false,"ResolvedModel":"","Discriminator":null,"CircularReference":null,"Format":"","OriginalName":"","OutputLocation":"","Name":"","Output":false,"Scope":"","ResponseEnvelope":false,"ContextStack":[],"Enum":null,"Examples":[],"Original":{"Name":"","OriginalName":"","ContextStack":[],"Type":"number","ItemType":null,"Fields":[],"Validations":{"MinItems":null,"MinLength":null,"Minimum":null,"MaxItems":null,"MaxLength":null,"Maximum":null,"Pattern":null,"UniqueItems":null},"AssociatedTypes":[],"Enum":null,"Scope":"","IsComponent":false,"Truncated":false,"Comments":null,"Input":false,"Output":false,"Extensions":{},"Examples":[],"Format":"","Discriminator":null,"ComplexAny":false,"OutputLocation":"","ResolvedModel":"","EventStreamEnvelope":false,"ResponseEnvelope":false},"ItemType":null,"Truncated":false,"Extensions":{"x-speakeasy-param-computed":true,"x-untouched":true,"x-speakeasy-in-get":true,"x-speakeasy-trace":{"Price#create.req.unit_amount":true}},"AssociatedTypes":[],"Fields":[],"IsComponent":false,"Type":"number","Comments":null,"Input":false,"Validations":{"Pattern":null,"UniqueItems":null,"MinItems":null,"MinLength":null,"Minimum":null,"MaxItems":null,"MaxLength":null,"Maximum":null}},"Optional":true,"Default":null},{"Type":{"ResolvedModel":"","ResponseEnvelope":false,"OutputLocation":"","AssociatedTypes":[],"ItemType":null,"Validations":{"MinLength":null,"Minimum":null,"MaxItems":null,"MaxLength":null,"Maximum":null,"Pattern":null,"UniqueItems":null,"MinItems":null},"OriginalName":"","ContextStack":[],"Comments":null,"Discriminator":null,"Fields":[],"Scope":"","CircularReference":null,"Original":{"Name":"","OriginalName":"","ContextStack":[],"Type":"string","ItemType":null,"Fields":[],"Validations":{"MinItems":null,"MinLength":null,"Minimum":null,"MaxItems":null,"MaxLength":null,"Maximum":null,"Pattern":null,"UniqueItems":null},"AssociatedTypes":[],"Enum":null,"Scope":"","IsComponent":false,"Truncated":false,"Comments":null,"Input":false,"Output":false,"Extensions":{},"Examples":[{}],"Format":"","Discriminator":null,"ComplexAny":false,"OutputLocation":"","ResolvedModel":"","EventStreamEnvelope":false,"ResponseEnvelope":false},"Examples":[{}],"Format":"","Truncated":false,"EventStreamEnvelope":false,"Input":false,"IsComponent":false,"Output":false,"Name":"","Type":"string","Extensions":{"x-speakeasy-trace":{"Price#create.req.unit_amount_currency":true},"x-speakeasy-param-computed":true,"x-untouched":true,"x-speakeasy-in-get":true},"Enum":null},"Name":"unit_amount_currency","Const":null,"Comments":{"Summary":"","Deprecated":false,"DeprecationMessage":"","DeprecationReplacement":"","Description":"Three-letter ISO currency code, in lowercase.","ExternalDocs":null},"IsAdditionalProperties":false,"ErrorMessage":false,"OriginalName":"unit_amount_currency","Nullable":false,"Optional":true,"Default":null,"Annotations":[{"Ignore":false,"FieldName":"unit_amount_currency"}]},{"Name":"unit_amount_decimal","Nullable":false,"Comments":{"DeprecationReplacement":"","Description":"The unit amount in cents to be charged, represented as a decimal string with at most 12 decimal places.","ExternalDocs":null,"Summary":"","Deprecated":false,"DeprecationMessage":""},"ErrorMessage":false,"IsAdditionalProperties":false,"OriginalName":"unit_amount_decimal","Type":{"CircularReference":null,"ResponseEnvelope":false,"OriginalName":"","Input":false,"IsComponent":false,"Type":"string","OutputLocation":"","Validations":{"MaxLength":null,"Maximum":null,"Pattern":null,"UniqueItems":null,"MinItems":null,"MinLength":null,"Minimum":null,"MaxItems":null},"Original":{"Name":"","OriginalName":"","ContextStack":[],"Type":"string","ItemType":null,"Fields":[],"Validations":{"MinItems":null,"MinLength":null,"Minimum":null,"MaxItems":null,"MaxLength":null,"Maximum":null,"Pattern":null,"UniqueItems":null},"AssociatedTypes":[],"Enum":null,"Scope":"","IsComponent":false,"Truncated":false,"Comments":null,"Input":false,"Output":false,"Extensions":{},"Examples":[],"Format":"","Discriminator":null,"ComplexAny":false,"OutputLocation":"","ResolvedModel":"","EventStreamEnvelope":false,"ResponseEnvelope":false},"Name":"","Comments":null,"Discriminator":null,"EventStreamEnvelope":false,"Examples":[],"Format":"","ItemType":null,"ResolvedModel":"","Enum":null,"Truncated":false,"Extensions":{"x-speakeasy-in-get":true,"x-speakeasy-trace":{"Price#create.req.unit_amount_decimal":true},"x-speakeasy-param-computed":true,"x-untouched":true},"Fields":[],"Scope":"","ContextStack":[],"AssociatedTypes":[],"Output":false},"Optional":true,"Default":null,"Const":null,"Annotations":[{"Ignore":false,"FieldName":"unit_amount_decimal"}]},{"Type":{"Scope":"","Discriminator":null,"Examples":[],"IsComponent":false,"EventStreamEnvelope":false,"Fields":[],"Output":false,"Validations":{"Maximum":null,"Pattern":null,"UniqueItems":null,"MinItems":null,"MinLength":null,"Minimum":null,"MaxItems":null,"MaxLength":null},"ResponseEnvelope":false,"Enum":null,"AssociatedTypes":[],"Truncated":false,"ItemType":null,"OriginalName":"","OutputLocation":"","ContextStack":[],"Type":"boolean","Extensions":{"x-speakeasy-param-computed":true,"x-untouched":true,"x-speakeasy-in-get":true,"x-speakeasy-trace":{"Price#create.req.variable_price":true}},"Input":false,"CircularReference":null,"Comments":null,"Format":"","ResolvedModel":"","Original":{"Name":"","OriginalName":"","ContextStack":[],"Type":"boolean","ItemType":null,"Fields":[],"Validations":{"MinItems":null,"MinLength":null,"Minimum":null,"MaxItems":null,"MaxLength":null,"Maximum":null,"Pattern":null,"UniqueItems":null},"AssociatedTypes":[],"Enum":null,"Scope":"","IsComponent":false,"Truncated":false,"Comments":null,"Input":false,"Output":false,"Extensions":{},"Examples":[],"Format":"","Discriminator":null,"ComplexAny":false,"OutputLocation":"","ResolvedModel":"","EventStreamEnvelope":false,"ResponseEnvelope":false},"Name":""},"Nullable":false,"Comments":{"Description":"The flag for prices that can be influenced by external variables such as user input.","ExternalDocs":null,"Summary":"","Deprecated":false,"DeprecationMessage":"","DeprecationReplacement":""},"IsAdditionalProperties":false,"ErrorMessage":false,"Annotations":[{"Ignore":false,"FieldName":"variable_price"}],"OriginalName":"variable_price","Name":"variable_price","Optional":true,"Default":{"Value":false},"Const":null}],"Input":false,"Scope":"shared","OriginalName":"PriceCreate"} + // {"Examples":[],"ItemType":null,"EventStreamEnvelope":false,"OriginalName":"","OutputLocation":"","ContextStack":[],"Fields":[],"Input":false,"IsComponent":false,"Scope":"","Type":"boolean","Comments":{"DeprecationMessage":"","Summary":"","Description":"Hydrates entities in relations when passed true","ExternalDocs":null,"ExtendedComments":{},"Deprecated":false,"DeprecationReplacement":""},"Output":false,"CircularReference":null,"Format":"","Truncated":false,"Extensions":{},"ResolvedModel":"","Discriminator":null,"ResponseEnvelope":false,"Original":{"Name":"","OriginalName":"","ContextStack":[],"Type":"boolean","ItemType":null,"Fields":[],"Validations":{"MinItems":null,"MinLength":null,"Minimum":null,"MaxItems":null,"MaxLength":null,"Maximum":null,"Pattern":null,"UniqueItems":null},"AssociatedTypes":[],"Enum":null,"Scope":"","IsComponent":false,"Truncated":false,"Comments":{"Summary":"","Description":"Hydrates entities in relations when passed true","ExternalDocs":null,"ExtendedComments":{},"Deprecated":false,"DeprecationReplacement":"","DeprecationMessage":""},"Input":false,"Output":false,"Extensions":{},"Examples":[],"Format":"","Discriminator":null,"ComplexAny":false,"OutputLocation":"","ResolvedModel":"","EventStreamEnvelope":false,"ResponseEnvelope":false},"Name":"","Enum":null,"AssociatedTypes":[],"Validations":{"UniqueItems":null,"MinItems":null,"MinLength":null,"Minimum":null,"MaxItems":null,"MaxLength":null,"Maximum":null,"Pattern":null}} var hydrate *bool priceID := data.ID.ValueString() request := operations.GetPriceRequest{ @@ -415,12 +419,16 @@ func (r *PriceResource) Read(ctx context.Context, req resource.ReadRequest, resp resp.Diagnostics.AddError("unexpected response from API", fmt.Sprintf("%v", res)) return } + if res.StatusCode == 404 { + resp.State.RemoveResource(ctx) + return + } if res.StatusCode != 200 { resp.Diagnostics.AddError(fmt.Sprintf("unexpected response from API. Got an unexpected response code %v", res.StatusCode), debugResponse(res.RawResponse)) return } - if res.Price == nil { - resp.Diagnostics.AddError("unexpected response from API. No response body", debugResponse(res.RawResponse)) + if !(res.Price != nil) { + resp.Diagnostics.AddError("unexpected response from API. Got an unexpected response body", debugResponse(res.RawResponse)) return } data.RefreshFromSharedPrice(res.Price) @@ -465,8 +473,8 @@ func (r *PriceResource) Update(ctx context.Context, req resource.UpdateRequest, resp.Diagnostics.AddError(fmt.Sprintf("unexpected response from API. Got an unexpected response code %v", res.StatusCode), debugResponse(res.RawResponse)) return } - if res.Price == nil { - resp.Diagnostics.AddError("unexpected response from API. No response body", debugResponse(res.RawResponse)) + if !(res.Price != nil) { + resp.Diagnostics.AddError("unexpected response from API. Got an unexpected response body", debugResponse(res.RawResponse)) return } data.RefreshFromSharedPrice(res.Price) diff --git a/internal/provider/price_resource_sdk.go b/internal/provider/price_resource_sdk.go index 5bfe133..e4975a7 100644 --- a/internal/provider/price_resource_sdk.go +++ b/internal/provider/price_resource_sdk.go @@ -1,10 +1,11 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasyapi.com). DO NOT EDIT. package provider import ( "encoding/json" - "github.com/epilot-dev/terraform-provider-epilot-product/internal/sdk/pkg/models/shared" + tfTypes "github.com/epilot-dev/terraform-provider-epilot-product/internal/provider/types" + "github.com/epilot-dev/terraform-provider-epilot-product/internal/sdk/models/shared" "github.com/hashicorp/terraform-plugin-framework/types" "math/big" ) @@ -54,6 +55,29 @@ func (r *PriceResourceModel) ToSharedPriceCreate() *shared.PriceCreate { } else { noticeTimeUnit = nil } + var priceComponents *shared.PriceCreatePriceComponents + if r.PriceComponents != nil { + var dollarRelation []shared.PriceComponentRelation = []shared.PriceComponentRelation{} + for _, dollarRelationItem := range r.PriceComponents.DollarRelation { + var tags []string = []string{} + for _, tagsItem := range dollarRelationItem.Tags { + tags = append(tags, tagsItem.ValueString()) + } + entityID := new(string) + if !dollarRelationItem.EntityID.IsUnknown() && !dollarRelationItem.EntityID.IsNull() { + *entityID = dollarRelationItem.EntityID.ValueString() + } else { + entityID = nil + } + dollarRelation = append(dollarRelation, shared.PriceComponentRelation{ + Tags: tags, + EntityID: entityID, + }) + } + priceComponents = &shared.PriceCreatePriceComponents{ + DollarRelation: dollarRelation, + } + } priceDisplayInJourneys := new(shared.PriceCreatePriceDisplayInJourneys) if !r.PriceDisplayInJourneys.IsUnknown() && !r.PriceDisplayInJourneys.IsNull() { *priceDisplayInJourneys = shared.PriceCreatePriceDisplayInJourneys(r.PriceDisplayInJourneys.ValueString()) @@ -94,7 +118,7 @@ func (r *PriceResourceModel) ToSharedPriceCreate() *shared.PriceCreate { } else { terminationTimeUnit = nil } - var tiers []shared.PriceTier = nil + var tiers []shared.PriceTier = []shared.PriceTier{} for _, tiersItem := range r.Tiers { displayMode := new(shared.PriceTierDisplayMode) if !tiersItem.DisplayMode.IsUnknown() && !tiersItem.DisplayMode.IsNull() { @@ -147,30 +171,11 @@ func (r *PriceResourceModel) ToSharedPriceCreate() *shared.PriceCreate { } else { typeVar = nil } - var unit *shared.PriceCreateUnit - if r.Unit != nil { - priceCreate1 := new(shared.PriceCreate1) - if !r.Unit.One.IsUnknown() && !r.Unit.One.IsNull() { - *priceCreate1 = shared.PriceCreate1(r.Unit.One.ValueString()) - } else { - priceCreate1 = nil - } - if priceCreate1 != nil { - unit = &shared.PriceCreateUnit{ - PriceCreate1: priceCreate1, - } - } - str := new(string) - if !r.Unit.Str.IsUnknown() && !r.Unit.Str.IsNull() { - *str = r.Unit.Str.ValueString() - } else { - str = nil - } - if str != nil { - unit = &shared.PriceCreateUnit{ - Str: str, - } - } + unit := new(string) + if !r.Unit.IsUnknown() && !r.Unit.IsNull() { + *unit = r.Unit.ValueString() + } else { + unit = nil } unitAmount1 := new(float64) if !r.UnitAmount.IsUnknown() && !r.UnitAmount.IsNull() { @@ -206,6 +211,7 @@ func (r *PriceResourceModel) ToSharedPriceCreate() *shared.PriceCreate { LongDescription: longDescription, NoticeTimeAmount: noticeTimeAmount, NoticeTimeUnit: noticeTimeUnit, + PriceComponents: priceComponents, PriceDisplayInJourneys: priceDisplayInJourneys, PricingModel: pricingModel, RenewalDurationAmount: renewalDurationAmount, @@ -225,132 +231,144 @@ func (r *PriceResourceModel) ToSharedPriceCreate() *shared.PriceCreate { } func (r *PriceResourceModel) RefreshFromSharedPrice(resp *shared.Price) { - r.ID = types.StringValue(resp.ID) - r.Active = types.BoolValue(resp.Active) - if resp.BillingDurationAmount != nil { - r.BillingDurationAmount = types.NumberValue(big.NewFloat(float64(*resp.BillingDurationAmount))) - } else { - r.BillingDurationAmount = types.NumberNull() - } - if resp.BillingDurationUnit != nil { - r.BillingDurationUnit = types.StringValue(string(*resp.BillingDurationUnit)) - } else { - r.BillingDurationUnit = types.StringNull() - } - r.Description = types.StringValue(resp.Description) - r.IsCompositePrice = types.BoolPointerValue(resp.IsCompositePrice) - r.IsTaxInclusive = types.BoolPointerValue(resp.IsTaxInclusive) - r.LongDescription = types.StringPointerValue(resp.LongDescription) - if resp.NoticeTimeAmount != nil { - r.NoticeTimeAmount = types.NumberValue(big.NewFloat(float64(*resp.NoticeTimeAmount))) - } else { - r.NoticeTimeAmount = types.NumberNull() - } - if resp.NoticeTimeUnit != nil { - r.NoticeTimeUnit = types.StringValue(string(*resp.NoticeTimeUnit)) - } else { - r.NoticeTimeUnit = types.StringNull() - } - if resp.PriceDisplayInJourneys != nil { - r.PriceDisplayInJourneys = types.StringValue(string(*resp.PriceDisplayInJourneys)) - } else { - r.PriceDisplayInJourneys = types.StringNull() - } - if resp.PricingModel != nil { - r.PricingModel = types.StringValue(string(*resp.PricingModel)) - } else { - r.PricingModel = types.StringNull() - } - if resp.RenewalDurationAmount != nil { - r.RenewalDurationAmount = types.NumberValue(big.NewFloat(float64(*resp.RenewalDurationAmount))) - } else { - r.RenewalDurationAmount = types.NumberNull() - } - if resp.RenewalDurationUnit != nil { - r.RenewalDurationUnit = types.StringValue(string(*resp.RenewalDurationUnit)) - } else { - r.RenewalDurationUnit = types.StringNull() - } - if resp.Tax == nil { - r.Tax = types.StringNull() - } else { - taxResult, _ := json.Marshal(resp.Tax) - r.Tax = types.StringValue(string(taxResult)) - } - if resp.TerminationTimeAmount != nil { - r.TerminationTimeAmount = types.NumberValue(big.NewFloat(float64(*resp.TerminationTimeAmount))) - } else { - r.TerminationTimeAmount = types.NumberNull() - } - if resp.TerminationTimeUnit != nil { - r.TerminationTimeUnit = types.StringValue(string(*resp.TerminationTimeUnit)) - } else { - r.TerminationTimeUnit = types.StringNull() - } - if len(r.Tiers) > len(resp.Tiers) { - r.Tiers = r.Tiers[:len(resp.Tiers)] - } - for tiersCount, tiersItem := range resp.Tiers { - var tiers1 PriceTier - if tiersItem.DisplayMode != nil { - tiers1.DisplayMode = types.StringValue(string(*tiersItem.DisplayMode)) + if resp != nil { + r.ID = types.StringValue(resp.ID) + r.Active = types.BoolValue(resp.Active) + if resp.BillingDurationAmount != nil { + r.BillingDurationAmount = types.NumberValue(big.NewFloat(float64(*resp.BillingDurationAmount))) } else { - tiers1.DisplayMode = types.StringNull() + r.BillingDurationAmount = types.NumberNull() } - if tiersItem.FlatFeeAmount != nil { - tiers1.FlatFeeAmount = types.NumberValue(big.NewFloat(float64(*tiersItem.FlatFeeAmount))) + if resp.BillingDurationUnit != nil { + r.BillingDurationUnit = types.StringValue(string(*resp.BillingDurationUnit)) } else { - tiers1.FlatFeeAmount = types.NumberNull() + r.BillingDurationUnit = types.StringNull() } - tiers1.FlatFeeAmountDecimal = types.StringPointerValue(tiersItem.FlatFeeAmountDecimal) - if tiersItem.UnitAmount != nil { - tiers1.UnitAmount = types.NumberValue(big.NewFloat(float64(*tiersItem.UnitAmount))) + r.Description = types.StringValue(resp.Description) + r.IsCompositePrice = types.BoolPointerValue(resp.IsCompositePrice) + r.IsTaxInclusive = types.BoolPointerValue(resp.IsTaxInclusive) + r.LongDescription = types.StringPointerValue(resp.LongDescription) + if resp.NoticeTimeAmount != nil { + r.NoticeTimeAmount = types.NumberValue(big.NewFloat(float64(*resp.NoticeTimeAmount))) } else { - tiers1.UnitAmount = types.NumberNull() + r.NoticeTimeAmount = types.NumberNull() } - tiers1.UnitAmountDecimal = types.StringPointerValue(tiersItem.UnitAmountDecimal) - if tiersItem.UpTo != nil { - tiers1.UpTo = types.NumberValue(big.NewFloat(float64(*tiersItem.UpTo))) + if resp.NoticeTimeUnit != nil { + r.NoticeTimeUnit = types.StringValue(string(*resp.NoticeTimeUnit)) } else { - tiers1.UpTo = types.NumberNull() + r.NoticeTimeUnit = types.StringNull() } - if tiersCount+1 > len(r.Tiers) { - r.Tiers = append(r.Tiers, tiers1) + if resp.PriceComponents == nil { + r.PriceComponents = nil } else { - r.Tiers[tiersCount].DisplayMode = tiers1.DisplayMode - r.Tiers[tiersCount].FlatFeeAmount = tiers1.FlatFeeAmount - r.Tiers[tiersCount].FlatFeeAmountDecimal = tiers1.FlatFeeAmountDecimal - r.Tiers[tiersCount].UnitAmount = tiers1.UnitAmount - r.Tiers[tiersCount].UnitAmountDecimal = tiers1.UnitAmountDecimal - r.Tiers[tiersCount].UpTo = tiers1.UpTo + r.PriceComponents = &tfTypes.PriceCreatePriceComponents{} + r.PriceComponents.DollarRelation = []tfTypes.PriceComponentRelation{} + if len(r.PriceComponents.DollarRelation) > len(resp.PriceComponents.DollarRelation) { + r.PriceComponents.DollarRelation = r.PriceComponents.DollarRelation[:len(resp.PriceComponents.DollarRelation)] + } + for dollarRelationCount, dollarRelationItem := range resp.PriceComponents.DollarRelation { + var dollarRelation1 tfTypes.PriceComponentRelation + dollarRelation1.Tags = []types.String{} + for _, v := range dollarRelationItem.Tags { + dollarRelation1.Tags = append(dollarRelation1.Tags, types.StringValue(v)) + } + dollarRelation1.EntityID = types.StringPointerValue(dollarRelationItem.EntityID) + if dollarRelationCount+1 > len(r.PriceComponents.DollarRelation) { + r.PriceComponents.DollarRelation = append(r.PriceComponents.DollarRelation, dollarRelation1) + } else { + r.PriceComponents.DollarRelation[dollarRelationCount].Tags = dollarRelation1.Tags + r.PriceComponents.DollarRelation[dollarRelationCount].EntityID = dollarRelation1.EntityID + } + } } - } - if resp.Type != nil { - r.Type = types.StringValue(string(*resp.Type)) - } else { - r.Type = types.StringNull() - } - if resp.Unit == nil { - r.Unit = nil - } else { - r.Unit = &PriceCreateUnit{} - if resp.Unit.Str != nil { - r.Unit.Str = types.StringPointerValue(resp.Unit.Str) + if resp.PriceDisplayInJourneys != nil { + r.PriceDisplayInJourneys = types.StringValue(string(*resp.PriceDisplayInJourneys)) + } else { + r.PriceDisplayInJourneys = types.StringNull() + } + if resp.PricingModel != nil { + r.PricingModel = types.StringValue(string(*resp.PricingModel)) + } else { + r.PricingModel = types.StringNull() + } + if resp.RenewalDurationAmount != nil { + r.RenewalDurationAmount = types.NumberValue(big.NewFloat(float64(*resp.RenewalDurationAmount))) + } else { + r.RenewalDurationAmount = types.NumberNull() + } + if resp.RenewalDurationUnit != nil { + r.RenewalDurationUnit = types.StringValue(string(*resp.RenewalDurationUnit)) + } else { + r.RenewalDurationUnit = types.StringNull() + } + if resp.Tax == nil { + r.Tax = types.StringNull() + } else { + taxResult, _ := json.Marshal(resp.Tax) + r.Tax = types.StringValue(string(taxResult)) + } + if resp.TerminationTimeAmount != nil { + r.TerminationTimeAmount = types.NumberValue(big.NewFloat(float64(*resp.TerminationTimeAmount))) + } else { + r.TerminationTimeAmount = types.NumberNull() + } + if resp.TerminationTimeUnit != nil { + r.TerminationTimeUnit = types.StringValue(string(*resp.TerminationTimeUnit)) + } else { + r.TerminationTimeUnit = types.StringNull() } - if resp.Unit.One != nil { - if resp.Unit.One != nil { - r.Unit.One = types.StringValue(string(*resp.Unit.One)) + r.Tiers = []tfTypes.PriceTier{} + if len(r.Tiers) > len(resp.Tiers) { + r.Tiers = r.Tiers[:len(resp.Tiers)] + } + for tiersCount, tiersItem := range resp.Tiers { + var tiers1 tfTypes.PriceTier + if tiersItem.DisplayMode != nil { + tiers1.DisplayMode = types.StringValue(string(*tiersItem.DisplayMode)) + } else { + tiers1.DisplayMode = types.StringNull() + } + if tiersItem.FlatFeeAmount != nil { + tiers1.FlatFeeAmount = types.NumberValue(big.NewFloat(float64(*tiersItem.FlatFeeAmount))) + } else { + tiers1.FlatFeeAmount = types.NumberNull() + } + tiers1.FlatFeeAmountDecimal = types.StringPointerValue(tiersItem.FlatFeeAmountDecimal) + if tiersItem.UnitAmount != nil { + tiers1.UnitAmount = types.NumberValue(big.NewFloat(float64(*tiersItem.UnitAmount))) + } else { + tiers1.UnitAmount = types.NumberNull() + } + tiers1.UnitAmountDecimal = types.StringPointerValue(tiersItem.UnitAmountDecimal) + if tiersItem.UpTo != nil { + tiers1.UpTo = types.NumberValue(big.NewFloat(float64(*tiersItem.UpTo))) + } else { + tiers1.UpTo = types.NumberNull() + } + if tiersCount+1 > len(r.Tiers) { + r.Tiers = append(r.Tiers, tiers1) } else { - r.Unit.One = types.StringNull() + r.Tiers[tiersCount].DisplayMode = tiers1.DisplayMode + r.Tiers[tiersCount].FlatFeeAmount = tiers1.FlatFeeAmount + r.Tiers[tiersCount].FlatFeeAmountDecimal = tiers1.FlatFeeAmountDecimal + r.Tiers[tiersCount].UnitAmount = tiers1.UnitAmount + r.Tiers[tiersCount].UnitAmountDecimal = tiers1.UnitAmountDecimal + r.Tiers[tiersCount].UpTo = tiers1.UpTo } } + if resp.Type != nil { + r.Type = types.StringValue(string(*resp.Type)) + } else { + r.Type = types.StringNull() + } + r.Unit = types.StringPointerValue(resp.Unit) + if resp.UnitAmount != nil { + r.UnitAmount = types.NumberValue(big.NewFloat(float64(*resp.UnitAmount))) + } else { + r.UnitAmount = types.NumberNull() + } + r.UnitAmountCurrency = types.StringPointerValue(resp.UnitAmountCurrency) + r.UnitAmountDecimal = types.StringPointerValue(resp.UnitAmountDecimal) + r.VariablePrice = types.BoolPointerValue(resp.VariablePrice) } - if resp.UnitAmount != nil { - r.UnitAmount = types.NumberValue(big.NewFloat(float64(*resp.UnitAmount))) - } else { - r.UnitAmount = types.NumberNull() - } - r.UnitAmountCurrency = types.StringPointerValue(resp.UnitAmountCurrency) - r.UnitAmountDecimal = types.StringPointerValue(resp.UnitAmountDecimal) - r.VariablePrice = types.BoolPointerValue(resp.VariablePrice) } diff --git a/internal/provider/product_data_source.go b/internal/provider/product_data_source.go index b22ea3f..4246eb1 100644 --- a/internal/provider/product_data_source.go +++ b/internal/provider/product_data_source.go @@ -1,12 +1,13 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasyapi.com). DO NOT EDIT. package provider import ( "context" "fmt" + tfTypes "github.com/epilot-dev/terraform-provider-epilot-product/internal/provider/types" "github.com/epilot-dev/terraform-provider-epilot-product/internal/sdk" - "github.com/epilot-dev/terraform-provider-epilot-product/internal/sdk/pkg/models/operations" + "github.com/epilot-dev/terraform-provider-epilot-product/internal/sdk/models/operations" "github.com/hashicorp/terraform-plugin-framework/datasource" "github.com/hashicorp/terraform-plugin-framework/datasource/schema" "github.com/hashicorp/terraform-plugin-framework/types" @@ -28,18 +29,18 @@ type ProductDataSource struct { // ProductDataSourceModel describes the data model. type ProductDataSourceModel struct { - Active types.Bool `tfsdk:"active"` - Code types.String `tfsdk:"code"` - Description types.String `tfsdk:"description"` - Feature []types.String `tfsdk:"feature"` - Hydrate types.Bool `tfsdk:"hydrate"` - ID types.String `tfsdk:"id"` - InternalName types.String `tfsdk:"internal_name"` - Name types.String `tfsdk:"name"` - PriceOptions *BaseRelation `tfsdk:"price_options"` - ProductDownloads types.String `tfsdk:"product_downloads"` - ProductImages types.String `tfsdk:"product_images"` - Type types.String `tfsdk:"type"` + Active types.Bool `tfsdk:"active"` + Code types.String `tfsdk:"code"` + Description types.String `tfsdk:"description"` + Feature []types.String `tfsdk:"feature"` + Hydrate types.Bool `tfsdk:"hydrate"` + ID types.String `tfsdk:"id"` + InternalName types.String `tfsdk:"internal_name"` + Name types.String `tfsdk:"name"` + PriceOptions *tfTypes.BaseRelation `tfsdk:"price_options"` + ProductDownloads types.String `tfsdk:"product_downloads"` + ProductImages types.String `tfsdk:"product_images"` + Type types.String `tfsdk:"type"` } // Metadata returns the data source type name. @@ -73,8 +74,7 @@ func (r *ProductDataSource) Schema(ctx context.Context, req datasource.SchemaReq Description: `Hydrates entities in relations when passed true`, }, "id": schema.StringAttribute{ - Required: true, - Description: `The product id`, + Computed: true, }, "internal_name": schema.StringAttribute{ Computed: true, @@ -120,7 +120,7 @@ func (r *ProductDataSource) Schema(ctx context.Context, req datasource.SchemaReq `| ` + "`" + `product` + "`" + ` | Represents a physical good |` + "\n" + `| ` + "`" + `service` + "`" + ` | Represents a service or virtual product |` + "\n" + `` + "\n" + - `must be one of ["product", "service"]; Default: "product"`, + `must be one of ["product", "service"]`, }, }, } @@ -187,12 +187,16 @@ func (r *ProductDataSource) Read(ctx context.Context, req datasource.ReadRequest resp.Diagnostics.AddError("unexpected response from API", fmt.Sprintf("%v", res)) return } + if res.StatusCode == 404 { + resp.State.RemoveResource(ctx) + return + } if res.StatusCode != 200 { resp.Diagnostics.AddError(fmt.Sprintf("unexpected response from API. Got an unexpected response code %v", res.StatusCode), debugResponse(res.RawResponse)) return } - if res.Product == nil { - resp.Diagnostics.AddError("unexpected response from API. No response body", debugResponse(res.RawResponse)) + if !(res.Product != nil) { + resp.Diagnostics.AddError("unexpected response from API. Got an unexpected response body", debugResponse(res.RawResponse)) return } data.RefreshFromSharedProduct(res.Product) diff --git a/internal/provider/product_data_source_sdk.go b/internal/provider/product_data_source_sdk.go index 87e77e6..d92400e 100644 --- a/internal/provider/product_data_source_sdk.go +++ b/internal/provider/product_data_source_sdk.go @@ -1,64 +1,68 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasyapi.com). DO NOT EDIT. package provider import ( "encoding/json" - "github.com/epilot-dev/terraform-provider-epilot-product/internal/sdk/pkg/models/shared" + tfTypes "github.com/epilot-dev/terraform-provider-epilot-product/internal/provider/types" + "github.com/epilot-dev/terraform-provider-epilot-product/internal/sdk/models/shared" "github.com/hashicorp/terraform-plugin-framework/types" ) func (r *ProductDataSourceModel) RefreshFromSharedProduct(resp *shared.Product) { - r.Active = types.BoolValue(resp.Active) - r.Code = types.StringPointerValue(resp.Code) - r.Description = types.StringPointerValue(resp.Description) - r.Feature = nil - for _, featureItem := range resp.Feature { - var feature1 types.String - feature1Result, _ := json.Marshal(featureItem) - feature1 = types.StringValue(string(feature1Result)) - r.Feature = append(r.Feature, feature1) - } - r.ID = types.StringValue(resp.ID) - r.InternalName = types.StringPointerValue(resp.InternalName) - r.Name = types.StringValue(resp.Name) - if resp.PriceOptions == nil { - r.PriceOptions = nil - } else { - r.PriceOptions = &BaseRelation{} - if len(r.PriceOptions.DollarRelation) > len(resp.PriceOptions.DollarRelation) { - r.PriceOptions.DollarRelation = r.PriceOptions.DollarRelation[:len(resp.PriceOptions.DollarRelation)] + if resp != nil { + r.ID = types.StringValue(resp.ID) + r.Active = types.BoolValue(resp.Active) + r.Code = types.StringPointerValue(resp.Code) + r.Description = types.StringPointerValue(resp.Description) + r.Feature = nil + for _, featureItem := range resp.Feature { + var feature1 types.String + feature1Result, _ := json.Marshal(featureItem) + feature1 = types.StringValue(string(feature1Result)) + r.Feature = append(r.Feature, feature1) } - for dollarRelationCount, dollarRelationItem := range resp.PriceOptions.DollarRelation { - var dollarRelation1 DollarRelation - dollarRelation1.Tags = nil - for _, v := range dollarRelationItem.Tags { - dollarRelation1.Tags = append(dollarRelation1.Tags, types.StringValue(v)) + r.InternalName = types.StringPointerValue(resp.InternalName) + r.Name = types.StringValue(resp.Name) + if resp.PriceOptions == nil { + r.PriceOptions = nil + } else { + r.PriceOptions = &tfTypes.BaseRelation{} + r.PriceOptions.DollarRelation = []tfTypes.DollarRelation{} + if len(r.PriceOptions.DollarRelation) > len(resp.PriceOptions.DollarRelation) { + r.PriceOptions.DollarRelation = r.PriceOptions.DollarRelation[:len(resp.PriceOptions.DollarRelation)] } - dollarRelation1.EntityID = types.StringPointerValue(dollarRelationItem.EntityID) - if dollarRelationCount+1 > len(r.PriceOptions.DollarRelation) { - r.PriceOptions.DollarRelation = append(r.PriceOptions.DollarRelation, dollarRelation1) - } else { - r.PriceOptions.DollarRelation[dollarRelationCount].Tags = dollarRelation1.Tags - r.PriceOptions.DollarRelation[dollarRelationCount].EntityID = dollarRelation1.EntityID + for dollarRelationCount, dollarRelationItem := range resp.PriceOptions.DollarRelation { + var dollarRelation1 tfTypes.DollarRelation + dollarRelation1.Tags = []types.String{} + for _, v := range dollarRelationItem.Tags { + dollarRelation1.Tags = append(dollarRelation1.Tags, types.StringValue(v)) + } + dollarRelation1.EntityID = types.StringPointerValue(dollarRelationItem.EntityID) + if dollarRelationCount+1 > len(r.PriceOptions.DollarRelation) { + r.PriceOptions.DollarRelation = append(r.PriceOptions.DollarRelation, dollarRelation1) + } else { + r.PriceOptions.DollarRelation[dollarRelationCount].Tags = dollarRelation1.Tags + r.PriceOptions.DollarRelation[dollarRelationCount].EntityID = dollarRelation1.EntityID + } } } - } - if resp.ProductDownloads == nil { - r.ProductDownloads = types.StringNull() - } else { - productDownloadsResult, _ := json.Marshal(resp.ProductDownloads) - r.ProductDownloads = types.StringValue(string(productDownloadsResult)) - } - if resp.ProductImages == nil { - r.ProductImages = types.StringNull() - } else { - productImagesResult, _ := json.Marshal(resp.ProductImages) - r.ProductImages = types.StringValue(string(productImagesResult)) - } - if resp.Type != nil { - r.Type = types.StringValue(string(*resp.Type)) - } else { - r.Type = types.StringNull() + if resp.ProductDownloads == nil { + r.ProductDownloads = types.StringNull() + } else { + productDownloadsResult, _ := json.Marshal(resp.ProductDownloads) + r.ProductDownloads = types.StringValue(string(productDownloadsResult)) + } + if resp.ProductImages == nil { + r.ProductImages = types.StringNull() + } else { + productImagesResult, _ := json.Marshal(resp.ProductImages) + r.ProductImages = types.StringValue(string(productImagesResult)) + } + if resp.Type != nil { + r.Type = types.StringValue(string(*resp.Type)) + } else { + r.Type = types.StringNull() + } } } diff --git a/internal/provider/product_resource.go b/internal/provider/product_resource.go index 416aefe..978f39d 100644 --- a/internal/provider/product_resource.go +++ b/internal/provider/product_resource.go @@ -1,18 +1,20 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasyapi.com). DO NOT EDIT. package provider import ( "context" "fmt" + tfTypes "github.com/epilot-dev/terraform-provider-epilot-product/internal/provider/types" "github.com/epilot-dev/terraform-provider-epilot-product/internal/sdk" - "github.com/epilot-dev/terraform-provider-epilot-product/internal/sdk/pkg/models/operations" + "github.com/epilot-dev/terraform-provider-epilot-product/internal/sdk/models/operations" "github.com/epilot-dev/terraform-provider-epilot-product/internal/validators" "github.com/hashicorp/terraform-plugin-framework-validators/listvalidator" "github.com/hashicorp/terraform-plugin-framework-validators/stringvalidator" "github.com/hashicorp/terraform-plugin-framework/path" "github.com/hashicorp/terraform-plugin-framework/resource" "github.com/hashicorp/terraform-plugin-framework/resource/schema" + "github.com/hashicorp/terraform-plugin-framework/resource/schema/stringdefault" "github.com/hashicorp/terraform-plugin-framework/schema/validator" "github.com/hashicorp/terraform-plugin-framework/types" "github.com/hashicorp/terraform-plugin-framework/types/basetypes" @@ -33,17 +35,17 @@ type ProductResource struct { // ProductResourceModel describes the resource data model. type ProductResourceModel struct { - ID types.String `tfsdk:"id"` - Active types.Bool `tfsdk:"active"` - Code types.String `tfsdk:"code"` - Description types.String `tfsdk:"description"` - Feature []types.String `tfsdk:"feature"` - InternalName types.String `tfsdk:"internal_name"` - Name types.String `tfsdk:"name"` - PriceOptions *BaseRelation `tfsdk:"price_options"` - ProductDownloads types.String `tfsdk:"product_downloads"` - ProductImages types.String `tfsdk:"product_images"` - Type types.String `tfsdk:"type"` + Active types.Bool `tfsdk:"active"` + Code types.String `tfsdk:"code"` + Description types.String `tfsdk:"description"` + Feature []types.String `tfsdk:"feature"` + ID types.String `tfsdk:"id"` + InternalName types.String `tfsdk:"internal_name"` + Name types.String `tfsdk:"name"` + PriceOptions *tfTypes.BaseRelation `tfsdk:"price_options"` + ProductDownloads types.String `tfsdk:"product_downloads"` + ProductImages types.String `tfsdk:"product_images"` + Type types.String `tfsdk:"type"` } func (r *ProductResource) Metadata(ctx context.Context, req resource.MetadataRequest, resp *resource.MetadataResponse) { @@ -53,12 +55,7 @@ func (r *ProductResource) Metadata(ctx context.Context, req resource.MetadataReq func (r *ProductResource) Schema(ctx context.Context, req resource.SchemaRequest, resp *resource.SchemaResponse) { resp.Schema = schema.Schema{ MarkdownDescription: "Product Resource", - Attributes: map[string]schema.Attribute{ - "id": schema.StringAttribute{ - Computed: true, - Description: `The product id`, - }, "active": schema.BoolAttribute{ Required: true, }, @@ -80,6 +77,9 @@ func (r *ProductResource) Schema(ctx context.Context, req resource.SchemaRequest listvalidator.ValueStringsAre(validators.IsValidJSON()), }, }, + "id": schema.StringAttribute{ + Computed: true, + }, "internal_name": schema.StringAttribute{ Computed: true, Optional: true, @@ -131,6 +131,7 @@ func (r *ProductResource) Schema(ctx context.Context, req resource.SchemaRequest "type": schema.StringAttribute{ Computed: true, Optional: true, + Default: stringdefault.StaticString("product"), MarkdownDescription: `The type of Product:` + "\n" + `` + "\n" + `| type | description |` + "\n" + @@ -205,8 +206,8 @@ func (r *ProductResource) Create(ctx context.Context, req resource.CreateRequest resp.Diagnostics.AddError(fmt.Sprintf("unexpected response from API. Got an unexpected response code %v", res.StatusCode), debugResponse(res.RawResponse)) return } - if res.Product == nil { - resp.Diagnostics.AddError("unexpected response from API. No response body", debugResponse(res.RawResponse)) + if !(res.Product != nil) { + resp.Diagnostics.AddError("unexpected response from API. Got an unexpected response body", debugResponse(res.RawResponse)) return } data.RefreshFromSharedProduct(res.Product) @@ -234,6 +235,9 @@ func (r *ProductResource) Read(ctx context.Context, req resource.ReadRequest, re return } + // read.product.hydrateread.product.hydrate impedance mismatch: "boolean" != "class"trace=["Product#create.req"] + // {"Name":"Product","Original":{"Name":"ProductCreate","OriginalName":"ProductCreate","ContextStack":[{"Type":"refType","Identifier":"Schemas","Used":false,"MustUse":false},{"Type":"refName","Identifier":"ProductCreate","Used":false,"MustUse":false},{"Type":"component","Identifier":"true","Used":false,"MustUse":false}],"Type":"class","ItemType":null,"Fields":[{"Name":"active","OriginalName":"active","Type":{"Name":"","OriginalName":"","ContextStack":[],"Type":"boolean","ItemType":null,"Fields":[],"Validations":{"MinItems":null,"MinLength":null,"Minimum":null,"MaxItems":null,"MaxLength":null,"Maximum":null,"Pattern":null,"UniqueItems":null},"AssociatedTypes":[],"Enum":null,"Scope":"","IsComponent":false,"Truncated":false,"Comments":null,"Input":false,"Output":false,"Extensions":{},"Examples":[],"Format":"","Discriminator":null,"ComplexAny":false,"OutputLocation":"","ResolvedModel":"","EventStreamEnvelope":false,"ResponseEnvelope":false},"Comments":null,"Annotations":[{"Ignore":false,"FieldName":"active"}],"Nullable":false,"Optional":false,"SerializationMethod":null,"ErrorMessage":false,"Const":null,"Default":null,"IsAdditionalProperties":false,"ParameterIndex":null},{"Name":"code","OriginalName":"code","Type":{"Name":"","OriginalName":"","ContextStack":[],"Type":"string","ItemType":null,"Fields":[],"Validations":{"MinItems":null,"MinLength":null,"Minimum":null,"MaxItems":null,"MaxLength":null,"Maximum":null,"Pattern":null,"UniqueItems":null},"AssociatedTypes":[],"Enum":null,"Scope":"","IsComponent":false,"Truncated":false,"Comments":null,"Input":false,"Output":false,"Extensions":{},"Examples":[],"Format":"","Discriminator":null,"ComplexAny":false,"OutputLocation":"","ResolvedModel":"","EventStreamEnvelope":false,"ResponseEnvelope":false},"Comments":{"Summary":"","Description":"The product code","ExternalDocs":null,"ExtendedComments":{},"Deprecated":false,"DeprecationReplacement":"","DeprecationMessage":""},"Annotations":[{"Ignore":false,"FieldName":"code"}],"Nullable":false,"Optional":true,"SerializationMethod":null,"ErrorMessage":false,"Const":null,"Default":null,"IsAdditionalProperties":false,"ParameterIndex":null},{"Name":"description","OriginalName":"description","Type":{"Name":"","OriginalName":"","ContextStack":[],"Type":"string","ItemType":null,"Fields":[],"Validations":{"MinItems":null,"MinLength":null,"Minimum":null,"MaxItems":null,"MaxLength":null,"Maximum":null,"Pattern":null,"UniqueItems":null},"AssociatedTypes":[],"Enum":null,"Scope":"","IsComponent":false,"Truncated":false,"Comments":null,"Input":false,"Output":false,"Extensions":{},"Examples":[],"Format":"","Discriminator":null,"ComplexAny":false,"OutputLocation":"","ResolvedModel":"","EventStreamEnvelope":false,"ResponseEnvelope":false},"Comments":{"Summary":"","Description":"A description of the product. Multi-line supported.","ExternalDocs":null,"ExtendedComments":{},"Deprecated":false,"DeprecationReplacement":"","DeprecationMessage":""},"Annotations":[{"Ignore":false,"FieldName":"description"}],"Nullable":false,"Optional":true,"SerializationMethod":null,"ErrorMessage":false,"Const":null,"Default":null,"IsAdditionalProperties":false,"ParameterIndex":null},{"Name":"feature","OriginalName":"feature","Type":{"Name":"","OriginalName":"","ContextStack":[],"Type":"array","ItemType":{"Name":"","OriginalName":"","ContextStack":[],"Type":"any","ItemType":null,"Fields":[],"Validations":{"MinItems":null,"MinLength":null,"Minimum":null,"MaxItems":null,"MaxLength":null,"Maximum":null,"Pattern":null,"UniqueItems":null},"AssociatedTypes":[],"Enum":null,"Scope":"","IsComponent":false,"Truncated":false,"Comments":null,"Input":false,"Output":false,"Extensions":{},"Examples":[],"Format":"","Discriminator":null,"ComplexAny":false,"OutputLocation":"","ResolvedModel":"","EventStreamEnvelope":false,"ResponseEnvelope":false},"Fields":[],"Validations":{"MinItems":null,"MinLength":null,"Minimum":null,"MaxItems":null,"MaxLength":null,"Maximum":null,"Pattern":null,"UniqueItems":null},"AssociatedTypes":[],"Enum":null,"Scope":"","IsComponent":false,"Truncated":false,"Comments":null,"Input":false,"Output":false,"Extensions":{},"Examples":[],"Format":"","Discriminator":null,"ComplexAny":false,"OutputLocation":"","ResolvedModel":"","EventStreamEnvelope":false,"ResponseEnvelope":false},"Comments":null,"Annotations":[{"Ignore":false,"FieldName":"feature"}],"Nullable":false,"Optional":true,"SerializationMethod":null,"ErrorMessage":false,"Const":null,"Default":null,"IsAdditionalProperties":false,"ParameterIndex":null},{"Name":"internal_name","OriginalName":"internal_name","Type":{"Name":"","OriginalName":"","ContextStack":[],"Type":"string","ItemType":null,"Fields":[],"Validations":{"MinItems":null,"MinLength":null,"Minimum":null,"MaxItems":null,"MaxLength":null,"Maximum":null,"Pattern":null,"UniqueItems":null},"AssociatedTypes":[],"Enum":null,"Scope":"","IsComponent":false,"Truncated":false,"Comments":null,"Input":false,"Output":false,"Extensions":{},"Examples":[],"Format":"","Discriminator":null,"ComplexAny":false,"OutputLocation":"","ResolvedModel":"","EventStreamEnvelope":false,"ResponseEnvelope":false},"Comments":{"Summary":"","Description":"Not visible to customers, only in internal tables","ExternalDocs":null,"ExtendedComments":{},"Deprecated":false,"DeprecationReplacement":"","DeprecationMessage":""},"Annotations":[{"Ignore":false,"FieldName":"internal_name"}],"Nullable":false,"Optional":true,"SerializationMethod":null,"ErrorMessage":false,"Const":null,"Default":null,"IsAdditionalProperties":false,"ParameterIndex":null},{"Name":"name","OriginalName":"name","Type":{"Name":"","OriginalName":"","ContextStack":[],"Type":"string","ItemType":null,"Fields":[],"Validations":{"MinItems":null,"MinLength":null,"Minimum":null,"MaxItems":null,"MaxLength":null,"Maximum":null,"Pattern":null,"UniqueItems":null},"AssociatedTypes":[],"Enum":null,"Scope":"","IsComponent":false,"Truncated":false,"Comments":null,"Input":false,"Output":false,"Extensions":{},"Examples":[],"Format":"","Discriminator":null,"ComplexAny":false,"OutputLocation":"","ResolvedModel":"","EventStreamEnvelope":false,"ResponseEnvelope":false},"Comments":{"Summary":"","Description":"The description for the product","ExternalDocs":null,"ExtendedComments":{},"Deprecated":false,"DeprecationReplacement":"","DeprecationMessage":""},"Annotations":[{"Ignore":false,"FieldName":"name"}],"Nullable":false,"Optional":false,"SerializationMethod":null,"ErrorMessage":false,"Const":null,"Default":null,"IsAdditionalProperties":false,"ParameterIndex":null},{"Name":"price_options","OriginalName":"price_options","Type":{"Name":"BaseRelation","OriginalName":"BaseRelation","ContextStack":[{"Type":"refType","Identifier":"Schemas","Used":false,"MustUse":false},{"Type":"refName","Identifier":"BaseRelation","Used":false,"MustUse":false},{"Type":"component","Identifier":"true","Used":false,"MustUse":false}],"Type":"class","ItemType":null,"Fields":[{"Name":"$relation","OriginalName":"$relation","Type":{"Name":"","OriginalName":"","ContextStack":[],"Type":"array","ItemType":{"Name":"$relation","OriginalName":"$relation","ContextStack":[{"Type":"refType","Identifier":"Schemas","Used":false,"MustUse":false},{"Type":"refName","Identifier":"BaseRelation","Used":false,"MustUse":false}],"Type":"class","ItemType":null,"Fields":[{"Name":"_tags","OriginalName":"_tags","Type":{"Name":"","OriginalName":"","ContextStack":[],"Type":"array","ItemType":{"Name":"","OriginalName":"","ContextStack":[],"Type":"string","ItemType":null,"Fields":[],"Validations":{"MinItems":null,"MinLength":null,"Minimum":null,"MaxItems":null,"MaxLength":null,"Maximum":null,"Pattern":null,"UniqueItems":null},"AssociatedTypes":[],"Enum":null,"Scope":"","IsComponent":false,"Truncated":false,"Comments":null,"Input":false,"Output":false,"Extensions":{},"Examples":[],"Format":"","Discriminator":null,"ComplexAny":false,"OutputLocation":"","ResolvedModel":"","EventStreamEnvelope":false,"ResponseEnvelope":false},"Fields":[],"Validations":{"MinItems":null,"MinLength":null,"Minimum":null,"MaxItems":null,"MaxLength":null,"Maximum":null,"Pattern":null,"UniqueItems":null},"AssociatedTypes":[],"Enum":null,"Scope":"","IsComponent":false,"Truncated":false,"Comments":null,"Input":false,"Output":false,"Extensions":{},"Examples":[],"Format":"","Discriminator":null,"ComplexAny":false,"OutputLocation":"","ResolvedModel":"","EventStreamEnvelope":false,"ResponseEnvelope":false},"Comments":null,"Annotations":[{"Ignore":false,"FieldName":"_tags"}],"Nullable":true,"Optional":true,"SerializationMethod":null,"ErrorMessage":false,"Const":null,"Default":null,"IsAdditionalProperties":false,"ParameterIndex":null},{"Name":"entity_id","OriginalName":"entity_id","Type":{"Name":"","OriginalName":"","ContextStack":[],"Type":"string","ItemType":null,"Fields":[],"Validations":{"MinItems":null,"MinLength":null,"Minimum":null,"MaxItems":null,"MaxLength":null,"Maximum":null,"Pattern":null,"UniqueItems":null},"AssociatedTypes":[],"Enum":null,"Scope":"","IsComponent":false,"Truncated":false,"Comments":null,"Input":false,"Output":false,"Extensions":{},"Examples":[{}],"Format":"uuid","Discriminator":null,"ComplexAny":false,"OutputLocation":"","ResolvedModel":"","EventStreamEnvelope":false,"ResponseEnvelope":false},"Comments":null,"Annotations":[{"Ignore":false,"FieldName":"entity_id"}],"Nullable":false,"Optional":true,"SerializationMethod":null,"ErrorMessage":false,"Const":null,"Default":null,"IsAdditionalProperties":false,"ParameterIndex":null}],"Validations":{"MinItems":null,"MinLength":null,"Minimum":null,"MaxItems":null,"MaxLength":null,"Maximum":null,"Pattern":null,"UniqueItems":null},"AssociatedTypes":[],"Enum":null,"Scope":"shared","IsComponent":false,"Truncated":false,"Comments":null,"Input":false,"Output":false,"Extensions":{},"Examples":[],"Format":"","Discriminator":null,"ComplexAny":false,"OutputLocation":"models/shared","ResolvedModel":"BaseRelation","EventStreamEnvelope":false,"ResponseEnvelope":false},"Fields":[],"Validations":{"MinItems":null,"MinLength":null,"Minimum":null,"MaxItems":null,"MaxLength":null,"Maximum":null,"Pattern":null,"UniqueItems":null},"AssociatedTypes":[],"Enum":null,"Scope":"","IsComponent":false,"Truncated":false,"Comments":null,"Input":false,"Output":false,"Extensions":{},"Examples":[],"Format":"","Discriminator":null,"ComplexAny":false,"OutputLocation":"","ResolvedModel":"","EventStreamEnvelope":false,"ResponseEnvelope":false},"Comments":null,"Annotations":[{"Ignore":false,"FieldName":"$relation"}],"Nullable":false,"Optional":true,"SerializationMethod":null,"ErrorMessage":false,"Const":null,"Default":null,"IsAdditionalProperties":false,"ParameterIndex":null}],"Validations":{"MinItems":null,"MinLength":null,"Minimum":null,"MaxItems":null,"MaxLength":null,"Maximum":null,"Pattern":null,"UniqueItems":null},"AssociatedTypes":[],"Enum":null,"Scope":"shared","IsComponent":true,"Truncated":false,"Comments":null,"Input":false,"Output":false,"Extensions":{},"Examples":[],"Format":"","Discriminator":null,"ComplexAny":false,"OutputLocation":"models/shared","ResolvedModel":"BaseRelation","EventStreamEnvelope":false,"ResponseEnvelope":false},"Comments":null,"Annotations":[{"Ignore":false,"FieldName":"price_options"}],"Nullable":false,"Optional":true,"SerializationMethod":null,"ErrorMessage":false,"Const":null,"Default":null,"IsAdditionalProperties":false,"ParameterIndex":null},{"Name":"product_downloads","OriginalName":"product_downloads","Type":{"Name":"","OriginalName":"","ContextStack":[],"Type":"any","ItemType":null,"Fields":[],"Validations":{"MinItems":null,"MinLength":null,"Minimum":null,"MaxItems":null,"MaxLength":null,"Maximum":null,"Pattern":null,"UniqueItems":null},"AssociatedTypes":[],"Enum":null,"Scope":"","IsComponent":false,"Truncated":false,"Comments":null,"Input":false,"Output":false,"Extensions":{},"Examples":[],"Format":"","Discriminator":null,"ComplexAny":false,"OutputLocation":"","ResolvedModel":"","EventStreamEnvelope":false,"ResponseEnvelope":false},"Comments":null,"Annotations":[{"Ignore":false,"FieldName":"product_downloads"}],"Nullable":false,"Optional":true,"SerializationMethod":null,"ErrorMessage":false,"Const":null,"Default":null,"IsAdditionalProperties":false,"ParameterIndex":null},{"Name":"product_images","OriginalName":"product_images","Type":{"Name":"","OriginalName":"","ContextStack":[],"Type":"any","ItemType":null,"Fields":[],"Validations":{"MinItems":null,"MinLength":null,"Minimum":null,"MaxItems":null,"MaxLength":null,"Maximum":null,"Pattern":null,"UniqueItems":null},"AssociatedTypes":[],"Enum":null,"Scope":"","IsComponent":false,"Truncated":false,"Comments":null,"Input":false,"Output":false,"Extensions":{},"Examples":[],"Format":"","Discriminator":null,"ComplexAny":false,"OutputLocation":"","ResolvedModel":"","EventStreamEnvelope":false,"ResponseEnvelope":false},"Comments":null,"Annotations":[{"Ignore":false,"FieldName":"product_images"}],"Nullable":false,"Optional":true,"SerializationMethod":null,"ErrorMessage":false,"Const":null,"Default":null,"IsAdditionalProperties":false,"ParameterIndex":null},{"Name":"type","OriginalName":"type","Type":{"Name":"ProductCreate_type","OriginalName":"type","ContextStack":[{"Type":"refType","Identifier":"Schemas","Used":false,"MustUse":false},{"Type":"refName","Identifier":"ProductCreate","Used":true,"MustUse":false}],"Type":"enum","ItemType":null,"Fields":[],"Validations":{"MinItems":null,"MinLength":null,"Minimum":null,"MaxItems":null,"MaxLength":null,"Maximum":null,"Pattern":null,"UniqueItems":null},"AssociatedTypes":[],"Enum":{"Type":{"Name":"","OriginalName":"","ContextStack":[],"Type":"string","ItemType":null,"Fields":[],"Validations":{"MinItems":null,"MinLength":null,"Minimum":null,"MaxItems":null,"MaxLength":null,"Maximum":null,"Pattern":null,"UniqueItems":null},"AssociatedTypes":[],"Enum":null,"Scope":"","IsComponent":false,"Truncated":false,"Comments":null,"Input":false,"Output":false,"Extensions":{},"Examples":[],"Format":"","Discriminator":null,"ComplexAny":false,"OutputLocation":"","ResolvedModel":"","EventStreamEnvelope":false,"ResponseEnvelope":false},"Values":["product","service"],"Names":[],"Open":false,"Format":""},"Scope":"shared","IsComponent":false,"Truncated":false,"Comments":{"Summary":"","Description":"The type of Product:\n\n| type | description |\n|----| ----|\n| `product` | Represents a physical good |\n| `service` | Represents a service or virtual product |\n","ExternalDocs":null,"ExtendedComments":{},"Deprecated":false,"DeprecationReplacement":"","DeprecationMessage":""},"Input":false,"Output":false,"Extensions":{},"Examples":[],"Format":"","Discriminator":null,"ComplexAny":false,"OutputLocation":"models/shared","ResolvedModel":"ProductCreate","EventStreamEnvelope":false,"ResponseEnvelope":false},"Comments":{"Summary":"","Description":"The type of Product:\n\n| type | description |\n|----| ----|\n| `product` | Represents a physical good |\n| `service` | Represents a service or virtual product |\n","ExternalDocs":null,"ExtendedComments":{},"Deprecated":false,"DeprecationReplacement":"","DeprecationMessage":""},"Annotations":[{"Ignore":false,"FieldName":"type"}],"Nullable":false,"Optional":true,"SerializationMethod":null,"ErrorMessage":false,"Const":null,"Default":{"Value":"product"},"IsAdditionalProperties":false,"ParameterIndex":null}],"Validations":{"MinItems":null,"MinLength":null,"Minimum":null,"MaxItems":null,"MaxLength":null,"Maximum":null,"Pattern":null,"UniqueItems":null},"AssociatedTypes":[],"Enum":null,"Scope":"shared","IsComponent":true,"Truncated":false,"Comments":null,"Input":false,"Output":false,"Extensions":{"x-speakeasy-entity":"Product"},"Examples":[],"Format":"","Discriminator":null,"ComplexAny":false,"OutputLocation":"models/shared","ResolvedModel":"ProductCreate","EventStreamEnvelope":false,"ResponseEnvelope":false},"Type":"class","AssociatedTypes":[],"Examples":[],"Scope":"shared","ResponseEnvelope":false,"OriginalName":"ProductCreate","Discriminator":null,"ItemType":null,"Output":false,"ResolvedModel":"ProductCreate","OutputLocation":"models/shared","ContextStack":[{"Type":"refType","Identifier":"Schemas","Used":false,"MustUse":false},{"Type":"refName","Identifier":"ProductCreate","Used":false,"MustUse":false},{"Type":"component","Identifier":"true","Used":false,"MustUse":false}],"Extensions":{"x-speakeasy-entity":"Product","x-speakeasy-trace":{"Product#create.req":true},"x-speakeasy-param-computed":true,"x-untouched":true,"x-speakeasy-in-get-request":true,"x-speakeasy-in-get":true,"x-speakeasy-root":true},"Comments":null,"Fields":[{"OriginalName":"_id","Type":{"Examples":[{}],"ResolvedModel":"","OutputLocation":"","Name":"","Comments":null,"Fields":[],"Discriminator":null,"Format":"uuid","ItemType":null,"Scope":"","CircularReference":null,"Truncated":false,"EventStreamEnvelope":false,"Extensions":{"x-speakeasy-in-get":true,"x-speakeasy-trace":{"Product#create.resp.id":true},"x-speakeasy-param-computed":true,"x-untouched":true,"x-speakeasy-param-readonly":true},"Enum":null,"AssociatedTypes":[],"Type":"string","Input":false,"IsComponent":false,"Validations":{"UniqueItems":null,"MinItems":null,"MinLength":null,"Minimum":null,"MaxItems":null,"MaxLength":null,"Maximum":null,"Pattern":null},"Original":{"Name":"","OriginalName":"","ContextStack":[],"Type":"string","ItemType":null,"Fields":[],"Validations":{"MinItems":null,"MinLength":null,"Minimum":null,"MaxItems":null,"MaxLength":null,"Maximum":null,"Pattern":null,"UniqueItems":null},"AssociatedTypes":[],"Enum":null,"Scope":"","IsComponent":false,"Truncated":false,"Comments":null,"Input":false,"Output":false,"Extensions":{},"Examples":[{}],"Format":"uuid","Discriminator":null,"ComplexAny":false,"OutputLocation":"","ResolvedModel":"","EventStreamEnvelope":false,"ResponseEnvelope":false},"OriginalName":"","ContextStack":[],"ResponseEnvelope":false,"Output":false},"Name":"_id","Nullable":false,"Default":null,"Optional":false,"Const":null,"Comments":null,"Annotations":[{"Ignore":false,"FieldName":"_id"}],"IsAdditionalProperties":false,"ErrorMessage":false},{"OriginalName":"active","Type":{"Truncated":false,"ResponseEnvelope":false,"OutputLocation":"","Type":"boolean","Extensions":{"x-speakeasy-param-computed":true,"x-untouched":true,"x-speakeasy-in-get":true,"x-speakeasy-trace":{"Product#create.req.active":true}},"Comments":null,"Original":{"Name":"","OriginalName":"","ContextStack":[],"Type":"boolean","ItemType":null,"Fields":[],"Validations":{"MinItems":null,"MinLength":null,"Minimum":null,"MaxItems":null,"MaxLength":null,"Maximum":null,"Pattern":null,"UniqueItems":null},"AssociatedTypes":[],"Enum":null,"Scope":"","IsComponent":false,"Truncated":false,"Comments":null,"Input":false,"Output":false,"Extensions":{},"Examples":[],"Format":"","Discriminator":null,"ComplexAny":false,"OutputLocation":"","ResolvedModel":"","EventStreamEnvelope":false,"ResponseEnvelope":false},"Fields":[],"EventStreamEnvelope":false,"Input":false,"Validations":{"MaxItems":null,"MaxLength":null,"Maximum":null,"Pattern":null,"UniqueItems":null,"MinItems":null,"MinLength":null,"Minimum":null},"Enum":null,"AssociatedTypes":[],"OriginalName":"","Discriminator":null,"Examples":[],"ResolvedModel":"","IsComponent":false,"CircularReference":null,"Name":"","Scope":"","ContextStack":[],"Format":"","ItemType":null,"Output":false},"Default":null,"Const":null,"ErrorMessage":false,"Name":"active","Nullable":false,"Optional":false,"Comments":null,"Annotations":[{"Ignore":false,"FieldName":"active"}],"IsAdditionalProperties":false},{"Type":{"OutputLocation":"","EventStreamEnvelope":false,"Original":{"Name":"","OriginalName":"","ContextStack":[],"Type":"string","ItemType":null,"Fields":[],"Validations":{"MinItems":null,"MinLength":null,"Minimum":null,"MaxItems":null,"MaxLength":null,"Maximum":null,"Pattern":null,"UniqueItems":null},"AssociatedTypes":[],"Enum":null,"Scope":"","IsComponent":false,"Truncated":false,"Comments":null,"Input":false,"Output":false,"Extensions":{},"Examples":[],"Format":"","Discriminator":null,"ComplexAny":false,"OutputLocation":"","ResolvedModel":"","EventStreamEnvelope":false,"ResponseEnvelope":false},"IsComponent":false,"Format":"","Output":false,"ContextStack":[],"Name":"","Type":"string","AssociatedTypes":[],"Examples":[],"OriginalName":"","ResolvedModel":"","Input":false,"Extensions":{"x-speakeasy-trace":{"Product#create.req.code":true},"x-speakeasy-param-computed":true,"x-untouched":true,"x-speakeasy-in-get":true},"Enum":null,"Comments":null,"Fields":[],"ResponseEnvelope":false,"ItemType":null,"CircularReference":null,"Truncated":false,"Validations":{"Minimum":null,"MaxItems":null,"MaxLength":null,"Maximum":null,"Pattern":null,"UniqueItems":null,"MinItems":null,"MinLength":null},"Discriminator":null,"Scope":""},"Nullable":false,"Default":null,"Annotations":[{"Ignore":false,"FieldName":"code"}],"OriginalName":"code","Name":"code","Optional":true,"Const":null,"Comments":{"Deprecated":false,"DeprecationMessage":"","DeprecationReplacement":"","Description":"The product code","ExternalDocs":null,"Summary":""},"IsAdditionalProperties":false,"ErrorMessage":false},{"Nullable":false,"Optional":true,"Default":null,"Const":null,"Annotations":[{"Ignore":false,"FieldName":"description"}],"ErrorMessage":false,"Name":"description","Type":{"Original":{"Name":"","OriginalName":"","ContextStack":[],"Type":"string","ItemType":null,"Fields":[],"Validations":{"MinItems":null,"MinLength":null,"Minimum":null,"MaxItems":null,"MaxLength":null,"Maximum":null,"Pattern":null,"UniqueItems":null},"AssociatedTypes":[],"Enum":null,"Scope":"","IsComponent":false,"Truncated":false,"Comments":null,"Input":false,"Output":false,"Extensions":{},"Examples":[],"Format":"","Discriminator":null,"ComplexAny":false,"OutputLocation":"","ResolvedModel":"","EventStreamEnvelope":false,"ResponseEnvelope":false},"OriginalName":"","Scope":"","CircularReference":null,"Name":"","ItemType":null,"OutputLocation":"","IsComponent":false,"Extensions":{"x-speakeasy-trace":{"Product#create.req.description":true},"x-speakeasy-param-computed":true,"x-untouched":true,"x-speakeasy-in-get":true},"AssociatedTypes":[],"Validations":{"MaxLength":null,"Maximum":null,"Pattern":null,"UniqueItems":null,"MinItems":null,"MinLength":null,"Minimum":null,"MaxItems":null},"ResolvedModel":"","EventStreamEnvelope":false,"Enum":null,"Output":false,"ResponseEnvelope":false,"Examples":[],"Format":"","Fields":[],"Input":false,"Truncated":false,"ContextStack":[],"Type":"string","Comments":null,"Discriminator":null},"Comments":{"DeprecationReplacement":"","Description":"A description of the product. Multi-line supported.","ExternalDocs":null,"Summary":"","Deprecated":false,"DeprecationMessage":""},"IsAdditionalProperties":false,"OriginalName":"description"},{"Comments":null,"Annotations":[{"Ignore":false,"FieldName":"feature"}],"ErrorMessage":false,"Type":{"Enum":null,"Comments":null,"Original":{"Name":"","OriginalName":"","ContextStack":[],"Type":"array","ItemType":{"Name":"","OriginalName":"","ContextStack":[],"Type":"any","ItemType":null,"Fields":[],"Validations":{"MinItems":null,"MinLength":null,"Minimum":null,"MaxItems":null,"MaxLength":null,"Maximum":null,"Pattern":null,"UniqueItems":null},"AssociatedTypes":[],"Enum":null,"Scope":"","IsComponent":false,"Truncated":false,"Comments":null,"Input":false,"Output":false,"Extensions":{},"Examples":[],"Format":"","Discriminator":null,"ComplexAny":false,"OutputLocation":"","ResolvedModel":"","EventStreamEnvelope":false,"ResponseEnvelope":false},"Fields":[],"Validations":{"MinItems":null,"MinLength":null,"Minimum":null,"MaxItems":null,"MaxLength":null,"Maximum":null,"Pattern":null,"UniqueItems":null},"AssociatedTypes":[],"Enum":null,"Scope":"","IsComponent":false,"Truncated":false,"Comments":null,"Input":false,"Output":false,"Extensions":{},"Examples":[],"Format":"","Discriminator":null,"ComplexAny":false,"OutputLocation":"","ResolvedModel":"","EventStreamEnvelope":false,"ResponseEnvelope":false},"OutputLocation":"","ContextStack":[],"Name":"","Extensions":{"x-speakeasy-in-get":true,"x-speakeasy-parent-require-to-not-null":true,"x-speakeasy-trace":{"Product#create.req.feature":true},"x-speakeasy-param-computed":true,"x-untouched":true},"Examples":[],"Scope":"","Discriminator":null,"Format":"","AssociatedTypes":[],"CircularReference":null,"EventStreamEnvelope":false,"ResponseEnvelope":false,"IsComponent":false,"Truncated":false,"ResolvedModel":"","Output":false,"Fields":[],"Input":false,"ItemType":{"Original":{"Name":"","OriginalName":"","ContextStack":[],"Type":"any","ItemType":null,"Fields":[],"Validations":{"MinItems":null,"MinLength":null,"Minimum":null,"MaxItems":null,"MaxLength":null,"Maximum":null,"Pattern":null,"UniqueItems":null},"AssociatedTypes":[],"Enum":null,"Scope":"","IsComponent":false,"Truncated":false,"Comments":null,"Input":false,"Output":false,"Extensions":{},"Examples":[],"Format":"","Discriminator":null,"ComplexAny":false,"OutputLocation":"","ResolvedModel":"","EventStreamEnvelope":false,"ResponseEnvelope":false},"Discriminator":null,"Examples":[],"Fields":[],"CircularReference":null,"Type":"any","ContextStack":[],"Name":"","Format":"","Output":false,"OriginalName":"","ResolvedModel":"","Extensions":{"x-speakeasy-trace":{"Product#create.req.feature.[]":true},"x-speakeasy-param-computed":true,"x-untouched":true,"x-speakeasy-in-get":true,"x-speakeasy-parent-require-to-not-null":true,"Symbol":"Feature"},"EventStreamEnvelope":false,"Scope":"","Validations":{"MaxItems":null,"MaxLength":null,"Maximum":null,"Pattern":null,"UniqueItems":null,"MinItems":null,"MinLength":null,"Minimum":null},"IsComponent":false,"ResponseEnvelope":false,"Enum":null,"ItemType":null,"Truncated":false,"AssociatedTypes":[],"Comments":null,"OutputLocation":"","Input":false},"Validations":{"Minimum":null,"MaxItems":null,"MaxLength":null,"Maximum":null,"Pattern":null,"UniqueItems":null,"MinItems":null,"MinLength":null},"Type":"array","OriginalName":""},"Name":"feature","Optional":true,"Default":null,"OriginalName":"feature","Nullable":false,"Const":null,"IsAdditionalProperties":false},{"Annotations":[{"Ignore":false,"FieldName":"internal_name"}],"IsAdditionalProperties":false,"ErrorMessage":false,"Default":null,"Const":null,"Comments":{"Deprecated":false,"DeprecationMessage":"","DeprecationReplacement":"","Description":"Not visible to customers, only in internal tables","ExternalDocs":null,"Summary":""},"Nullable":false,"Optional":true,"OriginalName":"internal_name","Type":{"ContextStack":[],"Type":"string","Output":false,"Scope":"","ResolvedModel":"","Format":"","Input":false,"IsComponent":false,"ItemType":null,"EventStreamEnvelope":false,"OriginalName":"","Extensions":{"x-speakeasy-trace":{"Product#create.req.internal_name":true},"x-speakeasy-param-computed":true,"x-untouched":true,"x-speakeasy-in-get":true},"Enum":null,"Comments":null,"ResponseEnvelope":false,"Original":{"Name":"","OriginalName":"","ContextStack":[],"Type":"string","ItemType":null,"Fields":[],"Validations":{"MinItems":null,"MinLength":null,"Minimum":null,"MaxItems":null,"MaxLength":null,"Maximum":null,"Pattern":null,"UniqueItems":null},"AssociatedTypes":[],"Enum":null,"Scope":"","IsComponent":false,"Truncated":false,"Comments":null,"Input":false,"Output":false,"Extensions":{},"Examples":[],"Format":"","Discriminator":null,"ComplexAny":false,"OutputLocation":"","ResolvedModel":"","EventStreamEnvelope":false,"ResponseEnvelope":false},"Name":"","AssociatedTypes":[],"Discriminator":null,"Examples":[],"Fields":[],"Truncated":false,"Validations":{"MinItems":null,"MinLength":null,"Minimum":null,"MaxItems":null,"MaxLength":null,"Maximum":null,"Pattern":null,"UniqueItems":null},"CircularReference":null,"OutputLocation":""},"Name":"internal_name"},{"Type":{"Discriminator":null,"Validations":{"UniqueItems":null,"MinItems":null,"MinLength":null,"Minimum":null,"MaxItems":null,"MaxLength":null,"Maximum":null,"Pattern":null},"Fields":[],"ResponseEnvelope":false,"ResolvedModel":"","AssociatedTypes":[],"Examples":[],"OutputLocation":"","Comments":null,"CircularReference":null,"Original":{"Name":"","OriginalName":"","ContextStack":[],"Type":"string","ItemType":null,"Fields":[],"Validations":{"MinItems":null,"MinLength":null,"Minimum":null,"MaxItems":null,"MaxLength":null,"Maximum":null,"Pattern":null,"UniqueItems":null},"AssociatedTypes":[],"Enum":null,"Scope":"","IsComponent":false,"Truncated":false,"Comments":null,"Input":false,"Output":false,"Extensions":{},"Examples":[],"Format":"","Discriminator":null,"ComplexAny":false,"OutputLocation":"","ResolvedModel":"","EventStreamEnvelope":false,"ResponseEnvelope":false},"Type":"string","Extensions":{"x-speakeasy-trace":{"Product#create.req.name":true},"x-speakeasy-param-computed":true,"x-untouched":true,"x-speakeasy-in-get":true},"Enum":null,"ItemType":null,"Format":"","Truncated":false,"Name":"","EventStreamEnvelope":false,"ContextStack":[],"Input":false,"Output":false,"OriginalName":"","IsComponent":false,"Scope":""},"Optional":false,"Default":null,"Comments":{"Deprecated":false,"DeprecationMessage":"","DeprecationReplacement":"","Description":"The description for the product","ExternalDocs":null,"Summary":""},"IsAdditionalProperties":false,"ErrorMessage":false,"OriginalName":"name","Name":"name","Nullable":false,"Const":null,"Annotations":[{"Ignore":false,"FieldName":"name"}]},{"ErrorMessage":false,"OriginalName":"price_options","Nullable":false,"Optional":true,"Comments":null,"Annotations":[{"FieldName":"price_options","Ignore":false}],"IsAdditionalProperties":false,"Type":{"Scope":"shared","OriginalName":"BaseRelation","Extensions":{"x-speakeasy-param-computed":true,"x-untouched":true,"x-speakeasy-in-get":true,"x-speakeasy-parent-require-to-not-null":true,"Symbol":"BaseRelation","x-speakeasy-trace":{"Product#create.req.price_options":true}},"AssociatedTypes":[],"Format":"","IsComponent":true,"EventStreamEnvelope":false,"ResponseEnvelope":false,"Comments":null,"Examples":[],"Fields":[{"Default":null,"Const":null,"Annotations":[{"Ignore":false,"FieldName":"$relation"}],"IsAdditionalProperties":false,"ErrorMessage":false,"OriginalName":"$relation","Name":"$relation","Nullable":false,"Type":{"Name":"","IsComponent":false,"ContextStack":[],"Type":"array","Examples":[],"Format":"","Original":{"Name":"","OriginalName":"","ContextStack":[],"Type":"array","ItemType":{"Name":"$relation","OriginalName":"$relation","ContextStack":[{"Type":"refType","Identifier":"Schemas","Used":false,"MustUse":false},{"Type":"refName","Identifier":"BaseRelation","Used":false,"MustUse":false}],"Type":"class","ItemType":null,"Fields":[{"Name":"_tags","OriginalName":"_tags","Type":{"Name":"","OriginalName":"","ContextStack":[],"Type":"array","ItemType":{"Name":"","OriginalName":"","ContextStack":[],"Type":"string","ItemType":null,"Fields":[],"Validations":{"MinItems":null,"MinLength":null,"Minimum":null,"MaxItems":null,"MaxLength":null,"Maximum":null,"Pattern":null,"UniqueItems":null},"AssociatedTypes":[],"Enum":null,"Scope":"","IsComponent":false,"Truncated":false,"Comments":null,"Input":false,"Output":false,"Extensions":{},"Examples":[],"Format":"","Discriminator":null,"ComplexAny":false,"OutputLocation":"","ResolvedModel":"","EventStreamEnvelope":false,"ResponseEnvelope":false},"Fields":[],"Validations":{"MinItems":null,"MinLength":null,"Minimum":null,"MaxItems":null,"MaxLength":null,"Maximum":null,"Pattern":null,"UniqueItems":null},"AssociatedTypes":[],"Enum":null,"Scope":"","IsComponent":false,"Truncated":false,"Comments":null,"Input":false,"Output":false,"Extensions":{},"Examples":[],"Format":"","Discriminator":null,"ComplexAny":false,"OutputLocation":"","ResolvedModel":"","EventStreamEnvelope":false,"ResponseEnvelope":false},"Comments":null,"Annotations":[{"Ignore":false,"FieldName":"_tags"}],"Nullable":true,"Optional":true,"SerializationMethod":null,"ErrorMessage":false,"Const":null,"Default":null,"IsAdditionalProperties":false,"ParameterIndex":null},{"Name":"entity_id","OriginalName":"entity_id","Type":{"Name":"","OriginalName":"","ContextStack":[],"Type":"string","ItemType":null,"Fields":[],"Validations":{"MinItems":null,"MinLength":null,"Minimum":null,"MaxItems":null,"MaxLength":null,"Maximum":null,"Pattern":null,"UniqueItems":null},"AssociatedTypes":[],"Enum":null,"Scope":"","IsComponent":false,"Truncated":false,"Comments":null,"Input":false,"Output":false,"Extensions":{},"Examples":[{}],"Format":"uuid","Discriminator":null,"ComplexAny":false,"OutputLocation":"","ResolvedModel":"","EventStreamEnvelope":false,"ResponseEnvelope":false},"Comments":null,"Annotations":[{"Ignore":false,"FieldName":"entity_id"}],"Nullable":false,"Optional":true,"SerializationMethod":null,"ErrorMessage":false,"Const":null,"Default":null,"IsAdditionalProperties":false,"ParameterIndex":null}],"Validations":{"MinItems":null,"MinLength":null,"Minimum":null,"MaxItems":null,"MaxLength":null,"Maximum":null,"Pattern":null,"UniqueItems":null},"AssociatedTypes":[],"Enum":null,"Scope":"shared","IsComponent":false,"Truncated":false,"Comments":null,"Input":false,"Output":false,"Extensions":{},"Examples":[],"Format":"","Discriminator":null,"ComplexAny":false,"OutputLocation":"models/shared","ResolvedModel":"BaseRelation","EventStreamEnvelope":false,"ResponseEnvelope":false},"Fields":[],"Validations":{"MinItems":null,"MinLength":null,"Minimum":null,"MaxItems":null,"MaxLength":null,"Maximum":null,"Pattern":null,"UniqueItems":null},"AssociatedTypes":[],"Enum":null,"Scope":"","IsComponent":false,"Truncated":false,"Comments":null,"Input":false,"Output":false,"Extensions":{},"Examples":[],"Format":"","Discriminator":null,"ComplexAny":false,"OutputLocation":"","ResolvedModel":"","EventStreamEnvelope":false,"ResponseEnvelope":false},"Fields":[],"Input":false,"Discriminator":null,"Output":false,"EventStreamEnvelope":false,"AssociatedTypes":[],"Comments":null,"Validations":{"Minimum":null,"MaxItems":null,"MaxLength":null,"Maximum":null,"Pattern":null,"UniqueItems":null,"MinItems":null,"MinLength":null},"ResponseEnvelope":false,"OriginalName":"","OutputLocation":"","ItemType":{"ResponseEnvelope":false,"ResolvedModel":"BaseRelation","Comments":null,"OriginalName":"$relation","Enum":null,"Examples":[],"Original":{"Name":"$relation","OriginalName":"$relation","ContextStack":[{"Type":"refType","Identifier":"Schemas","Used":false,"MustUse":false},{"Type":"refName","Identifier":"BaseRelation","Used":false,"MustUse":false}],"Type":"class","ItemType":null,"Fields":[{"Name":"_tags","OriginalName":"_tags","Type":{"Name":"","OriginalName":"","ContextStack":[],"Type":"array","ItemType":{"Name":"","OriginalName":"","ContextStack":[],"Type":"string","ItemType":null,"Fields":[],"Validations":{"MinItems":null,"MinLength":null,"Minimum":null,"MaxItems":null,"MaxLength":null,"Maximum":null,"Pattern":null,"UniqueItems":null},"AssociatedTypes":[],"Enum":null,"Scope":"","IsComponent":false,"Truncated":false,"Comments":null,"Input":false,"Output":false,"Extensions":{},"Examples":[],"Format":"","Discriminator":null,"ComplexAny":false,"OutputLocation":"","ResolvedModel":"","EventStreamEnvelope":false,"ResponseEnvelope":false},"Fields":[],"Validations":{"MinItems":null,"MinLength":null,"Minimum":null,"MaxItems":null,"MaxLength":null,"Maximum":null,"Pattern":null,"UniqueItems":null},"AssociatedTypes":[],"Enum":null,"Scope":"","IsComponent":false,"Truncated":false,"Comments":null,"Input":false,"Output":false,"Extensions":{},"Examples":[],"Format":"","Discriminator":null,"ComplexAny":false,"OutputLocation":"","ResolvedModel":"","EventStreamEnvelope":false,"ResponseEnvelope":false},"Comments":null,"Annotations":[{"Ignore":false,"FieldName":"_tags"}],"Nullable":true,"Optional":true,"SerializationMethod":null,"ErrorMessage":false,"Const":null,"Default":null,"IsAdditionalProperties":false,"ParameterIndex":null},{"Name":"entity_id","OriginalName":"entity_id","Type":{"Name":"","OriginalName":"","ContextStack":[],"Type":"string","ItemType":null,"Fields":[],"Validations":{"MinItems":null,"MinLength":null,"Minimum":null,"MaxItems":null,"MaxLength":null,"Maximum":null,"Pattern":null,"UniqueItems":null},"AssociatedTypes":[],"Enum":null,"Scope":"","IsComponent":false,"Truncated":false,"Comments":null,"Input":false,"Output":false,"Extensions":{},"Examples":[{}],"Format":"uuid","Discriminator":null,"ComplexAny":false,"OutputLocation":"","ResolvedModel":"","EventStreamEnvelope":false,"ResponseEnvelope":false},"Comments":null,"Annotations":[{"Ignore":false,"FieldName":"entity_id"}],"Nullable":false,"Optional":true,"SerializationMethod":null,"ErrorMessage":false,"Const":null,"Default":null,"IsAdditionalProperties":false,"ParameterIndex":null}],"Validations":{"MinItems":null,"MinLength":null,"Minimum":null,"MaxItems":null,"MaxLength":null,"Maximum":null,"Pattern":null,"UniqueItems":null},"AssociatedTypes":[],"Enum":null,"Scope":"shared","IsComponent":false,"Truncated":false,"Comments":null,"Input":false,"Output":false,"Extensions":{},"Examples":[],"Format":"","Discriminator":null,"ComplexAny":false,"OutputLocation":"models/shared","ResolvedModel":"BaseRelation","EventStreamEnvelope":false,"ResponseEnvelope":false},"Extensions":{"x-untouched":true,"x-speakeasy-in-get":true,"x-speakeasy-parent-require-to-not-null":true,"Symbol":"DollarRelation","x-speakeasy-trace":{"Product#create.req.price_options.dollar_relation.[]":true},"x-speakeasy-param-computed":true},"ItemType":null,"Validations":{"Pattern":null,"UniqueItems":null,"MinItems":null,"MinLength":null,"Minimum":null,"MaxItems":null,"MaxLength":null,"Maximum":null},"ContextStack":[{"Type":"refType","Identifier":"Schemas","Used":false,"MustUse":false},{"Type":"refName","Identifier":"BaseRelation","Used":false,"MustUse":false}],"Format":"","Input":false,"Type":"class","Discriminator":null,"CircularReference":null,"Output":false,"Fields":[{"Default":null,"Const":null,"Comments":null,"ErrorMessage":false,"OriginalName":"_tags","Nullable":true,"Optional":true,"Annotations":[{"Ignore":false,"FieldName":"_tags"}],"IsAdditionalProperties":false,"Type":{"Extensions":{"x-speakeasy-trace":{"Product#create.req.price_options.dollar_relation.[].tags":true},"x-speakeasy-param-computed":true,"x-untouched":true,"x-speakeasy-in-get":true,"x-speakeasy-parent-require-to-not-null":true},"ResolvedModel":"","Original":{"Name":"","OriginalName":"","ContextStack":[],"Type":"array","ItemType":{"Name":"","OriginalName":"","ContextStack":[],"Type":"string","ItemType":null,"Fields":[],"Validations":{"MinItems":null,"MinLength":null,"Minimum":null,"MaxItems":null,"MaxLength":null,"Maximum":null,"Pattern":null,"UniqueItems":null},"AssociatedTypes":[],"Enum":null,"Scope":"","IsComponent":false,"Truncated":false,"Comments":null,"Input":false,"Output":false,"Extensions":{},"Examples":[],"Format":"","Discriminator":null,"ComplexAny":false,"OutputLocation":"","ResolvedModel":"","EventStreamEnvelope":false,"ResponseEnvelope":false},"Fields":[],"Validations":{"MinItems":null,"MinLength":null,"Minimum":null,"MaxItems":null,"MaxLength":null,"Maximum":null,"Pattern":null,"UniqueItems":null},"AssociatedTypes":[],"Enum":null,"Scope":"","IsComponent":false,"Truncated":false,"Comments":null,"Input":false,"Output":false,"Extensions":{},"Examples":[],"Format":"","Discriminator":null,"ComplexAny":false,"OutputLocation":"","ResolvedModel":"","EventStreamEnvelope":false,"ResponseEnvelope":false},"EventStreamEnvelope":false,"ResponseEnvelope":false,"Discriminator":null,"IsComponent":false,"Name":"","AssociatedTypes":[],"Examples":[],"Truncated":false,"Output":false,"OutputLocation":"","Comments":null,"Input":false,"ItemType":{"Fields":[],"Scope":"","Truncated":false,"Comments":null,"ItemType":null,"Original":{"Name":"","OriginalName":"","ContextStack":[],"Type":"string","ItemType":null,"Fields":[],"Validations":{"MinItems":null,"MinLength":null,"Minimum":null,"MaxItems":null,"MaxLength":null,"Maximum":null,"Pattern":null,"UniqueItems":null},"AssociatedTypes":[],"Enum":null,"Scope":"","IsComponent":false,"Truncated":false,"Comments":null,"Input":false,"Output":false,"Extensions":{},"Examples":[],"Format":"","Discriminator":null,"ComplexAny":false,"OutputLocation":"","ResolvedModel":"","EventStreamEnvelope":false,"ResponseEnvelope":false},"AssociatedTypes":[],"ResolvedModel":"","Name":"","Extensions":{"x-speakeasy-parent-require-to-not-null":true,"Symbol":"Tags","x-speakeasy-trace":{"Product#create.req.price_options.dollar_relation.[].tags.[]":true},"x-speakeasy-param-computed":true,"x-untouched":true,"x-speakeasy-in-get":true},"EventStreamEnvelope":false,"ResponseEnvelope":false,"Input":false,"Output":false,"Discriminator":null,"Validations":{"MinLength":null,"Minimum":null,"MaxItems":null,"MaxLength":null,"Maximum":null,"Pattern":null,"UniqueItems":null,"MinItems":null},"CircularReference":null,"OriginalName":"","ContextStack":[],"Format":"","IsComponent":false,"OutputLocation":"","Enum":null,"Type":"string","Examples":[]},"Scope":"","ContextStack":[],"Enum":null,"Format":"","Validations":{"UniqueItems":null,"MinItems":null,"MinLength":null,"Minimum":null,"MaxItems":null,"MaxLength":null,"Maximum":null,"Pattern":null},"CircularReference":null,"Fields":[],"OriginalName":"","Type":"array"},"Name":"_tags"},{"Type":{"ItemType":null,"EventStreamEnvelope":false,"Name":"","Examples":[{}],"IsComponent":false,"Truncated":false,"Validations":{"MaxLength":null,"Maximum":null,"Pattern":null,"UniqueItems":null,"MinItems":null,"MinLength":null,"Minimum":null,"MaxItems":null},"Original":{"Name":"","OriginalName":"","ContextStack":[],"Type":"string","ItemType":null,"Fields":[],"Validations":{"MinItems":null,"MinLength":null,"Minimum":null,"MaxItems":null,"MaxLength":null,"Maximum":null,"Pattern":null,"UniqueItems":null},"AssociatedTypes":[],"Enum":null,"Scope":"","IsComponent":false,"Truncated":false,"Comments":null,"Input":false,"Output":false,"Extensions":{},"Examples":[{}],"Format":"uuid","Discriminator":null,"ComplexAny":false,"OutputLocation":"","ResolvedModel":"","EventStreamEnvelope":false,"ResponseEnvelope":false},"ContextStack":[],"Comments":null,"Format":"uuid","Enum":null,"Output":false,"ResponseEnvelope":false,"Scope":"","OriginalName":"","Extensions":{"x-speakeasy-trace":{"Product#create.req.price_options.dollar_relation.[].entity_id":true},"x-speakeasy-param-computed":true,"x-untouched":true,"x-speakeasy-in-get":true,"x-speakeasy-parent-require-to-not-null":true},"AssociatedTypes":[],"Fields":[],"CircularReference":null,"ResolvedModel":"","OutputLocation":"","Type":"string","Discriminator":null,"Input":false},"Optional":true,"Default":null,"Const":null,"OriginalName":"entity_id","Name":"entity_id","Nullable":false,"Comments":null,"Annotations":[{"Ignore":false,"FieldName":"entity_id"}],"IsAdditionalProperties":false,"ErrorMessage":false}],"IsComponent":false,"Scope":"shared","OutputLocation":"models/shared","Name":"$relation","AssociatedTypes":[],"EventStreamEnvelope":false,"Truncated":false},"Truncated":false,"CircularReference":null,"ResolvedModel":"","Extensions":{"x-speakeasy-param-computed":true,"x-untouched":true,"x-speakeasy-in-get":true,"x-speakeasy-parent-require-to-not-null":true,"x-speakeasy-trace":{"Product#create.req.price_options.dollar_relation":true}},"Enum":null,"Scope":""},"Optional":true,"Comments":null}],"Name":"BaseRelation","Validations":{"MinLength":null,"Minimum":null,"MaxItems":null,"MaxLength":null,"Maximum":null,"Pattern":null,"UniqueItems":null,"MinItems":null},"ItemType":null,"Truncated":false,"ResolvedModel":"BaseRelation","Original":{"Name":"BaseRelation","OriginalName":"BaseRelation","ContextStack":[{"Type":"refType","Identifier":"Schemas","Used":false,"MustUse":false},{"Type":"refName","Identifier":"BaseRelation","Used":false,"MustUse":false},{"Type":"component","Identifier":"true","Used":false,"MustUse":false}],"Type":"class","ItemType":null,"Fields":[{"Name":"$relation","OriginalName":"$relation","Type":{"Name":"","OriginalName":"","ContextStack":[],"Type":"array","ItemType":{"Name":"$relation","OriginalName":"$relation","ContextStack":[{"Type":"refType","Identifier":"Schemas","Used":false,"MustUse":false},{"Type":"refName","Identifier":"BaseRelation","Used":false,"MustUse":false}],"Type":"class","ItemType":null,"Fields":[{"Name":"_tags","OriginalName":"_tags","Type":{"Name":"","OriginalName":"","ContextStack":[],"Type":"array","ItemType":{"Name":"","OriginalName":"","ContextStack":[],"Type":"string","ItemType":null,"Fields":[],"Validations":{"MinItems":null,"MinLength":null,"Minimum":null,"MaxItems":null,"MaxLength":null,"Maximum":null,"Pattern":null,"UniqueItems":null},"AssociatedTypes":[],"Enum":null,"Scope":"","IsComponent":false,"Truncated":false,"Comments":null,"Input":false,"Output":false,"Extensions":{},"Examples":[],"Format":"","Discriminator":null,"ComplexAny":false,"OutputLocation":"","ResolvedModel":"","EventStreamEnvelope":false,"ResponseEnvelope":false},"Fields":[],"Validations":{"MinItems":null,"MinLength":null,"Minimum":null,"MaxItems":null,"MaxLength":null,"Maximum":null,"Pattern":null,"UniqueItems":null},"AssociatedTypes":[],"Enum":null,"Scope":"","IsComponent":false,"Truncated":false,"Comments":null,"Input":false,"Output":false,"Extensions":{},"Examples":[],"Format":"","Discriminator":null,"ComplexAny":false,"OutputLocation":"","ResolvedModel":"","EventStreamEnvelope":false,"ResponseEnvelope":false},"Comments":null,"Annotations":[{"Ignore":false,"FieldName":"_tags"}],"Nullable":true,"Optional":true,"SerializationMethod":null,"ErrorMessage":false,"Const":null,"Default":null,"IsAdditionalProperties":false,"ParameterIndex":null},{"Name":"entity_id","OriginalName":"entity_id","Type":{"Name":"","OriginalName":"","ContextStack":[],"Type":"string","ItemType":null,"Fields":[],"Validations":{"MinItems":null,"MinLength":null,"Minimum":null,"MaxItems":null,"MaxLength":null,"Maximum":null,"Pattern":null,"UniqueItems":null},"AssociatedTypes":[],"Enum":null,"Scope":"","IsComponent":false,"Truncated":false,"Comments":null,"Input":false,"Output":false,"Extensions":{},"Examples":[{}],"Format":"uuid","Discriminator":null,"ComplexAny":false,"OutputLocation":"","ResolvedModel":"","EventStreamEnvelope":false,"ResponseEnvelope":false},"Comments":null,"Annotations":[{"Ignore":false,"FieldName":"entity_id"}],"Nullable":false,"Optional":true,"SerializationMethod":null,"ErrorMessage":false,"Const":null,"Default":null,"IsAdditionalProperties":false,"ParameterIndex":null}],"Validations":{"MinItems":null,"MinLength":null,"Minimum":null,"MaxItems":null,"MaxLength":null,"Maximum":null,"Pattern":null,"UniqueItems":null},"AssociatedTypes":[],"Enum":null,"Scope":"shared","IsComponent":false,"Truncated":false,"Comments":null,"Input":false,"Output":false,"Extensions":{},"Examples":[],"Format":"","Discriminator":null,"ComplexAny":false,"OutputLocation":"models/shared","ResolvedModel":"BaseRelation","EventStreamEnvelope":false,"ResponseEnvelope":false},"Fields":[],"Validations":{"MinItems":null,"MinLength":null,"Minimum":null,"MaxItems":null,"MaxLength":null,"Maximum":null,"Pattern":null,"UniqueItems":null},"AssociatedTypes":[],"Enum":null,"Scope":"","IsComponent":false,"Truncated":false,"Comments":null,"Input":false,"Output":false,"Extensions":{},"Examples":[],"Format":"","Discriminator":null,"ComplexAny":false,"OutputLocation":"","ResolvedModel":"","EventStreamEnvelope":false,"ResponseEnvelope":false},"Comments":null,"Annotations":[{"Ignore":false,"FieldName":"$relation"}],"Nullable":false,"Optional":true,"SerializationMethod":null,"ErrorMessage":false,"Const":null,"Default":null,"IsAdditionalProperties":false,"ParameterIndex":null}],"Validations":{"MinItems":null,"MinLength":null,"Minimum":null,"MaxItems":null,"MaxLength":null,"Maximum":null,"Pattern":null,"UniqueItems":null},"AssociatedTypes":[],"Enum":null,"Scope":"shared","IsComponent":true,"Truncated":false,"Comments":null,"Input":false,"Output":false,"Extensions":{},"Examples":[],"Format":"","Discriminator":null,"ComplexAny":false,"OutputLocation":"models/shared","ResolvedModel":"BaseRelation","EventStreamEnvelope":false,"ResponseEnvelope":false},"Enum":null,"Input":false,"CircularReference":null,"OutputLocation":"models/shared","ContextStack":[{"Type":"refType","Identifier":"Schemas","Used":false,"MustUse":false},{"Type":"refName","Identifier":"BaseRelation","Used":false,"MustUse":false},{"Type":"component","Identifier":"true","Used":false,"MustUse":false}],"Discriminator":null,"Type":"class","Output":false},"Name":"price_options","Default":null,"Const":null},{"Comments":null,"Annotations":[{"Ignore":false,"FieldName":"product_downloads"}],"IsAdditionalProperties":false,"Const":null,"ErrorMessage":false,"OriginalName":"product_downloads","Type":{"Examples":[],"OutputLocation":"","Comments":null,"Format":"","Type":"any","Input":false,"EventStreamEnvelope":false,"Fields":[],"ItemType":null,"OriginalName":"","Enum":null,"Original":{"Name":"","OriginalName":"","ContextStack":[],"Type":"any","ItemType":null,"Fields":[],"Validations":{"MinItems":null,"MinLength":null,"Minimum":null,"MaxItems":null,"MaxLength":null,"Maximum":null,"Pattern":null,"UniqueItems":null},"AssociatedTypes":[],"Enum":null,"Scope":"","IsComponent":false,"Truncated":false,"Comments":null,"Input":false,"Output":false,"Extensions":{},"Examples":[],"Format":"","Discriminator":null,"ComplexAny":false,"OutputLocation":"","ResolvedModel":"","EventStreamEnvelope":false,"ResponseEnvelope":false},"Name":"","Output":false,"Truncated":false,"Scope":"","ResponseEnvelope":false,"Extensions":{"x-speakeasy-param-computed":true,"x-untouched":true,"x-speakeasy-in-get":true,"x-speakeasy-trace":{"Product#create.req.product_downloads":true}},"AssociatedTypes":[],"Discriminator":null,"IsComponent":false,"Validations":{"UniqueItems":null,"MinItems":null,"MinLength":null,"Minimum":null,"MaxItems":null,"MaxLength":null,"Maximum":null,"Pattern":null},"CircularReference":null,"ResolvedModel":"","ContextStack":[]},"Name":"product_downloads","Nullable":false,"Optional":true,"Default":null},{"OriginalName":"product_images","Type":{"Enum":null,"Input":false,"Type":"any","Comments":null,"IsComponent":false,"EventStreamEnvelope":false,"Fields":[],"Format":"","AssociatedTypes":[],"OriginalName":"","ResolvedModel":"","OutputLocation":"","ContextStack":[],"Scope":"","Validations":{"MinItems":null,"MinLength":null,"Minimum":null,"MaxItems":null,"MaxLength":null,"Maximum":null,"Pattern":null,"UniqueItems":null},"Truncated":false,"Original":{"Name":"","OriginalName":"","ContextStack":[],"Type":"any","ItemType":null,"Fields":[],"Validations":{"MinItems":null,"MinLength":null,"Minimum":null,"MaxItems":null,"MaxLength":null,"Maximum":null,"Pattern":null,"UniqueItems":null},"AssociatedTypes":[],"Enum":null,"Scope":"","IsComponent":false,"Truncated":false,"Comments":null,"Input":false,"Output":false,"Extensions":{},"Examples":[],"Format":"","Discriminator":null,"ComplexAny":false,"OutputLocation":"","ResolvedModel":"","EventStreamEnvelope":false,"ResponseEnvelope":false},"Extensions":{"x-speakeasy-param-computed":true,"x-untouched":true,"x-speakeasy-in-get":true,"x-speakeasy-trace":{"Product#create.req.product_images":true}},"ResponseEnvelope":false,"Name":"","Discriminator":null,"Examples":[],"ItemType":null,"Output":false,"CircularReference":null},"Name":"product_images","Optional":true,"Comments":null,"IsAdditionalProperties":false,"Nullable":false,"Default":null,"Const":null,"Annotations":[{"Ignore":false,"FieldName":"product_images"}],"ErrorMessage":false},{"OriginalName":"","Const":null,"Annotations":[{"Style":"simple","Explode":false,"FieldType":{"ItemType":null,"Scope":"","Extensions":{"x-speakeasy-match":"id"},"Type":"string","Comments":{"DeprecationReplacement":"","DeprecationMessage":"","Summary":"","Description":"The product id","ExternalDocs":null,"ExtendedComments":{},"Deprecated":false},"Input":false,"Format":"uuid","ComplexAny":false,"OutputLocation":"","ResolvedModel":"","Name":"","OriginalName":"","ContextStack":[],"Fields":[],"Validations":{"MinLength":null,"Minimum":null,"MaxItems":null,"MaxLength":null,"Maximum":null,"Pattern":null,"UniqueItems":null,"MinItems":null},"Examples":[{}],"EventStreamEnvelope":false,"ResponseEnvelope":false,"AssociatedTypes":[],"Enum":null,"IsComponent":false,"Truncated":false,"Output":false,"Discriminator":null},"Hidden":false,"ParamType":"pathParam","Name":"productId","Serialization":""}],"IsAdditionalProperties":false,"Type":{"ResponseEnvelope":false,"ResolvedModel":"","Name":"","Extensions":{"x-speakeasy-match":"id","x-speakeasy-trace":{"Product#get.req.product_id":true}},"AssociatedTypes":[],"Enum":null,"IsComponent":false,"ItemType":null,"Scope":"","Truncated":false,"Original":{"Name":"","OriginalName":"","ContextStack":[],"Type":"string","ItemType":null,"Fields":[],"Validations":{"MinItems":null,"MinLength":null,"Minimum":null,"MaxItems":null,"MaxLength":null,"Maximum":null,"Pattern":null,"UniqueItems":null},"AssociatedTypes":[],"Enum":null,"Scope":"","IsComponent":false,"Truncated":false,"Comments":{"Summary":"","Description":"The product id","ExternalDocs":null,"ExtendedComments":{},"Deprecated":false,"DeprecationReplacement":"","DeprecationMessage":""},"Input":false,"Output":false,"Extensions":{"x-speakeasy-match":"id"},"Examples":[{}],"Format":"uuid","Discriminator":null,"ComplexAny":false,"OutputLocation":"","ResolvedModel":"","EventStreamEnvelope":false,"ResponseEnvelope":false},"OutputLocation":"","Input":false,"Comments":{"ExtendedComments":{},"Deprecated":false,"DeprecationReplacement":"","DeprecationMessage":"","Summary":"","Description":"The product id","ExternalDocs":null},"EventStreamEnvelope":false,"OriginalName":"","Format":"uuid","CircularReference":null,"Type":"string","Discriminator":null,"Fields":[],"Validations":{"MaxItems":null,"MaxLength":null,"Maximum":null,"Pattern":null,"UniqueItems":null,"MinItems":null,"MinLength":null,"Minimum":null},"ContextStack":[],"Examples":[{}],"Output":false},"Name":"productId","Nullable":false,"Optional":false,"Default":null,"Comments":{"ExternalDocs":null,"ExtendedComments":{},"Deprecated":false,"DeprecationReplacement":"","DeprecationMessage":"","Summary":"","Description":"The product id"},"ErrorMessage":false},{"Nullable":false,"Optional":true,"Annotations":[{"FieldName":"type","Ignore":false}],"Name":"type","Type":{"Enum":{"Open":false,"Names":[],"Values":["product","service"],"Type":{"IsComponent":false,"EventStreamEnvelope":false,"Original":{"Name":"","OriginalName":"","ContextStack":[],"Type":"string","ItemType":null,"Fields":[],"Validations":{"MinItems":null,"MinLength":null,"Minimum":null,"MaxItems":null,"MaxLength":null,"Maximum":null,"Pattern":null,"UniqueItems":null},"AssociatedTypes":[],"Enum":null,"Scope":"","IsComponent":false,"Truncated":false,"Comments":null,"Input":false,"Output":false,"Extensions":{},"Examples":[],"Format":"","Discriminator":null,"ComplexAny":false,"OutputLocation":"","ResolvedModel":"","EventStreamEnvelope":false,"ResponseEnvelope":false},"OriginalName":"","Enum":null,"AssociatedTypes":[],"ItemType":null,"Output":false,"Validations":{"MinLength":null,"Minimum":null,"MaxItems":null,"MaxLength":null,"Maximum":null,"Pattern":null,"UniqueItems":null,"MinItems":null},"CircularReference":null,"ResolvedModel":"","Extensions":{},"Discriminator":null,"Comments":null,"Format":"","ContextStack":[],"Name":"","Examples":[],"Fields":[],"Scope":"","Type":"string","Input":false,"Truncated":false,"ResponseEnvelope":false,"OutputLocation":""}},"AssociatedTypes":[],"Output":false,"Validations":{"MinLength":null,"Minimum":null,"MaxItems":null,"MaxLength":null,"Maximum":null,"Pattern":null,"UniqueItems":null,"MinItems":null},"Original":{"Name":"ProductCreate_type","OriginalName":"type","ContextStack":[{"Type":"refType","Identifier":"Schemas","Used":false,"MustUse":false},{"Type":"refName","Identifier":"ProductCreate","Used":true,"MustUse":false}],"Type":"enum","ItemType":null,"Fields":[],"Validations":{"MinItems":null,"MinLength":null,"Minimum":null,"MaxItems":null,"MaxLength":null,"Maximum":null,"Pattern":null,"UniqueItems":null},"AssociatedTypes":[],"Enum":{"Type":{"Name":"","OriginalName":"","ContextStack":[],"Type":"string","ItemType":null,"Fields":[],"Validations":{"MinItems":null,"MinLength":null,"Minimum":null,"MaxItems":null,"MaxLength":null,"Maximum":null,"Pattern":null,"UniqueItems":null},"AssociatedTypes":[],"Enum":null,"Scope":"","IsComponent":false,"Truncated":false,"Comments":null,"Input":false,"Output":false,"Extensions":{},"Examples":[],"Format":"","Discriminator":null,"ComplexAny":false,"OutputLocation":"","ResolvedModel":"","EventStreamEnvelope":false,"ResponseEnvelope":false},"Values":["product","service"],"Names":[],"Open":false,"Format":""},"Scope":"shared","IsComponent":false,"Truncated":false,"Comments":{"Summary":"","Description":"The type of Product:\n\n| type | description |\n|----| ----|\n| `product` | Represents a physical good |\n| `service` | Represents a service or virtual product |\n","ExternalDocs":null,"ExtendedComments":{},"Deprecated":false,"DeprecationReplacement":"","DeprecationMessage":""},"Input":false,"Output":false,"Extensions":{},"Examples":[],"Format":"","Discriminator":null,"ComplexAny":false,"OutputLocation":"models/shared","ResolvedModel":"ProductCreate","EventStreamEnvelope":false,"ResponseEnvelope":false},"OriginalName":"type","ContextStack":[{"Type":"refType","Identifier":"Schemas","Used":false,"MustUse":false},{"Type":"refName","Identifier":"ProductCreate","Used":true,"MustUse":false}],"Fields":[],"Extensions":{"x-untouched":true,"x-speakeasy-in-get":true,"x-speakeasy-trace":{"Product#create.req.type":true},"x-speakeasy-param-computed":true},"Examples":[],"ItemType":null,"CircularReference":null,"ResponseEnvelope":false,"ResolvedModel":"ProductCreate","Type":"enum","Discriminator":null,"Name":"ProductCreate_type","Input":false,"IsComponent":false,"Format":"","Scope":"shared","Truncated":false,"EventStreamEnvelope":false,"OutputLocation":"models/shared","Comments":{"DeprecationReplacement":"","DeprecationMessage":"","Summary":"","Description":"The type of Product:\n\n| type | description |\n|----| ----|\n| `product` | Represents a physical good |\n| `service` | Represents a service or virtual product |\n","ExternalDocs":null,"ExtendedComments":{},"Deprecated":false}},"Default":{"Value":"product"},"Const":null,"Comments":{"Summary":"","Deprecated":false,"DeprecationMessage":"","DeprecationReplacement":"","Description":"The type of Product:\n\n| type | description |\n|----| ----|\n| `product` | Represents a physical good |\n| `service` | Represents a service or virtual product |\n","ExternalDocs":null},"IsAdditionalProperties":false,"ErrorMessage":false,"OriginalName":"type"}],"Enum":null,"Format":"","Input":false,"IsComponent":true,"Truncated":false,"Validations":{"Minimum":null,"MaxItems":null,"MaxLength":null,"Maximum":null,"Pattern":null,"UniqueItems":null,"MinItems":null,"MinLength":null},"EventStreamEnvelope":false,"CircularReference":null} + // {"ResolvedModel":"","OutputLocation":"","ContextStack":[],"Extensions":{},"Truncated":false,"EventStreamEnvelope":false,"Type":"boolean","CircularReference":null,"AssociatedTypes":[],"OriginalName":"","Name":"","Enum":null,"ItemType":null,"Scope":"","Format":"","Input":false,"IsComponent":false,"Discriminator":null,"Examples":[],"ResponseEnvelope":false,"Fields":[],"Validations":{"MinItems":null,"MinLength":null,"Minimum":null,"MaxItems":null,"MaxLength":null,"Maximum":null,"Pattern":null,"UniqueItems":null},"Original":{"Name":"","OriginalName":"","ContextStack":[],"Type":"boolean","ItemType":null,"Fields":[],"Validations":{"MinItems":null,"MinLength":null,"Minimum":null,"MaxItems":null,"MaxLength":null,"Maximum":null,"Pattern":null,"UniqueItems":null},"AssociatedTypes":[],"Enum":null,"Scope":"","IsComponent":false,"Truncated":false,"Comments":{"Summary":"","Description":"Hydrates entities in relations when passed true","ExternalDocs":null,"ExtendedComments":{},"Deprecated":false,"DeprecationReplacement":"","DeprecationMessage":""},"Input":false,"Output":false,"Extensions":{},"Examples":[],"Format":"","Discriminator":null,"ComplexAny":false,"OutputLocation":"","ResolvedModel":"","EventStreamEnvelope":false,"ResponseEnvelope":false},"Comments":{"Description":"Hydrates entities in relations when passed true","ExternalDocs":null,"ExtendedComments":{},"Deprecated":false,"DeprecationReplacement":"","DeprecationMessage":"","Summary":""},"Output":false} var hydrate *bool productID := data.ID.ValueString() request := operations.GetProductRequest{ @@ -252,12 +256,16 @@ func (r *ProductResource) Read(ctx context.Context, req resource.ReadRequest, re resp.Diagnostics.AddError("unexpected response from API", fmt.Sprintf("%v", res)) return } + if res.StatusCode == 404 { + resp.State.RemoveResource(ctx) + return + } if res.StatusCode != 200 { resp.Diagnostics.AddError(fmt.Sprintf("unexpected response from API. Got an unexpected response code %v", res.StatusCode), debugResponse(res.RawResponse)) return } - if res.Product == nil { - resp.Diagnostics.AddError("unexpected response from API. No response body", debugResponse(res.RawResponse)) + if !(res.Product != nil) { + resp.Diagnostics.AddError("unexpected response from API. Got an unexpected response body", debugResponse(res.RawResponse)) return } data.RefreshFromSharedProduct(res.Product) @@ -302,8 +310,8 @@ func (r *ProductResource) Update(ctx context.Context, req resource.UpdateRequest resp.Diagnostics.AddError(fmt.Sprintf("unexpected response from API. Got an unexpected response code %v", res.StatusCode), debugResponse(res.RawResponse)) return } - if res.Product == nil { - resp.Diagnostics.AddError("unexpected response from API. No response body", debugResponse(res.RawResponse)) + if !(res.Product != nil) { + resp.Diagnostics.AddError("unexpected response from API. Got an unexpected response body", debugResponse(res.RawResponse)) return } data.RefreshFromSharedProduct(res.Product) diff --git a/internal/provider/product_resource_sdk.go b/internal/provider/product_resource_sdk.go index fb917ff..373030f 100644 --- a/internal/provider/product_resource_sdk.go +++ b/internal/provider/product_resource_sdk.go @@ -1,10 +1,11 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasyapi.com). DO NOT EDIT. package provider import ( "encoding/json" - "github.com/epilot-dev/terraform-provider-epilot-product/internal/sdk/pkg/models/shared" + tfTypes "github.com/epilot-dev/terraform-provider-epilot-product/internal/provider/types" + "github.com/epilot-dev/terraform-provider-epilot-product/internal/sdk/models/shared" "github.com/hashicorp/terraform-plugin-framework/types" ) @@ -22,7 +23,7 @@ func (r *ProductResourceModel) ToSharedProductCreate() *shared.ProductCreate { } else { description = nil } - var feature []interface{} = nil + var feature []interface{} = []interface{}{} for _, featureItem := range r.Feature { var featureTmp interface{} _ = json.Unmarshal([]byte(featureItem.ValueString()), &featureTmp) @@ -37,9 +38,9 @@ func (r *ProductResourceModel) ToSharedProductCreate() *shared.ProductCreate { name := r.Name.ValueString() var priceOptions *shared.BaseRelation if r.PriceOptions != nil { - var dollarRelation []shared.DollarRelation = nil + var dollarRelation []shared.DollarRelation = []shared.DollarRelation{} for _, dollarRelationItem := range r.PriceOptions.DollarRelation { - var tags []string = nil + var tags []string = []string{} for _, tagsItem := range dollarRelationItem.Tags { tags = append(tags, tagsItem.ValueString()) } @@ -88,56 +89,59 @@ func (r *ProductResourceModel) ToSharedProductCreate() *shared.ProductCreate { } func (r *ProductResourceModel) RefreshFromSharedProduct(resp *shared.Product) { - r.ID = types.StringValue(resp.ID) - r.Active = types.BoolValue(resp.Active) - r.Code = types.StringPointerValue(resp.Code) - r.Description = types.StringPointerValue(resp.Description) - r.Feature = nil - for _, featureItem := range resp.Feature { - var feature1 types.String - feature1Result, _ := json.Marshal(featureItem) - feature1 = types.StringValue(string(feature1Result)) - r.Feature = append(r.Feature, feature1) - } - r.InternalName = types.StringPointerValue(resp.InternalName) - r.Name = types.StringValue(resp.Name) - if resp.PriceOptions == nil { - r.PriceOptions = nil - } else { - r.PriceOptions = &BaseRelation{} - if len(r.PriceOptions.DollarRelation) > len(resp.PriceOptions.DollarRelation) { - r.PriceOptions.DollarRelation = r.PriceOptions.DollarRelation[:len(resp.PriceOptions.DollarRelation)] + if resp != nil { + r.ID = types.StringValue(resp.ID) + r.Active = types.BoolValue(resp.Active) + r.Code = types.StringPointerValue(resp.Code) + r.Description = types.StringPointerValue(resp.Description) + r.Feature = nil + for _, featureItem := range resp.Feature { + var feature1 types.String + feature1Result, _ := json.Marshal(featureItem) + feature1 = types.StringValue(string(feature1Result)) + r.Feature = append(r.Feature, feature1) } - for dollarRelationCount, dollarRelationItem := range resp.PriceOptions.DollarRelation { - var dollarRelation1 DollarRelation - dollarRelation1.Tags = nil - for _, v := range dollarRelationItem.Tags { - dollarRelation1.Tags = append(dollarRelation1.Tags, types.StringValue(v)) + r.InternalName = types.StringPointerValue(resp.InternalName) + r.Name = types.StringValue(resp.Name) + if resp.PriceOptions == nil { + r.PriceOptions = nil + } else { + r.PriceOptions = &tfTypes.BaseRelation{} + r.PriceOptions.DollarRelation = []tfTypes.DollarRelation{} + if len(r.PriceOptions.DollarRelation) > len(resp.PriceOptions.DollarRelation) { + r.PriceOptions.DollarRelation = r.PriceOptions.DollarRelation[:len(resp.PriceOptions.DollarRelation)] } - dollarRelation1.EntityID = types.StringPointerValue(dollarRelationItem.EntityID) - if dollarRelationCount+1 > len(r.PriceOptions.DollarRelation) { - r.PriceOptions.DollarRelation = append(r.PriceOptions.DollarRelation, dollarRelation1) - } else { - r.PriceOptions.DollarRelation[dollarRelationCount].Tags = dollarRelation1.Tags - r.PriceOptions.DollarRelation[dollarRelationCount].EntityID = dollarRelation1.EntityID + for dollarRelationCount, dollarRelationItem := range resp.PriceOptions.DollarRelation { + var dollarRelation1 tfTypes.DollarRelation + dollarRelation1.Tags = []types.String{} + for _, v := range dollarRelationItem.Tags { + dollarRelation1.Tags = append(dollarRelation1.Tags, types.StringValue(v)) + } + dollarRelation1.EntityID = types.StringPointerValue(dollarRelationItem.EntityID) + if dollarRelationCount+1 > len(r.PriceOptions.DollarRelation) { + r.PriceOptions.DollarRelation = append(r.PriceOptions.DollarRelation, dollarRelation1) + } else { + r.PriceOptions.DollarRelation[dollarRelationCount].Tags = dollarRelation1.Tags + r.PriceOptions.DollarRelation[dollarRelationCount].EntityID = dollarRelation1.EntityID + } } } - } - if resp.ProductDownloads == nil { - r.ProductDownloads = types.StringNull() - } else { - productDownloadsResult, _ := json.Marshal(resp.ProductDownloads) - r.ProductDownloads = types.StringValue(string(productDownloadsResult)) - } - if resp.ProductImages == nil { - r.ProductImages = types.StringNull() - } else { - productImagesResult, _ := json.Marshal(resp.ProductImages) - r.ProductImages = types.StringValue(string(productImagesResult)) - } - if resp.Type != nil { - r.Type = types.StringValue(string(*resp.Type)) - } else { - r.Type = types.StringNull() + if resp.ProductDownloads == nil { + r.ProductDownloads = types.StringNull() + } else { + productDownloadsResult, _ := json.Marshal(resp.ProductDownloads) + r.ProductDownloads = types.StringValue(string(productDownloadsResult)) + } + if resp.ProductImages == nil { + r.ProductImages = types.StringNull() + } else { + productImagesResult, _ := json.Marshal(resp.ProductImages) + r.ProductImages = types.StringValue(string(productImagesResult)) + } + if resp.Type != nil { + r.Type = types.StringValue(string(*resp.Type)) + } else { + r.Type = types.StringNull() + } } } diff --git a/internal/provider/provider.go b/internal/provider/provider.go index 16d7daa..c95527f 100644 --- a/internal/provider/provider.go +++ b/internal/provider/provider.go @@ -1,16 +1,17 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasyapi.com). DO NOT EDIT. package provider import ( "context" "github.com/epilot-dev/terraform-provider-epilot-product/internal/sdk" - "github.com/epilot-dev/terraform-provider-epilot-product/internal/sdk/pkg/models/shared" + "github.com/epilot-dev/terraform-provider-epilot-product/internal/sdk/models/shared" "github.com/hashicorp/terraform-plugin-framework/datasource" "github.com/hashicorp/terraform-plugin-framework/provider" "github.com/hashicorp/terraform-plugin-framework/provider/schema" "github.com/hashicorp/terraform-plugin-framework/resource" "github.com/hashicorp/terraform-plugin-framework/types" + "net/http" ) var _ provider.Provider = &EpilotProductProvider{} @@ -89,6 +90,7 @@ func (p *EpilotProductProvider) Configure(ctx context.Context, req provider.Conf opts := []sdk.SDKOption{ sdk.WithServerURL(ServerURL), sdk.WithSecurity(security), + sdk.WithClient(http.DefaultClient), } client := sdk.New(opts...) diff --git a/internal/provider/reflect/diags.go b/internal/provider/reflect/diags.go index a91bba9..ce8aa51 100644 --- a/internal/provider/reflect/diags.go +++ b/internal/provider/reflect/diags.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasyapi.com). DO NOT EDIT. package reflect diff --git a/internal/provider/reflect/doc.go b/internal/provider/reflect/doc.go index ec91111..2978edc 100644 --- a/internal/provider/reflect/doc.go +++ b/internal/provider/reflect/doc.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasyapi.com). DO NOT EDIT. // Package reflect is a forked version of https://github.com/hashicorp/terraform-plugin-framework/tree/main/internal/reflect // that has been modified to support speakeasy's terraform generator. diff --git a/internal/provider/reflect/generic_attr_value.go b/internal/provider/reflect/generic_attr_value.go index 430ce2f..39454f5 100644 --- a/internal/provider/reflect/generic_attr_value.go +++ b/internal/provider/reflect/generic_attr_value.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasyapi.com). DO NOT EDIT. package reflect diff --git a/internal/provider/reflect/helpers.go b/internal/provider/reflect/helpers.go index 82b9515..398049d 100644 --- a/internal/provider/reflect/helpers.go +++ b/internal/provider/reflect/helpers.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasyapi.com). DO NOT EDIT. package reflect @@ -46,7 +46,7 @@ func commaSeparatedString(in []string) string { // getStructTags returns a map of Terraform field names to their position in // the tags of the struct `in`. `in` must be a struct. -func getStructTags(_ context.Context, in reflect.Value, path path.Path) (map[string]int, error) { +func getStructTags(_ context.Context, in reflect.Value, path path.Path, opts Options) (map[string]int, error) { tags := map[string]int{} typ := trueReflectValue(in).Type() if typ.Kind() != reflect.Struct { diff --git a/internal/provider/reflect/interfaces.go b/internal/provider/reflect/interfaces.go index 364ff86..f5bd513 100644 --- a/internal/provider/reflect/interfaces.go +++ b/internal/provider/reflect/interfaces.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasyapi.com). DO NOT EDIT. package reflect diff --git a/internal/provider/reflect/into.go b/internal/provider/reflect/into.go index c53d1be..45b15ef 100644 --- a/internal/provider/reflect/into.go +++ b/internal/provider/reflect/into.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasyapi.com). DO NOT EDIT. package reflect diff --git a/internal/provider/reflect/map.go b/internal/provider/reflect/map.go index 3310d42..affbabe 100644 --- a/internal/provider/reflect/map.go +++ b/internal/provider/reflect/map.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasyapi.com). DO NOT EDIT. package reflect diff --git a/internal/provider/reflect/number.go b/internal/provider/reflect/number.go index 37eef21..e0021c3 100644 --- a/internal/provider/reflect/number.go +++ b/internal/provider/reflect/number.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasyapi.com). DO NOT EDIT. package reflect diff --git a/internal/provider/reflect/options.go b/internal/provider/reflect/options.go index 490c5f1..c6d7b44 100644 --- a/internal/provider/reflect/options.go +++ b/internal/provider/reflect/options.go @@ -1,7 +1,12 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasyapi.com). DO NOT EDIT. package reflect +const ( + SourceTypeState = iota + SourceTypePlan +) + // Options provides configuration settings for how the reflection behavior // works, letting callers tweak different behaviors based on their needs. type Options struct { @@ -19,4 +24,8 @@ type Options struct { // perfectly in the types they're being stored in, rather than // returning errors. Numbers will always be rounded towards 0. AllowRoundingNumbers bool + // SourceType informs the reflection system what the source is + // such that it can make decisions based on the tfPlanOnly annotation + // The default is SourceTypeState + SourceType int } diff --git a/internal/provider/reflect/outof.go b/internal/provider/reflect/outof.go index 7852781..4fc5d24 100644 --- a/internal/provider/reflect/outof.go +++ b/internal/provider/reflect/outof.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasyapi.com). DO NOT EDIT. package reflect diff --git a/internal/provider/reflect/pointer.go b/internal/provider/reflect/pointer.go index e02c9eb..0ac5ebb 100644 --- a/internal/provider/reflect/pointer.go +++ b/internal/provider/reflect/pointer.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasyapi.com). DO NOT EDIT. package reflect diff --git a/internal/provider/reflect/primitive.go b/internal/provider/reflect/primitive.go index 3113c39..fc6b0e6 100644 --- a/internal/provider/reflect/primitive.go +++ b/internal/provider/reflect/primitive.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasyapi.com). DO NOT EDIT. package reflect diff --git a/internal/provider/reflect/slice.go b/internal/provider/reflect/slice.go index b91f729..7eea860 100644 --- a/internal/provider/reflect/slice.go +++ b/internal/provider/reflect/slice.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasyapi.com). DO NOT EDIT. package reflect diff --git a/internal/provider/reflect/struct.go b/internal/provider/reflect/struct.go index b670228..01ceb7b 100644 --- a/internal/provider/reflect/struct.go +++ b/internal/provider/reflect/struct.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasyapi.com). DO NOT EDIT. package reflect @@ -73,7 +73,7 @@ func Struct(ctx context.Context, typ attr.Type, object tftypes.Value, target ref // collect a map of fields that are defined in the tags of the struct // passed in - targetFields, err := getStructTags(ctx, target, path) + targetFields, err := getStructTags(ctx, target, path, opts) if err != nil { diags.Append(diag.WithPath(path, DiagIntoIncompatibleType{ Val: object, @@ -125,7 +125,8 @@ func Struct(ctx context.Context, typ attr.Type, object tftypes.Value, target ref } else { result = reflect.New(target.Type()).Elem() } - // Fork End + structType := trueReflectValue(target).Type() + for field, structFieldPos := range targetFields { attrType, ok := attrTypes[field] if !ok { @@ -136,6 +137,13 @@ func Struct(ctx context.Context, typ attr.Type, object tftypes.Value, target ref })) return target, diags } + + fieldReflected := structType.Field(structFieldPos) + if opts.SourceType == SourceTypeState && fieldReflected.Tag.Get(`tfPlanOnly`) == "true" { + // skip explicitly excluded fields + continue + } + // Fork End structField := result.Field(structFieldPos) fieldVal, fieldValDiags := BuildValue(ctx, attrType, objectFields[field], structField, opts, path.AtName(field)) diags.Append(fieldValDiags...) @@ -162,7 +170,7 @@ func FromStruct(ctx context.Context, typ attr.TypeWithAttributeTypes, val reflec // collect a map of fields that are defined in the tags of the struct // passed in - targetFields, err := getStructTags(ctx, val, path) + targetFields, err := getStructTags(ctx, val, path, Options{}) if err != nil { err = fmt.Errorf("error retrieving field names from struct tags: %w", err) diags.AddAttributeError( diff --git a/internal/provider/tax_data_source.go b/internal/provider/tax_data_source.go index 84bfc10..75a8d6f 100644 --- a/internal/provider/tax_data_source.go +++ b/internal/provider/tax_data_source.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasyapi.com). DO NOT EDIT. package provider @@ -6,7 +6,7 @@ import ( "context" "fmt" "github.com/epilot-dev/terraform-provider-epilot-product/internal/sdk" - "github.com/epilot-dev/terraform-provider-epilot-product/internal/sdk/pkg/models/operations" + "github.com/epilot-dev/terraform-provider-epilot-product/internal/sdk/models/operations" "github.com/hashicorp/terraform-plugin-framework/datasource" "github.com/hashicorp/terraform-plugin-framework/datasource/schema" "github.com/hashicorp/terraform-plugin-framework/types" @@ -59,8 +59,7 @@ func (r *TaxDataSource) Schema(ctx context.Context, req datasource.SchemaRequest Description: `Hydrates entities in relations when passed true`, }, "id": schema.StringAttribute{ - Required: true, - Description: `The tax id`, + Computed: true, }, "rate": schema.StringAttribute{ Computed: true, @@ -138,12 +137,16 @@ func (r *TaxDataSource) Read(ctx context.Context, req datasource.ReadRequest, re resp.Diagnostics.AddError("unexpected response from API", fmt.Sprintf("%v", res)) return } + if res.StatusCode == 404 { + resp.State.RemoveResource(ctx) + return + } if res.StatusCode != 200 { resp.Diagnostics.AddError(fmt.Sprintf("unexpected response from API. Got an unexpected response code %v", res.StatusCode), debugResponse(res.RawResponse)) return } - if res.Tax == nil { - resp.Diagnostics.AddError("unexpected response from API. No response body", debugResponse(res.RawResponse)) + if !(res.Tax != nil) { + resp.Diagnostics.AddError("unexpected response from API. Got an unexpected response body", debugResponse(res.RawResponse)) return } data.RefreshFromSharedTax(res.Tax) diff --git a/internal/provider/tax_data_source_sdk.go b/internal/provider/tax_data_source_sdk.go index 17959fc..9605106 100644 --- a/internal/provider/tax_data_source_sdk.go +++ b/internal/provider/tax_data_source_sdk.go @@ -1,17 +1,19 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasyapi.com). DO NOT EDIT. package provider import ( - "github.com/epilot-dev/terraform-provider-epilot-product/internal/sdk/pkg/models/shared" + "github.com/epilot-dev/terraform-provider-epilot-product/internal/sdk/models/shared" "github.com/hashicorp/terraform-plugin-framework/types" ) func (r *TaxDataSourceModel) RefreshFromSharedTax(resp *shared.Tax) { - r.Active = types.BoolValue(resp.Active) - r.Description = types.StringPointerValue(resp.Description) - r.ID = types.StringValue(resp.ID) - r.Rate = types.StringValue(resp.Rate) - r.Region = types.StringValue(string(resp.Region)) - r.Type = types.StringValue(string(resp.Type)) + if resp != nil { + r.ID = types.StringValue(resp.ID) + r.Active = types.BoolValue(resp.Active) + r.Description = types.StringPointerValue(resp.Description) + r.Rate = types.StringValue(resp.Rate) + r.Region = types.StringValue(string(resp.Region)) + r.Type = types.StringValue(string(resp.Type)) + } } diff --git a/internal/provider/tax_resource.go b/internal/provider/tax_resource.go index ab88232..920b00e 100644 --- a/internal/provider/tax_resource.go +++ b/internal/provider/tax_resource.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasyapi.com). DO NOT EDIT. package provider @@ -6,7 +6,7 @@ import ( "context" "fmt" "github.com/epilot-dev/terraform-provider-epilot-product/internal/sdk" - "github.com/epilot-dev/terraform-provider-epilot-product/internal/sdk/pkg/models/operations" + "github.com/epilot-dev/terraform-provider-epilot-product/internal/sdk/models/operations" "github.com/hashicorp/terraform-plugin-framework-validators/stringvalidator" "github.com/hashicorp/terraform-plugin-framework/path" "github.com/hashicorp/terraform-plugin-framework/resource" @@ -31,9 +31,9 @@ type TaxResource struct { // TaxResourceModel describes the resource data model. type TaxResourceModel struct { - ID types.String `tfsdk:"id"` Active types.Bool `tfsdk:"active"` Description types.String `tfsdk:"description"` + ID types.String `tfsdk:"id"` Rate types.String `tfsdk:"rate"` Region types.String `tfsdk:"region"` Type types.String `tfsdk:"type"` @@ -46,12 +46,7 @@ func (r *TaxResource) Metadata(ctx context.Context, req resource.MetadataRequest func (r *TaxResource) Schema(ctx context.Context, req resource.SchemaRequest, resp *resource.SchemaResponse) { resp.Schema = schema.Schema{ MarkdownDescription: "Tax Resource", - Attributes: map[string]schema.Attribute{ - "id": schema.StringAttribute{ - Computed: true, - Description: `The tax id`, - }, "active": schema.BoolAttribute{ Required: true, }, @@ -59,6 +54,9 @@ func (r *TaxResource) Schema(ctx context.Context, req resource.SchemaRequest, re Computed: true, Optional: true, }, + "id": schema.StringAttribute{ + Computed: true, + }, "rate": schema.StringAttribute{ Required: true, }, @@ -142,8 +140,8 @@ func (r *TaxResource) Create(ctx context.Context, req resource.CreateRequest, re resp.Diagnostics.AddError(fmt.Sprintf("unexpected response from API. Got an unexpected response code %v", res.StatusCode), debugResponse(res.RawResponse)) return } - if res.Tax == nil { - resp.Diagnostics.AddError("unexpected response from API. No response body", debugResponse(res.RawResponse)) + if !(res.Tax != nil) { + resp.Diagnostics.AddError("unexpected response from API. Got an unexpected response body", debugResponse(res.RawResponse)) return } data.RefreshFromSharedTax(res.Tax) @@ -171,6 +169,9 @@ func (r *TaxResource) Read(ctx context.Context, req resource.ReadRequest, resp * return } + // read.tax.hydrateread.tax.hydrate impedance mismatch: "boolean" != "class"trace=["Tax#create.req"] + // {"ResponseEnvelope":false,"ResolvedModel":"TaxCreate","Original":{"Name":"TaxCreate","OriginalName":"TaxCreate","ContextStack":[{"Type":"refType","Identifier":"Schemas","Used":false,"MustUse":false},{"Type":"refName","Identifier":"TaxCreate","Used":false,"MustUse":false},{"Type":"component","Identifier":"true","Used":false,"MustUse":false}],"Type":"class","ItemType":null,"Fields":[{"Name":"active","OriginalName":"active","Type":{"Name":"","OriginalName":"","ContextStack":[],"Type":"boolean","ItemType":null,"Fields":[],"Validations":{"MinItems":null,"MinLength":null,"Minimum":null,"MaxItems":null,"MaxLength":null,"Maximum":null,"Pattern":null,"UniqueItems":null},"AssociatedTypes":[],"Enum":null,"Scope":"","IsComponent":false,"Truncated":false,"Comments":null,"Input":false,"Output":false,"Extensions":{},"Examples":[],"Format":"","Discriminator":null,"ComplexAny":false,"OutputLocation":"","ResolvedModel":"","EventStreamEnvelope":false,"ResponseEnvelope":false},"Comments":null,"Annotations":[{"Ignore":false,"FieldName":"active"}],"Nullable":false,"Optional":false,"SerializationMethod":null,"ErrorMessage":false,"Const":null,"Default":null,"IsAdditionalProperties":false,"ParameterIndex":null},{"Name":"description","OriginalName":"description","Type":{"Name":"","OriginalName":"","ContextStack":[],"Type":"string","ItemType":null,"Fields":[],"Validations":{"MinItems":null,"MinLength":null,"Minimum":null,"MaxItems":null,"MaxLength":null,"Maximum":null,"Pattern":null,"UniqueItems":null},"AssociatedTypes":[],"Enum":null,"Scope":"","IsComponent":false,"Truncated":false,"Comments":null,"Input":false,"Output":false,"Extensions":{},"Examples":[],"Format":"","Discriminator":null,"ComplexAny":false,"OutputLocation":"","ResolvedModel":"","EventStreamEnvelope":false,"ResponseEnvelope":false},"Comments":null,"Annotations":[{"Ignore":false,"FieldName":"description"}],"Nullable":false,"Optional":true,"SerializationMethod":null,"ErrorMessage":false,"Const":null,"Default":null,"IsAdditionalProperties":false,"ParameterIndex":null},{"Name":"rate","OriginalName":"rate","Type":{"Name":"","OriginalName":"","ContextStack":[],"Type":"string","ItemType":null,"Fields":[],"Validations":{"MinItems":null,"MinLength":null,"Minimum":null,"MaxItems":null,"MaxLength":null,"Maximum":null,"Pattern":null,"UniqueItems":null},"AssociatedTypes":[],"Enum":null,"Scope":"","IsComponent":false,"Truncated":false,"Comments":null,"Input":false,"Output":false,"Extensions":{},"Examples":[],"Format":"","Discriminator":null,"ComplexAny":false,"OutputLocation":"","ResolvedModel":"","EventStreamEnvelope":false,"ResponseEnvelope":false},"Comments":null,"Annotations":[{"Ignore":false,"FieldName":"rate"}],"Nullable":false,"Optional":false,"SerializationMethod":null,"ErrorMessage":false,"Const":null,"Default":null,"IsAdditionalProperties":false,"ParameterIndex":null},{"Name":"region","OriginalName":"region","Type":{"Name":"TaxCreate_region","OriginalName":"region","ContextStack":[{"Type":"refType","Identifier":"Schemas","Used":false,"MustUse":false},{"Type":"refName","Identifier":"TaxCreate","Used":true,"MustUse":false}],"Type":"enum","ItemType":null,"Fields":[],"Validations":{"MinItems":null,"MinLength":null,"Minimum":null,"MaxItems":null,"MaxLength":null,"Maximum":null,"Pattern":null,"UniqueItems":null},"AssociatedTypes":[],"Enum":{"Type":{"Name":"","OriginalName":"","ContextStack":[],"Type":"string","ItemType":null,"Fields":[],"Validations":{"MinItems":null,"MinLength":null,"Minimum":null,"MaxItems":null,"MaxLength":null,"Maximum":null,"Pattern":null,"UniqueItems":null},"AssociatedTypes":[],"Enum":null,"Scope":"","IsComponent":false,"Truncated":false,"Comments":null,"Input":false,"Output":false,"Extensions":{},"Examples":[],"Format":"","Discriminator":null,"ComplexAny":false,"OutputLocation":"","ResolvedModel":"","EventStreamEnvelope":false,"ResponseEnvelope":false},"Values":["DE","AT","CH"],"Names":[],"Open":false,"Format":""},"Scope":"shared","IsComponent":false,"Truncated":false,"Comments":null,"Input":false,"Output":false,"Extensions":{},"Examples":[],"Format":"","Discriminator":null,"ComplexAny":false,"OutputLocation":"models/shared","ResolvedModel":"TaxCreate","EventStreamEnvelope":false,"ResponseEnvelope":false},"Comments":null,"Annotations":[{"Ignore":false,"FieldName":"region"}],"Nullable":false,"Optional":false,"SerializationMethod":null,"ErrorMessage":false,"Const":null,"Default":null,"IsAdditionalProperties":false,"ParameterIndex":null},{"Name":"type","OriginalName":"type","Type":{"Name":"TaxCreate_type","OriginalName":"type","ContextStack":[{"Type":"refType","Identifier":"Schemas","Used":false,"MustUse":false},{"Type":"refName","Identifier":"TaxCreate","Used":true,"MustUse":false}],"Type":"enum","ItemType":null,"Fields":[],"Validations":{"MinItems":null,"MinLength":null,"Minimum":null,"MaxItems":null,"MaxLength":null,"Maximum":null,"Pattern":null,"UniqueItems":null},"AssociatedTypes":[],"Enum":{"Type":{"Name":"","OriginalName":"","ContextStack":[],"Type":"string","ItemType":null,"Fields":[],"Validations":{"MinItems":null,"MinLength":null,"Minimum":null,"MaxItems":null,"MaxLength":null,"Maximum":null,"Pattern":null,"UniqueItems":null},"AssociatedTypes":[],"Enum":null,"Scope":"","IsComponent":false,"Truncated":false,"Comments":null,"Input":false,"Output":false,"Extensions":{},"Examples":[],"Format":"","Discriminator":null,"ComplexAny":false,"OutputLocation":"","ResolvedModel":"","EventStreamEnvelope":false,"ResponseEnvelope":false},"Values":["VAT","Custom"],"Names":[],"Open":false,"Format":""},"Scope":"shared","IsComponent":false,"Truncated":false,"Comments":null,"Input":false,"Output":false,"Extensions":{},"Examples":[],"Format":"","Discriminator":null,"ComplexAny":false,"OutputLocation":"models/shared","ResolvedModel":"TaxCreate","EventStreamEnvelope":false,"ResponseEnvelope":false},"Comments":null,"Annotations":[{"Ignore":false,"FieldName":"type"}],"Nullable":false,"Optional":false,"SerializationMethod":null,"ErrorMessage":false,"Const":null,"Default":null,"IsAdditionalProperties":false,"ParameterIndex":null}],"Validations":{"MinItems":null,"MinLength":null,"Minimum":null,"MaxItems":null,"MaxLength":null,"Maximum":null,"Pattern":null,"UniqueItems":null},"AssociatedTypes":[],"Enum":null,"Scope":"shared","IsComponent":true,"Truncated":false,"Comments":null,"Input":false,"Output":false,"Extensions":{"x-speakeasy-entity":"Tax"},"Examples":[],"Format":"","Discriminator":null,"ComplexAny":false,"OutputLocation":"models/shared","ResolvedModel":"TaxCreate","EventStreamEnvelope":false,"ResponseEnvelope":false},"Comments":null,"IsComponent":true,"AssociatedTypes":[],"Fields":[{"Default":null,"Const":null,"Comments":null,"Annotations":[{"Ignore":false,"FieldName":"_id"}],"IsAdditionalProperties":false,"OriginalName":"_id","Type":{"ResolvedModel":"","Enum":null,"ContextStack":[],"EventStreamEnvelope":false,"ItemType":null,"IsComponent":false,"OriginalName":"","Type":"string","Comments":null,"Discriminator":null,"CircularReference":null,"OutputLocation":"","Examples":[{}],"Fields":[],"Format":"uuid","Original":{"Name":"","OriginalName":"","ContextStack":[],"Type":"string","ItemType":null,"Fields":[],"Validations":{"MinItems":null,"MinLength":null,"Minimum":null,"MaxItems":null,"MaxLength":null,"Maximum":null,"Pattern":null,"UniqueItems":null},"AssociatedTypes":[],"Enum":null,"Scope":"","IsComponent":false,"Truncated":false,"Comments":null,"Input":false,"Output":false,"Extensions":{},"Examples":[{}],"Format":"uuid","Discriminator":null,"ComplexAny":false,"OutputLocation":"","ResolvedModel":"","EventStreamEnvelope":false,"ResponseEnvelope":false},"Name":"","Extensions":{"x-speakeasy-trace":{"Tax#create.resp.id":true},"x-speakeasy-param-computed":true,"x-untouched":true,"x-speakeasy-param-readonly":true,"x-speakeasy-in-get":true},"ResponseEnvelope":false,"Truncated":false,"Validations":{"MaxLength":null,"Maximum":null,"Pattern":null,"UniqueItems":null,"MinItems":null,"MinLength":null,"Minimum":null,"MaxItems":null},"Scope":"","AssociatedTypes":[],"Input":false,"Output":false},"Name":"_id","Nullable":false,"Optional":false,"ErrorMessage":false},{"Comments":null,"Annotations":[{"Ignore":false,"FieldName":"active"}],"OriginalName":"active","Optional":false,"Default":null,"Const":null,"ErrorMessage":false,"Type":{"ItemType":null,"Output":false,"Scope":"","ResponseEnvelope":false,"Enum":null,"Discriminator":null,"EventStreamEnvelope":false,"Type":"boolean","Format":"","Original":{"Name":"","OriginalName":"","ContextStack":[],"Type":"boolean","ItemType":null,"Fields":[],"Validations":{"MinItems":null,"MinLength":null,"Minimum":null,"MaxItems":null,"MaxLength":null,"Maximum":null,"Pattern":null,"UniqueItems":null},"AssociatedTypes":[],"Enum":null,"Scope":"","IsComponent":false,"Truncated":false,"Comments":null,"Input":false,"Output":false,"Extensions":{},"Examples":[],"Format":"","Discriminator":null,"ComplexAny":false,"OutputLocation":"","ResolvedModel":"","EventStreamEnvelope":false,"ResponseEnvelope":false},"Name":"","AssociatedTypes":[],"Input":false,"ContextStack":[],"OutputLocation":"","Comments":null,"CircularReference":null,"ResolvedModel":"","OriginalName":"","Examples":[],"Validations":{"MaxLength":null,"Maximum":null,"Pattern":null,"UniqueItems":null,"MinItems":null,"MinLength":null,"Minimum":null,"MaxItems":null},"IsComponent":false,"Truncated":false,"Extensions":{"x-untouched":true,"x-speakeasy-in-get":true,"x-speakeasy-trace":{"Tax#create.req.active":true},"x-speakeasy-param-computed":true},"Fields":[]},"Name":"active","Nullable":false,"IsAdditionalProperties":false},{"Name":"description","Optional":true,"Default":null,"Const":null,"IsAdditionalProperties":false,"ErrorMessage":false,"OriginalName":"description","Type":{"Name":"","Extensions":{"x-speakeasy-trace":{"Tax#create.req.description":true},"x-speakeasy-param-computed":true,"x-untouched":true,"x-speakeasy-in-get":true},"IsComponent":false,"EventStreamEnvelope":false,"ResolvedModel":"","Original":{"Name":"","OriginalName":"","ContextStack":[],"Type":"string","ItemType":null,"Fields":[],"Validations":{"MinItems":null,"MinLength":null,"Minimum":null,"MaxItems":null,"MaxLength":null,"Maximum":null,"Pattern":null,"UniqueItems":null},"AssociatedTypes":[],"Enum":null,"Scope":"","IsComponent":false,"Truncated":false,"Comments":null,"Input":false,"Output":false,"Extensions":{},"Examples":[],"Format":"","Discriminator":null,"ComplexAny":false,"OutputLocation":"","ResolvedModel":"","EventStreamEnvelope":false,"ResponseEnvelope":false},"ContextStack":[],"Discriminator":null,"Examples":[],"OriginalName":"","Enum":null,"ResponseEnvelope":false,"Comments":null,"Truncated":false,"CircularReference":null,"Type":"string","Output":false,"Scope":"","Fields":[],"Format":"","Input":false,"ItemType":null,"OutputLocation":"","AssociatedTypes":[],"Validations":{"Pattern":null,"UniqueItems":null,"MinItems":null,"MinLength":null,"Minimum":null,"MaxItems":null,"MaxLength":null,"Maximum":null}},"Nullable":false,"Comments":null,"Annotations":[{"FieldName":"description","Ignore":false}]},{"Const":null,"Comments":null,"Annotations":[{"Ignore":false,"FieldName":"rate"}],"ErrorMessage":false,"OriginalName":"rate","Default":null,"Nullable":false,"Optional":false,"IsAdditionalProperties":false,"Type":{"Format":"","Type":"string","Extensions":{"x-speakeasy-trace":{"Tax#create.req.rate":true},"x-speakeasy-param-computed":true,"x-untouched":true,"x-speakeasy-in-get":true},"Enum":null,"IsComponent":false,"ResponseEnvelope":false,"ResolvedModel":"","OutputLocation":"","EventStreamEnvelope":false,"Original":{"Name":"","OriginalName":"","ContextStack":[],"Type":"string","ItemType":null,"Fields":[],"Validations":{"MinItems":null,"MinLength":null,"Minimum":null,"MaxItems":null,"MaxLength":null,"Maximum":null,"Pattern":null,"UniqueItems":null},"AssociatedTypes":[],"Enum":null,"Scope":"","IsComponent":false,"Truncated":false,"Comments":null,"Input":false,"Output":false,"Extensions":{},"Examples":[],"Format":"","Discriminator":null,"ComplexAny":false,"OutputLocation":"","ResolvedModel":"","EventStreamEnvelope":false,"ResponseEnvelope":false},"ContextStack":[],"Name":"","Validations":{"MaxLength":null,"Maximum":null,"Pattern":null,"UniqueItems":null,"MinItems":null,"MinLength":null,"Minimum":null,"MaxItems":null},"OriginalName":"","Scope":"","CircularReference":null,"ItemType":null,"Comments":null,"Fields":[],"Input":false,"Output":false,"Truncated":false,"AssociatedTypes":[],"Discriminator":null,"Examples":[]},"Name":"rate"},{"OriginalName":"region","Name":"region","Comments":null,"Annotations":[{"Ignore":false,"FieldName":"region"}],"IsAdditionalProperties":false,"Type":{"AssociatedTypes":[],"Comments":null,"ContextStack":[{"Type":"refType","Identifier":"Schemas","Used":false,"MustUse":false},{"Type":"refName","Identifier":"TaxCreate","Used":true,"MustUse":false}],"Original":{"Name":"TaxCreate_region","OriginalName":"region","ContextStack":[{"Type":"refType","Identifier":"Schemas","Used":false,"MustUse":false},{"Type":"refName","Identifier":"TaxCreate","Used":true,"MustUse":false}],"Type":"enum","ItemType":null,"Fields":[],"Validations":{"MinItems":null,"MinLength":null,"Minimum":null,"MaxItems":null,"MaxLength":null,"Maximum":null,"Pattern":null,"UniqueItems":null},"AssociatedTypes":[],"Enum":{"Type":{"Name":"","OriginalName":"","ContextStack":[],"Type":"string","ItemType":null,"Fields":[],"Validations":{"MinItems":null,"MinLength":null,"Minimum":null,"MaxItems":null,"MaxLength":null,"Maximum":null,"Pattern":null,"UniqueItems":null},"AssociatedTypes":[],"Enum":null,"Scope":"","IsComponent":false,"Truncated":false,"Comments":null,"Input":false,"Output":false,"Extensions":{},"Examples":[],"Format":"","Discriminator":null,"ComplexAny":false,"OutputLocation":"","ResolvedModel":"","EventStreamEnvelope":false,"ResponseEnvelope":false},"Values":["DE","AT","CH"],"Names":[],"Open":false,"Format":""},"Scope":"shared","IsComponent":false,"Truncated":false,"Comments":null,"Input":false,"Output":false,"Extensions":{},"Examples":[],"Format":"","Discriminator":null,"ComplexAny":false,"OutputLocation":"models/shared","ResolvedModel":"TaxCreate","EventStreamEnvelope":false,"ResponseEnvelope":false},"OutputLocation":"models/shared","Format":"","IsComponent":false,"EventStreamEnvelope":false,"Name":"TaxCreate_region","Discriminator":null,"Input":false,"OriginalName":"region","Type":"enum","CircularReference":null,"Validations":{"UniqueItems":null,"MinItems":null,"MinLength":null,"Minimum":null,"MaxItems":null,"MaxLength":null,"Maximum":null,"Pattern":null},"ResolvedModel":"TaxCreate","Output":false,"ResponseEnvelope":false,"Examples":[],"ItemType":null,"Scope":"shared","Truncated":false,"Enum":{"Type":{"CircularReference":null,"IsComponent":false,"Scope":"","Original":{"Name":"","OriginalName":"","ContextStack":[],"Type":"string","ItemType":null,"Fields":[],"Validations":{"MinItems":null,"MinLength":null,"Minimum":null,"MaxItems":null,"MaxLength":null,"Maximum":null,"Pattern":null,"UniqueItems":null},"AssociatedTypes":[],"Enum":null,"Scope":"","IsComponent":false,"Truncated":false,"Comments":null,"Input":false,"Output":false,"Extensions":{},"Examples":[],"Format":"","Discriminator":null,"ComplexAny":false,"OutputLocation":"","ResolvedModel":"","EventStreamEnvelope":false,"ResponseEnvelope":false},"Extensions":{},"Fields":[],"Format":"","ContextStack":[],"Name":"","Comments":null,"EventStreamEnvelope":false,"Enum":null,"ItemType":null,"Truncated":false,"OriginalName":"","Discriminator":null,"Input":false,"ResponseEnvelope":false,"AssociatedTypes":[],"ResolvedModel":"","OutputLocation":"","Type":"string","Examples":[],"Output":false,"Validations":{"Maximum":null,"Pattern":null,"UniqueItems":null,"MinItems":null,"MinLength":null,"Minimum":null,"MaxItems":null,"MaxLength":null}},"Open":false,"Names":[],"Values":["DE","AT","CH"]},"Fields":[],"Extensions":{"x-speakeasy-trace":{"Tax#create.req.region":true},"x-speakeasy-param-computed":true,"x-untouched":true,"x-speakeasy-in-get":true}},"Nullable":false,"Optional":false,"Default":null,"Const":null,"ErrorMessage":false},{"Type":{"Name":"","Extensions":{"x-speakeasy-match":"id","x-speakeasy-trace":{"Tax#get.req.tax_id":true}},"Comments":{"Summary":"","Description":"The tax id","ExternalDocs":null,"ExtendedComments":{},"Deprecated":false,"DeprecationReplacement":"","DeprecationMessage":""},"Discriminator":null,"Enum":null,"AssociatedTypes":[],"Truncated":false,"EventStreamEnvelope":false,"ResponseEnvelope":false,"OriginalName":"","IsComponent":false,"OutputLocation":"","Format":"uuid","Output":false,"Scope":"","ResolvedModel":"","CircularReference":null,"Type":"string","Input":false,"Original":{"Name":"","OriginalName":"","ContextStack":[],"Type":"string","ItemType":null,"Fields":[],"Validations":{"MinItems":null,"MinLength":null,"Minimum":null,"MaxItems":null,"MaxLength":null,"Maximum":null,"Pattern":null,"UniqueItems":null},"AssociatedTypes":[],"Enum":null,"Scope":"","IsComponent":false,"Truncated":false,"Comments":{"Summary":"","Description":"The tax id","ExternalDocs":null,"ExtendedComments":{},"Deprecated":false,"DeprecationReplacement":"","DeprecationMessage":""},"Input":false,"Output":false,"Extensions":{"x-speakeasy-match":"id"},"Examples":[{}],"Format":"uuid","Discriminator":null,"ComplexAny":false,"OutputLocation":"","ResolvedModel":"","EventStreamEnvelope":false,"ResponseEnvelope":false},"ContextStack":[],"Examples":[{}],"Fields":[],"ItemType":null,"Validations":{"Pattern":null,"UniqueItems":null,"MinItems":null,"MinLength":null,"Minimum":null,"MaxItems":null,"MaxLength":null,"Maximum":null}},"Name":"taxId","Nullable":false,"Const":null,"Comments":{"DeprecationMessage":"","Summary":"","Description":"The tax id","ExternalDocs":null,"ExtendedComments":{},"Deprecated":false,"DeprecationReplacement":""},"OriginalName":"","Optional":false,"Default":null,"Annotations":[{"Serialization":"","Style":"simple","Explode":false,"FieldType":{"Truncated":false,"Comments":{"ExternalDocs":null,"ExtendedComments":{},"Deprecated":false,"DeprecationReplacement":"","DeprecationMessage":"","Summary":"","Description":"The tax id"},"Extensions":{"x-speakeasy-match":"id"},"EventStreamEnvelope":false,"OriginalName":"","Type":"string","Scope":"","IsComponent":false,"Input":false,"Format":"uuid","OutputLocation":"","ResponseEnvelope":false,"Name":"","Enum":null,"Examples":[{}],"ComplexAny":false,"Fields":[],"AssociatedTypes":[],"Validations":{"UniqueItems":null,"MinItems":null,"MinLength":null,"Minimum":null,"MaxItems":null,"MaxLength":null,"Maximum":null,"Pattern":null},"Output":false,"Discriminator":null,"ResolvedModel":"","ContextStack":[],"ItemType":null},"Hidden":false,"ParamType":"pathParam","Name":"taxId"}],"IsAdditionalProperties":false,"ErrorMessage":false},{"Comments":null,"IsAdditionalProperties":false,"Type":{"Output":false,"CircularReference":null,"ResponseEnvelope":false,"Name":"TaxCreate_type","Examples":[],"Discriminator":null,"Fields":[],"AssociatedTypes":[],"Comments":null,"ResolvedModel":"TaxCreate","Input":false,"ContextStack":[{"Type":"refType","Identifier":"Schemas","Used":false,"MustUse":false},{"Type":"refName","Identifier":"TaxCreate","Used":true,"MustUse":false}],"Type":"enum","ItemType":null,"Enum":{"Names":[],"Values":["VAT","Custom"],"Type":{"IsComponent":false,"Name":"","Extensions":{},"Examples":[],"EventStreamEnvelope":false,"OriginalName":"","Type":"string","Enum":null,"Input":false,"ItemType":null,"Discriminator":null,"Output":false,"ResolvedModel":"","Truncated":false,"CircularReference":null,"OutputLocation":"","ContextStack":[],"AssociatedTypes":[],"Fields":[],"Format":"","Validations":{"Maximum":null,"Pattern":null,"UniqueItems":null,"MinItems":null,"MinLength":null,"Minimum":null,"MaxItems":null,"MaxLength":null},"ResponseEnvelope":false,"Original":{"Name":"","OriginalName":"","ContextStack":[],"Type":"string","ItemType":null,"Fields":[],"Validations":{"MinItems":null,"MinLength":null,"Minimum":null,"MaxItems":null,"MaxLength":null,"Maximum":null,"Pattern":null,"UniqueItems":null},"AssociatedTypes":[],"Enum":null,"Scope":"","IsComponent":false,"Truncated":false,"Comments":null,"Input":false,"Output":false,"Extensions":{},"Examples":[],"Format":"","Discriminator":null,"ComplexAny":false,"OutputLocation":"","ResolvedModel":"","EventStreamEnvelope":false,"ResponseEnvelope":false},"Comments":null,"Scope":""},"Open":false},"IsComponent":false,"Validations":{"MinItems":null,"MinLength":null,"Minimum":null,"MaxItems":null,"MaxLength":null,"Maximum":null,"Pattern":null,"UniqueItems":null},"Original":{"Name":"TaxCreate_type","OriginalName":"type","ContextStack":[{"Type":"refType","Identifier":"Schemas","Used":false,"MustUse":false},{"Type":"refName","Identifier":"TaxCreate","Used":true,"MustUse":false}],"Type":"enum","ItemType":null,"Fields":[],"Validations":{"MinItems":null,"MinLength":null,"Minimum":null,"MaxItems":null,"MaxLength":null,"Maximum":null,"Pattern":null,"UniqueItems":null},"AssociatedTypes":[],"Enum":{"Type":{"Name":"","OriginalName":"","ContextStack":[],"Type":"string","ItemType":null,"Fields":[],"Validations":{"MinItems":null,"MinLength":null,"Minimum":null,"MaxItems":null,"MaxLength":null,"Maximum":null,"Pattern":null,"UniqueItems":null},"AssociatedTypes":[],"Enum":null,"Scope":"","IsComponent":false,"Truncated":false,"Comments":null,"Input":false,"Output":false,"Extensions":{},"Examples":[],"Format":"","Discriminator":null,"ComplexAny":false,"OutputLocation":"","ResolvedModel":"","EventStreamEnvelope":false,"ResponseEnvelope":false},"Values":["VAT","Custom"],"Names":[],"Open":false,"Format":""},"Scope":"shared","IsComponent":false,"Truncated":false,"Comments":null,"Input":false,"Output":false,"Extensions":{},"Examples":[],"Format":"","Discriminator":null,"ComplexAny":false,"OutputLocation":"models/shared","ResolvedModel":"TaxCreate","EventStreamEnvelope":false,"ResponseEnvelope":false},"OutputLocation":"models/shared","Scope":"shared","Truncated":false,"EventStreamEnvelope":false,"Format":"","OriginalName":"type","Extensions":{"x-untouched":true,"x-speakeasy-in-get":true,"x-speakeasy-trace":{"Tax#create.req.type":true},"x-speakeasy-param-computed":true}},"Name":"type","Nullable":false,"Optional":false,"Default":null,"Const":null,"ErrorMessage":false,"OriginalName":"type","Annotations":[{"Ignore":false,"FieldName":"type"}]}],"ItemType":null,"Truncated":false,"OriginalName":"TaxCreate","OutputLocation":"models/shared","Examples":[],"Output":false,"EventStreamEnvelope":false,"Validations":{"Pattern":null,"UniqueItems":null,"MinItems":null,"MinLength":null,"Minimum":null,"MaxItems":null,"MaxLength":null,"Maximum":null},"Extensions":{"x-speakeasy-entity":"Tax","x-speakeasy-trace":{"Tax#create.req":true},"x-speakeasy-param-computed":true,"x-untouched":true,"x-speakeasy-in-get-request":true,"x-speakeasy-in-get":true,"x-speakeasy-root":true},"Scope":"shared","CircularReference":null,"Format":"","Name":"Tax","Type":"class","Discriminator":null,"ContextStack":[{"Type":"refType","Identifier":"Schemas","Used":false,"MustUse":false},{"Type":"refName","Identifier":"TaxCreate","Used":false,"MustUse":false},{"Type":"component","Identifier":"true","Used":false,"MustUse":false}],"Enum":null,"Input":false} + // {"Examples":[],"ItemType":null,"Original":{"Name":"","OriginalName":"","ContextStack":[],"Type":"boolean","ItemType":null,"Fields":[],"Validations":{"MinItems":null,"MinLength":null,"Minimum":null,"MaxItems":null,"MaxLength":null,"Maximum":null,"Pattern":null,"UniqueItems":null},"AssociatedTypes":[],"Enum":null,"Scope":"","IsComponent":false,"Truncated":false,"Comments":{"Summary":"","Description":"Hydrates entities in relations when passed true","ExternalDocs":null,"ExtendedComments":{},"Deprecated":false,"DeprecationReplacement":"","DeprecationMessage":""},"Input":false,"Output":false,"Extensions":{},"Examples":[],"Format":"","Discriminator":null,"ComplexAny":false,"OutputLocation":"","ResolvedModel":"","EventStreamEnvelope":false,"ResponseEnvelope":false},"OriginalName":"","Type":"boolean","Discriminator":null,"Fields":[],"Validations":{"Minimum":null,"MaxItems":null,"MaxLength":null,"Maximum":null,"Pattern":null,"UniqueItems":null,"MinItems":null,"MinLength":null},"ResolvedModel":"","Input":false,"Scope":"","Comments":{"ExternalDocs":null,"ExtendedComments":{},"Deprecated":false,"DeprecationReplacement":"","DeprecationMessage":"","Summary":"","Description":"Hydrates entities in relations when passed true"},"Extensions":{},"ResponseEnvelope":false,"ContextStack":[],"Name":"","IsComponent":false,"Output":false,"Truncated":false,"EventStreamEnvelope":false,"Enum":null,"OutputLocation":"","AssociatedTypes":[],"Format":"","CircularReference":null} var hydrate *bool taxID := data.ID.ValueString() request := operations.GetTaxRequest{ @@ -189,12 +190,16 @@ func (r *TaxResource) Read(ctx context.Context, req resource.ReadRequest, resp * resp.Diagnostics.AddError("unexpected response from API", fmt.Sprintf("%v", res)) return } + if res.StatusCode == 404 { + resp.State.RemoveResource(ctx) + return + } if res.StatusCode != 200 { resp.Diagnostics.AddError(fmt.Sprintf("unexpected response from API. Got an unexpected response code %v", res.StatusCode), debugResponse(res.RawResponse)) return } - if res.Tax == nil { - resp.Diagnostics.AddError("unexpected response from API. No response body", debugResponse(res.RawResponse)) + if !(res.Tax != nil) { + resp.Diagnostics.AddError("unexpected response from API. Got an unexpected response body", debugResponse(res.RawResponse)) return } data.RefreshFromSharedTax(res.Tax) @@ -239,8 +244,8 @@ func (r *TaxResource) Update(ctx context.Context, req resource.UpdateRequest, re resp.Diagnostics.AddError(fmt.Sprintf("unexpected response from API. Got an unexpected response code %v", res.StatusCode), debugResponse(res.RawResponse)) return } - if res.Tax == nil { - resp.Diagnostics.AddError("unexpected response from API. No response body", debugResponse(res.RawResponse)) + if !(res.Tax != nil) { + resp.Diagnostics.AddError("unexpected response from API. Got an unexpected response body", debugResponse(res.RawResponse)) return } data.RefreshFromSharedTax(res.Tax) diff --git a/internal/provider/tax_resource_sdk.go b/internal/provider/tax_resource_sdk.go index c846086..c956903 100644 --- a/internal/provider/tax_resource_sdk.go +++ b/internal/provider/tax_resource_sdk.go @@ -1,9 +1,9 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasyapi.com). DO NOT EDIT. package provider import ( - "github.com/epilot-dev/terraform-provider-epilot-product/internal/sdk/pkg/models/shared" + "github.com/epilot-dev/terraform-provider-epilot-product/internal/sdk/models/shared" "github.com/hashicorp/terraform-plugin-framework/types" ) @@ -29,10 +29,12 @@ func (r *TaxResourceModel) ToSharedTaxCreate() *shared.TaxCreate { } func (r *TaxResourceModel) RefreshFromSharedTax(resp *shared.Tax) { - r.ID = types.StringValue(resp.ID) - r.Active = types.BoolValue(resp.Active) - r.Description = types.StringPointerValue(resp.Description) - r.Rate = types.StringValue(resp.Rate) - r.Region = types.StringValue(string(resp.Region)) - r.Type = types.StringValue(string(resp.Type)) + if resp != nil { + r.ID = types.StringValue(resp.ID) + r.Active = types.BoolValue(resp.Active) + r.Description = types.StringPointerValue(resp.Description) + r.Rate = types.StringValue(resp.Rate) + r.Region = types.StringValue(string(resp.Region)) + r.Type = types.StringValue(string(resp.Type)) + } } diff --git a/internal/provider/type_price_create_unit.go b/internal/provider/type_price_create_unit.go deleted file mode 100644 index 2f64ddb..0000000 --- a/internal/provider/type_price_create_unit.go +++ /dev/null @@ -1,10 +0,0 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. - -package provider - -import "github.com/hashicorp/terraform-plugin-framework/types" - -type PriceCreateUnit struct { - Str types.String `tfsdk:"str"` - One types.String `tfsdk:"one"` -} diff --git a/internal/provider/type_base_relation.go b/internal/provider/types/base_relation.go similarity index 54% rename from internal/provider/type_base_relation.go rename to internal/provider/types/base_relation.go index 3e9b4d9..df5cbd2 100644 --- a/internal/provider/type_base_relation.go +++ b/internal/provider/types/base_relation.go @@ -1,6 +1,6 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasyapi.com). DO NOT EDIT. -package provider +package types type BaseRelation struct { DollarRelation []DollarRelation `tfsdk:"dollar_relation"` diff --git a/internal/provider/type_dollar_relation.go b/internal/provider/types/dollar_relation.go similarity index 70% rename from internal/provider/type_dollar_relation.go rename to internal/provider/types/dollar_relation.go index 0f466cc..c09dffe 100644 --- a/internal/provider/type_dollar_relation.go +++ b/internal/provider/types/dollar_relation.go @@ -1,6 +1,6 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasyapi.com). DO NOT EDIT. -package provider +package types import "github.com/hashicorp/terraform-plugin-framework/types" diff --git a/internal/provider/types/price_component_relation.go b/internal/provider/types/price_component_relation.go new file mode 100644 index 0000000..a142609 --- /dev/null +++ b/internal/provider/types/price_component_relation.go @@ -0,0 +1,10 @@ +// Code generated by Speakeasy (https://speakeasyapi.com). DO NOT EDIT. + +package types + +import "github.com/hashicorp/terraform-plugin-framework/types" + +type PriceComponentRelation struct { + Tags []types.String `tfsdk:"tags"` + EntityID types.String `tfsdk:"entity_id"` +} diff --git a/internal/provider/types/price_create_price_components.go b/internal/provider/types/price_create_price_components.go new file mode 100644 index 0000000..a66236c --- /dev/null +++ b/internal/provider/types/price_create_price_components.go @@ -0,0 +1,7 @@ +// Code generated by Speakeasy (https://speakeasyapi.com). DO NOT EDIT. + +package types + +type PriceCreatePriceComponents struct { + DollarRelation []PriceComponentRelation `tfsdk:"dollar_relation"` +} diff --git a/internal/provider/type_price_tier.go b/internal/provider/types/price_tier.go similarity index 85% rename from internal/provider/type_price_tier.go rename to internal/provider/types/price_tier.go index 31ec88e..649d36b 100644 --- a/internal/provider/type_price_tier.go +++ b/internal/provider/types/price_tier.go @@ -1,6 +1,6 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasyapi.com). DO NOT EDIT. -package provider +package types import "github.com/hashicorp/terraform-plugin-framework/types" diff --git a/internal/provider/utils.go b/internal/provider/utils.go index 1b041e4..7def69e 100644 --- a/internal/provider/utils.go +++ b/internal/provider/utils.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasyapi.com). DO NOT EDIT. package provider @@ -11,13 +11,18 @@ import ( "github.com/hashicorp/terraform-plugin-framework/path" "github.com/hashicorp/terraform-plugin-framework/resource" "github.com/hashicorp/terraform-plugin-framework/types" - "github.com/hashicorp/terraform-plugin-framework/types/basetypes" "net/http" "net/http/httputil" "reflect" ) func debugResponse(response *http.Response) string { + if v := response.Request.Header.Get("Authorization"); v != "" { + response.Request.Header.Set("Authorization", "(sensitive)") + } + if v := response.Request.Header.Get("x-epilot-org-id"); v != "" { + response.Request.Header.Set("x-epilot-org-id", "(sensitive)") + } dumpReq, err := httputil.DumpRequest(response.Request, true) if err != nil { dumpReq, err = httputil.DumpRequest(response.Request, false) @@ -60,11 +65,15 @@ func merge(ctx context.Context, req resource.UpdateRequest, resp *resource.Updat if resp.Diagnostics.HasError() { return } - - resp.Diagnostics.Append(state.As(ctx, target, basetypes.ObjectAsOptions{ + val, err := state.ToTerraformValue(ctx) + if err != nil { + resp.Diagnostics.Append(diag.NewErrorDiagnostic("Object Conversion Error", "An unexpected error was encountered trying to convert object. This is always an error in the provider. Please report the following to the provider developer:\n\n"+err.Error())) + return + } + resp.Diagnostics.Append(tfReflect.Into(ctx, types.ObjectType{AttrTypes: state.AttributeTypes(ctx)}, val, target, tfReflect.Options{ UnhandledNullAsEmpty: true, UnhandledUnknownAsEmpty: true, - })...) + }, path.Empty())...) if resp.Diagnostics.HasError() { return } @@ -82,5 +91,6 @@ func refreshPlan(ctx context.Context, plan types.Object, target interface{}, dia diagnostics.Append(tfReflect.Into(ctx, obj, val, target, tfReflect.Options{ UnhandledNullAsEmpty: true, UnhandledUnknownAsEmpty: true, + SourceType: tfReflect.SourceTypePlan, }, path.Empty())...) } diff --git a/internal/sdk/.gitattributes b/internal/sdk/.gitattributes new file mode 100644 index 0000000..e6a9944 --- /dev/null +++ b/internal/sdk/.gitattributes @@ -0,0 +1,2 @@ +# This allows generated code to be indexed correctly +*.go linguist-generated=false \ No newline at end of file diff --git a/internal/sdk/.gitignore b/internal/sdk/.gitignore new file mode 100644 index 0000000..d3c2f59 --- /dev/null +++ b/internal/sdk/.gitignore @@ -0,0 +1 @@ +# .gitignore diff --git a/internal/sdk/CONTRIBUTING.md b/internal/sdk/CONTRIBUTING.md new file mode 100644 index 0000000..d585717 --- /dev/null +++ b/internal/sdk/CONTRIBUTING.md @@ -0,0 +1,26 @@ +# Contributing to This Repository + +Thank you for your interest in contributing to this repository. Please note that this repository contains generated code. As such, we do not accept direct changes or pull requests. Instead, we encourage you to follow the guidelines below to report issues and suggest improvements. + +## How to Report Issues + +If you encounter any bugs or have suggestions for improvements, please open an issue on GitHub. When reporting an issue, please provide as much detail as possible to help us reproduce the problem. This includes: + +- A clear and descriptive title +- Steps to reproduce the issue +- Expected and actual behavior +- Any relevant logs, screenshots, or error messages +- Information about your environment (e.g., operating system, software versions) + - For example can be collected using the `npx envinfo` command from your terminal if you have Node.js installed + +## Issue Triage and Upstream Fixes + +We will review and triage issues as quickly as possible. Our goal is to address bugs and incorporate improvements in the upstream source code. Fixes will be included in the next generation of the generated code. + +## Contact + +If you have any questions or need further assistance, please feel free to reach out by opening an issue. + +Thank you for your understanding and cooperation! + +The Maintainers diff --git a/internal/sdk/internal/hooks/hooks.go b/internal/sdk/internal/hooks/hooks.go new file mode 100644 index 0000000..b978f6b --- /dev/null +++ b/internal/sdk/internal/hooks/hooks.go @@ -0,0 +1,144 @@ +// Code generated by Speakeasy (https://speakeasyapi.com). DO NOT EDIT. + +package hooks + +import ( + "context" + "errors" + "net/http" +) + +type FailEarly struct { + Cause error +} + +var _ error = (*FailEarly)(nil) + +func (f *FailEarly) Error() string { + return f.Cause.Error() +} + +// HTTPClient provides an interface for supplying the SDK with a custom HTTP client +type HTTPClient interface { + Do(req *http.Request) (*http.Response, error) +} + +type HookContext struct { + Context context.Context + OperationID string + OAuth2Scopes []string + SecuritySource func(context.Context) (interface{}, error) +} + +type BeforeRequestContext struct { + HookContext +} + +type AfterSuccessContext struct { + HookContext +} + +type AfterErrorContext struct { + HookContext +} + +// sdkInitHook is called when the SDK is initializing. The hook can modify and return a new baseURL and HTTP client to be used by the SDK. +type sdkInitHook interface { + SDKInit(baseURL string, client HTTPClient) (string, HTTPClient) +} + +// beforeRequestHook is called before the SDK sends a request. The hook can modify the request before it is sent or return an error to stop the request from being sent. +type beforeRequestHook interface { + BeforeRequest(hookCtx BeforeRequestContext, req *http.Request) (*http.Request, error) +} + +// afterSuccessHook is called after the SDK receives a response. The hook can modify the response before it is handled or return an error to stop the response from being handled. +type afterSuccessHook interface { + AfterSuccess(hookCtx AfterSuccessContext, res *http.Response) (*http.Response, error) +} + +// afterErrorHook is called after the SDK encounters an error, or a non-successful response. The hook can modify the response if available otherwise modify the error. +// All afterErrorHook hooks are called and returning an error won't stop the other hooks from being called. But if you want to stop the other hooks from being called, you can return a FailEarly error wrapping your error. +type afterErrorHook interface { + AfterError(hookCtx AfterErrorContext, res *http.Response, err error) (*http.Response, error) +} + +type Hooks struct { + sdkInitHooks []sdkInitHook + beforeRequestHook []beforeRequestHook + afterSuccessHook []afterSuccessHook + afterErrorHook []afterErrorHook +} + +func New() *Hooks { + h := &Hooks{ + sdkInitHooks: []sdkInitHook{}, + beforeRequestHook: []beforeRequestHook{}, + afterSuccessHook: []afterSuccessHook{}, + afterErrorHook: []afterErrorHook{}, + } + + initHooks(h) + + return h +} + +// registerSDKInitHook registers a hook to be used by the SDK for the initialization event. +func (h *Hooks) registerSDKInitHook(hook sdkInitHook) { + h.sdkInitHooks = append(h.sdkInitHooks, hook) +} + +// registerBeforeRequestHook registers a hook to be used by the SDK for the before request event. +func (h *Hooks) registerBeforeRequestHook(hook beforeRequestHook) { + h.beforeRequestHook = append(h.beforeRequestHook, hook) +} + +// registerAfterSuccessHook registers a hook to be used by the SDK for the after success event. +func (h *Hooks) registerAfterSuccessHook(hook afterSuccessHook) { + h.afterSuccessHook = append(h.afterSuccessHook, hook) +} + +// registerAfterErrorHook registers a hook to be used by the SDK for the after error event. +func (h *Hooks) registerAfterErrorHook(hook afterErrorHook) { + h.afterErrorHook = append(h.afterErrorHook, hook) +} + +func (h *Hooks) SDKInit(baseURL string, client HTTPClient) (string, HTTPClient) { + for _, hook := range h.sdkInitHooks { + baseURL, client = hook.SDKInit(baseURL, client) + } + return baseURL, client +} + +func (h *Hooks) BeforeRequest(hookCtx BeforeRequestContext, req *http.Request) (*http.Request, error) { + for _, hook := range h.beforeRequestHook { + var err error + req, err = hook.BeforeRequest(hookCtx, req) + if err != nil { + return req, err + } + } + return req, nil +} + +func (h *Hooks) AfterSuccess(hookCtx AfterSuccessContext, res *http.Response) (*http.Response, error) { + for _, hook := range h.afterSuccessHook { + var err error + res, err = hook.AfterSuccess(hookCtx, res) + if err != nil { + return res, err + } + } + return res, nil +} + +func (h *Hooks) AfterError(hookCtx AfterErrorContext, res *http.Response, err error) (*http.Response, error) { + for _, hook := range h.afterErrorHook { + res, err = hook.AfterError(hookCtx, res, err) + var fe *FailEarly + if errors.As(err, &fe) { + return nil, fe.Cause + } + } + return res, err +} diff --git a/internal/sdk/internal/hooks/registration.go b/internal/sdk/internal/hooks/registration.go new file mode 100644 index 0000000..99a3606 --- /dev/null +++ b/internal/sdk/internal/hooks/registration.go @@ -0,0 +1,15 @@ +// Code generated by Speakeasy (https://speakeasyapi.com). DO NOT EDIT. + +package hooks + +/* + * This file is only ever generated once on the first generation and then is free to be modified. + * Any hooks you wish to add should be registered in the InitHooks function. Feel free to define them + * in this file or in separate files in the hooks package. + */ + +func initHooks(h *Hooks) { + // Add hooks by calling h.register{SDKInit/BeforeRequest/AfterSuccess/AfterError}Hook + // with an instance of a hook that implements that specific Hook interface + // Hooks are registered per SDK instance, and are valid for the lifetime of the SDK instance +} diff --git a/internal/sdk/pkg/utils/contenttype.go b/internal/sdk/internal/utils/contenttype.go similarity index 80% rename from internal/sdk/pkg/utils/contenttype.go rename to internal/sdk/internal/utils/contenttype.go index 8ed13e2..81e669d 100644 --- a/internal/sdk/pkg/utils/contenttype.go +++ b/internal/sdk/internal/utils/contenttype.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasyapi.com). DO NOT EDIT. package utils @@ -9,6 +9,10 @@ import ( ) func MatchContentType(contentType string, pattern string) bool { + if contentType == "" { + contentType = "application/octet-stream" + } + if contentType == pattern || pattern == "*" || pattern == "*/*" { return true } diff --git a/internal/sdk/pkg/utils/form.go b/internal/sdk/internal/utils/form.go similarity index 97% rename from internal/sdk/pkg/utils/form.go rename to internal/sdk/internal/utils/form.go index 5a21417..3ced4c3 100644 --- a/internal/sdk/pkg/utils/form.go +++ b/internal/sdk/internal/utils/form.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasyapi.com). DO NOT EDIT. package utils @@ -12,7 +12,7 @@ import ( "github.com/ericlagergren/decimal" - "github.com/epilot-dev/terraform-provider-epilot-product/internal/sdk/pkg/types" + "github.com/epilot-dev/terraform-provider-epilot-product/internal/sdk/types" ) func populateForm(paramName string, explode bool, objType reflect.Type, objValue reflect.Value, delimiter string, getFieldName func(reflect.StructField) string) url.Values { diff --git a/internal/sdk/pkg/utils/headers.go b/internal/sdk/internal/utils/headers.go similarity index 66% rename from internal/sdk/pkg/utils/headers.go rename to internal/sdk/internal/utils/headers.go index 0837022..7af15f9 100644 --- a/internal/sdk/pkg/utils/headers.go +++ b/internal/sdk/internal/utils/headers.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasyapi.com). DO NOT EDIT. package utils @@ -10,14 +10,34 @@ import ( "strings" ) -func PopulateHeaders(ctx context.Context, req *http.Request, headers interface{}) { - headerParamsStructType := reflect.TypeOf(headers) - headerParamsValType := reflect.ValueOf(headers) +func PopulateHeaders(_ context.Context, req *http.Request, headers interface{}, globals interface{}) { + globalsAlreadyPopulated := populateHeaders(headers, globals, req.Header, []string{}) + if globals != nil { + _ = populateHeaders(globals, nil, req.Header, globalsAlreadyPopulated) + } +} + +func populateHeaders(headers interface{}, globals interface{}, reqHeaders http.Header, skipFields []string) []string { + headerParamsStructType, headerParamsValType := dereferencePointers(reflect.TypeOf(headers), reflect.ValueOf(headers)) + + globalsAlreadyPopulated := []string{} for i := 0; i < headerParamsStructType.NumField(); i++ { fieldType := headerParamsStructType.Field(i) valType := headerParamsValType.Field(i) + if contains(skipFields, fieldType.Name) { + continue + } + + if globals != nil { + var globalFound bool + fieldType, valType, globalFound = populateFromGlobals(fieldType, valType, headerParamTagKey, globals) + if globalFound { + globalsAlreadyPopulated = append(globalsAlreadyPopulated, fieldType.Name) + } + } + tag := parseParamTag(headerParamTagKey, fieldType, "simple", false) if tag == nil { continue @@ -25,9 +45,11 @@ func PopulateHeaders(ctx context.Context, req *http.Request, headers interface{} value := serializeHeader(fieldType.Type, valType, tag.Explode) if value != "" { - req.Header.Add(tag.ParamName, value) + reqHeaders.Add(tag.ParamName, value) } } + + return globalsAlreadyPopulated } func serializeHeader(objType reflect.Type, objValue reflect.Value, explode bool) string { diff --git a/internal/sdk/pkg/utils/json.go b/internal/sdk/internal/utils/json.go similarity index 88% rename from internal/sdk/pkg/utils/json.go rename to internal/sdk/internal/utils/json.go index d2c92c3..858456c 100644 --- a/internal/sdk/pkg/utils/json.go +++ b/internal/sdk/internal/utils/json.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasyapi.com). DO NOT EDIT. package utils @@ -8,11 +8,12 @@ import ( "fmt" "math/big" "reflect" + "strconv" "strings" "time" "unsafe" - "github.com/epilot-dev/terraform-provider-epilot-product/internal/sdk/pkg/types" + "github.com/epilot-dev/terraform-provider-epilot-product/internal/sdk/types" "github.com/ericlagergren/decimal" ) @@ -260,6 +261,18 @@ func marshalValue(v interface{}, tag reflect.StructTag) (json.RawMessage, error) typ, val := dereferencePointers(reflect.TypeOf(v), reflect.ValueOf(v)) switch typ.Kind() { + case reflect.Int64: + format := tag.Get("integer") + if format == "string" { + b := val.Interface().(int64) + return []byte(fmt.Sprintf(`"%d"`, b)), nil + } + case reflect.Float64: + format := tag.Get("number") + if format == "string" { + b := val.Interface().(float64) + return []byte(fmt.Sprintf(`"%g"`, b)), nil + } case reflect.Map: if isNil(typ, val) { return []byte("null"), nil @@ -349,6 +362,16 @@ func handleDefaultConstValue(tagValue string, val interface{}, tag reflect.Struc if bigIntTag == "string" { return []byte(fmt.Sprintf(`"%s"`, tagValue)) } + case reflect.TypeOf(int64(0)): + format := tag.Get("integer") + if format == "string" { + return []byte(fmt.Sprintf(`"%s"`, tagValue)) + } + case reflect.TypeOf(float64(0)): + format := tag.Get("number") + if format == "string" { + return []byte(fmt.Sprintf(`"%s"`, tagValue)) + } case reflect.TypeOf(decimal.Big{}): decimalTag := tag.Get("decimal") if decimalTag != "number" { @@ -358,7 +381,7 @@ func handleDefaultConstValue(tagValue string, val interface{}, tag reflect.Struc return []byte(fmt.Sprintf(`"%s"`, tagValue)) default: if typ.Kind() == reflect.String { - return []byte(fmt.Sprintf(`"%s"`, tagValue)) + return []byte(fmt.Sprintf("%q", tagValue)) } } @@ -377,6 +400,57 @@ func unmarshalValue(value json.RawMessage, v reflect.Value, tag reflect.StructTa typ := dereferenceTypePointer(v.Type()) switch typ.Kind() { + case reflect.Int64: + var b int64 + + format := tag.Get("integer") + if format == "string" { + var s string + if err := json.Unmarshal(value, &s); err != nil { + return err + } + + var err error + b, err = strconv.ParseInt(s, 10, 64) + if err != nil { + return fmt.Errorf("failed to parse string as int64: %w", err) + } + if v.Kind() == reflect.Ptr { + if v.IsNil() { + v.Set(reflect.New(typ)) + } + v = v.Elem() + } + + v.Set(reflect.ValueOf(b)) + return nil + } + case reflect.Float64: + var b float64 + + format := tag.Get("number") + if format == "string" { + var s string + if err := json.Unmarshal(value, &s); err != nil { + return err + } + + var err error + b, err = strconv.ParseFloat(s, 64) + if err != nil { + return fmt.Errorf("failed to parse string as float64: %w", err) + } + + if v.Kind() == reflect.Ptr { + if v.IsNil() { + v.Set(reflect.New(typ)) + } + v = v.Elem() + } + + v.Set(reflect.ValueOf(b)) + return nil + } case reflect.Map: if bytes.Equal(value, []byte("null")) || !isComplexValueType(dereferenceTypePointer(typ.Elem())) { if v.CanAddr() { diff --git a/internal/sdk/pkg/utils/pathparams.go b/internal/sdk/internal/utils/pathparams.go similarity index 69% rename from internal/sdk/pkg/utils/pathparams.go rename to internal/sdk/internal/utils/pathparams.go index a466258..3f88da3 100644 --- a/internal/sdk/pkg/utils/pathparams.go +++ b/internal/sdk/internal/utils/pathparams.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasyapi.com). DO NOT EDIT. package utils @@ -13,21 +13,43 @@ import ( "github.com/ericlagergren/decimal" - "github.com/epilot-dev/terraform-provider-epilot-product/internal/sdk/pkg/types" + "github.com/epilot-dev/terraform-provider-epilot-product/internal/sdk/types" ) -func GenerateURL(ctx context.Context, serverURL, path string, pathParams interface{}, globals map[string]map[string]map[string]interface{}) (string, error) { +func GenerateURL(_ context.Context, serverURL, path string, pathParams interface{}, globals interface{}) (string, error) { uri := strings.TrimSuffix(serverURL, "/") + path - pathParamsStructType := reflect.TypeOf(pathParams) - pathParamsValType := reflect.ValueOf(pathParams) - parsedParameters := map[string]string{} + globalsAlreadyPopulated, err := populateParsedParameters(pathParams, globals, parsedParameters, []string{}) + if err != nil { + return "", err + } + + if globals != nil { + _, err = populateParsedParameters(globals, nil, parsedParameters, globalsAlreadyPopulated) + if err != nil { + return "", err + } + } + + // TODO should we handle the case where there are no matching path params? + return ReplaceParameters(uri, parsedParameters), nil +} + +func populateParsedParameters(pathParams interface{}, globals interface{}, parsedParameters map[string]string, skipFields []string) ([]string, error) { + pathParamsStructType, pathParamsValType := dereferencePointers(reflect.TypeOf(pathParams), reflect.ValueOf(pathParams)) + + globalsAlreadyPopulated := []string{} + for i := 0; i < pathParamsStructType.NumField(); i++ { fieldType := pathParamsStructType.Field(i) valType := pathParamsValType.Field(i) + if contains(skipFields, fieldType.Name) { + continue + } + requestTag := getRequestTag(fieldType) if requestTag != nil { continue @@ -38,12 +60,18 @@ func GenerateURL(ctx context.Context, serverURL, path string, pathParams interfa continue } - valType = populateFromGlobals(fieldType, valType, "pathParam", globals) + if globals != nil { + var globalFound bool + fieldType, valType, globalFound = populateFromGlobals(fieldType, valType, pathParamTagKey, globals) + if globalFound { + globalsAlreadyPopulated = append(globalsAlreadyPopulated, fieldType.Name) + } + } if ppTag.Serialization != "" { vals, err := populateSerializedParams(ppTag, fieldType.Type, valType) if err != nil { - return "", err + return nil, err } for k, v := range vals { parsedParameters[k] = url.PathEscape(v) @@ -52,7 +80,7 @@ func GenerateURL(ctx context.Context, serverURL, path string, pathParams interfa // TODO: support other styles switch ppTag.Style { case "simple": - simpleParams := getSimplePathParams(ctx, ppTag.ParamName, fieldType.Type, valType, ppTag.Explode) + simpleParams := getSimplePathParams(ppTag.ParamName, fieldType.Type, valType, ppTag.Explode) for k, v := range simpleParams { parsedParameters[k] = v } @@ -60,11 +88,10 @@ func GenerateURL(ctx context.Context, serverURL, path string, pathParams interfa } } - // TODO should we handle the case where there are no matching path params? - return ReplaceParameters(uri, parsedParameters), nil + return globalsAlreadyPopulated, nil } -func getSimplePathParams(ctx context.Context, parentName string, objType reflect.Type, objValue reflect.Value, explode bool) map[string]string { +func getSimplePathParams(parentName string, objType reflect.Type, objValue reflect.Value, explode bool) map[string]string { pathParams := make(map[string]string) if isNil(objType, objValue) { diff --git a/internal/sdk/internal/utils/queryparams.go b/internal/sdk/internal/utils/queryparams.go new file mode 100644 index 0000000..af22d47 --- /dev/null +++ b/internal/sdk/internal/utils/queryparams.go @@ -0,0 +1,259 @@ +// Code generated by Speakeasy (https://speakeasyapi.com). DO NOT EDIT. + +package utils + +import ( + "context" + "encoding/json" + "fmt" + "math/big" + "net/http" + "net/url" + "reflect" + "time" + + "github.com/ericlagergren/decimal" + + "github.com/epilot-dev/terraform-provider-epilot-product/internal/sdk/types" +) + +func PopulateQueryParams(_ context.Context, req *http.Request, queryParams interface{}, globals interface{}) error { + // Query parameters may already be present from overriding URL + if req.URL.RawQuery != "" { + return nil + } + + values := url.Values{} + + globalsAlreadyPopulated, err := populateQueryParams(queryParams, globals, values, []string{}) + if err != nil { + return err + } + + if globals != nil { + _, err = populateQueryParams(globals, nil, values, globalsAlreadyPopulated) + if err != nil { + return err + } + } + + req.URL.RawQuery = values.Encode() + + return nil +} + +func populateQueryParams(queryParams interface{}, globals interface{}, values url.Values, skipFields []string) ([]string, error) { + queryParamsStructType, queryParamsValType := dereferencePointers(reflect.TypeOf(queryParams), reflect.ValueOf(queryParams)) + + globalsAlreadyPopulated := []string{} + + for i := 0; i < queryParamsStructType.NumField(); i++ { + fieldType := queryParamsStructType.Field(i) + valType := queryParamsValType.Field(i) + + if contains(skipFields, fieldType.Name) { + continue + } + + requestTag := getRequestTag(fieldType) + if requestTag != nil { + continue + } + + qpTag := parseQueryParamTag(fieldType) + if qpTag == nil { + continue + } + + if globals != nil { + var globalFound bool + fieldType, valType, globalFound = populateFromGlobals(fieldType, valType, queryParamTagKey, globals) + if globalFound { + globalsAlreadyPopulated = append(globalsAlreadyPopulated, fieldType.Name) + } + } + + if qpTag.Serialization != "" { + vals, err := populateSerializedParams(qpTag, fieldType.Type, valType) + if err != nil { + return nil, err + } + for k, v := range vals { + values.Add(k, v) + } + } else { + switch qpTag.Style { + case "deepObject": + vals := populateDeepObjectParams(qpTag, fieldType.Type, valType) + for k, v := range vals { + for _, vv := range v { + values.Add(k, vv) + } + } + case "form": + vals := populateFormParams(qpTag, fieldType.Type, valType, ",") + for k, v := range vals { + for _, vv := range v { + values.Add(k, vv) + } + } + case "pipeDelimited": + vals := populateFormParams(qpTag, fieldType.Type, valType, "|") + for k, v := range vals { + for _, vv := range v { + values.Add(k, vv) + } + } + default: + return nil, fmt.Errorf("unsupported style: %s", qpTag.Style) + } + } + } + + return globalsAlreadyPopulated, nil +} + +func populateSerializedParams(tag *paramTag, objType reflect.Type, objValue reflect.Value) (map[string]string, error) { + if isNil(objType, objValue) { + return nil, nil + } + + if objType.Kind() == reflect.Pointer { + objValue = objValue.Elem() + } + + values := map[string]string{} + + switch tag.Serialization { + case "json": + data, err := json.Marshal(objValue.Interface()) + if err != nil { + return nil, fmt.Errorf("error marshaling json: %v", err) + } + values[tag.ParamName] = string(data) + } + + return values, nil +} + +func populateDeepObjectParams(tag *paramTag, objType reflect.Type, objValue reflect.Value) url.Values { + values := url.Values{} + + if isNil(objType, objValue) { + return values + } + + if objValue.Kind() == reflect.Pointer { + objValue = objValue.Elem() + } + + switch objValue.Kind() { + case reflect.Map: + populateDeepObjectParamsMap(values, tag.ParamName, objValue) + case reflect.Struct: + populateDeepObjectParamsStruct(values, tag.ParamName, objValue) + } + + return values +} + +func populateDeepObjectParamsArray(qsValues url.Values, priorScope string, value reflect.Value) { + if value.Kind() != reflect.Array && value.Kind() != reflect.Slice { + return + } + + for i := 0; i < value.Len(); i++ { + qsValues.Add(priorScope, valToString(value.Index(i).Interface())) + } +} + +func populateDeepObjectParamsMap(qsValues url.Values, priorScope string, mapValue reflect.Value) { + if mapValue.Kind() != reflect.Map { + return + } + + iter := mapValue.MapRange() + + for iter.Next() { + scope := priorScope + "[" + iter.Key().String() + "]" + iterValue := iter.Value() + + switch iterValue.Kind() { + case reflect.Array, reflect.Slice: + populateDeepObjectParamsArray(qsValues, scope, iterValue) + case reflect.Map: + populateDeepObjectParamsMap(qsValues, scope, iterValue) + default: + qsValues.Add(scope, valToString(iterValue.Interface())) + } + } +} + +func populateDeepObjectParamsStruct(qsValues url.Values, priorScope string, structValue reflect.Value) { + if structValue.Kind() != reflect.Struct { + return + } + + structType := structValue.Type() + + for i := 0; i < structType.NumField(); i++ { + field := structType.Field(i) + fieldValue := structValue.Field(i) + + if isNil(field.Type, fieldValue) { + continue + } + + if fieldValue.Kind() == reflect.Pointer { + fieldValue = fieldValue.Elem() + } + + qpTag := parseQueryParamTag(field) + + if qpTag == nil { + continue + } + + scope := priorScope + "[" + qpTag.ParamName + "]" + + switch fieldValue.Kind() { + case reflect.Array, reflect.Slice: + populateDeepObjectParamsArray(qsValues, scope, fieldValue) + case reflect.Map: + populateDeepObjectParamsMap(qsValues, scope, fieldValue) + case reflect.Struct: + switch fieldValue.Type() { + case reflect.TypeOf(big.Int{}), reflect.TypeOf(decimal.Big{}), reflect.TypeOf(time.Time{}), reflect.TypeOf(types.Date{}): + qsValues.Add(scope, valToString(fieldValue.Interface())) + + continue + } + + populateDeepObjectParamsStruct(qsValues, scope, fieldValue) + default: + qsValues.Add(scope, valToString(fieldValue.Interface())) + } + } +} + +func populateFormParams(tag *paramTag, objType reflect.Type, objValue reflect.Value, delimiter string) url.Values { + return populateForm(tag.ParamName, tag.Explode, objType, objValue, delimiter, func(fieldType reflect.StructField) string { + qpTag := parseQueryParamTag(fieldType) + if qpTag == nil { + return "" + } + + return qpTag.ParamName + }) +} + +type paramTag struct { + Style string + Explode bool + ParamName string + Serialization string +} + +func parseQueryParamTag(field reflect.StructField) *paramTag { + return parseParamTag(queryParamTagKey, field, "form", true) +} diff --git a/internal/sdk/pkg/utils/requestbody.go b/internal/sdk/internal/utils/requestbody.go similarity index 92% rename from internal/sdk/pkg/utils/requestbody.go rename to internal/sdk/internal/utils/requestbody.go index 950f39a..b4e2b8b 100644 --- a/internal/sdk/pkg/utils/requestbody.go +++ b/internal/sdk/internal/utils/requestbody.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasyapi.com). DO NOT EDIT. package utils @@ -25,7 +25,20 @@ var ( urlEncodedEncodingRegex = regexp.MustCompile(`application\/x-www-form-urlencoded.*`) ) -func SerializeRequestBody(ctx context.Context, request interface{}, nullable, optional bool, requestFieldName, serializationMethod, tag string) (io.Reader, string, error) { +func SerializeRequestBody(_ context.Context, request interface{}, nullable, optional bool, requestFieldName, serializationMethod, tag string) (io.Reader, string, error) { + bodyReader, contentType, err := serializeRequestBody(request, nullable, optional, requestFieldName, serializationMethod, tag) + if err != nil { + return nil, "", fmt.Errorf("error serializing request body: %w", err) + } + + if bodyReader == nil && !optional { + return nil, "", fmt.Errorf("request body is required") + } + + return bodyReader, contentType, nil +} + +func serializeRequestBody(request interface{}, nullable, optional bool, requestFieldName, serializationMethod, tag string) (io.Reader, string, error) { requestStructType := reflect.TypeOf(request) requestValType := reflect.ValueOf(request) diff --git a/internal/sdk/pkg/utils/retries.go b/internal/sdk/internal/utils/retries.go similarity index 85% rename from internal/sdk/pkg/utils/retries.go rename to internal/sdk/internal/utils/retries.go index ff39d0d..73b3f90 100644 --- a/internal/sdk/pkg/utils/retries.go +++ b/internal/sdk/internal/utils/retries.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasyapi.com). DO NOT EDIT. package utils @@ -6,32 +6,25 @@ import ( "context" "errors" "fmt" + "github.com/cenkalti/backoff/v4" + "github.com/epilot-dev/terraform-provider-epilot-product/internal/sdk/retry" "net/http" "net/url" "strconv" "strings" "time" - - "github.com/cenkalti/backoff/v4" ) var errRequestFailed = errors.New("request failed") -type BackoffStrategy struct { - InitialInterval int - MaxInterval int - Exponent float64 - MaxElapsedTime int -} +// Deprecated: Use retry.BackoffStrategy instead. +type BackoffStrategy = retry.BackoffStrategy -type RetryConfig struct { - Strategy string - Backoff *BackoffStrategy - RetryConnectionErrors bool -} +// Deprecated: Use retry.Config instead. +type RetryConfig = retry.Config type Retries struct { - Config *RetryConfig + Config *retry.Config StatusCodes []string } diff --git a/internal/sdk/pkg/utils/security.go b/internal/sdk/internal/utils/security.go similarity index 63% rename from internal/sdk/pkg/utils/security.go rename to internal/sdk/internal/utils/security.go index fa5eff7..ace81f7 100644 --- a/internal/sdk/pkg/utils/security.go +++ b/internal/sdk/internal/utils/security.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasyapi.com). DO NOT EDIT. package utils @@ -11,10 +11,6 @@ import ( "strings" ) -type HTTPClient interface { - Do(req *http.Request) (*http.Response, error) -} - const ( securityTagKey = "security" ) @@ -27,73 +23,24 @@ type securityTag struct { SubType string } -type securityConfig struct { - headers map[string]string - queryParams map[string]string -} - -type SecurityClient struct { - HTTPClient - security func(ctx context.Context) (interface{}, error) -} - -func newSecurityClient(client HTTPClient, security func(ctx context.Context) (interface{}, error)) *SecurityClient { - return &SecurityClient{ - HTTPClient: client, - security: security, +func PopulateSecurity(ctx context.Context, req *http.Request, securitySource func(context.Context) (interface{}, error)) error { + if securitySource == nil { + return nil } -} -func (c *SecurityClient) Do(req *http.Request) (*http.Response, error) { - securityCtx, err := c.security(req.Context()) + security, err := securitySource(ctx) if err != nil { - return nil, err - } - - ctx := securityConfig{ - headers: make(map[string]string), - queryParams: make(map[string]string), - } - parseSecurityStruct(&ctx, securityCtx) - - for k, v := range ctx.headers { - req.Header.Set(k, v) - } - - queryParams := req.URL.Query() - - for k, v := range ctx.queryParams { - queryParams.Add(k, v) + return err } - req.URL.RawQuery = queryParams.Encode() - - return c.HTTPClient.Do(req) -} - -func ConfigureSecurityClient(c HTTPClient, security func(ctx context.Context) (interface{}, error)) *SecurityClient { - return newSecurityClient(c, security) -} - -func trueReflectValue(val reflect.Value) reflect.Value { - kind := val.Type().Kind() - for kind == reflect.Interface || kind == reflect.Ptr { - innerVal := val.Elem() - if !innerVal.IsValid() { - break - } - val = innerVal - kind = val.Type().Kind() - } - return val -} + headers := make(map[string]string) + queryParams := make(map[string]string) -func parseSecurityStruct(c *securityConfig, security interface{}) { securityValType := trueReflectValue(reflect.ValueOf(security)) securityStructType := securityValType.Type() if isNil(securityStructType, securityValType) { - return + return nil } if securityStructType.Kind() == reflect.Ptr { @@ -118,25 +65,37 @@ func parseSecurityStruct(c *securityConfig, security interface{}) { secTag := parseSecurityTag(fieldType) if secTag != nil { if secTag.Option { - handleSecurityOption(c, valType.Interface()) + handleSecurityOption(headers, queryParams, valType.Interface()) } else if secTag.Scheme { // Special case for basic auth which could be a flattened struct if secTag.SubType == "basic" && kind != reflect.Struct { - parseSecurityScheme(c, secTag, security) + parseSecurityScheme(headers, queryParams, secTag, security) } else { - parseSecurityScheme(c, secTag, valType.Interface()) + parseSecurityScheme(headers, queryParams, secTag, valType.Interface()) } } } } + + for key, value := range headers { + req.Header.Add(key, value) + } + + query := req.URL.Query() + for key, value := range queryParams { + query.Add(key, value) + } + req.URL.RawQuery = query.Encode() + + return nil } -func handleSecurityOption(c *securityConfig, option interface{}) error { +func handleSecurityOption(headers, queryParams map[string]string, option interface{}) { optionValType := trueReflectValue(reflect.ValueOf(option)) optionStructType := optionValType.Type() if isNil(optionStructType, optionValType) { - return nil + return } for i := 0; i < optionStructType.NumField(); i++ { @@ -145,14 +104,12 @@ func handleSecurityOption(c *securityConfig, option interface{}) error { secTag := parseSecurityTag(fieldType) if secTag != nil && secTag.Scheme { - parseSecurityScheme(c, secTag, valType.Interface()) + parseSecurityScheme(headers, queryParams, secTag, valType.Interface()) } } - - return nil } -func parseSecurityScheme(client *securityConfig, schemeTag *securityTag, scheme interface{}) { +func parseSecurityScheme(headers, queryParams map[string]string, schemeTag *securityTag, scheme interface{}) { schemeVal := trueReflectValue(reflect.ValueOf(scheme)) schemeType := schemeVal.Type() @@ -162,7 +119,7 @@ func parseSecurityScheme(client *securityConfig, schemeTag *securityTag, scheme if schemeType.Kind() == reflect.Struct { if schemeTag.Type == "http" && schemeTag.SubType == "basic" { - handleBasicAuthScheme(client, schemeVal.Interface()) + handleBasicAuthScheme(headers, schemeVal.Interface()) return } @@ -183,34 +140,36 @@ func parseSecurityScheme(client *securityConfig, schemeTag *securityTag, scheme return } - parseSecuritySchemeValue(client, schemeTag, secTag, valType.Interface()) + parseSecuritySchemeValue(headers, queryParams, schemeTag, secTag, valType.Interface()) } } else { - parseSecuritySchemeValue(client, schemeTag, schemeTag, schemeVal.Interface()) + parseSecuritySchemeValue(headers, queryParams, schemeTag, schemeTag, schemeVal.Interface()) } } -func parseSecuritySchemeValue(client *securityConfig, schemeTag *securityTag, secTag *securityTag, val interface{}) { +func parseSecuritySchemeValue(headers, queryParams map[string]string, schemeTag *securityTag, secTag *securityTag, val interface{}) { switch schemeTag.Type { case "apiKey": switch schemeTag.SubType { case "header": - client.headers[secTag.Name] = valToString(val) + headers[secTag.Name] = valToString(val) case "query": - client.queryParams[secTag.Name] = valToString(val) + queryParams[secTag.Name] = valToString(val) case "cookie": - client.headers["Cookie"] = fmt.Sprintf("%s=%s", secTag.Name, valToString(val)) + headers["Cookie"] = fmt.Sprintf("%s=%s", secTag.Name, valToString(val)) default: panic("not supported") } case "openIdConnect": - client.headers[secTag.Name] = valToString(val) + headers[secTag.Name] = prefixBearer(valToString(val)) case "oauth2": - client.headers[secTag.Name] = valToString(val) + if schemeTag.SubType != "client_credentials" { + headers[secTag.Name] = prefixBearer(valToString(val)) + } case "http": switch schemeTag.SubType { case "bearer": - client.headers[secTag.Name] = prefixBearer(valToString(val)) + headers[secTag.Name] = prefixBearer(valToString(val)) default: panic("not supported") } @@ -227,7 +186,7 @@ func prefixBearer(authHeaderValue string) string { return fmt.Sprintf("Bearer %s", authHeaderValue) } -func handleBasicAuthScheme(client *securityConfig, scheme interface{}) { +func handleBasicAuthScheme(headers map[string]string, scheme interface{}) { schemeStructType := reflect.TypeOf(scheme) schemeValType := reflect.ValueOf(scheme) @@ -237,6 +196,10 @@ func handleBasicAuthScheme(client *securityConfig, scheme interface{}) { fieldType := schemeStructType.Field(i) valType := schemeValType.Field(i) + if fieldType.Type.Kind() == reflect.Ptr { + valType = valType.Elem() + } + secTag := parseSecurityTag(fieldType) if secTag == nil || secTag.Name == "" { continue @@ -250,7 +213,7 @@ func handleBasicAuthScheme(client *securityConfig, scheme interface{}) { } } - client.headers["Authorization"] = fmt.Sprintf("Basic %s", base64.StdEncoding.EncodeToString([]byte(fmt.Sprintf("%s:%s", username, password)))) + headers["Authorization"] = fmt.Sprintf("Basic %s", base64.StdEncoding.EncodeToString([]byte(fmt.Sprintf("%s:%s", username, password)))) } func parseSecurityTag(field reflect.StructField) *securityTag { @@ -296,3 +259,16 @@ func parseSecurityTag(field reflect.StructField) *securityTag { SubType: securitySubType, } } + +func trueReflectValue(val reflect.Value) reflect.Value { + kind := val.Type().Kind() + for kind == reflect.Interface || kind == reflect.Ptr { + innerVal := val.Elem() + if !innerVal.IsValid() { + break + } + val = innerVal + kind = val.Type().Kind() + } + return val +} diff --git a/internal/sdk/pkg/utils/utils.go b/internal/sdk/internal/utils/utils.go similarity index 60% rename from internal/sdk/pkg/utils/utils.go rename to internal/sdk/internal/utils/utils.go index 8c8161a..50482f2 100644 --- a/internal/sdk/pkg/utils/utils.go +++ b/internal/sdk/internal/utils/utils.go @@ -1,13 +1,15 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasyapi.com). DO NOT EDIT. package utils import ( + "context" "fmt" "io" "math/big" "reflect" "regexp" + "strconv" "strings" "time" @@ -63,6 +65,35 @@ func Contains(slice []string, item string) bool { return false } +func MatchStatusCodes(expectedCodes []string, statusCode int) bool { + for _, codeStr := range expectedCodes { + code, err := strconv.Atoi(codeStr) + if err == nil { + if code == statusCode { + return true + } + continue + } + + codeRange, err := strconv.Atoi(string(codeStr[0])) + if err != nil { + continue + } + + if statusCode >= (codeRange*100) && statusCode < ((codeRange+1)*100) { + return true + } + } + + return false +} + +func AsSecuritySource(security interface{}) func(context.Context) (interface{}, error) { + return func(context.Context) (interface{}, error) { + return security, nil + } +} + func parseStructTag(tagKey string, field reflect.StructField) map[string]string { tag := field.Tag.Get(tagKey) if tag == "" { @@ -134,29 +165,66 @@ func valToString(val interface{}) string { } } -func populateFromGlobals(fieldType reflect.StructField, valType reflect.Value, paramType string, globals map[string]map[string]map[string]interface{}) reflect.Value { - if globals != nil && fieldType.Type.Kind() == reflect.Ptr { - parameters, ok := globals["parameters"] - if ok { - paramsOfType, ok := parameters[paramType] - if ok { - globalVal, ok := paramsOfType[fieldType.Name] - if ok { - if reflect.TypeOf(globalVal).Kind() == fieldType.Type.Elem().Kind() && valType.IsNil() { - valType = reflect.ValueOf(&globalVal) - } - } - } +func populateFromGlobals(fieldType reflect.StructField, valType reflect.Value, paramType string, globals interface{}) (reflect.StructField, reflect.Value, bool) { + if globals == nil { + return fieldType, valType, false + } + + globalsStruct := reflect.TypeOf(globals) + globalsStructVal := reflect.ValueOf(globals) + + globalsField, found := globalsStruct.FieldByName(fieldType.Name) + if !found { + return fieldType, valType, false + } + + if fieldType.Type.Kind() != reflect.Ptr || !valType.IsNil() { + return fieldType, valType, true + } + + globalsVal := globalsStructVal.FieldByName(fieldType.Name) + + if !globalsVal.IsValid() { + return fieldType, valType, false + } + + switch paramType { + case queryParamTagKey: + qpTag := parseQueryParamTag(globalsField) + if qpTag == nil { + return fieldType, valType, false + } + default: + tag := parseParamTag(paramType, fieldType, "simple", false) + if tag == nil { + return fieldType, valType, false } } - return valType + return globalsField, globalsVal, true } func isNil(typ reflect.Type, val reflect.Value) bool { + // `reflect.TypeOf(nil) == nil` so calling typ.Kind() will cause a nil pointer + // dereference panic. Catch it and return early. + // https://github.com/golang/go/issues/51649 + // https://github.com/golang/go/issues/54208 + if typ == nil { + return true + } + if typ.Kind() == reflect.Ptr || typ.Kind() == reflect.Map || typ.Kind() == reflect.Slice || typ.Kind() == reflect.Interface { return val.IsNil() } return false } + +func contains(arr []string, str string) bool { + for _, a := range arr { + if a == str { + return true + } + } + return false +} diff --git a/internal/sdk/pkg/models/sdkerrors/sdkerror.go b/internal/sdk/models/errors/sdkerror.go similarity index 87% rename from internal/sdk/pkg/models/sdkerrors/sdkerror.go rename to internal/sdk/models/errors/sdkerror.go index 5c1affd..ff3fad6 100644 --- a/internal/sdk/pkg/models/sdkerrors/sdkerror.go +++ b/internal/sdk/models/errors/sdkerror.go @@ -1,6 +1,6 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasyapi.com). DO NOT EDIT. -package sdkerrors +package errors import ( "fmt" diff --git a/internal/sdk/pkg/models/operations/createprice.go b/internal/sdk/models/operations/createprice.go similarity index 93% rename from internal/sdk/pkg/models/operations/createprice.go rename to internal/sdk/models/operations/createprice.go index 0098bdc..971e573 100644 --- a/internal/sdk/pkg/models/operations/createprice.go +++ b/internal/sdk/models/operations/createprice.go @@ -1,9 +1,9 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasyapi.com). DO NOT EDIT. package operations import ( - "github.com/epilot-dev/terraform-provider-epilot-product/internal/sdk/pkg/models/shared" + "github.com/epilot-dev/terraform-provider-epilot-product/internal/sdk/models/shared" "net/http" ) diff --git a/internal/sdk/pkg/models/operations/createproduct.go b/internal/sdk/models/operations/createproduct.go similarity index 93% rename from internal/sdk/pkg/models/operations/createproduct.go rename to internal/sdk/models/operations/createproduct.go index 9fa454f..378a1a4 100644 --- a/internal/sdk/pkg/models/operations/createproduct.go +++ b/internal/sdk/models/operations/createproduct.go @@ -1,9 +1,9 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasyapi.com). DO NOT EDIT. package operations import ( - "github.com/epilot-dev/terraform-provider-epilot-product/internal/sdk/pkg/models/shared" + "github.com/epilot-dev/terraform-provider-epilot-product/internal/sdk/models/shared" "net/http" ) diff --git a/internal/sdk/pkg/models/operations/createtax.go b/internal/sdk/models/operations/createtax.go similarity index 93% rename from internal/sdk/pkg/models/operations/createtax.go rename to internal/sdk/models/operations/createtax.go index 6c749e7..44f966c 100644 --- a/internal/sdk/pkg/models/operations/createtax.go +++ b/internal/sdk/models/operations/createtax.go @@ -1,9 +1,9 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasyapi.com). DO NOT EDIT. package operations import ( - "github.com/epilot-dev/terraform-provider-epilot-product/internal/sdk/pkg/models/shared" + "github.com/epilot-dev/terraform-provider-epilot-product/internal/sdk/models/shared" "net/http" ) diff --git a/internal/sdk/pkg/models/operations/deleteprice.go b/internal/sdk/models/operations/deleteprice.go similarity index 94% rename from internal/sdk/pkg/models/operations/deleteprice.go rename to internal/sdk/models/operations/deleteprice.go index a12361b..0bed7f4 100644 --- a/internal/sdk/pkg/models/operations/deleteprice.go +++ b/internal/sdk/models/operations/deleteprice.go @@ -1,9 +1,9 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasyapi.com). DO NOT EDIT. package operations import ( - "github.com/epilot-dev/terraform-provider-epilot-product/internal/sdk/pkg/models/shared" + "github.com/epilot-dev/terraform-provider-epilot-product/internal/sdk/models/shared" "net/http" ) diff --git a/internal/sdk/pkg/models/operations/deleteproduct.go b/internal/sdk/models/operations/deleteproduct.go similarity index 94% rename from internal/sdk/pkg/models/operations/deleteproduct.go rename to internal/sdk/models/operations/deleteproduct.go index 83e2de2..45b0c0f 100644 --- a/internal/sdk/pkg/models/operations/deleteproduct.go +++ b/internal/sdk/models/operations/deleteproduct.go @@ -1,9 +1,9 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasyapi.com). DO NOT EDIT. package operations import ( - "github.com/epilot-dev/terraform-provider-epilot-product/internal/sdk/pkg/models/shared" + "github.com/epilot-dev/terraform-provider-epilot-product/internal/sdk/models/shared" "net/http" ) diff --git a/internal/sdk/pkg/models/operations/deletetax.go b/internal/sdk/models/operations/deletetax.go similarity index 94% rename from internal/sdk/pkg/models/operations/deletetax.go rename to internal/sdk/models/operations/deletetax.go index 7667e4f..06aff91 100644 --- a/internal/sdk/pkg/models/operations/deletetax.go +++ b/internal/sdk/models/operations/deletetax.go @@ -1,9 +1,9 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasyapi.com). DO NOT EDIT. package operations import ( - "github.com/epilot-dev/terraform-provider-epilot-product/internal/sdk/pkg/models/shared" + "github.com/epilot-dev/terraform-provider-epilot-product/internal/sdk/models/shared" "net/http" ) diff --git a/internal/sdk/pkg/models/operations/getprice.go b/internal/sdk/models/operations/getprice.go similarity index 94% rename from internal/sdk/pkg/models/operations/getprice.go rename to internal/sdk/models/operations/getprice.go index f5969d2..03d95bd 100644 --- a/internal/sdk/pkg/models/operations/getprice.go +++ b/internal/sdk/models/operations/getprice.go @@ -1,9 +1,9 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasyapi.com). DO NOT EDIT. package operations import ( - "github.com/epilot-dev/terraform-provider-epilot-product/internal/sdk/pkg/models/shared" + "github.com/epilot-dev/terraform-provider-epilot-product/internal/sdk/models/shared" "net/http" ) diff --git a/internal/sdk/pkg/models/operations/getproduct.go b/internal/sdk/models/operations/getproduct.go similarity index 95% rename from internal/sdk/pkg/models/operations/getproduct.go rename to internal/sdk/models/operations/getproduct.go index 895c056..4adb565 100644 --- a/internal/sdk/pkg/models/operations/getproduct.go +++ b/internal/sdk/models/operations/getproduct.go @@ -1,9 +1,9 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasyapi.com). DO NOT EDIT. package operations import ( - "github.com/epilot-dev/terraform-provider-epilot-product/internal/sdk/pkg/models/shared" + "github.com/epilot-dev/terraform-provider-epilot-product/internal/sdk/models/shared" "net/http" ) diff --git a/internal/sdk/pkg/models/operations/gettax.go b/internal/sdk/models/operations/gettax.go similarity index 94% rename from internal/sdk/pkg/models/operations/gettax.go rename to internal/sdk/models/operations/gettax.go index a09cada..df376bb 100644 --- a/internal/sdk/pkg/models/operations/gettax.go +++ b/internal/sdk/models/operations/gettax.go @@ -1,9 +1,9 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasyapi.com). DO NOT EDIT. package operations import ( - "github.com/epilot-dev/terraform-provider-epilot-product/internal/sdk/pkg/models/shared" + "github.com/epilot-dev/terraform-provider-epilot-product/internal/sdk/models/shared" "net/http" ) diff --git a/internal/sdk/models/operations/options.go b/internal/sdk/models/operations/options.go new file mode 100644 index 0000000..1001484 --- /dev/null +++ b/internal/sdk/models/operations/options.go @@ -0,0 +1,93 @@ +// Code generated by Speakeasy (https://speakeasyapi.com). DO NOT EDIT. + +package operations + +import ( + "errors" + "github.com/epilot-dev/terraform-provider-epilot-product/internal/sdk/internal/utils" + "github.com/epilot-dev/terraform-provider-epilot-product/internal/sdk/retry" + "time" +) + +var ErrUnsupportedOption = errors.New("unsupported option") + +const ( + SupportedOptionServerURL = "serverURL" + SupportedOptionRetries = "retries" + SupportedOptionTimeout = "timeout" + SupportedOptionAcceptHeaderOverride = "acceptHeaderOverride" + SupportedOptionURLOverride = "urlOverride" +) + +type Options struct { + ServerURL *string + Retries *retry.Config + Timeout *time.Duration + URLOverride *string +} + +type Option func(*Options, ...string) error + +// WithServerURL allows providing an alternative server URL. +func WithServerURL(serverURL string) Option { + return func(opts *Options, supportedOptions ...string) error { + if !utils.Contains(supportedOptions, SupportedOptionServerURL) { + return ErrUnsupportedOption + } + + opts.ServerURL = &serverURL + return nil + } +} + +// WithTemplatedServerURL allows providing an alternative server URL with templated parameters. +func WithTemplatedServerURL(serverURL string, params map[string]string) Option { + return func(opts *Options, supportedOptions ...string) error { + if !utils.Contains(supportedOptions, SupportedOptionServerURL) { + return ErrUnsupportedOption + } + + if params != nil { + serverURL = utils.ReplaceParameters(serverURL, params) + } + + opts.ServerURL = &serverURL + return nil + } +} + +// WithRetries allows customizing the default retry configuration. +func WithRetries(config retry.Config) Option { + return func(opts *Options, supportedOptions ...string) error { + if !utils.Contains(supportedOptions, SupportedOptionRetries) { + return ErrUnsupportedOption + } + + opts.Retries = &config + return nil + } +} + +// WithOperationTimeout allows setting the request timeout applied for an operation. +func WithOperationTimeout(timeout time.Duration) Option { + return func(opts *Options, supportedOptions ...string) error { + if !utils.Contains(supportedOptions, SupportedOptionRetries) { + return ErrUnsupportedOption + } + + opts.Timeout = &timeout + return nil + } +} + +// WithURLOverride allows overriding the URL. +func WithURLOverride(urlOverride string) Option { + return func(opts *Options, supportedOptions ...string) error { + if !utils.Contains(supportedOptions, SupportedOptionURLOverride) { + return ErrUnsupportedOption + } + + opts.URLOverride = &urlOverride + return nil + } +} diff --git a/internal/sdk/pkg/models/operations/patchprice.go b/internal/sdk/models/operations/patchprice.go similarity index 94% rename from internal/sdk/pkg/models/operations/patchprice.go rename to internal/sdk/models/operations/patchprice.go index adb63ea..765a8f5 100644 --- a/internal/sdk/pkg/models/operations/patchprice.go +++ b/internal/sdk/models/operations/patchprice.go @@ -1,9 +1,9 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasyapi.com). DO NOT EDIT. package operations import ( - "github.com/epilot-dev/terraform-provider-epilot-product/internal/sdk/pkg/models/shared" + "github.com/epilot-dev/terraform-provider-epilot-product/internal/sdk/models/shared" "net/http" ) diff --git a/internal/sdk/pkg/models/operations/patchproduct.go b/internal/sdk/models/operations/patchproduct.go similarity index 95% rename from internal/sdk/pkg/models/operations/patchproduct.go rename to internal/sdk/models/operations/patchproduct.go index 6fc7efb..acbd2b9 100644 --- a/internal/sdk/pkg/models/operations/patchproduct.go +++ b/internal/sdk/models/operations/patchproduct.go @@ -1,9 +1,9 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasyapi.com). DO NOT EDIT. package operations import ( - "github.com/epilot-dev/terraform-provider-epilot-product/internal/sdk/pkg/models/shared" + "github.com/epilot-dev/terraform-provider-epilot-product/internal/sdk/models/shared" "net/http" ) diff --git a/internal/sdk/pkg/models/operations/patchtax.go b/internal/sdk/models/operations/patchtax.go similarity index 94% rename from internal/sdk/pkg/models/operations/patchtax.go rename to internal/sdk/models/operations/patchtax.go index d1d900b..58cd52b 100644 --- a/internal/sdk/pkg/models/operations/patchtax.go +++ b/internal/sdk/models/operations/patchtax.go @@ -1,9 +1,9 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasyapi.com). DO NOT EDIT. package operations import ( - "github.com/epilot-dev/terraform-provider-epilot-product/internal/sdk/pkg/models/shared" + "github.com/epilot-dev/terraform-provider-epilot-product/internal/sdk/models/shared" "net/http" ) diff --git a/internal/sdk/pkg/models/operations/updateprice.go b/internal/sdk/models/operations/updateprice.go similarity index 95% rename from internal/sdk/pkg/models/operations/updateprice.go rename to internal/sdk/models/operations/updateprice.go index 6bbd8b3..d1fa949 100644 --- a/internal/sdk/pkg/models/operations/updateprice.go +++ b/internal/sdk/models/operations/updateprice.go @@ -1,9 +1,9 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasyapi.com). DO NOT EDIT. package operations import ( - "github.com/epilot-dev/terraform-provider-epilot-product/internal/sdk/pkg/models/shared" + "github.com/epilot-dev/terraform-provider-epilot-product/internal/sdk/models/shared" "net/http" ) diff --git a/internal/sdk/pkg/models/operations/updateproduct.go b/internal/sdk/models/operations/updateproduct.go similarity index 95% rename from internal/sdk/pkg/models/operations/updateproduct.go rename to internal/sdk/models/operations/updateproduct.go index b1f8c96..408e1fa 100644 --- a/internal/sdk/pkg/models/operations/updateproduct.go +++ b/internal/sdk/models/operations/updateproduct.go @@ -1,9 +1,9 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasyapi.com). DO NOT EDIT. package operations import ( - "github.com/epilot-dev/terraform-provider-epilot-product/internal/sdk/pkg/models/shared" + "github.com/epilot-dev/terraform-provider-epilot-product/internal/sdk/models/shared" "net/http" ) diff --git a/internal/sdk/pkg/models/operations/updatetax.go b/internal/sdk/models/operations/updatetax.go similarity index 94% rename from internal/sdk/pkg/models/operations/updatetax.go rename to internal/sdk/models/operations/updatetax.go index ab4d74f..5e909a3 100644 --- a/internal/sdk/pkg/models/operations/updatetax.go +++ b/internal/sdk/models/operations/updatetax.go @@ -1,9 +1,9 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasyapi.com). DO NOT EDIT. package operations import ( - "github.com/epilot-dev/terraform-provider-epilot-product/internal/sdk/pkg/models/shared" + "github.com/epilot-dev/terraform-provider-epilot-product/internal/sdk/models/shared" "net/http" ) diff --git a/internal/sdk/pkg/models/shared/baserelation.go b/internal/sdk/models/shared/baserelation.go similarity index 89% rename from internal/sdk/pkg/models/shared/baserelation.go rename to internal/sdk/models/shared/baserelation.go index 46f06f5..58f1f6a 100644 --- a/internal/sdk/pkg/models/shared/baserelation.go +++ b/internal/sdk/models/shared/baserelation.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasyapi.com). DO NOT EDIT. package shared diff --git a/internal/sdk/pkg/models/shared/clienterror.go b/internal/sdk/models/shared/clienterror.go similarity index 82% rename from internal/sdk/pkg/models/shared/clienterror.go rename to internal/sdk/models/shared/clienterror.go index 5ab234e..00ac3a2 100644 --- a/internal/sdk/pkg/models/shared/clienterror.go +++ b/internal/sdk/models/shared/clienterror.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasyapi.com). DO NOT EDIT. package shared diff --git a/internal/sdk/pkg/models/shared/price.go b/internal/sdk/models/shared/price.go similarity index 83% rename from internal/sdk/pkg/models/shared/price.go rename to internal/sdk/models/shared/price.go index daeb8de..990ac5a 100644 --- a/internal/sdk/pkg/models/shared/price.go +++ b/internal/sdk/models/shared/price.go @@ -1,12 +1,11 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasyapi.com). DO NOT EDIT. package shared import ( "encoding/json" - "errors" "fmt" - "github.com/epilot-dev/terraform-provider-epilot-product/internal/sdk/pkg/utils" + "github.com/epilot-dev/terraform-provider-epilot-product/internal/sdk/internal/utils" ) // BillingDurationUnit - The billing period duration unit @@ -21,7 +20,6 @@ const ( func (e BillingDurationUnit) ToPointer() *BillingDurationUnit { return &e } - func (e *BillingDurationUnit) UnmarshalJSON(data []byte) error { var v string if err := json.Unmarshal(data, &v); err != nil { @@ -52,7 +50,6 @@ const ( func (e NoticeTimeUnit) ToPointer() *NoticeTimeUnit { return &e } - func (e *NoticeTimeUnit) UnmarshalJSON(data []byte) error { var v string if err := json.Unmarshal(data, &v); err != nil { @@ -71,6 +68,18 @@ func (e *NoticeTimeUnit) UnmarshalJSON(data []byte) error { } } +// PriceComponents - A set of [price](/api/pricing#tag/simple_price_schema) components that define the composite price. +type PriceComponents struct { + DollarRelation []PriceComponentRelation `json:"$relation,omitempty"` +} + +func (o *PriceComponents) GetDollarRelation() []PriceComponentRelation { + if o == nil { + return nil + } + return o.DollarRelation +} + // PriceDisplayInJourneys - Defines the way the price amount is display in epilot journeys. type PriceDisplayInJourneys string @@ -83,7 +92,6 @@ const ( func (e PriceDisplayInJourneys) ToPointer() *PriceDisplayInJourneys { return &e } - func (e *PriceDisplayInJourneys) UnmarshalJSON(data []byte) error { var v string if err := json.Unmarshal(data, &v); err != nil { @@ -119,7 +127,6 @@ const ( func (e PricingModel) ToPointer() *PricingModel { return &e } - func (e *PricingModel) UnmarshalJSON(data []byte) error { var v string if err := json.Unmarshal(data, &v); err != nil { @@ -152,7 +159,6 @@ const ( func (e RenewalDurationUnit) ToPointer() *RenewalDurationUnit { return &e } - func (e *RenewalDurationUnit) UnmarshalJSON(data []byte) error { var v string if err := json.Unmarshal(data, &v); err != nil { @@ -183,7 +189,6 @@ const ( func (e TerminationTimeUnit) ToPointer() *TerminationTimeUnit { return &e } - func (e *TerminationTimeUnit) UnmarshalJSON(data []byte) error { var v string if err := json.Unmarshal(data, &v); err != nil { @@ -213,7 +218,6 @@ const ( func (e Type) ToPointer() *Type { return &e } - func (e *Type) UnmarshalJSON(data []byte) error { var v string if err := json.Unmarshal(data, &v); err != nil { @@ -230,131 +234,6 @@ func (e *Type) UnmarshalJSON(data []byte) error { } } -// One - built-in units -type One string - -const ( - OneKw One = "kw" - OneKwh One = "kwh" - OneM One = "m" - OneM2 One = "m2" - OneL One = "l" - OneCubicMeter One = "cubic-meter" - OneCubicMeterH One = "cubic-meter-h" - OneLs One = "ls" - OneA One = "a" - OneKva One = "kva" - OneW One = "w" - OneWp One = "wp" - OneKwp One = "kwp" -) - -func (e One) ToPointer() *One { - return &e -} - -func (e *One) UnmarshalJSON(data []byte) error { - var v string - if err := json.Unmarshal(data, &v); err != nil { - return err - } - switch v { - case "kw": - fallthrough - case "kwh": - fallthrough - case "m": - fallthrough - case "m2": - fallthrough - case "l": - fallthrough - case "cubic-meter": - fallthrough - case "cubic-meter-h": - fallthrough - case "ls": - fallthrough - case "a": - fallthrough - case "kva": - fallthrough - case "w": - fallthrough - case "wp": - fallthrough - case "kwp": - *e = One(v) - return nil - default: - return fmt.Errorf("invalid value for One: %v", v) - } -} - -type UnitType string - -const ( - UnitTypeOne UnitType = "1" - UnitTypeStr UnitType = "str" -) - -// Unit - The unit of measurement used for display purposes and possibly for calculations when the price is variable. -type Unit struct { - One *One - Str *string - - Type UnitType -} - -func CreateUnitOne(one One) Unit { - typ := UnitTypeOne - - return Unit{ - One: &one, - Type: typ, - } -} - -func CreateUnitStr(str string) Unit { - typ := UnitTypeStr - - return Unit{ - Str: &str, - Type: typ, - } -} - -func (u *Unit) UnmarshalJSON(data []byte) error { - - one := new(One) - if err := utils.UnmarshalJSON(data, &one, "", true, true); err == nil { - u.One = one - u.Type = UnitTypeOne - return nil - } - - str := new(string) - if err := utils.UnmarshalJSON(data, &str, "", true, true); err == nil { - u.Str = str - u.Type = UnitTypeStr - return nil - } - - return errors.New("could not unmarshal into supported union types") -} - -func (u Unit) MarshalJSON() ([]byte, error) { - if u.One != nil { - return utils.MarshalJSON(u.One, "", true) - } - - if u.Str != nil { - return utils.MarshalJSON(u.Str, "", true) - } - - return nil, errors.New("could not marshal union type: all fields are null") -} - type Price struct { ID string `json:"_id"` // Whether the price can be used for new purchases. @@ -375,6 +254,8 @@ type Price struct { NoticeTimeAmount *float64 `json:"notice_time_amount,omitempty"` // The notice period duration unit NoticeTimeUnit *NoticeTimeUnit `json:"notice_time_unit,omitempty"` + // A set of [price](/api/pricing#tag/simple_price_schema) components that define the composite price. + PriceComponents *PriceComponents `json:"price_components,omitempty"` // Defines the way the price amount is display in epilot journeys. PriceDisplayInJourneys *PriceDisplayInJourneys `json:"price_display_in_journeys,omitempty"` // Describes how to compute the price per period. Either `per_unit`, `tiered_graduated` or `tiered_volume`. @@ -388,7 +269,7 @@ type Price struct { RenewalDurationAmount *float64 `json:"renewal_duration_amount,omitempty"` // The renewal period duration unit RenewalDurationUnit *RenewalDurationUnit `json:"renewal_duration_unit,omitempty"` - Tax interface{} `json:"tax,omitempty"` + Tax any `json:"tax,omitempty"` // The termination period duration TerminationTimeAmount *float64 `json:"termination_time_amount,omitempty"` // The termination period duration unit @@ -399,7 +280,7 @@ type Price struct { // One of `one_time` or `recurring` depending on whether the price is for a one-time purchase or a recurring (subscription) purchase. Type *Type `default:"one_time" json:"type"` // The unit of measurement used for display purposes and possibly for calculations when the price is variable. - Unit *Unit `json:"unit,omitempty"` + Unit *string `json:"unit,omitempty"` // The unit amount in cents to be charged, represented as a whole integer if possible. UnitAmount *float64 `json:"unit_amount,omitempty"` // Three-letter ISO currency code, in lowercase. @@ -491,6 +372,13 @@ func (o *Price) GetNoticeTimeUnit() *NoticeTimeUnit { return o.NoticeTimeUnit } +func (o *Price) GetPriceComponents() *PriceComponents { + if o == nil { + return nil + } + return o.PriceComponents +} + func (o *Price) GetPriceDisplayInJourneys() *PriceDisplayInJourneys { if o == nil { return nil @@ -519,7 +407,7 @@ func (o *Price) GetRenewalDurationUnit() *RenewalDurationUnit { return o.RenewalDurationUnit } -func (o *Price) GetTax() interface{} { +func (o *Price) GetTax() any { if o == nil { return nil } @@ -554,7 +442,7 @@ func (o *Price) GetType() *Type { return o.Type } -func (o *Price) GetUnit() *Unit { +func (o *Price) GetUnit() *string { if o == nil { return nil } diff --git a/internal/sdk/models/shared/pricecomponentrelation.go b/internal/sdk/models/shared/pricecomponentrelation.go new file mode 100644 index 0000000..4ff20ca --- /dev/null +++ b/internal/sdk/models/shared/pricecomponentrelation.go @@ -0,0 +1,24 @@ +// Code generated by Speakeasy (https://speakeasyapi.com). DO NOT EDIT. + +package shared + +type PriceComponentRelation struct { + // An arbitrary set of tags attached to the composite price - component relation + Tags []string `json:"_tags,omitempty"` + // The id of the price component + EntityID *string `json:"entity_id,omitempty"` +} + +func (o *PriceComponentRelation) GetTags() []string { + if o == nil { + return nil + } + return o.Tags +} + +func (o *PriceComponentRelation) GetEntityID() *string { + if o == nil { + return nil + } + return o.EntityID +} diff --git a/internal/sdk/pkg/models/shared/pricecreate.go b/internal/sdk/models/shared/pricecreate.go similarity index 80% rename from internal/sdk/pkg/models/shared/pricecreate.go rename to internal/sdk/models/shared/pricecreate.go index 385dd8d..eea8431 100644 --- a/internal/sdk/pkg/models/shared/pricecreate.go +++ b/internal/sdk/models/shared/pricecreate.go @@ -1,12 +1,11 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasyapi.com). DO NOT EDIT. package shared import ( "encoding/json" - "errors" "fmt" - "github.com/epilot-dev/terraform-provider-epilot-product/internal/sdk/pkg/utils" + "github.com/epilot-dev/terraform-provider-epilot-product/internal/sdk/internal/utils" ) // PriceCreateBillingDurationUnit - The billing period duration unit @@ -21,7 +20,6 @@ const ( func (e PriceCreateBillingDurationUnit) ToPointer() *PriceCreateBillingDurationUnit { return &e } - func (e *PriceCreateBillingDurationUnit) UnmarshalJSON(data []byte) error { var v string if err := json.Unmarshal(data, &v); err != nil { @@ -52,7 +50,6 @@ const ( func (e PriceCreateNoticeTimeUnit) ToPointer() *PriceCreateNoticeTimeUnit { return &e } - func (e *PriceCreateNoticeTimeUnit) UnmarshalJSON(data []byte) error { var v string if err := json.Unmarshal(data, &v); err != nil { @@ -71,6 +68,18 @@ func (e *PriceCreateNoticeTimeUnit) UnmarshalJSON(data []byte) error { } } +// PriceCreatePriceComponents - A set of [price](/api/pricing#tag/simple_price_schema) components that define the composite price. +type PriceCreatePriceComponents struct { + DollarRelation []PriceComponentRelation `json:"$relation,omitempty"` +} + +func (o *PriceCreatePriceComponents) GetDollarRelation() []PriceComponentRelation { + if o == nil { + return nil + } + return o.DollarRelation +} + // PriceCreatePriceDisplayInJourneys - Defines the way the price amount is display in epilot journeys. type PriceCreatePriceDisplayInJourneys string @@ -83,7 +92,6 @@ const ( func (e PriceCreatePriceDisplayInJourneys) ToPointer() *PriceCreatePriceDisplayInJourneys { return &e } - func (e *PriceCreatePriceDisplayInJourneys) UnmarshalJSON(data []byte) error { var v string if err := json.Unmarshal(data, &v); err != nil { @@ -119,7 +127,6 @@ const ( func (e PriceCreatePricingModel) ToPointer() *PriceCreatePricingModel { return &e } - func (e *PriceCreatePricingModel) UnmarshalJSON(data []byte) error { var v string if err := json.Unmarshal(data, &v); err != nil { @@ -152,7 +159,6 @@ const ( func (e PriceCreateRenewalDurationUnit) ToPointer() *PriceCreateRenewalDurationUnit { return &e } - func (e *PriceCreateRenewalDurationUnit) UnmarshalJSON(data []byte) error { var v string if err := json.Unmarshal(data, &v); err != nil { @@ -183,7 +189,6 @@ const ( func (e PriceCreateTerminationTimeUnit) ToPointer() *PriceCreateTerminationTimeUnit { return &e } - func (e *PriceCreateTerminationTimeUnit) UnmarshalJSON(data []byte) error { var v string if err := json.Unmarshal(data, &v); err != nil { @@ -213,7 +218,6 @@ const ( func (e PriceCreateType) ToPointer() *PriceCreateType { return &e } - func (e *PriceCreateType) UnmarshalJSON(data []byte) error { var v string if err := json.Unmarshal(data, &v); err != nil { @@ -230,131 +234,6 @@ func (e *PriceCreateType) UnmarshalJSON(data []byte) error { } } -// PriceCreate1 - built-in units -type PriceCreate1 string - -const ( - PriceCreate1Kw PriceCreate1 = "kw" - PriceCreate1Kwh PriceCreate1 = "kwh" - PriceCreate1M PriceCreate1 = "m" - PriceCreate1M2 PriceCreate1 = "m2" - PriceCreate1L PriceCreate1 = "l" - PriceCreate1CubicMeter PriceCreate1 = "cubic-meter" - PriceCreate1CubicMeterH PriceCreate1 = "cubic-meter-h" - PriceCreate1Ls PriceCreate1 = "ls" - PriceCreate1A PriceCreate1 = "a" - PriceCreate1Kva PriceCreate1 = "kva" - PriceCreate1W PriceCreate1 = "w" - PriceCreate1Wp PriceCreate1 = "wp" - PriceCreate1Kwp PriceCreate1 = "kwp" -) - -func (e PriceCreate1) ToPointer() *PriceCreate1 { - return &e -} - -func (e *PriceCreate1) UnmarshalJSON(data []byte) error { - var v string - if err := json.Unmarshal(data, &v); err != nil { - return err - } - switch v { - case "kw": - fallthrough - case "kwh": - fallthrough - case "m": - fallthrough - case "m2": - fallthrough - case "l": - fallthrough - case "cubic-meter": - fallthrough - case "cubic-meter-h": - fallthrough - case "ls": - fallthrough - case "a": - fallthrough - case "kva": - fallthrough - case "w": - fallthrough - case "wp": - fallthrough - case "kwp": - *e = PriceCreate1(v) - return nil - default: - return fmt.Errorf("invalid value for PriceCreate1: %v", v) - } -} - -type PriceCreateUnitType string - -const ( - PriceCreateUnitTypePriceCreate1 PriceCreateUnitType = "PriceCreate_1" - PriceCreateUnitTypeStr PriceCreateUnitType = "str" -) - -// PriceCreateUnit - The unit of measurement used for display purposes and possibly for calculations when the price is variable. -type PriceCreateUnit struct { - PriceCreate1 *PriceCreate1 - Str *string - - Type PriceCreateUnitType -} - -func CreatePriceCreateUnitPriceCreate1(priceCreate1 PriceCreate1) PriceCreateUnit { - typ := PriceCreateUnitTypePriceCreate1 - - return PriceCreateUnit{ - PriceCreate1: &priceCreate1, - Type: typ, - } -} - -func CreatePriceCreateUnitStr(str string) PriceCreateUnit { - typ := PriceCreateUnitTypeStr - - return PriceCreateUnit{ - Str: &str, - Type: typ, - } -} - -func (u *PriceCreateUnit) UnmarshalJSON(data []byte) error { - - priceCreate1 := new(PriceCreate1) - if err := utils.UnmarshalJSON(data, &priceCreate1, "", true, true); err == nil { - u.PriceCreate1 = priceCreate1 - u.Type = PriceCreateUnitTypePriceCreate1 - return nil - } - - str := new(string) - if err := utils.UnmarshalJSON(data, &str, "", true, true); err == nil { - u.Str = str - u.Type = PriceCreateUnitTypeStr - return nil - } - - return errors.New("could not unmarshal into supported union types") -} - -func (u PriceCreateUnit) MarshalJSON() ([]byte, error) { - if u.PriceCreate1 != nil { - return utils.MarshalJSON(u.PriceCreate1, "", true) - } - - if u.Str != nil { - return utils.MarshalJSON(u.Str, "", true) - } - - return nil, errors.New("could not marshal union type: all fields are null") -} - type PriceCreate struct { // Whether the price can be used for new purchases. Active bool `json:"active"` @@ -374,6 +253,8 @@ type PriceCreate struct { NoticeTimeAmount *float64 `json:"notice_time_amount,omitempty"` // The notice period duration unit NoticeTimeUnit *PriceCreateNoticeTimeUnit `json:"notice_time_unit,omitempty"` + // A set of [price](/api/pricing#tag/simple_price_schema) components that define the composite price. + PriceComponents *PriceCreatePriceComponents `json:"price_components,omitempty"` // Defines the way the price amount is display in epilot journeys. PriceDisplayInJourneys *PriceCreatePriceDisplayInJourneys `json:"price_display_in_journeys,omitempty"` // Describes how to compute the price per period. Either `per_unit`, `tiered_graduated` or `tiered_volume`. @@ -387,7 +268,7 @@ type PriceCreate struct { RenewalDurationAmount *float64 `json:"renewal_duration_amount,omitempty"` // The renewal period duration unit RenewalDurationUnit *PriceCreateRenewalDurationUnit `json:"renewal_duration_unit,omitempty"` - Tax interface{} `json:"tax,omitempty"` + Tax any `json:"tax,omitempty"` // The termination period duration TerminationTimeAmount *float64 `json:"termination_time_amount,omitempty"` // The termination period duration unit @@ -398,7 +279,7 @@ type PriceCreate struct { // One of `one_time` or `recurring` depending on whether the price is for a one-time purchase or a recurring (subscription) purchase. Type *PriceCreateType `default:"one_time" json:"type"` // The unit of measurement used for display purposes and possibly for calculations when the price is variable. - Unit *PriceCreateUnit `json:"unit,omitempty"` + Unit *string `json:"unit,omitempty"` // The unit amount in cents to be charged, represented as a whole integer if possible. UnitAmount *float64 `json:"unit_amount,omitempty"` // Three-letter ISO currency code, in lowercase. @@ -483,6 +364,13 @@ func (o *PriceCreate) GetNoticeTimeUnit() *PriceCreateNoticeTimeUnit { return o.NoticeTimeUnit } +func (o *PriceCreate) GetPriceComponents() *PriceCreatePriceComponents { + if o == nil { + return nil + } + return o.PriceComponents +} + func (o *PriceCreate) GetPriceDisplayInJourneys() *PriceCreatePriceDisplayInJourneys { if o == nil { return nil @@ -511,7 +399,7 @@ func (o *PriceCreate) GetRenewalDurationUnit() *PriceCreateRenewalDurationUnit { return o.RenewalDurationUnit } -func (o *PriceCreate) GetTax() interface{} { +func (o *PriceCreate) GetTax() any { if o == nil { return nil } @@ -546,7 +434,7 @@ func (o *PriceCreate) GetType() *PriceCreateType { return o.Type } -func (o *PriceCreate) GetUnit() *PriceCreateUnit { +func (o *PriceCreate) GetUnit() *string { if o == nil { return nil } diff --git a/internal/sdk/pkg/models/shared/pricepatch.go b/internal/sdk/models/shared/pricepatch.go similarity index 81% rename from internal/sdk/pkg/models/shared/pricepatch.go rename to internal/sdk/models/shared/pricepatch.go index 7736054..678d389 100644 --- a/internal/sdk/pkg/models/shared/pricepatch.go +++ b/internal/sdk/models/shared/pricepatch.go @@ -1,12 +1,11 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasyapi.com). DO NOT EDIT. package shared import ( "encoding/json" - "errors" "fmt" - "github.com/epilot-dev/terraform-provider-epilot-product/internal/sdk/pkg/utils" + "github.com/epilot-dev/terraform-provider-epilot-product/internal/sdk/internal/utils" ) // PricePatchBillingDurationUnit - The billing period duration unit @@ -21,7 +20,6 @@ const ( func (e PricePatchBillingDurationUnit) ToPointer() *PricePatchBillingDurationUnit { return &e } - func (e *PricePatchBillingDurationUnit) UnmarshalJSON(data []byte) error { var v string if err := json.Unmarshal(data, &v); err != nil { @@ -52,7 +50,6 @@ const ( func (e PricePatchNoticeTimeUnit) ToPointer() *PricePatchNoticeTimeUnit { return &e } - func (e *PricePatchNoticeTimeUnit) UnmarshalJSON(data []byte) error { var v string if err := json.Unmarshal(data, &v); err != nil { @@ -71,6 +68,18 @@ func (e *PricePatchNoticeTimeUnit) UnmarshalJSON(data []byte) error { } } +// PricePatchPriceComponents - A set of [price](/api/pricing#tag/simple_price_schema) components that define the composite price. +type PricePatchPriceComponents struct { + DollarRelation []PriceComponentRelation `json:"$relation,omitempty"` +} + +func (o *PricePatchPriceComponents) GetDollarRelation() []PriceComponentRelation { + if o == nil { + return nil + } + return o.DollarRelation +} + // PricePatchPriceDisplayInJourneys - Defines the way the price amount is display in epilot journeys. type PricePatchPriceDisplayInJourneys string @@ -83,7 +92,6 @@ const ( func (e PricePatchPriceDisplayInJourneys) ToPointer() *PricePatchPriceDisplayInJourneys { return &e } - func (e *PricePatchPriceDisplayInJourneys) UnmarshalJSON(data []byte) error { var v string if err := json.Unmarshal(data, &v); err != nil { @@ -119,7 +127,6 @@ const ( func (e PricePatchPricingModel) ToPointer() *PricePatchPricingModel { return &e } - func (e *PricePatchPricingModel) UnmarshalJSON(data []byte) error { var v string if err := json.Unmarshal(data, &v); err != nil { @@ -152,7 +159,6 @@ const ( func (e PricePatchRenewalDurationUnit) ToPointer() *PricePatchRenewalDurationUnit { return &e } - func (e *PricePatchRenewalDurationUnit) UnmarshalJSON(data []byte) error { var v string if err := json.Unmarshal(data, &v); err != nil { @@ -183,7 +189,6 @@ const ( func (e PricePatchTerminationTimeUnit) ToPointer() *PricePatchTerminationTimeUnit { return &e } - func (e *PricePatchTerminationTimeUnit) UnmarshalJSON(data []byte) error { var v string if err := json.Unmarshal(data, &v); err != nil { @@ -213,7 +218,6 @@ const ( func (e PricePatchType) ToPointer() *PricePatchType { return &e } - func (e *PricePatchType) UnmarshalJSON(data []byte) error { var v string if err := json.Unmarshal(data, &v); err != nil { @@ -230,131 +234,6 @@ func (e *PricePatchType) UnmarshalJSON(data []byte) error { } } -// PricePatch1 - built-in units -type PricePatch1 string - -const ( - PricePatch1Kw PricePatch1 = "kw" - PricePatch1Kwh PricePatch1 = "kwh" - PricePatch1M PricePatch1 = "m" - PricePatch1M2 PricePatch1 = "m2" - PricePatch1L PricePatch1 = "l" - PricePatch1CubicMeter PricePatch1 = "cubic-meter" - PricePatch1CubicMeterH PricePatch1 = "cubic-meter-h" - PricePatch1Ls PricePatch1 = "ls" - PricePatch1A PricePatch1 = "a" - PricePatch1Kva PricePatch1 = "kva" - PricePatch1W PricePatch1 = "w" - PricePatch1Wp PricePatch1 = "wp" - PricePatch1Kwp PricePatch1 = "kwp" -) - -func (e PricePatch1) ToPointer() *PricePatch1 { - return &e -} - -func (e *PricePatch1) UnmarshalJSON(data []byte) error { - var v string - if err := json.Unmarshal(data, &v); err != nil { - return err - } - switch v { - case "kw": - fallthrough - case "kwh": - fallthrough - case "m": - fallthrough - case "m2": - fallthrough - case "l": - fallthrough - case "cubic-meter": - fallthrough - case "cubic-meter-h": - fallthrough - case "ls": - fallthrough - case "a": - fallthrough - case "kva": - fallthrough - case "w": - fallthrough - case "wp": - fallthrough - case "kwp": - *e = PricePatch1(v) - return nil - default: - return fmt.Errorf("invalid value for PricePatch1: %v", v) - } -} - -type PricePatchUnitType string - -const ( - PricePatchUnitTypePricePatch1 PricePatchUnitType = "PricePatch_1" - PricePatchUnitTypeStr PricePatchUnitType = "str" -) - -// PricePatchUnit - The unit of measurement used for display purposes and possibly for calculations when the price is variable. -type PricePatchUnit struct { - PricePatch1 *PricePatch1 - Str *string - - Type PricePatchUnitType -} - -func CreatePricePatchUnitPricePatch1(pricePatch1 PricePatch1) PricePatchUnit { - typ := PricePatchUnitTypePricePatch1 - - return PricePatchUnit{ - PricePatch1: &pricePatch1, - Type: typ, - } -} - -func CreatePricePatchUnitStr(str string) PricePatchUnit { - typ := PricePatchUnitTypeStr - - return PricePatchUnit{ - Str: &str, - Type: typ, - } -} - -func (u *PricePatchUnit) UnmarshalJSON(data []byte) error { - - pricePatch1 := new(PricePatch1) - if err := utils.UnmarshalJSON(data, &pricePatch1, "", true, true); err == nil { - u.PricePatch1 = pricePatch1 - u.Type = PricePatchUnitTypePricePatch1 - return nil - } - - str := new(string) - if err := utils.UnmarshalJSON(data, &str, "", true, true); err == nil { - u.Str = str - u.Type = PricePatchUnitTypeStr - return nil - } - - return errors.New("could not unmarshal into supported union types") -} - -func (u PricePatchUnit) MarshalJSON() ([]byte, error) { - if u.PricePatch1 != nil { - return utils.MarshalJSON(u.PricePatch1, "", true) - } - - if u.Str != nil { - return utils.MarshalJSON(u.Str, "", true) - } - - return nil, errors.New("could not marshal union type: all fields are null") -} - type PricePatch struct { // Whether the price can be used for new purchases. Active *bool `json:"active,omitempty"` @@ -374,6 +253,8 @@ type PricePatch struct { NoticeTimeAmount *float64 `json:"notice_time_amount,omitempty"` // The notice period duration unit NoticeTimeUnit *PricePatchNoticeTimeUnit `json:"notice_time_unit,omitempty"` + // A set of [price](/api/pricing#tag/simple_price_schema) components that define the composite price. + PriceComponents *PricePatchPriceComponents `json:"price_components,omitempty"` // Defines the way the price amount is display in epilot journeys. PriceDisplayInJourneys *PricePatchPriceDisplayInJourneys `json:"price_display_in_journeys,omitempty"` // Describes how to compute the price per period. Either `per_unit`, `tiered_graduated` or `tiered_volume`. @@ -387,7 +268,7 @@ type PricePatch struct { RenewalDurationAmount *float64 `json:"renewal_duration_amount,omitempty"` // The renewal period duration unit RenewalDurationUnit *PricePatchRenewalDurationUnit `json:"renewal_duration_unit,omitempty"` - Tax interface{} `json:"tax,omitempty"` + Tax any `json:"tax,omitempty"` // The termination period duration TerminationTimeAmount *float64 `json:"termination_time_amount,omitempty"` // The termination period duration unit @@ -398,7 +279,7 @@ type PricePatch struct { // One of `one_time` or `recurring` depending on whether the price is for a one-time purchase or a recurring (subscription) purchase. Type *PricePatchType `default:"one_time" json:"type"` // The unit of measurement used for display purposes and possibly for calculations when the price is variable. - Unit *PricePatchUnit `json:"unit,omitempty"` + Unit *string `json:"unit,omitempty"` // The unit amount in cents to be charged, represented as a whole integer if possible. UnitAmount *float64 `json:"unit_amount,omitempty"` // Three-letter ISO currency code, in lowercase. @@ -483,6 +364,13 @@ func (o *PricePatch) GetNoticeTimeUnit() *PricePatchNoticeTimeUnit { return o.NoticeTimeUnit } +func (o *PricePatch) GetPriceComponents() *PricePatchPriceComponents { + if o == nil { + return nil + } + return o.PriceComponents +} + func (o *PricePatch) GetPriceDisplayInJourneys() *PricePatchPriceDisplayInJourneys { if o == nil { return nil @@ -511,7 +399,7 @@ func (o *PricePatch) GetRenewalDurationUnit() *PricePatchRenewalDurationUnit { return o.RenewalDurationUnit } -func (o *PricePatch) GetTax() interface{} { +func (o *PricePatch) GetTax() any { if o == nil { return nil } @@ -546,7 +434,7 @@ func (o *PricePatch) GetType() *PricePatchType { return o.Type } -func (o *PricePatch) GetUnit() *PricePatchUnit { +func (o *PricePatch) GetUnit() *string { if o == nil { return nil } diff --git a/internal/sdk/pkg/models/shared/pricetier.go b/internal/sdk/models/shared/pricetier.go similarity index 94% rename from internal/sdk/pkg/models/shared/pricetier.go rename to internal/sdk/models/shared/pricetier.go index 766929d..9e02446 100644 --- a/internal/sdk/pkg/models/shared/pricetier.go +++ b/internal/sdk/models/shared/pricetier.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasyapi.com). DO NOT EDIT. package shared diff --git a/internal/sdk/pkg/models/shared/pricetierdisplaymode.go b/internal/sdk/models/shared/pricetierdisplaymode.go similarity index 90% rename from internal/sdk/pkg/models/shared/pricetierdisplaymode.go rename to internal/sdk/models/shared/pricetierdisplaymode.go index 2a74647..bc05506 100644 --- a/internal/sdk/pkg/models/shared/pricetierdisplaymode.go +++ b/internal/sdk/models/shared/pricetierdisplaymode.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasyapi.com). DO NOT EDIT. package shared @@ -17,7 +17,6 @@ const ( func (e PriceTierDisplayMode) ToPointer() *PriceTierDisplayMode { return &e } - func (e *PriceTierDisplayMode) UnmarshalJSON(data []byte) error { var v string if err := json.Unmarshal(data, &v); err != nil { diff --git a/internal/sdk/pkg/models/shared/product.go b/internal/sdk/models/shared/product.go similarity index 84% rename from internal/sdk/pkg/models/shared/product.go rename to internal/sdk/models/shared/product.go index 5574ea6..b3fd4d1 100644 --- a/internal/sdk/pkg/models/shared/product.go +++ b/internal/sdk/models/shared/product.go @@ -1,11 +1,11 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasyapi.com). DO NOT EDIT. package shared import ( "encoding/json" "fmt" - "github.com/epilot-dev/terraform-provider-epilot-product/internal/sdk/pkg/utils" + "github.com/epilot-dev/terraform-provider-epilot-product/internal/sdk/internal/utils" ) // ProductType - The type of Product: @@ -24,7 +24,6 @@ const ( func (e ProductType) ToPointer() *ProductType { return &e } - func (e *ProductType) UnmarshalJSON(data []byte) error { var v string if err := json.Unmarshal(data, &v); err != nil { @@ -47,15 +46,15 @@ type Product struct { // The product code Code *string `json:"code,omitempty"` // A description of the product. Multi-line supported. - Description *string `json:"description,omitempty"` - Feature []interface{} `json:"feature,omitempty"` + Description *string `json:"description,omitempty"` + Feature []any `json:"feature,omitempty"` // Not visible to customers, only in internal tables InternalName *string `json:"internal_name,omitempty"` // The description for the product Name string `json:"name"` PriceOptions *BaseRelation `json:"price_options,omitempty"` - ProductDownloads interface{} `json:"product_downloads,omitempty"` - ProductImages interface{} `json:"product_images,omitempty"` + ProductDownloads any `json:"product_downloads,omitempty"` + ProductImages any `json:"product_images,omitempty"` // The type of Product: // // | type | description | @@ -105,7 +104,7 @@ func (o *Product) GetDescription() *string { return o.Description } -func (o *Product) GetFeature() []interface{} { +func (o *Product) GetFeature() []any { if o == nil { return nil } @@ -133,14 +132,14 @@ func (o *Product) GetPriceOptions() *BaseRelation { return o.PriceOptions } -func (o *Product) GetProductDownloads() interface{} { +func (o *Product) GetProductDownloads() any { if o == nil { return nil } return o.ProductDownloads } -func (o *Product) GetProductImages() interface{} { +func (o *Product) GetProductImages() any { if o == nil { return nil } diff --git a/internal/sdk/pkg/models/shared/productcreate.go b/internal/sdk/models/shared/productcreate.go similarity index 84% rename from internal/sdk/pkg/models/shared/productcreate.go rename to internal/sdk/models/shared/productcreate.go index 11b9be8..d490dce 100644 --- a/internal/sdk/pkg/models/shared/productcreate.go +++ b/internal/sdk/models/shared/productcreate.go @@ -1,11 +1,11 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasyapi.com). DO NOT EDIT. package shared import ( "encoding/json" "fmt" - "github.com/epilot-dev/terraform-provider-epilot-product/internal/sdk/pkg/utils" + "github.com/epilot-dev/terraform-provider-epilot-product/internal/sdk/internal/utils" ) // ProductCreateType - The type of Product: @@ -24,7 +24,6 @@ const ( func (e ProductCreateType) ToPointer() *ProductCreateType { return &e } - func (e *ProductCreateType) UnmarshalJSON(data []byte) error { var v string if err := json.Unmarshal(data, &v); err != nil { @@ -46,15 +45,15 @@ type ProductCreate struct { // The product code Code *string `json:"code,omitempty"` // A description of the product. Multi-line supported. - Description *string `json:"description,omitempty"` - Feature []interface{} `json:"feature,omitempty"` + Description *string `json:"description,omitempty"` + Feature []any `json:"feature,omitempty"` // Not visible to customers, only in internal tables InternalName *string `json:"internal_name,omitempty"` // The description for the product Name string `json:"name"` PriceOptions *BaseRelation `json:"price_options,omitempty"` - ProductDownloads interface{} `json:"product_downloads,omitempty"` - ProductImages interface{} `json:"product_images,omitempty"` + ProductDownloads any `json:"product_downloads,omitempty"` + ProductImages any `json:"product_images,omitempty"` // The type of Product: // // | type | description | @@ -97,7 +96,7 @@ func (o *ProductCreate) GetDescription() *string { return o.Description } -func (o *ProductCreate) GetFeature() []interface{} { +func (o *ProductCreate) GetFeature() []any { if o == nil { return nil } @@ -125,14 +124,14 @@ func (o *ProductCreate) GetPriceOptions() *BaseRelation { return o.PriceOptions } -func (o *ProductCreate) GetProductDownloads() interface{} { +func (o *ProductCreate) GetProductDownloads() any { if o == nil { return nil } return o.ProductDownloads } -func (o *ProductCreate) GetProductImages() interface{} { +func (o *ProductCreate) GetProductImages() any { if o == nil { return nil } diff --git a/internal/sdk/pkg/models/shared/productpatch.go b/internal/sdk/models/shared/productpatch.go similarity index 84% rename from internal/sdk/pkg/models/shared/productpatch.go rename to internal/sdk/models/shared/productpatch.go index c1c00a2..9a62b51 100644 --- a/internal/sdk/pkg/models/shared/productpatch.go +++ b/internal/sdk/models/shared/productpatch.go @@ -1,11 +1,11 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasyapi.com). DO NOT EDIT. package shared import ( "encoding/json" "fmt" - "github.com/epilot-dev/terraform-provider-epilot-product/internal/sdk/pkg/utils" + "github.com/epilot-dev/terraform-provider-epilot-product/internal/sdk/internal/utils" ) // ProductPatchType - The type of Product: @@ -24,7 +24,6 @@ const ( func (e ProductPatchType) ToPointer() *ProductPatchType { return &e } - func (e *ProductPatchType) UnmarshalJSON(data []byte) error { var v string if err := json.Unmarshal(data, &v); err != nil { @@ -46,15 +45,15 @@ type ProductPatch struct { // The product code Code *string `json:"code,omitempty"` // A description of the product. Multi-line supported. - Description *string `json:"description,omitempty"` - Feature []interface{} `json:"feature,omitempty"` + Description *string `json:"description,omitempty"` + Feature []any `json:"feature,omitempty"` // Not visible to customers, only in internal tables InternalName *string `json:"internal_name,omitempty"` // The description for the product Name *string `json:"name,omitempty"` PriceOptions *BaseRelation `json:"price_options,omitempty"` - ProductDownloads interface{} `json:"product_downloads,omitempty"` - ProductImages interface{} `json:"product_images,omitempty"` + ProductDownloads any `json:"product_downloads,omitempty"` + ProductImages any `json:"product_images,omitempty"` // The type of Product: // // | type | description | @@ -97,7 +96,7 @@ func (o *ProductPatch) GetDescription() *string { return o.Description } -func (o *ProductPatch) GetFeature() []interface{} { +func (o *ProductPatch) GetFeature() []any { if o == nil { return nil } @@ -125,14 +124,14 @@ func (o *ProductPatch) GetPriceOptions() *BaseRelation { return o.PriceOptions } -func (o *ProductPatch) GetProductDownloads() interface{} { +func (o *ProductPatch) GetProductDownloads() any { if o == nil { return nil } return o.ProductDownloads } -func (o *ProductPatch) GetProductImages() interface{} { +func (o *ProductPatch) GetProductImages() any { if o == nil { return nil } diff --git a/internal/sdk/pkg/models/shared/security.go b/internal/sdk/models/shared/security.go similarity index 86% rename from internal/sdk/pkg/models/shared/security.go rename to internal/sdk/models/shared/security.go index 76201a4..91dc71a 100644 --- a/internal/sdk/pkg/models/shared/security.go +++ b/internal/sdk/models/shared/security.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasyapi.com). DO NOT EDIT. package shared diff --git a/internal/sdk/pkg/models/shared/servererror.go b/internal/sdk/models/shared/servererror.go similarity index 82% rename from internal/sdk/pkg/models/shared/servererror.go rename to internal/sdk/models/shared/servererror.go index 9658064..07202f8 100644 --- a/internal/sdk/pkg/models/shared/servererror.go +++ b/internal/sdk/models/shared/servererror.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasyapi.com). DO NOT EDIT. package shared diff --git a/internal/sdk/pkg/models/shared/tax.go b/internal/sdk/models/shared/tax.go similarity index 96% rename from internal/sdk/pkg/models/shared/tax.go rename to internal/sdk/models/shared/tax.go index bfc9d7a..20401f6 100644 --- a/internal/sdk/pkg/models/shared/tax.go +++ b/internal/sdk/models/shared/tax.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasyapi.com). DO NOT EDIT. package shared @@ -18,7 +18,6 @@ const ( func (e Region) ToPointer() *Region { return &e } - func (e *Region) UnmarshalJSON(data []byte) error { var v string if err := json.Unmarshal(data, &v); err != nil { @@ -47,7 +46,6 @@ const ( func (e TaxType) ToPointer() *TaxType { return &e } - func (e *TaxType) UnmarshalJSON(data []byte) error { var v string if err := json.Unmarshal(data, &v); err != nil { diff --git a/internal/sdk/pkg/models/shared/taxcreate.go b/internal/sdk/models/shared/taxcreate.go similarity index 96% rename from internal/sdk/pkg/models/shared/taxcreate.go rename to internal/sdk/models/shared/taxcreate.go index 896a4ba..51c8187 100644 --- a/internal/sdk/pkg/models/shared/taxcreate.go +++ b/internal/sdk/models/shared/taxcreate.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasyapi.com). DO NOT EDIT. package shared @@ -18,7 +18,6 @@ const ( func (e TaxCreateRegion) ToPointer() *TaxCreateRegion { return &e } - func (e *TaxCreateRegion) UnmarshalJSON(data []byte) error { var v string if err := json.Unmarshal(data, &v); err != nil { @@ -47,7 +46,6 @@ const ( func (e TaxCreateType) ToPointer() *TaxCreateType { return &e } - func (e *TaxCreateType) UnmarshalJSON(data []byte) error { var v string if err := json.Unmarshal(data, &v); err != nil { diff --git a/internal/sdk/pkg/models/shared/taxpatch.go b/internal/sdk/models/shared/taxpatch.go similarity index 96% rename from internal/sdk/pkg/models/shared/taxpatch.go rename to internal/sdk/models/shared/taxpatch.go index f172624..d87136e 100644 --- a/internal/sdk/pkg/models/shared/taxpatch.go +++ b/internal/sdk/models/shared/taxpatch.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasyapi.com). DO NOT EDIT. package shared @@ -18,7 +18,6 @@ const ( func (e TaxPatchRegion) ToPointer() *TaxPatchRegion { return &e } - func (e *TaxPatchRegion) UnmarshalJSON(data []byte) error { var v string if err := json.Unmarshal(data, &v); err != nil { @@ -47,7 +46,6 @@ const ( func (e TaxPatchType) ToPointer() *TaxPatchType { return &e } - func (e *TaxPatchType) UnmarshalJSON(data []byte) error { var v string if err := json.Unmarshal(data, &v); err != nil { diff --git a/internal/sdk/pkg/utils/queryparams.go b/internal/sdk/pkg/utils/queryparams.go deleted file mode 100644 index 0e94bce..0000000 --- a/internal/sdk/pkg/utils/queryparams.go +++ /dev/null @@ -1,178 +0,0 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. - -package utils - -import ( - "context" - "encoding/json" - "fmt" - "net/http" - "net/url" - "reflect" -) - -func PopulateQueryParams(ctx context.Context, req *http.Request, queryParams interface{}, globals map[string]map[string]map[string]interface{}) error { - queryParamsStructType := reflect.TypeOf(queryParams) - queryParamsValType := reflect.ValueOf(queryParams) - - values := url.Values{} - - for i := 0; i < queryParamsStructType.NumField(); i++ { - fieldType := queryParamsStructType.Field(i) - valType := queryParamsValType.Field(i) - - requestTag := getRequestTag(fieldType) - if requestTag != nil { - continue - } - - qpTag := parseQueryParamTag(fieldType) - if qpTag == nil { - continue - } - - valType = populateFromGlobals(fieldType, valType, "queryParam", globals) - - if qpTag.Serialization != "" { - vals, err := populateSerializedParams(qpTag, fieldType.Type, valType) - if err != nil { - return err - } - for k, v := range vals { - values.Add(k, v) - } - } else { - switch qpTag.Style { - case "deepObject": - vals := populateDeepObjectParams(req, qpTag, fieldType.Type, valType) - for k, v := range vals { - for _, vv := range v { - values.Add(k, vv) - } - } - case "form": - vals := populateFormParams(req, qpTag, fieldType.Type, valType, ",") - for k, v := range vals { - for _, vv := range v { - values.Add(k, vv) - } - } - case "pipeDelimited": - vals := populateFormParams(req, qpTag, fieldType.Type, valType, "|") - for k, v := range vals { - for _, vv := range v { - values.Add(k, vv) - } - } - default: - return fmt.Errorf("unsupported style: %s", qpTag.Style) - } - } - } - - req.URL.RawQuery = values.Encode() - - return nil -} - -func populateSerializedParams(tag *paramTag, objType reflect.Type, objValue reflect.Value) (map[string]string, error) { - if isNil(objType, objValue) { - return nil, nil - } - - if objType.Kind() == reflect.Pointer { - objValue = objValue.Elem() - } - - values := map[string]string{} - - switch tag.Serialization { - case "json": - data, err := json.Marshal(objValue.Interface()) - if err != nil { - return nil, fmt.Errorf("error marshaling json: %v", err) - } - values[tag.ParamName] = string(data) - } - - return values, nil -} - -func populateDeepObjectParams(req *http.Request, tag *paramTag, objType reflect.Type, objValue reflect.Value) url.Values { - values := url.Values{} - - if isNil(objType, objValue) { - return values - } - - if objType.Kind() == reflect.Pointer { - objType = objType.Elem() - objValue = objValue.Elem() - } - - switch objType.Kind() { - case reflect.Struct: - for i := 0; i < objType.NumField(); i++ { - fieldType := objType.Field(i) - valType := objValue.Field(i) - - if isNil(fieldType.Type, valType) { - continue - } - - if fieldType.Type.Kind() == reflect.Pointer { - valType = valType.Elem() - } - - qpTag := parseQueryParamTag(fieldType) - if qpTag == nil { - continue - } - - switch valType.Kind() { - case reflect.Array, reflect.Slice: - for i := 0; i < valType.Len(); i++ { - values.Add(fmt.Sprintf("%s[%s]", tag.ParamName, qpTag.ParamName), valToString(valType.Index(i).Interface())) - } - default: - values.Add(fmt.Sprintf("%s[%s]", tag.ParamName, qpTag.ParamName), valToString(valType.Interface())) - } - } - case reflect.Map: - iter := objValue.MapRange() - for iter.Next() { - switch iter.Value().Kind() { - case reflect.Array, reflect.Slice: - for i := 0; i < iter.Value().Len(); i++ { - values.Add(fmt.Sprintf("%s[%s]", tag.ParamName, iter.Key().String()), valToString(iter.Value().Index(i).Interface())) - } - default: - values.Add(fmt.Sprintf("%s[%s]", tag.ParamName, iter.Key().String()), valToString(iter.Value().Interface())) - } - } - } - - return values -} - -func populateFormParams(req *http.Request, tag *paramTag, objType reflect.Type, objValue reflect.Value, delimiter string) url.Values { - return populateForm(tag.ParamName, tag.Explode, objType, objValue, delimiter, func(fieldType reflect.StructField) string { - qpTag := parseQueryParamTag(fieldType) - if qpTag == nil { - return "" - } - - return qpTag.ParamName - }) -} - -type paramTag struct { - Style string - Explode bool - ParamName string - Serialization string -} - -func parseQueryParamTag(field reflect.StructField) *paramTag { - return parseParamTag(queryParamTagKey, field, "form", true) -} diff --git a/internal/sdk/price.go b/internal/sdk/price.go index f788d2c..7135912 100644 --- a/internal/sdk/price.go +++ b/internal/sdk/price.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasyapi.com). DO NOT EDIT. package sdk @@ -6,13 +6,14 @@ import ( "bytes" "context" "fmt" - "github.com/epilot-dev/terraform-provider-epilot-product/internal/sdk/pkg/models/operations" - "github.com/epilot-dev/terraform-provider-epilot-product/internal/sdk/pkg/models/sdkerrors" - "github.com/epilot-dev/terraform-provider-epilot-product/internal/sdk/pkg/models/shared" - "github.com/epilot-dev/terraform-provider-epilot-product/internal/sdk/pkg/utils" + "github.com/epilot-dev/terraform-provider-epilot-product/internal/sdk/internal/hooks" + "github.com/epilot-dev/terraform-provider-epilot-product/internal/sdk/internal/utils" + "github.com/epilot-dev/terraform-provider-epilot-product/internal/sdk/models/errors" + "github.com/epilot-dev/terraform-provider-epilot-product/internal/sdk/models/operations" + "github.com/epilot-dev/terraform-provider-epilot-product/internal/sdk/models/shared" "io" "net/http" - "strings" + "net/url" ) // Price operations @@ -28,59 +29,105 @@ func newPrice(sdkConfig sdkConfiguration) *Price { // CreatePrice - createPrice // Create a new price entity -func (s *Price) CreatePrice(ctx context.Context, request shared.PriceCreate) (*operations.CreatePriceResponse, error) { +func (s *Price) CreatePrice(ctx context.Context, request shared.PriceCreate, opts ...operations.Option) (*operations.CreatePriceResponse, error) { + hookCtx := hooks.HookContext{ + Context: ctx, + OperationID: "createPrice", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, + } + + o := operations.Options{} + supportedOptions := []string{ + operations.SupportedOptionTimeout, + } + + for _, opt := range opts { + if err := opt(&o, supportedOptions...); err != nil { + return nil, fmt.Errorf("error applying option: %w", err) + } + } + baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - url := strings.TrimSuffix(baseURL, "/") + "/v1/price" + opURL, err := url.JoinPath(baseURL, "/v1/price") + if err != nil { + return nil, fmt.Errorf("error generating URL: %w", err) + } bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "Request", "json", `request:"mediaType=application/json"`) if err != nil { - return nil, fmt.Errorf("error serializing request body: %w", err) + return nil, err } - if bodyReader == nil { - return nil, fmt.Errorf("request body is required") + + timeout := o.Timeout + if timeout == nil { + timeout = s.sdkConfiguration.Timeout } - debugBody := bytes.NewBuffer([]byte{}) - debugReader := io.TeeReader(bodyReader, debugBody) + if timeout != nil { + var cancel context.CancelFunc + ctx, cancel = context.WithTimeout(ctx, *timeout) + defer cancel() + } - req, err := http.NewRequestWithContext(ctx, "POST", url, debugReader) + req, err := http.NewRequestWithContext(ctx, "POST", opURL, bodyReader) if err != nil { return nil, fmt.Errorf("error creating request: %w", err) } req.Header.Set("Accept", "application/json") - req.Header.Set("user-agent", s.sdkConfiguration.UserAgent) - + req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) req.Header.Set("Content-Type", reqContentType) - client := s.sdkConfiguration.SecurityClient + if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { + return nil, err + } - httpRes, err := client.Do(req) + req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { - return nil, fmt.Errorf("error sending request: %w", err) + return nil, err } - if httpRes == nil { - return nil, fmt.Errorf("error sending request: no response") + + httpRes, err := s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + return nil, err + } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { + _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + if err != nil { + return nil, err + } else if _httpRes != nil { + httpRes = _httpRes + } + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } + } + + res := &operations.CreatePriceResponse{ + StatusCode: httpRes.StatusCode, + ContentType: httpRes.Header.Get("Content-Type"), + RawResponse: httpRes, } rawBody, err := io.ReadAll(httpRes.Body) if err != nil { return nil, fmt.Errorf("error reading response body: %w", err) } - httpRes.Request.Body = io.NopCloser(debugBody) httpRes.Body.Close() httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) - contentType := httpRes.Header.Get("Content-Type") - - res := &operations.CreatePriceResponse{ - StatusCode: httpRes.StatusCode, - ContentType: contentType, - RawResponse: httpRes, - } switch { case httpRes.StatusCode == 200: switch { - case utils.MatchContentType(contentType, `application/json`): + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): var out shared.Price if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err @@ -88,11 +135,11 @@ func (s *Price) CreatePrice(ctx context.Context, request shared.PriceCreate) (*o res.Price = &out default: - return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) + return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode == 400: switch { - case utils.MatchContentType(contentType, `application/json`): + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): var out shared.ClientError if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err @@ -100,11 +147,11 @@ func (s *Price) CreatePrice(ctx context.Context, request shared.PriceCreate) (*o res.ClientError = &out default: - return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) + return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode == 500: switch { - case utils.MatchContentType(contentType, `application/json`): + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): var out shared.ServerError if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err @@ -112,37 +159,98 @@ func (s *Price) CreatePrice(ctx context.Context, request shared.PriceCreate) (*o res.ServerError = &out default: - return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) + return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } + default: + return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) } return res, nil + } // DeletePrice - deletePrice // Delete a specific price entity by a given id -func (s *Price) DeletePrice(ctx context.Context, request operations.DeletePriceRequest) (*operations.DeletePriceResponse, error) { +func (s *Price) DeletePrice(ctx context.Context, request operations.DeletePriceRequest, opts ...operations.Option) (*operations.DeletePriceResponse, error) { + hookCtx := hooks.HookContext{ + Context: ctx, + OperationID: "deletePrice", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, + } + + o := operations.Options{} + supportedOptions := []string{ + operations.SupportedOptionTimeout, + } + + for _, opt := range opts { + if err := opt(&o, supportedOptions...); err != nil { + return nil, fmt.Errorf("error applying option: %w", err) + } + } + baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - url, err := utils.GenerateURL(ctx, baseURL, "/v1/price/{priceId}", request, nil) + opURL, err := utils.GenerateURL(ctx, baseURL, "/v1/price/{priceId}", request, nil) if err != nil { return nil, fmt.Errorf("error generating URL: %w", err) } - req, err := http.NewRequestWithContext(ctx, "DELETE", url, nil) + timeout := o.Timeout + if timeout == nil { + timeout = s.sdkConfiguration.Timeout + } + + if timeout != nil { + var cancel context.CancelFunc + ctx, cancel = context.WithTimeout(ctx, *timeout) + defer cancel() + } + + req, err := http.NewRequestWithContext(ctx, "DELETE", opURL, nil) if err != nil { return nil, fmt.Errorf("error creating request: %w", err) } req.Header.Set("Accept", "application/json") - req.Header.Set("user-agent", s.sdkConfiguration.UserAgent) + req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - client := s.sdkConfiguration.SecurityClient + if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { + return nil, err + } - httpRes, err := client.Do(req) + req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { - return nil, fmt.Errorf("error sending request: %w", err) + return nil, err + } + + httpRes, err := s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + return nil, err + } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { + _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + if err != nil { + return nil, err + } else if _httpRes != nil { + httpRes = _httpRes + } + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } } - if httpRes == nil { - return nil, fmt.Errorf("error sending request: no response") + + res := &operations.DeletePriceResponse{ + StatusCode: httpRes.StatusCode, + ContentType: httpRes.Header.Get("Content-Type"), + RawResponse: httpRes, } rawBody, err := io.ReadAll(httpRes.Body) @@ -152,17 +260,10 @@ func (s *Price) DeletePrice(ctx context.Context, request operations.DeletePriceR httpRes.Body.Close() httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) - contentType := httpRes.Header.Get("Content-Type") - - res := &operations.DeletePriceResponse{ - StatusCode: httpRes.StatusCode, - ContentType: contentType, - RawResponse: httpRes, - } switch { case httpRes.StatusCode == 200: switch { - case utils.MatchContentType(contentType, `application/json`): + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): var out shared.Price if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err @@ -170,11 +271,11 @@ func (s *Price) DeletePrice(ctx context.Context, request operations.DeletePriceR res.Price = &out default: - return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) + return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode == 400: switch { - case utils.MatchContentType(contentType, `application/json`): + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): var out shared.ClientError if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err @@ -182,11 +283,11 @@ func (s *Price) DeletePrice(ctx context.Context, request operations.DeletePriceR res.ClientError = &out default: - return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) + return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode == 500: switch { - case utils.MatchContentType(contentType, `application/json`): + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): var out shared.ServerError if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err @@ -194,41 +295,102 @@ func (s *Price) DeletePrice(ctx context.Context, request operations.DeletePriceR res.ServerError = &out default: - return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) + return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } + default: + return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) } return res, nil + } // GetPrice - getPrice // Read a specific price entity by a given id -func (s *Price) GetPrice(ctx context.Context, request operations.GetPriceRequest) (*operations.GetPriceResponse, error) { +func (s *Price) GetPrice(ctx context.Context, request operations.GetPriceRequest, opts ...operations.Option) (*operations.GetPriceResponse, error) { + hookCtx := hooks.HookContext{ + Context: ctx, + OperationID: "getPrice", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, + } + + o := operations.Options{} + supportedOptions := []string{ + operations.SupportedOptionTimeout, + } + + for _, opt := range opts { + if err := opt(&o, supportedOptions...); err != nil { + return nil, fmt.Errorf("error applying option: %w", err) + } + } + baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - url, err := utils.GenerateURL(ctx, baseURL, "/v1/price/{priceId}", request, nil) + opURL, err := utils.GenerateURL(ctx, baseURL, "/v1/price/{priceId}", request, nil) if err != nil { return nil, fmt.Errorf("error generating URL: %w", err) } - req, err := http.NewRequestWithContext(ctx, "GET", url, nil) + timeout := o.Timeout + if timeout == nil { + timeout = s.sdkConfiguration.Timeout + } + + if timeout != nil { + var cancel context.CancelFunc + ctx, cancel = context.WithTimeout(ctx, *timeout) + defer cancel() + } + + req, err := http.NewRequestWithContext(ctx, "GET", opURL, nil) if err != nil { return nil, fmt.Errorf("error creating request: %w", err) } req.Header.Set("Accept", "application/json") - req.Header.Set("user-agent", s.sdkConfiguration.UserAgent) + req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) if err := utils.PopulateQueryParams(ctx, req, request, nil); err != nil { return nil, fmt.Errorf("error populating query params: %w", err) } - client := s.sdkConfiguration.SecurityClient + if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { + return nil, err + } - httpRes, err := client.Do(req) + req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { - return nil, fmt.Errorf("error sending request: %w", err) + return nil, err } - if httpRes == nil { - return nil, fmt.Errorf("error sending request: no response") + + httpRes, err := s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + return nil, err + } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { + _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + if err != nil { + return nil, err + } else if _httpRes != nil { + httpRes = _httpRes + } + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } + } + + res := &operations.GetPriceResponse{ + StatusCode: httpRes.StatusCode, + ContentType: httpRes.Header.Get("Content-Type"), + RawResponse: httpRes, } rawBody, err := io.ReadAll(httpRes.Body) @@ -238,17 +400,10 @@ func (s *Price) GetPrice(ctx context.Context, request operations.GetPriceRequest httpRes.Body.Close() httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) - contentType := httpRes.Header.Get("Content-Type") - - res := &operations.GetPriceResponse{ - StatusCode: httpRes.StatusCode, - ContentType: contentType, - RawResponse: httpRes, - } switch { case httpRes.StatusCode == 200: switch { - case utils.MatchContentType(contentType, `application/json`): + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): var out shared.Price if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err @@ -256,11 +411,11 @@ func (s *Price) GetPrice(ctx context.Context, request operations.GetPriceRequest res.Price = &out default: - return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) + return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode == 400: switch { - case utils.MatchContentType(contentType, `application/json`): + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): var out shared.ClientError if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err @@ -268,11 +423,11 @@ func (s *Price) GetPrice(ctx context.Context, request operations.GetPriceRequest res.ClientError = &out default: - return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) + return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode == 500: switch { - case utils.MatchContentType(contentType, `application/json`): + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): var out shared.ServerError if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err @@ -280,71 +435,117 @@ func (s *Price) GetPrice(ctx context.Context, request operations.GetPriceRequest res.ServerError = &out default: - return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) + return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } + default: + return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) } return res, nil + } // PatchPrice - patchPrice // Partially update a specific price entity's properties by a given id and a given payload -func (s *Price) PatchPrice(ctx context.Context, request operations.PatchPriceRequest) (*operations.PatchPriceResponse, error) { +func (s *Price) PatchPrice(ctx context.Context, request operations.PatchPriceRequest, opts ...operations.Option) (*operations.PatchPriceResponse, error) { + hookCtx := hooks.HookContext{ + Context: ctx, + OperationID: "patchPrice", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, + } + + o := operations.Options{} + supportedOptions := []string{ + operations.SupportedOptionTimeout, + } + + for _, opt := range opts { + if err := opt(&o, supportedOptions...); err != nil { + return nil, fmt.Errorf("error applying option: %w", err) + } + } + baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - url, err := utils.GenerateURL(ctx, baseURL, "/v1/price/{priceId}", request, nil) + opURL, err := utils.GenerateURL(ctx, baseURL, "/v1/price/{priceId}", request, nil) if err != nil { return nil, fmt.Errorf("error generating URL: %w", err) } bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "PricePatch", "json", `request:"mediaType=application/json"`) if err != nil { - return nil, fmt.Errorf("error serializing request body: %w", err) + return nil, err } - if bodyReader == nil { - return nil, fmt.Errorf("request body is required") + + timeout := o.Timeout + if timeout == nil { + timeout = s.sdkConfiguration.Timeout } - debugBody := bytes.NewBuffer([]byte{}) - debugReader := io.TeeReader(bodyReader, debugBody) + if timeout != nil { + var cancel context.CancelFunc + ctx, cancel = context.WithTimeout(ctx, *timeout) + defer cancel() + } - req, err := http.NewRequestWithContext(ctx, "PATCH", url, debugReader) + req, err := http.NewRequestWithContext(ctx, "PATCH", opURL, bodyReader) if err != nil { return nil, fmt.Errorf("error creating request: %w", err) } req.Header.Set("Accept", "application/json") - req.Header.Set("user-agent", s.sdkConfiguration.UserAgent) - + req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) req.Header.Set("Content-Type", reqContentType) - client := s.sdkConfiguration.SecurityClient + if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { + return nil, err + } - httpRes, err := client.Do(req) + req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { - return nil, fmt.Errorf("error sending request: %w", err) + return nil, err } - if httpRes == nil { - return nil, fmt.Errorf("error sending request: no response") + + httpRes, err := s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + return nil, err + } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { + _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + if err != nil { + return nil, err + } else if _httpRes != nil { + httpRes = _httpRes + } + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } + } + + res := &operations.PatchPriceResponse{ + StatusCode: httpRes.StatusCode, + ContentType: httpRes.Header.Get("Content-Type"), + RawResponse: httpRes, } rawBody, err := io.ReadAll(httpRes.Body) if err != nil { return nil, fmt.Errorf("error reading response body: %w", err) } - httpRes.Request.Body = io.NopCloser(debugBody) httpRes.Body.Close() httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) - contentType := httpRes.Header.Get("Content-Type") - - res := &operations.PatchPriceResponse{ - StatusCode: httpRes.StatusCode, - ContentType: contentType, - RawResponse: httpRes, - } switch { case httpRes.StatusCode == 200: switch { - case utils.MatchContentType(contentType, `application/json`): + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): var out shared.Price if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err @@ -352,11 +553,11 @@ func (s *Price) PatchPrice(ctx context.Context, request operations.PatchPriceReq res.Price = &out default: - return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) + return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode == 400: switch { - case utils.MatchContentType(contentType, `application/json`): + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): var out shared.ClientError if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err @@ -364,11 +565,11 @@ func (s *Price) PatchPrice(ctx context.Context, request operations.PatchPriceReq res.ClientError = &out default: - return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) + return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode == 500: switch { - case utils.MatchContentType(contentType, `application/json`): + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): var out shared.ServerError if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err @@ -376,71 +577,117 @@ func (s *Price) PatchPrice(ctx context.Context, request operations.PatchPriceReq res.ServerError = &out default: - return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) + return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } + default: + return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) } return res, nil + } // UpdatePrice - updatePrice // Completly replace a specific tax entity's properties by a given id and given payload -func (s *Price) UpdatePrice(ctx context.Context, request operations.UpdatePriceRequest) (*operations.UpdatePriceResponse, error) { +func (s *Price) UpdatePrice(ctx context.Context, request operations.UpdatePriceRequest, opts ...operations.Option) (*operations.UpdatePriceResponse, error) { + hookCtx := hooks.HookContext{ + Context: ctx, + OperationID: "updatePrice", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, + } + + o := operations.Options{} + supportedOptions := []string{ + operations.SupportedOptionTimeout, + } + + for _, opt := range opts { + if err := opt(&o, supportedOptions...); err != nil { + return nil, fmt.Errorf("error applying option: %w", err) + } + } + baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - url, err := utils.GenerateURL(ctx, baseURL, "/v1/price/{priceId}", request, nil) + opURL, err := utils.GenerateURL(ctx, baseURL, "/v1/price/{priceId}", request, nil) if err != nil { return nil, fmt.Errorf("error generating URL: %w", err) } bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "PriceCreate", "json", `request:"mediaType=application/json"`) if err != nil { - return nil, fmt.Errorf("error serializing request body: %w", err) + return nil, err } - if bodyReader == nil { - return nil, fmt.Errorf("request body is required") + + timeout := o.Timeout + if timeout == nil { + timeout = s.sdkConfiguration.Timeout } - debugBody := bytes.NewBuffer([]byte{}) - debugReader := io.TeeReader(bodyReader, debugBody) + if timeout != nil { + var cancel context.CancelFunc + ctx, cancel = context.WithTimeout(ctx, *timeout) + defer cancel() + } - req, err := http.NewRequestWithContext(ctx, "PUT", url, debugReader) + req, err := http.NewRequestWithContext(ctx, "PUT", opURL, bodyReader) if err != nil { return nil, fmt.Errorf("error creating request: %w", err) } req.Header.Set("Accept", "application/json") - req.Header.Set("user-agent", s.sdkConfiguration.UserAgent) - + req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) req.Header.Set("Content-Type", reqContentType) - client := s.sdkConfiguration.SecurityClient + if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { + return nil, err + } - httpRes, err := client.Do(req) + req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { - return nil, fmt.Errorf("error sending request: %w", err) + return nil, err } - if httpRes == nil { - return nil, fmt.Errorf("error sending request: no response") + + httpRes, err := s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + return nil, err + } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { + _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + if err != nil { + return nil, err + } else if _httpRes != nil { + httpRes = _httpRes + } + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } + } + + res := &operations.UpdatePriceResponse{ + StatusCode: httpRes.StatusCode, + ContentType: httpRes.Header.Get("Content-Type"), + RawResponse: httpRes, } rawBody, err := io.ReadAll(httpRes.Body) if err != nil { return nil, fmt.Errorf("error reading response body: %w", err) } - httpRes.Request.Body = io.NopCloser(debugBody) httpRes.Body.Close() httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) - contentType := httpRes.Header.Get("Content-Type") - - res := &operations.UpdatePriceResponse{ - StatusCode: httpRes.StatusCode, - ContentType: contentType, - RawResponse: httpRes, - } switch { case httpRes.StatusCode == 200: switch { - case utils.MatchContentType(contentType, `application/json`): + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): var out shared.Price if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err @@ -448,11 +695,11 @@ func (s *Price) UpdatePrice(ctx context.Context, request operations.UpdatePriceR res.Price = &out default: - return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) + return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode == 400: switch { - case utils.MatchContentType(contentType, `application/json`): + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): var out shared.ClientError if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err @@ -460,11 +707,11 @@ func (s *Price) UpdatePrice(ctx context.Context, request operations.UpdatePriceR res.ClientError = &out default: - return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) + return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode == 500: switch { - case utils.MatchContentType(contentType, `application/json`): + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): var out shared.ServerError if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err @@ -472,9 +719,12 @@ func (s *Price) UpdatePrice(ctx context.Context, request operations.UpdatePriceR res.ServerError = &out default: - return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) + return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } + default: + return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) } return res, nil + } diff --git a/internal/sdk/product.go b/internal/sdk/product.go index a5921a9..dbd7487 100644 --- a/internal/sdk/product.go +++ b/internal/sdk/product.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasyapi.com). DO NOT EDIT. package sdk @@ -6,13 +6,14 @@ import ( "bytes" "context" "fmt" - "github.com/epilot-dev/terraform-provider-epilot-product/internal/sdk/pkg/models/operations" - "github.com/epilot-dev/terraform-provider-epilot-product/internal/sdk/pkg/models/sdkerrors" - "github.com/epilot-dev/terraform-provider-epilot-product/internal/sdk/pkg/models/shared" - "github.com/epilot-dev/terraform-provider-epilot-product/internal/sdk/pkg/utils" + "github.com/epilot-dev/terraform-provider-epilot-product/internal/sdk/internal/hooks" + "github.com/epilot-dev/terraform-provider-epilot-product/internal/sdk/internal/utils" + "github.com/epilot-dev/terraform-provider-epilot-product/internal/sdk/models/errors" + "github.com/epilot-dev/terraform-provider-epilot-product/internal/sdk/models/operations" + "github.com/epilot-dev/terraform-provider-epilot-product/internal/sdk/models/shared" "io" "net/http" - "strings" + "net/url" ) // Product operations @@ -28,59 +29,105 @@ func newProduct(sdkConfig sdkConfiguration) *Product { // CreateProduct - createProduct // Create a new product entity -func (s *Product) CreateProduct(ctx context.Context, request shared.ProductCreate) (*operations.CreateProductResponse, error) { +func (s *Product) CreateProduct(ctx context.Context, request shared.ProductCreate, opts ...operations.Option) (*operations.CreateProductResponse, error) { + hookCtx := hooks.HookContext{ + Context: ctx, + OperationID: "createProduct", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, + } + + o := operations.Options{} + supportedOptions := []string{ + operations.SupportedOptionTimeout, + } + + for _, opt := range opts { + if err := opt(&o, supportedOptions...); err != nil { + return nil, fmt.Errorf("error applying option: %w", err) + } + } + baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - url := strings.TrimSuffix(baseURL, "/") + "/v1/product" + opURL, err := url.JoinPath(baseURL, "/v1/product") + if err != nil { + return nil, fmt.Errorf("error generating URL: %w", err) + } bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "Request", "json", `request:"mediaType=application/json"`) if err != nil { - return nil, fmt.Errorf("error serializing request body: %w", err) + return nil, err } - if bodyReader == nil { - return nil, fmt.Errorf("request body is required") + + timeout := o.Timeout + if timeout == nil { + timeout = s.sdkConfiguration.Timeout } - debugBody := bytes.NewBuffer([]byte{}) - debugReader := io.TeeReader(bodyReader, debugBody) + if timeout != nil { + var cancel context.CancelFunc + ctx, cancel = context.WithTimeout(ctx, *timeout) + defer cancel() + } - req, err := http.NewRequestWithContext(ctx, "POST", url, debugReader) + req, err := http.NewRequestWithContext(ctx, "POST", opURL, bodyReader) if err != nil { return nil, fmt.Errorf("error creating request: %w", err) } req.Header.Set("Accept", "application/json") - req.Header.Set("user-agent", s.sdkConfiguration.UserAgent) - + req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) req.Header.Set("Content-Type", reqContentType) - client := s.sdkConfiguration.SecurityClient + if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { + return nil, err + } - httpRes, err := client.Do(req) + req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { - return nil, fmt.Errorf("error sending request: %w", err) + return nil, err } - if httpRes == nil { - return nil, fmt.Errorf("error sending request: no response") + + httpRes, err := s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + return nil, err + } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { + _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + if err != nil { + return nil, err + } else if _httpRes != nil { + httpRes = _httpRes + } + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } + } + + res := &operations.CreateProductResponse{ + StatusCode: httpRes.StatusCode, + ContentType: httpRes.Header.Get("Content-Type"), + RawResponse: httpRes, } rawBody, err := io.ReadAll(httpRes.Body) if err != nil { return nil, fmt.Errorf("error reading response body: %w", err) } - httpRes.Request.Body = io.NopCloser(debugBody) httpRes.Body.Close() httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) - contentType := httpRes.Header.Get("Content-Type") - - res := &operations.CreateProductResponse{ - StatusCode: httpRes.StatusCode, - ContentType: contentType, - RawResponse: httpRes, - } switch { case httpRes.StatusCode == 200: switch { - case utils.MatchContentType(contentType, `application/json`): + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): var out shared.Product if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err @@ -88,11 +135,11 @@ func (s *Product) CreateProduct(ctx context.Context, request shared.ProductCreat res.Product = &out default: - return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) + return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode == 400: switch { - case utils.MatchContentType(contentType, `application/json`): + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): var out shared.ClientError if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err @@ -100,11 +147,11 @@ func (s *Product) CreateProduct(ctx context.Context, request shared.ProductCreat res.ClientError = &out default: - return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) + return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode == 500: switch { - case utils.MatchContentType(contentType, `application/json`): + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): var out shared.ServerError if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err @@ -112,37 +159,98 @@ func (s *Product) CreateProduct(ctx context.Context, request shared.ProductCreat res.ServerError = &out default: - return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) + return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } + default: + return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) } return res, nil + } // DeleteProduct - deleteProduct // Delete a specific product entity by a given id -func (s *Product) DeleteProduct(ctx context.Context, request operations.DeleteProductRequest) (*operations.DeleteProductResponse, error) { +func (s *Product) DeleteProduct(ctx context.Context, request operations.DeleteProductRequest, opts ...operations.Option) (*operations.DeleteProductResponse, error) { + hookCtx := hooks.HookContext{ + Context: ctx, + OperationID: "deleteProduct", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, + } + + o := operations.Options{} + supportedOptions := []string{ + operations.SupportedOptionTimeout, + } + + for _, opt := range opts { + if err := opt(&o, supportedOptions...); err != nil { + return nil, fmt.Errorf("error applying option: %w", err) + } + } + baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - url, err := utils.GenerateURL(ctx, baseURL, "/v1/product/{productId}", request, nil) + opURL, err := utils.GenerateURL(ctx, baseURL, "/v1/product/{productId}", request, nil) if err != nil { return nil, fmt.Errorf("error generating URL: %w", err) } - req, err := http.NewRequestWithContext(ctx, "DELETE", url, nil) + timeout := o.Timeout + if timeout == nil { + timeout = s.sdkConfiguration.Timeout + } + + if timeout != nil { + var cancel context.CancelFunc + ctx, cancel = context.WithTimeout(ctx, *timeout) + defer cancel() + } + + req, err := http.NewRequestWithContext(ctx, "DELETE", opURL, nil) if err != nil { return nil, fmt.Errorf("error creating request: %w", err) } req.Header.Set("Accept", "application/json") - req.Header.Set("user-agent", s.sdkConfiguration.UserAgent) + req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - client := s.sdkConfiguration.SecurityClient + if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { + return nil, err + } - httpRes, err := client.Do(req) + req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { - return nil, fmt.Errorf("error sending request: %w", err) + return nil, err + } + + httpRes, err := s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + return nil, err + } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { + _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + if err != nil { + return nil, err + } else if _httpRes != nil { + httpRes = _httpRes + } + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } } - if httpRes == nil { - return nil, fmt.Errorf("error sending request: no response") + + res := &operations.DeleteProductResponse{ + StatusCode: httpRes.StatusCode, + ContentType: httpRes.Header.Get("Content-Type"), + RawResponse: httpRes, } rawBody, err := io.ReadAll(httpRes.Body) @@ -152,17 +260,10 @@ func (s *Product) DeleteProduct(ctx context.Context, request operations.DeletePr httpRes.Body.Close() httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) - contentType := httpRes.Header.Get("Content-Type") - - res := &operations.DeleteProductResponse{ - StatusCode: httpRes.StatusCode, - ContentType: contentType, - RawResponse: httpRes, - } switch { case httpRes.StatusCode == 200: switch { - case utils.MatchContentType(contentType, `application/json`): + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): var out shared.Product if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err @@ -170,11 +271,11 @@ func (s *Product) DeleteProduct(ctx context.Context, request operations.DeletePr res.Product = &out default: - return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) + return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode == 400: switch { - case utils.MatchContentType(contentType, `application/json`): + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): var out shared.ClientError if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err @@ -182,11 +283,11 @@ func (s *Product) DeleteProduct(ctx context.Context, request operations.DeletePr res.ClientError = &out default: - return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) + return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode == 500: switch { - case utils.MatchContentType(contentType, `application/json`): + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): var out shared.ServerError if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err @@ -194,41 +295,102 @@ func (s *Product) DeleteProduct(ctx context.Context, request operations.DeletePr res.ServerError = &out default: - return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) + return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } + default: + return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) } return res, nil + } // GetProduct - getProduct // Read a specific product entity by a given id -func (s *Product) GetProduct(ctx context.Context, request operations.GetProductRequest) (*operations.GetProductResponse, error) { +func (s *Product) GetProduct(ctx context.Context, request operations.GetProductRequest, opts ...operations.Option) (*operations.GetProductResponse, error) { + hookCtx := hooks.HookContext{ + Context: ctx, + OperationID: "getProduct", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, + } + + o := operations.Options{} + supportedOptions := []string{ + operations.SupportedOptionTimeout, + } + + for _, opt := range opts { + if err := opt(&o, supportedOptions...); err != nil { + return nil, fmt.Errorf("error applying option: %w", err) + } + } + baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - url, err := utils.GenerateURL(ctx, baseURL, "/v1/product/{productId}", request, nil) + opURL, err := utils.GenerateURL(ctx, baseURL, "/v1/product/{productId}", request, nil) if err != nil { return nil, fmt.Errorf("error generating URL: %w", err) } - req, err := http.NewRequestWithContext(ctx, "GET", url, nil) + timeout := o.Timeout + if timeout == nil { + timeout = s.sdkConfiguration.Timeout + } + + if timeout != nil { + var cancel context.CancelFunc + ctx, cancel = context.WithTimeout(ctx, *timeout) + defer cancel() + } + + req, err := http.NewRequestWithContext(ctx, "GET", opURL, nil) if err != nil { return nil, fmt.Errorf("error creating request: %w", err) } req.Header.Set("Accept", "application/json") - req.Header.Set("user-agent", s.sdkConfiguration.UserAgent) + req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) if err := utils.PopulateQueryParams(ctx, req, request, nil); err != nil { return nil, fmt.Errorf("error populating query params: %w", err) } - client := s.sdkConfiguration.SecurityClient + if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { + return nil, err + } - httpRes, err := client.Do(req) + req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { - return nil, fmt.Errorf("error sending request: %w", err) + return nil, err } - if httpRes == nil { - return nil, fmt.Errorf("error sending request: no response") + + httpRes, err := s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + return nil, err + } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { + _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + if err != nil { + return nil, err + } else if _httpRes != nil { + httpRes = _httpRes + } + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } + } + + res := &operations.GetProductResponse{ + StatusCode: httpRes.StatusCode, + ContentType: httpRes.Header.Get("Content-Type"), + RawResponse: httpRes, } rawBody, err := io.ReadAll(httpRes.Body) @@ -238,17 +400,10 @@ func (s *Product) GetProduct(ctx context.Context, request operations.GetProductR httpRes.Body.Close() httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) - contentType := httpRes.Header.Get("Content-Type") - - res := &operations.GetProductResponse{ - StatusCode: httpRes.StatusCode, - ContentType: contentType, - RawResponse: httpRes, - } switch { case httpRes.StatusCode == 200: switch { - case utils.MatchContentType(contentType, `application/json`): + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): var out shared.Product if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err @@ -256,11 +411,11 @@ func (s *Product) GetProduct(ctx context.Context, request operations.GetProductR res.Product = &out default: - return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) + return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode == 400: switch { - case utils.MatchContentType(contentType, `application/json`): + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): var out shared.ClientError if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err @@ -268,11 +423,11 @@ func (s *Product) GetProduct(ctx context.Context, request operations.GetProductR res.ClientError = &out default: - return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) + return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode == 500: switch { - case utils.MatchContentType(contentType, `application/json`): + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): var out shared.ServerError if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err @@ -280,71 +435,117 @@ func (s *Product) GetProduct(ctx context.Context, request operations.GetProductR res.ServerError = &out default: - return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) + return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } + default: + return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) } return res, nil + } // PatchProduct - patchProduct // Partially update a specific product entity's properties by a given id and a given payload -func (s *Product) PatchProduct(ctx context.Context, request operations.PatchProductRequest) (*operations.PatchProductResponse, error) { +func (s *Product) PatchProduct(ctx context.Context, request operations.PatchProductRequest, opts ...operations.Option) (*operations.PatchProductResponse, error) { + hookCtx := hooks.HookContext{ + Context: ctx, + OperationID: "patchProduct", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, + } + + o := operations.Options{} + supportedOptions := []string{ + operations.SupportedOptionTimeout, + } + + for _, opt := range opts { + if err := opt(&o, supportedOptions...); err != nil { + return nil, fmt.Errorf("error applying option: %w", err) + } + } + baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - url, err := utils.GenerateURL(ctx, baseURL, "/v1/product/{productId}", request, nil) + opURL, err := utils.GenerateURL(ctx, baseURL, "/v1/product/{productId}", request, nil) if err != nil { return nil, fmt.Errorf("error generating URL: %w", err) } bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "ProductPatch", "json", `request:"mediaType=application/json"`) if err != nil { - return nil, fmt.Errorf("error serializing request body: %w", err) + return nil, err } - if bodyReader == nil { - return nil, fmt.Errorf("request body is required") + + timeout := o.Timeout + if timeout == nil { + timeout = s.sdkConfiguration.Timeout } - debugBody := bytes.NewBuffer([]byte{}) - debugReader := io.TeeReader(bodyReader, debugBody) + if timeout != nil { + var cancel context.CancelFunc + ctx, cancel = context.WithTimeout(ctx, *timeout) + defer cancel() + } - req, err := http.NewRequestWithContext(ctx, "PATCH", url, debugReader) + req, err := http.NewRequestWithContext(ctx, "PATCH", opURL, bodyReader) if err != nil { return nil, fmt.Errorf("error creating request: %w", err) } req.Header.Set("Accept", "application/json") - req.Header.Set("user-agent", s.sdkConfiguration.UserAgent) - + req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) req.Header.Set("Content-Type", reqContentType) - client := s.sdkConfiguration.SecurityClient + if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { + return nil, err + } - httpRes, err := client.Do(req) + req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { - return nil, fmt.Errorf("error sending request: %w", err) + return nil, err } - if httpRes == nil { - return nil, fmt.Errorf("error sending request: no response") + + httpRes, err := s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + return nil, err + } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { + _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + if err != nil { + return nil, err + } else if _httpRes != nil { + httpRes = _httpRes + } + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } + } + + res := &operations.PatchProductResponse{ + StatusCode: httpRes.StatusCode, + ContentType: httpRes.Header.Get("Content-Type"), + RawResponse: httpRes, } rawBody, err := io.ReadAll(httpRes.Body) if err != nil { return nil, fmt.Errorf("error reading response body: %w", err) } - httpRes.Request.Body = io.NopCloser(debugBody) httpRes.Body.Close() httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) - contentType := httpRes.Header.Get("Content-Type") - - res := &operations.PatchProductResponse{ - StatusCode: httpRes.StatusCode, - ContentType: contentType, - RawResponse: httpRes, - } switch { case httpRes.StatusCode == 200: switch { - case utils.MatchContentType(contentType, `application/json`): + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): var out shared.Product if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err @@ -352,11 +553,11 @@ func (s *Product) PatchProduct(ctx context.Context, request operations.PatchProd res.Product = &out default: - return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) + return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode == 400: switch { - case utils.MatchContentType(contentType, `application/json`): + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): var out shared.ClientError if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err @@ -364,11 +565,11 @@ func (s *Product) PatchProduct(ctx context.Context, request operations.PatchProd res.ClientError = &out default: - return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) + return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode == 500: switch { - case utils.MatchContentType(contentType, `application/json`): + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): var out shared.ServerError if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err @@ -376,71 +577,117 @@ func (s *Product) PatchProduct(ctx context.Context, request operations.PatchProd res.ServerError = &out default: - return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) + return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } + default: + return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) } return res, nil + } // UpdateProduct - updateProduct // Completly replace a specific product entity's properties by a given id and given payload -func (s *Product) UpdateProduct(ctx context.Context, request operations.UpdateProductRequest) (*operations.UpdateProductResponse, error) { +func (s *Product) UpdateProduct(ctx context.Context, request operations.UpdateProductRequest, opts ...operations.Option) (*operations.UpdateProductResponse, error) { + hookCtx := hooks.HookContext{ + Context: ctx, + OperationID: "updateProduct", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, + } + + o := operations.Options{} + supportedOptions := []string{ + operations.SupportedOptionTimeout, + } + + for _, opt := range opts { + if err := opt(&o, supportedOptions...); err != nil { + return nil, fmt.Errorf("error applying option: %w", err) + } + } + baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - url, err := utils.GenerateURL(ctx, baseURL, "/v1/product/{productId}", request, nil) + opURL, err := utils.GenerateURL(ctx, baseURL, "/v1/product/{productId}", request, nil) if err != nil { return nil, fmt.Errorf("error generating URL: %w", err) } bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "ProductCreate", "json", `request:"mediaType=application/json"`) if err != nil { - return nil, fmt.Errorf("error serializing request body: %w", err) + return nil, err } - if bodyReader == nil { - return nil, fmt.Errorf("request body is required") + + timeout := o.Timeout + if timeout == nil { + timeout = s.sdkConfiguration.Timeout } - debugBody := bytes.NewBuffer([]byte{}) - debugReader := io.TeeReader(bodyReader, debugBody) + if timeout != nil { + var cancel context.CancelFunc + ctx, cancel = context.WithTimeout(ctx, *timeout) + defer cancel() + } - req, err := http.NewRequestWithContext(ctx, "PUT", url, debugReader) + req, err := http.NewRequestWithContext(ctx, "PUT", opURL, bodyReader) if err != nil { return nil, fmt.Errorf("error creating request: %w", err) } req.Header.Set("Accept", "application/json") - req.Header.Set("user-agent", s.sdkConfiguration.UserAgent) - + req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) req.Header.Set("Content-Type", reqContentType) - client := s.sdkConfiguration.SecurityClient + if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { + return nil, err + } - httpRes, err := client.Do(req) + req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { - return nil, fmt.Errorf("error sending request: %w", err) + return nil, err } - if httpRes == nil { - return nil, fmt.Errorf("error sending request: no response") + + httpRes, err := s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + return nil, err + } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { + _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + if err != nil { + return nil, err + } else if _httpRes != nil { + httpRes = _httpRes + } + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } + } + + res := &operations.UpdateProductResponse{ + StatusCode: httpRes.StatusCode, + ContentType: httpRes.Header.Get("Content-Type"), + RawResponse: httpRes, } rawBody, err := io.ReadAll(httpRes.Body) if err != nil { return nil, fmt.Errorf("error reading response body: %w", err) } - httpRes.Request.Body = io.NopCloser(debugBody) httpRes.Body.Close() httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) - contentType := httpRes.Header.Get("Content-Type") - - res := &operations.UpdateProductResponse{ - StatusCode: httpRes.StatusCode, - ContentType: contentType, - RawResponse: httpRes, - } switch { case httpRes.StatusCode == 200: switch { - case utils.MatchContentType(contentType, `application/json`): + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): var out shared.Product if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err @@ -448,11 +695,11 @@ func (s *Product) UpdateProduct(ctx context.Context, request operations.UpdatePr res.Product = &out default: - return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) + return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode == 400: switch { - case utils.MatchContentType(contentType, `application/json`): + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): var out shared.ClientError if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err @@ -460,11 +707,11 @@ func (s *Product) UpdateProduct(ctx context.Context, request operations.UpdatePr res.ClientError = &out default: - return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) + return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode == 500: switch { - case utils.MatchContentType(contentType, `application/json`): + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): var out shared.ServerError if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err @@ -472,9 +719,12 @@ func (s *Product) UpdateProduct(ctx context.Context, request operations.UpdatePr res.ServerError = &out default: - return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) + return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } + default: + return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) } return res, nil + } diff --git a/internal/sdk/retry/config.go b/internal/sdk/retry/config.go new file mode 100644 index 0000000..a9b559b --- /dev/null +++ b/internal/sdk/retry/config.go @@ -0,0 +1,16 @@ +// Code generated by Speakeasy (https://speakeasyapi.com). DO NOT EDIT. + +package retry + +type BackoffStrategy struct { + InitialInterval int + MaxInterval int + Exponent float64 + MaxElapsedTime int +} + +type Config struct { + Strategy string + Backoff *BackoffStrategy + RetryConnectionErrors bool +} diff --git a/internal/sdk/sdk.go b/internal/sdk/sdk.go index 9a0e791..8f741a5 100644 --- a/internal/sdk/sdk.go +++ b/internal/sdk/sdk.go @@ -1,12 +1,14 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasyapi.com). DO NOT EDIT. package sdk import ( "context" "fmt" - "github.com/epilot-dev/terraform-provider-epilot-product/internal/sdk/pkg/models/shared" - "github.com/epilot-dev/terraform-provider-epilot-product/internal/sdk/pkg/utils" + "github.com/epilot-dev/terraform-provider-epilot-product/internal/sdk/internal/hooks" + "github.com/epilot-dev/terraform-provider-epilot-product/internal/sdk/internal/utils" + "github.com/epilot-dev/terraform-provider-epilot-product/internal/sdk/models/shared" + "github.com/epilot-dev/terraform-provider-epilot-product/internal/sdk/retry" "net/http" "time" ) @@ -41,8 +43,7 @@ func Float32(f float32) *float32 { return &f } func Float64(f float64) *float64 { return &f } type sdkConfiguration struct { - DefaultClient HTTPClient - SecurityClient HTTPClient + Client HTTPClient Security func(context.Context) (interface{}, error) ServerURL string ServerIndex int @@ -51,7 +52,9 @@ type sdkConfiguration struct { SDKVersion string GenVersion string UserAgent string - RetryConfig *utils.RetryConfig + RetryConfig *retry.Config + Hooks *hooks.Hooks + Timeout *time.Duration } func (c *sdkConfiguration) GetServerDetails() (string, map[string]string) { @@ -107,20 +110,14 @@ func WithServerIndex(serverIndex int) SDKOption { // WithClient allows the overriding of the default HTTP client used by the SDK func WithClient(client HTTPClient) SDKOption { return func(sdk *SDK) { - sdk.sdkConfiguration.DefaultClient = client - } -} - -func withSecurity(security interface{}) func(context.Context) (interface{}, error) { - return func(context.Context) (interface{}, error) { - return &security, nil + sdk.sdkConfiguration.Client = client } } // WithSecurity configures the SDK to use the provided security details func WithSecurity(security shared.Security) SDKOption { return func(sdk *SDK) { - sdk.sdkConfiguration.Security = withSecurity(security) + sdk.sdkConfiguration.Security = utils.AsSecuritySource(security) } } @@ -133,21 +130,29 @@ func WithSecuritySource(security func(context.Context) (shared.Security, error)) } } -func WithRetryConfig(retryConfig utils.RetryConfig) SDKOption { +func WithRetryConfig(retryConfig retry.Config) SDKOption { return func(sdk *SDK) { sdk.sdkConfiguration.RetryConfig = &retryConfig } } +// WithTimeout Optional request timeout applied to each operation +func WithTimeout(timeout time.Duration) SDKOption { + return func(sdk *SDK) { + sdk.sdkConfiguration.Timeout = &timeout + } +} + // New creates a new instance of the SDK with the provided options func New(opts ...SDKOption) *SDK { sdk := &SDK{ sdkConfiguration: sdkConfiguration{ Language: "go", OpenAPIDocVersion: "1.0.0", - SDKVersion: "0.6.0", - GenVersion: "2.230.1", - UserAgent: "speakeasy-sdk/go 0.6.0 2.230.1 1.0.0 epilot-product", + SDKVersion: "0.0.1", + GenVersion: "2.379.3", + UserAgent: "speakeasy-sdk/go 0.0.1 2.379.3 1.0.0 github.com/epilot-dev/terraform-provider-epilot-product/internal/sdk", + Hooks: hooks.New(), }, } for _, opt := range opts { @@ -155,15 +160,15 @@ func New(opts ...SDKOption) *SDK { } // Use WithClient to override the default client if you would like to customize the timeout - if sdk.sdkConfiguration.DefaultClient == nil { - sdk.sdkConfiguration.DefaultClient = &http.Client{Timeout: 60 * time.Second} + if sdk.sdkConfiguration.Client == nil { + sdk.sdkConfiguration.Client = &http.Client{Timeout: 60 * time.Second} } - if sdk.sdkConfiguration.SecurityClient == nil { - if sdk.sdkConfiguration.Security != nil { - sdk.sdkConfiguration.SecurityClient = utils.ConfigureSecurityClient(sdk.sdkConfiguration.DefaultClient, sdk.sdkConfiguration.Security) - } else { - sdk.sdkConfiguration.SecurityClient = sdk.sdkConfiguration.DefaultClient - } + + currentServerURL, _ := sdk.sdkConfiguration.GetServerDetails() + serverURL := currentServerURL + serverURL, sdk.sdkConfiguration.Client = sdk.sdkConfiguration.Hooks.SDKInit(currentServerURL, sdk.sdkConfiguration.Client) + if serverURL != currentServerURL { + sdk.sdkConfiguration.ServerURL = serverURL } sdk.Price = newPrice(sdk.sdkConfiguration) diff --git a/internal/sdk/tax.go b/internal/sdk/tax.go index 925295f..e3460e9 100644 --- a/internal/sdk/tax.go +++ b/internal/sdk/tax.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasyapi.com). DO NOT EDIT. package sdk @@ -6,13 +6,14 @@ import ( "bytes" "context" "fmt" - "github.com/epilot-dev/terraform-provider-epilot-product/internal/sdk/pkg/models/operations" - "github.com/epilot-dev/terraform-provider-epilot-product/internal/sdk/pkg/models/sdkerrors" - "github.com/epilot-dev/terraform-provider-epilot-product/internal/sdk/pkg/models/shared" - "github.com/epilot-dev/terraform-provider-epilot-product/internal/sdk/pkg/utils" + "github.com/epilot-dev/terraform-provider-epilot-product/internal/sdk/internal/hooks" + "github.com/epilot-dev/terraform-provider-epilot-product/internal/sdk/internal/utils" + "github.com/epilot-dev/terraform-provider-epilot-product/internal/sdk/models/errors" + "github.com/epilot-dev/terraform-provider-epilot-product/internal/sdk/models/operations" + "github.com/epilot-dev/terraform-provider-epilot-product/internal/sdk/models/shared" "io" "net/http" - "strings" + "net/url" ) // Tax operations @@ -28,59 +29,105 @@ func newTax(sdkConfig sdkConfiguration) *Tax { // CreateTax - createTax // Create a new tax entity -func (s *Tax) CreateTax(ctx context.Context, request shared.TaxCreate) (*operations.CreateTaxResponse, error) { +func (s *Tax) CreateTax(ctx context.Context, request shared.TaxCreate, opts ...operations.Option) (*operations.CreateTaxResponse, error) { + hookCtx := hooks.HookContext{ + Context: ctx, + OperationID: "createTax", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, + } + + o := operations.Options{} + supportedOptions := []string{ + operations.SupportedOptionTimeout, + } + + for _, opt := range opts { + if err := opt(&o, supportedOptions...); err != nil { + return nil, fmt.Errorf("error applying option: %w", err) + } + } + baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - url := strings.TrimSuffix(baseURL, "/") + "/v1/tax" + opURL, err := url.JoinPath(baseURL, "/v1/tax") + if err != nil { + return nil, fmt.Errorf("error generating URL: %w", err) + } bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "Request", "json", `request:"mediaType=application/json"`) if err != nil { - return nil, fmt.Errorf("error serializing request body: %w", err) + return nil, err } - if bodyReader == nil { - return nil, fmt.Errorf("request body is required") + + timeout := o.Timeout + if timeout == nil { + timeout = s.sdkConfiguration.Timeout } - debugBody := bytes.NewBuffer([]byte{}) - debugReader := io.TeeReader(bodyReader, debugBody) + if timeout != nil { + var cancel context.CancelFunc + ctx, cancel = context.WithTimeout(ctx, *timeout) + defer cancel() + } - req, err := http.NewRequestWithContext(ctx, "POST", url, debugReader) + req, err := http.NewRequestWithContext(ctx, "POST", opURL, bodyReader) if err != nil { return nil, fmt.Errorf("error creating request: %w", err) } req.Header.Set("Accept", "application/json") - req.Header.Set("user-agent", s.sdkConfiguration.UserAgent) - + req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) req.Header.Set("Content-Type", reqContentType) - client := s.sdkConfiguration.SecurityClient + if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { + return nil, err + } - httpRes, err := client.Do(req) + req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { - return nil, fmt.Errorf("error sending request: %w", err) + return nil, err } - if httpRes == nil { - return nil, fmt.Errorf("error sending request: no response") + + httpRes, err := s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + return nil, err + } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { + _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + if err != nil { + return nil, err + } else if _httpRes != nil { + httpRes = _httpRes + } + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } + } + + res := &operations.CreateTaxResponse{ + StatusCode: httpRes.StatusCode, + ContentType: httpRes.Header.Get("Content-Type"), + RawResponse: httpRes, } rawBody, err := io.ReadAll(httpRes.Body) if err != nil { return nil, fmt.Errorf("error reading response body: %w", err) } - httpRes.Request.Body = io.NopCloser(debugBody) httpRes.Body.Close() httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) - contentType := httpRes.Header.Get("Content-Type") - - res := &operations.CreateTaxResponse{ - StatusCode: httpRes.StatusCode, - ContentType: contentType, - RawResponse: httpRes, - } switch { case httpRes.StatusCode == 200: switch { - case utils.MatchContentType(contentType, `application/json`): + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): var out shared.Tax if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err @@ -88,11 +135,11 @@ func (s *Tax) CreateTax(ctx context.Context, request shared.TaxCreate) (*operati res.Tax = &out default: - return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) + return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode == 400: switch { - case utils.MatchContentType(contentType, `application/json`): + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): var out shared.ClientError if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err @@ -100,11 +147,11 @@ func (s *Tax) CreateTax(ctx context.Context, request shared.TaxCreate) (*operati res.ClientError = &out default: - return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) + return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode == 500: switch { - case utils.MatchContentType(contentType, `application/json`): + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): var out shared.ServerError if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err @@ -112,37 +159,98 @@ func (s *Tax) CreateTax(ctx context.Context, request shared.TaxCreate) (*operati res.ServerError = &out default: - return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) + return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } + default: + return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) } return res, nil + } // DeleteTax - deleteTax // Delete a specific tax entity by a given id -func (s *Tax) DeleteTax(ctx context.Context, request operations.DeleteTaxRequest) (*operations.DeleteTaxResponse, error) { +func (s *Tax) DeleteTax(ctx context.Context, request operations.DeleteTaxRequest, opts ...operations.Option) (*operations.DeleteTaxResponse, error) { + hookCtx := hooks.HookContext{ + Context: ctx, + OperationID: "deleteTax", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, + } + + o := operations.Options{} + supportedOptions := []string{ + operations.SupportedOptionTimeout, + } + + for _, opt := range opts { + if err := opt(&o, supportedOptions...); err != nil { + return nil, fmt.Errorf("error applying option: %w", err) + } + } + baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - url, err := utils.GenerateURL(ctx, baseURL, "/v1/tax/{taxId}", request, nil) + opURL, err := utils.GenerateURL(ctx, baseURL, "/v1/tax/{taxId}", request, nil) if err != nil { return nil, fmt.Errorf("error generating URL: %w", err) } - req, err := http.NewRequestWithContext(ctx, "DELETE", url, nil) + timeout := o.Timeout + if timeout == nil { + timeout = s.sdkConfiguration.Timeout + } + + if timeout != nil { + var cancel context.CancelFunc + ctx, cancel = context.WithTimeout(ctx, *timeout) + defer cancel() + } + + req, err := http.NewRequestWithContext(ctx, "DELETE", opURL, nil) if err != nil { return nil, fmt.Errorf("error creating request: %w", err) } req.Header.Set("Accept", "application/json") - req.Header.Set("user-agent", s.sdkConfiguration.UserAgent) + req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - client := s.sdkConfiguration.SecurityClient + if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { + return nil, err + } - httpRes, err := client.Do(req) + req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { - return nil, fmt.Errorf("error sending request: %w", err) + return nil, err + } + + httpRes, err := s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + return nil, err + } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { + _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + if err != nil { + return nil, err + } else if _httpRes != nil { + httpRes = _httpRes + } + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } } - if httpRes == nil { - return nil, fmt.Errorf("error sending request: no response") + + res := &operations.DeleteTaxResponse{ + StatusCode: httpRes.StatusCode, + ContentType: httpRes.Header.Get("Content-Type"), + RawResponse: httpRes, } rawBody, err := io.ReadAll(httpRes.Body) @@ -152,17 +260,10 @@ func (s *Tax) DeleteTax(ctx context.Context, request operations.DeleteTaxRequest httpRes.Body.Close() httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) - contentType := httpRes.Header.Get("Content-Type") - - res := &operations.DeleteTaxResponse{ - StatusCode: httpRes.StatusCode, - ContentType: contentType, - RawResponse: httpRes, - } switch { case httpRes.StatusCode == 200: switch { - case utils.MatchContentType(contentType, `application/json`): + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): var out shared.Tax if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err @@ -170,11 +271,11 @@ func (s *Tax) DeleteTax(ctx context.Context, request operations.DeleteTaxRequest res.Tax = &out default: - return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) + return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode == 400: switch { - case utils.MatchContentType(contentType, `application/json`): + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): var out shared.ClientError if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err @@ -182,11 +283,11 @@ func (s *Tax) DeleteTax(ctx context.Context, request operations.DeleteTaxRequest res.ClientError = &out default: - return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) + return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode == 500: switch { - case utils.MatchContentType(contentType, `application/json`): + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): var out shared.ServerError if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err @@ -194,41 +295,102 @@ func (s *Tax) DeleteTax(ctx context.Context, request operations.DeleteTaxRequest res.ServerError = &out default: - return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) + return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } + default: + return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) } return res, nil + } // GetTax - getTax // Read a specific tax entity by a given id -func (s *Tax) GetTax(ctx context.Context, request operations.GetTaxRequest) (*operations.GetTaxResponse, error) { +func (s *Tax) GetTax(ctx context.Context, request operations.GetTaxRequest, opts ...operations.Option) (*operations.GetTaxResponse, error) { + hookCtx := hooks.HookContext{ + Context: ctx, + OperationID: "getTax", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, + } + + o := operations.Options{} + supportedOptions := []string{ + operations.SupportedOptionTimeout, + } + + for _, opt := range opts { + if err := opt(&o, supportedOptions...); err != nil { + return nil, fmt.Errorf("error applying option: %w", err) + } + } + baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - url, err := utils.GenerateURL(ctx, baseURL, "/v1/tax/{taxId}", request, nil) + opURL, err := utils.GenerateURL(ctx, baseURL, "/v1/tax/{taxId}", request, nil) if err != nil { return nil, fmt.Errorf("error generating URL: %w", err) } - req, err := http.NewRequestWithContext(ctx, "GET", url, nil) + timeout := o.Timeout + if timeout == nil { + timeout = s.sdkConfiguration.Timeout + } + + if timeout != nil { + var cancel context.CancelFunc + ctx, cancel = context.WithTimeout(ctx, *timeout) + defer cancel() + } + + req, err := http.NewRequestWithContext(ctx, "GET", opURL, nil) if err != nil { return nil, fmt.Errorf("error creating request: %w", err) } req.Header.Set("Accept", "application/json") - req.Header.Set("user-agent", s.sdkConfiguration.UserAgent) + req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) if err := utils.PopulateQueryParams(ctx, req, request, nil); err != nil { return nil, fmt.Errorf("error populating query params: %w", err) } - client := s.sdkConfiguration.SecurityClient + if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { + return nil, err + } - httpRes, err := client.Do(req) + req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { - return nil, fmt.Errorf("error sending request: %w", err) + return nil, err } - if httpRes == nil { - return nil, fmt.Errorf("error sending request: no response") + + httpRes, err := s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + return nil, err + } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { + _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + if err != nil { + return nil, err + } else if _httpRes != nil { + httpRes = _httpRes + } + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } + } + + res := &operations.GetTaxResponse{ + StatusCode: httpRes.StatusCode, + ContentType: httpRes.Header.Get("Content-Type"), + RawResponse: httpRes, } rawBody, err := io.ReadAll(httpRes.Body) @@ -238,17 +400,10 @@ func (s *Tax) GetTax(ctx context.Context, request operations.GetTaxRequest) (*op httpRes.Body.Close() httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) - contentType := httpRes.Header.Get("Content-Type") - - res := &operations.GetTaxResponse{ - StatusCode: httpRes.StatusCode, - ContentType: contentType, - RawResponse: httpRes, - } switch { case httpRes.StatusCode == 200: switch { - case utils.MatchContentType(contentType, `application/json`): + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): var out shared.Tax if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err @@ -256,11 +411,11 @@ func (s *Tax) GetTax(ctx context.Context, request operations.GetTaxRequest) (*op res.Tax = &out default: - return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) + return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode == 400: switch { - case utils.MatchContentType(contentType, `application/json`): + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): var out shared.ClientError if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err @@ -268,11 +423,11 @@ func (s *Tax) GetTax(ctx context.Context, request operations.GetTaxRequest) (*op res.ClientError = &out default: - return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) + return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode == 500: switch { - case utils.MatchContentType(contentType, `application/json`): + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): var out shared.ServerError if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err @@ -280,71 +435,117 @@ func (s *Tax) GetTax(ctx context.Context, request operations.GetTaxRequest) (*op res.ServerError = &out default: - return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) + return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } + default: + return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) } return res, nil + } // PatchTax - patchTax // Partially update a specific tax entity's properties by a given id and a given payload -func (s *Tax) PatchTax(ctx context.Context, request operations.PatchTaxRequest) (*operations.PatchTaxResponse, error) { +func (s *Tax) PatchTax(ctx context.Context, request operations.PatchTaxRequest, opts ...operations.Option) (*operations.PatchTaxResponse, error) { + hookCtx := hooks.HookContext{ + Context: ctx, + OperationID: "patchTax", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, + } + + o := operations.Options{} + supportedOptions := []string{ + operations.SupportedOptionTimeout, + } + + for _, opt := range opts { + if err := opt(&o, supportedOptions...); err != nil { + return nil, fmt.Errorf("error applying option: %w", err) + } + } + baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - url, err := utils.GenerateURL(ctx, baseURL, "/v1/tax/{taxId}", request, nil) + opURL, err := utils.GenerateURL(ctx, baseURL, "/v1/tax/{taxId}", request, nil) if err != nil { return nil, fmt.Errorf("error generating URL: %w", err) } bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "TaxPatch", "json", `request:"mediaType=application/json"`) if err != nil { - return nil, fmt.Errorf("error serializing request body: %w", err) + return nil, err } - if bodyReader == nil { - return nil, fmt.Errorf("request body is required") + + timeout := o.Timeout + if timeout == nil { + timeout = s.sdkConfiguration.Timeout } - debugBody := bytes.NewBuffer([]byte{}) - debugReader := io.TeeReader(bodyReader, debugBody) + if timeout != nil { + var cancel context.CancelFunc + ctx, cancel = context.WithTimeout(ctx, *timeout) + defer cancel() + } - req, err := http.NewRequestWithContext(ctx, "PATCH", url, debugReader) + req, err := http.NewRequestWithContext(ctx, "PATCH", opURL, bodyReader) if err != nil { return nil, fmt.Errorf("error creating request: %w", err) } req.Header.Set("Accept", "application/json") - req.Header.Set("user-agent", s.sdkConfiguration.UserAgent) - + req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) req.Header.Set("Content-Type", reqContentType) - client := s.sdkConfiguration.SecurityClient + if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { + return nil, err + } - httpRes, err := client.Do(req) + req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { - return nil, fmt.Errorf("error sending request: %w", err) + return nil, err } - if httpRes == nil { - return nil, fmt.Errorf("error sending request: no response") + + httpRes, err := s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + return nil, err + } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { + _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + if err != nil { + return nil, err + } else if _httpRes != nil { + httpRes = _httpRes + } + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } + } + + res := &operations.PatchTaxResponse{ + StatusCode: httpRes.StatusCode, + ContentType: httpRes.Header.Get("Content-Type"), + RawResponse: httpRes, } rawBody, err := io.ReadAll(httpRes.Body) if err != nil { return nil, fmt.Errorf("error reading response body: %w", err) } - httpRes.Request.Body = io.NopCloser(debugBody) httpRes.Body.Close() httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) - contentType := httpRes.Header.Get("Content-Type") - - res := &operations.PatchTaxResponse{ - StatusCode: httpRes.StatusCode, - ContentType: contentType, - RawResponse: httpRes, - } switch { case httpRes.StatusCode == 200: switch { - case utils.MatchContentType(contentType, `application/json`): + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): var out shared.Tax if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err @@ -352,11 +553,11 @@ func (s *Tax) PatchTax(ctx context.Context, request operations.PatchTaxRequest) res.Tax = &out default: - return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) + return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode == 400: switch { - case utils.MatchContentType(contentType, `application/json`): + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): var out shared.ClientError if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err @@ -364,11 +565,11 @@ func (s *Tax) PatchTax(ctx context.Context, request operations.PatchTaxRequest) res.ClientError = &out default: - return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) + return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode == 500: switch { - case utils.MatchContentType(contentType, `application/json`): + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): var out shared.ServerError if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err @@ -376,71 +577,117 @@ func (s *Tax) PatchTax(ctx context.Context, request operations.PatchTaxRequest) res.ServerError = &out default: - return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) + return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } + default: + return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) } return res, nil + } // UpdateTax - updateTax // Completly replace a specific tax entity's properties by a given id and a given payload -func (s *Tax) UpdateTax(ctx context.Context, request operations.UpdateTaxRequest) (*operations.UpdateTaxResponse, error) { +func (s *Tax) UpdateTax(ctx context.Context, request operations.UpdateTaxRequest, opts ...operations.Option) (*operations.UpdateTaxResponse, error) { + hookCtx := hooks.HookContext{ + Context: ctx, + OperationID: "updateTax", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, + } + + o := operations.Options{} + supportedOptions := []string{ + operations.SupportedOptionTimeout, + } + + for _, opt := range opts { + if err := opt(&o, supportedOptions...); err != nil { + return nil, fmt.Errorf("error applying option: %w", err) + } + } + baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - url, err := utils.GenerateURL(ctx, baseURL, "/v1/tax/{taxId}", request, nil) + opURL, err := utils.GenerateURL(ctx, baseURL, "/v1/tax/{taxId}", request, nil) if err != nil { return nil, fmt.Errorf("error generating URL: %w", err) } bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "TaxCreate", "json", `request:"mediaType=application/json"`) if err != nil { - return nil, fmt.Errorf("error serializing request body: %w", err) + return nil, err } - if bodyReader == nil { - return nil, fmt.Errorf("request body is required") + + timeout := o.Timeout + if timeout == nil { + timeout = s.sdkConfiguration.Timeout } - debugBody := bytes.NewBuffer([]byte{}) - debugReader := io.TeeReader(bodyReader, debugBody) + if timeout != nil { + var cancel context.CancelFunc + ctx, cancel = context.WithTimeout(ctx, *timeout) + defer cancel() + } - req, err := http.NewRequestWithContext(ctx, "PUT", url, debugReader) + req, err := http.NewRequestWithContext(ctx, "PUT", opURL, bodyReader) if err != nil { return nil, fmt.Errorf("error creating request: %w", err) } req.Header.Set("Accept", "application/json") - req.Header.Set("user-agent", s.sdkConfiguration.UserAgent) - + req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) req.Header.Set("Content-Type", reqContentType) - client := s.sdkConfiguration.SecurityClient + if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { + return nil, err + } - httpRes, err := client.Do(req) + req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { - return nil, fmt.Errorf("error sending request: %w", err) + return nil, err } - if httpRes == nil { - return nil, fmt.Errorf("error sending request: no response") + + httpRes, err := s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + return nil, err + } else if utils.MatchStatusCodes([]string{}, httpRes.StatusCode) { + _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + if err != nil { + return nil, err + } else if _httpRes != nil { + httpRes = _httpRes + } + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } + } + + res := &operations.UpdateTaxResponse{ + StatusCode: httpRes.StatusCode, + ContentType: httpRes.Header.Get("Content-Type"), + RawResponse: httpRes, } rawBody, err := io.ReadAll(httpRes.Body) if err != nil { return nil, fmt.Errorf("error reading response body: %w", err) } - httpRes.Request.Body = io.NopCloser(debugBody) httpRes.Body.Close() httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) - contentType := httpRes.Header.Get("Content-Type") - - res := &operations.UpdateTaxResponse{ - StatusCode: httpRes.StatusCode, - ContentType: contentType, - RawResponse: httpRes, - } switch { case httpRes.StatusCode == 200: switch { - case utils.MatchContentType(contentType, `application/json`): + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): var out shared.Tax if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err @@ -448,11 +695,11 @@ func (s *Tax) UpdateTax(ctx context.Context, request operations.UpdateTaxRequest res.Tax = &out default: - return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) + return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode == 400: switch { - case utils.MatchContentType(contentType, `application/json`): + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): var out shared.ClientError if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err @@ -460,11 +707,11 @@ func (s *Tax) UpdateTax(ctx context.Context, request operations.UpdateTaxRequest res.ClientError = &out default: - return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) + return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode == 500: switch { - case utils.MatchContentType(contentType, `application/json`): + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): var out shared.ServerError if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err @@ -472,9 +719,12 @@ func (s *Tax) UpdateTax(ctx context.Context, request operations.UpdateTaxRequest res.ServerError = &out default: - return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) + return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } + default: + return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) } return res, nil + } diff --git a/internal/sdk/pkg/types/bigint.go b/internal/sdk/types/bigint.go similarity index 87% rename from internal/sdk/pkg/types/bigint.go rename to internal/sdk/types/bigint.go index afd0cd2..4765ef2 100644 --- a/internal/sdk/pkg/types/bigint.go +++ b/internal/sdk/types/bigint.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasyapi.com). DO NOT EDIT. package types diff --git a/internal/sdk/pkg/types/date.go b/internal/sdk/types/date.go similarity index 96% rename from internal/sdk/pkg/types/date.go rename to internal/sdk/types/date.go index c4648fa..131f364 100644 --- a/internal/sdk/pkg/types/date.go +++ b/internal/sdk/types/date.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasyapi.com). DO NOT EDIT. package types diff --git a/internal/sdk/pkg/types/datetime.go b/internal/sdk/types/datetime.go similarity index 90% rename from internal/sdk/pkg/types/datetime.go rename to internal/sdk/types/datetime.go index 0529b25..c07ddcd 100644 --- a/internal/sdk/pkg/types/datetime.go +++ b/internal/sdk/types/datetime.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasyapi.com). DO NOT EDIT. package types diff --git a/internal/sdk/pkg/types/decimal.go b/internal/sdk/types/decimal.go similarity index 85% rename from internal/sdk/pkg/types/decimal.go rename to internal/sdk/types/decimal.go index a42284b..f7def72 100644 --- a/internal/sdk/pkg/types/decimal.go +++ b/internal/sdk/types/decimal.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasyapi.com). DO NOT EDIT. package types diff --git a/internal/sdk/pkg/types/pointers.go b/internal/sdk/types/pointers.go similarity index 82% rename from internal/sdk/pkg/types/pointers.go rename to internal/sdk/types/pointers.go index 4f15e99..1ed80cf 100644 --- a/internal/sdk/pkg/types/pointers.go +++ b/internal/sdk/types/pointers.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasyapi.com). DO NOT EDIT. package types diff --git a/internal/validators/DateValidator.go b/internal/validators/DateValidator.go index 746f7c8..b214431 100644 --- a/internal/validators/DateValidator.go +++ b/internal/validators/DateValidator.go @@ -1,10 +1,10 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasyapi.com). DO NOT EDIT. package validators import ( "context" - "github.com/epilot-dev/terraform-provider-epilot-product/internal/sdk/pkg/types" + "github.com/epilot-dev/terraform-provider-epilot-product/internal/sdk/types" "github.com/hashicorp/terraform-plugin-framework-validators/helpers/validatordiag" "github.com/hashicorp/terraform-plugin-framework/schema/validator" ) diff --git a/internal/validators/ExactlyOneChild.go b/internal/validators/ExactlyOneChild.go index 5741558..dc9cd6a 100644 --- a/internal/validators/ExactlyOneChild.go +++ b/internal/validators/ExactlyOneChild.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasyapi.com). DO NOT EDIT. package validators diff --git a/internal/validators/JSONParseValidator.go b/internal/validators/JSONParseValidator.go index 3a341e1..cb680b9 100644 --- a/internal/validators/JSONParseValidator.go +++ b/internal/validators/JSONParseValidator.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasyapi.com). DO NOT EDIT. package validators diff --git a/internal/validators/RFC3339Validator.go b/internal/validators/RFC3339Validator.go index ad3d715..888f85c 100644 --- a/internal/validators/RFC3339Validator.go +++ b/internal/validators/RFC3339Validator.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasyapi.com). DO NOT EDIT. package validators diff --git a/internal/validators/boolvalidators/not_null.go b/internal/validators/boolvalidators/not_null.go index 45e2e97..de7f756 100644 --- a/internal/validators/boolvalidators/not_null.go +++ b/internal/validators/boolvalidators/not_null.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasyapi.com). DO NOT EDIT. package boolvalidators diff --git a/internal/validators/float64validators/not_null.go b/internal/validators/float64validators/not_null.go index 75099c2..fed2c05 100644 --- a/internal/validators/float64validators/not_null.go +++ b/internal/validators/float64validators/not_null.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasyapi.com). DO NOT EDIT. package float64validators diff --git a/internal/validators/int64validators/not_null.go b/internal/validators/int64validators/not_null.go index 32192d8..c07e1de 100644 --- a/internal/validators/int64validators/not_null.go +++ b/internal/validators/int64validators/not_null.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasyapi.com). DO NOT EDIT. package int64validators diff --git a/internal/validators/listvalidators/not_null.go b/internal/validators/listvalidators/not_null.go index c7bfa6e..f39d6fa 100644 --- a/internal/validators/listvalidators/not_null.go +++ b/internal/validators/listvalidators/not_null.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasyapi.com). DO NOT EDIT. package listvalidators diff --git a/internal/validators/mapvalidators/not_null.go b/internal/validators/mapvalidators/not_null.go index 7d22172..9cdf99e 100644 --- a/internal/validators/mapvalidators/not_null.go +++ b/internal/validators/mapvalidators/not_null.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasyapi.com). DO NOT EDIT. package mapvalidators diff --git a/internal/validators/numbervalidators/not_null.go b/internal/validators/numbervalidators/not_null.go index b085170..e2baffe 100644 --- a/internal/validators/numbervalidators/not_null.go +++ b/internal/validators/numbervalidators/not_null.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasyapi.com). DO NOT EDIT. package numbervalidators diff --git a/internal/validators/objectvalidators/not_null.go b/internal/validators/objectvalidators/not_null.go index c45ca8d..480ec23 100644 --- a/internal/validators/objectvalidators/not_null.go +++ b/internal/validators/objectvalidators/not_null.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasyapi.com). DO NOT EDIT. package objectvalidators diff --git a/internal/validators/setvalidators/not_null.go b/internal/validators/setvalidators/not_null.go index 23d6c16..45369e3 100644 --- a/internal/validators/setvalidators/not_null.go +++ b/internal/validators/setvalidators/not_null.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasyapi.com). DO NOT EDIT. package setvalidators diff --git a/internal/validators/stringvalidators/not_null.go b/internal/validators/stringvalidators/not_null.go index f15f8ae..ce5f808 100644 --- a/internal/validators/stringvalidators/not_null.go +++ b/internal/validators/stringvalidators/not_null.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasyapi.com). DO NOT EDIT. package stringvalidators diff --git a/main.go b/main.go index 4e1e0fa..dfeeb74 100644 --- a/main.go +++ b/main.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasyapi.com). DO NOT EDIT. package main @@ -15,7 +15,7 @@ import ( // Run the docs generation tool, check its repository for more information on how it works and how docs // can be customized. -//go:generate go run github.com/hashicorp/terraform-plugin-docs/cmd/tfplugindocs generate --rendered-provider-name terraform-provider-epilot-product +//go:generate go run github.com/hashicorp/terraform-plugin-docs/cmd/tfplugindocs generate --provider-name terraform-provider-epilot-product --rendered-provider-name terraform-provider-epilot-product var ( // these will be set by the goreleaser configuration diff --git a/product.yaml b/product.yaml index 1ecb2e0..4308dca 100644 --- a/product.yaml +++ b/product.yaml @@ -494,6 +494,14 @@ components: - tiered_graduated - tiered_flatfee default: per_unit + price_components: + description: A set of [price](/api/pricing#tag/simple_price_schema) components that define the composite price. + type: object + properties: + $relation: + type: array + items: + $ref: '#/components/schemas/PriceComponentRelation' unit_amount: description: The unit amount in cents to be charged, represented as a whole integer if possible. type: number @@ -570,25 +578,7 @@ components: default: false unit: description: The unit of measurement used for display purposes and possibly for calculations when the price is variable. - oneOf: - - type: string - description: built-in units - enum: - - kw - - kwh - - m - - m2 - - l - - cubic-meter - - cubic-meter-h - - ls - - a - - kva - - w - - wp - - kwp - - type: string - description: user custom unit + type: string tax: {} PriceTier: type: object @@ -694,6 +684,17 @@ components: - $ref: '#/components/schemas/BaseProductRequired' ProductPatch: $ref: '#/components/schemas/BaseProduct' + PriceComponentRelation: + type: object + properties: + entity_id: + description: The id of the price component + type: string + _tags: + type: array + description: An arbitrary set of tags attached to the composite price - component relation + items: + type: string parameters: HydrateQueryParam: name: hydrate diff --git a/tools/tools.go b/tools/tools.go index 4f42a8c..08da0fd 100644 --- a/tools/tools.go +++ b/tools/tools.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasyapi.com). DO NOT EDIT. //go:build tools