flagsmithapi

package module
v0.9.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 25, 2024 License: BSD-3-Clause Imports: 7 Imported by: 0

README

Feature Flag, Remote Config and A/B Testing platform, Flagsmith

Flagsmith is an open source, fully featured, Feature Flag and Remote Config service. Use our hosted API, deploy to your own private cloud, or run on-premise.

Flagsmith Go Admin API Client

This project provides a very(currently) limited access to the Flagsmith Admin APIs using Master API Key.

Documentation

Index

Constants

View Source
const BaseAPIURL = "https://api.flagsmith.com/api/v1"

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

func NewClient

func NewClient(masterAPIKey string, baseURL string) *Client

func (*Client) AddFeatureOwners added in v0.5.0

func (c *Client) AddFeatureOwners(feature *Feature, ownerIDs []int64) error

func (*Client) CreateEnvironment added in v0.9.0

func (c *Client) CreateEnvironment(environment *Environment) error

func (*Client) CreateFeature added in v0.1.0

func (c *Client) CreateFeature(feature *Feature) error

func (*Client) CreateFeatureMVOption added in v0.2.0

func (c *Client) CreateFeatureMVOption(featureMVOption *FeatureMultivariateOption) error

func (*Client) CreateFeatureSegment added in v0.4.0

func (c *Client) CreateFeatureSegment(featureSegment *FeatureSegment) error

func (*Client) CreateIdentity added in v0.9.0

func (c *Client) CreateIdentity(environmentKey string, identity *Identity) error

func (*Client) CreateProject added in v0.9.0

func (c *Client) CreateProject(project *Project) error

func (*Client) CreateSegment added in v0.3.0

func (c *Client) CreateSegment(segment *Segment) error

func (*Client) CreateSegmentOverride added in v0.4.0

func (c *Client) CreateSegmentOverride(featureState *FeatureState) error

func (*Client) CreateServerSideEnvKey added in v0.9.0

func (c *Client) CreateServerSideEnvKey(environmentKey string, key *ServerSideEnvKey) error

func (*Client) CreateTag added in v0.8.0

func (c *Client) CreateTag(tag *Tag) error

func (*Client) CreateTrait added in v0.9.0

func (c *Client) CreateTrait(environmentKey string, identityID int64, trait *Trait) error

func (*Client) DeleteEnvironment added in v0.9.0

func (c *Client) DeleteEnvironment(apiKey string) error

func (*Client) DeleteFeature added in v0.1.0

func (c *Client) DeleteFeature(projectID, featureID int64) error

func (*Client) DeleteFeatureMVOption added in v0.2.0

func (c *Client) DeleteFeatureMVOption(projectID, featureID, mvOptionID int64) error

func (*Client) DeleteFeatureSegment added in v0.4.0

func (c *Client) DeleteFeatureSegment(featureSegmentID int64) error

func (*Client) DeleteIdentity added in v0.9.0

func (c *Client) DeleteIdentity(environmentKey string, identityID int64) error

func (*Client) DeleteProject added in v0.9.0

func (c *Client) DeleteProject(projectID int64) error

func (*Client) DeleteSegment added in v0.3.0

func (c *Client) DeleteSegment(projectID, segmentID int64) error

func (*Client) DeleteServerSideEnvKey added in v0.9.0

func (c *Client) DeleteServerSideEnvKey(environmentKey string, keyID int64) error

func (*Client) DeleteTag added in v0.8.0

func (c *Client) DeleteTag(projectID, tagID int64) error

func (*Client) DeleteTrait added in v0.9.0

func (c *Client) DeleteTrait(environmentKey string, identityID int64, traitID int64) error

func (*Client) GetEnvironment added in v0.4.0

func (c *Client) GetEnvironment(apiKey string) (*Environment, error)

func (*Client) GetEnvironmentFeatureState

func (c *Client) GetEnvironmentFeatureState(environmentKey string, featureID int64) (*FeatureState, error)

Get the feature state associated with the environment for a given feature

func (*Client) GetFeature added in v0.1.0

func (c *Client) GetFeature(featureUUID string) (*Feature, error)

func (*Client) GetFeatureMVOption added in v0.2.0

func (c *Client) GetFeatureMVOption(featureUUID, mvOptionUUID string) (*FeatureMultivariateOption, error)

func (*Client) GetFeatureSegmentByID added in v0.4.0

func (c *Client) GetFeatureSegmentByID(featureSegmentID int64) (*FeatureSegment, error)

func (*Client) GetFeatureState added in v0.4.0

func (c *Client) GetFeatureState(featureStateUUID string) (*FeatureState, error)

func (*Client) GetIdentity added in v0.9.0

func (c *Client) GetIdentity(environmentKey string, identityID int64) (*Identity, error)

func (*Client) GetProject added in v0.1.0

func (c *Client) GetProject(projectUUID string) (*Project, error)

func (*Client) GetProjectByID added in v0.1.0

func (c *Client) GetProjectByID(projectID int64) (*Project, error)

func (*Client) GetSegment added in v0.3.0

func (c *Client) GetSegment(segmentUUID string) (*Segment, error)

func (*Client) GetServerSideEnvKeys added in v0.9.0

func (c *Client) GetServerSideEnvKeys(environmentKey string) ([]ServerSideEnvKey, error)

func (*Client) GetTag added in v0.8.0

func (c *Client) GetTag(projectUUID string, tagUUID string) (*Tag, error)

func (*Client) GetTraits added in v0.9.0

func (c *Client) GetTraits(environmentKey string, identityID int64) ([]Trait, error)

func (*Client) RemoveFeatureOwners added in v0.5.0

func (c *Client) RemoveFeatureOwners(feature *Feature, ownerIDs []int64) error

func (*Client) UpdateEnvironment added in v0.9.0

func (c *Client) UpdateEnvironment(environment *Environment) error

func (*Client) UpdateFeature added in v0.1.0

func (c *Client) UpdateFeature(feature *Feature) error

func (*Client) UpdateFeatureMVOption added in v0.2.0

func (c *Client) UpdateFeatureMVOption(featureMVOption *FeatureMultivariateOption) error

func (*Client) UpdateFeatureSegmentPriority added in v0.4.0

func (c *Client) UpdateFeatureSegmentPriority(featureSegmentID, priority int64) error

func (*Client) UpdateFeatureState

func (c *Client) UpdateFeatureState(featureState *FeatureState, updateSegmentPriority bool) error

Update the feature state

func (*Client) UpdateProject added in v0.9.0

func (c *Client) UpdateProject(project *Project) error

func (*Client) UpdateSegment added in v0.3.0

func (c *Client) UpdateSegment(segment *Segment) error

func (*Client) UpdateServerSideEnvKey added in v0.9.0

func (c *Client) UpdateServerSideEnvKey(environmentKey string, key *ServerSideEnvKey) error

func (*Client) UpdateTag added in v0.8.0

func (c *Client) UpdateTag(tag *Tag) error

func (*Client) UpdateTrait added in v0.9.0

func (c *Client) UpdateTrait(environmentKey string, identityID int64, trait *Trait) error

type Condition added in v0.3.0

type Condition struct {
	Operator string `json:"operator"`
	Property string `json:"property"`
	Value    string `json:"value"`
}

type Environment added in v0.4.0

type Environment struct {
	ID                                int64  `json:"id,omitempty"`
	Name                              string `json:"name"`
	APIKey                            string `json:"api_key,omitempty"`
	Description                       string `json:"description"`
	Project                           int64  `json:"project"`
	AllowClientTraits                 bool   `json:"allow_client_traits,omitempty"`
	BannerText                        string `json:"banner_text,omitempty"`
	BannerColour                      string `json:"banner_colour,omitempty"`
	HideDisabledFlags                 bool   `json:"hide_disabled_flags,omitempty"`
	HideSensitiveData                 bool   `json:"hide_sensitive_data,omitempty"`
	UseIdentityCompositeKeyForHashing bool   `json:"use_identity_composite_key_for_hashing,omitempty"`
}

type Feature added in v0.1.0

type Feature struct {
	Name           string   `json:"name"`
	UUID           string   `json:"uuid,omitempty"`
	ID             *int64   `json:"id,omitempty"`
	Type           *string  `json:"type,omitempty"`
	Description    *string  `json:"description,omitempty"`
	InitialValue   string   `json:"initial_value,omitempty"`
	DefaultEnabled bool     `json:"default_enabled,omitempty"`
	IsArchived     bool     `json:"is_archived,omitempty"`
	Owners         *[]int64 `json:"owners,omitempty"`
	Tags           []int64  `json:"tags"`

	ProjectUUID string `json:"-"`
	ProjectID   *int64 `json:"project,omitempty"`
}

func (*Feature) UnmarshalJSON added in v0.5.0

func (f *Feature) UnmarshalJSON(data []byte) error

type FeatureMVOptionNotFoundError added in v0.6.0

type FeatureMVOptionNotFoundError struct {
	// contains filtered or unexported fields
}

func (FeatureMVOptionNotFoundError) Error added in v0.6.0

type FeatureMultivariateOption added in v0.2.0

type FeatureMultivariateOption struct {
	ID                          int64   `json:"id,omitempty"`
	Type                        string  `json:"type"`
	UUID                        string  `json:"uuid,omitempty"`
	FeatureID                   *int64  `json:"feature,omitempty"`
	IntegerValue                *int64  `json:"integer_value,omitempty"`
	StringValue                 *string `json:"string_value,omitempty"`
	BooleanValue                *bool   `json:"boolean_value,omitempty"`
	DefaultPercentageAllocation float64 `json:"default_percentage_allocation"`

	FeatureUUID string `json:"-"`
	ProjectID   *int64 `json:"-"`
}

type FeatureNotFoundError added in v0.6.0

type FeatureNotFoundError struct {
	// contains filtered or unexported fields
}

func (FeatureNotFoundError) Error added in v0.6.0

func (e FeatureNotFoundError) Error() string

type FeatureSegment added in v0.4.0

type FeatureSegment struct {
	ID          *int64 `json:"id,omitempty"`
	Feature     int64  `json:"feature"`
	Segment     *int64 `json:"segment"`
	Environment int64  `json:"environment"`
	Priority    *int64 `json:"priority"`
}

type FeatureState

type FeatureState struct {
	ID                int64              `json:"id,omitempty"`
	UUID              string             `json:"uuid,omitempty"`
	FeatureStateValue *FeatureStateValue `json:"feature_state_value"`
	Enabled           bool               `json:"enabled"`
	Feature           int64              `json:"feature"`
	Environment       *int64             `json:"environment"`
	FeatureSegment    *int64             `json:"feature_segment,omitempty"`

	EnvironmentKey  string `json:"-"`
	Segment         *int64 `json:"-"`
	SegmentPriority *int64 `json:"-"`
}

func (*FeatureState) UnmarshalJSON

func (fs *FeatureState) UnmarshalJSON(data []byte) error

type FeatureStateNotFoundError added in v0.6.0

type FeatureStateNotFoundError struct {
	// contains filtered or unexported fields
}

func (FeatureStateNotFoundError) Error added in v0.6.0

type FeatureStateValue

type FeatureStateValue struct {
	Type         string  `json:"type"`
	StringValue  *string `json:"string_value"`
	IntegerValue *int64  `json:"integer_value"`
	BooleanValue *bool   `json:"boolean_value"`
}

type Identity added in v0.9.0

type Identity struct {
	ID         *int64 `json:"id,omitempty"`
	Identifier string `json:"identifier"`
}

type Project added in v0.1.0

type Project struct {
	ID                             int64  `json:"id,omitempty"`
	UUID                           string `json:"uuid,omitempty"`
	Name                           string `json:"name"`
	Organisation                   int64  `json:"organisation"`
	HideDisabledFlags              bool   `json:"hide_disabled_flags,omitempty"`
	PreventFlagDefaults            bool   `json:"prevent_flag_defaults,omitempty"`
	OnlyAllowLowerCaseFeatureNames bool   `json:"only_allow_lower_case_feature_names,omitempty"`
	FeatureNameRegex               bool   `json:"feature_name_regex,omitempty"`
}

type Rule added in v0.3.0

type Rule struct {
	Type       string      `json:"type"`
	Rules      []Rule      `json:"rules,omitempty"`
	Conditions []Condition `json:"conditions,omitempty"`
}

type Segment added in v0.3.0

type Segment struct {
	ID          *int64  `json:"id,omitempty"`
	UUID        string  `json:"uuid,omitempty"`
	Name        string  `json:"name"`
	Description *string `json:"description,omitempty"`
	ProjectID   *int64  `json:"project"`
	ProjectUUID string  `json:"-"`
	FeatureID   *int64  `json:"feature,omitempty"`
	Rules       []Rule  `json:"rules"`
}

type SegmentNotFoundError added in v0.6.0

type SegmentNotFoundError struct {
	// contains filtered or unexported fields
}

func (SegmentNotFoundError) Error added in v0.6.0

func (e SegmentNotFoundError) Error() string

type ServerSideEnvKey added in v0.9.0

type ServerSideEnvKey struct {
	ID        int64      `json:"id,omitempty"`
	Active    bool       `json:"active"`
	Name      string     `json:"name,omitempty"`
	Key       string     `json:"key,omitempty"`
	ExpiresAt *time.Time `json:"expires_at,omitempty"`
	CreatedAt *time.Time `json:"created_at,omitempty"`
}

type Tag added in v0.8.0

type Tag struct {
	ID          *int64  `json:"id,omitempty"`
	UUID        string  `json:"uuid,omitempty"`
	Name        string  `json:"label"`
	Description *string `json:"description"`
	Colour      string  `json:"color"`

	ProjectUUID string `json:"-"`
	ProjectID   *int64 `json:"project,omitempty"`
}

type Trait added in v0.9.0

type Trait struct {
	ID           int64    `json:"id,omitempty"`
	TraitKey     string   `json:"trait_key"`
	ValueType    string   `json:"value_type"`
	IntegerValue *int     `json:"integer_value,omitempty"`
	StringValue  *string  `json:"string_value,omitempty"`
	BooleanValue *bool    `json:"boolean_value,omitempty"`
	FloatValue   *float64 `json:"float_value,omitempty"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL