Skip to content

Latest commit

 

History

History
327 lines (304 loc) · 30.1 KB

README.md

File metadata and controls

327 lines (304 loc) · 30.1 KB

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

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. 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.
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 DeleteApprovalRequest Delete /projects/{projectKey}/flags/{featureFlagKey}/environments/{environmentKey}/approval-requests/{approvalRequestId} Delete an approval request for a feature flag config
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 DeleteFlagConfigScheduledChanges Delete /projects/{projectKey}/flags/{featureFlagKey}/environments/{environmentKey}/scheduled-changes/{scheduledChangeId} Delete a scheduled change on a feature flag in an environment.
FeatureFlagsApi FlagsProjectKeyEnvironmentKeyFeatureFlagKeyDependentFlagsGet Get /flags/{projectKey}/{environmentKey}/{featureFlagKey}/dependent-flags Get dependent flags for the flag in the environment specified in path parameters
FeatureFlagsApi FlagsProjectKeyFeatureFlagKeyDependentFlagsGet Get /flags/{projectKey}/{featureFlagKey}/dependent-flags Get dependent flags across all environments for the flag specified in the path parameters
FeatureFlagsApi GetApprovalRequest Get /projects/{projectKey}/flags/{featureFlagKey}/environments/{environmentKey}/approval-requests/{approvalRequestId} Get a single approval request for a feature flag config
FeatureFlagsApi GetApprovalRequests Get /projects/{projectKey}/flags/{featureFlagKey}/environments/{environmentKey}/approval-requests Get all approval requests for a feature flag config
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 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 GetFlagConfigScheduledChange Get /projects/{projectKey}/flags/{featureFlagKey}/environments/{environmentKey}/scheduled-changes/{scheduledChangeId} Get a scheduled change on a feature flag by id.
FeatureFlagsApi GetFlagConfigScheduledChanges Get /projects/{projectKey}/flags/{featureFlagKey}/environments/{environmentKey}/scheduled-changes Get all scheduled workflows for a feature flag by key.
FeatureFlagsApi GetFlagConfigScheduledChangesConflicts Post /projects/{projectKey}/flags/{featureFlagKey}/environments/{environmentKey}/scheduled-changes-conflicts Lists conflicts between the given instructions and any existing scheduled changes for the feature flag. The actual HTTP verb should be REPORT, not POST.
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 PatchFlagConfigScheduledChange Patch /projects/{projectKey}/flags/{featureFlagKey}/environments/{environmentKey}/scheduled-changes/{scheduledChangeId} Updates an existing scheduled-change on a feature flag in an environment.
FeatureFlagsApi PostApplyApprovalRequest Post /projects/{projectKey}/flags/{featureFlagKey}/environments/{environmentKey}/approval-requests/{approvalRequestId}/apply Apply approval request for a feature flag config
FeatureFlagsApi PostApprovalRequest Post /projects/{projectKey}/flags/{featureFlagKey}/environments/{environmentKey}/approval-requests/{approvalRequestId} Create an approval request for a feature flag config
FeatureFlagsApi PostFeatureFlag Post /flags/{projectKey} Creates a new feature flag.
FeatureFlagsApi PostFlagConfigScheduledChanges Post /projects/{projectKey}/flags/{featureFlagKey}/environments/{environmentKey}/scheduled-changes Creates a new scheduled change for a feature flag.
FeatureFlagsApi PostReviewApprovalRequest Post /projects/{projectKey}/flags/{featureFlagKey}/environments/{environmentKey}/approval-requests/{approvalRequestId}/review Review approval request for a feature flag config
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 UpdateBigSegmentTargets Post /segments/{projectKey}/{environmentKey}/{userSegmentKey}/users Update targets included or excluded in a big 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

Author

support@launchdarkly.com

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
}