From c175dadca203cd4f9cc065b6f597dd63dc1f738a Mon Sep 17 00:00:00 2001 From: SDK Generator Bot Date: Wed, 30 Apr 2025 13:41:35 +0000 Subject: [PATCH 1/2] Generate stackitmarketplace --- services/stackitmarketplace/api_default.go | 10 +-- .../stackitmarketplace/api_default_test.go | 2 +- services/stackitmarketplace/client.go | 2 +- .../model_catalog_product_detail.go | 10 ++- .../model_catalog_product_overview.go | 10 ++- .../model_inquiry_contact_sales.go | 10 ++- .../stackitmarketplace/model_product_id.go | 80 ------------------- .../model_subscription_product.go | 59 +++++++++++++- 8 files changed, 80 insertions(+), 103 deletions(-) delete mode 100644 services/stackitmarketplace/model_product_id.go diff --git a/services/stackitmarketplace/api_default.go b/services/stackitmarketplace/api_default.go index 87738d345..aed62f184 100644 --- a/services/stackitmarketplace/api_default.go +++ b/services/stackitmarketplace/api_default.go @@ -233,11 +233,11 @@ func (r ApiGetCatalogProductRequest) Execute() (*CatalogProductDetail, error) { localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} localVarFormParams := url.Values{} - if strlen(r.productId) < 36 { - return localVarReturnValue, fmt.Errorf("productId must have at least 36 elements") + if strlen(r.productId) < 10 { + return localVarReturnValue, fmt.Errorf("productId must have at least 10 elements") } - if strlen(r.productId) > 36 { - return localVarReturnValue, fmt.Errorf("productId must have less than 36 elements") + if strlen(r.productId) > 29 { + return localVarReturnValue, fmt.Errorf("productId must have less than 29 elements") } if r.locale != nil { @@ -747,7 +747,7 @@ func (r ApiListCatalogProductsRequest) Filter(filter string) ApiListCatalogProdu return r } -// Sort the products based on attributes and order (if specified). E.g `name:asc`. The supported attributes are `name`, `price`, and `deliveryMethod`. To set the sort order, append `asc` (ascending) or `desc` (descending) to the attribute, e.g. `name:asc`. To sort by multiple attributes, separate them with a comma. E.g `name,price:desc`. The order can be ommited to sort by the default order. E.g `name`. +// Sort the products based on attributes and order e.g. `name:asc`. Attributes with scalar types (`createdAt`, `isProductListing`) or keywords (`name`, `deliveryMethod`, `lifecycleState`, `vendor.name`) can be used as sort criteria. To set the sort order, append `asc` (ascending) or `desc` (descending) to the attribute, e.g. `name:asc`. To sort by multiple attributes, separate them with a comma. E.g `name:asc,price:desc`. func (r ApiListCatalogProductsRequest) Sort(sort string) ApiListCatalogProductsRequest { r.sort = &sort diff --git a/services/stackitmarketplace/api_default_test.go b/services/stackitmarketplace/api_default_test.go index 430672e92..3f0b04d36 100644 --- a/services/stackitmarketplace/api_default_test.go +++ b/services/stackitmarketplace/api_default_test.go @@ -75,7 +75,7 @@ func Test_stackitmarketplace_DefaultApiService(t *testing.T) { t.Run("Test DefaultApiService GetCatalogProduct", func(t *testing.T) { _apiUrlPath := "/v1/catalog/products/{productId}" - productIdValue := uuid.NewString() + productIdValue := "productId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"productId"+"}", url.PathEscape(ParameterValueToString(productIdValue, "productId")), -1) testDefaultApiServeMux := http.NewServeMux() diff --git a/services/stackitmarketplace/client.go b/services/stackitmarketplace/client.go index e99ec2ce5..b545d7f3c 100644 --- a/services/stackitmarketplace/client.go +++ b/services/stackitmarketplace/client.go @@ -308,7 +308,7 @@ func (c *APIClient) prepareRequest( var body *bytes.Buffer // Detect postBody type and post. - if postBody != nil { + if !IsNil(postBody) { contentType := headerParams["Content-Type"] if contentType == "" { contentType = detectContentType(postBody) diff --git a/services/stackitmarketplace/model_catalog_product_detail.go b/services/stackitmarketplace/model_catalog_product_detail.go index 305962f07..462f7f586 100644 --- a/services/stackitmarketplace/model_catalog_product_detail.go +++ b/services/stackitmarketplace/model_catalog_product_detail.go @@ -245,10 +245,8 @@ func setCatalogProductDetailGetPricingOptionsAttributeType(arg *CatalogProductDe types and functions for productId */ -// isModel -type CatalogProductDetailGetProductIdAttributeType = *ProductId -type CatalogProductDetailGetProductIdArgType = ProductId -type CatalogProductDetailGetProductIdRetType = ProductId +// isNotNullableString +type CatalogProductDetailGetProductIdAttributeType = *string func getCatalogProductDetailGetProductIdAttributeTypeOk(arg CatalogProductDetailGetProductIdAttributeType) (ret CatalogProductDetailGetProductIdRetType, ok bool) { if arg == nil { @@ -261,6 +259,9 @@ func setCatalogProductDetailGetProductIdAttributeType(arg *CatalogProductDetailG *arg = &val } +type CatalogProductDetailGetProductIdArgType = string +type CatalogProductDetailGetProductIdRetType = string + /* types and functions for summary */ @@ -436,6 +437,7 @@ type CatalogProductDetail struct { // The list of pricing options. // REQUIRED PricingOptions CatalogProductDetailGetPricingOptionsAttributeType `json:"pricingOptions"` + // The user-readable product ID. // REQUIRED ProductId CatalogProductDetailGetProductIdAttributeType `json:"productId"` // The short summary of the product. diff --git a/services/stackitmarketplace/model_catalog_product_overview.go b/services/stackitmarketplace/model_catalog_product_overview.go index 55a299feb..2f34dd3db 100644 --- a/services/stackitmarketplace/model_catalog_product_overview.go +++ b/services/stackitmarketplace/model_catalog_product_overview.go @@ -102,10 +102,8 @@ type CatalogProductOverviewGetNameRetType = string types and functions for productId */ -// isModel -type CatalogProductOverviewGetProductIdAttributeType = *ProductId -type CatalogProductOverviewGetProductIdArgType = ProductId -type CatalogProductOverviewGetProductIdRetType = ProductId +// isNotNullableString +type CatalogProductOverviewGetProductIdAttributeType = *string func getCatalogProductOverviewGetProductIdAttributeTypeOk(arg CatalogProductOverviewGetProductIdAttributeType) (ret CatalogProductOverviewGetProductIdRetType, ok bool) { if arg == nil { @@ -118,6 +116,9 @@ func setCatalogProductOverviewGetProductIdAttributeType(arg *CatalogProductOverv *arg = &val } +type CatalogProductOverviewGetProductIdArgType = string +type CatalogProductOverviewGetProductIdRetType = string + /* types and functions for summary */ @@ -170,6 +171,7 @@ type CatalogProductOverview struct { // The name of the product. // REQUIRED Name CatalogProductOverviewGetNameAttributeType `json:"name"` + // The user-readable product ID. // REQUIRED ProductId CatalogProductOverviewGetProductIdAttributeType `json:"productId"` // A custom message. diff --git a/services/stackitmarketplace/model_inquiry_contact_sales.go b/services/stackitmarketplace/model_inquiry_contact_sales.go index 8ce37bd66..98a6847eb 100644 --- a/services/stackitmarketplace/model_inquiry_contact_sales.go +++ b/services/stackitmarketplace/model_inquiry_contact_sales.go @@ -105,10 +105,8 @@ type InquiryContactSalesGetMessageRetType = string types and functions for productId */ -// isModel -type InquiryContactSalesGetProductIdAttributeType = *ProductId -type InquiryContactSalesGetProductIdArgType = ProductId -type InquiryContactSalesGetProductIdRetType = ProductId +// isNotNullableString +type InquiryContactSalesGetProductIdAttributeType = *string func getInquiryContactSalesGetProductIdAttributeTypeOk(arg InquiryContactSalesGetProductIdAttributeType) (ret InquiryContactSalesGetProductIdRetType, ok bool) { if arg == nil { @@ -121,6 +119,9 @@ func setInquiryContactSalesGetProductIdAttributeType(arg *InquiryContactSalesGet *arg = &val } +type InquiryContactSalesGetProductIdArgType = string +type InquiryContactSalesGetProductIdRetType = string + // InquiryContactSales Contact sales. type InquiryContactSales struct { // The product's vendor name. @@ -135,6 +136,7 @@ type InquiryContactSales struct { // A custom message. // REQUIRED Message InquiryContactSalesGetMessageAttributeType `json:"message"` + // The user-readable product ID. // REQUIRED ProductId InquiryContactSalesGetProductIdAttributeType `json:"productId"` } diff --git a/services/stackitmarketplace/model_product_id.go b/services/stackitmarketplace/model_product_id.go deleted file mode 100644 index c23f0d321..000000000 --- a/services/stackitmarketplace/model_product_id.go +++ /dev/null @@ -1,80 +0,0 @@ -/* -STACKIT Marketplace API - -API to manage STACKIT Marketplace. - -API version: 1 -*/ - -// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. - -package stackitmarketplace - -import ( - "encoding/json" -) - -// checks if the ProductId type satisfies the MappedNullable interface at compile time -var _ MappedNullable = &ProductId{} - -// ProductId The product ID. -type ProductId struct { -} - -// NewProductId instantiates a new ProductId object -// This constructor will assign default values to properties that have it defined, -// and makes sure properties required by API are set, but the set of arguments -// will change when the set of required properties is changed -func NewProductId() *ProductId { - this := ProductId{} - return &this -} - -// NewProductIdWithDefaults instantiates a new ProductId object -// This constructor will only assign default values to properties that have it defined, -// but it doesn't guarantee that properties required by API are set -func NewProductIdWithDefaults() *ProductId { - this := ProductId{} - return &this -} - -func (o ProductId) ToMap() (map[string]interface{}, error) { - toSerialize := map[string]interface{}{} - return toSerialize, nil -} - -type NullableProductId struct { - value *ProductId - isSet bool -} - -func (v NullableProductId) Get() *ProductId { - return v.value -} - -func (v *NullableProductId) Set(val *ProductId) { - v.value = val - v.isSet = true -} - -func (v NullableProductId) IsSet() bool { - return v.isSet -} - -func (v *NullableProductId) Unset() { - v.value = nil - v.isSet = false -} - -func NewNullableProductId(val *ProductId) *NullableProductId { - return &NullableProductId{value: val, isSet: true} -} - -func (v NullableProductId) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -func (v *NullableProductId) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/services/stackitmarketplace/model_subscription_product.go b/services/stackitmarketplace/model_subscription_product.go index e5e9b7d7a..145be8ef6 100644 --- a/services/stackitmarketplace/model_subscription_product.go +++ b/services/stackitmarketplace/model_subscription_product.go @@ -102,10 +102,8 @@ type SubscriptionProductGetPricingPlanRetType = string types and functions for productId */ -// isModel -type SubscriptionProductGetProductIdAttributeType = *ProductId -type SubscriptionProductGetProductIdArgType = ProductId -type SubscriptionProductGetProductIdRetType = ProductId +// isNotNullableString +type SubscriptionProductGetProductIdAttributeType = *string func getSubscriptionProductGetProductIdAttributeTypeOk(arg SubscriptionProductGetProductIdAttributeType) (ret SubscriptionProductGetProductIdRetType, ok bool) { if arg == nil { @@ -118,6 +116,9 @@ func setSubscriptionProductGetProductIdAttributeType(arg *SubscriptionProductGet *arg = &val } +type SubscriptionProductGetProductIdArgType = string +type SubscriptionProductGetProductIdRetType = string + /* types and functions for productName */ @@ -160,6 +161,27 @@ func setSubscriptionProductGetVendorNameAttributeType(arg *SubscriptionProductGe type SubscriptionProductGetVendorNameArgType = string type SubscriptionProductGetVendorNameRetType = string +/* + types and functions for vendorPlanId +*/ + +// isNotNullableString +type SubscriptionProductGetVendorPlanIdAttributeType = *string + +func getSubscriptionProductGetVendorPlanIdAttributeTypeOk(arg SubscriptionProductGetVendorPlanIdAttributeType) (ret SubscriptionProductGetVendorPlanIdRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setSubscriptionProductGetVendorPlanIdAttributeType(arg *SubscriptionProductGetVendorPlanIdAttributeType, val SubscriptionProductGetVendorPlanIdRetType) { + *arg = &val +} + +type SubscriptionProductGetVendorPlanIdArgType = string +type SubscriptionProductGetVendorPlanIdRetType = string + /* types and functions for vendorProductId */ @@ -213,6 +235,7 @@ type SubscriptionProduct struct { // Additional price type information. // REQUIRED PricingPlan SubscriptionProductGetPricingPlanAttributeType `json:"pricingPlan"` + // The user-readable product ID. // REQUIRED ProductId SubscriptionProductGetProductIdAttributeType `json:"productId"` // The name of the product. @@ -221,6 +244,8 @@ type SubscriptionProduct struct { // The product's vendor name. // REQUIRED VendorName SubscriptionProductGetVendorNameAttributeType `json:"vendorName"` + // The vendor provided plan ID. + VendorPlanId SubscriptionProductGetVendorPlanIdAttributeType `json:"vendorPlanId,omitempty"` // The vendor provided product ID. VendorProductId SubscriptionProductGetVendorProductIdAttributeType `json:"vendorProductId,omitempty"` // Uniform Resource Locator. @@ -374,6 +399,29 @@ func (o *SubscriptionProduct) SetVendorName(v SubscriptionProductGetVendorNameRe setSubscriptionProductGetVendorNameAttributeType(&o.VendorName, v) } +// GetVendorPlanId returns the VendorPlanId field value if set, zero value otherwise. +func (o *SubscriptionProduct) GetVendorPlanId() (res SubscriptionProductGetVendorPlanIdRetType) { + res, _ = o.GetVendorPlanIdOk() + return +} + +// GetVendorPlanIdOk returns a tuple with the VendorPlanId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SubscriptionProduct) GetVendorPlanIdOk() (ret SubscriptionProductGetVendorPlanIdRetType, ok bool) { + return getSubscriptionProductGetVendorPlanIdAttributeTypeOk(o.VendorPlanId) +} + +// HasVendorPlanId returns a boolean if a field has been set. +func (o *SubscriptionProduct) HasVendorPlanId() bool { + _, ok := o.GetVendorPlanIdOk() + return ok +} + +// SetVendorPlanId gets a reference to the given string and assigns it to the VendorPlanId field. +func (o *SubscriptionProduct) SetVendorPlanId(v SubscriptionProductGetVendorPlanIdRetType) { + setSubscriptionProductGetVendorPlanIdAttributeType(&o.VendorPlanId, v) +} + // GetVendorProductId returns the VendorProductId field value if set, zero value otherwise. func (o *SubscriptionProduct) GetVendorProductId() (res SubscriptionProductGetVendorProductIdRetType) { res, _ = o.GetVendorProductIdOk() @@ -437,6 +485,9 @@ func (o SubscriptionProduct) ToMap() (map[string]interface{}, error) { if val, ok := getSubscriptionProductGetVendorNameAttributeTypeOk(o.VendorName); ok { toSerialize["VendorName"] = val } + if val, ok := getSubscriptionProductGetVendorPlanIdAttributeTypeOk(o.VendorPlanId); ok { + toSerialize["VendorPlanId"] = val + } if val, ok := getSubscriptionProductGetVendorProductIdAttributeTypeOk(o.VendorProductId); ok { toSerialize["VendorProductId"] = val } From a6042f83b6f490c43e516caf66262bc7ae6ee2f0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=BCdiger=20Schmitz?= <152157960+bahkauv70@users.noreply.github.com> Date: Fri, 2 May 2025 14:58:12 +0200 Subject: [PATCH 2/2] chore(sdk): add changelog for updated api --- CHANGELOG.md | 8 ++++++++ services/stackitmarketplace/CHANGELOG.md | 7 +++++++ 2 files changed, 15 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index b39980cad..58acb7b13 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,11 @@ +## Release (2025-05-XX) +- `stackitmarketplace`: [0.6.0](services/stackitmarketplace/CHANGELOG.md#v060-2025-05-02) + - **Breaking Change:** + - Introduced dedicated type for product id with appropriate validations + - **Feature:** + - Improved nil-safety + - subscription products contain the plan id + ## Release (2025-04-30) - `core`: [v0.17.1](core/CHANGELOG.md#v0171-2025-04-09) - **Improvement:** Improve error message for key flow authentication diff --git a/services/stackitmarketplace/CHANGELOG.md b/services/stackitmarketplace/CHANGELOG.md index 7ab1362f2..c60b3a2cb 100644 --- a/services/stackitmarketplace/CHANGELOG.md +++ b/services/stackitmarketplace/CHANGELOG.md @@ -1,3 +1,10 @@ +## v0.6.0 (2025-05-02) +- **Breaking Change:** + - Introduced dedicated type for product id with appropriate validations +- **Feature:** + - Improved nil-safety + - subscription products contain the plan id + ## v0.5.0 (2025-04-11) - **Feature:** Add new `InquiryContactSales`, `InquirySuggestProduct`, `PriceType`, `PricingOption` and `DeliveryMethod`