Categorygithub.com/configcat/configcat-publicapi-go-client

# README

Go API client for configcatpublicapi

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.

The API is based on HTTP REST, uses resource-oriented URLs, status codes and supports JSON format.

Important: Do not use this API for accessing and evaluating feature flag values. Use the SDKs or the ConfigCat Proxy instead.

OpenAPI Specification

The complete specification is publicly available in the following formats:

You can use it to generate client libraries in various languages with OpenAPI Generator or Swagger Codegen to interact with this API.

Authentication

This API uses the Basic HTTP Authentication Scheme.

Throttling and rate limits

All the rate limited API calls are returning information about the current rate limit period in the following HTTP headers:

HeaderDescription
X-Rate-Limit-RemainingThe maximum number of requests remaining in the current rate limit period.
X-Rate-Limit-ResetThe 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.

Overview

This API client was generated by the OpenAPI Generator project. By using the OpenAPI-spec from a remote server, you can easily generate an API client.

  • API version: v1
  • Package version: 1.0.0
  • Generator version: 7.7.0
  • Build package: org.openapitools.codegen.languages.GoClientCodegen For more information, please visit https://configcat.com

Installation

Install the following dependencies:

go get github.com/stretchr/testify/assert
go get golang.org/x/net/context

Put the package under your project folder and add the following in import:

import configcatpublicapi "github.com/configcat/configcat-publicapi-go-client/v2"

To use a proxy, set the environment variable HTTP_PROXY:

os.Setenv("HTTP_PROXY", "http://proxy_name:proxy_port")

Configuration of Server URL

Default configuration comes with Servers field that contains server objects as defined in the OpenAPI specification.

Select Server Configuration

For using other server than the one defined on index 0 set context value configcatpublicapi.ContextServerIndex of type int.

ctx := context.WithValue(context.Background(), configcatpublicapi.ContextServerIndex, 1)

Templated Server URL

Templated server URL is formatted using default variables from configuration or from context value configcatpublicapi.ContextServerVariables of type map[string]string.

ctx := context.WithValue(context.Background(), configcatpublicapi.ContextServerVariables, map[string]string{
	"basePath": "v2",
})

Note, enum values are always validated and all unused variables are silently ignored.

URLs Configuration per Operation

Each operation can use different server URL defined using OperationServers map in the Configuration. An operation is uniquely identified by "{classname}Service.{nickname}" string. Similar rules for overriding default operation server index and variables applies by using configcatpublicapi.ContextOperationServerIndices and configcatpublicapi.ContextOperationServerVariables context maps.

ctx := context.WithValue(context.Background(), configcatpublicapi.ContextOperationServerIndices, map[string]int{
	"{classname}Service.{nickname}": 2,
})
ctx = context.WithValue(context.Background(), configcatpublicapi.ContextOperationServerVariables, map[string]map[string]string{
	"{classname}Service.{nickname}": {
		"port": "8443",
	},
})

Documentation for API Endpoints

All URIs are relative to https://test-api.configcat.com

ClassMethodHTTP requestDescription
AuditLogsAPIGetAuditlogsGet /v1/products/{productId}/auditlogsList Audit log items for Product
AuditLogsAPIGetDeletedSettingsGet /v1/configs/{configId}/deleted-settingsList Deleted Settings
AuditLogsAPIGetOrganizationAuditlogsGet /v1/organizations/{organizationId}/auditlogsList Audit log items for Organization
CodeReferencesAPIV1CodeReferencesDeleteReportsPostPost /v1/code-references/delete-reportsDelete Reference reports
CodeReferencesAPIV1CodeReferencesPostPost /v1/code-referencesUpload References
CodeReferencesAPIV1SettingsSettingIdCodeReferencesGetGet /v1/settings/{settingId}/code-referencesGet References for Feature Flag or Setting
ConfigsAPICreateConfigPost /v1/products/{productId}/configsCreate Config
ConfigsAPIDeleteConfigDelete /v1/configs/{configId}Delete Config
ConfigsAPIGetConfigGet /v1/configs/{configId}Get Config
ConfigsAPIGetConfigsGet /v1/products/{productId}/configsList Configs
ConfigsAPIUpdateConfigPut /v1/configs/{configId}Update Config
EnvironmentsAPICreateEnvironmentPost /v1/products/{productId}/environmentsCreate Environment
EnvironmentsAPIDeleteEnvironmentDelete /v1/environments/{environmentId}Delete Environment
EnvironmentsAPIGetEnvironmentGet /v1/environments/{environmentId}Get Environment
EnvironmentsAPIGetEnvironmentsGet /v1/products/{productId}/environmentsList Environments
EnvironmentsAPIUpdateEnvironmentPut /v1/environments/{environmentId}Update Environment
FeatureFlagSettingValuesAPIGetSettingValueGet /v1/environments/{environmentId}/settings/{settingId}/valueGet value
FeatureFlagSettingValuesAPIGetSettingValuesGet /v1/configs/{configId}/environments/{environmentId}/valuesGet values
FeatureFlagSettingValuesAPIPostSettingValuesPost /v1/configs/{configId}/environments/{environmentId}/valuesPost values
FeatureFlagSettingValuesAPIReplaceSettingValuePut /v1/environments/{environmentId}/settings/{settingId}/valueReplace value
FeatureFlagSettingValuesAPIUpdateSettingValuePatch /v1/environments/{environmentId}/settings/{settingId}/valueUpdate value
FeatureFlagSettingValuesUsingSDKKeyAPIGetSettingValueBySdkkeyGet /v1/settings/{settingKeyOrId}/valueGet value
FeatureFlagSettingValuesUsingSDKKeyAPIReplaceSettingValueBySdkkeyPut /v1/settings/{settingKeyOrId}/valueReplace value
FeatureFlagSettingValuesUsingSDKKeyAPIUpdateSettingValueBySdkkeyPatch /v1/settings/{settingKeyOrId}/valueUpdate value
FeatureFlagSettingValuesUsingSDKKeyV2APIGetSettingValueBySdkkeyV2Get /v2/settings/{settingKeyOrId}/valueGet value
FeatureFlagSettingValuesUsingSDKKeyV2APIReplaceSettingValueBySdkkeyV2Put /v2/settings/{settingKeyOrId}/valueReplace value
FeatureFlagSettingValuesUsingSDKKeyV2APIUpdateSettingValueBySdkkeyV2Patch /v2/settings/{settingKeyOrId}/valueUpdate value
FeatureFlagSettingValuesV2APIGetSettingValueV2Get /v2/environments/{environmentId}/settings/{settingId}/valueGet value
FeatureFlagSettingValuesV2APIGetSettingValuesV2Get /v2/configs/{configId}/environments/{environmentId}/valuesGet values
FeatureFlagSettingValuesV2APIPostSettingValuesV2Post /v2/configs/{configId}/environments/{environmentId}/valuesPost values
FeatureFlagSettingValuesV2APIReplaceSettingValueV2Put /v2/environments/{environmentId}/settings/{settingId}/valueReplace value
FeatureFlagSettingValuesV2APIUpdateSettingValueV2Patch /v2/environments/{environmentId}/settings/{settingId}/valueUpdate value
FeatureFlagsSettingsAPICreateSettingPost /v1/configs/{configId}/settingsCreate Flag
FeatureFlagsSettingsAPIDeleteSettingDelete /v1/settings/{settingId}Delete Flag
FeatureFlagsSettingsAPIGetSettingGet /v1/settings/{settingId}Get Flag
FeatureFlagsSettingsAPIGetSettingsGet /v1/configs/{configId}/settingsList Flags
FeatureFlagsSettingsAPIReplaceSettingPut /v1/settings/{settingId}Replace Flag
FeatureFlagsSettingsAPIUpdateSettingPatch /v1/settings/{settingId}Update Flag
IntegrationLinksAPIAddOrUpdateIntegrationLinkPost /v1/environments/{environmentId}/settings/{settingId}/integrationLinks/{integrationLinkType}/{key}Add or update Integration link
IntegrationLinksAPIDeleteIntegrationLinkDelete /v1/environments/{environmentId}/settings/{settingId}/integrationLinks/{integrationLinkType}/{key}Delete Integration link
IntegrationLinksAPIGetIntegrationLinkDetailsGet /v1/integrationLink/{integrationLinkType}/{key}/detailsGet Integration link
IntegrationLinksAPIJiraAddOrUpdateIntegrationLinkPost /v1/jira/environments/{environmentId}/settings/{settingId}/integrationLinks/{key}
IntegrationLinksAPIJiraConnectPost /v1/jira/connect
IntegrationsAPICreateIntegrationPost /v1/products/{productId}/integrationsCreate Integration
IntegrationsAPIDeleteIntegrationDelete /v1/integrations/{integrationId}Delete Integration
IntegrationsAPIGetIntegrationGet /v1/integrations/{integrationId}Get Integration
IntegrationsAPIGetIntegrationsGet /v1/products/{productId}/integrationsList Integrations
IntegrationsAPIUpdateIntegrationPut /v1/integrations/{integrationId}Update Integration
MeAPIGetMeGet /v1/meGet authenticated user details
MembersAPIAddMemberToGroupPost /v1/organizations/{organizationId}/members/{userId}Update Member Permissions
MembersAPIDeleteInvitationDelete /v1/invitations/{invitationId}Delete Invitation
MembersAPIDeleteOrganizationMemberDelete /v1/organizations/{organizationId}/members/{userId}Delete Member from Organization
MembersAPIDeleteProductMemberDelete /v1/products/{productId}/members/{userId}Delete Member from Product
MembersAPIGetOrganizationMembersGet /v1/organizations/{organizationId}/membersList Organization Members
MembersAPIGetOrganizationMembersV2Get /v2/organizations/{organizationId}/membersList Organization Members
MembersAPIGetPendingInvitationsGet /v1/products/{productId}/invitationsList Pending Invitations in Product
MembersAPIGetPendingInvitationsOrgGet /v1/organizations/{organizationId}/invitationsList Pending Invitations in Organization
MembersAPIGetProductMembersGet /v1/products/{productId}/membersList Product Members
MembersAPIInviteMemberPost /v1/products/{productId}/members/inviteInvite Member
OrganizationsAPIGetOrganizationsGet /v1/organizationsList Organizations
PermissionGroupsAPICreatePermissionGroupPost /v1/products/{productId}/permissionsCreate Permission Group
PermissionGroupsAPIDeletePermissionGroupDelete /v1/permissions/{permissionGroupId}Delete Permission Group
PermissionGroupsAPIGetPermissionGroupGet /v1/permissions/{permissionGroupId}Get Permission Group
PermissionGroupsAPIGetPermissionGroupsGet /v1/products/{productId}/permissionsList Permission Groups
PermissionGroupsAPIUpdatePermissionGroupPut /v1/permissions/{permissionGroupId}Update Permission Group
ProductsAPICreateProductPost /v1/organizations/{organizationId}/productsCreate Product
ProductsAPIDeleteProductDelete /v1/products/{productId}Delete Product
ProductsAPIGetProductGet /v1/products/{productId}Get Product
ProductsAPIGetProductPreferencesGet /v1/products/{productId}/preferencesGet Product Preferences
ProductsAPIGetProductsGet /v1/productsList Products
ProductsAPIUpdateProductPut /v1/products/{productId}Update Product
ProductsAPIUpdateProductPreferencesPost /v1/products/{productId}/preferencesUpdate Product Preferences
SDKKeysAPIGetSdkKeysGet /v1/configs/{configId}/environments/{environmentId}Get SDK Key
SegmentsAPICreateSegmentPost /v1/products/{productId}/segmentsCreate Segment
SegmentsAPIDeleteSegmentDelete /v1/segments/{segmentId}Delete Segment
SegmentsAPIGetSegmentGet /v1/segments/{segmentId}Get Segment
SegmentsAPIGetSegmentsGet /v1/products/{productId}/segmentsList Segments
SegmentsAPIUpdateSegmentPut /v1/segments/{segmentId}Update Segment
TagsAPICreateTagPost /v1/products/{productId}/tagsCreate Tag
TagsAPIDeleteTagDelete /v1/tags/{tagId}Delete Tag
TagsAPIGetSettingsByTagGet /v1/tags/{tagId}/settingsList Settings by Tag
TagsAPIGetTagGet /v1/tags/{tagId}Get Tag
TagsAPIGetTagsGet /v1/products/{productId}/tagsList Tags
TagsAPIUpdateTagPut /v1/tags/{tagId}Update Tag
WebhooksAPICreateWebhookPost /v1/configs/{configId}/environments/{environmentId}/webhooksCreate Webhook
WebhooksAPIDeleteWebhookDelete /v1/webhooks/{webhookId}Delete Webhook
WebhooksAPIGetWebhookGet /v1/webhooks/{webhookId}Get Webhook
WebhooksAPIGetWebhookSigningKeysGet /v1/webhooks/{webhookId}/keysGet Webhook Signing Keys
WebhooksAPIGetWebhooksGet /v1/products/{productId}/webhooksList Webhooks
WebhooksAPIReplaceWebhookPut /v1/webhooks/{webhookId}Replace Webhook
WebhooksAPIUpdateWebhookPatch /v1/webhooks/{webhookId}Update Webhook

Documentation For Models

Documentation For Authorization

Authentication schemes defined for the API:

Basic

  • Type: HTTP basic authentication

Example

auth := context.WithValue(context.Background(), configcatpublicapi.ContextBasicAuth, configcatpublicapi.BasicAuth{
	UserName: "username",
	Password: "password",
})
r, err := client.Service.Operation(auth, args)

Documentation for Utility Methods

Due to the fact that model structure members are all pointers, this package contains a number of utility functions to easily obtain pointers to values of basic types. Each of these functions takes a value of the given basic type and returns a pointer to it:

  • PtrBool
  • PtrInt
  • PtrInt32
  • PtrInt64
  • PtrFloat
  • PtrFloat32
  • PtrFloat64
  • PtrString
  • PtrTime

Author

[email protected]

# Packages

No description provided by the author