# 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: 4.0.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
Class | Method | HTTP request | Description |
---|---|---|---|
AccessTokensApi | DeleteToken | Delete /tokens/{tokenId} | Delete an access token by ID. |
AccessTokensApi | GetToken | Get /tokens/{tokenId} | Get a single access token by ID. |
AccessTokensApi | GetTokens | Get /tokens | Returns a list of tokens in the account. |
AccessTokensApi | PatchToken | Patch /tokens/{tokenId} | Modify an access token by ID. |
AccessTokensApi | PostToken | Post /tokens | Create a new token. |
AccessTokensApi | ResetToken | Post /tokens/{tokenId}/reset | Reset an access token's secret key with an optional expiry time for the old key. |
AuditLogApi | GetAuditLogEntries | Get /auditlog | Get 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. |
AuditLogApi | GetAuditLogEntry | Get /auditlog/{resourceId} | Use this endpoint to fetch a single audit log entry by its resouce ID. |
CustomRolesApi | DeleteCustomRole | Delete /roles/{customRoleKey} | Delete a custom role by key. |
CustomRolesApi | GetCustomRole | Get /roles/{customRoleKey} | Get one custom role by key. |
CustomRolesApi | GetCustomRoles | Get /roles | Return a complete list of custom roles. |
CustomRolesApi | PatchCustomRole | Patch /roles/{customRoleKey} | Modify a custom role by key. |
CustomRolesApi | PostCustomRole | Post /roles | Create a new custom role. |
CustomerMetricsApi | GetEvaluations | Get /usage/evaluations/{envId}/{flagKey} | Get events usage by event id and the feature flag key. |
CustomerMetricsApi | GetEvent | Get /usage/events/{type} | Get events usage by event type. |
CustomerMetricsApi | GetEvents | Get /usage/events | Get events usage endpoints. |
CustomerMetricsApi | GetMAU | Get /usage/mau | Get monthly active user data. |
CustomerMetricsApi | GetMAUByCategory | Get /usage/mau/bycategory | Get monthly active user data by category. |
CustomerMetricsApi | GetStream | Get /usage/streams/{source} | Get a stream endpoint and return timeseries data. |
CustomerMetricsApi | GetStreamBySDK | Get /usage/streams/{source}/bysdkversion | Get a stream timeseries data by source show sdk version metadata. |
CustomerMetricsApi | GetStreamSDKVersion | Get /usage/streams/{source}/sdkversions | Get a stream timeseries data by source and show all sdk version associated. |
CustomerMetricsApi | GetStreams | Get /usage/streams | Returns a list of all streams. |
CustomerMetricsApi | GetUsage | Get /usage | Returns of the usage endpoints available. |
DataExportDestinationsApi | DeleteDestination | Delete /destinations/{projectKey}/{environmentKey}/{destinationId} | Get a single data export destination by ID |
DataExportDestinationsApi | GetDestination | Get /destinations/{projectKey}/{environmentKey}/{destinationId} | Get a single data export destination by ID |
DataExportDestinationsApi | GetDestinations | Get /destinations | Returns a list of all data export destinations. |
DataExportDestinationsApi | PatchDestination | Patch /destinations/{projectKey}/{environmentKey}/{destinationId} | Perform a partial update to a data export destination. |
DataExportDestinationsApi | PostDestination | Post /destinations/{projectKey}/{environmentKey} | Create a new data export destination |
EnvironmentsApi | DeleteEnvironment | Delete /projects/{projectKey}/environments/{environmentKey} | Delete an environment in a specific project. |
EnvironmentsApi | GetEnvironment | Get /projects/{projectKey}/environments/{environmentKey} | Get an environment given a project and key. |
EnvironmentsApi | PatchEnvironment | Patch /projects/{projectKey}/environments/{environmentKey} | Modify an environment by ID. |
EnvironmentsApi | PostEnvironment | Post /projects/{projectKey}/environments | Create a new environment in a specified project with a given name, key, and swatch color. |
EnvironmentsApi | ResetEnvironmentMobileKey | Post /projects/{projectKey}/environments/{environmentKey}/mobileKey | Reset 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. |
EnvironmentsApi | ResetEnvironmentSDKKey | Post /projects/{projectKey}/environments/{environmentKey}/apiKey | Reset an environment's SDK key with an optional expiry time for the old key. |
FeatureFlagsApi | CopyFeatureFlag | Post /flags/{projectKey}/{featureFlagKey}/copy | Copies the feature flag configuration from one environment to the same feature flag in another environment. |
FeatureFlagsApi | DeleteFeatureFlag | Delete /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. |
FeatureFlagsApi | DeleteFeatureFlagApprovalRequest | Delete /projects/{projectKey}/flags/{featureFlagKey}/environments/{environmentKey}/approval-requests/{featureFlagApprovalRequestId} | Delete an approval request for a feature flag |
FeatureFlagsApi | GetExpiringUserTargets | Get /flags/{projectKey}/{featureFlagKey}/expiring-user-targets/{environmentKey} | Get expiring user targets for feature flag |
FeatureFlagsApi | GetFeatureFlag | Get /flags/{projectKey}/{featureFlagKey} | Get a single feature flag by key. |
FeatureFlagsApi | GetFeatureFlagApprovalRequest | Get /projects/{projectKey}/flags/{featureFlagKey}/environments/{environmentKey}/approval-requests/{featureFlagApprovalRequestId} | Get a single approval request for a feature flag |
FeatureFlagsApi | GetFeatureFlagApprovalRequests | Get /projects/{projectKey}/flags/{featureFlagKey}/environments/{environmentKey}/approval-requests | Get all approval requests for a feature flag |
FeatureFlagsApi | GetFeatureFlagStatus | Get /flag-statuses/{projectKey}/{environmentKey}/{featureFlagKey} | Get the status for a particular feature flag. |
FeatureFlagsApi | GetFeatureFlagStatusAcrossEnvironments | Get /flag-status/{projectKey}/{featureFlagKey} | Get the status for a particular feature flag across environments |
FeatureFlagsApi | GetFeatureFlagStatuses | Get /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. |
FeatureFlagsApi | GetFeatureFlags | Get /flags/{projectKey} | Get a list of all features in the given project. |
FeatureFlagsApi | PatchExpiringUserTargets | Patch /flags/{projectKey}/{featureFlagKey}/expiring-user-targets/{environmentKey} | Update, add, or delete expiring user targets on feature flag |
FeatureFlagsApi | PatchFeatureFlag | Patch /flags/{projectKey}/{featureFlagKey} | Perform a partial update to a feature. |
FeatureFlagsApi | PostApplyFeatureFlagApprovalRequest | Post /projects/{projectKey}/flags/{featureFlagKey}/environments/{environmentKey}/approval-requests/{featureFlagApprovalRequestId}/apply | Apply approval request for a feature flag |
FeatureFlagsApi | PostFeatureFlag | Post /flags/{projectKey} | Creates a new feature flag. |
FeatureFlagsApi | PostFeatureFlagApprovalRequest | Post /projects/{projectKey}/flags/{featureFlagKey}/environments/{environmentKey}/approval-requests/{featureFlagApprovalRequestId} | Create an approval request for a feature flag |
FeatureFlagsApi | PostReviewFeatureFlagApprovalRequest | Post /projects/{projectKey}/flags/{featureFlagKey}/environments/{environmentKey}/approval-requests/{featureFlagApprovalRequestId}/review | Review approval request for a feature flag |
IntegrationsApi | DeleteIntegrationSubscription | Delete /integrations/{integrationKey}/{integrationId} | Delete an integration subscription by ID. |
IntegrationsApi | GetIntegrationSubscription | Get /integrations/{integrationKey}/{integrationId} | Get a single integration subscription by ID. |
IntegrationsApi | GetIntegrationSubscriptions | Get /integrations/{integrationKey} | Get a list of all configured integrations of a given kind. |
IntegrationsApi | GetIntegrations | Get /integrations | Get a list of all configured audit log event integrations associated with this account. |
IntegrationsApi | PatchIntegrationSubscription | Patch /integrations/{integrationKey}/{integrationId} | Modify an integration subscription by ID. |
IntegrationsApi | PostIntegrationSubscription | Post /integrations/{integrationKey} | Create a new integration subscription of a given kind. |
ProjectsApi | DeleteProject | Delete /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. |
ProjectsApi | GetProject | Get /projects/{projectKey} | Fetch a single project by key. |
ProjectsApi | GetProjects | Get /projects | Returns a list of all projects in the account. |
ProjectsApi | PatchProject | Patch /projects/{projectKey} | Modify a project by ID. |
ProjectsApi | PostProject | Post /projects | Create a new project with the given key and name. |
RelayProxyConfigurationsApi | DeleteRelayProxyConfig | Delete /account/relay-auto-configs/{id} | Delete a relay proxy configuration by ID. |
RelayProxyConfigurationsApi | GetRelayProxyConfig | Get /account/relay-auto-configs/{id} | Get a single relay proxy configuration by ID. |
RelayProxyConfigurationsApi | GetRelayProxyConfigs | Get /account/relay-auto-configs | Returns a list of relay proxy configurations in the account. |
RelayProxyConfigurationsApi | PatchRelayProxyConfig | Patch /account/relay-auto-configs/{id} | Modify a relay proxy configuration by ID. |
RelayProxyConfigurationsApi | PostRelayAutoConfig | Post /account/relay-auto-configs | Create a new relay proxy config. |
RelayProxyConfigurationsApi | ResetRelayProxyConfig | Post /account/relay-auto-configs/{id}/reset | Reset a relay proxy configuration's secret key with an optional expiry time for the old key. |
RootApi | GetRoot | Get / | |
TeamMembersApi | DeleteMember | Delete /members/{memberId} | Delete a team member by ID. |
TeamMembersApi | GetMe | Get /members/me | Get the current team member associated with the token |
TeamMembersApi | GetMember | Get /members/{memberId} | Get a single team member by ID. |
TeamMembersApi | GetMembers | Get /members | Returns a list of all members in the account. |
TeamMembersApi | PatchMember | Patch /members/{memberId} | Modify a team member by ID. |
TeamMembersApi | PostMembers | Post /members | Invite new members. |
UserSegmentsApi | DeleteUserSegment | Delete /segments/{projectKey}/{environmentKey}/{userSegmentKey} | Delete a user segment. |
UserSegmentsApi | GetExpiringUserTargetsOnSegment | Get /segments/{projectKey}/{userSegmentKey}/expiring-user-targets/{environmentKey} | Get expiring user targets for user segment |
UserSegmentsApi | GetUserSegment | Get /segments/{projectKey}/{environmentKey}/{userSegmentKey} | Get a single user segment by key. |
UserSegmentsApi | GetUserSegments | Get /segments/{projectKey}/{environmentKey} | Get a list of all user segments in the given project. |
UserSegmentsApi | PatchExpiringUserTargetsOnSegment | Patch /segments/{projectKey}/{userSegmentKey}/expiring-user-targets/{environmentKey} | Update, add, or delete expiring user targets on user segment |
UserSegmentsApi | PatchUserSegment | Patch /segments/{projectKey}/{environmentKey}/{userSegmentKey} | Perform a partial update to a user segment. |
UserSegmentsApi | PostUserSegment | Post /segments/{projectKey}/{environmentKey} | Creates a new user segment. |
UserSegmentsApi | UpdatedUnboundedSegmentTargets | Post /segments/{projectKey}/{environmentKey}/{userSegmentKey}/unbounded-users | Update targets included or excluded in an unbounded segment |
UserSettingsApi | GetExpiringUserTargetsForUser | Get /users/{projectKey}/{userKey}/expiring-user-targets/{environmentKey} | Get expiring dates on flags for user |
UserSettingsApi | GetUserFlagSetting | Get /users/{projectKey}/{environmentKey}/{userKey}/flags/{featureFlagKey} | Fetch a single flag setting for a user by key. |
UserSettingsApi | GetUserFlagSettings | Get /users/{projectKey}/{environmentKey}/{userKey}/flags | Fetch a single flag setting for a user by key. |
UserSettingsApi | PatchExpiringUserTargetsForFlags | Patch /users/{projectKey}/{userKey}/expiring-user-targets/{environmentKey} | Update, add, or delete expiring user targets for a single user on all flags |
UserSettingsApi | PutFlagSetting | Put /users/{projectKey}/{environmentKey}/{userKey}/flags/{featureFlagKey} | Specifically enable or disable a feature flag for a user based on their key. |
UsersApi | DeleteUser | Delete /users/{projectKey}/{environmentKey}/{userKey} | Delete a user by ID. |
UsersApi | GetSearchUsers | Get /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. |
UsersApi | GetUser | Get /users/{projectKey}/{environmentKey}/{userKey} | Get a user by key. |
UsersApi | GetUsers | Get /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. |
WebhooksApi | DeleteWebhook | Delete /webhooks/{resourceId} | Delete a webhook by ID. |
WebhooksApi | GetWebhook | Get /webhooks/{resourceId} | Get a webhook by ID. |
WebhooksApi | GetWebhooks | Get /webhooks | Fetch a list of all webhooks. |
WebhooksApi | PatchWebhook | Patch /webhooks/{resourceId} | Modify a webhook by ID. |
WebhooksApi | PostWebhook | Post /webhooks | Create a webhook. |
Documentation For Models
- AuditLogEntries
- AuditLogEntry
- AuditLogEntryTarget
- Clause
- ClientSideAvailability
- CopyActions
- CustomProperty
- CustomPropertyValues
- CustomRole
- CustomRoleBody
- CustomRoles
- Defaults
- Destination
- DestinationAmazonKinesis
- DestinationBody
- DestinationGooglePubSub
- DestinationMParticle
- DestinationSegment
- Destinations
- Environment
- EnvironmentApprovalSettings
- EnvironmentPost
- EvaluationUsageError
- Events
- FeatureFlag
- FeatureFlagApprovalRequest
- FeatureFlagApprovalRequestApplyConfigBody
- FeatureFlagApprovalRequestConfigBody
- FeatureFlagApprovalRequestReview
- FeatureFlagApprovalRequestReviewConfigBody
- FeatureFlagApprovalRequestReviewStatus
- FeatureFlagApprovalRequests
- FeatureFlagBody
- FeatureFlagConfig
- FeatureFlagCopyBody
- FeatureFlagCopyObject
- FeatureFlagScheduledChange
- FeatureFlagScheduledChanges
- FeatureFlagScheduledChangesConflicts
- FeatureFlagScheduledChangesConflictsInstructions
- FeatureFlagStatus
- FeatureFlagStatusAcrossEnvironments
- FeatureFlagStatusForQueriedEnvironment
- FeatureFlagStatuses
- FeatureFlags
- FlagListItem
- HierarchicalLinks
- Id
- Integration
- IntegrationLinks
- IntegrationSubscription
- IntegrationSubscriptionStatus
- Integrations
- Link
- Links
- MaUbyCategory
- Mau
- MauMetadata
- Member
- Members
- MembersBody
- ModelFallthrough
- PatchComment
- PatchOperation
- Policy
- Prerequisite
- Project
- ProjectBody
- Projects
- RelayProxyConfig
- RelayProxyConfigBody
- RelayProxyConfigs
- Role
- Rollout
- Rule
- ScheduledChangesFeatureFlagConflict
- SemanticPatchInstruction
- SemanticPatchInstructionInner
- SemanticPatchOperation
- Site
- Statement
- Stream
- StreamBySdk
- StreamBySdkLinks
- StreamBySdkLinksMetadata
- StreamLinks
- StreamSdkVersion
- StreamSdkVersionData
- StreamUsageError
- StreamUsageLinks
- StreamUsageMetadata
- StreamUsageSeries
- Streams
- SubscriptionBody
- Target
- Token
- TokenBody
- Tokens
- UnboundedSegmentTargetChanges
- UnboundedSegmentTargetsBody
- Usage
- UsageError
- UsageLinks
- User
- UserFlagSetting
- UserFlagSettings
- UserRecord
- UserSegment
- UserSegmentBody
- UserSegmentRule
- UserSegments
- UserSettingsBody
- UserTargetingExpirationForFlag
- UserTargetingExpirationForFlags
- UserTargetingExpirationForSegment
- UserTargetingExpirationOnFlagsForUser
- UserTargetingExpirationResourceIdForFlag
- Users
- Variation
- Webhook
- WebhookBody
- Webhooks
- WeightedVariation
Author
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 FeatureFlagApprovalRequestReviewStatus.
List of FeatureFlagChangeRequestReviewStatus.
List of FeatureFlagApprovalRequestReviewStatus.
List of FeatureFlagChangeRequestReviewStatus.
List of Role.
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
APIClient manages communication with the LaunchDarkly REST API API v4.0.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
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
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
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
GenericSwaggerError Provides access to the body, error and model on returned errors.
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
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
# Type aliases
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
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