Documentation
¶
Overview ¶
Package client has client definitions
Package client has client facing factories
Index ¶
- type OptimizelyClient
- func (o *OptimizelyClient) Activate(experimentKey string, userContext entities.UserContext) (result string, err error)
- func (o *OptimizelyClient) Close()
- func (o *OptimizelyClient) GetAllFeatureVariables(featureKey string, userContext entities.UserContext) (enabled bool, variableMap map[string]string, err error)
- func (o *OptimizelyClient) GetEnabledFeatures(userContext entities.UserContext) (enabledFeatures []string, err error)
- func (o *OptimizelyClient) GetFeatureVariable(featureKey, variableKey string, userContext entities.UserContext) (value string, valueType entities.VariableType, err error)
- func (o *OptimizelyClient) GetFeatureVariableBoolean(featureKey, variableKey string, userContext entities.UserContext) (value bool, err error)
- func (o *OptimizelyClient) GetFeatureVariableDouble(featureKey, variableKey string, userContext entities.UserContext) (value float64, err error)
- func (o *OptimizelyClient) GetFeatureVariableInteger(featureKey, variableKey string, userContext entities.UserContext) (value int, err error)
- func (o *OptimizelyClient) GetFeatureVariableString(featureKey, variableKey string, userContext entities.UserContext) (value string, err error)
- func (o *OptimizelyClient) GetProjectConfig() (projectConfig pkg.ProjectConfig, err error)
- func (o *OptimizelyClient) GetVariation(experimentKey string, userContext entities.UserContext) (result string, err error)
- func (o *OptimizelyClient) IsFeatureEnabled(featureKey string, userContext entities.UserContext) (result bool, err error)
- func (o *OptimizelyClient) Track(eventKey string, userContext entities.UserContext, ...) (err error)
- type OptimizelyFactory
- type OptionFunc
- func WithBatchEventProcessor(batchSize, queueSize int, flushInterval time.Duration) OptionFunc
- func WithCompositeDecisionService(sdkKey string) OptionFunc
- func WithConfigManager(configManager pkg.ProjectConfigManager) OptionFunc
- func WithDecisionService(decisionService decision.Service) OptionFunc
- func WithEventProcessor(eventProcessor event.Processor) OptionFunc
- func WithExecutionContext(executionContext utils.ExecutionCtx) OptionFunc
- func WithPollingConfigManager(sdkKey string, pollingInterval time.Duration, initDataFile []byte) OptionFunc
- func WithPollingConfigManagerRequester(requester utils.Requester, pollingInterval time.Duration, initDataFile []byte) OptionFunc
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type OptimizelyClient ¶
type OptimizelyClient struct { ConfigManager pkg.ProjectConfigManager DecisionService decision.Service EventProcessor event.Processor // contains filtered or unexported fields }
OptimizelyClient is the entry point to the Optimizely SDK
func (*OptimizelyClient) Activate ¶
func (o *OptimizelyClient) Activate(experimentKey string, userContext entities.UserContext) (result string, err error)
Activate returns the key of the variation the user is bucketed into and sends an impression event to the Optimizely log endpoint
func (*OptimizelyClient) Close ¶
func (o *OptimizelyClient) Close()
Close closes the Optimizely instance and stops any ongoing tasks from its children components
func (*OptimizelyClient) GetAllFeatureVariables ¶
func (o *OptimizelyClient) GetAllFeatureVariables(featureKey string, userContext entities.UserContext) (enabled bool, variableMap map[string]string, err error)
GetAllFeatureVariables returns all the variables for a given feature along with the enabled state
func (*OptimizelyClient) GetEnabledFeatures ¶
func (o *OptimizelyClient) GetEnabledFeatures(userContext entities.UserContext) (enabledFeatures []string, err error)
GetEnabledFeatures returns an array containing the keys of all features in the project that are enabled for the given user.
func (*OptimizelyClient) GetFeatureVariable ¶
func (o *OptimizelyClient) GetFeatureVariable(featureKey, variableKey string, userContext entities.UserContext) (value string, valueType entities.VariableType, err error)
GetFeatureVariable returns feature as a string along with it's associated type
func (*OptimizelyClient) GetFeatureVariableBoolean ¶
func (o *OptimizelyClient) GetFeatureVariableBoolean(featureKey, variableKey string, userContext entities.UserContext) (value bool, err error)
GetFeatureVariableBoolean returns boolean feature variable value
func (*OptimizelyClient) GetFeatureVariableDouble ¶
func (o *OptimizelyClient) GetFeatureVariableDouble(featureKey, variableKey string, userContext entities.UserContext) (value float64, err error)
GetFeatureVariableDouble returns double feature variable value
func (*OptimizelyClient) GetFeatureVariableInteger ¶
func (o *OptimizelyClient) GetFeatureVariableInteger(featureKey, variableKey string, userContext entities.UserContext) (value int, err error)
GetFeatureVariableInteger returns integer feature variable value
func (*OptimizelyClient) GetFeatureVariableString ¶
func (o *OptimizelyClient) GetFeatureVariableString(featureKey, variableKey string, userContext entities.UserContext) (value string, err error)
GetFeatureVariableString returns string feature variable value
func (*OptimizelyClient) GetProjectConfig ¶
func (o *OptimizelyClient) GetProjectConfig() (projectConfig pkg.ProjectConfig, err error)
GetProjectConfig returns the current ProjectConfig or nil if the instance is not valid
func (*OptimizelyClient) GetVariation ¶
func (o *OptimizelyClient) GetVariation(experimentKey string, userContext entities.UserContext) (result string, err error)
GetVariation returns the key of the variation the user is bucketed into
func (*OptimizelyClient) IsFeatureEnabled ¶
func (o *OptimizelyClient) IsFeatureEnabled(featureKey string, userContext entities.UserContext) (result bool, err error)
IsFeatureEnabled returns true if the feature is enabled for the given user
func (*OptimizelyClient) Track ¶
func (o *OptimizelyClient) Track(eventKey string, userContext entities.UserContext, eventTags map[string]interface{}) (err error)
Track take and event key with event tags and if the event is part of the config, send to events backend.
type OptimizelyFactory ¶
OptimizelyFactory is used to construct an instance of the OptimizelyClient
func (OptimizelyFactory) Client ¶
func (f OptimizelyFactory) Client(clientOptions ...OptionFunc) (*OptimizelyClient, error)
Client gets client and sets some parameters
func (OptimizelyFactory) StaticClient ¶
func (f OptimizelyFactory) StaticClient() (*OptimizelyClient, error)
StaticClient returns a client initialized with a static project config
type OptionFunc ¶
type OptionFunc func(*OptimizelyClient)
OptionFunc is a type to a proper func
func WithBatchEventProcessor ¶
func WithBatchEventProcessor(batchSize, queueSize int, flushInterval time.Duration) OptionFunc
WithBatchEventProcessor sets event processor on a client
func WithCompositeDecisionService ¶
func WithCompositeDecisionService(sdkKey string) OptionFunc
WithCompositeDecisionService sets decision service on a client
func WithConfigManager ¶
func WithConfigManager(configManager pkg.ProjectConfigManager) OptionFunc
WithConfigManager sets polling config manager on a client
func WithDecisionService ¶
func WithDecisionService(decisionService decision.Service) OptionFunc
WithDecisionService sets decision service on a client
func WithEventProcessor ¶
func WithEventProcessor(eventProcessor event.Processor) OptionFunc
WithEventProcessor sets event processor on a client
func WithExecutionContext ¶
func WithExecutionContext(executionContext utils.ExecutionCtx) OptionFunc
WithExecutionContext allows user to pass in their own execution context to override the default one in the client
func WithPollingConfigManager ¶
func WithPollingConfigManager(sdkKey string, pollingInterval time.Duration, initDataFile []byte) OptionFunc
WithPollingConfigManager sets polling config manager on a client
func WithPollingConfigManagerRequester ¶
func WithPollingConfigManagerRequester(requester utils.Requester, pollingInterval time.Duration, initDataFile []byte) OptionFunc
WithPollingConfigManagerRequester sets polling config manager on a client