Documentation
¶
Overview ¶
* DevCycle Bucketing API * * Documents the DevCycle Bucketing API which provides and API interface to User Bucketing and for generated SDKs. * * API version: 1.0.0 * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
* DevCycle Bucketing API * * Documents the DevCycle Bucketing API which provides and API interface to User Bucketing and for generated SDKs. * * API version: 1.0.0 * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
* DevCycle Bucketing API * * Documents the DevCycle Bucketing API which provides and API interface to User Bucketing and for generated SDKs. * * API version: 1.0.0 * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
* DevCycle Bucketing API * * Documents the DevCycle Bucketing API which provides and API interface to User Bucketing and for generated SDKs. * * API version: 1.0.0 * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
* DevCycle Bucketing API * * Documents the DevCycle Bucketing API which provides and API interface to User Bucketing and for generated SDKs. * * API version: 1.0.0 * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
* DevCycle Bucketing API * * Documents the DevCycle Bucketing API which provides and API interface to User Bucketing and for generated SDKs. * * API version: 1.0.0 * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
* DevCycle Bucketing API * * Documents the DevCycle Bucketing API which provides and API interface to User Bucketing and for generated SDKs. * * API version: 1.0.0 * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
* DevCycle Bucketing API * * Documents the DevCycle Bucketing API which provides and API interface to User Bucketing and for generated SDKs. * * API version: 1.0.0 * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
* DevCycle Bucketing API * * Documents the DevCycle Bucketing API which provides and API interface to User Bucketing and for generated SDKs. * * API version: 1.0.0 * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
Index ¶
- Constants
- Variables
- func CacheExpires(r *http.Response) time.Time
- type APIKey
- type APIResponse
- type BasicAuth
- type BatchEventsBody
- type BucketedUserConfig
- type DVCClient
- type DVCClientService
- func (a *DVCClientService) AllFeatures(ctx context.Context, body UserData) (map[string]Feature, error)
- func (a *DVCClientService) AllVariables(ctx context.Context, body UserData) (map[string]Variable, error)
- func (a *DVCClientService) FlushEvents() error
- func (a *DVCClientService) Track(ctx context.Context, user UserData, event DVCEvent) (bool, error)
- func (a *DVCClientService) Variable(ctx context.Context, userdata UserData, key string, defaultValue interface{}) (Variable, error)
- type DVCEvent
- type DVCOptions
- type DevCycleLocalBucketing
- func (d *DevCycleLocalBucketing) GenerateBucketedConfigForUser(user string) (ret BucketedUserConfig, err error)
- func (d *DevCycleLocalBucketing) Initialize(sdkToken string, options *DVCOptions) (err error)
- func (d *DevCycleLocalBucketing) SetPlatformData(platformData string) error
- func (d *DevCycleLocalBucketing) SetSDKToken(token string)
- func (d *DevCycleLocalBucketing) StoreConfig(token, config string) error
- type EdgeDBSettings
- type Environment
- type EnvironmentConfigManager
- type ErrorResponse
- type EventQueue
- type EventQueueOptions
- type Feature
- type FlushPayload
- type GenericSwaggerError
- type HTTPConfiguration
- type OptInColors
- type OptInSettings
- type PlatformData
- type Project
- type ProjectSettings
- type SDKEvent
- type UserData
- type UserDataAndEventsBody
- type UserEventsBatchRecord
- type UserFeatureData
- type Variable
Constants ¶
const ( EventType_VariableEvaluated = "variableEvaluated" EventType_AggVariableEvaluated = "aggVariableEvaluated" EventType_VariableDefaulted = "variableDefaulted" EventType_AggVariableDefaulted = "aggVariableDefaulted" )
const VERSION = "1.2.0"
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") )
Functions ¶
Types ¶
type APIKey ¶
APIKey provides API key based authentication to a request passed via context using ContextAPIKey
type APIResponse ¶
type APIResponse struct {
*http.Response `json:"-"`
Message string `json:"message,omitempty"`
// Operation is the name of the swagger operation.
Operation string `json:"operation,omitempty"`
// RequestURL is the request URL. This value is always available, even if the
// embedded *http.Response is nil.
RequestURL string `json:"url,omitempty"`
// Method is the HTTP method used for the request. This value is always
// available, even if the embedded *http.Response is nil.
Method string `json:"method,omitempty"`
// Payload holds the contents of the response body (which may be nil or empty).
// This is provided here as the raw response.Body() reader will have already
// been drained.
Payload []byte `json:"-"`
}
func NewAPIResponse ¶
func NewAPIResponse(r *http.Response) *APIResponse
func NewAPIResponseWithError ¶
func NewAPIResponseWithError(errorMessage string) *APIResponse
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 ¶ added in v1.2.0
type BatchEventsBody struct {
Records []UserEventsBatchRecord `json:"batch,omitempty"`
}
type BucketedUserConfig ¶ added in v1.2.0
type BucketedUserConfig struct {
Project Project `json:"project"`
Environment Environment `json:"environment"`
Features map[string]Feature `json:"features"`
FeatureVariationMap map[string]string `json:"featureVariationMap"`
Variables map[string]Variable `json:"variables"`
KnownVariableKeys []float64 `json:"knownVariableKeys"`
// contains filtered or unexported fields
}
type DVCClient ¶
type DVCClient struct {
// API Services
DevCycleApi *DVCClientService
DevCycleOptions *DVCOptions
// contains filtered or unexported fields
}
DVCClient In most cases there should be only one, shared, DVCClient.
func NewDVCClient ¶
func NewDVCClient(environmentKey string, options *DVCOptions, localBucketing *DevCycleLocalBucketing) (*DVCClient, error)
NewDVCClient creates a new API client. Requires a userAgent string describing your application. optionally a custom http.Client to allow for advanced features such as caching.
func (*DVCClient) ChangeBasePath ¶
Change base path to allow switching to mocks
func (*DVCClient) SetOptions ¶ added in v1.1.0
func (c *DVCClient) SetOptions(dvcOptions DVCOptions)
type DVCClientService ¶
type DVCClientService service
func (*DVCClientService) AllFeatures ¶
func (a *DVCClientService) AllFeatures(ctx context.Context, body UserData) (map[string]Feature, error)
DVCClientService Get all features by key for user data
- @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
- @param body
@return map[string]Feature
func (*DVCClientService) AllVariables ¶
func (*DVCClientService) FlushEvents ¶ added in v1.2.0
func (a *DVCClientService) FlushEvents() error
func (*DVCClientService) Variable ¶
func (a *DVCClientService) Variable(ctx context.Context, userdata UserData, key string, defaultValue interface{}) (Variable, error)
DVCClientService Get variable by key for user data
- @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
- @param body
- @param key Variable key
@return Variable
type DVCEvent ¶ added in v1.2.0
type DVCEvent struct {
Type_ string `json:"type"`
Target string `json:"target,omitempty"`
CustomType string `json:"customType,omitempty"`
UserId string `json:"user_id,omitempty"`
ClientDate time.Time `json:"clientDate,omitempty"`
Value float64 `json:"value,omitempty"`
FeatureVars map[string]string `json:"featureVars,omitempty"`
MetaData map[string]interface{} `json:"metaData,omitempty"`
}
type DVCOptions ¶ added in v1.1.0
type DVCOptions struct {
EnableEdgeDB bool `json:"enableEdgeDb,omitempty"`
DisableLocalBucketing bool `json:"disableLocalBucketing,omitempty"`
EventsFlushInterval time.Duration `json:"eventsFlushInterval,omitempty"`
PollingInterval time.Duration `json:"pollingInterval,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"`
ConfigCDNOverride string
EventsAPIOverride string
}
func (*DVCOptions) CheckDefaults ¶ added in v1.2.0
func (o *DVCOptions) CheckDefaults()
type DevCycleLocalBucketing ¶ added in v1.2.0
type DevCycleLocalBucketing struct {
// contains filtered or unexported fields
}
func InitializeLocalBucketing ¶ added in v1.2.0
func InitializeLocalBucketing(environmentKey string, options *DVCOptions) (ret *DevCycleLocalBucketing, err error)
func (*DevCycleLocalBucketing) GenerateBucketedConfigForUser ¶ added in v1.2.0
func (d *DevCycleLocalBucketing) GenerateBucketedConfigForUser(user string) (ret BucketedUserConfig, err error)
func (*DevCycleLocalBucketing) Initialize ¶ added in v1.2.0
func (d *DevCycleLocalBucketing) Initialize(sdkToken string, options *DVCOptions) (err error)
func (*DevCycleLocalBucketing) SetPlatformData ¶ added in v1.2.0
func (d *DevCycleLocalBucketing) SetPlatformData(platformData string) error
func (*DevCycleLocalBucketing) SetSDKToken ¶ added in v1.2.0
func (d *DevCycleLocalBucketing) SetSDKToken(token string)
func (*DevCycleLocalBucketing) StoreConfig ¶ added in v1.2.0
func (d *DevCycleLocalBucketing) StoreConfig(token, config string) error
type EdgeDBSettings ¶ added in v1.2.0
type EdgeDBSettings struct {
Enabled bool `json:"enabled"`
}
type Environment ¶ added in v1.2.0
type EnvironmentConfigManager ¶ added in v1.2.0
type EnvironmentConfigManager struct {
// contains filtered or unexported fields
}
func (*EnvironmentConfigManager) Initialize ¶ added in v1.2.0
func (e *EnvironmentConfigManager) Initialize(environmentKey string, options *DVCOptions) (err error)
type ErrorResponse ¶
type ErrorResponse struct {
// Error message
Message string `json:"message"`
// Additional error information detailing the error reasoning
Data interface{} `json:"data,omitempty"`
}
type EventQueue ¶ added in v1.2.0
type EventQueue struct {
// contains filtered or unexported fields
}
func (*EventQueue) FlushEvents ¶ added in v1.2.0
func (e *EventQueue) FlushEvents() (err error)
func (*EventQueue) QueueAggregateEvent ¶ added in v1.2.0
func (e *EventQueue) QueueAggregateEvent(user BucketedUserConfig, event DVCEvent) error
func (*EventQueue) QueueEvent ¶ added in v1.2.0
func (e *EventQueue) QueueEvent(user UserData, event DVCEvent) error
type EventQueueOptions ¶ added in v1.2.0
type Feature ¶
type Feature struct {
// unique database id
Id string `json:"_id"`
// Unique key by Project, can be used in the SDK / API to reference by 'key' rather than _id.
Key string `json:"key"`
// Feature type
Type_ string `json:"type"`
// Bucketed feature variation
Variation string `json:"_variation"`
// Bucketed feature variation key
VariationKey string `json:"variationKey"`
// Bucketed feature variation name
VariationName string `json:"variationName"`
// Evaluation reasoning
EvalReason string `json:"evalReason,omitempty"`
}
type FlushPayload ¶ added in v1.2.0
type FlushPayload struct {
PayloadId string `json:"payloadId,omitempty"`
EventCount int `json:"eventCount,omitempty"`
Records []UserEventsBatchRecord `json:"records,omitempty"`
}
type GenericSwaggerError ¶
type GenericSwaggerError struct {
// contains filtered or unexported fields
}
GenericSwaggerError Provides access to the body, error and model on returned errors.
func (GenericSwaggerError) Body ¶
func (e GenericSwaggerError) Body() []byte
Body returns the raw bytes of the response
func (GenericSwaggerError) Error ¶
func (e GenericSwaggerError) Error() string
Error returns non-empty string if there was an error.
func (GenericSwaggerError) Model ¶
func (e GenericSwaggerError) Model() interface{}
Model returns the unpacked model of the error
type HTTPConfiguration ¶ added in v1.2.0
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 *DVCOptions) *HTTPConfiguration
func (*HTTPConfiguration) AddDefaultHeader ¶ added in v1.2.0
func (c *HTTPConfiguration) AddDefaultHeader(key string, value string)
type OptInColors ¶ added in v1.2.0
type OptInSettings ¶ added in v1.2.0
type OptInSettings struct {
Enabled bool `json:"enabled"`
Title string `json:"title"`
Description string `json:"description"`
ImageURL string `json:"imageURL"`
Colors OptInColors `json:"colors"`
}
type PlatformData ¶ added in v1.2.0
type PlatformData struct {
SdkType string `json:"sdkType"`
SdkVersion string `json:"sdkVersion"`
PlatformVersion string `json:"platformVersion"`
DeviceModel string `json:"deviceModel"`
Platform string `json:"platform"`
Hostname string `json:"hostname"`
}
func (*PlatformData) Default ¶ added in v1.2.0
func (pd *PlatformData) Default(isLocal bool) *PlatformData
func (*PlatformData) FromUser ¶ added in v1.2.0
func (pd *PlatformData) FromUser(user UserData) PlatformData
type Project ¶ added in v1.2.0
type Project struct {
Id string `json:"_id"`
Key string `json:"key"`
A0OrganizationId string `json:"a0_organization"`
Settings ProjectSettings `json:"settings"`
}
type ProjectSettings ¶ added in v1.2.0
type ProjectSettings struct {
EdgeDB EdgeDBSettings `json:"edgeDB"`
OptIn OptInSettings `json:"optIn"`
}
type UserData ¶
type UserData struct {
// Unique id to identify the user
UserId string `json:"user_id"`
// User's email used to identify the user on the dashboard / target audiences
Email string `json:"email,omitempty"`
// User's name used to identify the user on the dashboard / target audiences
Name string `json:"name,omitempty"`
// User's language in ISO 639-1 format
Language string `json:"language,omitempty"`
// User's country in ISO 3166 alpha-2 format
Country string `json:"country,omitempty"`
// App Version of the running application
AppVersion string `json:"appVersion,omitempty"`
// App Build number of the running application
AppBuild string `json:"appBuild,omitempty"`
// User's custom data to target the user with, data will be logged to DevCycle for use in dashboard.
CustomData map[string]interface{} `json:"customData,omitempty"`
// User's custom data to target the user with, data will not be logged to DevCycle only used for feature bucketing.
PrivateCustomData map[string]interface{} `json:"privateCustomData,omitempty"`
// Date the user was created, Unix epoch timestamp format
CreatedDate time.Time `json:"createdDate,omitempty"`
// Date the user was created, Unix epoch timestamp format
LastSeenDate time.Time `json:"lastSeenDate,omitempty"`
// Platform the Client SDK is running on
Platform string `json:"platform,omitempty"`
// Version of the platform the Client SDK is running on
PlatformVersion string `json:"platformVersion,omitempty"`
// User's device model
DeviceModel string `json:"deviceModel,omitempty"`
// DevCycle SDK type
SdkType string `json:"sdkType,omitempty"`
// DevCycle SDK Version
SdkVersion string `json:"sdkVersion,omitempty"`
}
type UserDataAndEventsBody ¶
type UserEventsBatchRecord ¶ added in v1.2.0
type UserFeatureData ¶ added in v1.2.0
type Variable ¶
type Variable struct {
// unique database id
Id string `json:"_id"`
// Unique key by Project, can be used in the SDK / API to reference by 'key' rather than _id.
Key string `json:"key"`
// Variable type
Type_ string `json:"type"`
// Variable value can be a string, number, boolean, or JSON
Value interface{} `json:"value"`
// Identifies if variable was returned with the default value
IsDefaulted bool `json:"isDefaulted,omitempty"`
}
Source Files
¶
- api_devcycle.go
- client.go
- configmanager.go
- configuration.go
- eventqueue.go
- localbucketing.go
- model_bucketed_user_config.go
- model_environment.go
- model_error_response.go
- model_event.go
- model_event_types.go
- model_eventqueue.go
- model_feature.go
- model_platformdata.go
- model_public_project.go
- model_user_data.go
- model_user_data_and_events_body.go
- model_variable.go
- response.go
- testing_helpers.go
- version.go