Version: v1.0.0 Latest Latest

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

Go to latest
Published: Jul 17, 2020 License: Apache-2.0 Imports: 12 Imported by: 0




This section is empty.


This section is empty.


This section is empty.


type Client

type Client struct {
	// contains filtered or unexported fields

Client represent the Flagship SDK client object

func Create

func Create(f *Options) (*Client, error)

Create creates a Client from options

func (*Client) Dispose

func (c *Client) Dispose() (err error)

Dispose disposes the Client and close all connections

func (*Client) GetEnvID

func (c *Client) GetEnvID() string

GetEnvID returns the current set env id

func (*Client) NewVisitor

func (c *Client) NewVisitor(visitorID string, context model.Context) (visitor *Visitor, err error)

NewVisitor returns a new Visitor from ID and context

func (*Client) SendHit

func (c *Client) SendHit(visitorID string, hit model.HitInterface) (err error)

SendHit sends a tracking hit to the Data Collect API

type DecisionMode

type DecisionMode string

DecisionMode represents the decision mode of the Client engine

const (
	API       DecisionMode = "API"
	Bucketing DecisionMode = "Bucketing"

The different decision modes

type ModificationInfo

type ModificationInfo struct {
	CampaignID       string
	VariationGroupID string
	VariationID      string
	Value            interface{}

ModificationInfo represents additional info linked to the modification key, for third party services

type OptionBuilder

type OptionBuilder func(*Options)

OptionBuilder is a func type to set options to the FlagshipOption.

func WithBucketing

func WithBucketing(options ...func(*bucketing.Engine)) OptionBuilder

WithBucketing enables the bucketing decision mode for the SDK

func WithDecisionAPI

func WithDecisionAPI(options ...func(*decisionapi.APIClient)) OptionBuilder

WithDecisionAPI changes the decision API options

func WithVisitorCache

func WithVisitorCache(options ...cache.OptionBuilder) OptionBuilder

WithVisitorCache enables visitor assignment caching with options

type Options

type Options struct {
	EnvID string
	// contains filtered or unexported fields

Options represent the options passed to the Flagship SDK client

func (*Options) BuildOptions

func (f *Options) BuildOptions(clientOptions ...OptionBuilder)

BuildOptions fill out the FlagshipOption struct from option builders

type Visitor

type Visitor struct {
	ID      string
	Context map[string]interface{}
	// contains filtered or unexported fields

Visitor represents a visitor instance of the Flagship SDK

func (*Visitor) ActivateCacheModification

func (v *Visitor) ActivateCacheModification(key string) (err error)

ActivateCacheModification activates a modification from the cache of assigned visitor campaigns

func (*Visitor) ActivateModification

func (v *Visitor) ActivateModification(key string) (err error)

ActivateModification notifies Flagship that the visitor has seen to modification

func (*Visitor) GetAllModifications

func (v *Visitor) GetAllModifications() (flagInfos map[string]model.FlagInfos)

GetAllModifications return all the modifications

func (*Visitor) GetModificationBool

func (v *Visitor) GetModificationBool(key string, defaultValue bool, activate bool) (castVal bool, err error)

GetModificationBool get a modification bool by its key

func (*Visitor) GetModificationInfo

func (v *Visitor) GetModificationInfo(key string) (modifInfo *ModificationInfo, err error)

GetModificationInfo returns a modification info by its key

func (*Visitor) GetModificationNumber

func (v *Visitor) GetModificationNumber(key string, defaultValue float64, activate bool) (castVal float64, err error)

GetModificationNumber get a modification number as float64 by its key

func (*Visitor) GetModificationString

func (v *Visitor) GetModificationString(key string, defaultValue string, activate bool) (castVal string, err error)

GetModificationString get a modification string by its key

func (*Visitor) SendHit

func (v *Visitor) SendHit(hit model.HitInterface) (err error)

SendHit sends a tracking hit to the Data Collect API

func (*Visitor) SynchronizeModifications

func (v *Visitor) SynchronizeModifications() (err error)

SynchronizeModifications updates the latest campaigns and modifications for the visitor

func (*Visitor) UpdateContext

func (v *Visitor) UpdateContext(newContext model.Context) (err error)

UpdateContext updates the Visitor context with new value

func (*Visitor) UpdateContextKey

func (v *Visitor) UpdateContextKey(key string, value interface{}) (err error)

UpdateContextKey updates a single Visitor context key with new value

Jump to

Keyboard shortcuts

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