From f65a693f5b096a99b3179f961afc5412aa1dbb14 Mon Sep 17 00:00:00 2001 From: Lajos Szoke <63732287+laliconfigcat@users.noreply.github.com> Date: Fri, 19 Apr 2024 19:30:34 +0200 Subject: [PATCH] Regenerated based on latest api (#11) * regenerated api * regen --- .openapi-generator/FILES | 10 +- README.md | 7 +- api/openapi.yaml | 298 ++++++++++++++---- api_feature_flag_setting_values.go | 4 +- ...ature_flag_setting_values_using_sdk_key.go | 2 +- ...re_flag_setting_values_using_sdk_key_v2.go | 2 +- api_feature_flag_setting_values_v2.go | 2 +- api_feature_flags_settings.go | 118 +++++++ api_webhooks.go | 129 +++++++- docs/FeatureFlagsSettingsApi.md | 73 +++++ docs/ReplaceSettingModel.md | 159 ++++++++++ docs/WebHookRequest.md | 149 +++++++++ docs/WebhookConfig.md | 92 ++++++ docs/WebhookEnvironment.md | 92 ++++++ docs/WebhookModel.md | 72 ++--- docs/WebhooksApi.md | 81 ++++- model_replace_setting_model.go | 251 +++++++++++++++ model_web_hook_request.go | 240 ++++++++++++++ model_webhook_config.go | 175 ++++++++++ model_webhook_environment.go | 175 ++++++++++ model_webhook_model.go | 94 +++--- 21 files changed, 2034 insertions(+), 191 deletions(-) create mode 100644 docs/ReplaceSettingModel.md create mode 100644 docs/WebHookRequest.md create mode 100644 docs/WebhookConfig.md create mode 100644 docs/WebhookEnvironment.md create mode 100644 model_replace_setting_model.go create mode 100644 model_web_hook_request.go create mode 100644 model_webhook_config.go create mode 100644 model_webhook_environment.go diff --git a/.openapi-generator/FILES b/.openapi-generator/FILES index b3d5a53..b78c3d0 100644 --- a/.openapi-generator/FILES +++ b/.openapi-generator/FILES @@ -51,7 +51,6 @@ docs/CreateProductRequest.md docs/CreateSegmentModel.md docs/CreateSettingInitialValues.md docs/CreateTagModel.md -docs/CreateWebHookRequest.md docs/DeleteIntegrationLinkModel.md docs/DeleteRepositoryReportsRequest.md docs/EnvironmentAccessModel.md @@ -101,6 +100,7 @@ docs/ProductsApi.md docs/ReasonRequiredEnvironmentModel.md docs/ReferenceLine.md docs/ReferenceLines.md +docs/ReplaceSettingModel.md docs/RolloutPercentageItemModel.md docs/RolloutRuleComparator.md docs/RolloutRuleModel.md @@ -140,6 +140,9 @@ docs/UserConditionModel.md docs/UserModel.md docs/ValueModel.md docs/WebHookHttpMethod.md +docs/WebHookRequest.md +docs/WebhookConfig.md +docs/WebhookEnvironment.md docs/WebhookHeaderModel.md docs/WebhookModel.md docs/WebhookSigningKeysModel.md @@ -172,7 +175,6 @@ model_create_product_request.go model_create_segment_model.go model_create_setting_initial_values.go model_create_tag_model.go -model_create_web_hook_request.go model_delete_integration_link_model.go model_delete_repository_reports_request.go model_environment_access_model.go @@ -210,6 +212,7 @@ model_product_model.go model_reason_required_environment_model.go model_reference_line.go model_reference_lines.go +model_replace_setting_model.go model_rollout_percentage_item_model.go model_rollout_rule_comparator.go model_rollout_rule_model.go @@ -246,6 +249,9 @@ model_user_condition_model.go model_user_model.go model_value_model.go model_web_hook_http_method.go +model_web_hook_request.go +model_webhook_config.go +model_webhook_environment.go model_webhook_header_model.go model_webhook_model.go model_webhook_signing_keys_model.go diff --git a/README.md b/README.md index c09749c..70598c7 100644 --- a/README.md +++ b/README.md @@ -149,6 +149,7 @@ Class | Method | HTTP request | Description *FeatureFlagsSettingsApi* | [**DeleteSetting**](docs/FeatureFlagsSettingsApi.md#deletesetting) | **Delete** /v1/settings/{settingId} | Delete Flag *FeatureFlagsSettingsApi* | [**GetSetting**](docs/FeatureFlagsSettingsApi.md#getsetting) | **Get** /v1/settings/{settingId} | Get Flag *FeatureFlagsSettingsApi* | [**GetSettings**](docs/FeatureFlagsSettingsApi.md#getsettings) | **Get** /v1/configs/{configId}/settings | List Flags +*FeatureFlagsSettingsApi* | [**ReplaceSetting**](docs/FeatureFlagsSettingsApi.md#replacesetting) | **Put** /v1/settings/{settingId} | Replace Flag *FeatureFlagsSettingsApi* | [**UpdateSetting**](docs/FeatureFlagsSettingsApi.md#updatesetting) | **Patch** /v1/settings/{settingId} | Update Flag *IntegrationLinksApi* | [**AddOrUpdateIntegrationLink**](docs/IntegrationLinksApi.md#addorupdateintegrationlink) | **Post** /v1/environments/{environmentId}/settings/{settingId}/integrationLinks/{integrationLinkType}/{key} | Add or update Integration link *IntegrationLinksApi* | [**DeleteIntegrationLink**](docs/IntegrationLinksApi.md#deleteintegrationlink) | **Delete** /v1/environments/{environmentId}/settings/{settingId}/integrationLinks/{integrationLinkType}/{key} | Delete Integration link @@ -196,6 +197,7 @@ Class | Method | HTTP request | Description *WebhooksApi* | [**GetWebhook**](docs/WebhooksApi.md#getwebhook) | **Get** /v1/webhooks/{webhookId} | Get Webhook *WebhooksApi* | [**GetWebhookSigningKeys**](docs/WebhooksApi.md#getwebhooksigningkeys) | **Get** /v1/webhooks/{webhookId}/keys | Get Webhook Signing Keys *WebhooksApi* | [**GetWebhooks**](docs/WebhooksApi.md#getwebhooks) | **Get** /v1/products/{productId}/webhooks | List Webhooks +*WebhooksApi* | [**ReplaceWebhook**](docs/WebhooksApi.md#replacewebhook) | **Put** /v1/webhooks/{webhookId} | Replace Webhook *WebhooksApi* | [**UpdateWebhook**](docs/WebhooksApi.md#updatewebhook) | **Patch** /v1/webhooks/{webhookId} | Update Webhook @@ -226,7 +228,6 @@ Class | Method | HTTP request | Description - [CreateSegmentModel](docs/CreateSegmentModel.md) - [CreateSettingInitialValues](docs/CreateSettingInitialValues.md) - [CreateTagModel](docs/CreateTagModel.md) - - [CreateWebHookRequest](docs/CreateWebHookRequest.md) - [DeleteIntegrationLinkModel](docs/DeleteIntegrationLinkModel.md) - [DeleteRepositoryReportsRequest](docs/DeleteRepositoryReportsRequest.md) - [EnvironmentAccessModel](docs/EnvironmentAccessModel.md) @@ -264,6 +265,7 @@ Class | Method | HTTP request | Description - [ReasonRequiredEnvironmentModel](docs/ReasonRequiredEnvironmentModel.md) - [ReferenceLine](docs/ReferenceLine.md) - [ReferenceLines](docs/ReferenceLines.md) + - [ReplaceSettingModel](docs/ReplaceSettingModel.md) - [RolloutPercentageItemModel](docs/RolloutPercentageItemModel.md) - [RolloutRuleComparator](docs/RolloutRuleComparator.md) - [RolloutRuleModel](docs/RolloutRuleModel.md) @@ -300,6 +302,9 @@ Class | Method | HTTP request | Description - [UserModel](docs/UserModel.md) - [ValueModel](docs/ValueModel.md) - [WebHookHttpMethod](docs/WebHookHttpMethod.md) + - [WebHookRequest](docs/WebHookRequest.md) + - [WebhookConfig](docs/WebhookConfig.md) + - [WebhookEnvironment](docs/WebhookEnvironment.md) - [WebhookHeaderModel](docs/WebhookHeaderModel.md) - [WebhookModel](docs/WebhookModel.md) - [WebhookSigningKeysModel](docs/WebhookSigningKeysModel.md) diff --git a/api/openapi.yaml b/api/openapi.yaml index 8926b91..d5cf141 100644 --- a/api/openapi.yaml +++ b/api/openapi.yaml @@ -1966,6 +1966,52 @@ paths: summary: Update Flag tags: - Feature Flags & Settings + put: + description: "This endpoint replaces the whole value of a Feature Flag or Setting\n\ + identified by the `settingId` parameter.\n\n**Important:** As this endpoint\ + \ is doing a complete replace, it's important to set every other attribute\ + \ that you don't \nwant to change in its original state. Not listing one means\ + \ it will reset." + operationId: replace-setting + parameters: + - description: The identifier of the Setting. + explode: false + in: path + name: settingId + required: true + schema: + format: int32 + type: integer + style: simple + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/ReplaceSettingModel' + text/json: + schema: + $ref: '#/components/schemas/ReplaceSettingModel' + application/*+json: + schema: + $ref: '#/components/schemas/ReplaceSettingModel' + required: true + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/SettingModel' + description: When the replace was successful. + "400": + description: Bad request. + "404": + description: Not found. + "429": + description: Too many requests. In case of the request rate exceeds the + rate limits. + summary: Replace Flag + tags: + - Feature Flags & Settings /v1/tags/{tagId}/settings: get: description: "This endpoint returns the list of the Settings that \nhas the\ @@ -2336,12 +2382,12 @@ paths: \ and `percentageRules` attributes are modifiable by this endpoint.\n\n**Important:**\ \ As this endpoint is doing a complete replace, it's important to set every\ \ other attribute that you don't \nwant to change to its original state. Not\ - \ listing one means that it will reset.\n\nFor example: We have the following\ - \ resource.\n```json\n{\n \"rolloutPercentageItems\": [\n {\n \"\ - percentage\": 30,\n \"value\": true\n },\n {\n \"percentage\"\ - : 70,\n \"value\": false\n }\n ],\n \"rolloutRules\": [],\n \"\ - value\": false\n}\n```\nIf we send a replace request body as below:\n```json\n\ - {\n \"value\": true\n}\n```\nThen besides that the default served value is\ + \ listing one means it will reset.\n\nFor example: We have the following resource.\n\ + ```json\n{\n \"rolloutPercentageItems\": [\n {\n \"percentage\":\ + \ 30,\n \"value\": true\n },\n {\n \"percentage\": 70,\n \ + \ \"value\": false\n }\n ],\n \"rolloutRules\": [],\n \"value\"\ + : false\n}\n```\nIf we send a replace request body as below:\n```json\n{\n\ + \ \"value\": true\n}\n```\nThen besides that the default served value is\ \ set to `true`, all the Percentage Rules are deleted. \nSo we get a response\ \ like this:\n```json\n{\n \"rolloutPercentageItems\": [],\n \"rolloutRules\"\ : [],\n \"value\": true\n}\n```" @@ -2785,7 +2831,7 @@ paths: \ attributes are modifiable by this endpoint.\n\n**Important:** As this endpoint\ \ is doing a complete replace, it's important to set every other attribute\ \ that you don't \nwant to change in its original state. Not listing one means\ - \ that it will reset.\n\nFor example: We have the following resource.\n```json\n\ + \ it will reset.\n\nFor example: We have the following resource.\n```json\n\ {\n \"rolloutPercentageItems\": [\n {\n \"percentage\": 30,\n \ \ \"value\": true\n },\n {\n \"percentage\": 70,\n \"value\"\ : false\n }\n ],\n \"rolloutRules\": [],\n \"value\": false\n}\n```\n\ @@ -3329,7 +3375,7 @@ paths: Only the `defaultValue`, `targetingRules`, and `percentageEvaluationAttribute` fields are modifiable by this endpoint. **Important:** As this endpoint is doing a complete replace, it's important to set every other field that you don't - want to change to its original state. Not listing one means that it will reset. + want to change to its original state. Not listing one means it will reset. For example: We have the following resource of a Feature Flag. ```json @@ -3942,7 +3988,7 @@ paths: Only the `defaultValue`, `targetingRules`, and `percentageEvaluationAttribute` fields are modifiable by this endpoint. **Important:** As this endpoint is doing a complete replace, it's important to set every other field that you don't - want to change to its original state. Not listing one means that it will reset. + want to change to its original state. Not listing one means it will reset. For example: We have the following resource of a Feature Flag. ```json @@ -4183,10 +4229,10 @@ paths: \ `rolloutRules` and `percentageRules` attributes are modifiable by this endpoint.\n\ \n**Important:** As this endpoint is doing a complete replace, it's important\ \ to set every other attribute that you don't \nwant to change in its original\ - \ state. Not listing one means that it will reset.\n\nFor example: We have\ - \ the following resource.\n```json\n{\n \"settingValues\": [\n {\n \ - \ \"rolloutPercentageItems\": [\n {\n \"percentage\": 30,\n\ - \ \"value\": true\n },\n {\n \"percentage\"\ + \ state. Not listing one means it will reset.\n\nFor example: We have the\ + \ following resource.\n```json\n{\n \"settingValues\": [\n {\n \"\ + rolloutPercentageItems\": [\n {\n \"percentage\": 30,\n \ + \ \"value\": true\n },\n {\n \"percentage\"\ : 70,\n \"value\": false\n }\n ],\n \"rolloutRules\"\ : [],\n \"value\": false,\n \"settingId\": 1\n }\n ]\n}\n```\n\ If we send a replace request body as below:\n```json\n{ \n \"settingValues\"\ @@ -4623,6 +4669,52 @@ paths: summary: Update Webhook tags: - Webhooks + put: + description: |- + This endpoint replaces the whole value of a Webhook identified by the `webhookId` parameter. + + **Important:** As this endpoint is doing a complete replace, it's important to set every other attribute that you don't + want to change in its original state. Not listing one means it will reset. + operationId: replace-webhook + parameters: + - description: The identifier of the Webhook. + explode: false + in: path + name: webhookId + required: true + schema: + format: int32 + type: integer + style: simple + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/WebHookRequest' + text/json: + schema: + $ref: '#/components/schemas/WebHookRequest' + application/*+json: + schema: + $ref: '#/components/schemas/WebHookRequest' + required: true + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/WebhookModel' + description: When the replace was successful. + "400": + description: Bad request. + "404": + description: Not found. + "429": + description: Too many requests. In case of the request rate exceeds the + rate limits. + summary: Replace Webhook + tags: + - Webhooks /v1/webhooks/{webhookId}/keys: get: description: "This endpoint returns the signing keys of a Webhook \nidentified\ @@ -4933,13 +5025,13 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/CreateWebHookRequest' + $ref: '#/components/schemas/WebHookRequest' text/json: schema: - $ref: '#/components/schemas/CreateWebHookRequest' + $ref: '#/components/schemas/WebHookRequest' application/*+json: schema: - $ref: '#/components/schemas/CreateWebHookRequest' + $ref: '#/components/schemas/WebHookRequest' required: true responses: "201": @@ -7086,45 +7178,6 @@ components: required: - name type: object - CreateWebHookRequest: - additionalProperties: false - example: - webHookHeaders: - - isSecure: true - value: value - key: key - - isSecure: true - value: value - key: key - httpMethod: null - url: url - content: content - properties: - url: - description: The URL of the Webhook. - maxLength: 1000 - minLength: 7 - pattern: "^(https?:\\/\\/(?:www\\.|(?!www)|(?!a-zA-Z))[a-zA-Z0-9][a-zA-Z0-9-]*[a-zA-Z0-9]\\\ - .[^\\s]{2,}|https?:\\/\\/(?:www\\.|(?!www)|(?!a-zA-Z))[a-zA-Z0-9]\\.[^\\\ - s]{2,})$" - type: string - content: - description: The HTTP body content. - maxLength: 15000 - minLength: 0 - nullable: true - type: string - httpMethod: - $ref: '#/components/schemas/WebHookHttpMethod' - webHookHeaders: - description: List of HTTP headers. - items: - $ref: '#/components/schemas/WebhookHeaderModel' - nullable: true - type: array - required: - - url - type: object DeleteIntegrationLinkModel: additionalProperties: false example: @@ -8348,6 +8401,44 @@ components: - file - referenceLine type: object + ReplaceSettingModel: + additionalProperties: false + example: + hint: hint + name: name + tags: + - 0 + - 0 + order: 6 + properties: + hint: + description: "A short description for the setting, shown on the Dashboard\ + \ UI." + maxLength: 1000 + minLength: 0 + nullable: true + type: string + tags: + description: The IDs of the tags which are attached to the setting. + items: + format: int64 + type: integer + nullable: true + type: array + order: + description: "The order of the Setting represented on the ConfigCat Dashboard.\r\ + \nDetermined from an ascending sequence of integers." + format: int32 + nullable: true + type: integer + name: + description: The name of the Feature Flag or Setting. + maxLength: 255 + minLength: 1 + type: string + required: + - name + type: object RolloutPercentageItemModel: additionalProperties: false example: @@ -10502,6 +10593,77 @@ components: - get - post type: string + WebHookRequest: + additionalProperties: false + example: + webHookHeaders: + - isSecure: true + value: value + key: key + - isSecure: true + value: value + key: key + httpMethod: null + url: url + content: content + properties: + url: + description: The URL of the Webhook. + maxLength: 1000 + minLength: 7 + pattern: "^(https?:\\/\\/(?:www\\.|(?!www)|(?!a-zA-Z))[a-zA-Z0-9][a-zA-Z0-9-]*[a-zA-Z0-9]\\\ + .[^\\s]{2,}|https?:\\/\\/(?:www\\.|(?!www)|(?!a-zA-Z))[a-zA-Z0-9]\\.[^\\\ + s]{2,})$" + type: string + content: + description: The HTTP body content. + maxLength: 15000 + minLength: 0 + nullable: true + type: string + httpMethod: + $ref: '#/components/schemas/WebHookHttpMethod' + webHookHeaders: + description: List of HTTP headers. + items: + $ref: '#/components/schemas/WebhookHeaderModel' + nullable: true + type: array + required: + - url + type: object + WebhookConfig: + additionalProperties: false + description: The Config where the applied changes will invoke the Webhook. + example: + configId: 046b6c7f-0b8a-43b9-b35d-6489e6daee91 + name: name + properties: + name: + description: The Config's name. + nullable: true + type: string + configId: + description: The Config's identifier. + format: uuid + type: string + type: object + WebhookEnvironment: + additionalProperties: false + description: The Environment where the applied changes will invoke the Webhook. + example: + environmentId: 046b6c7f-0b8a-43b9-b35d-6489e6daee91 + name: name + properties: + name: + description: The Environment's name. + nullable: true + type: string + environmentId: + description: The Environment's identifier. + format: uuid + type: string + type: object WebhookHeaderModel: additionalProperties: false example: @@ -10513,13 +10675,13 @@ components: description: The HTTP header key. maxLength: 255 minLength: 1 - pattern: "^[\\x00-\\x7F]*$" + pattern: "^[a-zA-Z0-9_\\-]*$" type: string value: description: The HTTP header value. maxLength: 1000 minLength: 1 - pattern: "^[\\x00-\\x7F]*$" + pattern: "^[a-zA-Z0-9\\- _\\\\:;.,\\/\"'?!(){}\\[\\]@<>=+*#$&`|~^%]*$" type: string isSecure: description: Indicates whether the header value is sensitive. @@ -10538,10 +10700,14 @@ components: - isSecure: true value: value key: key - configName: configName + environment: + environmentId: 046b6c7f-0b8a-43b9-b35d-6489e6daee91 + name: name webhookId: 0 - environmentName: environmentName httpMethod: null + config: + configId: 046b6c7f-0b8a-43b9-b35d-6489e6daee91 + name: name url: url content: content properties: @@ -10565,16 +10731,10 @@ components: $ref: '#/components/schemas/WebhookHeaderModel' nullable: true type: array - configName: - description: The Config's name where the applied changes will invoke the - Webhook. - nullable: true - type: string - environmentName: - description: The Environment's name where the applied changes will invoke - the Webhook. - nullable: true - type: string + config: + $ref: '#/components/schemas/WebhookConfig' + environment: + $ref: '#/components/schemas/WebhookEnvironment' type: object WebhookSigningKeysModel: additionalProperties: false diff --git a/api_feature_flag_setting_values.go b/api_feature_flag_setting_values.go index 1b2bb1e..16fca33 100644 --- a/api_feature_flag_setting_values.go +++ b/api_feature_flag_setting_values.go @@ -291,7 +291,7 @@ in a specified Environment identified by the `environmentId` parameter. Only the `value`, `rolloutRules` and `percentageRules` attributes are modifiable by this endpoint. **Important:** As this endpoint is doing a complete replace, it's important to set every other attribute that you don't -want to change in its original state. Not listing one means that it will reset. +want to change in its original state. Not listing one means it will reset. For example: We have the following resource. ```json @@ -480,7 +480,7 @@ This endpoint replaces the whole value of a Feature Flag or Setting in a specifi Only the `value`, `rolloutRules` and `percentageRules` attributes are modifiable by this endpoint. **Important:** As this endpoint is doing a complete replace, it's important to set every other attribute that you don't -want to change in its original state. Not listing one means that it will reset. +want to change in its original state. Not listing one means it will reset. For example: We have the following resource. ```json diff --git a/api_feature_flag_setting_values_using_sdk_key.go b/api_feature_flag_setting_values_using_sdk_key.go index 8a7b8eb..b34eef7 100644 --- a/api_feature_flag_setting_values_using_sdk_key.go +++ b/api_feature_flag_setting_values_using_sdk_key.go @@ -186,7 +186,7 @@ in a specified Environment identified by the = 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + type FeatureFlagsSettingsApiUpdateSettingRequest struct { ctx context.Context ApiService *FeatureFlagsSettingsApiService diff --git a/api_webhooks.go b/api_webhooks.go index a844cb5..f29e366 100644 --- a/api_webhooks.go +++ b/api_webhooks.go @@ -29,11 +29,11 @@ type WebhooksApiCreateWebhookRequest struct { ApiService *WebhooksApiService configId string environmentId string - createWebHookRequest *CreateWebHookRequest + webHookRequest *WebHookRequest } -func (r WebhooksApiCreateWebhookRequest) CreateWebHookRequest(createWebHookRequest CreateWebHookRequest) WebhooksApiCreateWebhookRequest { - r.createWebHookRequest = &createWebHookRequest +func (r WebhooksApiCreateWebhookRequest) WebHookRequest(webHookRequest WebHookRequest) WebhooksApiCreateWebhookRequest { + r.webHookRequest = &webHookRequest return r } @@ -83,8 +83,8 @@ func (a *WebhooksApiService) CreateWebhookExecute(r WebhooksApiCreateWebhookRequ localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} localVarFormParams := url.Values{} - if r.createWebHookRequest == nil { - return localVarReturnValue, nil, reportError("createWebHookRequest is required and must be specified") + if r.webHookRequest == nil { + return localVarReturnValue, nil, reportError("webHookRequest is required and must be specified") } // to determine the Content-Type header @@ -105,7 +105,7 @@ func (a *WebhooksApiService) CreateWebhookExecute(r WebhooksApiCreateWebhookRequ localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } // body params - localVarPostBody = r.createWebHookRequest + localVarPostBody = r.webHookRequest req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) if err != nil { return localVarReturnValue, nil, err @@ -551,6 +551,123 @@ func (a *WebhooksApiService) GetWebhooksExecute(r WebhooksApiGetWebhooksRequest) return localVarReturnValue, localVarHTTPResponse, nil } +type WebhooksApiReplaceWebhookRequest struct { + ctx context.Context + ApiService *WebhooksApiService + webhookId int32 + webHookRequest *WebHookRequest +} + +func (r WebhooksApiReplaceWebhookRequest) WebHookRequest(webHookRequest WebHookRequest) WebhooksApiReplaceWebhookRequest { + r.webHookRequest = &webHookRequest + return r +} + +func (r WebhooksApiReplaceWebhookRequest) Execute() (*WebhookModel, *http.Response, error) { + return r.ApiService.ReplaceWebhookExecute(r) +} + +/* +ReplaceWebhook Replace Webhook + +This endpoint replaces the whole value of a Webhook identified by the `webhookId` parameter. + +**Important:** As this endpoint is doing a complete replace, it's important to set every other attribute that you don't +want to change in its original state. Not listing one means it will reset. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param webhookId The identifier of the Webhook. + @return WebhooksApiReplaceWebhookRequest +*/ +func (a *WebhooksApiService) ReplaceWebhook(ctx context.Context, webhookId int32) WebhooksApiReplaceWebhookRequest { + return WebhooksApiReplaceWebhookRequest{ + ApiService: a, + ctx: ctx, + webhookId: webhookId, + } +} + +// Execute executes the request +// @return WebhookModel +func (a *WebhooksApiService) ReplaceWebhookExecute(r WebhooksApiReplaceWebhookRequest) (*WebhookModel, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodPut + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *WebhookModel + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "WebhooksApiService.ReplaceWebhook") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/v1/webhooks/{webhookId}" + localVarPath = strings.Replace(localVarPath, "{"+"webhookId"+"}", url.PathEscape(parameterValueToString(r.webhookId, "webhookId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.webHookRequest == nil { + return localVarReturnValue, nil, reportError("webHookRequest is required and must be specified") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json", "text/json", "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.webHookRequest + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + type WebhooksApiUpdateWebhookRequest struct { ctx context.Context ApiService *WebhooksApiService diff --git a/docs/FeatureFlagsSettingsApi.md b/docs/FeatureFlagsSettingsApi.md index 0d905c8..baea4e6 100644 --- a/docs/FeatureFlagsSettingsApi.md +++ b/docs/FeatureFlagsSettingsApi.md @@ -8,6 +8,7 @@ Method | HTTP request | Description [**DeleteSetting**](FeatureFlagsSettingsApi.md#DeleteSetting) | **Delete** /v1/settings/{settingId} | Delete Flag [**GetSetting**](FeatureFlagsSettingsApi.md#GetSetting) | **Get** /v1/settings/{settingId} | Get Flag [**GetSettings**](FeatureFlagsSettingsApi.md#GetSettings) | **Get** /v1/configs/{configId}/settings | List Flags +[**ReplaceSetting**](FeatureFlagsSettingsApi.md#ReplaceSetting) | **Put** /v1/settings/{settingId} | Replace Flag [**UpdateSetting**](FeatureFlagsSettingsApi.md#UpdateSetting) | **Patch** /v1/settings/{settingId} | Update Flag @@ -292,6 +293,78 @@ Name | Type | Description | Notes [[Back to README]](../README.md) +## ReplaceSetting + +> SettingModel ReplaceSetting(ctx, settingId).ReplaceSettingModel(replaceSettingModel).Execute() + +Replace Flag + + + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "github.com/configcat/configcat-publicapi-go-client" +) + +func main() { + settingId := int32(56) // int32 | The identifier of the Setting. + replaceSettingModel := *openapiclient.NewReplaceSettingModel("Name_example") // ReplaceSettingModel | + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.FeatureFlagsSettingsApi.ReplaceSetting(context.Background(), settingId).ReplaceSettingModel(replaceSettingModel).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `FeatureFlagsSettingsApi.ReplaceSetting``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `ReplaceSetting`: SettingModel + fmt.Fprintf(os.Stdout, "Response from `FeatureFlagsSettingsApi.ReplaceSetting`: %v\n", resp) +} +``` + +### Path Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**settingId** | **int32** | The identifier of the Setting. | + +### Other Parameters + +Other parameters are passed through a pointer to a apiReplaceSettingRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + + **replaceSettingModel** | [**ReplaceSettingModel**](ReplaceSettingModel.md) | | + +### Return type + +[**SettingModel**](SettingModel.md) + +### Authorization + +[Basic](../README.md#Basic) + +### HTTP request headers + +- **Content-Type**: application/json, text/json, application/*+json +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + ## UpdateSetting > SettingModel UpdateSetting(ctx, settingId).JsonPatchOperation(jsonPatchOperation).Execute() diff --git a/docs/ReplaceSettingModel.md b/docs/ReplaceSettingModel.md new file mode 100644 index 0000000..a736bf1 --- /dev/null +++ b/docs/ReplaceSettingModel.md @@ -0,0 +1,159 @@ +# ReplaceSettingModel + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Hint** | Pointer to **NullableString** | A short description for the setting, shown on the Dashboard UI. | [optional] +**Tags** | Pointer to **[]int64** | The IDs of the tags which are attached to the setting. | [optional] +**Order** | Pointer to **NullableInt32** | The order of the Setting represented on the ConfigCat Dashboard. Determined from an ascending sequence of integers. | [optional] +**Name** | **string** | The name of the Feature Flag or Setting. | + +## Methods + +### NewReplaceSettingModel + +`func NewReplaceSettingModel(name string, ) *ReplaceSettingModel` + +NewReplaceSettingModel instantiates a new ReplaceSettingModel 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 + +### NewReplaceSettingModelWithDefaults + +`func NewReplaceSettingModelWithDefaults() *ReplaceSettingModel` + +NewReplaceSettingModelWithDefaults instantiates a new ReplaceSettingModel 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 + +### GetHint + +`func (o *ReplaceSettingModel) GetHint() string` + +GetHint returns the Hint field if non-nil, zero value otherwise. + +### GetHintOk + +`func (o *ReplaceSettingModel) GetHintOk() (*string, bool)` + +GetHintOk returns a tuple with the Hint field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetHint + +`func (o *ReplaceSettingModel) SetHint(v string)` + +SetHint sets Hint field to given value. + +### HasHint + +`func (o *ReplaceSettingModel) HasHint() bool` + +HasHint returns a boolean if a field has been set. + +### SetHintNil + +`func (o *ReplaceSettingModel) SetHintNil(b bool)` + + SetHintNil sets the value for Hint to be an explicit nil + +### UnsetHint +`func (o *ReplaceSettingModel) UnsetHint()` + +UnsetHint ensures that no value is present for Hint, not even an explicit nil +### GetTags + +`func (o *ReplaceSettingModel) GetTags() []int64` + +GetTags returns the Tags field if non-nil, zero value otherwise. + +### GetTagsOk + +`func (o *ReplaceSettingModel) GetTagsOk() (*[]int64, bool)` + +GetTagsOk returns a tuple with the Tags field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetTags + +`func (o *ReplaceSettingModel) SetTags(v []int64)` + +SetTags sets Tags field to given value. + +### HasTags + +`func (o *ReplaceSettingModel) HasTags() bool` + +HasTags returns a boolean if a field has been set. + +### SetTagsNil + +`func (o *ReplaceSettingModel) SetTagsNil(b bool)` + + SetTagsNil sets the value for Tags to be an explicit nil + +### UnsetTags +`func (o *ReplaceSettingModel) UnsetTags()` + +UnsetTags ensures that no value is present for Tags, not even an explicit nil +### GetOrder + +`func (o *ReplaceSettingModel) GetOrder() int32` + +GetOrder returns the Order field if non-nil, zero value otherwise. + +### GetOrderOk + +`func (o *ReplaceSettingModel) GetOrderOk() (*int32, bool)` + +GetOrderOk returns a tuple with the Order field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetOrder + +`func (o *ReplaceSettingModel) SetOrder(v int32)` + +SetOrder sets Order field to given value. + +### HasOrder + +`func (o *ReplaceSettingModel) HasOrder() bool` + +HasOrder returns a boolean if a field has been set. + +### SetOrderNil + +`func (o *ReplaceSettingModel) SetOrderNil(b bool)` + + SetOrderNil sets the value for Order to be an explicit nil + +### UnsetOrder +`func (o *ReplaceSettingModel) UnsetOrder()` + +UnsetOrder ensures that no value is present for Order, not even an explicit nil +### GetName + +`func (o *ReplaceSettingModel) GetName() string` + +GetName returns the Name field if non-nil, zero value otherwise. + +### GetNameOk + +`func (o *ReplaceSettingModel) GetNameOk() (*string, bool)` + +GetNameOk returns a tuple with the Name field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetName + +`func (o *ReplaceSettingModel) SetName(v string)` + +SetName sets Name field to given value. + + + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/WebHookRequest.md b/docs/WebHookRequest.md new file mode 100644 index 0000000..b6edba3 --- /dev/null +++ b/docs/WebHookRequest.md @@ -0,0 +1,149 @@ +# WebHookRequest + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Url** | **string** | The URL of the Webhook. | +**Content** | Pointer to **NullableString** | The HTTP body content. | [optional] +**HttpMethod** | Pointer to [**WebHookHttpMethod**](WebHookHttpMethod.md) | | [optional] +**WebHookHeaders** | Pointer to [**[]WebhookHeaderModel**](WebhookHeaderModel.md) | List of HTTP headers. | [optional] + +## Methods + +### NewWebHookRequest + +`func NewWebHookRequest(url string, ) *WebHookRequest` + +NewWebHookRequest instantiates a new WebHookRequest 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 + +### NewWebHookRequestWithDefaults + +`func NewWebHookRequestWithDefaults() *WebHookRequest` + +NewWebHookRequestWithDefaults instantiates a new WebHookRequest 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 + +### GetUrl + +`func (o *WebHookRequest) GetUrl() string` + +GetUrl returns the Url field if non-nil, zero value otherwise. + +### GetUrlOk + +`func (o *WebHookRequest) GetUrlOk() (*string, bool)` + +GetUrlOk returns a tuple with the Url field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetUrl + +`func (o *WebHookRequest) SetUrl(v string)` + +SetUrl sets Url field to given value. + + +### GetContent + +`func (o *WebHookRequest) GetContent() string` + +GetContent returns the Content field if non-nil, zero value otherwise. + +### GetContentOk + +`func (o *WebHookRequest) GetContentOk() (*string, bool)` + +GetContentOk returns a tuple with the Content field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetContent + +`func (o *WebHookRequest) SetContent(v string)` + +SetContent sets Content field to given value. + +### HasContent + +`func (o *WebHookRequest) HasContent() bool` + +HasContent returns a boolean if a field has been set. + +### SetContentNil + +`func (o *WebHookRequest) SetContentNil(b bool)` + + SetContentNil sets the value for Content to be an explicit nil + +### UnsetContent +`func (o *WebHookRequest) UnsetContent()` + +UnsetContent ensures that no value is present for Content, not even an explicit nil +### GetHttpMethod + +`func (o *WebHookRequest) GetHttpMethod() WebHookHttpMethod` + +GetHttpMethod returns the HttpMethod field if non-nil, zero value otherwise. + +### GetHttpMethodOk + +`func (o *WebHookRequest) GetHttpMethodOk() (*WebHookHttpMethod, bool)` + +GetHttpMethodOk returns a tuple with the HttpMethod field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetHttpMethod + +`func (o *WebHookRequest) SetHttpMethod(v WebHookHttpMethod)` + +SetHttpMethod sets HttpMethod field to given value. + +### HasHttpMethod + +`func (o *WebHookRequest) HasHttpMethod() bool` + +HasHttpMethod returns a boolean if a field has been set. + +### GetWebHookHeaders + +`func (o *WebHookRequest) GetWebHookHeaders() []WebhookHeaderModel` + +GetWebHookHeaders returns the WebHookHeaders field if non-nil, zero value otherwise. + +### GetWebHookHeadersOk + +`func (o *WebHookRequest) GetWebHookHeadersOk() (*[]WebhookHeaderModel, bool)` + +GetWebHookHeadersOk returns a tuple with the WebHookHeaders field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetWebHookHeaders + +`func (o *WebHookRequest) SetWebHookHeaders(v []WebhookHeaderModel)` + +SetWebHookHeaders sets WebHookHeaders field to given value. + +### HasWebHookHeaders + +`func (o *WebHookRequest) HasWebHookHeaders() bool` + +HasWebHookHeaders returns a boolean if a field has been set. + +### SetWebHookHeadersNil + +`func (o *WebHookRequest) SetWebHookHeadersNil(b bool)` + + SetWebHookHeadersNil sets the value for WebHookHeaders to be an explicit nil + +### UnsetWebHookHeaders +`func (o *WebHookRequest) UnsetWebHookHeaders()` + +UnsetWebHookHeaders ensures that no value is present for WebHookHeaders, not even an explicit nil + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/WebhookConfig.md b/docs/WebhookConfig.md new file mode 100644 index 0000000..0090f31 --- /dev/null +++ b/docs/WebhookConfig.md @@ -0,0 +1,92 @@ +# WebhookConfig + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Name** | Pointer to **NullableString** | The Config's name. | [optional] +**ConfigId** | Pointer to **string** | The Config's identifier. | [optional] + +## Methods + +### NewWebhookConfig + +`func NewWebhookConfig() *WebhookConfig` + +NewWebhookConfig instantiates a new WebhookConfig 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 + +### NewWebhookConfigWithDefaults + +`func NewWebhookConfigWithDefaults() *WebhookConfig` + +NewWebhookConfigWithDefaults instantiates a new WebhookConfig 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 + +### GetName + +`func (o *WebhookConfig) GetName() string` + +GetName returns the Name field if non-nil, zero value otherwise. + +### GetNameOk + +`func (o *WebhookConfig) GetNameOk() (*string, bool)` + +GetNameOk returns a tuple with the Name field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetName + +`func (o *WebhookConfig) SetName(v string)` + +SetName sets Name field to given value. + +### HasName + +`func (o *WebhookConfig) HasName() bool` + +HasName returns a boolean if a field has been set. + +### SetNameNil + +`func (o *WebhookConfig) SetNameNil(b bool)` + + SetNameNil sets the value for Name to be an explicit nil + +### UnsetName +`func (o *WebhookConfig) UnsetName()` + +UnsetName ensures that no value is present for Name, not even an explicit nil +### GetConfigId + +`func (o *WebhookConfig) GetConfigId() string` + +GetConfigId returns the ConfigId field if non-nil, zero value otherwise. + +### GetConfigIdOk + +`func (o *WebhookConfig) GetConfigIdOk() (*string, bool)` + +GetConfigIdOk returns a tuple with the ConfigId field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetConfigId + +`func (o *WebhookConfig) SetConfigId(v string)` + +SetConfigId sets ConfigId field to given value. + +### HasConfigId + +`func (o *WebhookConfig) HasConfigId() bool` + +HasConfigId returns a boolean if a field has been set. + + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/WebhookEnvironment.md b/docs/WebhookEnvironment.md new file mode 100644 index 0000000..d88a65e --- /dev/null +++ b/docs/WebhookEnvironment.md @@ -0,0 +1,92 @@ +# WebhookEnvironment + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Name** | Pointer to **NullableString** | The Environment's name. | [optional] +**EnvironmentId** | Pointer to **string** | The Environment's identifier. | [optional] + +## Methods + +### NewWebhookEnvironment + +`func NewWebhookEnvironment() *WebhookEnvironment` + +NewWebhookEnvironment instantiates a new WebhookEnvironment 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 + +### NewWebhookEnvironmentWithDefaults + +`func NewWebhookEnvironmentWithDefaults() *WebhookEnvironment` + +NewWebhookEnvironmentWithDefaults instantiates a new WebhookEnvironment 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 + +### GetName + +`func (o *WebhookEnvironment) GetName() string` + +GetName returns the Name field if non-nil, zero value otherwise. + +### GetNameOk + +`func (o *WebhookEnvironment) GetNameOk() (*string, bool)` + +GetNameOk returns a tuple with the Name field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetName + +`func (o *WebhookEnvironment) SetName(v string)` + +SetName sets Name field to given value. + +### HasName + +`func (o *WebhookEnvironment) HasName() bool` + +HasName returns a boolean if a field has been set. + +### SetNameNil + +`func (o *WebhookEnvironment) SetNameNil(b bool)` + + SetNameNil sets the value for Name to be an explicit nil + +### UnsetName +`func (o *WebhookEnvironment) UnsetName()` + +UnsetName ensures that no value is present for Name, not even an explicit nil +### GetEnvironmentId + +`func (o *WebhookEnvironment) GetEnvironmentId() string` + +GetEnvironmentId returns the EnvironmentId field if non-nil, zero value otherwise. + +### GetEnvironmentIdOk + +`func (o *WebhookEnvironment) GetEnvironmentIdOk() (*string, bool)` + +GetEnvironmentIdOk returns a tuple with the EnvironmentId field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetEnvironmentId + +`func (o *WebhookEnvironment) SetEnvironmentId(v string)` + +SetEnvironmentId sets EnvironmentId field to given value. + +### HasEnvironmentId + +`func (o *WebhookEnvironment) HasEnvironmentId() bool` + +HasEnvironmentId returns a boolean if a field has been set. + + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/WebhookModel.md b/docs/WebhookModel.md index 3b18359..d28ab2b 100644 --- a/docs/WebhookModel.md +++ b/docs/WebhookModel.md @@ -9,8 +9,8 @@ Name | Type | Description | Notes **HttpMethod** | Pointer to [**WebHookHttpMethod**](WebHookHttpMethod.md) | | [optional] **Content** | Pointer to **NullableString** | The HTTP body content. | [optional] **WebHookHeaders** | Pointer to [**[]WebhookHeaderModel**](WebhookHeaderModel.md) | List of HTTP headers that the Webhook must send. | [optional] -**ConfigName** | Pointer to **NullableString** | The Config's name where the applied changes will invoke the Webhook. | [optional] -**EnvironmentName** | Pointer to **NullableString** | The Environment's name where the applied changes will invoke the Webhook. | [optional] +**Config** | Pointer to [**WebhookConfig**](WebhookConfig.md) | | [optional] +**Environment** | Pointer to [**WebhookEnvironment**](WebhookEnvironment.md) | | [optional] ## Methods @@ -186,76 +186,56 @@ HasWebHookHeaders returns a boolean if a field has been set. `func (o *WebhookModel) UnsetWebHookHeaders()` UnsetWebHookHeaders ensures that no value is present for WebHookHeaders, not even an explicit nil -### GetConfigName +### GetConfig -`func (o *WebhookModel) GetConfigName() string` +`func (o *WebhookModel) GetConfig() WebhookConfig` -GetConfigName returns the ConfigName field if non-nil, zero value otherwise. +GetConfig returns the Config field if non-nil, zero value otherwise. -### GetConfigNameOk +### GetConfigOk -`func (o *WebhookModel) GetConfigNameOk() (*string, bool)` +`func (o *WebhookModel) GetConfigOk() (*WebhookConfig, bool)` -GetConfigNameOk returns a tuple with the ConfigName field if it's non-nil, zero value otherwise +GetConfigOk returns a tuple with the Config field if it's non-nil, zero value otherwise and a boolean to check if the value has been set. -### SetConfigName +### SetConfig -`func (o *WebhookModel) SetConfigName(v string)` +`func (o *WebhookModel) SetConfig(v WebhookConfig)` -SetConfigName sets ConfigName field to given value. +SetConfig sets Config field to given value. -### HasConfigName +### HasConfig -`func (o *WebhookModel) HasConfigName() bool` +`func (o *WebhookModel) HasConfig() bool` -HasConfigName returns a boolean if a field has been set. +HasConfig returns a boolean if a field has been set. -### SetConfigNameNil +### GetEnvironment -`func (o *WebhookModel) SetConfigNameNil(b bool)` +`func (o *WebhookModel) GetEnvironment() WebhookEnvironment` - SetConfigNameNil sets the value for ConfigName to be an explicit nil +GetEnvironment returns the Environment field if non-nil, zero value otherwise. -### UnsetConfigName -`func (o *WebhookModel) UnsetConfigName()` +### GetEnvironmentOk -UnsetConfigName ensures that no value is present for ConfigName, not even an explicit nil -### GetEnvironmentName +`func (o *WebhookModel) GetEnvironmentOk() (*WebhookEnvironment, bool)` -`func (o *WebhookModel) GetEnvironmentName() string` - -GetEnvironmentName returns the EnvironmentName field if non-nil, zero value otherwise. - -### GetEnvironmentNameOk - -`func (o *WebhookModel) GetEnvironmentNameOk() (*string, bool)` - -GetEnvironmentNameOk returns a tuple with the EnvironmentName field if it's non-nil, zero value otherwise +GetEnvironmentOk returns a tuple with the Environment field if it's non-nil, zero value otherwise and a boolean to check if the value has been set. -### SetEnvironmentName - -`func (o *WebhookModel) SetEnvironmentName(v string)` - -SetEnvironmentName sets EnvironmentName field to given value. - -### HasEnvironmentName - -`func (o *WebhookModel) HasEnvironmentName() bool` +### SetEnvironment -HasEnvironmentName returns a boolean if a field has been set. +`func (o *WebhookModel) SetEnvironment(v WebhookEnvironment)` -### SetEnvironmentNameNil +SetEnvironment sets Environment field to given value. -`func (o *WebhookModel) SetEnvironmentNameNil(b bool)` +### HasEnvironment - SetEnvironmentNameNil sets the value for EnvironmentName to be an explicit nil +`func (o *WebhookModel) HasEnvironment() bool` -### UnsetEnvironmentName -`func (o *WebhookModel) UnsetEnvironmentName()` +HasEnvironment returns a boolean if a field has been set. -UnsetEnvironmentName ensures that no value is present for EnvironmentName, not even an explicit nil [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/docs/WebhooksApi.md b/docs/WebhooksApi.md index f5cc3dc..f43b73c 100644 --- a/docs/WebhooksApi.md +++ b/docs/WebhooksApi.md @@ -9,13 +9,14 @@ Method | HTTP request | Description [**GetWebhook**](WebhooksApi.md#GetWebhook) | **Get** /v1/webhooks/{webhookId} | Get Webhook [**GetWebhookSigningKeys**](WebhooksApi.md#GetWebhookSigningKeys) | **Get** /v1/webhooks/{webhookId}/keys | Get Webhook Signing Keys [**GetWebhooks**](WebhooksApi.md#GetWebhooks) | **Get** /v1/products/{productId}/webhooks | List Webhooks +[**ReplaceWebhook**](WebhooksApi.md#ReplaceWebhook) | **Put** /v1/webhooks/{webhookId} | Replace Webhook [**UpdateWebhook**](WebhooksApi.md#UpdateWebhook) | **Patch** /v1/webhooks/{webhookId} | Update Webhook ## CreateWebhook -> WebhookModel CreateWebhook(ctx, configId, environmentId).CreateWebHookRequest(createWebHookRequest).Execute() +> WebhookModel CreateWebhook(ctx, configId, environmentId).WebHookRequest(webHookRequest).Execute() Create Webhook @@ -36,11 +37,11 @@ import ( func main() { configId := "38400000-8cf0-11bd-b23e-10b96e4ef00d" // string | The identifier of the Config. environmentId := "38400000-8cf0-11bd-b23e-10b96e4ef00d" // string | The identifier of the Environment. - createWebHookRequest := *openapiclient.NewCreateWebHookRequest("Url_example") // CreateWebHookRequest | + webHookRequest := *openapiclient.NewWebHookRequest("Url_example") // WebHookRequest | configuration := openapiclient.NewConfiguration() apiClient := openapiclient.NewAPIClient(configuration) - resp, r, err := apiClient.WebhooksApi.CreateWebhook(context.Background(), configId, environmentId).CreateWebHookRequest(createWebHookRequest).Execute() + resp, r, err := apiClient.WebhooksApi.CreateWebhook(context.Background(), configId, environmentId).WebHookRequest(webHookRequest).Execute() if err != nil { fmt.Fprintf(os.Stderr, "Error when calling `WebhooksApi.CreateWebhook``: %v\n", err) fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) @@ -68,7 +69,7 @@ Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **createWebHookRequest** | [**CreateWebHookRequest**](CreateWebHookRequest.md) | | + **webHookRequest** | [**WebHookRequest**](WebHookRequest.md) | | ### Return type @@ -366,6 +367,78 @@ Name | Type | Description | Notes [[Back to README]](../README.md) +## ReplaceWebhook + +> WebhookModel ReplaceWebhook(ctx, webhookId).WebHookRequest(webHookRequest).Execute() + +Replace Webhook + + + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "github.com/configcat/configcat-publicapi-go-client" +) + +func main() { + webhookId := int32(56) // int32 | The identifier of the Webhook. + webHookRequest := *openapiclient.NewWebHookRequest("Url_example") // WebHookRequest | + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.WebhooksApi.ReplaceWebhook(context.Background(), webhookId).WebHookRequest(webHookRequest).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `WebhooksApi.ReplaceWebhook``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `ReplaceWebhook`: WebhookModel + fmt.Fprintf(os.Stdout, "Response from `WebhooksApi.ReplaceWebhook`: %v\n", resp) +} +``` + +### Path Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**webhookId** | **int32** | The identifier of the Webhook. | + +### Other Parameters + +Other parameters are passed through a pointer to a apiReplaceWebhookRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + + **webHookRequest** | [**WebHookRequest**](WebHookRequest.md) | | + +### Return type + +[**WebhookModel**](WebhookModel.md) + +### Authorization + +[Basic](../README.md#Basic) + +### HTTP request headers + +- **Content-Type**: application/json, text/json, application/*+json +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + ## UpdateWebhook > WebhookModel UpdateWebhook(ctx, webhookId).JsonPatchOperation(jsonPatchOperation).Execute() diff --git a/model_replace_setting_model.go b/model_replace_setting_model.go new file mode 100644 index 0000000..57e8981 --- /dev/null +++ b/model_replace_setting_model.go @@ -0,0 +1,251 @@ +/* +ConfigCat Public Management API + +The purpose of this API is to access the ConfigCat platform programmatically. You can **Create**, **Read**, **Update** and **Delete** any entities like **Feature Flags, Configs, Environments** or **Products** within ConfigCat. **Base API URL**: https://test-api.configcat.com If you prefer the swagger documentation, you can find it here: [Swagger UI](https://test-api.configcat.com/swagger). The API is based on HTTP REST, uses resource-oriented URLs, status codes and supports JSON format. Do not use this API for accessing and evaluating feature flag values. Use the [SDKs instead](https://configcat.com/docs/sdk-reference/overview). # OpenAPI Specification The complete specification is publicly available in the following formats: - [OpenAPI v3](https://test-api.configcat.com/docs/v1/swagger.json) - [Swagger v2](https://test-api.configcat.com/docs/v1/swagger.v2.json) You can use it to generate client libraries in various languages with [OpenAPI Generator](https://github.com/OpenAPITools/openapi-generator) or [Swagger Codegen](https://swagger.io/tools/swagger-codegen/) to interact with this API. # Authentication This API uses the [Basic HTTP Authentication Scheme](https://en.wikipedia.org/wiki/Basic_access_authentication). # Throttling and rate limits All the rate limited API calls are returning information about the current rate limit period in the following HTTP headers: | Header | Description | | :- | :- | | X-Rate-Limit-Remaining | The maximum number of requests remaining in the current rate limit period. | | X-Rate-Limit-Reset | The time when the current rate limit period resets. | When the rate limit is exceeded by a request, the API returns with a `HTTP 429 - Too many requests` status along with a `Retry-After` HTTP header. + +API version: v1 +Contact: support@configcat.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package configcatpublicapi + +import ( + "encoding/json" +) + +// checks if the ReplaceSettingModel type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ReplaceSettingModel{} + +// ReplaceSettingModel struct for ReplaceSettingModel +type ReplaceSettingModel struct { + // A short description for the setting, shown on the Dashboard UI. + Hint NullableString `json:"hint,omitempty"` + // The IDs of the tags which are attached to the setting. + Tags []int64 `json:"tags,omitempty"` + // The order of the Setting represented on the ConfigCat Dashboard. Determined from an ascending sequence of integers. + Order NullableInt32 `json:"order,omitempty"` + // The name of the Feature Flag or Setting. + Name string `json:"name"` +} + +// NewReplaceSettingModel instantiates a new ReplaceSettingModel 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 NewReplaceSettingModel(name string) *ReplaceSettingModel { + this := ReplaceSettingModel{} + this.Name = name + return &this +} + +// NewReplaceSettingModelWithDefaults instantiates a new ReplaceSettingModel 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 NewReplaceSettingModelWithDefaults() *ReplaceSettingModel { + this := ReplaceSettingModel{} + return &this +} + +// GetHint returns the Hint field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *ReplaceSettingModel) GetHint() string { + if o == nil || IsNil(o.Hint.Get()) { + var ret string + return ret + } + return *o.Hint.Get() +} + +// GetHintOk returns a tuple with the Hint field value if set, nil otherwise +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *ReplaceSettingModel) GetHintOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Hint.Get(), o.Hint.IsSet() +} + +// HasHint returns a boolean if a field has been set. +func (o *ReplaceSettingModel) HasHint() bool { + if o != nil && o.Hint.IsSet() { + return true + } + + return false +} + +// SetHint gets a reference to the given NullableString and assigns it to the Hint field. +func (o *ReplaceSettingModel) SetHint(v string) { + o.Hint.Set(&v) +} +// SetHintNil sets the value for Hint to be an explicit nil +func (o *ReplaceSettingModel) SetHintNil() { + o.Hint.Set(nil) +} + +// UnsetHint ensures that no value is present for Hint, not even an explicit nil +func (o *ReplaceSettingModel) UnsetHint() { + o.Hint.Unset() +} + +// GetTags returns the Tags field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *ReplaceSettingModel) GetTags() []int64 { + if o == nil { + var ret []int64 + return ret + } + return o.Tags +} + +// GetTagsOk returns a tuple with the Tags field value if set, nil otherwise +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *ReplaceSettingModel) GetTagsOk() ([]int64, bool) { + if o == nil || IsNil(o.Tags) { + return nil, false + } + return o.Tags, true +} + +// HasTags returns a boolean if a field has been set. +func (o *ReplaceSettingModel) HasTags() bool { + if o != nil && IsNil(o.Tags) { + return true + } + + return false +} + +// SetTags gets a reference to the given []int64 and assigns it to the Tags field. +func (o *ReplaceSettingModel) SetTags(v []int64) { + o.Tags = v +} + +// GetOrder returns the Order field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *ReplaceSettingModel) GetOrder() int32 { + if o == nil || IsNil(o.Order.Get()) { + var ret int32 + return ret + } + return *o.Order.Get() +} + +// GetOrderOk returns a tuple with the Order field value if set, nil otherwise +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *ReplaceSettingModel) GetOrderOk() (*int32, bool) { + if o == nil { + return nil, false + } + return o.Order.Get(), o.Order.IsSet() +} + +// HasOrder returns a boolean if a field has been set. +func (o *ReplaceSettingModel) HasOrder() bool { + if o != nil && o.Order.IsSet() { + return true + } + + return false +} + +// SetOrder gets a reference to the given NullableInt32 and assigns it to the Order field. +func (o *ReplaceSettingModel) SetOrder(v int32) { + o.Order.Set(&v) +} +// SetOrderNil sets the value for Order to be an explicit nil +func (o *ReplaceSettingModel) SetOrderNil() { + o.Order.Set(nil) +} + +// UnsetOrder ensures that no value is present for Order, not even an explicit nil +func (o *ReplaceSettingModel) UnsetOrder() { + o.Order.Unset() +} + +// GetName returns the Name field value +func (o *ReplaceSettingModel) GetName() string { + if o == nil { + 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 *ReplaceSettingModel) GetNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Name, true +} + +// SetName sets field value +func (o *ReplaceSettingModel) SetName(v string) { + o.Name = v +} + +func (o ReplaceSettingModel) MarshalJSON() ([]byte, error) { + toSerialize,err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o ReplaceSettingModel) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if o.Hint.IsSet() { + toSerialize["hint"] = o.Hint.Get() + } + if o.Tags != nil { + toSerialize["tags"] = o.Tags + } + if o.Order.IsSet() { + toSerialize["order"] = o.Order.Get() + } + toSerialize["name"] = o.Name + return toSerialize, nil +} + +type NullableReplaceSettingModel struct { + value *ReplaceSettingModel + isSet bool +} + +func (v NullableReplaceSettingModel) Get() *ReplaceSettingModel { + return v.value +} + +func (v *NullableReplaceSettingModel) Set(val *ReplaceSettingModel) { + v.value = val + v.isSet = true +} + +func (v NullableReplaceSettingModel) IsSet() bool { + return v.isSet +} + +func (v *NullableReplaceSettingModel) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableReplaceSettingModel(val *ReplaceSettingModel) *NullableReplaceSettingModel { + return &NullableReplaceSettingModel{value: val, isSet: true} +} + +func (v NullableReplaceSettingModel) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableReplaceSettingModel) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/model_web_hook_request.go b/model_web_hook_request.go new file mode 100644 index 0000000..24f45bc --- /dev/null +++ b/model_web_hook_request.go @@ -0,0 +1,240 @@ +/* +ConfigCat Public Management API + +The purpose of this API is to access the ConfigCat platform programmatically. You can **Create**, **Read**, **Update** and **Delete** any entities like **Feature Flags, Configs, Environments** or **Products** within ConfigCat. **Base API URL**: https://test-api.configcat.com If you prefer the swagger documentation, you can find it here: [Swagger UI](https://test-api.configcat.com/swagger). The API is based on HTTP REST, uses resource-oriented URLs, status codes and supports JSON format. Do not use this API for accessing and evaluating feature flag values. Use the [SDKs instead](https://configcat.com/docs/sdk-reference/overview). # OpenAPI Specification The complete specification is publicly available in the following formats: - [OpenAPI v3](https://test-api.configcat.com/docs/v1/swagger.json) - [Swagger v2](https://test-api.configcat.com/docs/v1/swagger.v2.json) You can use it to generate client libraries in various languages with [OpenAPI Generator](https://github.com/OpenAPITools/openapi-generator) or [Swagger Codegen](https://swagger.io/tools/swagger-codegen/) to interact with this API. # Authentication This API uses the [Basic HTTP Authentication Scheme](https://en.wikipedia.org/wiki/Basic_access_authentication). # Throttling and rate limits All the rate limited API calls are returning information about the current rate limit period in the following HTTP headers: | Header | Description | | :- | :- | | X-Rate-Limit-Remaining | The maximum number of requests remaining in the current rate limit period. | | X-Rate-Limit-Reset | The time when the current rate limit period resets. | When the rate limit is exceeded by a request, the API returns with a `HTTP 429 - Too many requests` status along with a `Retry-After` HTTP header. + +API version: v1 +Contact: support@configcat.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package configcatpublicapi + +import ( + "encoding/json" +) + +// checks if the WebHookRequest type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &WebHookRequest{} + +// WebHookRequest struct for WebHookRequest +type WebHookRequest struct { + // The URL of the Webhook. + Url string `json:"url"` + // The HTTP body content. + Content NullableString `json:"content,omitempty"` + HttpMethod *WebHookHttpMethod `json:"httpMethod,omitempty"` + // List of HTTP headers. + WebHookHeaders []WebhookHeaderModel `json:"webHookHeaders,omitempty"` +} + +// NewWebHookRequest instantiates a new WebHookRequest 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 NewWebHookRequest(url string) *WebHookRequest { + this := WebHookRequest{} + this.Url = url + return &this +} + +// NewWebHookRequestWithDefaults instantiates a new WebHookRequest 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 NewWebHookRequestWithDefaults() *WebHookRequest { + this := WebHookRequest{} + return &this +} + +// GetUrl returns the Url field value +func (o *WebHookRequest) GetUrl() string { + if o == nil { + 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 *WebHookRequest) GetUrlOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Url, true +} + +// SetUrl sets field value +func (o *WebHookRequest) SetUrl(v string) { + o.Url = v +} + +// GetContent returns the Content field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *WebHookRequest) GetContent() string { + if o == nil || IsNil(o.Content.Get()) { + var ret string + return ret + } + return *o.Content.Get() +} + +// GetContentOk returns a tuple with the Content field value if set, nil otherwise +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *WebHookRequest) GetContentOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Content.Get(), o.Content.IsSet() +} + +// HasContent returns a boolean if a field has been set. +func (o *WebHookRequest) HasContent() bool { + if o != nil && o.Content.IsSet() { + return true + } + + return false +} + +// SetContent gets a reference to the given NullableString and assigns it to the Content field. +func (o *WebHookRequest) SetContent(v string) { + o.Content.Set(&v) +} +// SetContentNil sets the value for Content to be an explicit nil +func (o *WebHookRequest) SetContentNil() { + o.Content.Set(nil) +} + +// UnsetContent ensures that no value is present for Content, not even an explicit nil +func (o *WebHookRequest) UnsetContent() { + o.Content.Unset() +} + +// GetHttpMethod returns the HttpMethod field value if set, zero value otherwise. +func (o *WebHookRequest) GetHttpMethod() WebHookHttpMethod { + if o == nil || IsNil(o.HttpMethod) { + var ret WebHookHttpMethod + return ret + } + return *o.HttpMethod +} + +// GetHttpMethodOk returns a tuple with the HttpMethod field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *WebHookRequest) GetHttpMethodOk() (*WebHookHttpMethod, bool) { + if o == nil || IsNil(o.HttpMethod) { + return nil, false + } + return o.HttpMethod, true +} + +// HasHttpMethod returns a boolean if a field has been set. +func (o *WebHookRequest) HasHttpMethod() bool { + if o != nil && !IsNil(o.HttpMethod) { + return true + } + + return false +} + +// SetHttpMethod gets a reference to the given WebHookHttpMethod and assigns it to the HttpMethod field. +func (o *WebHookRequest) SetHttpMethod(v WebHookHttpMethod) { + o.HttpMethod = &v +} + +// GetWebHookHeaders returns the WebHookHeaders field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *WebHookRequest) GetWebHookHeaders() []WebhookHeaderModel { + if o == nil { + var ret []WebhookHeaderModel + return ret + } + return o.WebHookHeaders +} + +// GetWebHookHeadersOk returns a tuple with the WebHookHeaders field value if set, nil otherwise +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *WebHookRequest) GetWebHookHeadersOk() ([]WebhookHeaderModel, bool) { + if o == nil || IsNil(o.WebHookHeaders) { + return nil, false + } + return o.WebHookHeaders, true +} + +// HasWebHookHeaders returns a boolean if a field has been set. +func (o *WebHookRequest) HasWebHookHeaders() bool { + if o != nil && IsNil(o.WebHookHeaders) { + return true + } + + return false +} + +// SetWebHookHeaders gets a reference to the given []WebhookHeaderModel and assigns it to the WebHookHeaders field. +func (o *WebHookRequest) SetWebHookHeaders(v []WebhookHeaderModel) { + o.WebHookHeaders = v +} + +func (o WebHookRequest) MarshalJSON() ([]byte, error) { + toSerialize,err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o WebHookRequest) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["url"] = o.Url + if o.Content.IsSet() { + toSerialize["content"] = o.Content.Get() + } + if !IsNil(o.HttpMethod) { + toSerialize["httpMethod"] = o.HttpMethod + } + if o.WebHookHeaders != nil { + toSerialize["webHookHeaders"] = o.WebHookHeaders + } + return toSerialize, nil +} + +type NullableWebHookRequest struct { + value *WebHookRequest + isSet bool +} + +func (v NullableWebHookRequest) Get() *WebHookRequest { + return v.value +} + +func (v *NullableWebHookRequest) Set(val *WebHookRequest) { + v.value = val + v.isSet = true +} + +func (v NullableWebHookRequest) IsSet() bool { + return v.isSet +} + +func (v *NullableWebHookRequest) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableWebHookRequest(val *WebHookRequest) *NullableWebHookRequest { + return &NullableWebHookRequest{value: val, isSet: true} +} + +func (v NullableWebHookRequest) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableWebHookRequest) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/model_webhook_config.go b/model_webhook_config.go new file mode 100644 index 0000000..b4abe04 --- /dev/null +++ b/model_webhook_config.go @@ -0,0 +1,175 @@ +/* +ConfigCat Public Management API + +The purpose of this API is to access the ConfigCat platform programmatically. You can **Create**, **Read**, **Update** and **Delete** any entities like **Feature Flags, Configs, Environments** or **Products** within ConfigCat. **Base API URL**: https://test-api.configcat.com If you prefer the swagger documentation, you can find it here: [Swagger UI](https://test-api.configcat.com/swagger). The API is based on HTTP REST, uses resource-oriented URLs, status codes and supports JSON format. Do not use this API for accessing and evaluating feature flag values. Use the [SDKs instead](https://configcat.com/docs/sdk-reference/overview). # OpenAPI Specification The complete specification is publicly available in the following formats: - [OpenAPI v3](https://test-api.configcat.com/docs/v1/swagger.json) - [Swagger v2](https://test-api.configcat.com/docs/v1/swagger.v2.json) You can use it to generate client libraries in various languages with [OpenAPI Generator](https://github.com/OpenAPITools/openapi-generator) or [Swagger Codegen](https://swagger.io/tools/swagger-codegen/) to interact with this API. # Authentication This API uses the [Basic HTTP Authentication Scheme](https://en.wikipedia.org/wiki/Basic_access_authentication). # Throttling and rate limits All the rate limited API calls are returning information about the current rate limit period in the following HTTP headers: | Header | Description | | :- | :- | | X-Rate-Limit-Remaining | The maximum number of requests remaining in the current rate limit period. | | X-Rate-Limit-Reset | The time when the current rate limit period resets. | When the rate limit is exceeded by a request, the API returns with a `HTTP 429 - Too many requests` status along with a `Retry-After` HTTP header. + +API version: v1 +Contact: support@configcat.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package configcatpublicapi + +import ( + "encoding/json" +) + +// checks if the WebhookConfig type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &WebhookConfig{} + +// WebhookConfig The Config where the applied changes will invoke the Webhook. +type WebhookConfig struct { + // The Config's name. + Name NullableString `json:"name,omitempty"` + // The Config's identifier. + ConfigId *string `json:"configId,omitempty"` +} + +// NewWebhookConfig instantiates a new WebhookConfig 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 NewWebhookConfig() *WebhookConfig { + this := WebhookConfig{} + return &this +} + +// NewWebhookConfigWithDefaults instantiates a new WebhookConfig 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 NewWebhookConfigWithDefaults() *WebhookConfig { + this := WebhookConfig{} + return &this +} + +// GetName returns the Name field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *WebhookConfig) GetName() string { + if o == nil || IsNil(o.Name.Get()) { + var ret string + return ret + } + return *o.Name.Get() +} + +// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *WebhookConfig) GetNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Name.Get(), o.Name.IsSet() +} + +// HasName returns a boolean if a field has been set. +func (o *WebhookConfig) HasName() bool { + if o != nil && o.Name.IsSet() { + return true + } + + return false +} + +// SetName gets a reference to the given NullableString and assigns it to the Name field. +func (o *WebhookConfig) SetName(v string) { + o.Name.Set(&v) +} +// SetNameNil sets the value for Name to be an explicit nil +func (o *WebhookConfig) SetNameNil() { + o.Name.Set(nil) +} + +// UnsetName ensures that no value is present for Name, not even an explicit nil +func (o *WebhookConfig) UnsetName() { + o.Name.Unset() +} + +// GetConfigId returns the ConfigId field value if set, zero value otherwise. +func (o *WebhookConfig) GetConfigId() string { + if o == nil || IsNil(o.ConfigId) { + var ret string + return ret + } + return *o.ConfigId +} + +// GetConfigIdOk returns a tuple with the ConfigId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *WebhookConfig) GetConfigIdOk() (*string, bool) { + if o == nil || IsNil(o.ConfigId) { + return nil, false + } + return o.ConfigId, true +} + +// HasConfigId returns a boolean if a field has been set. +func (o *WebhookConfig) HasConfigId() bool { + if o != nil && !IsNil(o.ConfigId) { + return true + } + + return false +} + +// SetConfigId gets a reference to the given string and assigns it to the ConfigId field. +func (o *WebhookConfig) SetConfigId(v string) { + o.ConfigId = &v +} + +func (o WebhookConfig) MarshalJSON() ([]byte, error) { + toSerialize,err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o WebhookConfig) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if o.Name.IsSet() { + toSerialize["name"] = o.Name.Get() + } + if !IsNil(o.ConfigId) { + toSerialize["configId"] = o.ConfigId + } + return toSerialize, nil +} + +type NullableWebhookConfig struct { + value *WebhookConfig + isSet bool +} + +func (v NullableWebhookConfig) Get() *WebhookConfig { + return v.value +} + +func (v *NullableWebhookConfig) Set(val *WebhookConfig) { + v.value = val + v.isSet = true +} + +func (v NullableWebhookConfig) IsSet() bool { + return v.isSet +} + +func (v *NullableWebhookConfig) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableWebhookConfig(val *WebhookConfig) *NullableWebhookConfig { + return &NullableWebhookConfig{value: val, isSet: true} +} + +func (v NullableWebhookConfig) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableWebhookConfig) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/model_webhook_environment.go b/model_webhook_environment.go new file mode 100644 index 0000000..42278d1 --- /dev/null +++ b/model_webhook_environment.go @@ -0,0 +1,175 @@ +/* +ConfigCat Public Management API + +The purpose of this API is to access the ConfigCat platform programmatically. You can **Create**, **Read**, **Update** and **Delete** any entities like **Feature Flags, Configs, Environments** or **Products** within ConfigCat. **Base API URL**: https://test-api.configcat.com If you prefer the swagger documentation, you can find it here: [Swagger UI](https://test-api.configcat.com/swagger). The API is based on HTTP REST, uses resource-oriented URLs, status codes and supports JSON format. Do not use this API for accessing and evaluating feature flag values. Use the [SDKs instead](https://configcat.com/docs/sdk-reference/overview). # OpenAPI Specification The complete specification is publicly available in the following formats: - [OpenAPI v3](https://test-api.configcat.com/docs/v1/swagger.json) - [Swagger v2](https://test-api.configcat.com/docs/v1/swagger.v2.json) You can use it to generate client libraries in various languages with [OpenAPI Generator](https://github.com/OpenAPITools/openapi-generator) or [Swagger Codegen](https://swagger.io/tools/swagger-codegen/) to interact with this API. # Authentication This API uses the [Basic HTTP Authentication Scheme](https://en.wikipedia.org/wiki/Basic_access_authentication). # Throttling and rate limits All the rate limited API calls are returning information about the current rate limit period in the following HTTP headers: | Header | Description | | :- | :- | | X-Rate-Limit-Remaining | The maximum number of requests remaining in the current rate limit period. | | X-Rate-Limit-Reset | The time when the current rate limit period resets. | When the rate limit is exceeded by a request, the API returns with a `HTTP 429 - Too many requests` status along with a `Retry-After` HTTP header. + +API version: v1 +Contact: support@configcat.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package configcatpublicapi + +import ( + "encoding/json" +) + +// checks if the WebhookEnvironment type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &WebhookEnvironment{} + +// WebhookEnvironment The Environment where the applied changes will invoke the Webhook. +type WebhookEnvironment struct { + // The Environment's name. + Name NullableString `json:"name,omitempty"` + // The Environment's identifier. + EnvironmentId *string `json:"environmentId,omitempty"` +} + +// NewWebhookEnvironment instantiates a new WebhookEnvironment 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 NewWebhookEnvironment() *WebhookEnvironment { + this := WebhookEnvironment{} + return &this +} + +// NewWebhookEnvironmentWithDefaults instantiates a new WebhookEnvironment 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 NewWebhookEnvironmentWithDefaults() *WebhookEnvironment { + this := WebhookEnvironment{} + return &this +} + +// GetName returns the Name field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *WebhookEnvironment) GetName() string { + if o == nil || IsNil(o.Name.Get()) { + var ret string + return ret + } + return *o.Name.Get() +} + +// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *WebhookEnvironment) GetNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Name.Get(), o.Name.IsSet() +} + +// HasName returns a boolean if a field has been set. +func (o *WebhookEnvironment) HasName() bool { + if o != nil && o.Name.IsSet() { + return true + } + + return false +} + +// SetName gets a reference to the given NullableString and assigns it to the Name field. +func (o *WebhookEnvironment) SetName(v string) { + o.Name.Set(&v) +} +// SetNameNil sets the value for Name to be an explicit nil +func (o *WebhookEnvironment) SetNameNil() { + o.Name.Set(nil) +} + +// UnsetName ensures that no value is present for Name, not even an explicit nil +func (o *WebhookEnvironment) UnsetName() { + o.Name.Unset() +} + +// GetEnvironmentId returns the EnvironmentId field value if set, zero value otherwise. +func (o *WebhookEnvironment) GetEnvironmentId() string { + if o == nil || IsNil(o.EnvironmentId) { + var ret string + return ret + } + return *o.EnvironmentId +} + +// GetEnvironmentIdOk returns a tuple with the EnvironmentId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *WebhookEnvironment) GetEnvironmentIdOk() (*string, bool) { + if o == nil || IsNil(o.EnvironmentId) { + return nil, false + } + return o.EnvironmentId, true +} + +// HasEnvironmentId returns a boolean if a field has been set. +func (o *WebhookEnvironment) HasEnvironmentId() bool { + if o != nil && !IsNil(o.EnvironmentId) { + return true + } + + return false +} + +// SetEnvironmentId gets a reference to the given string and assigns it to the EnvironmentId field. +func (o *WebhookEnvironment) SetEnvironmentId(v string) { + o.EnvironmentId = &v +} + +func (o WebhookEnvironment) MarshalJSON() ([]byte, error) { + toSerialize,err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o WebhookEnvironment) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if o.Name.IsSet() { + toSerialize["name"] = o.Name.Get() + } + if !IsNil(o.EnvironmentId) { + toSerialize["environmentId"] = o.EnvironmentId + } + return toSerialize, nil +} + +type NullableWebhookEnvironment struct { + value *WebhookEnvironment + isSet bool +} + +func (v NullableWebhookEnvironment) Get() *WebhookEnvironment { + return v.value +} + +func (v *NullableWebhookEnvironment) Set(val *WebhookEnvironment) { + v.value = val + v.isSet = true +} + +func (v NullableWebhookEnvironment) IsSet() bool { + return v.isSet +} + +func (v *NullableWebhookEnvironment) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableWebhookEnvironment(val *WebhookEnvironment) *NullableWebhookEnvironment { + return &NullableWebhookEnvironment{value: val, isSet: true} +} + +func (v NullableWebhookEnvironment) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableWebhookEnvironment) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/model_webhook_model.go b/model_webhook_model.go index c5a252d..2f6e10f 100644 --- a/model_webhook_model.go +++ b/model_webhook_model.go @@ -29,10 +29,8 @@ type WebhookModel struct { Content NullableString `json:"content,omitempty"` // List of HTTP headers that the Webhook must send. WebHookHeaders []WebhookHeaderModel `json:"webHookHeaders,omitempty"` - // The Config's name where the applied changes will invoke the Webhook. - ConfigName NullableString `json:"configName,omitempty"` - // The Environment's name where the applied changes will invoke the Webhook. - EnvironmentName NullableString `json:"environmentName,omitempty"` + Config *WebhookConfig `json:"config,omitempty"` + Environment *WebhookEnvironment `json:"environment,omitempty"` } // NewWebhookModel instantiates a new WebhookModel object @@ -233,88 +231,68 @@ func (o *WebhookModel) SetWebHookHeaders(v []WebhookHeaderModel) { o.WebHookHeaders = v } -// GetConfigName returns the ConfigName field value if set, zero value otherwise (both if not set or set to explicit null). -func (o *WebhookModel) GetConfigName() string { - if o == nil || IsNil(o.ConfigName.Get()) { - var ret string +// GetConfig returns the Config field value if set, zero value otherwise. +func (o *WebhookModel) GetConfig() WebhookConfig { + if o == nil || IsNil(o.Config) { + var ret WebhookConfig return ret } - return *o.ConfigName.Get() + return *o.Config } -// GetConfigNameOk returns a tuple with the ConfigName field value if set, nil otherwise +// GetConfigOk returns a tuple with the Config field value if set, nil otherwise // and a boolean to check if the value has been set. -// NOTE: If the value is an explicit nil, `nil, true` will be returned -func (o *WebhookModel) GetConfigNameOk() (*string, bool) { - if o == nil { +func (o *WebhookModel) GetConfigOk() (*WebhookConfig, bool) { + if o == nil || IsNil(o.Config) { return nil, false } - return o.ConfigName.Get(), o.ConfigName.IsSet() + return o.Config, true } -// HasConfigName returns a boolean if a field has been set. -func (o *WebhookModel) HasConfigName() bool { - if o != nil && o.ConfigName.IsSet() { +// HasConfig returns a boolean if a field has been set. +func (o *WebhookModel) HasConfig() bool { + if o != nil && !IsNil(o.Config) { return true } return false } -// SetConfigName gets a reference to the given NullableString and assigns it to the ConfigName field. -func (o *WebhookModel) SetConfigName(v string) { - o.ConfigName.Set(&v) -} -// SetConfigNameNil sets the value for ConfigName to be an explicit nil -func (o *WebhookModel) SetConfigNameNil() { - o.ConfigName.Set(nil) -} - -// UnsetConfigName ensures that no value is present for ConfigName, not even an explicit nil -func (o *WebhookModel) UnsetConfigName() { - o.ConfigName.Unset() +// SetConfig gets a reference to the given WebhookConfig and assigns it to the Config field. +func (o *WebhookModel) SetConfig(v WebhookConfig) { + o.Config = &v } -// GetEnvironmentName returns the EnvironmentName field value if set, zero value otherwise (both if not set or set to explicit null). -func (o *WebhookModel) GetEnvironmentName() string { - if o == nil || IsNil(o.EnvironmentName.Get()) { - var ret string +// GetEnvironment returns the Environment field value if set, zero value otherwise. +func (o *WebhookModel) GetEnvironment() WebhookEnvironment { + if o == nil || IsNil(o.Environment) { + var ret WebhookEnvironment return ret } - return *o.EnvironmentName.Get() + return *o.Environment } -// GetEnvironmentNameOk returns a tuple with the EnvironmentName field value if set, nil otherwise +// GetEnvironmentOk returns a tuple with the Environment field value if set, nil otherwise // and a boolean to check if the value has been set. -// NOTE: If the value is an explicit nil, `nil, true` will be returned -func (o *WebhookModel) GetEnvironmentNameOk() (*string, bool) { - if o == nil { +func (o *WebhookModel) GetEnvironmentOk() (*WebhookEnvironment, bool) { + if o == nil || IsNil(o.Environment) { return nil, false } - return o.EnvironmentName.Get(), o.EnvironmentName.IsSet() + return o.Environment, true } -// HasEnvironmentName returns a boolean if a field has been set. -func (o *WebhookModel) HasEnvironmentName() bool { - if o != nil && o.EnvironmentName.IsSet() { +// HasEnvironment returns a boolean if a field has been set. +func (o *WebhookModel) HasEnvironment() bool { + if o != nil && !IsNil(o.Environment) { return true } return false } -// SetEnvironmentName gets a reference to the given NullableString and assigns it to the EnvironmentName field. -func (o *WebhookModel) SetEnvironmentName(v string) { - o.EnvironmentName.Set(&v) -} -// SetEnvironmentNameNil sets the value for EnvironmentName to be an explicit nil -func (o *WebhookModel) SetEnvironmentNameNil() { - o.EnvironmentName.Set(nil) -} - -// UnsetEnvironmentName ensures that no value is present for EnvironmentName, not even an explicit nil -func (o *WebhookModel) UnsetEnvironmentName() { - o.EnvironmentName.Unset() +// SetEnvironment gets a reference to the given WebhookEnvironment and assigns it to the Environment field. +func (o *WebhookModel) SetEnvironment(v WebhookEnvironment) { + o.Environment = &v } func (o WebhookModel) MarshalJSON() ([]byte, error) { @@ -342,11 +320,11 @@ func (o WebhookModel) ToMap() (map[string]interface{}, error) { if o.WebHookHeaders != nil { toSerialize["webHookHeaders"] = o.WebHookHeaders } - if o.ConfigName.IsSet() { - toSerialize["configName"] = o.ConfigName.Get() + if !IsNil(o.Config) { + toSerialize["config"] = o.Config } - if o.EnvironmentName.IsSet() { - toSerialize["environmentName"] = o.EnvironmentName.Get() + if !IsNil(o.Environment) { + toSerialize["environment"] = o.Environment } return toSerialize, nil }