flagsmithapi

package module
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Sep 30, 2022 License: BSD-3-Clause Imports: 4 Imported by: 1

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) CreateFeature added in v0.1.0

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

func (*Client) DeleteFeature added in v0.1.0

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

func (*Client) GetEnvironmentFeatureState

func (c *Client) GetEnvironmentFeatureState(environmentAPIKey string, featureName string) (*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) 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) UpdateFeature added in v0.1.0

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

func (*Client) UpdateFeatureState

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

Update the feature state

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"`
	MultivariateOptions *[]MultivariateOption `json:"multivariate_options,omitempty"`

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

type FeatureState

type FeatureState struct {
	ID                int64              `json:"id"`
	FeatureStateValue *FeatureStateValue `json:"feature_state_value"`
	Enabled           bool               `json:"enabled"`
	Feature           int64              `json:"feature"`
	Environment       int64              `json:"environment"`
}

func (*FeatureState) UnmarshalJSON

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

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 MultivariateOption added in v0.1.0

type MultivariateOption struct {
	Type                        string  `json:"type"`
	ID                          *int64  `json:"id,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"`
}

type Project added in v0.1.0

type Project struct {
	ID           int64  `json:"id"`
	UUID         string `json:"uuid"`
	Name         string `json:"name"`
	Organisation int64  `json:"organisation"`
}

Jump to

Keyboard shortcuts

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