Documentation ¶
Index ¶
- Constants
- type Client
- func (c *Client) FeatureEnabled(name string) (bool, error)
- func (c *Client) FeatureEnabledWithContext(ctx context.Context, name string) (bool, error)
- func (c *Client) GetFeatures() ([]Flag, error)
- func (c *Client) GetFeaturesWithContext(ctx context.Context) ([]Flag, error)
- func (c *Client) GetTrait(user User, key string) (*Trait, error)
- func (c *Client) GetTraitWithContext(ctx context.Context, user User, key string) (*Trait, error)
- func (c *Client) GetTraits(user User, keys ...string) ([]*Trait, error)
- func (c *Client) GetTraitsWithContext(ctx context.Context, user User, keys ...string) ([]*Trait, error)
- func (c *Client) GetUserFeatures(user User) ([]Flag, error)
- func (c *Client) GetUserFeaturesWithContext(ctx context.Context, user User) ([]Flag, error)
- func (c *Client) GetUserValue(user User, name string) (interface{}, error)
- func (c *Client) GetUserValueWithContext(ctx context.Context, user User, name string) (interface{}, error)
- func (c *Client) GetValue(name string) (interface{}, error)
- func (c *Client) GetValueWithContext(ctx context.Context, name string) (interface{}, error)
- func (c *Client) HasFeature(name string) (bool, error)
- func (c *Client) HasFeatureWithContext(ctx context.Context, name string) (bool, error)
- func (c *Client) HasUserFeature(user User, name string) (bool, error)
- func (c *Client) HasUserFeatureWithContext(ctx context.Context, user User, name string) (bool, error)
- func (c *Client) RemoveProxy()
- func (c *Client) SetProxy(proxyUrl string)
- func (c *Client) UpdateTrait(user User, toUpdate *Trait) (*Trait, error)
- func (c *Client) UpdateTraitWithContext(ctx context.Context, user User, toUpdate *Trait) (*Trait, error)
- func (c *Client) UpdateTraits(user User, object interface{}) ([]*Trait, error)
- func (c *Client) UpdateTraitsWithContext(ctx context.Context, user User, object interface{}) ([]*Trait, error)
- func (c *Client) UserFeatureEnabled(user User, name string) (bool, error)
- func (c *Client) UserFeatureEnabledWithContext(ctx context.Context, user User, name string) (bool, error)
- type Config
- type Feature
- type Flag
- type Trait
- type User
Constants ¶
const ( // DefaultTimeout is a default timeout for HTTP client DefaultTimeout = 5 * time.Second // DefaultBaseURI is a default URI DefaultBaseURI = "https://api.bullet-train.io/api/v1/" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client provides various methods to query BulletTrain API
func DefaultClient ¶
DefaultClient returns new Client with default configuration
func (*Client) FeatureEnabled ¶
FeatureEnabled returns information whether given feature flag is enabled
func (*Client) FeatureEnabledWithContext ¶
FeatureEnabledWithContext returns information whether given feature flag is enabled
func (*Client) GetFeatures ¶
GetFeatures returns all features available in given environment
func (*Client) GetFeaturesWithContext ¶
GetFeaturesWithContext returns all features available in given environment
func (*Client) GetTraitWithContext ¶
GetTraitWithContext returns trait defined for given user
func (*Client) GetTraits ¶
GetTraits returns traits defined for given user
If keys are provided, GetTrais returns only corresponding traits, otherwise all traits for given user are returned.
func (*Client) GetTraitsWithContext ¶
func (c *Client) GetTraitsWithContext(ctx context.Context, user User, keys ...string) ([]*Trait, error)
GetTraitsWithContext returns traits defined for given user
If keys are provided, GetTrais returns only corresponding traits, otherwise all traits for given user are returned.
func (*Client) GetUserFeatures ¶
GetUserFeatures returns all features as defined for given user
func (*Client) GetUserFeaturesWithContext ¶
GetUserFeaturesWithContext returns all features as defined for given user
func (*Client) GetUserValue ¶
GetUserValue return value of given feature (remote config) as defined for given user
Returned value can have one of following types: bool, int, string
func (*Client) GetUserValueWithContext ¶
func (c *Client) GetUserValueWithContext(ctx context.Context, user User, name string) (interface{}, error)
GetUserValueWithContext return value of given feature (remote config) as defined for given user
Returned value can have one of following types: bool, int, string
func (*Client) GetValue ¶
GetValue returns value of given feature (remote config)
Returned value can have one of following types: bool, int, string
func (*Client) GetValueWithContext ¶
GetValueWithContext returns value of given feature (remote config)
Returned value can have one of following types: bool, int, string
func (*Client) HasFeature ¶
HasFeature returns information whether given feature is defined
func (*Client) HasFeatureWithContext ¶
HasFeatureWithContext returns information whether given feature is defined
func (*Client) HasUserFeature ¶
HasUserFeature returns information whether given feature is defined for given user
func (*Client) HasUserFeatureWithContext ¶
func (c *Client) HasUserFeatureWithContext(ctx context.Context, user User, name string) (bool, error)
HasUserFeatureWithContext returns information whether given feature is defined for given user
func (*Client) RemoveProxy ¶
func (c *Client) RemoveProxy()
func (*Client) UpdateTrait ¶
UpdateTrait updates trait value
func (*Client) UpdateTraitWithContext ¶
func (c *Client) UpdateTraitWithContext(ctx context.Context, user User, toUpdate *Trait) (*Trait, error)
UpdateTraitWithContext updates trait vaule with context
func (*Client) UpdateTraits ¶
UpdateTraits updates trait values in bulk. The object argument may be a []Trait, []*Trait or a struct. If object is []Trait or []*Trait then their Identity field may be mutated. If object is a struct then the struct will be inspected and each key value pair will be considered as a separate trait to be updated.
func (*Client) UpdateTraitsWithContext ¶
func (c *Client) UpdateTraitsWithContext(ctx context.Context, user User, object interface{}) ([]*Trait, error)
UpdateTraitsWithContext updates trait values in bulk. The object argument may be a []Trait, []*Trait or a struct. If object is []Trait or []*Trait then their Identity field may be mutated. If object is a struct then the struct will be inspected and each key value pair will be considered as a separate trait to be updated.
func (*Client) UserFeatureEnabled ¶
UserFeatureEnabled returns information whether given feature flag is enabled for given user
type Feature ¶
type Feature struct { Name string `json:"name"` Type string `json:"type"` Description string `json:"description"` }
Feature contains core information about feature
type Flag ¶
type Flag struct { Feature Feature `json:"feature"` StateValue interface{} `json:"feature_state_value"` Enabled bool `json:"enabled"` }
Flag contains information about Feature and it's value