Documentation ¶
Index ¶
- Constants
- Variables
- func GeneratePlatformData() *api.PlatformData
- func SetLogger(log Logger)
- type APIKey
- type AdvancedOptions
- type BaseVariable
- type BasicAuth
- type BatchEventsBody
- type BucketedUserConfig
- type Client
- func (c *Client) AllFeatures(user User) (map[string]Feature, error)
- func (c *Client) AllVariables(user User) (map[string]ReadOnlyVariable, error)
- func (c *Client) ChangeBasePath(path string)
- func (c *Client) Close() (err error)
- func (c *Client) EventQueueMetrics() (int32, int32, int32)
- func (c *Client) FlushEvents() error
- func (c *Client) GetRawConfig() (config []byte, etag string, err error)
- func (c *Client) IsLocalBucketing() bool
- func (c *Client) OpenFeatureProvider() DevCycleProvider
- func (c *Client) SetClientCustomData(customData map[string]interface{}) error
- func (c *Client) SetOptions(dvcOptions Options)
- func (c *Client) Track(user User, event Event) (bool, error)
- func (c *Client) Variable(userdata User, key string, defaultValue interface{}) (result Variable, err error)
- func (c *Client) VariableValue(userdata User, key string, defaultValue interface{}) (interface{}, error)
- type ClientImpl
- type ConfigReceiver
- type DVCClientdeprecated
- type DVCEventdeprecated
- type DVCOptionsdeprecated
- type DVCUserdeprecated
- type DevCycleProvider
- func (p DevCycleProvider) BooleanEvaluation(ctx context.Context, flag string, defaultValue bool, ...) openfeature.BoolResolutionDetail
- func (p DevCycleProvider) FloatEvaluation(ctx context.Context, flag string, defaultValue float64, ...) openfeature.FloatResolutionDetail
- func (p DevCycleProvider) Hooks() []openfeature.Hook
- func (p DevCycleProvider) IntEvaluation(ctx context.Context, flag string, defaultValue int64, ...) openfeature.IntResolutionDetail
- func (p DevCycleProvider) Metadata() openfeature.Metadata
- func (p DevCycleProvider) ObjectEvaluation(ctx context.Context, flag string, defaultValue interface{}, ...) openfeature.InterfaceResolutionDetail
- func (p DevCycleProvider) StringEvaluation(ctx context.Context, flag string, defaultValue string, ...) openfeature.StringResolutionDetail
- type DiscardLogger
- type EnvironmentConfigManager
- type ErrorResponse
- type Event
- type EventFlushCallback
- type EventManager
- type EventQueueOptions
- type Feature
- type FeatureVariation
- type FlushPayload
- type FlushResult
- type GenericError
- type HTTPConfiguration
- type InternalEventQueue
- type LocalBucketing
- type Logger
- type NativeLocalBucketing
- func (n *NativeLocalBucketing) Close()
- func (n *NativeLocalBucketing) FlushEventQueue(callback EventFlushCallback) error
- func (n *NativeLocalBucketing) GenerateBucketedConfigForUser(user User) (ret *BucketedUserConfig, err error)
- func (n *NativeLocalBucketing) Metrics() (int32, int32, int32)
- func (n *NativeLocalBucketing) QueueAggregateEvent(config BucketedUserConfig, event Event) error
- func (n *NativeLocalBucketing) QueueEvent(user User, event Event) error
- func (n *NativeLocalBucketing) SetClientCustomData(customData map[string]interface{}) error
- func (n *NativeLocalBucketing) StoreConfig(configJSON []byte, eTag string) error
- func (n *NativeLocalBucketing) UserQueueLength() (int, error)
- func (n *NativeLocalBucketing) Variable(user User, variableKey string, variableType string) (Variable, error)
- type Options
- type PlatformData
- type ReadOnlyVariable
- type SDKEvent
- type User
- type UserDataAndEventsBody
- type Variable
Constants ¶
const CONFIG_RETRIES = 1
const DEVCYCLE_USER_ID_KEY = "userId"
const NATIVE_SDK = true
const VERSION = "2.11.2"
Variables ¶
var ( // ContextOAuth2 takes a oauth2.TokenSource as authentication for the request. ContextOAuth2 = contextKey("token") // ContextBasicAuth takes BasicAuth as authentication for the request. ContextBasicAuth = contextKey("basic") // ContextAccessToken takes a string oauth2 access token as authentication for the request. ContextAccessToken = contextKey("accesstoken") // ContextAPIKey takes an APIKey as authentication for the request ContextAPIKey = contextKey("apikey") )
var DEFAULT_USER_TIME = time.Time{}
This value will always be set to zero as the user.CreatedDate is not actually used in native bucketing
var ErrInvalidDefaultValue = errors.New("the default value for variable is not of type Boolean, Number, String, or JSON")
var ErrQueueFull = bucketing.ErrQueueFull
Functions ¶
func GeneratePlatformData ¶
func GeneratePlatformData() *api.PlatformData
Types ¶
type APIKey ¶
APIKey provides API key based authentication to a request passed via context using ContextAPIKey
type AdvancedOptions ¶
type AdvancedOptions struct {
OverridePlatformData *api.PlatformData
}
type BaseVariable ¶
type BaseVariable = api.BaseVariable
type BasicAuth ¶
type BasicAuth struct { UserName string `json:"userName,omitempty"` Password string `json:"password,omitempty"` }
BasicAuth provides basic http authentication to a request passed via context using ContextBasicAuth
type BatchEventsBody ¶
type BatchEventsBody = api.BatchEventsBody
type BucketedUserConfig ¶
type BucketedUserConfig = api.BucketedUserConfig
type Client ¶
type Client struct { DevCycleOptions *Options // contains filtered or unexported fields }
DevCycle Client In most cases there should be only one, shared, Client.
func NewClient ¶
NewClient creates a new API client. optionally pass a custom http.Client to allow for advanced features such as caching.
func NewDVCClient
deprecated
func (*Client) AllFeatures ¶
Get all features by key for user data
- @param body
@return map[string]Feature
func (*Client) AllVariables ¶
func (c *Client) AllVariables(user User) (map[string]ReadOnlyVariable, error)
func (*Client) ChangeBasePath ¶
Change base path to allow switching to mocks
func (*Client) FlushEvents ¶
func (*Client) GetRawConfig ¶
func (*Client) IsLocalBucketing ¶
func (*Client) OpenFeatureProvider ¶
func (c *Client) OpenFeatureProvider() DevCycleProvider
Convenience method for creating a DevCycleProvider from a Client
func (*Client) SetClientCustomData ¶
func (*Client) SetOptions ¶
type ClientImpl ¶
type ConfigReceiver ¶
type DVCOptions
deprecated
type DVCOptions = Options
Deprecated: Use devcycle.Options instead
type DevCycleProvider ¶
type DevCycleProvider struct {
Client ClientImpl
}
DevCycleProvider implements the FeatureProvider interface and provides functions for evaluating flags
func (DevCycleProvider) BooleanEvaluation ¶
func (p DevCycleProvider) BooleanEvaluation(ctx context.Context, flag string, defaultValue bool, evalCtx openfeature.FlattenedContext) openfeature.BoolResolutionDetail
BooleanEvaluation returns a boolean flag
func (DevCycleProvider) FloatEvaluation ¶
func (p DevCycleProvider) FloatEvaluation(ctx context.Context, flag string, defaultValue float64, evalCtx openfeature.FlattenedContext) openfeature.FloatResolutionDetail
FloatEvaluation returns a float flag
func (DevCycleProvider) Hooks ¶
func (p DevCycleProvider) Hooks() []openfeature.Hook
Hooks returns hooks
func (DevCycleProvider) IntEvaluation ¶
func (p DevCycleProvider) IntEvaluation(ctx context.Context, flag string, defaultValue int64, evalCtx openfeature.FlattenedContext) openfeature.IntResolutionDetail
IntEvaluation returns an int flag
func (DevCycleProvider) Metadata ¶
func (p DevCycleProvider) Metadata() openfeature.Metadata
Metadata returns the metadata of the provider
func (DevCycleProvider) ObjectEvaluation ¶
func (p DevCycleProvider) ObjectEvaluation(ctx context.Context, flag string, defaultValue interface{}, evalCtx openfeature.FlattenedContext) openfeature.InterfaceResolutionDetail
ObjectEvaluation returns an object flag
func (DevCycleProvider) StringEvaluation ¶
func (p DevCycleProvider) StringEvaluation(ctx context.Context, flag string, defaultValue string, evalCtx openfeature.FlattenedContext) openfeature.StringResolutionDetail
StringEvaluation returns a string flag
type DiscardLogger ¶
type DiscardLogger = util.DiscardLogger
type EnvironmentConfigManager ¶
type EnvironmentConfigManager struct {
// contains filtered or unexported fields
}
func NewEnvironmentConfigManager ¶
func NewEnvironmentConfigManager( sdkKey string, localBucketing ConfigReceiver, options *Options, cfg *HTTPConfiguration, ) (e *EnvironmentConfigManager)
func (*EnvironmentConfigManager) Close ¶
func (e *EnvironmentConfigManager) Close()
func (*EnvironmentConfigManager) HasConfig ¶
func (e *EnvironmentConfigManager) HasConfig() bool
func (*EnvironmentConfigManager) StartPolling ¶
func (e *EnvironmentConfigManager) StartPolling( interval time.Duration, )
type ErrorResponse ¶
type ErrorResponse = api.ErrorResponse
Aliases for the types in the api package
type EventFlushCallback ¶
type EventFlushCallback func(payloads map[string]FlushPayload) (*FlushResult, error)
type EventManager ¶
type EventManager struct {
// contains filtered or unexported fields
}
EventManager is responsible for flushing the event queue and reporting events to the server. It wraps an InternalEventQueue which is implemented either natively by the bucketing package or in WASM.
func NewEventManager ¶
func NewEventManager(options *Options, localBucketing InternalEventQueue, cfg *HTTPConfiguration, sdkKey string) (eventQueue *EventManager, err error)
func (*EventManager) Close ¶
func (e *EventManager) Close() (err error)
func (*EventManager) FlushEvents ¶
func (e *EventManager) FlushEvents() (err error)
func (*EventManager) QueueEvent ¶
func (e *EventManager) QueueEvent(user User, event Event) error
func (*EventManager) QueueVariableDefaultedEvent ¶
func (e *EventManager) QueueVariableDefaultedEvent(variableKey string) error
type EventQueueOptions ¶
type EventQueueOptions = api.EventQueueOptions
type FeatureVariation ¶
type FeatureVariation = api.FeatureVariation
type FlushPayload ¶
type FlushPayload = api.FlushPayload
type FlushResult ¶
type GenericError ¶
type GenericError struct {
// contains filtered or unexported fields
}
GenericError Provides access to the body, error and model on returned errors.
func (GenericError) Body ¶
func (e GenericError) Body() []byte
Body returns the raw bytes of the response
func (GenericError) Error ¶
func (e GenericError) Error() string
Error returns non-empty string if there was an error.
func (GenericError) Model ¶
func (e GenericError) Model() interface{}
Model returns the unpacked model of the error
type HTTPConfiguration ¶
type HTTPConfiguration struct { BasePath string `json:"basePath,omitempty"` ConfigCDNBasePath string `json:"configCDNBasePath,omitempty"` EventsAPIBasePath string `json:"eventsAPIBasePath,omitempty"` Host string `json:"host,omitempty"` Scheme string `json:"scheme,omitempty"` DefaultHeader map[string]string `json:"defaultHeader,omitempty"` UserAgent string `json:"userAgent,omitempty"` HTTPClient *http.Client }
func NewConfiguration ¶
func NewConfiguration(options *Options) *HTTPConfiguration
func (*HTTPConfiguration) AddDefaultHeader ¶
func (c *HTTPConfiguration) AddDefaultHeader(key string, value string)
type InternalEventQueue ¶
type LocalBucketing ¶
type LocalBucketing interface { ConfigReceiver InternalEventQueue GenerateBucketedConfigForUser(user User) (ret *BucketedUserConfig, err error) SetClientCustomData(map[string]interface{}) error Variable(user User, key string, variableType string) (variable Variable, err error) Close() }
type NativeLocalBucketing ¶
type NativeLocalBucketing struct {
// contains filtered or unexported fields
}
func NewNativeLocalBucketing ¶
func NewNativeLocalBucketing(sdkKey string, platformData *api.PlatformData, options *Options) (*NativeLocalBucketing, error)
func (*NativeLocalBucketing) Close ¶
func (n *NativeLocalBucketing) Close()
func (*NativeLocalBucketing) FlushEventQueue ¶
func (n *NativeLocalBucketing) FlushEventQueue(callback EventFlushCallback) error
func (*NativeLocalBucketing) GenerateBucketedConfigForUser ¶
func (n *NativeLocalBucketing) GenerateBucketedConfigForUser(user User) (ret *BucketedUserConfig, err error)
func (*NativeLocalBucketing) Metrics ¶
func (n *NativeLocalBucketing) Metrics() (int32, int32, int32)
func (*NativeLocalBucketing) QueueAggregateEvent ¶
func (n *NativeLocalBucketing) QueueAggregateEvent(config BucketedUserConfig, event Event) error
func (*NativeLocalBucketing) QueueEvent ¶
func (n *NativeLocalBucketing) QueueEvent(user User, event Event) error
func (*NativeLocalBucketing) SetClientCustomData ¶
func (n *NativeLocalBucketing) SetClientCustomData(customData map[string]interface{}) error
func (*NativeLocalBucketing) StoreConfig ¶
func (n *NativeLocalBucketing) StoreConfig(configJSON []byte, eTag string) error
func (*NativeLocalBucketing) UserQueueLength ¶
func (n *NativeLocalBucketing) UserQueueLength() (int, error)
type Options ¶
type Options struct { EnableEdgeDB bool `json:"enableEdgeDb,omitempty"` EnableCloudBucketing bool `json:"enableCloudBucketing,omitempty"` EventFlushIntervalMS time.Duration `json:"eventFlushIntervalMS,omitempty"` ConfigPollingIntervalMS time.Duration `json:"configPollingIntervalMS,omitempty"` RequestTimeout time.Duration `json:"requestTimeout,omitempty"` DisableAutomaticEventLogging bool `json:"disableAutomaticEventLogging,omitempty"` DisableCustomEventLogging bool `json:"disableCustomEventLogging,omitempty"` MaxEventQueueSize int `json:"maxEventsPerFlush,omitempty"` FlushEventQueueSize int `json:"minEventsPerFlush,omitempty"` ConfigCDNURI string EventsAPIURI string OnInitializedChannel chan bool BucketingAPIURI string Logger util.Logger AdvancedOptions }
func (*Options) CheckDefaults ¶
func (o *Options) CheckDefaults()
type PlatformData ¶
type PlatformData = api.PlatformData
type ReadOnlyVariable ¶
type ReadOnlyVariable = api.ReadOnlyVariable
type UserDataAndEventsBody ¶
type UserDataAndEventsBody = api.UserDataAndEventsBody
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
* DevCycle Bucketing API * * Documents the DevCycle Bucketing API which provides and API interface to User Bucketing and for generated SDKs.
|
* DevCycle Bucketing API * * Documents the DevCycle Bucketing API which provides and API interface to User Bucketing and for generated SDKs. |
example
|
|