Documentation
¶
Overview ¶
Package API provides functionality for interacting with the Optimizely REST API. Current functionality includes reading projects, environments, and datafiles.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Client ¶
type Client interface { // GetDatafile returns the raw contents of the datafile for a given environment and project. This method will // return an error if the project cannot be found, the environment cannot be found in the project, or if there // is an error retrieving the datafile. GetDatafile(environmentName string, projectID int) ([]byte, error) // GetEnvironment returns a single environment with a given name within a Project with a given ID. // This method can return an error if the given project ID is not found or the environment with the specified name // is not found. GetEnvironmentByProjectID(name string, projectID int) (Environment, error) // GetEnvironmentByProjectName returns the a single environment with a given name within a Project with a given name. // This method can return an error if the given project is not found or the environment with the specified name // is not found. GetEnvironmentByProjectName(key, projectName string) (Environment, error) // GetEnvironmentsByProjectID returns a list of environments located in the project with the given ID. GetEnvironmentsByProjectID(projectID int) ([]Environment, error) // GetEnvironmentsByProjectName returns a list of environments located in the project with the given name. // If there is no project with the given name, an error is returned. GetEnvironmentsByProjectName(projectName string) ([]Environment, error) // GetProjects returns all Optimizely Projects within the Optimizely account that the client has access to. GetProjects() ([]Project, error) // ReportEvents sends serialized events to the Optimizely events API. ReportEvents(events []byte) error }
Client is the interface for interacting with the Optimizely API. NewClient returns a real implementation of this interface and the mocks package contains a version of this interface for testing purposes.
type Datafile ¶
type Datafile struct { ID int `json:"id"` LatestFileSize int `json:"latest_file_size"` OtherURLs []string `json:"other_urls"` Revision int `json:"revision"` SDKKey string `json:"sdk_key"` URL string `json:"url"` }
Datafile is the API representation of a datafile for an environment
type Environment ¶
type Environment struct { ID int `json:"id"` Key string `json:"key"` Name string `json:"name"` ProjectID int `json:"project_id"` Archived bool `json:"archived"` Description string `json:"description"` HasRestrictedPermissions bool `json:"has_restricted_permissions"` Created time.Time `json:"created"` LastModified time.Time `json:"last_modified"` Datafile Datafile `json:"datafile"` IsPrimary bool `json:"is_primary"` }
Environment is the API representation of an Optimizely environment with a project
type Project ¶
type Project struct { ID int `json:"id"` Name string `json:"name"` Description string `json:"description"` Status string `json:"status"` AccountID int `json:"account_id"` Created time.Time `json:"created"` LastModified time.Time `json:"last_modified"` }
Project is the API representation of an Optimizely project
Click to show internal directories.
Click to hide internal directories.