diff --git a/CHANGELOG.md b/CHANGELOG.md index 9f2c998c8..8fa0bac70 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,8 @@ - **Bugfix:** `ConfigureRegion` does not return an error if a region is set by an environment variable. - `authorization`: [v0.5.0](services/authorization/CHANGELOG.md#v050-2025-01-09) - **Feature:** Add support for regions in `APIClient` +- `stackitmarketplace`: [v0.1.0](services/stackitmarketplace/CHANGELOG.md#v010-2025-01-10) + - **New**: STACKIT Marketplace module can be used to manage the STACKIT Marketplace. ## Release (2025-01-07) diff --git a/go.work b/go.work index 18fe2932b..c20c76e0b 100644 --- a/go.work +++ b/go.work @@ -54,4 +54,5 @@ use ( ./services/serviceenablement ./services/ske ./services/sqlserverflex + ./services/stackitmarketplace ) diff --git a/services/stackitmarketplace/.openapi-generator/VERSION b/services/stackitmarketplace/.openapi-generator/VERSION new file mode 100644 index 000000000..cd802a1ec --- /dev/null +++ b/services/stackitmarketplace/.openapi-generator/VERSION @@ -0,0 +1 @@ +6.6.0 \ No newline at end of file diff --git a/services/stackitmarketplace/CHANGELOG.md b/services/stackitmarketplace/CHANGELOG.md new file mode 100644 index 000000000..002acef54 --- /dev/null +++ b/services/stackitmarketplace/CHANGELOG.md @@ -0,0 +1,3 @@ +## v0.1.0 (2025-01-10) + +- **New**: STACKIT Marketplace module can be used to manage the STACKIT Marketplace. diff --git a/services/stackitmarketplace/api_default.go b/services/stackitmarketplace/api_default.go new file mode 100644 index 000000000..4e3b04b01 --- /dev/null +++ b/services/stackitmarketplace/api_default.go @@ -0,0 +1,1047 @@ +/* +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 ( + "bytes" + "context" + "fmt" + "io" + "net/http" + "net/url" + "strings" + + "github.com/stackitcloud/stackit-sdk-go/core/config" + "github.com/stackitcloud/stackit-sdk-go/core/oapierror" +) + +// DefaultApiService DefaultApi service +type DefaultApiService service + +type ApiApproveSubscriptionRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + subscriptionId string +} + +func (r ApiApproveSubscriptionRequest) Execute() error { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + ) + a := r.apiService + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.ApproveSubscription") + if err != nil { + return &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1/vendors/projects/{projectId}/subscriptions/{subscriptionId}/approve" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"subscriptionId"+"}", url.PathEscape(ParameterValueToString(r.subscriptionId, "subscriptionId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := a.client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v ErrorResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v ErrorResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v ErrorResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v ErrorResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return newErr + } + + return nil +} + +/* +ApproveSubscription: Approve a subscription + +Approve a pending subscription. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The project ID. + @param subscriptionId The subscription ID. + @return ApiApproveSubscriptionRequest +*/ +func (a *APIClient) ApproveSubscription(ctx context.Context, projectId string, subscriptionId string) ApiApproveSubscriptionRequest { + return ApiApproveSubscriptionRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + subscriptionId: subscriptionId, + } +} + +func (a *APIClient) ApproveSubscriptionExecute(ctx context.Context, projectId string, subscriptionId string) error { + r := ApiApproveSubscriptionRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + subscriptionId: subscriptionId, + } + return r.Execute() +} + +type ApiGetCatalogProductRequest struct { + ctx context.Context + apiService *DefaultApiService + productId string + locale *string +} + +// The language of the response. + +func (r ApiGetCatalogProductRequest) Locale(locale string) ApiGetCatalogProductRequest { + r.locale = &locale + return r +} + +func (r ApiGetCatalogProductRequest) Execute() (*CatalogProductDetail, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *CatalogProductDetail + ) + a := r.apiService + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.GetCatalogProduct") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1/catalog/products/{productId}" + localVarPath = strings.Replace(localVarPath, "{"+"productId"+"}", url.PathEscape(ParameterValueToString(r.productId, "productId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if r.locale != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "locale", r.locale, "") + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := a.client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v ErrorResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v ErrorResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v ErrorResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v ErrorResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +GetCatalogProduct: Get a product + +Get a product. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param productId The product ID. + @return ApiGetCatalogProductRequest +*/ +func (a *APIClient) GetCatalogProduct(ctx context.Context, productId string) ApiGetCatalogProductRequest { + return ApiGetCatalogProductRequest{ + apiService: a.defaultApi, + ctx: ctx, + productId: productId, + } +} + +func (a *APIClient) GetCatalogProductExecute(ctx context.Context, productId string) (*CatalogProductDetail, error) { + r := ApiGetCatalogProductRequest{ + apiService: a.defaultApi, + ctx: ctx, + productId: productId, + } + return r.Execute() +} + +type ApiGetVendorSubscriptionRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + subscriptionId string +} + +func (r ApiGetVendorSubscriptionRequest) Execute() (*VendorSubscription, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *VendorSubscription + ) + a := r.apiService + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.GetVendorSubscription") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1/vendors/projects/{projectId}/subscriptions/{subscriptionId}" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"subscriptionId"+"}", url.PathEscape(ParameterValueToString(r.subscriptionId, "subscriptionId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := a.client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v ErrorResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v ErrorResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v ErrorResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v ErrorResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +GetVendorSubscription: Get a subscription + +Get a subscription. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The project ID. + @param subscriptionId The subscription ID. + @return ApiGetVendorSubscriptionRequest +*/ +func (a *APIClient) GetVendorSubscription(ctx context.Context, projectId string, subscriptionId string) ApiGetVendorSubscriptionRequest { + return ApiGetVendorSubscriptionRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + subscriptionId: subscriptionId, + } +} + +func (a *APIClient) GetVendorSubscriptionExecute(ctx context.Context, projectId string, subscriptionId string) (*VendorSubscription, error) { + r := ApiGetVendorSubscriptionRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + subscriptionId: subscriptionId, + } + return r.Execute() +} + +type ApiListCatalogProductsRequest struct { + ctx context.Context + apiService *DefaultApiService + cursor *string + limit *float32 + locale *string +} + +// A pagination cursor that represents a position in the dataset. If given, results will be returned from the item after the cursor. If not given, results will be returned from the beginning. + +func (r ApiListCatalogProductsRequest) Cursor(cursor string) ApiListCatalogProductsRequest { + r.cursor = &cursor + return r +} + +// The maximum number of items to return in the response. If maximum is exceeded, maximum is used. + +func (r ApiListCatalogProductsRequest) Limit(limit float32) ApiListCatalogProductsRequest { + r.limit = &limit + return r +} + +// The language of the response. + +func (r ApiListCatalogProductsRequest) Locale(locale string) ApiListCatalogProductsRequest { + r.locale = &locale + return r +} + +func (r ApiListCatalogProductsRequest) Execute() (*ListCatalogProductsResponse, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *ListCatalogProductsResponse + ) + a := r.apiService + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.ListCatalogProducts") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1/catalog/products" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if r.cursor != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "cursor", r.cursor, "") + } + if r.limit != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "limit", r.limit, "") + } + if r.locale != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "locale", r.locale, "") + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := a.client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v ErrorResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v ErrorResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v ErrorResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +ListCatalogProducts: List all products + +List all products. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return ApiListCatalogProductsRequest +*/ +func (a *APIClient) ListCatalogProducts(ctx context.Context) ApiListCatalogProductsRequest { + return ApiListCatalogProductsRequest{ + apiService: a.defaultApi, + ctx: ctx, + } +} + +func (a *APIClient) ListCatalogProductsExecute(ctx context.Context) (*ListCatalogProductsResponse, error) { + r := ApiListCatalogProductsRequest{ + apiService: a.defaultApi, + ctx: ctx, + } + return r.Execute() +} + +type ApiListVendorSubscriptionsRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + cursor *string + limit *float32 + productId *string +} + +// A pagination cursor that represents a position in the dataset. If given, results will be returned from the item after the cursor. If not given, results will be returned from the beginning. + +func (r ApiListVendorSubscriptionsRequest) Cursor(cursor string) ApiListVendorSubscriptionsRequest { + r.cursor = &cursor + return r +} + +// The maximum number of items to return in the response. If maximum is exceeded, maximum is used. + +func (r ApiListVendorSubscriptionsRequest) Limit(limit float32) ApiListVendorSubscriptionsRequest { + r.limit = &limit + return r +} + +// The product ID. + +func (r ApiListVendorSubscriptionsRequest) ProductId(productId string) ApiListVendorSubscriptionsRequest { + r.productId = &productId + return r +} + +func (r ApiListVendorSubscriptionsRequest) Execute() (*ListVendorSubscriptionsResponse, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *ListVendorSubscriptionsResponse + ) + a := r.apiService + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.ListVendorSubscriptions") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1/vendors/projects/{projectId}/subscriptions" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if r.cursor != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "cursor", r.cursor, "") + } + if r.limit != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "limit", r.limit, "") + } + if r.productId != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "productId", r.productId, "") + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := a.client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v ErrorResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v ErrorResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v ErrorResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +ListVendorSubscriptions: List all subscriptions + +List all subscriptions. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The project ID. + @return ApiListVendorSubscriptionsRequest +*/ +func (a *APIClient) ListVendorSubscriptions(ctx context.Context, projectId string) ApiListVendorSubscriptionsRequest { + return ApiListVendorSubscriptionsRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + } +} + +func (a *APIClient) ListVendorSubscriptionsExecute(ctx context.Context, projectId string) (*ListVendorSubscriptionsResponse, error) { + r := ApiListVendorSubscriptionsRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + } + return r.Execute() +} + +type ApiResolveCustomerRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + resolveCustomerPayload *ResolveCustomerPayload +} + +func (r ApiResolveCustomerRequest) ResolveCustomerPayload(resolveCustomerPayload ResolveCustomerPayload) ApiResolveCustomerRequest { + r.resolveCustomerPayload = &resolveCustomerPayload + return r +} + +func (r ApiResolveCustomerRequest) Execute() (*VendorSubscription, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *VendorSubscription + ) + a := r.apiService + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.ResolveCustomer") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1/vendors/projects/{projectId}/resolve-customer" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.resolveCustomerPayload == nil { + return localVarReturnValue, fmt.Errorf("resolveCustomerPayload is required and must be specified") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.resolveCustomerPayload + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := a.client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v ErrorResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v ErrorResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v ErrorResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v ErrorResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +ResolveCustomer: Resolve customer + +Get details about the requested subscription. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The project ID. + @return ApiResolveCustomerRequest +*/ +func (a *APIClient) ResolveCustomer(ctx context.Context, projectId string) ApiResolveCustomerRequest { + return ApiResolveCustomerRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + } +} + +func (a *APIClient) ResolveCustomerExecute(ctx context.Context, projectId string) (*VendorSubscription, error) { + r := ApiResolveCustomerRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + } + return r.Execute() +} diff --git a/services/stackitmarketplace/api_default_test.go b/services/stackitmarketplace/api_default_test.go new file mode 100644 index 000000000..d9d948744 --- /dev/null +++ b/services/stackitmarketplace/api_default_test.go @@ -0,0 +1,335 @@ +/* +STACKIT Marketplace API + +Testing DefaultApiService + +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); + +package stackitmarketplace + +import ( + "context" + "encoding/json" + "net/http" + "net/http/httptest" + "net/url" + "strings" + "testing" + + "github.com/stackitcloud/stackit-sdk-go/core/config" +) + +func Test_stackitmarketplace_DefaultApiService(t *testing.T) { + + t.Run("Test DefaultApiService ApproveSubscription", func(t *testing.T) { + path := "/v1/vendors/projects/{projectId}/subscriptions/{subscriptionId}/approve" + projectIdValue := "projectId" + path = strings.Replace(path, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + subscriptionIdValue := "subscriptionId" + path = strings.Replace(path, "{"+"subscriptionId"+"}", url.PathEscape(ParameterValueToString(subscriptionIdValue, "subscriptionId")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(path, func(w http.ResponseWriter, req *http.Request) { + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for stackitmarketplace_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := "projectId" + subscriptionId := "subscriptionId" + + reqErr := apiClient.ApproveSubscription(context.Background(), projectId, subscriptionId).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + }) + + t.Run("Test DefaultApiService GetCatalogProduct", func(t *testing.T) { + path := "/v1/catalog/products/{productId}" + productIdValue := "productId" + path = strings.Replace(path, "{"+"productId"+"}", url.PathEscape(ParameterValueToString(productIdValue, "productId")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(path, func(w http.ResponseWriter, req *http.Request) { + data := CatalogProductDetail{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for stackitmarketplace_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + productId := "productId" + + resp, reqErr := apiClient.GetCatalogProduct(context.Background(), productId).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if resp == nil { + t.Fatalf("response not present") + } + }) + + t.Run("Test DefaultApiService GetVendorSubscription", func(t *testing.T) { + path := "/v1/vendors/projects/{projectId}/subscriptions/{subscriptionId}" + projectIdValue := "projectId" + path = strings.Replace(path, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + subscriptionIdValue := "subscriptionId" + path = strings.Replace(path, "{"+"subscriptionId"+"}", url.PathEscape(ParameterValueToString(subscriptionIdValue, "subscriptionId")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(path, func(w http.ResponseWriter, req *http.Request) { + data := VendorSubscription{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for stackitmarketplace_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := "projectId" + subscriptionId := "subscriptionId" + + resp, reqErr := apiClient.GetVendorSubscription(context.Background(), projectId, subscriptionId).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if resp == nil { + t.Fatalf("response not present") + } + }) + + t.Run("Test DefaultApiService ListCatalogProducts", func(t *testing.T) { + path := "/v1/catalog/products" + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(path, func(w http.ResponseWriter, req *http.Request) { + data := ListCatalogProductsResponse{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for stackitmarketplace_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + resp, reqErr := apiClient.ListCatalogProducts(context.Background()).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if resp == nil { + t.Fatalf("response not present") + } + }) + + t.Run("Test DefaultApiService ListVendorSubscriptions", func(t *testing.T) { + path := "/v1/vendors/projects/{projectId}/subscriptions" + projectIdValue := "projectId" + path = strings.Replace(path, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(path, func(w http.ResponseWriter, req *http.Request) { + data := ListVendorSubscriptionsResponse{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for stackitmarketplace_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := "projectId" + + resp, reqErr := apiClient.ListVendorSubscriptions(context.Background(), projectId).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if resp == nil { + t.Fatalf("response not present") + } + }) + + t.Run("Test DefaultApiService ResolveCustomer", func(t *testing.T) { + path := "/v1/vendors/projects/{projectId}/resolve-customer" + projectIdValue := "projectId" + path = strings.Replace(path, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(path, func(w http.ResponseWriter, req *http.Request) { + data := VendorSubscription{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for stackitmarketplace_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := "projectId" + resolveCustomerPayload := ResolveCustomerPayload{} + + resp, reqErr := apiClient.ResolveCustomer(context.Background(), projectId).ResolveCustomerPayload(resolveCustomerPayload).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if resp == nil { + t.Fatalf("response not present") + } + }) + +} diff --git a/services/stackitmarketplace/client.go b/services/stackitmarketplace/client.go new file mode 100644 index 000000000..e99ec2ce5 --- /dev/null +++ b/services/stackitmarketplace/client.go @@ -0,0 +1,631 @@ +/* +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 ( + "bytes" + "context" + "encoding/json" + "encoding/xml" + "fmt" + "io" + "log" + "mime/multipart" + "net/http" + "net/http/httputil" + "net/url" + "os" + "path/filepath" + "reflect" + "regexp" + "strconv" + "strings" + "time" + "unicode/utf8" + + "github.com/stackitcloud/stackit-sdk-go/core/auth" + "github.com/stackitcloud/stackit-sdk-go/core/config" +) + +var ( + jsonCheck = regexp.MustCompile(`(?i:(?:application|text)/(?:vnd\.[^;]+\+)?json)`) + xmlCheck = regexp.MustCompile(`(?i:(?:application|text)/xml)`) + queryParamSplit = regexp.MustCompile(`(^|&)([^&]+)`) + queryDescape = strings.NewReplacer("%5B", "[", "%5D", "]") +) + +// APIClient manages communication with the STACKIT Marketplace API API v1 +// In most cases there should be only one, shared, APIClient. +type APIClient struct { + cfg *config.Configuration + common service // Reuse a single struct instead of allocating one for each service on the heap. + defaultApi *DefaultApiService +} + +type service struct { + client *APIClient +} + +// NewAPIClient creates a new API client. +// Optionally receives configuration options +func NewAPIClient(opts ...config.ConfigurationOption) (*APIClient, error) { + cfg := NewConfiguration() + + for _, option := range opts { + err := option(cfg) + if err != nil { + return nil, fmt.Errorf("configuring the client: %w", err) + } + } + + err := config.ConfigureRegion(cfg) + if err != nil { + return nil, fmt.Errorf("configuring region: %w", err) + } + + if cfg.HTTPClient == nil { + cfg.HTTPClient = &http.Client{} + } + + authRoundTripper, err := auth.SetupAuth(cfg) + if err != nil { + return nil, fmt.Errorf("setting up authentication: %w", err) + } + + roundTripper := authRoundTripper + if cfg.Middleware != nil { + roundTripper = config.ChainMiddleware(roundTripper, cfg.Middleware...) + } + + cfg.HTTPClient.Transport = roundTripper + + c := &APIClient{} + c.cfg = cfg + c.common.client = c + c.defaultApi = (*DefaultApiService)(&c.common) + + return c, nil +} + +func atoi(in string) (int, error) { + return strconv.Atoi(in) +} + +// selectHeaderContentType select a content type from the available list. +func selectHeaderContentType(contentTypes []string) string { + if len(contentTypes) == 0 { + return "" + } + if contains(contentTypes, "application/json") { + return "application/json" + } + return contentTypes[0] // use the first content type specified in 'consumes' +} + +// selectHeaderAccept join all accept types and return +func selectHeaderAccept(accepts []string) string { + if len(accepts) == 0 { + return "" + } + + if contains(accepts, "application/json") { + return "application/json" + } + + return strings.Join(accepts, ",") +} + +// contains is a case insensitive match, finding needle in a haystack +func contains(haystack []string, needle string) bool { + for _, a := range haystack { + if strings.EqualFold(a, needle) { + return true + } + } + return false +} + +// Verify optional parameters are of the correct type. +func typeCheckParameter(obj interface{}, expected string, name string) error { + // Make sure there is an object. + if obj == nil { + return nil + } + + // Check the type is as expected. + if reflect.TypeOf(obj).String() != expected { + return fmt.Errorf("expected %s to be of type %s but received %s", name, expected, reflect.TypeOf(obj).String()) + } + return nil +} + +func ParameterValueToString(obj interface{}, key string) string { + if reflect.TypeOf(obj).Kind() != reflect.Ptr { + return fmt.Sprintf("%v", obj) + } + var param, ok = obj.(MappedNullable) + if !ok { + return "" + } + dataMap, err := param.ToMap() + if err != nil { + return "" + } + return fmt.Sprintf("%v", dataMap[key]) +} + +// parameterAddToHeaderOrQuery adds the provided object to the request header or url query +// supporting deep object syntax +func parameterAddToHeaderOrQuery(headerOrQueryParams interface{}, keyPrefix string, obj interface{}, collectionType string) { + var v = reflect.ValueOf(obj) + var value = "" + if v == reflect.ValueOf(nil) { + value = "null" + } else { + switch v.Kind() { + case reflect.Invalid: + value = "invalid" + + case reflect.Struct: + if t, ok := obj.(MappedNullable); ok { + dataMap, err := t.ToMap() + if err != nil { + return + } + parameterAddToHeaderOrQuery(headerOrQueryParams, keyPrefix, dataMap, collectionType) + return + } + if t, ok := obj.(time.Time); ok { + parameterAddToHeaderOrQuery(headerOrQueryParams, keyPrefix, t.Format(time.RFC3339), collectionType) + return + } + value = v.Type().String() + " value" + case reflect.Slice: + var indValue = reflect.ValueOf(obj) + if indValue == reflect.ValueOf(nil) { + return + } + var lenIndValue = indValue.Len() + for i := 0; i < lenIndValue; i++ { + var arrayValue = indValue.Index(i) + parameterAddToHeaderOrQuery(headerOrQueryParams, keyPrefix, arrayValue.Interface(), collectionType) + } + return + + case reflect.Map: + var indValue = reflect.ValueOf(obj) + if indValue == reflect.ValueOf(nil) { + return + } + iter := indValue.MapRange() + for iter.Next() { + k, v := iter.Key(), iter.Value() + parameterAddToHeaderOrQuery(headerOrQueryParams, fmt.Sprintf("%s[%s]", keyPrefix, k.String()), v.Interface(), collectionType) + } + return + + case reflect.Interface: + fallthrough + case reflect.Ptr: + parameterAddToHeaderOrQuery(headerOrQueryParams, keyPrefix, v.Elem().Interface(), collectionType) + return + + case reflect.Int, reflect.Int8, reflect.Int16, + reflect.Int32, reflect.Int64: + value = strconv.FormatInt(v.Int(), 10) + case reflect.Uint, reflect.Uint8, reflect.Uint16, + reflect.Uint32, reflect.Uint64, reflect.Uintptr: + value = strconv.FormatUint(v.Uint(), 10) + case reflect.Float32, reflect.Float64: + value = strconv.FormatFloat(v.Float(), 'g', -1, 32) + case reflect.Bool: + value = strconv.FormatBool(v.Bool()) + case reflect.String: + value = v.String() + default: + value = v.Type().String() + " value" + } + } + + switch valuesMap := headerOrQueryParams.(type) { + case url.Values: + if collectionType == "csv" && valuesMap.Get(keyPrefix) != "" { + valuesMap.Set(keyPrefix, valuesMap.Get(keyPrefix)+","+value) + } else { + valuesMap.Add(keyPrefix, value) + } + break + case map[string]string: + valuesMap[keyPrefix] = value + break + } +} + +// helper for converting interface{} parameters to json strings +func parameterToJson(obj interface{}) (string, error) { + jsonBuf, err := json.Marshal(obj) + if err != nil { + return "", err + } + return string(jsonBuf), err +} + +// callAPI do the request. +func (c *APIClient) callAPI(request *http.Request) (*http.Response, error) { + if c.cfg.Debug { + dump, err := httputil.DumpRequestOut(request, true) + if err != nil { + return nil, err + } + log.Printf("\n%s\n", string(dump)) + } + + resp, err := c.cfg.HTTPClient.Do(request) + if err != nil { + return resp, err + } + + if c.cfg.Debug { + dump, err := httputil.DumpResponse(resp, true) + if err != nil { + return resp, err + } + log.Printf("\n%s\n", string(dump)) + } + return resp, err +} + +// Allow modification of underlying config for alternate implementations and testing +// Caution: modifying the configuration while live can cause data races and potentially unwanted behavior +func (c *APIClient) GetConfig() *config.Configuration { + return c.cfg +} + +type formFile struct { + fileBytes []byte + fileName string + formFileName string +} + +// prepareRequest build the request +func (c *APIClient) prepareRequest( + ctx context.Context, + path string, method string, + postBody interface{}, + headerParams map[string]string, + queryParams url.Values, + formParams url.Values, + formFiles []formFile) (localVarRequest *http.Request, err error) { + + var body *bytes.Buffer + + // Detect postBody type and post. + if postBody != nil { + contentType := headerParams["Content-Type"] + if contentType == "" { + contentType = detectContentType(postBody) + headerParams["Content-Type"] = contentType + } + + body, err = setBody(postBody, contentType) + if err != nil { + return nil, err + } + } + + // add form parameters and file if available. + if strings.HasPrefix(headerParams["Content-Type"], "multipart/form-data") && len(formParams) > 0 || (len(formFiles) > 0) { + if body != nil { + return nil, fmt.Errorf("cannot specify postBody and multipart form at the same time.") + } + body = &bytes.Buffer{} + w := multipart.NewWriter(body) + + for k, v := range formParams { + for _, iv := range v { + if strings.HasPrefix(k, "@") { // file + err = addFile(w, k[1:], iv) + if err != nil { + return nil, err + } + } else { // form value + w.WriteField(k, iv) + } + } + } + for _, formFile := range formFiles { + if len(formFile.fileBytes) > 0 && formFile.fileName != "" { + w.Boundary() + part, err := w.CreateFormFile(formFile.formFileName, filepath.Base(formFile.fileName)) + if err != nil { + return nil, err + } + _, err = part.Write(formFile.fileBytes) + if err != nil { + return nil, err + } + } + } + + // Set the Boundary in the Content-Type + headerParams["Content-Type"] = w.FormDataContentType() + + // Set Content-Length + headerParams["Content-Length"] = fmt.Sprintf("%d", body.Len()) + w.Close() + } + + if strings.HasPrefix(headerParams["Content-Type"], "application/x-www-form-urlencoded") && len(formParams) > 0 { + if body != nil { + return nil, fmt.Errorf("cannot specify postBody and x-www-form-urlencoded form at the same time.") + } + body = &bytes.Buffer{} + body.WriteString(formParams.Encode()) + // Set Content-Length + headerParams["Content-Length"] = fmt.Sprintf("%d", body.Len()) + } + + // Setup path and query parameters + url, err := url.Parse(path) + if err != nil { + return nil, err + } + + // Override request host, if applicable + if c.cfg.Host != "" { + url.Host = c.cfg.Host + } + + // Override request scheme, if applicable + if c.cfg.Scheme != "" { + url.Scheme = c.cfg.Scheme + } + + // Adding Query Param + query := url.Query() + for k, v := range queryParams { + for _, iv := range v { + query.Add(k, iv) + } + } + + // Encode the parameters. + url.RawQuery = queryParamSplit.ReplaceAllStringFunc(query.Encode(), func(s string) string { + pieces := strings.Split(s, "=") + pieces[0] = queryDescape.Replace(pieces[0]) + return strings.Join(pieces, "=") + }) + + // Generate a new request + if body != nil { + localVarRequest, err = http.NewRequest(method, url.String(), body) + } else { + localVarRequest, err = http.NewRequest(method, url.String(), nil) + } + if err != nil { + return nil, err + } + + // add header parameters, if any + if len(headerParams) > 0 { + headers := http.Header{} + for h, v := range headerParams { + headers[h] = []string{v} + } + localVarRequest.Header = headers + } + + // Add the user agent to the request. + localVarRequest.Header.Add("User-Agent", c.cfg.UserAgent) + + if ctx != nil { + // add context to the request + localVarRequest = localVarRequest.WithContext(ctx) + + // Walk through any authentication. + + } + + for header, value := range c.cfg.DefaultHeader { + localVarRequest.Header.Add(header, value) + } + return localVarRequest, nil +} + +func (c *APIClient) decode(v interface{}, b []byte, contentType string) (err error) { + if len(b) == 0 { + return nil + } + if s, ok := v.(*string); ok { + *s = string(b) + return nil + } + if f, ok := v.(*os.File); ok { + f, err = os.CreateTemp("", "HttpClientFile") + if err != nil { + return + } + _, err = f.Write(b) + if err != nil { + return + } + _, err = f.Seek(0, io.SeekStart) + return + } + if f, ok := v.(**os.File); ok { + *f, err = os.CreateTemp("", "HttpClientFile") + if err != nil { + return + } + _, err = (*f).Write(b) + if err != nil { + return + } + _, err = (*f).Seek(0, io.SeekStart) + return + } + if xmlCheck.MatchString(contentType) { + if err = xml.Unmarshal(b, v); err != nil { + return err + } + return nil + } + if jsonCheck.MatchString(contentType) { + if actualObj, ok := v.(interface{ GetActualInstance() interface{} }); ok { // oneOf, anyOf schemas + if unmarshalObj, ok := actualObj.(interface{ UnmarshalJSON([]byte) error }); ok { // make sure it has UnmarshalJSON defined + if err = unmarshalObj.UnmarshalJSON(b); err != nil { + return err + } + } else { + return fmt.Errorf("unknown type with GetActualInstance but no unmarshalObj.UnmarshalJSON defined") + } + } else if err = json.Unmarshal(b, v); err != nil { // simple model + return err + } + return nil + } + return fmt.Errorf("undefined response type") +} + +// Add a file to the multipart request +func addFile(w *multipart.Writer, fieldName, path string) error { + file, err := os.Open(filepath.Clean(path)) + if err != nil { + return err + } + err = file.Close() + if err != nil { + return err + } + + part, err := w.CreateFormFile(fieldName, filepath.Base(path)) + if err != nil { + return err + } + _, err = io.Copy(part, file) + + return err +} + +// A wrapper for strict JSON decoding +func newStrictDecoder(data []byte) *json.Decoder { + dec := json.NewDecoder(bytes.NewBuffer(data)) + dec.DisallowUnknownFields() + return dec +} + +// Set request body from an interface{} +func setBody(body interface{}, contentType string) (bodyBuf *bytes.Buffer, err error) { + if bodyBuf == nil { + bodyBuf = &bytes.Buffer{} + } + + if reader, ok := body.(io.Reader); ok { + _, err = bodyBuf.ReadFrom(reader) + } else if fp, ok := body.(*os.File); ok { + _, err = bodyBuf.ReadFrom(fp) + } else if b, ok := body.([]byte); ok { + _, err = bodyBuf.Write(b) + } else if s, ok := body.(string); ok { + _, err = bodyBuf.WriteString(s) + } else if s, ok := body.(*string); ok { + _, err = bodyBuf.WriteString(*s) + } else if jsonCheck.MatchString(contentType) { + err = json.NewEncoder(bodyBuf).Encode(body) + } else if xmlCheck.MatchString(contentType) { + err = xml.NewEncoder(bodyBuf).Encode(body) + } + + if err != nil { + return nil, err + } + + if bodyBuf.Len() == 0 { + err = fmt.Errorf("invalid body type %s", contentType) + return nil, err + } + return bodyBuf, nil +} + +// detectContentType method is used to figure out `Request.Body` content type for request header +func detectContentType(body interface{}) string { + contentType := "text/plain; charset=utf-8" + kind := reflect.TypeOf(body).Kind() + + switch kind { + case reflect.Struct, reflect.Map, reflect.Ptr: + contentType = "application/json; charset=utf-8" + case reflect.String: + contentType = "text/plain; charset=utf-8" + default: + if b, ok := body.([]byte); ok { + contentType = http.DetectContentType(b) + } else if kind == reflect.Slice { + contentType = "application/json; charset=utf-8" + } + } + + return contentType +} + +// Ripped from https://github.com/gregjones/httpcache/blob/master/httpcache.go +type cacheControl map[string]string + +func parseCacheControl(headers http.Header) cacheControl { + cc := cacheControl{} + ccHeader := headers.Get("Cache-Control") + for _, part := range strings.Split(ccHeader, ",") { + part = strings.Trim(part, " ") + if part == "" { + continue + } + if strings.ContainsRune(part, '=') { + keyval := strings.Split(part, "=") + cc[strings.Trim(keyval[0], " ")] = strings.Trim(keyval[1], ",") + } else { + cc[part] = "" + } + } + return cc +} + +// CacheExpires helper function to determine remaining time before repeating a request. +func CacheExpires(r *http.Response) time.Time { + // Figure out when the cache expires. + var expires time.Time + now, err := time.Parse(time.RFC1123, r.Header.Get("date")) + if err != nil { + return time.Now() + } + respCacheControl := parseCacheControl(r.Header) + + if maxAge, ok := respCacheControl["max-age"]; ok { + lifetime, err := time.ParseDuration(maxAge + "s") + if err != nil { + expires = now + } else { + expires = now.Add(lifetime) + } + } else { + expiresHeader := r.Header.Get("Expires") + if expiresHeader != "" { + expires, err = time.Parse(time.RFC1123, expiresHeader) + if err != nil { + expires = now + } + } + } + return expires +} + +func strlen(s string) int { + return utf8.RuneCountInString(s) +} diff --git a/services/stackitmarketplace/configuration.go b/services/stackitmarketplace/configuration.go new file mode 100644 index 000000000..108ac6e3e --- /dev/null +++ b/services/stackitmarketplace/configuration.go @@ -0,0 +1,38 @@ +/* +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 ( + "github.com/stackitcloud/stackit-sdk-go/core/config" +) + +// NewConfiguration returns a new Configuration object +func NewConfiguration() *config.Configuration { + cfg := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Servers: config.ServerConfigurations{ + { + URL: "https://stackit-marketplace.api.stackit.cloud", + Description: "No description provided", + Variables: map[string]config.ServerVariable{ + "region": { + Description: "No description provided", + DefaultValue: "global", + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + return cfg +} diff --git a/services/stackitmarketplace/go.mod b/services/stackitmarketplace/go.mod new file mode 100644 index 000000000..ddf25694c --- /dev/null +++ b/services/stackitmarketplace/go.mod @@ -0,0 +1,10 @@ +module github.com/stackitcloud/stackit-sdk-go/services/stackitmarketplace + +go 1.18 + +require github.com/stackitcloud/stackit-sdk-go/core v0.15.0 + +require ( + github.com/golang-jwt/jwt/v5 v5.2.1 // indirect + github.com/google/uuid v1.6.0 // indirect +) diff --git a/services/stackitmarketplace/go.sum b/services/stackitmarketplace/go.sum new file mode 100644 index 000000000..318b353d7 --- /dev/null +++ b/services/stackitmarketplace/go.sum @@ -0,0 +1,7 @@ +github.com/golang-jwt/jwt/v5 v5.2.1 h1:OuVbFODueb089Lh128TAcimifWaLhJwVflnrgM17wHk= +github.com/golang-jwt/jwt/v5 v5.2.1/go.mod h1:pqrtFR0X4osieyHYxtmOUWsAWrfe1Q5UVIyoH402zdk= +github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= +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/stackitcloud/stackit-sdk-go/core v0.15.0 h1:oMP6L616/bP3b/B1Me7Ptu637dAJKr7NO3Rd3UwqpvE= +github.com/stackitcloud/stackit-sdk-go/core v0.15.0/go.mod h1:mDX1mSTsB3mP+tNBGcFNx6gH1mGBN4T+dVt+lcw7nlw= diff --git a/services/stackitmarketplace/model_catalog_pricing_option_highlight.go b/services/stackitmarketplace/model_catalog_pricing_option_highlight.go new file mode 100644 index 000000000..efe0561b1 --- /dev/null +++ b/services/stackitmarketplace/model_catalog_pricing_option_highlight.go @@ -0,0 +1,117 @@ +/* +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 CatalogPricingOptionHighlight type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &CatalogPricingOptionHighlight{} + +// CatalogPricingOptionHighlight struct for CatalogPricingOptionHighlight +type CatalogPricingOptionHighlight struct { + // The highlight content. + HighlightContent *string `json:"highlightContent,omitempty"` +} + +// NewCatalogPricingOptionHighlight instantiates a new CatalogPricingOptionHighlight 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 NewCatalogPricingOptionHighlight() *CatalogPricingOptionHighlight { + this := CatalogPricingOptionHighlight{} + return &this +} + +// NewCatalogPricingOptionHighlightWithDefaults instantiates a new CatalogPricingOptionHighlight 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 NewCatalogPricingOptionHighlightWithDefaults() *CatalogPricingOptionHighlight { + this := CatalogPricingOptionHighlight{} + return &this +} + +// GetHighlightContent returns the HighlightContent field value if set, zero value otherwise. +func (o *CatalogPricingOptionHighlight) GetHighlightContent() *string { + if o == nil || IsNil(o.HighlightContent) { + var ret *string + return ret + } + return o.HighlightContent +} + +// GetHighlightContentOk returns a tuple with the HighlightContent field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CatalogPricingOptionHighlight) GetHighlightContentOk() (*string, bool) { + if o == nil || IsNil(o.HighlightContent) { + return nil, false + } + return o.HighlightContent, true +} + +// HasHighlightContent returns a boolean if a field has been set. +func (o *CatalogPricingOptionHighlight) HasHighlightContent() bool { + if o != nil && !IsNil(o.HighlightContent) { + return true + } + + return false +} + +// SetHighlightContent gets a reference to the given string and assigns it to the HighlightContent field. +func (o *CatalogPricingOptionHighlight) SetHighlightContent(v *string) { + o.HighlightContent = v +} + +func (o CatalogPricingOptionHighlight) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.HighlightContent) { + toSerialize["highlightContent"] = o.HighlightContent + } + return toSerialize, nil +} + +type NullableCatalogPricingOptionHighlight struct { + value *CatalogPricingOptionHighlight + isSet bool +} + +func (v NullableCatalogPricingOptionHighlight) Get() *CatalogPricingOptionHighlight { + return v.value +} + +func (v *NullableCatalogPricingOptionHighlight) Set(val *CatalogPricingOptionHighlight) { + v.value = val + v.isSet = true +} + +func (v NullableCatalogPricingOptionHighlight) IsSet() bool { + return v.isSet +} + +func (v *NullableCatalogPricingOptionHighlight) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableCatalogPricingOptionHighlight(val *CatalogPricingOptionHighlight) *NullableCatalogPricingOptionHighlight { + return &NullableCatalogPricingOptionHighlight{value: val, isSet: true} +} + +func (v NullableCatalogPricingOptionHighlight) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableCatalogPricingOptionHighlight) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/stackitmarketplace/model_catalog_product_detail.go b/services/stackitmarketplace/model_catalog_product_detail.go new file mode 100644 index 000000000..0bd1026d9 --- /dev/null +++ b/services/stackitmarketplace/model_catalog_product_detail.go @@ -0,0 +1,680 @@ +/* +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 CatalogProductDetail type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &CatalogProductDetail{} + +// CatalogProductDetail struct for CatalogProductDetail +type CatalogProductDetail struct { + // The list of categories associated to the product. + Categories *[]string `json:"categories,omitempty"` + // The product type. For reference: SAAS - Software as a Service, SAI - STACKIT Application Image + // REQUIRED + DeliveryMethod *string `json:"deliveryMethod"` + // The product description. + // REQUIRED + Description *string `json:"description"` + // The documentation URL. + // REQUIRED + DocumentationUrl *string `json:"documentationUrl"` + // The list of highlights. + // REQUIRED + Highlights *[]CatalogProductHighlight `json:"highlights"` + // If true, the product is not fully integrated but only listed. Product listings may not have prices and support information. + // REQUIRED + IsProductListing *bool `json:"isProductListing"` + // The lifecycle state of the product. + // REQUIRED + LifecycleState *string `json:"lifecycleState"` + // The logo base64 encoded. + // REQUIRED + Logo *string `json:"logo"` + // The product name. + // REQUIRED + Name *string `json:"name"` + // The list of pricing options. + // REQUIRED + PricingOptions *[]CatalogProductPricingOption `json:"pricingOptions"` + // The product ID. + // REQUIRED + ProductId *string `json:"productId"` + // The short summary of the product. + // REQUIRED + Summary *string `json:"summary"` + // The e-mail address for support inquiries. + SupportEmail *string `json:"supportEmail,omitempty"` + // The support FAQ URL. + SupportFaq *string `json:"supportFaq,omitempty"` + // The phone number for support inquiries. + SupportPhone *string `json:"supportPhone,omitempty"` + // The list of support resources. + SupportResources *[]CatalogProductSupportResource `json:"supportResources,omitempty"` + // REQUIRED + Vendor *CatalogProductDetailsVendor `json:"vendor"` + // The list of terms of use. + VendorTerms *[]CatalogProductVendorTerms `json:"vendorTerms,omitempty"` + // The video URL. + // REQUIRED + VideoUrl *string `json:"videoUrl"` +} + +type _CatalogProductDetail CatalogProductDetail + +// NewCatalogProductDetail instantiates a new CatalogProductDetail 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 NewCatalogProductDetail(deliveryMethod *string, description *string, documentationUrl *string, highlights *[]CatalogProductHighlight, isProductListing *bool, lifecycleState *string, logo *string, name *string, pricingOptions *[]CatalogProductPricingOption, productId *string, summary *string, vendor *CatalogProductDetailsVendor, videoUrl *string) *CatalogProductDetail { + this := CatalogProductDetail{} + this.DeliveryMethod = deliveryMethod + this.Description = description + this.DocumentationUrl = documentationUrl + this.Highlights = highlights + this.IsProductListing = isProductListing + this.LifecycleState = lifecycleState + this.Logo = logo + this.Name = name + this.PricingOptions = pricingOptions + this.ProductId = productId + this.Summary = summary + this.Vendor = vendor + this.VideoUrl = videoUrl + return &this +} + +// NewCatalogProductDetailWithDefaults instantiates a new CatalogProductDetail 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 NewCatalogProductDetailWithDefaults() *CatalogProductDetail { + this := CatalogProductDetail{} + return &this +} + +// GetCategories returns the Categories field value if set, zero value otherwise. +func (o *CatalogProductDetail) GetCategories() *[]string { + if o == nil || IsNil(o.Categories) { + var ret *[]string + return ret + } + return o.Categories +} + +// GetCategoriesOk returns a tuple with the Categories field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CatalogProductDetail) GetCategoriesOk() (*[]string, bool) { + if o == nil || IsNil(o.Categories) { + return nil, false + } + return o.Categories, true +} + +// HasCategories returns a boolean if a field has been set. +func (o *CatalogProductDetail) HasCategories() bool { + if o != nil && !IsNil(o.Categories) { + return true + } + + return false +} + +// SetCategories gets a reference to the given []string and assigns it to the Categories field. +func (o *CatalogProductDetail) SetCategories(v *[]string) { + o.Categories = v +} + +// GetDeliveryMethod returns the DeliveryMethod field value +func (o *CatalogProductDetail) GetDeliveryMethod() *string { + if o == nil || IsNil(o.DeliveryMethod) { + var ret *string + return ret + } + + return o.DeliveryMethod +} + +// GetDeliveryMethodOk returns a tuple with the DeliveryMethod field value +// and a boolean to check if the value has been set. +func (o *CatalogProductDetail) GetDeliveryMethodOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.DeliveryMethod, true +} + +// SetDeliveryMethod sets field value +func (o *CatalogProductDetail) SetDeliveryMethod(v *string) { + o.DeliveryMethod = v +} + +// GetDescription returns the Description field value +func (o *CatalogProductDetail) GetDescription() *string { + if o == nil || IsNil(o.Description) { + var ret *string + return ret + } + + return o.Description +} + +// GetDescriptionOk returns a tuple with the Description field value +// and a boolean to check if the value has been set. +func (o *CatalogProductDetail) GetDescriptionOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Description, true +} + +// SetDescription sets field value +func (o *CatalogProductDetail) SetDescription(v *string) { + o.Description = v +} + +// GetDocumentationUrl returns the DocumentationUrl field value +func (o *CatalogProductDetail) GetDocumentationUrl() *string { + if o == nil || IsNil(o.DocumentationUrl) { + var ret *string + return ret + } + + return o.DocumentationUrl +} + +// GetDocumentationUrlOk returns a tuple with the DocumentationUrl field value +// and a boolean to check if the value has been set. +func (o *CatalogProductDetail) GetDocumentationUrlOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.DocumentationUrl, true +} + +// SetDocumentationUrl sets field value +func (o *CatalogProductDetail) SetDocumentationUrl(v *string) { + o.DocumentationUrl = v +} + +// GetHighlights returns the Highlights field value +func (o *CatalogProductDetail) GetHighlights() *[]CatalogProductHighlight { + if o == nil || IsNil(o.Highlights) { + var ret *[]CatalogProductHighlight + return ret + } + + return o.Highlights +} + +// GetHighlightsOk returns a tuple with the Highlights field value +// and a boolean to check if the value has been set. +func (o *CatalogProductDetail) GetHighlightsOk() (*[]CatalogProductHighlight, bool) { + if o == nil { + return nil, false + } + return o.Highlights, true +} + +// SetHighlights sets field value +func (o *CatalogProductDetail) SetHighlights(v *[]CatalogProductHighlight) { + o.Highlights = v +} + +// GetIsProductListing returns the IsProductListing field value +func (o *CatalogProductDetail) GetIsProductListing() *bool { + if o == nil || IsNil(o.IsProductListing) { + var ret *bool + return ret + } + + return o.IsProductListing +} + +// GetIsProductListingOk returns a tuple with the IsProductListing field value +// and a boolean to check if the value has been set. +func (o *CatalogProductDetail) GetIsProductListingOk() (*bool, bool) { + if o == nil { + return nil, false + } + return o.IsProductListing, true +} + +// SetIsProductListing sets field value +func (o *CatalogProductDetail) SetIsProductListing(v *bool) { + o.IsProductListing = v +} + +// GetLifecycleState returns the LifecycleState field value +func (o *CatalogProductDetail) GetLifecycleState() *string { + if o == nil || IsNil(o.LifecycleState) { + var ret *string + return ret + } + + return o.LifecycleState +} + +// GetLifecycleStateOk returns a tuple with the LifecycleState field value +// and a boolean to check if the value has been set. +func (o *CatalogProductDetail) GetLifecycleStateOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.LifecycleState, true +} + +// SetLifecycleState sets field value +func (o *CatalogProductDetail) SetLifecycleState(v *string) { + o.LifecycleState = v +} + +// GetLogo returns the Logo field value +func (o *CatalogProductDetail) GetLogo() *string { + if o == nil || IsNil(o.Logo) { + var ret *string + return ret + } + + return o.Logo +} + +// GetLogoOk returns a tuple with the Logo field value +// and a boolean to check if the value has been set. +func (o *CatalogProductDetail) GetLogoOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Logo, true +} + +// SetLogo sets field value +func (o *CatalogProductDetail) SetLogo(v *string) { + o.Logo = v +} + +// GetName returns the Name field value +func (o *CatalogProductDetail) GetName() *string { + if o == nil || IsNil(o.Name) { + var ret *string + return ret + } + + return o.Name +} + +// GetNameOk returns a tuple with the Name field value +// and a boolean to check if the value has been set. +func (o *CatalogProductDetail) GetNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Name, true +} + +// SetName sets field value +func (o *CatalogProductDetail) SetName(v *string) { + o.Name = v +} + +// GetPricingOptions returns the PricingOptions field value +func (o *CatalogProductDetail) GetPricingOptions() *[]CatalogProductPricingOption { + if o == nil || IsNil(o.PricingOptions) { + var ret *[]CatalogProductPricingOption + return ret + } + + return o.PricingOptions +} + +// GetPricingOptionsOk returns a tuple with the PricingOptions field value +// and a boolean to check if the value has been set. +func (o *CatalogProductDetail) GetPricingOptionsOk() (*[]CatalogProductPricingOption, bool) { + if o == nil { + return nil, false + } + return o.PricingOptions, true +} + +// SetPricingOptions sets field value +func (o *CatalogProductDetail) SetPricingOptions(v *[]CatalogProductPricingOption) { + o.PricingOptions = v +} + +// GetProductId returns the ProductId field value +func (o *CatalogProductDetail) GetProductId() *string { + if o == nil || IsNil(o.ProductId) { + var ret *string + return ret + } + + return o.ProductId +} + +// GetProductIdOk returns a tuple with the ProductId field value +// and a boolean to check if the value has been set. +func (o *CatalogProductDetail) GetProductIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.ProductId, true +} + +// SetProductId sets field value +func (o *CatalogProductDetail) SetProductId(v *string) { + o.ProductId = v +} + +// GetSummary returns the Summary field value +func (o *CatalogProductDetail) GetSummary() *string { + if o == nil || IsNil(o.Summary) { + var ret *string + return ret + } + + return o.Summary +} + +// GetSummaryOk returns a tuple with the Summary field value +// and a boolean to check if the value has been set. +func (o *CatalogProductDetail) GetSummaryOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Summary, true +} + +// SetSummary sets field value +func (o *CatalogProductDetail) SetSummary(v *string) { + o.Summary = v +} + +// GetSupportEmail returns the SupportEmail field value if set, zero value otherwise. +func (o *CatalogProductDetail) GetSupportEmail() *string { + if o == nil || IsNil(o.SupportEmail) { + var ret *string + return ret + } + return o.SupportEmail +} + +// GetSupportEmailOk returns a tuple with the SupportEmail field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CatalogProductDetail) GetSupportEmailOk() (*string, bool) { + if o == nil || IsNil(o.SupportEmail) { + return nil, false + } + return o.SupportEmail, true +} + +// HasSupportEmail returns a boolean if a field has been set. +func (o *CatalogProductDetail) HasSupportEmail() bool { + if o != nil && !IsNil(o.SupportEmail) { + return true + } + + return false +} + +// SetSupportEmail gets a reference to the given string and assigns it to the SupportEmail field. +func (o *CatalogProductDetail) SetSupportEmail(v *string) { + o.SupportEmail = v +} + +// GetSupportFaq returns the SupportFaq field value if set, zero value otherwise. +func (o *CatalogProductDetail) GetSupportFaq() *string { + if o == nil || IsNil(o.SupportFaq) { + var ret *string + return ret + } + return o.SupportFaq +} + +// GetSupportFaqOk returns a tuple with the SupportFaq field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CatalogProductDetail) GetSupportFaqOk() (*string, bool) { + if o == nil || IsNil(o.SupportFaq) { + return nil, false + } + return o.SupportFaq, true +} + +// HasSupportFaq returns a boolean if a field has been set. +func (o *CatalogProductDetail) HasSupportFaq() bool { + if o != nil && !IsNil(o.SupportFaq) { + return true + } + + return false +} + +// SetSupportFaq gets a reference to the given string and assigns it to the SupportFaq field. +func (o *CatalogProductDetail) SetSupportFaq(v *string) { + o.SupportFaq = v +} + +// GetSupportPhone returns the SupportPhone field value if set, zero value otherwise. +func (o *CatalogProductDetail) GetSupportPhone() *string { + if o == nil || IsNil(o.SupportPhone) { + var ret *string + return ret + } + return o.SupportPhone +} + +// GetSupportPhoneOk returns a tuple with the SupportPhone field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CatalogProductDetail) GetSupportPhoneOk() (*string, bool) { + if o == nil || IsNil(o.SupportPhone) { + return nil, false + } + return o.SupportPhone, true +} + +// HasSupportPhone returns a boolean if a field has been set. +func (o *CatalogProductDetail) HasSupportPhone() bool { + if o != nil && !IsNil(o.SupportPhone) { + return true + } + + return false +} + +// SetSupportPhone gets a reference to the given string and assigns it to the SupportPhone field. +func (o *CatalogProductDetail) SetSupportPhone(v *string) { + o.SupportPhone = v +} + +// GetSupportResources returns the SupportResources field value if set, zero value otherwise. +func (o *CatalogProductDetail) GetSupportResources() *[]CatalogProductSupportResource { + if o == nil || IsNil(o.SupportResources) { + var ret *[]CatalogProductSupportResource + return ret + } + return o.SupportResources +} + +// GetSupportResourcesOk returns a tuple with the SupportResources field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CatalogProductDetail) GetSupportResourcesOk() (*[]CatalogProductSupportResource, bool) { + if o == nil || IsNil(o.SupportResources) { + return nil, false + } + return o.SupportResources, true +} + +// HasSupportResources returns a boolean if a field has been set. +func (o *CatalogProductDetail) HasSupportResources() bool { + if o != nil && !IsNil(o.SupportResources) { + return true + } + + return false +} + +// SetSupportResources gets a reference to the given []CatalogProductSupportResource and assigns it to the SupportResources field. +func (o *CatalogProductDetail) SetSupportResources(v *[]CatalogProductSupportResource) { + o.SupportResources = v +} + +// GetVendor returns the Vendor field value +func (o *CatalogProductDetail) GetVendor() *CatalogProductDetailsVendor { + if o == nil || IsNil(o.Vendor) { + var ret *CatalogProductDetailsVendor + return ret + } + + return o.Vendor +} + +// GetVendorOk returns a tuple with the Vendor field value +// and a boolean to check if the value has been set. +func (o *CatalogProductDetail) GetVendorOk() (*CatalogProductDetailsVendor, bool) { + if o == nil { + return nil, false + } + return o.Vendor, true +} + +// SetVendor sets field value +func (o *CatalogProductDetail) SetVendor(v *CatalogProductDetailsVendor) { + o.Vendor = v +} + +// GetVendorTerms returns the VendorTerms field value if set, zero value otherwise. +func (o *CatalogProductDetail) GetVendorTerms() *[]CatalogProductVendorTerms { + if o == nil || IsNil(o.VendorTerms) { + var ret *[]CatalogProductVendorTerms + return ret + } + return o.VendorTerms +} + +// GetVendorTermsOk returns a tuple with the VendorTerms field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CatalogProductDetail) GetVendorTermsOk() (*[]CatalogProductVendorTerms, bool) { + if o == nil || IsNil(o.VendorTerms) { + return nil, false + } + return o.VendorTerms, true +} + +// HasVendorTerms returns a boolean if a field has been set. +func (o *CatalogProductDetail) HasVendorTerms() bool { + if o != nil && !IsNil(o.VendorTerms) { + return true + } + + return false +} + +// SetVendorTerms gets a reference to the given []CatalogProductVendorTerms and assigns it to the VendorTerms field. +func (o *CatalogProductDetail) SetVendorTerms(v *[]CatalogProductVendorTerms) { + o.VendorTerms = v +} + +// GetVideoUrl returns the VideoUrl field value +func (o *CatalogProductDetail) GetVideoUrl() *string { + if o == nil || IsNil(o.VideoUrl) { + var ret *string + return ret + } + + return o.VideoUrl +} + +// GetVideoUrlOk returns a tuple with the VideoUrl field value +// and a boolean to check if the value has been set. +func (o *CatalogProductDetail) GetVideoUrlOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.VideoUrl, true +} + +// SetVideoUrl sets field value +func (o *CatalogProductDetail) SetVideoUrl(v *string) { + o.VideoUrl = v +} + +func (o CatalogProductDetail) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Categories) { + toSerialize["categories"] = o.Categories + } + toSerialize["deliveryMethod"] = o.DeliveryMethod + toSerialize["description"] = o.Description + toSerialize["documentationUrl"] = o.DocumentationUrl + toSerialize["highlights"] = o.Highlights + toSerialize["isProductListing"] = o.IsProductListing + toSerialize["lifecycleState"] = o.LifecycleState + toSerialize["logo"] = o.Logo + toSerialize["name"] = o.Name + toSerialize["pricingOptions"] = o.PricingOptions + toSerialize["productId"] = o.ProductId + toSerialize["summary"] = o.Summary + if !IsNil(o.SupportEmail) { + toSerialize["supportEmail"] = o.SupportEmail + } + if !IsNil(o.SupportFaq) { + toSerialize["supportFaq"] = o.SupportFaq + } + if !IsNil(o.SupportPhone) { + toSerialize["supportPhone"] = o.SupportPhone + } + if !IsNil(o.SupportResources) { + toSerialize["supportResources"] = o.SupportResources + } + toSerialize["vendor"] = o.Vendor + if !IsNil(o.VendorTerms) { + toSerialize["vendorTerms"] = o.VendorTerms + } + toSerialize["videoUrl"] = o.VideoUrl + return toSerialize, nil +} + +type NullableCatalogProductDetail struct { + value *CatalogProductDetail + isSet bool +} + +func (v NullableCatalogProductDetail) Get() *CatalogProductDetail { + return v.value +} + +func (v *NullableCatalogProductDetail) Set(val *CatalogProductDetail) { + v.value = val + v.isSet = true +} + +func (v NullableCatalogProductDetail) IsSet() bool { + return v.isSet +} + +func (v *NullableCatalogProductDetail) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableCatalogProductDetail(val *CatalogProductDetail) *NullableCatalogProductDetail { + return &NullableCatalogProductDetail{value: val, isSet: true} +} + +func (v NullableCatalogProductDetail) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableCatalogProductDetail) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/stackitmarketplace/model_catalog_product_details_vendor.go b/services/stackitmarketplace/model_catalog_product_details_vendor.go new file mode 100644 index 000000000..36ea655f0 --- /dev/null +++ b/services/stackitmarketplace/model_catalog_product_details_vendor.go @@ -0,0 +1,256 @@ +/* +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 CatalogProductDetailsVendor type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &CatalogProductDetailsVendor{} + +// CatalogProductDetailsVendor struct for CatalogProductDetailsVendor +type CatalogProductDetailsVendor struct { + // The vendor description. + // REQUIRED + Description *string `json:"description"` + // The vendor logo base64 encoded. + // REQUIRED + Logo *string `json:"logo"` + // The vendor name. + // REQUIRED + Name *string `json:"name"` + // The vendor ID. + // REQUIRED + VendorId *string `json:"vendorId"` + // The vendor video URL. + // REQUIRED + VideoUrl *string `json:"videoUrl"` + // The vendor website URL. + // REQUIRED + WebsiteUrl *string `json:"websiteUrl"` +} + +type _CatalogProductDetailsVendor CatalogProductDetailsVendor + +// NewCatalogProductDetailsVendor instantiates a new CatalogProductDetailsVendor 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 NewCatalogProductDetailsVendor(description *string, logo *string, name *string, vendorId *string, videoUrl *string, websiteUrl *string) *CatalogProductDetailsVendor { + this := CatalogProductDetailsVendor{} + this.Description = description + this.Logo = logo + this.Name = name + this.VendorId = vendorId + this.VideoUrl = videoUrl + this.WebsiteUrl = websiteUrl + return &this +} + +// NewCatalogProductDetailsVendorWithDefaults instantiates a new CatalogProductDetailsVendor 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 NewCatalogProductDetailsVendorWithDefaults() *CatalogProductDetailsVendor { + this := CatalogProductDetailsVendor{} + return &this +} + +// GetDescription returns the Description field value +func (o *CatalogProductDetailsVendor) GetDescription() *string { + if o == nil || IsNil(o.Description) { + var ret *string + return ret + } + + return o.Description +} + +// GetDescriptionOk returns a tuple with the Description field value +// and a boolean to check if the value has been set. +func (o *CatalogProductDetailsVendor) GetDescriptionOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Description, true +} + +// SetDescription sets field value +func (o *CatalogProductDetailsVendor) SetDescription(v *string) { + o.Description = v +} + +// GetLogo returns the Logo field value +func (o *CatalogProductDetailsVendor) GetLogo() *string { + if o == nil || IsNil(o.Logo) { + var ret *string + return ret + } + + return o.Logo +} + +// GetLogoOk returns a tuple with the Logo field value +// and a boolean to check if the value has been set. +func (o *CatalogProductDetailsVendor) GetLogoOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Logo, true +} + +// SetLogo sets field value +func (o *CatalogProductDetailsVendor) SetLogo(v *string) { + o.Logo = v +} + +// GetName returns the Name field value +func (o *CatalogProductDetailsVendor) GetName() *string { + if o == nil || IsNil(o.Name) { + var ret *string + return ret + } + + return o.Name +} + +// GetNameOk returns a tuple with the Name field value +// and a boolean to check if the value has been set. +func (o *CatalogProductDetailsVendor) GetNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Name, true +} + +// SetName sets field value +func (o *CatalogProductDetailsVendor) SetName(v *string) { + o.Name = v +} + +// GetVendorId returns the VendorId field value +func (o *CatalogProductDetailsVendor) GetVendorId() *string { + if o == nil || IsNil(o.VendorId) { + var ret *string + return ret + } + + return o.VendorId +} + +// GetVendorIdOk returns a tuple with the VendorId field value +// and a boolean to check if the value has been set. +func (o *CatalogProductDetailsVendor) GetVendorIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.VendorId, true +} + +// SetVendorId sets field value +func (o *CatalogProductDetailsVendor) SetVendorId(v *string) { + o.VendorId = v +} + +// GetVideoUrl returns the VideoUrl field value +func (o *CatalogProductDetailsVendor) GetVideoUrl() *string { + if o == nil || IsNil(o.VideoUrl) { + var ret *string + return ret + } + + return o.VideoUrl +} + +// GetVideoUrlOk returns a tuple with the VideoUrl field value +// and a boolean to check if the value has been set. +func (o *CatalogProductDetailsVendor) GetVideoUrlOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.VideoUrl, true +} + +// SetVideoUrl sets field value +func (o *CatalogProductDetailsVendor) SetVideoUrl(v *string) { + o.VideoUrl = v +} + +// GetWebsiteUrl returns the WebsiteUrl field value +func (o *CatalogProductDetailsVendor) GetWebsiteUrl() *string { + if o == nil || IsNil(o.WebsiteUrl) { + var ret *string + return ret + } + + return o.WebsiteUrl +} + +// GetWebsiteUrlOk returns a tuple with the WebsiteUrl field value +// and a boolean to check if the value has been set. +func (o *CatalogProductDetailsVendor) GetWebsiteUrlOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.WebsiteUrl, true +} + +// SetWebsiteUrl sets field value +func (o *CatalogProductDetailsVendor) SetWebsiteUrl(v *string) { + o.WebsiteUrl = v +} + +func (o CatalogProductDetailsVendor) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["description"] = o.Description + toSerialize["logo"] = o.Logo + toSerialize["name"] = o.Name + toSerialize["vendorId"] = o.VendorId + toSerialize["videoUrl"] = o.VideoUrl + toSerialize["websiteUrl"] = o.WebsiteUrl + return toSerialize, nil +} + +type NullableCatalogProductDetailsVendor struct { + value *CatalogProductDetailsVendor + isSet bool +} + +func (v NullableCatalogProductDetailsVendor) Get() *CatalogProductDetailsVendor { + return v.value +} + +func (v *NullableCatalogProductDetailsVendor) Set(val *CatalogProductDetailsVendor) { + v.value = val + v.isSet = true +} + +func (v NullableCatalogProductDetailsVendor) IsSet() bool { + return v.isSet +} + +func (v *NullableCatalogProductDetailsVendor) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableCatalogProductDetailsVendor(val *CatalogProductDetailsVendor) *NullableCatalogProductDetailsVendor { + return &NullableCatalogProductDetailsVendor{value: val, isSet: true} +} + +func (v NullableCatalogProductDetailsVendor) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableCatalogProductDetailsVendor) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/stackitmarketplace/model_catalog_product_highlight.go b/services/stackitmarketplace/model_catalog_product_highlight.go new file mode 100644 index 000000000..6ae27a777 --- /dev/null +++ b/services/stackitmarketplace/model_catalog_product_highlight.go @@ -0,0 +1,191 @@ +/* +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 CatalogProductHighlight type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &CatalogProductHighlight{} + +// CatalogProductHighlight struct for CatalogProductHighlight +type CatalogProductHighlight struct { + // The highlight content. + HighlightContent *string `json:"highlightContent,omitempty"` + // The highlight icon. + HighlightIcon *string `json:"highlightIcon,omitempty"` + // The highlight title. + HighlightTitle *string `json:"highlightTitle,omitempty"` +} + +// NewCatalogProductHighlight instantiates a new CatalogProductHighlight 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 NewCatalogProductHighlight() *CatalogProductHighlight { + this := CatalogProductHighlight{} + return &this +} + +// NewCatalogProductHighlightWithDefaults instantiates a new CatalogProductHighlight 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 NewCatalogProductHighlightWithDefaults() *CatalogProductHighlight { + this := CatalogProductHighlight{} + return &this +} + +// GetHighlightContent returns the HighlightContent field value if set, zero value otherwise. +func (o *CatalogProductHighlight) GetHighlightContent() *string { + if o == nil || IsNil(o.HighlightContent) { + var ret *string + return ret + } + return o.HighlightContent +} + +// GetHighlightContentOk returns a tuple with the HighlightContent field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CatalogProductHighlight) GetHighlightContentOk() (*string, bool) { + if o == nil || IsNil(o.HighlightContent) { + return nil, false + } + return o.HighlightContent, true +} + +// HasHighlightContent returns a boolean if a field has been set. +func (o *CatalogProductHighlight) HasHighlightContent() bool { + if o != nil && !IsNil(o.HighlightContent) { + return true + } + + return false +} + +// SetHighlightContent gets a reference to the given string and assigns it to the HighlightContent field. +func (o *CatalogProductHighlight) SetHighlightContent(v *string) { + o.HighlightContent = v +} + +// GetHighlightIcon returns the HighlightIcon field value if set, zero value otherwise. +func (o *CatalogProductHighlight) GetHighlightIcon() *string { + if o == nil || IsNil(o.HighlightIcon) { + var ret *string + return ret + } + return o.HighlightIcon +} + +// GetHighlightIconOk returns a tuple with the HighlightIcon field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CatalogProductHighlight) GetHighlightIconOk() (*string, bool) { + if o == nil || IsNil(o.HighlightIcon) { + return nil, false + } + return o.HighlightIcon, true +} + +// HasHighlightIcon returns a boolean if a field has been set. +func (o *CatalogProductHighlight) HasHighlightIcon() bool { + if o != nil && !IsNil(o.HighlightIcon) { + return true + } + + return false +} + +// SetHighlightIcon gets a reference to the given string and assigns it to the HighlightIcon field. +func (o *CatalogProductHighlight) SetHighlightIcon(v *string) { + o.HighlightIcon = v +} + +// GetHighlightTitle returns the HighlightTitle field value if set, zero value otherwise. +func (o *CatalogProductHighlight) GetHighlightTitle() *string { + if o == nil || IsNil(o.HighlightTitle) { + var ret *string + return ret + } + return o.HighlightTitle +} + +// GetHighlightTitleOk returns a tuple with the HighlightTitle field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CatalogProductHighlight) GetHighlightTitleOk() (*string, bool) { + if o == nil || IsNil(o.HighlightTitle) { + return nil, false + } + return o.HighlightTitle, true +} + +// HasHighlightTitle returns a boolean if a field has been set. +func (o *CatalogProductHighlight) HasHighlightTitle() bool { + if o != nil && !IsNil(o.HighlightTitle) { + return true + } + + return false +} + +// SetHighlightTitle gets a reference to the given string and assigns it to the HighlightTitle field. +func (o *CatalogProductHighlight) SetHighlightTitle(v *string) { + o.HighlightTitle = v +} + +func (o CatalogProductHighlight) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.HighlightContent) { + toSerialize["highlightContent"] = o.HighlightContent + } + if !IsNil(o.HighlightIcon) { + toSerialize["highlightIcon"] = o.HighlightIcon + } + if !IsNil(o.HighlightTitle) { + toSerialize["highlightTitle"] = o.HighlightTitle + } + return toSerialize, nil +} + +type NullableCatalogProductHighlight struct { + value *CatalogProductHighlight + isSet bool +} + +func (v NullableCatalogProductHighlight) Get() *CatalogProductHighlight { + return v.value +} + +func (v *NullableCatalogProductHighlight) Set(val *CatalogProductHighlight) { + v.value = val + v.isSet = true +} + +func (v NullableCatalogProductHighlight) IsSet() bool { + return v.isSet +} + +func (v *NullableCatalogProductHighlight) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableCatalogProductHighlight(val *CatalogProductHighlight) *NullableCatalogProductHighlight { + return &NullableCatalogProductHighlight{value: val, isSet: true} +} + +func (v NullableCatalogProductHighlight) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableCatalogProductHighlight) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/stackitmarketplace/model_catalog_product_overview.go b/services/stackitmarketplace/model_catalog_product_overview.go new file mode 100644 index 000000000..133bdc066 --- /dev/null +++ b/services/stackitmarketplace/model_catalog_product_overview.go @@ -0,0 +1,292 @@ +/* +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 CatalogProductOverview type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &CatalogProductOverview{} + +// CatalogProductOverview struct for CatalogProductOverview +type CatalogProductOverview struct { + // The product type. For reference: SAAS - Software as a Service, SAI - STACKIT Application Image + // REQUIRED + DeliveryMethod *string `json:"deliveryMethod"` + // The lifecycle state of the product. + // REQUIRED + LifecycleState *string `json:"lifecycleState"` + // The logo base64 encoded. + Logo *string `json:"logo,omitempty"` + // The product name. + // REQUIRED + Name *string `json:"name"` + // The product ID. + // REQUIRED + ProductId *string `json:"productId"` + // The short summary of the product. + // REQUIRED + Summary *string `json:"summary"` + // REQUIRED + Vendor *CatalogProductOverviewVendor `json:"vendor"` +} + +type _CatalogProductOverview CatalogProductOverview + +// NewCatalogProductOverview instantiates a new CatalogProductOverview 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 NewCatalogProductOverview(deliveryMethod *string, lifecycleState *string, name *string, productId *string, summary *string, vendor *CatalogProductOverviewVendor) *CatalogProductOverview { + this := CatalogProductOverview{} + this.DeliveryMethod = deliveryMethod + this.LifecycleState = lifecycleState + this.Name = name + this.ProductId = productId + this.Summary = summary + this.Vendor = vendor + return &this +} + +// NewCatalogProductOverviewWithDefaults instantiates a new CatalogProductOverview 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 NewCatalogProductOverviewWithDefaults() *CatalogProductOverview { + this := CatalogProductOverview{} + return &this +} + +// GetDeliveryMethod returns the DeliveryMethod field value +func (o *CatalogProductOverview) GetDeliveryMethod() *string { + if o == nil || IsNil(o.DeliveryMethod) { + var ret *string + return ret + } + + return o.DeliveryMethod +} + +// GetDeliveryMethodOk returns a tuple with the DeliveryMethod field value +// and a boolean to check if the value has been set. +func (o *CatalogProductOverview) GetDeliveryMethodOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.DeliveryMethod, true +} + +// SetDeliveryMethod sets field value +func (o *CatalogProductOverview) SetDeliveryMethod(v *string) { + o.DeliveryMethod = v +} + +// GetLifecycleState returns the LifecycleState field value +func (o *CatalogProductOverview) GetLifecycleState() *string { + if o == nil || IsNil(o.LifecycleState) { + var ret *string + return ret + } + + return o.LifecycleState +} + +// GetLifecycleStateOk returns a tuple with the LifecycleState field value +// and a boolean to check if the value has been set. +func (o *CatalogProductOverview) GetLifecycleStateOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.LifecycleState, true +} + +// SetLifecycleState sets field value +func (o *CatalogProductOverview) SetLifecycleState(v *string) { + o.LifecycleState = v +} + +// GetLogo returns the Logo field value if set, zero value otherwise. +func (o *CatalogProductOverview) GetLogo() *string { + if o == nil || IsNil(o.Logo) { + var ret *string + return ret + } + return o.Logo +} + +// GetLogoOk returns a tuple with the Logo field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CatalogProductOverview) GetLogoOk() (*string, bool) { + if o == nil || IsNil(o.Logo) { + return nil, false + } + return o.Logo, true +} + +// HasLogo returns a boolean if a field has been set. +func (o *CatalogProductOverview) HasLogo() bool { + if o != nil && !IsNil(o.Logo) { + return true + } + + return false +} + +// SetLogo gets a reference to the given string and assigns it to the Logo field. +func (o *CatalogProductOverview) SetLogo(v *string) { + o.Logo = v +} + +// GetName returns the Name field value +func (o *CatalogProductOverview) GetName() *string { + if o == nil || IsNil(o.Name) { + var ret *string + return ret + } + + return o.Name +} + +// GetNameOk returns a tuple with the Name field value +// and a boolean to check if the value has been set. +func (o *CatalogProductOverview) GetNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Name, true +} + +// SetName sets field value +func (o *CatalogProductOverview) SetName(v *string) { + o.Name = v +} + +// GetProductId returns the ProductId field value +func (o *CatalogProductOverview) GetProductId() *string { + if o == nil || IsNil(o.ProductId) { + var ret *string + return ret + } + + return o.ProductId +} + +// GetProductIdOk returns a tuple with the ProductId field value +// and a boolean to check if the value has been set. +func (o *CatalogProductOverview) GetProductIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.ProductId, true +} + +// SetProductId sets field value +func (o *CatalogProductOverview) SetProductId(v *string) { + o.ProductId = v +} + +// GetSummary returns the Summary field value +func (o *CatalogProductOverview) GetSummary() *string { + if o == nil || IsNil(o.Summary) { + var ret *string + return ret + } + + return o.Summary +} + +// GetSummaryOk returns a tuple with the Summary field value +// and a boolean to check if the value has been set. +func (o *CatalogProductOverview) GetSummaryOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Summary, true +} + +// SetSummary sets field value +func (o *CatalogProductOverview) SetSummary(v *string) { + o.Summary = v +} + +// GetVendor returns the Vendor field value +func (o *CatalogProductOverview) GetVendor() *CatalogProductOverviewVendor { + if o == nil || IsNil(o.Vendor) { + var ret *CatalogProductOverviewVendor + return ret + } + + return o.Vendor +} + +// GetVendorOk returns a tuple with the Vendor field value +// and a boolean to check if the value has been set. +func (o *CatalogProductOverview) GetVendorOk() (*CatalogProductOverviewVendor, bool) { + if o == nil { + return nil, false + } + return o.Vendor, true +} + +// SetVendor sets field value +func (o *CatalogProductOverview) SetVendor(v *CatalogProductOverviewVendor) { + o.Vendor = v +} + +func (o CatalogProductOverview) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["deliveryMethod"] = o.DeliveryMethod + toSerialize["lifecycleState"] = o.LifecycleState + if !IsNil(o.Logo) { + toSerialize["logo"] = o.Logo + } + toSerialize["name"] = o.Name + toSerialize["productId"] = o.ProductId + toSerialize["summary"] = o.Summary + toSerialize["vendor"] = o.Vendor + return toSerialize, nil +} + +type NullableCatalogProductOverview struct { + value *CatalogProductOverview + isSet bool +} + +func (v NullableCatalogProductOverview) Get() *CatalogProductOverview { + return v.value +} + +func (v *NullableCatalogProductOverview) Set(val *CatalogProductOverview) { + v.value = val + v.isSet = true +} + +func (v NullableCatalogProductOverview) IsSet() bool { + return v.isSet +} + +func (v *NullableCatalogProductOverview) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableCatalogProductOverview(val *CatalogProductOverview) *NullableCatalogProductOverview { + return &NullableCatalogProductOverview{value: val, isSet: true} +} + +func (v NullableCatalogProductOverview) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableCatalogProductOverview) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/stackitmarketplace/model_catalog_product_overview_vendor.go b/services/stackitmarketplace/model_catalog_product_overview_vendor.go new file mode 100644 index 000000000..dc7bbb802 --- /dev/null +++ b/services/stackitmarketplace/model_catalog_product_overview_vendor.go @@ -0,0 +1,169 @@ +/* +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 CatalogProductOverviewVendor type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &CatalogProductOverviewVendor{} + +// CatalogProductOverviewVendor struct for CatalogProductOverviewVendor +type CatalogProductOverviewVendor struct { + // The vendor name. + // REQUIRED + Name *string `json:"name"` + // The vendor ID. + // REQUIRED + VendorId *string `json:"vendorId"` + // The vendor website URL. + // REQUIRED + WebsiteUrl *string `json:"websiteUrl"` +} + +type _CatalogProductOverviewVendor CatalogProductOverviewVendor + +// NewCatalogProductOverviewVendor instantiates a new CatalogProductOverviewVendor 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 NewCatalogProductOverviewVendor(name *string, vendorId *string, websiteUrl *string) *CatalogProductOverviewVendor { + this := CatalogProductOverviewVendor{} + this.Name = name + this.VendorId = vendorId + this.WebsiteUrl = websiteUrl + return &this +} + +// NewCatalogProductOverviewVendorWithDefaults instantiates a new CatalogProductOverviewVendor 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 NewCatalogProductOverviewVendorWithDefaults() *CatalogProductOverviewVendor { + this := CatalogProductOverviewVendor{} + return &this +} + +// GetName returns the Name field value +func (o *CatalogProductOverviewVendor) GetName() *string { + if o == nil || IsNil(o.Name) { + var ret *string + return ret + } + + return o.Name +} + +// GetNameOk returns a tuple with the Name field value +// and a boolean to check if the value has been set. +func (o *CatalogProductOverviewVendor) GetNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Name, true +} + +// SetName sets field value +func (o *CatalogProductOverviewVendor) SetName(v *string) { + o.Name = v +} + +// GetVendorId returns the VendorId field value +func (o *CatalogProductOverviewVendor) GetVendorId() *string { + if o == nil || IsNil(o.VendorId) { + var ret *string + return ret + } + + return o.VendorId +} + +// GetVendorIdOk returns a tuple with the VendorId field value +// and a boolean to check if the value has been set. +func (o *CatalogProductOverviewVendor) GetVendorIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.VendorId, true +} + +// SetVendorId sets field value +func (o *CatalogProductOverviewVendor) SetVendorId(v *string) { + o.VendorId = v +} + +// GetWebsiteUrl returns the WebsiteUrl field value +func (o *CatalogProductOverviewVendor) GetWebsiteUrl() *string { + if o == nil || IsNil(o.WebsiteUrl) { + var ret *string + return ret + } + + return o.WebsiteUrl +} + +// GetWebsiteUrlOk returns a tuple with the WebsiteUrl field value +// and a boolean to check if the value has been set. +func (o *CatalogProductOverviewVendor) GetWebsiteUrlOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.WebsiteUrl, true +} + +// SetWebsiteUrl sets field value +func (o *CatalogProductOverviewVendor) SetWebsiteUrl(v *string) { + o.WebsiteUrl = v +} + +func (o CatalogProductOverviewVendor) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["name"] = o.Name + toSerialize["vendorId"] = o.VendorId + toSerialize["websiteUrl"] = o.WebsiteUrl + return toSerialize, nil +} + +type NullableCatalogProductOverviewVendor struct { + value *CatalogProductOverviewVendor + isSet bool +} + +func (v NullableCatalogProductOverviewVendor) Get() *CatalogProductOverviewVendor { + return v.value +} + +func (v *NullableCatalogProductOverviewVendor) Set(val *CatalogProductOverviewVendor) { + v.value = val + v.isSet = true +} + +func (v NullableCatalogProductOverviewVendor) IsSet() bool { + return v.isSet +} + +func (v *NullableCatalogProductOverviewVendor) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableCatalogProductOverviewVendor(val *CatalogProductOverviewVendor) *NullableCatalogProductOverviewVendor { + return &NullableCatalogProductOverviewVendor{value: val, isSet: true} +} + +func (v NullableCatalogProductOverviewVendor) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableCatalogProductOverviewVendor) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/stackitmarketplace/model_catalog_product_pricing_option.go b/services/stackitmarketplace/model_catalog_product_pricing_option.go new file mode 100644 index 000000000..86487579c --- /dev/null +++ b/services/stackitmarketplace/model_catalog_product_pricing_option.go @@ -0,0 +1,404 @@ +/* +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 CatalogProductPricingOption type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &CatalogProductPricingOption{} + +// CatalogProductPricingOption struct for CatalogProductPricingOption +type CatalogProductPricingOption struct { + // The pricing option description. + // REQUIRED + Description *string `json:"description"` + // The list of highlights. + // REQUIRED + Highlights *[]CatalogPricingOptionHighlight `json:"highlights"` + // The pricing option name. + // REQUIRED + Name *string `json:"name"` + // The price type / pricing model. + PriceType *string `json:"priceType,omitempty"` + // Additional price type information. + PricingPlan *string `json:"pricingPlan,omitempty"` + // The price of the product (per unit). + Rate *string `json:"rate,omitempty"` + // The concrete variant of the product. + // REQUIRED + Sku *string `json:"sku"` + // Short description of this offering. + // REQUIRED + SkuInfo *string `json:"skuInfo"` + // More details about what this offering entails. + // REQUIRED + SkuInfoDetails *string `json:"skuInfoDetails"` + // The interval to which the rate applies. + Unit *string `json:"unit,omitempty"` +} + +type _CatalogProductPricingOption CatalogProductPricingOption + +// NewCatalogProductPricingOption instantiates a new CatalogProductPricingOption 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 NewCatalogProductPricingOption(description *string, highlights *[]CatalogPricingOptionHighlight, name *string, sku *string, skuInfo *string, skuInfoDetails *string) *CatalogProductPricingOption { + this := CatalogProductPricingOption{} + this.Description = description + this.Highlights = highlights + this.Name = name + this.Sku = sku + this.SkuInfo = skuInfo + this.SkuInfoDetails = skuInfoDetails + return &this +} + +// NewCatalogProductPricingOptionWithDefaults instantiates a new CatalogProductPricingOption 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 NewCatalogProductPricingOptionWithDefaults() *CatalogProductPricingOption { + this := CatalogProductPricingOption{} + return &this +} + +// GetDescription returns the Description field value +func (o *CatalogProductPricingOption) GetDescription() *string { + if o == nil || IsNil(o.Description) { + var ret *string + return ret + } + + return o.Description +} + +// GetDescriptionOk returns a tuple with the Description field value +// and a boolean to check if the value has been set. +func (o *CatalogProductPricingOption) GetDescriptionOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Description, true +} + +// SetDescription sets field value +func (o *CatalogProductPricingOption) SetDescription(v *string) { + o.Description = v +} + +// GetHighlights returns the Highlights field value +func (o *CatalogProductPricingOption) GetHighlights() *[]CatalogPricingOptionHighlight { + if o == nil || IsNil(o.Highlights) { + var ret *[]CatalogPricingOptionHighlight + return ret + } + + return o.Highlights +} + +// GetHighlightsOk returns a tuple with the Highlights field value +// and a boolean to check if the value has been set. +func (o *CatalogProductPricingOption) GetHighlightsOk() (*[]CatalogPricingOptionHighlight, bool) { + if o == nil { + return nil, false + } + return o.Highlights, true +} + +// SetHighlights sets field value +func (o *CatalogProductPricingOption) SetHighlights(v *[]CatalogPricingOptionHighlight) { + o.Highlights = v +} + +// GetName returns the Name field value +func (o *CatalogProductPricingOption) GetName() *string { + if o == nil || IsNil(o.Name) { + var ret *string + return ret + } + + return o.Name +} + +// GetNameOk returns a tuple with the Name field value +// and a boolean to check if the value has been set. +func (o *CatalogProductPricingOption) GetNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Name, true +} + +// SetName sets field value +func (o *CatalogProductPricingOption) SetName(v *string) { + o.Name = v +} + +// GetPriceType returns the PriceType field value if set, zero value otherwise. +func (o *CatalogProductPricingOption) GetPriceType() *string { + if o == nil || IsNil(o.PriceType) { + var ret *string + return ret + } + return o.PriceType +} + +// GetPriceTypeOk returns a tuple with the PriceType field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CatalogProductPricingOption) GetPriceTypeOk() (*string, bool) { + if o == nil || IsNil(o.PriceType) { + return nil, false + } + return o.PriceType, true +} + +// HasPriceType returns a boolean if a field has been set. +func (o *CatalogProductPricingOption) HasPriceType() bool { + if o != nil && !IsNil(o.PriceType) { + return true + } + + return false +} + +// SetPriceType gets a reference to the given string and assigns it to the PriceType field. +func (o *CatalogProductPricingOption) SetPriceType(v *string) { + o.PriceType = v +} + +// GetPricingPlan returns the PricingPlan field value if set, zero value otherwise. +func (o *CatalogProductPricingOption) GetPricingPlan() *string { + if o == nil || IsNil(o.PricingPlan) { + var ret *string + return ret + } + return o.PricingPlan +} + +// GetPricingPlanOk returns a tuple with the PricingPlan field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CatalogProductPricingOption) GetPricingPlanOk() (*string, bool) { + if o == nil || IsNil(o.PricingPlan) { + return nil, false + } + return o.PricingPlan, true +} + +// HasPricingPlan returns a boolean if a field has been set. +func (o *CatalogProductPricingOption) HasPricingPlan() bool { + if o != nil && !IsNil(o.PricingPlan) { + return true + } + + return false +} + +// SetPricingPlan gets a reference to the given string and assigns it to the PricingPlan field. +func (o *CatalogProductPricingOption) SetPricingPlan(v *string) { + o.PricingPlan = v +} + +// GetRate returns the Rate field value if set, zero value otherwise. +func (o *CatalogProductPricingOption) GetRate() *string { + if o == nil || IsNil(o.Rate) { + var ret *string + return ret + } + return o.Rate +} + +// GetRateOk returns a tuple with the Rate field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CatalogProductPricingOption) GetRateOk() (*string, bool) { + if o == nil || IsNil(o.Rate) { + return nil, false + } + return o.Rate, true +} + +// HasRate returns a boolean if a field has been set. +func (o *CatalogProductPricingOption) HasRate() bool { + if o != nil && !IsNil(o.Rate) { + return true + } + + return false +} + +// SetRate gets a reference to the given string and assigns it to the Rate field. +func (o *CatalogProductPricingOption) SetRate(v *string) { + o.Rate = v +} + +// GetSku returns the Sku field value +func (o *CatalogProductPricingOption) GetSku() *string { + if o == nil || IsNil(o.Sku) { + var ret *string + return ret + } + + return o.Sku +} + +// GetSkuOk returns a tuple with the Sku field value +// and a boolean to check if the value has been set. +func (o *CatalogProductPricingOption) GetSkuOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Sku, true +} + +// SetSku sets field value +func (o *CatalogProductPricingOption) SetSku(v *string) { + o.Sku = v +} + +// GetSkuInfo returns the SkuInfo field value +func (o *CatalogProductPricingOption) GetSkuInfo() *string { + if o == nil || IsNil(o.SkuInfo) { + var ret *string + return ret + } + + return o.SkuInfo +} + +// GetSkuInfoOk returns a tuple with the SkuInfo field value +// and a boolean to check if the value has been set. +func (o *CatalogProductPricingOption) GetSkuInfoOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.SkuInfo, true +} + +// SetSkuInfo sets field value +func (o *CatalogProductPricingOption) SetSkuInfo(v *string) { + o.SkuInfo = v +} + +// GetSkuInfoDetails returns the SkuInfoDetails field value +func (o *CatalogProductPricingOption) GetSkuInfoDetails() *string { + if o == nil || IsNil(o.SkuInfoDetails) { + var ret *string + return ret + } + + return o.SkuInfoDetails +} + +// GetSkuInfoDetailsOk returns a tuple with the SkuInfoDetails field value +// and a boolean to check if the value has been set. +func (o *CatalogProductPricingOption) GetSkuInfoDetailsOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.SkuInfoDetails, true +} + +// SetSkuInfoDetails sets field value +func (o *CatalogProductPricingOption) SetSkuInfoDetails(v *string) { + o.SkuInfoDetails = v +} + +// GetUnit returns the Unit field value if set, zero value otherwise. +func (o *CatalogProductPricingOption) GetUnit() *string { + if o == nil || IsNil(o.Unit) { + var ret *string + return ret + } + return o.Unit +} + +// GetUnitOk returns a tuple with the Unit field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CatalogProductPricingOption) GetUnitOk() (*string, bool) { + if o == nil || IsNil(o.Unit) { + return nil, false + } + return o.Unit, true +} + +// HasUnit returns a boolean if a field has been set. +func (o *CatalogProductPricingOption) HasUnit() bool { + if o != nil && !IsNil(o.Unit) { + return true + } + + return false +} + +// SetUnit gets a reference to the given string and assigns it to the Unit field. +func (o *CatalogProductPricingOption) SetUnit(v *string) { + o.Unit = v +} + +func (o CatalogProductPricingOption) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["description"] = o.Description + toSerialize["highlights"] = o.Highlights + toSerialize["name"] = o.Name + if !IsNil(o.PriceType) { + toSerialize["priceType"] = o.PriceType + } + if !IsNil(o.PricingPlan) { + toSerialize["pricingPlan"] = o.PricingPlan + } + if !IsNil(o.Rate) { + toSerialize["rate"] = o.Rate + } + toSerialize["sku"] = o.Sku + toSerialize["skuInfo"] = o.SkuInfo + toSerialize["skuInfoDetails"] = o.SkuInfoDetails + if !IsNil(o.Unit) { + toSerialize["unit"] = o.Unit + } + return toSerialize, nil +} + +type NullableCatalogProductPricingOption struct { + value *CatalogProductPricingOption + isSet bool +} + +func (v NullableCatalogProductPricingOption) Get() *CatalogProductPricingOption { + return v.value +} + +func (v *NullableCatalogProductPricingOption) Set(val *CatalogProductPricingOption) { + v.value = val + v.isSet = true +} + +func (v NullableCatalogProductPricingOption) IsSet() bool { + return v.isSet +} + +func (v *NullableCatalogProductPricingOption) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableCatalogProductPricingOption(val *CatalogProductPricingOption) *NullableCatalogProductPricingOption { + return &NullableCatalogProductPricingOption{value: val, isSet: true} +} + +func (v NullableCatalogProductPricingOption) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableCatalogProductPricingOption) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/stackitmarketplace/model_catalog_product_support_resource.go b/services/stackitmarketplace/model_catalog_product_support_resource.go new file mode 100644 index 000000000..69fb7478b --- /dev/null +++ b/services/stackitmarketplace/model_catalog_product_support_resource.go @@ -0,0 +1,154 @@ +/* +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 CatalogProductSupportResource type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &CatalogProductSupportResource{} + +// CatalogProductSupportResource struct for CatalogProductSupportResource +type CatalogProductSupportResource struct { + // The support resource link. + SupportLink *string `json:"supportLink,omitempty"` + // The support resource link title. + SupportLinkTitle *string `json:"supportLinkTitle,omitempty"` +} + +// NewCatalogProductSupportResource instantiates a new CatalogProductSupportResource 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 NewCatalogProductSupportResource() *CatalogProductSupportResource { + this := CatalogProductSupportResource{} + return &this +} + +// NewCatalogProductSupportResourceWithDefaults instantiates a new CatalogProductSupportResource 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 NewCatalogProductSupportResourceWithDefaults() *CatalogProductSupportResource { + this := CatalogProductSupportResource{} + return &this +} + +// GetSupportLink returns the SupportLink field value if set, zero value otherwise. +func (o *CatalogProductSupportResource) GetSupportLink() *string { + if o == nil || IsNil(o.SupportLink) { + var ret *string + return ret + } + return o.SupportLink +} + +// GetSupportLinkOk returns a tuple with the SupportLink field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CatalogProductSupportResource) GetSupportLinkOk() (*string, bool) { + if o == nil || IsNil(o.SupportLink) { + return nil, false + } + return o.SupportLink, true +} + +// HasSupportLink returns a boolean if a field has been set. +func (o *CatalogProductSupportResource) HasSupportLink() bool { + if o != nil && !IsNil(o.SupportLink) { + return true + } + + return false +} + +// SetSupportLink gets a reference to the given string and assigns it to the SupportLink field. +func (o *CatalogProductSupportResource) SetSupportLink(v *string) { + o.SupportLink = v +} + +// GetSupportLinkTitle returns the SupportLinkTitle field value if set, zero value otherwise. +func (o *CatalogProductSupportResource) GetSupportLinkTitle() *string { + if o == nil || IsNil(o.SupportLinkTitle) { + var ret *string + return ret + } + return o.SupportLinkTitle +} + +// GetSupportLinkTitleOk returns a tuple with the SupportLinkTitle field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CatalogProductSupportResource) GetSupportLinkTitleOk() (*string, bool) { + if o == nil || IsNil(o.SupportLinkTitle) { + return nil, false + } + return o.SupportLinkTitle, true +} + +// HasSupportLinkTitle returns a boolean if a field has been set. +func (o *CatalogProductSupportResource) HasSupportLinkTitle() bool { + if o != nil && !IsNil(o.SupportLinkTitle) { + return true + } + + return false +} + +// SetSupportLinkTitle gets a reference to the given string and assigns it to the SupportLinkTitle field. +func (o *CatalogProductSupportResource) SetSupportLinkTitle(v *string) { + o.SupportLinkTitle = v +} + +func (o CatalogProductSupportResource) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.SupportLink) { + toSerialize["supportLink"] = o.SupportLink + } + if !IsNil(o.SupportLinkTitle) { + toSerialize["supportLinkTitle"] = o.SupportLinkTitle + } + return toSerialize, nil +} + +type NullableCatalogProductSupportResource struct { + value *CatalogProductSupportResource + isSet bool +} + +func (v NullableCatalogProductSupportResource) Get() *CatalogProductSupportResource { + return v.value +} + +func (v *NullableCatalogProductSupportResource) Set(val *CatalogProductSupportResource) { + v.value = val + v.isSet = true +} + +func (v NullableCatalogProductSupportResource) IsSet() bool { + return v.isSet +} + +func (v *NullableCatalogProductSupportResource) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableCatalogProductSupportResource(val *CatalogProductSupportResource) *NullableCatalogProductSupportResource { + return &NullableCatalogProductSupportResource{value: val, isSet: true} +} + +func (v NullableCatalogProductSupportResource) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableCatalogProductSupportResource) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/stackitmarketplace/model_catalog_product_vendor_terms.go b/services/stackitmarketplace/model_catalog_product_vendor_terms.go new file mode 100644 index 000000000..8075635d9 --- /dev/null +++ b/services/stackitmarketplace/model_catalog_product_vendor_terms.go @@ -0,0 +1,169 @@ +/* +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 CatalogProductVendorTerms type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &CatalogProductVendorTerms{} + +// CatalogProductVendorTerms struct for CatalogProductVendorTerms +type CatalogProductVendorTerms struct { + // The terms of use description. + // REQUIRED + Description *string `json:"description"` + // The terms of use title. + // REQUIRED + Title *string `json:"title"` + // The terms of use url. + // REQUIRED + Url *string `json:"url"` +} + +type _CatalogProductVendorTerms CatalogProductVendorTerms + +// NewCatalogProductVendorTerms instantiates a new CatalogProductVendorTerms 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 NewCatalogProductVendorTerms(description *string, title *string, url *string) *CatalogProductVendorTerms { + this := CatalogProductVendorTerms{} + this.Description = description + this.Title = title + this.Url = url + return &this +} + +// NewCatalogProductVendorTermsWithDefaults instantiates a new CatalogProductVendorTerms 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 NewCatalogProductVendorTermsWithDefaults() *CatalogProductVendorTerms { + this := CatalogProductVendorTerms{} + return &this +} + +// GetDescription returns the Description field value +func (o *CatalogProductVendorTerms) GetDescription() *string { + if o == nil || IsNil(o.Description) { + var ret *string + return ret + } + + return o.Description +} + +// GetDescriptionOk returns a tuple with the Description field value +// and a boolean to check if the value has been set. +func (o *CatalogProductVendorTerms) GetDescriptionOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Description, true +} + +// SetDescription sets field value +func (o *CatalogProductVendorTerms) SetDescription(v *string) { + o.Description = v +} + +// GetTitle returns the Title field value +func (o *CatalogProductVendorTerms) GetTitle() *string { + if o == nil || IsNil(o.Title) { + var ret *string + return ret + } + + return o.Title +} + +// GetTitleOk returns a tuple with the Title field value +// and a boolean to check if the value has been set. +func (o *CatalogProductVendorTerms) GetTitleOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Title, true +} + +// SetTitle sets field value +func (o *CatalogProductVendorTerms) SetTitle(v *string) { + o.Title = v +} + +// GetUrl returns the Url field value +func (o *CatalogProductVendorTerms) GetUrl() *string { + if o == nil || IsNil(o.Url) { + var ret *string + return ret + } + + return o.Url +} + +// GetUrlOk returns a tuple with the Url field value +// and a boolean to check if the value has been set. +func (o *CatalogProductVendorTerms) GetUrlOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Url, true +} + +// SetUrl sets field value +func (o *CatalogProductVendorTerms) SetUrl(v *string) { + o.Url = v +} + +func (o CatalogProductVendorTerms) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["description"] = o.Description + toSerialize["title"] = o.Title + toSerialize["url"] = o.Url + return toSerialize, nil +} + +type NullableCatalogProductVendorTerms struct { + value *CatalogProductVendorTerms + isSet bool +} + +func (v NullableCatalogProductVendorTerms) Get() *CatalogProductVendorTerms { + return v.value +} + +func (v *NullableCatalogProductVendorTerms) Set(val *CatalogProductVendorTerms) { + v.value = val + v.isSet = true +} + +func (v NullableCatalogProductVendorTerms) IsSet() bool { + return v.isSet +} + +func (v *NullableCatalogProductVendorTerms) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableCatalogProductVendorTerms(val *CatalogProductVendorTerms) *NullableCatalogProductVendorTerms { + return &NullableCatalogProductVendorTerms{value: val, isSet: true} +} + +func (v NullableCatalogProductVendorTerms) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableCatalogProductVendorTerms) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/stackitmarketplace/model_current_subscription_state_response.go b/services/stackitmarketplace/model_current_subscription_state_response.go new file mode 100644 index 000000000..14d00e5e5 --- /dev/null +++ b/services/stackitmarketplace/model_current_subscription_state_response.go @@ -0,0 +1,140 @@ +/* +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 CurrentSubscriptionStateResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &CurrentSubscriptionStateResponse{} + +// CurrentSubscriptionStateResponse struct for CurrentSubscriptionStateResponse +type CurrentSubscriptionStateResponse struct { + // Lifecycle state of the subscription. + // REQUIRED + LifecycleState *string `json:"lifecycleState"` + // The subscription ID. + // REQUIRED + SubscriptionId *string `json:"subscriptionId"` +} + +type _CurrentSubscriptionStateResponse CurrentSubscriptionStateResponse + +// NewCurrentSubscriptionStateResponse instantiates a new CurrentSubscriptionStateResponse 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 NewCurrentSubscriptionStateResponse(lifecycleState *string, subscriptionId *string) *CurrentSubscriptionStateResponse { + this := CurrentSubscriptionStateResponse{} + this.LifecycleState = lifecycleState + this.SubscriptionId = subscriptionId + return &this +} + +// NewCurrentSubscriptionStateResponseWithDefaults instantiates a new CurrentSubscriptionStateResponse 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 NewCurrentSubscriptionStateResponseWithDefaults() *CurrentSubscriptionStateResponse { + this := CurrentSubscriptionStateResponse{} + return &this +} + +// GetLifecycleState returns the LifecycleState field value +func (o *CurrentSubscriptionStateResponse) GetLifecycleState() *string { + if o == nil || IsNil(o.LifecycleState) { + var ret *string + return ret + } + + return o.LifecycleState +} + +// GetLifecycleStateOk returns a tuple with the LifecycleState field value +// and a boolean to check if the value has been set. +func (o *CurrentSubscriptionStateResponse) GetLifecycleStateOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.LifecycleState, true +} + +// SetLifecycleState sets field value +func (o *CurrentSubscriptionStateResponse) SetLifecycleState(v *string) { + o.LifecycleState = v +} + +// GetSubscriptionId returns the SubscriptionId field value +func (o *CurrentSubscriptionStateResponse) GetSubscriptionId() *string { + if o == nil || IsNil(o.SubscriptionId) { + var ret *string + return ret + } + + return o.SubscriptionId +} + +// GetSubscriptionIdOk returns a tuple with the SubscriptionId field value +// and a boolean to check if the value has been set. +func (o *CurrentSubscriptionStateResponse) GetSubscriptionIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.SubscriptionId, true +} + +// SetSubscriptionId sets field value +func (o *CurrentSubscriptionStateResponse) SetSubscriptionId(v *string) { + o.SubscriptionId = v +} + +func (o CurrentSubscriptionStateResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["lifecycleState"] = o.LifecycleState + toSerialize["subscriptionId"] = o.SubscriptionId + return toSerialize, nil +} + +type NullableCurrentSubscriptionStateResponse struct { + value *CurrentSubscriptionStateResponse + isSet bool +} + +func (v NullableCurrentSubscriptionStateResponse) Get() *CurrentSubscriptionStateResponse { + return v.value +} + +func (v *NullableCurrentSubscriptionStateResponse) Set(val *CurrentSubscriptionStateResponse) { + v.value = val + v.isSet = true +} + +func (v NullableCurrentSubscriptionStateResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableCurrentSubscriptionStateResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableCurrentSubscriptionStateResponse(val *CurrentSubscriptionStateResponse) *NullableCurrentSubscriptionStateResponse { + return &NullableCurrentSubscriptionStateResponse{value: val, isSet: true} +} + +func (v NullableCurrentSubscriptionStateResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableCurrentSubscriptionStateResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/stackitmarketplace/model_error_response.go b/services/stackitmarketplace/model_error_response.go new file mode 100644 index 000000000..edf67053e --- /dev/null +++ b/services/stackitmarketplace/model_error_response.go @@ -0,0 +1,229 @@ +/* +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" + "time" +) + +// checks if the ErrorResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ErrorResponse{} + +// ErrorResponse struct for ErrorResponse +type ErrorResponse struct { + // Reason phrase of the status code. + // REQUIRED + Error *string `json:"error"` + // Description of the error. + // REQUIRED + Message *string `json:"message"` + // Path which was called. + // REQUIRED + Path *string `json:"path"` + // HTTP response status code. + // Can be cast to int32 without loss of precision. + // REQUIRED + Status *int64 `json:"status"` + // Timestamp at which the error occurred. + // REQUIRED + TimeStamp *time.Time `json:"timeStamp"` +} + +type _ErrorResponse ErrorResponse + +// NewErrorResponse instantiates a new ErrorResponse 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 NewErrorResponse(error_ *string, message *string, path *string, status *int64, timeStamp *time.Time) *ErrorResponse { + this := ErrorResponse{} + this.Error = error_ + this.Message = message + this.Path = path + this.Status = status + this.TimeStamp = timeStamp + return &this +} + +// NewErrorResponseWithDefaults instantiates a new ErrorResponse 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 NewErrorResponseWithDefaults() *ErrorResponse { + this := ErrorResponse{} + return &this +} + +// GetError returns the Error field value +func (o *ErrorResponse) GetError() *string { + if o == nil || IsNil(o.Error) { + var ret *string + return ret + } + + return o.Error +} + +// GetErrorOk returns a tuple with the Error field value +// and a boolean to check if the value has been set. +func (o *ErrorResponse) GetErrorOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Error, true +} + +// SetError sets field value +func (o *ErrorResponse) SetError(v *string) { + o.Error = v +} + +// GetMessage returns the Message field value +func (o *ErrorResponse) GetMessage() *string { + if o == nil || IsNil(o.Message) { + var ret *string + return ret + } + + return o.Message +} + +// GetMessageOk returns a tuple with the Message field value +// and a boolean to check if the value has been set. +func (o *ErrorResponse) GetMessageOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Message, true +} + +// SetMessage sets field value +func (o *ErrorResponse) SetMessage(v *string) { + o.Message = v +} + +// GetPath returns the Path field value +func (o *ErrorResponse) GetPath() *string { + if o == nil || IsNil(o.Path) { + var ret *string + return ret + } + + return o.Path +} + +// GetPathOk returns a tuple with the Path field value +// and a boolean to check if the value has been set. +func (o *ErrorResponse) GetPathOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Path, true +} + +// SetPath sets field value +func (o *ErrorResponse) SetPath(v *string) { + o.Path = v +} + +// GetStatus returns the Status field value +func (o *ErrorResponse) GetStatus() *int64 { + if o == nil || IsNil(o.Status) { + var ret *int64 + return ret + } + + return o.Status +} + +// GetStatusOk returns a tuple with the Status field value +// and a boolean to check if the value has been set. +func (o *ErrorResponse) GetStatusOk() (*int64, bool) { + if o == nil { + return nil, false + } + return o.Status, true +} + +// SetStatus sets field value +func (o *ErrorResponse) SetStatus(v *int64) { + o.Status = v +} + +// GetTimeStamp returns the TimeStamp field value +func (o *ErrorResponse) GetTimeStamp() *time.Time { + if o == nil || IsNil(o.TimeStamp) { + var ret *time.Time + return ret + } + + return o.TimeStamp +} + +// GetTimeStampOk returns a tuple with the TimeStamp field value +// and a boolean to check if the value has been set. +func (o *ErrorResponse) GetTimeStampOk() (*time.Time, bool) { + if o == nil { + return nil, false + } + return o.TimeStamp, true +} + +// SetTimeStamp sets field value +func (o *ErrorResponse) SetTimeStamp(v *time.Time) { + o.TimeStamp = v +} + +func (o ErrorResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["error"] = o.Error + toSerialize["message"] = o.Message + toSerialize["path"] = o.Path + toSerialize["status"] = o.Status + toSerialize["timeStamp"] = o.TimeStamp + return toSerialize, nil +} + +type NullableErrorResponse struct { + value *ErrorResponse + isSet bool +} + +func (v NullableErrorResponse) Get() *ErrorResponse { + return v.value +} + +func (v *NullableErrorResponse) Set(val *ErrorResponse) { + v.value = val + v.isSet = true +} + +func (v NullableErrorResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableErrorResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableErrorResponse(val *ErrorResponse) *NullableErrorResponse { + return &NullableErrorResponse{value: val, isSet: true} +} + +func (v NullableErrorResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableErrorResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/stackitmarketplace/model_list_catalog_products_response.go b/services/stackitmarketplace/model_list_catalog_products_response.go new file mode 100644 index 000000000..20617fa15 --- /dev/null +++ b/services/stackitmarketplace/model_list_catalog_products_response.go @@ -0,0 +1,171 @@ +/* +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 ListCatalogProductsResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ListCatalogProductsResponse{} + +// ListCatalogProductsResponse struct for ListCatalogProductsResponse +type ListCatalogProductsResponse struct { + // A pagination cursor that represents a position in the dataset. Use it in subsequent requests to continue retrieving data from this position. If `null`, there are no more results to retrieve. + // REQUIRED + Cursor *string `json:"cursor"` + // REQUIRED + Items *[]CatalogProductOverview `json:"items"` + // The maximum number of items to return in the response. If not present, an appropriate default will be used. If maximum is exceeded, maximum is used. + // Can be cast to int32 without loss of precision. + // REQUIRED + Limit *int64 `json:"limit"` +} + +type _ListCatalogProductsResponse ListCatalogProductsResponse + +// NewListCatalogProductsResponse instantiates a new ListCatalogProductsResponse 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 NewListCatalogProductsResponse(cursor *string, items *[]CatalogProductOverview, limit *int64) *ListCatalogProductsResponse { + this := ListCatalogProductsResponse{} + this.Cursor = cursor + this.Items = items + this.Limit = limit + return &this +} + +// NewListCatalogProductsResponseWithDefaults instantiates a new ListCatalogProductsResponse 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 NewListCatalogProductsResponseWithDefaults() *ListCatalogProductsResponse { + this := ListCatalogProductsResponse{} + var limit int64 = 50 + this.Limit = &limit + return &this +} + +// GetCursor returns the Cursor field value +func (o *ListCatalogProductsResponse) GetCursor() *string { + if o == nil || IsNil(o.Cursor) { + var ret *string + return ret + } + + return o.Cursor +} + +// GetCursorOk returns a tuple with the Cursor field value +// and a boolean to check if the value has been set. +func (o *ListCatalogProductsResponse) GetCursorOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Cursor, true +} + +// SetCursor sets field value +func (o *ListCatalogProductsResponse) SetCursor(v *string) { + o.Cursor = v +} + +// GetItems returns the Items field value +func (o *ListCatalogProductsResponse) GetItems() *[]CatalogProductOverview { + if o == nil || IsNil(o.Items) { + var ret *[]CatalogProductOverview + return ret + } + + return o.Items +} + +// GetItemsOk returns a tuple with the Items field value +// and a boolean to check if the value has been set. +func (o *ListCatalogProductsResponse) GetItemsOk() (*[]CatalogProductOverview, bool) { + if o == nil { + return nil, false + } + return o.Items, true +} + +// SetItems sets field value +func (o *ListCatalogProductsResponse) SetItems(v *[]CatalogProductOverview) { + o.Items = v +} + +// GetLimit returns the Limit field value +func (o *ListCatalogProductsResponse) GetLimit() *int64 { + if o == nil || IsNil(o.Limit) { + var ret *int64 + return ret + } + + return o.Limit +} + +// GetLimitOk returns a tuple with the Limit field value +// and a boolean to check if the value has been set. +func (o *ListCatalogProductsResponse) GetLimitOk() (*int64, bool) { + if o == nil { + return nil, false + } + return o.Limit, true +} + +// SetLimit sets field value +func (o *ListCatalogProductsResponse) SetLimit(v *int64) { + o.Limit = v +} + +func (o ListCatalogProductsResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["cursor"] = o.Cursor + toSerialize["items"] = o.Items + toSerialize["limit"] = o.Limit + return toSerialize, nil +} + +type NullableListCatalogProductsResponse struct { + value *ListCatalogProductsResponse + isSet bool +} + +func (v NullableListCatalogProductsResponse) Get() *ListCatalogProductsResponse { + return v.value +} + +func (v *NullableListCatalogProductsResponse) Set(val *ListCatalogProductsResponse) { + v.value = val + v.isSet = true +} + +func (v NullableListCatalogProductsResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableListCatalogProductsResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableListCatalogProductsResponse(val *ListCatalogProductsResponse) *NullableListCatalogProductsResponse { + return &NullableListCatalogProductsResponse{value: val, isSet: true} +} + +func (v NullableListCatalogProductsResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableListCatalogProductsResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/stackitmarketplace/model_list_vendor_subscriptions_response.go b/services/stackitmarketplace/model_list_vendor_subscriptions_response.go new file mode 100644 index 000000000..bfebaab30 --- /dev/null +++ b/services/stackitmarketplace/model_list_vendor_subscriptions_response.go @@ -0,0 +1,172 @@ +/* +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 ListVendorSubscriptionsResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ListVendorSubscriptionsResponse{} + +// ListVendorSubscriptionsResponse struct for ListVendorSubscriptionsResponse +type ListVendorSubscriptionsResponse struct { + // A pagination cursor that represents a position in the dataset. Use it in subsequent requests to continue retrieving data from this position. If `null`, there are no more results to retrieve. + // REQUIRED + Cursor *string `json:"cursor"` + // List of subscriptions. + // REQUIRED + Items *[]VendorSubscription `json:"items"` + // Number of subscriptions returned for a single request. + // Can be cast to int32 without loss of precision. + // REQUIRED + Limit *int64 `json:"limit"` +} + +type _ListVendorSubscriptionsResponse ListVendorSubscriptionsResponse + +// NewListVendorSubscriptionsResponse instantiates a new ListVendorSubscriptionsResponse 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 NewListVendorSubscriptionsResponse(cursor *string, items *[]VendorSubscription, limit *int64) *ListVendorSubscriptionsResponse { + this := ListVendorSubscriptionsResponse{} + this.Cursor = cursor + this.Items = items + this.Limit = limit + return &this +} + +// NewListVendorSubscriptionsResponseWithDefaults instantiates a new ListVendorSubscriptionsResponse 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 NewListVendorSubscriptionsResponseWithDefaults() *ListVendorSubscriptionsResponse { + this := ListVendorSubscriptionsResponse{} + var limit int64 = 50 + this.Limit = &limit + return &this +} + +// GetCursor returns the Cursor field value +func (o *ListVendorSubscriptionsResponse) GetCursor() *string { + if o == nil || IsNil(o.Cursor) { + var ret *string + return ret + } + + return o.Cursor +} + +// GetCursorOk returns a tuple with the Cursor field value +// and a boolean to check if the value has been set. +func (o *ListVendorSubscriptionsResponse) GetCursorOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Cursor, true +} + +// SetCursor sets field value +func (o *ListVendorSubscriptionsResponse) SetCursor(v *string) { + o.Cursor = v +} + +// GetItems returns the Items field value +func (o *ListVendorSubscriptionsResponse) GetItems() *[]VendorSubscription { + if o == nil || IsNil(o.Items) { + var ret *[]VendorSubscription + return ret + } + + return o.Items +} + +// GetItemsOk returns a tuple with the Items field value +// and a boolean to check if the value has been set. +func (o *ListVendorSubscriptionsResponse) GetItemsOk() (*[]VendorSubscription, bool) { + if o == nil { + return nil, false + } + return o.Items, true +} + +// SetItems sets field value +func (o *ListVendorSubscriptionsResponse) SetItems(v *[]VendorSubscription) { + o.Items = v +} + +// GetLimit returns the Limit field value +func (o *ListVendorSubscriptionsResponse) GetLimit() *int64 { + if o == nil || IsNil(o.Limit) { + var ret *int64 + return ret + } + + return o.Limit +} + +// GetLimitOk returns a tuple with the Limit field value +// and a boolean to check if the value has been set. +func (o *ListVendorSubscriptionsResponse) GetLimitOk() (*int64, bool) { + if o == nil { + return nil, false + } + return o.Limit, true +} + +// SetLimit sets field value +func (o *ListVendorSubscriptionsResponse) SetLimit(v *int64) { + o.Limit = v +} + +func (o ListVendorSubscriptionsResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["cursor"] = o.Cursor + toSerialize["items"] = o.Items + toSerialize["limit"] = o.Limit + return toSerialize, nil +} + +type NullableListVendorSubscriptionsResponse struct { + value *ListVendorSubscriptionsResponse + isSet bool +} + +func (v NullableListVendorSubscriptionsResponse) Get() *ListVendorSubscriptionsResponse { + return v.value +} + +func (v *NullableListVendorSubscriptionsResponse) Set(val *ListVendorSubscriptionsResponse) { + v.value = val + v.isSet = true +} + +func (v NullableListVendorSubscriptionsResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableListVendorSubscriptionsResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableListVendorSubscriptionsResponse(val *ListVendorSubscriptionsResponse) *NullableListVendorSubscriptionsResponse { + return &NullableListVendorSubscriptionsResponse{value: val, isSet: true} +} + +func (v NullableListVendorSubscriptionsResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableListVendorSubscriptionsResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/stackitmarketplace/model_requested_subscription_state_response.go b/services/stackitmarketplace/model_requested_subscription_state_response.go new file mode 100644 index 000000000..f6ed66fa4 --- /dev/null +++ b/services/stackitmarketplace/model_requested_subscription_state_response.go @@ -0,0 +1,140 @@ +/* +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 RequestedSubscriptionStateResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &RequestedSubscriptionStateResponse{} + +// RequestedSubscriptionStateResponse struct for RequestedSubscriptionStateResponse +type RequestedSubscriptionStateResponse struct { + // Lifecycle state of the subscription. + // REQUIRED + LifecycleState *string `json:"lifecycleState"` + // The subscription ID. + // REQUIRED + SubscriptionId *string `json:"subscriptionId"` +} + +type _RequestedSubscriptionStateResponse RequestedSubscriptionStateResponse + +// NewRequestedSubscriptionStateResponse instantiates a new RequestedSubscriptionStateResponse 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 NewRequestedSubscriptionStateResponse(lifecycleState *string, subscriptionId *string) *RequestedSubscriptionStateResponse { + this := RequestedSubscriptionStateResponse{} + this.LifecycleState = lifecycleState + this.SubscriptionId = subscriptionId + return &this +} + +// NewRequestedSubscriptionStateResponseWithDefaults instantiates a new RequestedSubscriptionStateResponse 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 NewRequestedSubscriptionStateResponseWithDefaults() *RequestedSubscriptionStateResponse { + this := RequestedSubscriptionStateResponse{} + return &this +} + +// GetLifecycleState returns the LifecycleState field value +func (o *RequestedSubscriptionStateResponse) GetLifecycleState() *string { + if o == nil || IsNil(o.LifecycleState) { + var ret *string + return ret + } + + return o.LifecycleState +} + +// GetLifecycleStateOk returns a tuple with the LifecycleState field value +// and a boolean to check if the value has been set. +func (o *RequestedSubscriptionStateResponse) GetLifecycleStateOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.LifecycleState, true +} + +// SetLifecycleState sets field value +func (o *RequestedSubscriptionStateResponse) SetLifecycleState(v *string) { + o.LifecycleState = v +} + +// GetSubscriptionId returns the SubscriptionId field value +func (o *RequestedSubscriptionStateResponse) GetSubscriptionId() *string { + if o == nil || IsNil(o.SubscriptionId) { + var ret *string + return ret + } + + return o.SubscriptionId +} + +// GetSubscriptionIdOk returns a tuple with the SubscriptionId field value +// and a boolean to check if the value has been set. +func (o *RequestedSubscriptionStateResponse) GetSubscriptionIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.SubscriptionId, true +} + +// SetSubscriptionId sets field value +func (o *RequestedSubscriptionStateResponse) SetSubscriptionId(v *string) { + o.SubscriptionId = v +} + +func (o RequestedSubscriptionStateResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["lifecycleState"] = o.LifecycleState + toSerialize["subscriptionId"] = o.SubscriptionId + return toSerialize, nil +} + +type NullableRequestedSubscriptionStateResponse struct { + value *RequestedSubscriptionStateResponse + isSet bool +} + +func (v NullableRequestedSubscriptionStateResponse) Get() *RequestedSubscriptionStateResponse { + return v.value +} + +func (v *NullableRequestedSubscriptionStateResponse) Set(val *RequestedSubscriptionStateResponse) { + v.value = val + v.isSet = true +} + +func (v NullableRequestedSubscriptionStateResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableRequestedSubscriptionStateResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableRequestedSubscriptionStateResponse(val *RequestedSubscriptionStateResponse) *NullableRequestedSubscriptionStateResponse { + return &NullableRequestedSubscriptionStateResponse{value: val, isSet: true} +} + +func (v NullableRequestedSubscriptionStateResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableRequestedSubscriptionStateResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/stackitmarketplace/model_resolve_customer_payload.go b/services/stackitmarketplace/model_resolve_customer_payload.go new file mode 100644 index 000000000..5c595d9da --- /dev/null +++ b/services/stackitmarketplace/model_resolve_customer_payload.go @@ -0,0 +1,111 @@ +/* +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 ResolveCustomerPayload type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ResolveCustomerPayload{} + +// ResolveCustomerPayload struct for ResolveCustomerPayload +type ResolveCustomerPayload struct { + // Opaque token exchangeable for subscription details. + // REQUIRED + Token *string `json:"token"` +} + +type _ResolveCustomerPayload ResolveCustomerPayload + +// NewResolveCustomerPayload instantiates a new ResolveCustomerPayload 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 NewResolveCustomerPayload(token *string) *ResolveCustomerPayload { + this := ResolveCustomerPayload{} + this.Token = token + return &this +} + +// NewResolveCustomerPayloadWithDefaults instantiates a new ResolveCustomerPayload 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 NewResolveCustomerPayloadWithDefaults() *ResolveCustomerPayload { + this := ResolveCustomerPayload{} + return &this +} + +// GetToken returns the Token field value +func (o *ResolveCustomerPayload) GetToken() *string { + if o == nil || IsNil(o.Token) { + var ret *string + return ret + } + + return o.Token +} + +// GetTokenOk returns a tuple with the Token field value +// and a boolean to check if the value has been set. +func (o *ResolveCustomerPayload) GetTokenOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Token, true +} + +// SetToken sets field value +func (o *ResolveCustomerPayload) SetToken(v *string) { + o.Token = v +} + +func (o ResolveCustomerPayload) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["token"] = o.Token + return toSerialize, nil +} + +type NullableResolveCustomerPayload struct { + value *ResolveCustomerPayload + isSet bool +} + +func (v NullableResolveCustomerPayload) Get() *ResolveCustomerPayload { + return v.value +} + +func (v *NullableResolveCustomerPayload) Set(val *ResolveCustomerPayload) { + v.value = val + v.isSet = true +} + +func (v NullableResolveCustomerPayload) IsSet() bool { + return v.isSet +} + +func (v *NullableResolveCustomerPayload) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableResolveCustomerPayload(val *ResolveCustomerPayload) *NullableResolveCustomerPayload { + return &NullableResolveCustomerPayload{value: val, isSet: true} +} + +func (v NullableResolveCustomerPayload) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableResolveCustomerPayload) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/stackitmarketplace/model_subscription_cancel_response.go b/services/stackitmarketplace/model_subscription_cancel_response.go new file mode 100644 index 000000000..e9a644eba --- /dev/null +++ b/services/stackitmarketplace/model_subscription_cancel_response.go @@ -0,0 +1,138 @@ +/* +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 SubscriptionCancelResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &SubscriptionCancelResponse{} + +// SubscriptionCancelResponse struct for SubscriptionCancelResponse +type SubscriptionCancelResponse struct { + // REQUIRED + CurrentSubscription *CurrentSubscriptionStateResponse `json:"currentSubscription"` + // REQUIRED + RequestedSubscription *RequestedSubscriptionStateResponse `json:"requestedSubscription"` +} + +type _SubscriptionCancelResponse SubscriptionCancelResponse + +// NewSubscriptionCancelResponse instantiates a new SubscriptionCancelResponse 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 NewSubscriptionCancelResponse(currentSubscription *CurrentSubscriptionStateResponse, requestedSubscription *RequestedSubscriptionStateResponse) *SubscriptionCancelResponse { + this := SubscriptionCancelResponse{} + this.CurrentSubscription = currentSubscription + this.RequestedSubscription = requestedSubscription + return &this +} + +// NewSubscriptionCancelResponseWithDefaults instantiates a new SubscriptionCancelResponse 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 NewSubscriptionCancelResponseWithDefaults() *SubscriptionCancelResponse { + this := SubscriptionCancelResponse{} + return &this +} + +// GetCurrentSubscription returns the CurrentSubscription field value +func (o *SubscriptionCancelResponse) GetCurrentSubscription() *CurrentSubscriptionStateResponse { + if o == nil || IsNil(o.CurrentSubscription) { + var ret *CurrentSubscriptionStateResponse + return ret + } + + return o.CurrentSubscription +} + +// GetCurrentSubscriptionOk returns a tuple with the CurrentSubscription field value +// and a boolean to check if the value has been set. +func (o *SubscriptionCancelResponse) GetCurrentSubscriptionOk() (*CurrentSubscriptionStateResponse, bool) { + if o == nil { + return nil, false + } + return o.CurrentSubscription, true +} + +// SetCurrentSubscription sets field value +func (o *SubscriptionCancelResponse) SetCurrentSubscription(v *CurrentSubscriptionStateResponse) { + o.CurrentSubscription = v +} + +// GetRequestedSubscription returns the RequestedSubscription field value +func (o *SubscriptionCancelResponse) GetRequestedSubscription() *RequestedSubscriptionStateResponse { + if o == nil || IsNil(o.RequestedSubscription) { + var ret *RequestedSubscriptionStateResponse + return ret + } + + return o.RequestedSubscription +} + +// GetRequestedSubscriptionOk returns a tuple with the RequestedSubscription field value +// and a boolean to check if the value has been set. +func (o *SubscriptionCancelResponse) GetRequestedSubscriptionOk() (*RequestedSubscriptionStateResponse, bool) { + if o == nil { + return nil, false + } + return o.RequestedSubscription, true +} + +// SetRequestedSubscription sets field value +func (o *SubscriptionCancelResponse) SetRequestedSubscription(v *RequestedSubscriptionStateResponse) { + o.RequestedSubscription = v +} + +func (o SubscriptionCancelResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["currentSubscription"] = o.CurrentSubscription + toSerialize["requestedSubscription"] = o.RequestedSubscription + return toSerialize, nil +} + +type NullableSubscriptionCancelResponse struct { + value *SubscriptionCancelResponse + isSet bool +} + +func (v NullableSubscriptionCancelResponse) Get() *SubscriptionCancelResponse { + return v.value +} + +func (v *NullableSubscriptionCancelResponse) Set(val *SubscriptionCancelResponse) { + v.value = val + v.isSet = true +} + +func (v NullableSubscriptionCancelResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableSubscriptionCancelResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableSubscriptionCancelResponse(val *SubscriptionCancelResponse) *NullableSubscriptionCancelResponse { + return &NullableSubscriptionCancelResponse{value: val, isSet: true} +} + +func (v NullableSubscriptionCancelResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableSubscriptionCancelResponse) 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 new file mode 100644 index 000000000..2d0b43ff4 --- /dev/null +++ b/services/stackitmarketplace/model_subscription_product.go @@ -0,0 +1,314 @@ +/* +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 SubscriptionProduct type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &SubscriptionProduct{} + +// SubscriptionProduct struct for SubscriptionProduct +type SubscriptionProduct struct { + // The product's delivery method. + // REQUIRED + DeliveryMethod *string `json:"deliveryMethod"` + // The lifecycle state of the product. + // REQUIRED + LifecycleState *string `json:"lifecycleState"` + // The product's price type. + // REQUIRED + PriceType *string `json:"priceType"` + // The product's pricing plan. + // REQUIRED + PricingPlan *string `json:"pricingPlan"` + // The product ID. + // REQUIRED + ProductId *string `json:"productId"` + // The name of the product. + // REQUIRED + ProductName *string `json:"productName"` + // The product's vendor name. + // REQUIRED + VendorName *string `json:"vendorName"` + // The vendor's website. + // REQUIRED + VendorWebsiteUrl *string `json:"vendorWebsiteUrl"` +} + +type _SubscriptionProduct SubscriptionProduct + +// NewSubscriptionProduct instantiates a new SubscriptionProduct 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 NewSubscriptionProduct(deliveryMethod *string, lifecycleState *string, priceType *string, pricingPlan *string, productId *string, productName *string, vendorName *string, vendorWebsiteUrl *string) *SubscriptionProduct { + this := SubscriptionProduct{} + this.DeliveryMethod = deliveryMethod + this.LifecycleState = lifecycleState + this.PriceType = priceType + this.PricingPlan = pricingPlan + this.ProductId = productId + this.ProductName = productName + this.VendorName = vendorName + this.VendorWebsiteUrl = vendorWebsiteUrl + return &this +} + +// NewSubscriptionProductWithDefaults instantiates a new SubscriptionProduct 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 NewSubscriptionProductWithDefaults() *SubscriptionProduct { + this := SubscriptionProduct{} + return &this +} + +// GetDeliveryMethod returns the DeliveryMethod field value +func (o *SubscriptionProduct) GetDeliveryMethod() *string { + if o == nil || IsNil(o.DeliveryMethod) { + var ret *string + return ret + } + + return o.DeliveryMethod +} + +// GetDeliveryMethodOk returns a tuple with the DeliveryMethod field value +// and a boolean to check if the value has been set. +func (o *SubscriptionProduct) GetDeliveryMethodOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.DeliveryMethod, true +} + +// SetDeliveryMethod sets field value +func (o *SubscriptionProduct) SetDeliveryMethod(v *string) { + o.DeliveryMethod = v +} + +// GetLifecycleState returns the LifecycleState field value +func (o *SubscriptionProduct) GetLifecycleState() *string { + if o == nil || IsNil(o.LifecycleState) { + var ret *string + return ret + } + + return o.LifecycleState +} + +// GetLifecycleStateOk returns a tuple with the LifecycleState field value +// and a boolean to check if the value has been set. +func (o *SubscriptionProduct) GetLifecycleStateOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.LifecycleState, true +} + +// SetLifecycleState sets field value +func (o *SubscriptionProduct) SetLifecycleState(v *string) { + o.LifecycleState = v +} + +// GetPriceType returns the PriceType field value +func (o *SubscriptionProduct) GetPriceType() *string { + if o == nil || IsNil(o.PriceType) { + var ret *string + return ret + } + + return o.PriceType +} + +// GetPriceTypeOk returns a tuple with the PriceType field value +// and a boolean to check if the value has been set. +func (o *SubscriptionProduct) GetPriceTypeOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.PriceType, true +} + +// SetPriceType sets field value +func (o *SubscriptionProduct) SetPriceType(v *string) { + o.PriceType = v +} + +// GetPricingPlan returns the PricingPlan field value +func (o *SubscriptionProduct) GetPricingPlan() *string { + if o == nil || IsNil(o.PricingPlan) { + var ret *string + return ret + } + + return o.PricingPlan +} + +// GetPricingPlanOk returns a tuple with the PricingPlan field value +// and a boolean to check if the value has been set. +func (o *SubscriptionProduct) GetPricingPlanOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.PricingPlan, true +} + +// SetPricingPlan sets field value +func (o *SubscriptionProduct) SetPricingPlan(v *string) { + o.PricingPlan = v +} + +// GetProductId returns the ProductId field value +func (o *SubscriptionProduct) GetProductId() *string { + if o == nil || IsNil(o.ProductId) { + var ret *string + return ret + } + + return o.ProductId +} + +// GetProductIdOk returns a tuple with the ProductId field value +// and a boolean to check if the value has been set. +func (o *SubscriptionProduct) GetProductIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.ProductId, true +} + +// SetProductId sets field value +func (o *SubscriptionProduct) SetProductId(v *string) { + o.ProductId = v +} + +// GetProductName returns the ProductName field value +func (o *SubscriptionProduct) GetProductName() *string { + if o == nil || IsNil(o.ProductName) { + var ret *string + return ret + } + + return o.ProductName +} + +// GetProductNameOk returns a tuple with the ProductName field value +// and a boolean to check if the value has been set. +func (o *SubscriptionProduct) GetProductNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.ProductName, true +} + +// SetProductName sets field value +func (o *SubscriptionProduct) SetProductName(v *string) { + o.ProductName = v +} + +// GetVendorName returns the VendorName field value +func (o *SubscriptionProduct) GetVendorName() *string { + if o == nil || IsNil(o.VendorName) { + var ret *string + return ret + } + + return o.VendorName +} + +// GetVendorNameOk returns a tuple with the VendorName field value +// and a boolean to check if the value has been set. +func (o *SubscriptionProduct) GetVendorNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.VendorName, true +} + +// SetVendorName sets field value +func (o *SubscriptionProduct) SetVendorName(v *string) { + o.VendorName = v +} + +// GetVendorWebsiteUrl returns the VendorWebsiteUrl field value +func (o *SubscriptionProduct) GetVendorWebsiteUrl() *string { + if o == nil || IsNil(o.VendorWebsiteUrl) { + var ret *string + return ret + } + + return o.VendorWebsiteUrl +} + +// GetVendorWebsiteUrlOk returns a tuple with the VendorWebsiteUrl field value +// and a boolean to check if the value has been set. +func (o *SubscriptionProduct) GetVendorWebsiteUrlOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.VendorWebsiteUrl, true +} + +// SetVendorWebsiteUrl sets field value +func (o *SubscriptionProduct) SetVendorWebsiteUrl(v *string) { + o.VendorWebsiteUrl = v +} + +func (o SubscriptionProduct) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["deliveryMethod"] = o.DeliveryMethod + toSerialize["lifecycleState"] = o.LifecycleState + toSerialize["priceType"] = o.PriceType + toSerialize["pricingPlan"] = o.PricingPlan + toSerialize["productId"] = o.ProductId + toSerialize["productName"] = o.ProductName + toSerialize["vendorName"] = o.VendorName + toSerialize["vendorWebsiteUrl"] = o.VendorWebsiteUrl + return toSerialize, nil +} + +type NullableSubscriptionProduct struct { + value *SubscriptionProduct + isSet bool +} + +func (v NullableSubscriptionProduct) Get() *SubscriptionProduct { + return v.value +} + +func (v *NullableSubscriptionProduct) Set(val *SubscriptionProduct) { + v.value = val + v.isSet = true +} + +func (v NullableSubscriptionProduct) IsSet() bool { + return v.isSet +} + +func (v *NullableSubscriptionProduct) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableSubscriptionProduct(val *SubscriptionProduct) *NullableSubscriptionProduct { + return &NullableSubscriptionProduct{value: val, isSet: true} +} + +func (v NullableSubscriptionProduct) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableSubscriptionProduct) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/stackitmarketplace/model_vendor_subscription.go b/services/stackitmarketplace/model_vendor_subscription.go new file mode 100644 index 000000000..273968682 --- /dev/null +++ b/services/stackitmarketplace/model_vendor_subscription.go @@ -0,0 +1,197 @@ +/* +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 VendorSubscription type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &VendorSubscription{} + +// VendorSubscription struct for VendorSubscription +type VendorSubscription struct { + // Lifecycle state of the subscription. + // REQUIRED + LifecycleState *string `json:"lifecycleState"` + // REQUIRED + Product *SubscriptionProduct `json:"product"` + // The associated consumer project ID. + // REQUIRED + ProjectId *string `json:"projectId"` + // The subscription ID. + // REQUIRED + SubscriptionId *string `json:"subscriptionId"` +} + +type _VendorSubscription VendorSubscription + +// NewVendorSubscription instantiates a new VendorSubscription 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 NewVendorSubscription(lifecycleState *string, product *SubscriptionProduct, projectId *string, subscriptionId *string) *VendorSubscription { + this := VendorSubscription{} + this.LifecycleState = lifecycleState + this.Product = product + this.ProjectId = projectId + this.SubscriptionId = subscriptionId + return &this +} + +// NewVendorSubscriptionWithDefaults instantiates a new VendorSubscription 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 NewVendorSubscriptionWithDefaults() *VendorSubscription { + this := VendorSubscription{} + return &this +} + +// GetLifecycleState returns the LifecycleState field value +func (o *VendorSubscription) GetLifecycleState() *string { + if o == nil || IsNil(o.LifecycleState) { + var ret *string + return ret + } + + return o.LifecycleState +} + +// GetLifecycleStateOk returns a tuple with the LifecycleState field value +// and a boolean to check if the value has been set. +func (o *VendorSubscription) GetLifecycleStateOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.LifecycleState, true +} + +// SetLifecycleState sets field value +func (o *VendorSubscription) SetLifecycleState(v *string) { + o.LifecycleState = v +} + +// GetProduct returns the Product field value +func (o *VendorSubscription) GetProduct() *SubscriptionProduct { + if o == nil || IsNil(o.Product) { + var ret *SubscriptionProduct + return ret + } + + return o.Product +} + +// GetProductOk returns a tuple with the Product field value +// and a boolean to check if the value has been set. +func (o *VendorSubscription) GetProductOk() (*SubscriptionProduct, bool) { + if o == nil { + return nil, false + } + return o.Product, true +} + +// SetProduct sets field value +func (o *VendorSubscription) SetProduct(v *SubscriptionProduct) { + o.Product = v +} + +// GetProjectId returns the ProjectId field value +func (o *VendorSubscription) GetProjectId() *string { + if o == nil || IsNil(o.ProjectId) { + var ret *string + return ret + } + + return o.ProjectId +} + +// GetProjectIdOk returns a tuple with the ProjectId field value +// and a boolean to check if the value has been set. +func (o *VendorSubscription) GetProjectIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.ProjectId, true +} + +// SetProjectId sets field value +func (o *VendorSubscription) SetProjectId(v *string) { + o.ProjectId = v +} + +// GetSubscriptionId returns the SubscriptionId field value +func (o *VendorSubscription) GetSubscriptionId() *string { + if o == nil || IsNil(o.SubscriptionId) { + var ret *string + return ret + } + + return o.SubscriptionId +} + +// GetSubscriptionIdOk returns a tuple with the SubscriptionId field value +// and a boolean to check if the value has been set. +func (o *VendorSubscription) GetSubscriptionIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.SubscriptionId, true +} + +// SetSubscriptionId sets field value +func (o *VendorSubscription) SetSubscriptionId(v *string) { + o.SubscriptionId = v +} + +func (o VendorSubscription) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["lifecycleState"] = o.LifecycleState + toSerialize["product"] = o.Product + toSerialize["projectId"] = o.ProjectId + toSerialize["subscriptionId"] = o.SubscriptionId + return toSerialize, nil +} + +type NullableVendorSubscription struct { + value *VendorSubscription + isSet bool +} + +func (v NullableVendorSubscription) Get() *VendorSubscription { + return v.value +} + +func (v *NullableVendorSubscription) Set(val *VendorSubscription) { + v.value = val + v.isSet = true +} + +func (v NullableVendorSubscription) IsSet() bool { + return v.isSet +} + +func (v *NullableVendorSubscription) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableVendorSubscription(val *VendorSubscription) *NullableVendorSubscription { + return &NullableVendorSubscription{value: val, isSet: true} +} + +func (v NullableVendorSubscription) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableVendorSubscription) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/stackitmarketplace/utils.go b/services/stackitmarketplace/utils.go new file mode 100644 index 000000000..089879e2d --- /dev/null +++ b/services/stackitmarketplace/utils.go @@ -0,0 +1,347 @@ +/* +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" + "reflect" + "time" +) + +// PtrBool is a helper routine that returns a pointer to given boolean value. +func PtrBool(v bool) *bool { return &v } + +// PtrInt is a helper routine that returns a pointer to given integer value. +func PtrInt(v int) *int { return &v } + +// PtrInt32 is a helper routine that returns a pointer to given integer value. +func PtrInt32(v int32) *int32 { return &v } + +// PtrInt64 is a helper routine that returns a pointer to given integer value. +func PtrInt64(v int64) *int64 { return &v } + +// PtrFloat32 is a helper routine that returns a pointer to given float value. +func PtrFloat32(v float32) *float32 { return &v } + +// PtrFloat64 is a helper routine that returns a pointer to given float value. +func PtrFloat64(v float64) *float64 { return &v } + +// PtrString is a helper routine that returns a pointer to given string value. +func PtrString(v string) *string { return &v } + +// PtrTime is helper routine that returns a pointer to given Time value. +func PtrTime(v time.Time) *time.Time { return &v } + +type NullableBool struct { + value *bool + isSet bool +} + +func (v NullableBool) Get() *bool { + return v.value +} + +func (v *NullableBool) Set(val *bool) { + v.value = val + v.isSet = true +} + +func (v NullableBool) IsSet() bool { + return v.isSet +} + +func (v *NullableBool) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableBool(val *bool) *NullableBool { + return &NullableBool{value: val, isSet: true} +} + +func (v NullableBool) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableBool) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type NullableInt struct { + value *int + isSet bool +} + +func (v NullableInt) Get() *int { + return v.value +} + +func (v *NullableInt) Set(val *int) { + v.value = val + v.isSet = true +} + +func (v NullableInt) IsSet() bool { + return v.isSet +} + +func (v *NullableInt) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableInt(val *int) *NullableInt { + return &NullableInt{value: val, isSet: true} +} + +func (v NullableInt) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableInt) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type NullableInt32 struct { + value *int32 + isSet bool +} + +func (v NullableInt32) Get() *int32 { + return v.value +} + +func (v *NullableInt32) Set(val *int32) { + v.value = val + v.isSet = true +} + +func (v NullableInt32) IsSet() bool { + return v.isSet +} + +func (v *NullableInt32) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableInt32(val *int32) *NullableInt32 { + return &NullableInt32{value: val, isSet: true} +} + +func (v NullableInt32) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableInt32) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type NullableInt64 struct { + value *int64 + isSet bool +} + +func (v NullableInt64) Get() *int64 { + return v.value +} + +func (v *NullableInt64) Set(val *int64) { + v.value = val + v.isSet = true +} + +func (v NullableInt64) IsSet() bool { + return v.isSet +} + +func (v *NullableInt64) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableInt64(val *int64) *NullableInt64 { + return &NullableInt64{value: val, isSet: true} +} + +func (v NullableInt64) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableInt64) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type NullableFloat32 struct { + value *float32 + isSet bool +} + +func (v NullableFloat32) Get() *float32 { + return v.value +} + +func (v *NullableFloat32) Set(val *float32) { + v.value = val + v.isSet = true +} + +func (v NullableFloat32) IsSet() bool { + return v.isSet +} + +func (v *NullableFloat32) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableFloat32(val *float32) *NullableFloat32 { + return &NullableFloat32{value: val, isSet: true} +} + +func (v NullableFloat32) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableFloat32) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type NullableFloat64 struct { + value *float64 + isSet bool +} + +func (v NullableFloat64) Get() *float64 { + return v.value +} + +func (v *NullableFloat64) Set(val *float64) { + v.value = val + v.isSet = true +} + +func (v NullableFloat64) IsSet() bool { + return v.isSet +} + +func (v *NullableFloat64) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableFloat64(val *float64) *NullableFloat64 { + return &NullableFloat64{value: val, isSet: true} +} + +func (v NullableFloat64) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableFloat64) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type NullableString struct { + value *string + isSet bool +} + +func (v NullableString) Get() *string { + return v.value +} + +func (v *NullableString) Set(val *string) { + v.value = val + v.isSet = true +} + +func (v NullableString) IsSet() bool { + return v.isSet +} + +func (v *NullableString) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableString(val *string) *NullableString { + return &NullableString{value: val, isSet: true} +} + +func (v NullableString) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableString) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type NullableTime struct { + value *time.Time + isSet bool +} + +func (v NullableTime) Get() *time.Time { + return v.value +} + +func (v *NullableTime) Set(val *time.Time) { + v.value = val + v.isSet = true +} + +func (v NullableTime) IsSet() bool { + return v.isSet +} + +func (v *NullableTime) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableTime(val *time.Time) *NullableTime { + return &NullableTime{value: val, isSet: true} +} + +func (v NullableTime) MarshalJSON() ([]byte, error) { + return v.value.MarshalJSON() +} + +func (v *NullableTime) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +// IsNil checks if an input is nil +func IsNil(i interface{}) bool { + if i == nil { + return true + } + switch reflect.TypeOf(i).Kind() { + case reflect.Chan, reflect.Func, reflect.Map, reflect.Ptr, reflect.UnsafePointer, reflect.Interface, reflect.Slice: + return reflect.ValueOf(i).IsNil() + case reflect.Array: + return reflect.ValueOf(i).IsZero() + } + return false +} + +type MappedNullable interface { + ToMap() (map[string]interface{}, error) +}