Documentation ¶
Index ¶
- Constants
- type AnalyticsProcessor
- type Client
- func (c *Client) BulkIdentify(batch []*IdentityTraits) error
- func (c *Client) GeIdentitySegments(identifier string, traits []*Trait) ([]*segments.SegmentModel, error)
- func (c *Client) GetEnvironmentFlags() (Flags, error)
- func (c *Client) GetEnvironmentFlagsFromAPI(ctx context.Context) (Flags, error)
- func (c *Client) GetEnvironmentFlagsFromDocument(ctx context.Context, env *environments.EnvironmentModel) (Flags, error)
- func (c *Client) GetIdentityFlags(identifier string, traits []*Trait) (Flags, error)
- func (c *Client) GetIdentityFlagsFromAPI(ctx context.Context, identifier string, traits []*Trait) (Flags, error)
- func (c *Client) GetIdentityFlagsFromDocument(ctx context.Context, env *environments.EnvironmentModel, identifier string, ...) (Flags, error)
- func (c *Client) UpdateEnvironment(ctx context.Context) error
- type Flag
- type Flags
- type FlagsmithAPIError
- type FlagsmithClientError
- type IdentityTraits
- type Option
- func WithAnalytics() Option
- func WithBaseURL(url string) Option
- func WithContext(ctx context.Context) Option
- func WithCustomHeaders(headers map[string]string) Option
- func WithDefaultHandler(handler func(string) Flag) Option
- func WithEnvironmentRefreshInterval(interval time.Duration) Option
- func WithLocalEvaluation() Option
- func WithRemoteEvaluation() Option
- func WithRequestTimeout(timeout time.Duration) Option
- func WithRetries(count int, waitTime time.Duration) Option
- type Trait
Constants ¶
View Source
const ( // Number of seconds to wait for a request to // complete before terminating the request DefaultTimeout = 10 * time.Second // Default base URL for the API DefaultBaseURL = "https://edge.api.flagsmith.com/api/v1/" )
View Source
const AnalyticsEndpoint = "analytics/flags/"
View Source
const AnalyticsTimerInMilli = 10 * 1000
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AnalyticsProcessor ¶
type AnalyticsProcessor struct {
// contains filtered or unexported fields
}
func NewAnalyticsProcessor ¶
func NewAnalyticsProcessor(ctx context.Context, client *resty.Client, baseURL string, timerInMilli *int) *AnalyticsProcessor
func (*AnalyticsProcessor) Flush ¶
func (a *AnalyticsProcessor) Flush(ctx context.Context)
func (*AnalyticsProcessor) TrackFeature ¶
func (a *AnalyticsProcessor) TrackFeature(featureName string)
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client provides various methods to query Flagsmith API
func (*Client) BulkIdentify ¶ added in v2.1.0
func (c *Client) BulkIdentify(batch []*IdentityTraits) error
BulkIdentify can be used to create/overwrite identities(with traits) in bulk NOTE: This method only works with Edge API endpoint
func (*Client) GeIdentitySegments ¶
func (c *Client) GeIdentitySegments(identifier string, traits []*Trait) ([]*segments.SegmentModel, error)
Returns an array of segments that the given identity is part of
func (*Client) GetEnvironmentFlags ¶
Returns `Flags` struct holding all the flags for the current environment
func (*Client) GetEnvironmentFlagsFromAPI ¶
func (*Client) GetEnvironmentFlagsFromDocument ¶
func (c *Client) GetEnvironmentFlagsFromDocument(ctx context.Context, env *environments.EnvironmentModel) (Flags, error)
func (*Client) GetIdentityFlags ¶
Returns `Flags` struct holding all the flags for the current environment for a given identity. Will also upsert all traits to the Flagsmith API for future evaluations. Providing a trait with a value of nil will remove the trait from the identity if it exists.
func (*Client) GetIdentityFlagsFromAPI ¶
func (*Client) GetIdentityFlagsFromDocument ¶
func (c *Client) GetIdentityFlagsFromDocument(ctx context.Context, env *environments.EnvironmentModel, identifier string, traits []*Trait) (Flags, error)
type Flags ¶
type Flags struct {
// contains filtered or unexported fields
}
func (*Flags) GetFeatureValue ¶
Returns the value of a particular flag
type FlagsmithAPIError ¶
type FlagsmithAPIError struct {
// contains filtered or unexported fields
}
func (FlagsmithAPIError) Error ¶
func (e FlagsmithAPIError) Error() string
type FlagsmithClientError ¶
type FlagsmithClientError struct {
// contains filtered or unexported fields
}
func (FlagsmithClientError) Error ¶
func (e FlagsmithClientError) Error() string
type IdentityTraits ¶ added in v2.1.0
type Option ¶
type Option func(c *Client)
func WithAnalytics ¶
func WithAnalytics() Option
func WithBaseURL ¶
func WithContext ¶
func WithCustomHeaders ¶
func WithDefaultHandler ¶
func WithLocalEvaluation ¶
func WithLocalEvaluation() Option
func WithRemoteEvaluation ¶
func WithRemoteEvaluation() Option
func WithRequestTimeout ¶
type Trait ¶
type Trait struct { TraitKey string `json:"trait_key"` TraitValue interface{} `json:"trait_value"` }
func (*Trait) ToTraitModel ¶
func (t *Trait) ToTraitModel() *traits.TraitModel
Source Files ¶
Click to show internal directories.
Click to hide internal directories.