Documentation ¶
Overview ¶
Package handlers //
Package handlers //
Package handlers //
Package handlers //
Package handlers //
Package handlers //
Package handlers //
Package handlers //
Package handlers //
Index ¶
- Variables
- func Activate(w http.ResponseWriter, r *http.Request)
- func NotificationEventSteamHandler(w http.ResponseWriter, r *http.Request)
- func OptimizelyConfig(w http.ResponseWriter, r *http.Request)
- func Override(w http.ResponseWriter, r *http.Request)
- func ParseRequestBody(r *http.Request, v interface{}) error
- func RenderError(err error, status int, w http.ResponseWriter, r *http.Request)
- func TrackEvent(w http.ResponseWriter, r *http.Request)
- type ActivateBody
- type Admin
- type ClientCredentials
- type ClientCredentialsError
- type DatafileUpdateData
- type ErrorResponse
- type Info
- type JSON
- type MessageChan
- type OAuthHandler
- type OptlyMessage
- type OptlyWebhookHandler
- type OverrideBody
Constants ¶
This section is empty.
Variables ¶
var ErrEmptyUserID = errors.New(`missing "userId" in request payload`)
ErrEmptyUserID is a constant error if userId is omitted from the request
Functions ¶
func Activate ¶ added in v0.12.0
func Activate(w http.ResponseWriter, r *http.Request)
Activate makes feature and experiment decisions for the selected query parameters.
func NotificationEventSteamHandler ¶ added in v0.14.0
func NotificationEventSteamHandler(w http.ResponseWriter, r *http.Request)
NotificationEventSteamHandler implements the http.Handler interface.
func OptimizelyConfig ¶ added in v0.12.0
func OptimizelyConfig(w http.ResponseWriter, r *http.Request)
OptimizelyConfig returns the entire OptimizelyConfig object directly from the SDK
func Override ¶ added in v0.12.0
func Override(w http.ResponseWriter, r *http.Request)
Override is used to set forced variations for a given experiment or feature test
func ParseRequestBody ¶
ParseRequestBody reads the request body from the request and unmarshals it into the provided interface. Note that we're sanitizing the returned error so that it is not leaked back to the requestor.
func RenderError ¶
RenderError sets the request status and renders the error message.
func TrackEvent ¶ added in v0.12.0
func TrackEvent(w http.ResponseWriter, r *http.Request)
TrackEvent - track a given event for the current user
Types ¶
type ActivateBody ¶ added in v0.12.0
type ActivateBody struct { UserID string `json:"userId"` UserAttributes map[string]interface{} `json:"userAttributes"` }
ActivateBody defines the request body for an activation
type Admin ¶
type Admin struct { Config config.AgentConfig Info Info }
Admin is holding info to pass to admin handlers
func (Admin) AppConfig ¶ added in v0.12.0
func (a Admin) AppConfig(w http.ResponseWriter, r *http.Request)
AppConfig returns the agent configuration
func (Admin) AppInfo ¶
func (a Admin) AppInfo(w http.ResponseWriter, r *http.Request)
AppInfo returns custom app-info
func (Admin) AppInfoHeader ¶
AppInfoHeader adds custom app-info to the response header
type ClientCredentials ¶ added in v0.12.0
ClientCredentials has all info for client credentials
type ClientCredentialsError ¶ added in v0.13.0
type ClientCredentialsError struct { ErrorCode string `json:"error"` ErrorDescription string `json:"error_description,omitempty"` }
ClientCredentialsError is the response body returned when the provided client credentials are invalid
func (*ClientCredentialsError) Error ¶ added in v0.13.0
func (err *ClientCredentialsError) Error() string
type DatafileUpdateData ¶
type DatafileUpdateData struct { Revision int32 `json:"revision"` OriginURL string `json:"origin_url"` CDNUrl string `json:"cdn_url"` Environment string `json:"environment"` }
DatafileUpdateData model which represents data specific to datafile update
type Info ¶ added in v0.12.0
type Info struct { Version string `json:"version,omitempty"` Author string `json:"author,omitempty"` AppName string `json:"app_name,omitempty"` Uptime string `json:"uptime"` Host string `json:"host,omitempty"` }
Info holds the detail to support the info endpoint
type MessageChan ¶ added in v0.12.0
type MessageChan chan []byte
A MessageChan is a channel of bytes Each http handler call creates a new channel and pumps decision service messages onto it.
type OAuthHandler ¶ added in v0.12.0
type OAuthHandler struct { ClientCredentials map[string]ClientCredentials // contains filtered or unexported fields }
OAuthHandler provides handler for auth
func NewOAuthHandler ¶ added in v0.12.0
func NewOAuthHandler(authConfig *config.ServiceAuthConfig) *OAuthHandler
NewOAuthHandler creates new handler for auth
func (*OAuthHandler) CreateAPIAccessToken ¶ added in v0.13.0
func (h *OAuthHandler) CreateAPIAccessToken(w http.ResponseWriter, r *http.Request)
CreateAPIAccessToken returns a JWT access token for the API service
func (*OAuthHandler) CreateAdminAccessToken ¶ added in v0.13.0
func (h *OAuthHandler) CreateAdminAccessToken(w http.ResponseWriter, r *http.Request)
CreateAdminAccessToken returns a JWT access token for the Admin service
type OptlyMessage ¶
type OptlyMessage struct { ProjectID int64 `json:"project_id"` Timestamp int64 `json:"timestamp"` Event string `json:"event"` Data DatafileUpdateData `json:"data"` }
OptlyMessage model which represents any message received from Optimizely
type OptlyWebhookHandler ¶
type OptlyWebhookHandler struct { ProjectMap map[int64]config.WebhookProject // contains filtered or unexported fields }
OptlyWebhookHandler handles incoming messages from Optimizely
func NewWebhookHandler ¶
func NewWebhookHandler(optlyCache optimizely.Cache, projectMap map[int64]config.WebhookProject) *OptlyWebhookHandler
NewWebhookHandler returns a new instance of OptlyWebhookHandler
func (*OptlyWebhookHandler) HandleWebhook ¶
func (h *OptlyWebhookHandler) HandleWebhook(w http.ResponseWriter, r *http.Request)
HandleWebhook handles incoming webhook messages from Optimizely application
type OverrideBody ¶ added in v0.12.0
type OverrideBody struct { UserID string `json:"userId"` ExperimentKey string `json:"experimentKey"` VariationKey string `json:"variationKey"` }
OverrideBody defines the request body for an override