Skip to content

The purpose of this client is to access the ConfigCat Public Management API programmatically. You can Create, Read, Update and Delete any entities like Feature Flags, Configs, Environments or Products within ConfigCat.

License

Notifications You must be signed in to change notification settings

configcat/configcat-publicapi-go-client

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

65 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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:

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.

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.9.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

Class Method HTTP request Description
AuditLogsAPI GetAuditlogs Get /v1/products/{productId}/auditlogs List Audit log items for Product
AuditLogsAPI GetDeletedSettings Get /v1/configs/{configId}/deleted-settings List Deleted Settings
AuditLogsAPI GetOrganizationAuditlogs Get /v1/organizations/{organizationId}/auditlogs List Audit log items for Organization
CodeReferencesAPI V1CodeReferencesDeleteReportsPost Post /v1/code-references/delete-reports Delete Reference reports
CodeReferencesAPI V1CodeReferencesPost Post /v1/code-references Upload References
CodeReferencesAPI V1SettingsSettingIdCodeReferencesGet Get /v1/settings/{settingId}/code-references Get References for Feature Flag or Setting
ConfigsAPI CreateConfig Post /v1/products/{productId}/configs Create Config
ConfigsAPI DeleteConfig Delete /v1/configs/{configId} Delete Config
ConfigsAPI GetConfig Get /v1/configs/{configId} Get Config
ConfigsAPI GetConfigs Get /v1/products/{productId}/configs List Configs
ConfigsAPI UpdateConfig Put /v1/configs/{configId} Update Config
EnvironmentsAPI CreateEnvironment Post /v1/products/{productId}/environments Create Environment
EnvironmentsAPI DeleteEnvironment Delete /v1/environments/{environmentId} Delete Environment
EnvironmentsAPI GetEnvironment Get /v1/environments/{environmentId} Get Environment
EnvironmentsAPI GetEnvironments Get /v1/products/{productId}/environments List Environments
EnvironmentsAPI UpdateEnvironment Put /v1/environments/{environmentId} Update Environment
FeatureFlagSettingValuesAPI GetSettingValue Get /v1/environments/{environmentId}/settings/{settingId}/value Get value
FeatureFlagSettingValuesAPI GetSettingValues Get /v1/configs/{configId}/environments/{environmentId}/values Get values
FeatureFlagSettingValuesAPI PostSettingValues Post /v1/configs/{configId}/environments/{environmentId}/values Post values
FeatureFlagSettingValuesAPI ReplaceSettingValue Put /v1/environments/{environmentId}/settings/{settingId}/value Replace value
FeatureFlagSettingValuesAPI UpdateSettingValue Patch /v1/environments/{environmentId}/settings/{settingId}/value Update value
FeatureFlagSettingValuesUsingSDKKeyAPI GetSettingValueBySdkkey Get /v1/settings/{settingKeyOrId}/value Get value
FeatureFlagSettingValuesUsingSDKKeyAPI ReplaceSettingValueBySdkkey Put /v1/settings/{settingKeyOrId}/value Replace value
FeatureFlagSettingValuesUsingSDKKeyAPI UpdateSettingValueBySdkkey Patch /v1/settings/{settingKeyOrId}/value Update value
FeatureFlagSettingValuesUsingSDKKeyV2API GetSettingValueBySdkkeyV2 Get /v2/settings/{settingKeyOrId}/value Get value
FeatureFlagSettingValuesUsingSDKKeyV2API ReplaceSettingValueBySdkkeyV2 Put /v2/settings/{settingKeyOrId}/value Replace value
FeatureFlagSettingValuesUsingSDKKeyV2API UpdateSettingValueBySdkkeyV2 Patch /v2/settings/{settingKeyOrId}/value Update value
FeatureFlagSettingValuesV2API GetSettingValueV2 Get /v2/environments/{environmentId}/settings/{settingId}/value Get value
FeatureFlagSettingValuesV2API GetSettingValuesV2 Get /v2/configs/{configId}/environments/{environmentId}/values Get values
FeatureFlagSettingValuesV2API PostSettingValuesV2 Post /v2/configs/{configId}/environments/{environmentId}/values Post values
FeatureFlagSettingValuesV2API ReplaceSettingValueV2 Put /v2/environments/{environmentId}/settings/{settingId}/value Replace value
FeatureFlagSettingValuesV2API UpdateSettingValueV2 Patch /v2/environments/{environmentId}/settings/{settingId}/value Update value
FeatureFlagsSettingsAPI CreateSetting Post /v1/configs/{configId}/settings Create Flag
FeatureFlagsSettingsAPI DeleteSetting Delete /v1/settings/{settingId} Delete Flag
FeatureFlagsSettingsAPI GetSetting Get /v1/settings/{settingId} Get Flag
FeatureFlagsSettingsAPI GetSettings Get /v1/configs/{configId}/settings List Flags
FeatureFlagsSettingsAPI ReplaceSetting Put /v1/settings/{settingId} Replace Flag
FeatureFlagsSettingsAPI UpdateSetting Patch /v1/settings/{settingId} Update Flag
IntegrationLinksAPI AddOrUpdateIntegrationLink Post /v1/environments/{environmentId}/settings/{settingId}/integrationLinks/{integrationLinkType}/{key} Add or update Integration link
IntegrationLinksAPI DeleteIntegrationLink Delete /v1/environments/{environmentId}/settings/{settingId}/integrationLinks/{integrationLinkType}/{key} Delete Integration link
IntegrationLinksAPI GetIntegrationLinkDetails Get /v1/integrationLink/{integrationLinkType}/{key}/details Get Integration link
IntegrationLinksAPI JiraAddOrUpdateIntegrationLink Post /v1/jira/environments/{environmentId}/settings/{settingId}/integrationLinks/{key}
IntegrationLinksAPI JiraConnect Post /v1/jira/connect
IntegrationsAPI CreateIntegration Post /v1/products/{productId}/integrations Create Integration
IntegrationsAPI DeleteIntegration Delete /v1/integrations/{integrationId} Delete Integration
IntegrationsAPI GetIntegration Get /v1/integrations/{integrationId} Get Integration
IntegrationsAPI GetIntegrations Get /v1/products/{productId}/integrations List Integrations
IntegrationsAPI UpdateIntegration Put /v1/integrations/{integrationId} Update Integration
MeAPI GetMe Get /v1/me Get authenticated user details
MembersAPI AddMemberToGroup Post /v1/organizations/{organizationId}/members/{userId} Update Member Permissions
MembersAPI DeleteInvitation Delete /v1/invitations/{invitationId} Delete Invitation
MembersAPI DeleteOrganizationMember Delete /v1/organizations/{organizationId}/members/{userId} Delete Member from Organization
MembersAPI DeleteProductMember Delete /v1/products/{productId}/members/{userId} Delete Member from Product
MembersAPI GetOrganizationMembers Get /v1/organizations/{organizationId}/members List Organization Members
MembersAPI GetOrganizationMembersV2 Get /v2/organizations/{organizationId}/members List Organization Members
MembersAPI GetPendingInvitations Get /v1/products/{productId}/invitations List Pending Invitations in Product
MembersAPI GetPendingInvitationsOrg Get /v1/organizations/{organizationId}/invitations List Pending Invitations in Organization
MembersAPI GetProductMembers Get /v1/products/{productId}/members List Product Members
MembersAPI InviteMember Post /v1/products/{productId}/members/invite Invite Member
OrganizationsAPI GetOrganizations Get /v1/organizations List Organizations
PermissionGroupsAPI CreatePermissionGroup Post /v1/products/{productId}/permissions Create Permission Group
PermissionGroupsAPI DeletePermissionGroup Delete /v1/permissions/{permissionGroupId} Delete Permission Group
PermissionGroupsAPI GetPermissionGroup Get /v1/permissions/{permissionGroupId} Get Permission Group
PermissionGroupsAPI GetPermissionGroups Get /v1/products/{productId}/permissions List Permission Groups
PermissionGroupsAPI UpdatePermissionGroup Put /v1/permissions/{permissionGroupId} Update Permission Group
ProductsAPI CreateProduct Post /v1/organizations/{organizationId}/products Create Product
ProductsAPI DeleteProduct Delete /v1/products/{productId} Delete Product
ProductsAPI GetProduct Get /v1/products/{productId} Get Product
ProductsAPI GetProductPreferences Get /v1/products/{productId}/preferences Get Product Preferences
ProductsAPI GetProducts Get /v1/products List Products
ProductsAPI UpdateProduct Put /v1/products/{productId} Update Product
ProductsAPI UpdateProductPreferences Post /v1/products/{productId}/preferences Update Product Preferences
SDKKeysAPI GetSdkKeys Get /v1/configs/{configId}/environments/{environmentId} Get SDK Key
SegmentsAPI CreateSegment Post /v1/products/{productId}/segments Create Segment
SegmentsAPI DeleteSegment Delete /v1/segments/{segmentId} Delete Segment
SegmentsAPI GetSegment Get /v1/segments/{segmentId} Get Segment
SegmentsAPI GetSegments Get /v1/products/{productId}/segments List Segments
SegmentsAPI UpdateSegment Put /v1/segments/{segmentId} Update Segment
TagsAPI CreateTag Post /v1/products/{productId}/tags Create Tag
TagsAPI DeleteTag Delete /v1/tags/{tagId} Delete Tag
TagsAPI GetSettingsByTag Get /v1/tags/{tagId}/settings List Settings by Tag
TagsAPI GetTag Get /v1/tags/{tagId} Get Tag
TagsAPI GetTags Get /v1/products/{productId}/tags List Tags
TagsAPI UpdateTag Put /v1/tags/{tagId} Update Tag
WebhooksAPI CreateWebhook Post /v1/configs/{configId}/environments/{environmentId}/webhooks Create Webhook
WebhooksAPI DeleteWebhook Delete /v1/webhooks/{webhookId} Delete Webhook
WebhooksAPI GetWebhook Get /v1/webhooks/{webhookId} Get Webhook
WebhooksAPI GetWebhookSigningKeys Get /v1/webhooks/{webhookId}/keys Get Webhook Signing Keys
WebhooksAPI GetWebhooks Get /v1/products/{productId}/webhooks List Webhooks
WebhooksAPI ReplaceWebhook Put /v1/webhooks/{webhookId} Replace Webhook
WebhooksAPI UpdateWebhook Patch /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]

About

The purpose of this client is to access the ConfigCat Public Management API programmatically. You can Create, Read, Update and Delete any entities like Feature Flags, Configs, Environments or Products within ConfigCat.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages