Categorygithub.com/launchdarkly/api-client-go
modulepackage
5.3.0+incompatible
Repository: https://github.com/launchdarkly/api-client-go.git
Documentation: pkg.go.dev

# README

This repository contains a client library for LaunchDarkly's REST API. This client was automatically generated from our OpenAPI specification.

This REST API is for custom integrations, data export, or automating your feature flag workflows. DO NOT use this client library to include feature flags in your web or mobile application. To integrate feature flags with your application, please see the SDK documentation

Go API client for ldapi

Build custom integrations with the LaunchDarkly REST API

Overview

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

  • API version: 5.3.0
  • Package version: 1.0.0
  • Build package: io.swagger.codegen.languages.GoClientCodegen For more information, please visit https://support.launchdarkly.com

Installation

import "github.com/launchdarkly/api-client-go"

Documentation for API Endpoints

All URIs are relative to https://app.launchdarkly.com/api/v2

ClassMethodHTTP requestDescription
AccessTokensApiDeleteTokenDelete /tokens/{tokenId}Delete an access token by ID.
AccessTokensApiGetTokenGet /tokens/{tokenId}Get a single access token by ID.
AccessTokensApiGetTokensGet /tokensReturns a list of tokens in the account.
AccessTokensApiPatchTokenPatch /tokens/{tokenId}Modify an access token by ID.
AccessTokensApiPostTokenPost /tokensCreate a new token.
AccessTokensApiResetTokenPost /tokens/{tokenId}/resetReset an access token's secret key with an optional expiry time for the old key.
AuditLogApiGetAuditLogEntriesGet /auditlogGet a list of all audit log entries. The query parameters allow you to restrict the returned results by date ranges, resource specifiers, or a full-text search query.
AuditLogApiGetAuditLogEntryGet /auditlog/{resourceId}Use this endpoint to fetch a single audit log entry by its resouce ID.
CustomRolesApiDeleteCustomRoleDelete /roles/{customRoleKey}Delete a custom role by key.
CustomRolesApiGetCustomRoleGet /roles/{customRoleKey}Get one custom role by key.
CustomRolesApiGetCustomRolesGet /rolesReturn a complete list of custom roles.
CustomRolesApiPatchCustomRolePatch /roles/{customRoleKey}Modify a custom role by key.
CustomRolesApiPostCustomRolePost /rolesCreate a new custom role.
CustomerMetricsApiGetEvaluationsGet /usage/evaluations/{envId}/{flagKey}Get events usage by event id and the feature flag key.
CustomerMetricsApiGetEventGet /usage/events/{type}Get events usage by event type.
CustomerMetricsApiGetEventsGet /usage/eventsGet events usage endpoints.
CustomerMetricsApiGetMAUGet /usage/mauGet monthly active user data.
CustomerMetricsApiGetMAUByCategoryGet /usage/mau/bycategoryGet monthly active user data by category.
CustomerMetricsApiGetStreamGet /usage/streams/{source}Get a stream endpoint and return timeseries data.
CustomerMetricsApiGetStreamBySDKGet /usage/streams/{source}/bysdkversionGet a stream timeseries data by source show sdk version metadata.
CustomerMetricsApiGetStreamSDKVersionGet /usage/streams/{source}/sdkversionsGet a stream timeseries data by source and show all sdk version associated.
CustomerMetricsApiGetStreamsGet /usage/streamsReturns a list of all streams.
CustomerMetricsApiGetUsageGet /usageReturns of the usage endpoints available.
DataExportDestinationsApiDeleteDestinationDelete /destinations/{projectKey}/{environmentKey}/{destinationId}Get a single data export destination by ID
DataExportDestinationsApiGetDestinationGet /destinations/{projectKey}/{environmentKey}/{destinationId}Get a single data export destination by ID
DataExportDestinationsApiGetDestinationsGet /destinationsReturns a list of all data export destinations.
DataExportDestinationsApiPatchDestinationPatch /destinations/{projectKey}/{environmentKey}/{destinationId}Perform a partial update to a data export destination.
DataExportDestinationsApiPostDestinationPost /destinations/{projectKey}/{environmentKey}Create a new data export destination
EnvironmentsApiDeleteEnvironmentDelete /projects/{projectKey}/environments/{environmentKey}Delete an environment in a specific project.
EnvironmentsApiGetEnvironmentGet /projects/{projectKey}/environments/{environmentKey}Get an environment given a project and key.
EnvironmentsApiPatchEnvironmentPatch /projects/{projectKey}/environments/{environmentKey}Modify an environment by ID. If you try to patch the environment by setting both required and requiredApprovalTags, it will result in an error. Users can specify either required approvals for all flags in an environment or those with specific tags, but not both. Only customers on an Enterprise plan can require approval for flag updates with either mechanism.
EnvironmentsApiPostEnvironmentPost /projects/{projectKey}/environmentsCreate a new environment in a specified project with a given name, key, and swatch color.
EnvironmentsApiResetEnvironmentMobileKeyPost /projects/{projectKey}/environments/{environmentKey}/mobileKeyReset an environment's mobile key. The optional expiry for the old key is deprecated for this endpoint, so the old key will always expire immediately.
EnvironmentsApiResetEnvironmentSDKKeyPost /projects/{projectKey}/environments/{environmentKey}/apiKeyReset an environment's SDK key with an optional expiry time for the old key.
FeatureFlagsApiCopyFeatureFlagPost /flags/{projectKey}/{featureFlagKey}/copyCopies the feature flag configuration from one environment to the same feature flag in another environment.
FeatureFlagsApiDeleteApprovalRequestDelete /projects/{projectKey}/flags/{featureFlagKey}/environments/{environmentKey}/approval-requests/{approvalRequestId}Delete an approval request for a feature flag config
FeatureFlagsApiDeleteFeatureFlagDelete /flags/{projectKey}/{featureFlagKey}Delete a feature flag in all environments. Be careful-- only delete feature flags that are no longer being used by your application.
FeatureFlagsApiDeleteFlagConfigScheduledChangesDelete /projects/{projectKey}/flags/{featureFlagKey}/environments/{environmentKey}/scheduled-changes/{scheduledChangeId}Delete a scheduled change on a feature flag in an environment.
FeatureFlagsApiFlagsProjectKeyEnvironmentKeyFeatureFlagKeyDependentFlagsGetGet /flags/{projectKey}/{environmentKey}/{featureFlagKey}/dependent-flagsGet dependent flags for the flag in the environment specified in path parameters
FeatureFlagsApiFlagsProjectKeyFeatureFlagKeyDependentFlagsGetGet /flags/{projectKey}/{featureFlagKey}/dependent-flagsGet dependent flags across all environments for the flag specified in the path parameters
FeatureFlagsApiGetApprovalRequestGet /projects/{projectKey}/flags/{featureFlagKey}/environments/{environmentKey}/approval-requests/{approvalRequestId}Get a single approval request for a feature flag config
FeatureFlagsApiGetApprovalRequestsGet /projects/{projectKey}/flags/{featureFlagKey}/environments/{environmentKey}/approval-requestsGet all approval requests for a feature flag config
FeatureFlagsApiGetExpiringUserTargetsGet /flags/{projectKey}/{featureFlagKey}/expiring-user-targets/{environmentKey}Get expiring user targets for feature flag
FeatureFlagsApiGetFeatureFlagGet /flags/{projectKey}/{featureFlagKey}Get a single feature flag by key.
FeatureFlagsApiGetFeatureFlagStatusGet /flag-statuses/{projectKey}/{environmentKey}/{featureFlagKey}Get the status for a particular feature flag.
FeatureFlagsApiGetFeatureFlagStatusAcrossEnvironmentsGet /flag-status/{projectKey}/{featureFlagKey}Get the status for a particular feature flag across environments
FeatureFlagsApiGetFeatureFlagStatusesGet /flag-statuses/{projectKey}/{environmentKey}Get a list of statuses for all feature flags. The status includes the last time the feature flag was requested, as well as the state of the flag.
FeatureFlagsApiGetFeatureFlagsGet /flags/{projectKey}Get a list of all features in the given project.
FeatureFlagsApiGetFlagConfigScheduledChangeGet /projects/{projectKey}/flags/{featureFlagKey}/environments/{environmentKey}/scheduled-changes/{scheduledChangeId}Get a scheduled change on a feature flag by id.
FeatureFlagsApiGetFlagConfigScheduledChangesGet /projects/{projectKey}/flags/{featureFlagKey}/environments/{environmentKey}/scheduled-changesGet all scheduled workflows for a feature flag by key.
FeatureFlagsApiGetFlagConfigScheduledChangesConflictsPost /projects/{projectKey}/flags/{featureFlagKey}/environments/{environmentKey}/scheduled-changes-conflictsLists conflicts between the given instructions and any existing scheduled changes for the feature flag. The actual HTTP verb should be REPORT, not POST.
FeatureFlagsApiPatchExpiringUserTargetsPatch /flags/{projectKey}/{featureFlagKey}/expiring-user-targets/{environmentKey}Update, add, or delete expiring user targets on feature flag
FeatureFlagsApiPatchFeatureFlagPatch /flags/{projectKey}/{featureFlagKey}Perform a partial update to a feature.
FeatureFlagsApiPatchFlagConfigScheduledChangePatch /projects/{projectKey}/flags/{featureFlagKey}/environments/{environmentKey}/scheduled-changes/{scheduledChangeId}Updates an existing scheduled-change on a feature flag in an environment.
FeatureFlagsApiPostApplyApprovalRequestPost /projects/{projectKey}/flags/{featureFlagKey}/environments/{environmentKey}/approval-requests/{approvalRequestId}/applyApply approval request for a feature flag config
FeatureFlagsApiPostApprovalRequestPost /projects/{projectKey}/flags/{featureFlagKey}/environments/{environmentKey}/approval-requests/{approvalRequestId}Create an approval request for a feature flag config
FeatureFlagsApiPostFeatureFlagPost /flags/{projectKey}Creates a new feature flag.
FeatureFlagsApiPostFlagConfigScheduledChangesPost /projects/{projectKey}/flags/{featureFlagKey}/environments/{environmentKey}/scheduled-changesCreates a new scheduled change for a feature flag.
FeatureFlagsApiPostReviewApprovalRequestPost /projects/{projectKey}/flags/{featureFlagKey}/environments/{environmentKey}/approval-requests/{approvalRequestId}/reviewReview approval request for a feature flag config
IntegrationsApiDeleteIntegrationSubscriptionDelete /integrations/{integrationKey}/{integrationId}Delete an integration subscription by ID.
IntegrationsApiGetIntegrationSubscriptionGet /integrations/{integrationKey}/{integrationId}Get a single integration subscription by ID.
IntegrationsApiGetIntegrationSubscriptionsGet /integrations/{integrationKey}Get a list of all configured integrations of a given kind.
IntegrationsApiGetIntegrationsGet /integrationsGet a list of all configured audit log event integrations associated with this account.
IntegrationsApiPatchIntegrationSubscriptionPatch /integrations/{integrationKey}/{integrationId}Modify an integration subscription by ID.
IntegrationsApiPostIntegrationSubscriptionPost /integrations/{integrationKey}Create a new integration subscription of a given kind.
ProjectsApiDeleteProjectDelete /projects/{projectKey}Delete a project by key. Caution-- deleting a project will delete all associated environments and feature flags. You cannot delete the last project in an account.
ProjectsApiGetProjectGet /projects/{projectKey}Fetch a single project by key.
ProjectsApiGetProjectsGet /projectsReturns a list of all projects in the account.
ProjectsApiPatchProjectPatch /projects/{projectKey}Modify a project by ID.
ProjectsApiPostProjectPost /projectsCreate a new project with the given key and name.
RelayProxyConfigurationsApiDeleteRelayProxyConfigDelete /account/relay-auto-configs/{id}Delete a relay proxy configuration by ID.
RelayProxyConfigurationsApiGetRelayProxyConfigGet /account/relay-auto-configs/{id}Get a single relay proxy configuration by ID.
RelayProxyConfigurationsApiGetRelayProxyConfigsGet /account/relay-auto-configsReturns a list of relay proxy configurations in the account.
RelayProxyConfigurationsApiPatchRelayProxyConfigPatch /account/relay-auto-configs/{id}Modify a relay proxy configuration by ID.
RelayProxyConfigurationsApiPostRelayAutoConfigPost /account/relay-auto-configsCreate a new relay proxy config.
RelayProxyConfigurationsApiResetRelayProxyConfigPost /account/relay-auto-configs/{id}/resetReset a relay proxy configuration's secret key with an optional expiry time for the old key.
RootApiGetRootGet /
TeamMembersApiDeleteMemberDelete /members/{memberId}Delete a team member by ID.
TeamMembersApiGetMeGet /members/meGet the current team member associated with the token
TeamMembersApiGetMemberGet /members/{memberId}Get a single team member by ID.
TeamMembersApiGetMembersGet /membersReturns a list of all members in the account.
TeamMembersApiPatchMemberPatch /members/{memberId}Modify a team member by ID.
TeamMembersApiPostMembersPost /membersInvite new members.
UserSegmentsApiDeleteUserSegmentDelete /segments/{projectKey}/{environmentKey}/{userSegmentKey}Delete a user segment.
UserSegmentsApiGetExpiringUserTargetsOnSegmentGet /segments/{projectKey}/{userSegmentKey}/expiring-user-targets/{environmentKey}Get expiring user targets for user segment
UserSegmentsApiGetUserSegmentGet /segments/{projectKey}/{environmentKey}/{userSegmentKey}Get a single user segment by key.
UserSegmentsApiGetUserSegmentsGet /segments/{projectKey}/{environmentKey}Get a list of all user segments in the given project.
UserSegmentsApiPatchExpiringUserTargetsOnSegmentPatch /segments/{projectKey}/{userSegmentKey}/expiring-user-targets/{environmentKey}Update, add, or delete expiring user targets on user segment
UserSegmentsApiPatchUserSegmentPatch /segments/{projectKey}/{environmentKey}/{userSegmentKey}Perform a partial update to a user segment.
UserSegmentsApiPostUserSegmentPost /segments/{projectKey}/{environmentKey}Creates a new user segment.
UserSegmentsApiUpdateBigSegmentTargetsPost /segments/{projectKey}/{environmentKey}/{userSegmentKey}/usersUpdate targets included or excluded in a big segment
UserSettingsApiGetExpiringUserTargetsForUserGet /users/{projectKey}/{userKey}/expiring-user-targets/{environmentKey}Get expiring dates on flags for user
UserSettingsApiGetUserFlagSettingGet /users/{projectKey}/{environmentKey}/{userKey}/flags/{featureFlagKey}Fetch a single flag setting for a user by key.
UserSettingsApiGetUserFlagSettingsGet /users/{projectKey}/{environmentKey}/{userKey}/flagsFetch a single flag setting for a user by key.
UserSettingsApiPatchExpiringUserTargetsForFlagsPatch /users/{projectKey}/{userKey}/expiring-user-targets/{environmentKey}Update, add, or delete expiring user targets for a single user on all flags
UserSettingsApiPutFlagSettingPut /users/{projectKey}/{environmentKey}/{userKey}/flags/{featureFlagKey}Specifically enable or disable a feature flag for a user based on their key.
UsersApiDeleteUserDelete /users/{projectKey}/{environmentKey}/{userKey}Delete a user by ID.
UsersApiGetSearchUsersGet /user-search/{projectKey}/{environmentKey}Search users in LaunchDarkly based on their last active date, or a search query. It should not be used to enumerate all users in LaunchDarkly-- use the List users API resource.
UsersApiGetUserGet /users/{projectKey}/{environmentKey}/{userKey}Get a user by key.
UsersApiGetUsersGet /users/{projectKey}/{environmentKey}List all users in the environment. Includes the total count of users. In each page, there will be up to 'limit' users returned (default 20). This is useful for exporting all users in the system for further analysis. Paginated collections will include a next link containing a URL with the next set of elements in the collection.
WebhooksApiDeleteWebhookDelete /webhooks/{resourceId}Delete a webhook by ID.
WebhooksApiGetWebhookGet /webhooks/{resourceId}Get a webhook by ID.
WebhooksApiGetWebhooksGet /webhooksFetch a list of all webhooks.
WebhooksApiPatchWebhookPatch /webhooks/{resourceId}Modify a webhook by ID.
WebhooksApiPostWebhookPost /webhooksCreate a webhook.

Documentation For Models

Author

[email protected]

Sample Code

package main

import (
	"context"
	"fmt"
	"os"

	"github.com/launchdarkly/api-client-go"
)

func main() {
	apiKey := os.Getenv("LD_API_KEY")
	if apiKey == "" {
		panic("LD_API_KEY env var was empty!")
	}
	client := ldapi.NewAPIClient(ldapi.NewConfiguration())
	ctx := context.WithValue(context.Background(), ldapi.ContextAPIKey, ldapi.APIKey{
		Key: apiKey,
	})

	// Create a multi-variate feature flag
	body := ldapi.FeatureFlagBody{
		Name: "Test Flag Go",
		Key:  "test-go",
		Variations: []ldapi.Variation{
			{Value: intfPtr([]interface{}{1, 2})},
			{Value: intfPtr([]interface{}{3, 4})},
			{Value: intfPtr([]interface{}{5})}}}
	flag, _, err := client.FeatureFlagsApi.PostFeatureFlag(ctx, "openapi", body, nil)
	if err != nil {
		panic(fmt.Errorf("create failed: %s", err))
	}
	fmt.Printf("Created flag: %+v\n", flag)
	// Clean up new flag
	defer func() {
		if _, err := client.FeatureFlagsApi.DeleteFeatureFlag(ctx, "openapi", body.Key); err != nil {
			panic(fmt.Errorf("delete failed: %s", err))
		}
	}()
}

func intfPtr(i interface{}) *interface{} {
	return &i
}

# Functions

CacheExpires helper function to determine remaining time before repeating a request.
NewAPIClient creates a new API client.
No description provided by the author
No description provided by the author
No description provided by the author

# Constants

List of Role.
List of ApprovalRequestReviewStatus.
List of FeatureFlagApprovalRequestReviewStatus.
List of FeatureFlagChangeRequestReviewStatus.
List of ApprovalRequestReviewStatus.
List of FeatureFlagApprovalRequestReviewStatus.
List of FeatureFlagChangeRequestReviewStatus.
List of Role.
List of ApprovalRequestReviewStatus.
List of FeatureFlagApprovalRequestReviewStatus.
List of FeatureFlagChangeRequestReviewStatus.
List of Role.
List of CopyActions.
List of CopyActions.
List of CopyActions.
List of CopyActions.
List of CopyActions.
List of CopyActions.
List of Role.

# Variables

ContextAccessToken takes a string oauth2 access token as authentication for the request.
ContextAPIKey takes an APIKey as authentication for the request.
ContextBasicAuth takes BasicAuth as authentication for the request.
ContextOAuth2 takes a oauth2.TokenSource as authentication for the request.

# Structs

No description provided by the author
No description provided by the author
APIClient manages communication with the LaunchDarkly REST API API v5.3.0 In most cases there should be only one, shared, APIClient.
APIKey provides API key based authentication to a request passed via context using ContextAPIKey.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
BasicAuth provides basic http authentication to a request passed via context using ContextBasicAuth.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
A name and value describing a custom property.
Values for this property.
No description provided by the author
No description provided by the author
No description provided by the author
Default values to be used when a new environment is created.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
Approval settings for an environment.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
GenericSwaggerError Provides access to the body, error and model on returned errors.
No description provided by the author
The unique resource id.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author

# Type aliases

No description provided by the author
ApprovalRequestReviewStatus : | Name | Description | | --------:| ----------- | | pending | the approval request has not been reviewed yet | | approved | the approval request has been approved and can now be applied | | declined | the approval request has been declined and cannot be applied | .
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
FeatureFlagApprovalRequestReviewStatus : | Name | Description | | --------:| ----------- | | pending | the feature flag approval request has not been reviewed yet | | approved | the feature flag approval request has been approved and can now be applied | | declined | the feature flag approval request has been declined and cannot be applied | .
FeatureFlagChangeRequestReviewStatus : | Name | Description | | --------:| ----------- | | pending | the feature flag change request has not been reviewed yet | | approved | the feature flag change request has been approved and can now be applied | | declined | the feature flag change request has been declined and cannot be applied | .
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author