api

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jul 10, 2023 License: MIT Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
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

func CacheExpires

func CacheExpires(r *http.Response) time.Time

CacheExpires helper function to determine remaining time before repeating a request.

Types

type APIClient

type APIClient struct {
	ExperimentApi *ExperimentApiService
	//
	ExperimentGroupApi *ExperimentGroupApiService
	//
	ExperimentRoomApi *ExperimentRoomApiService
	//
	LayerApi *LayerApiService

	SceneApi *SceneApiService

	ParamApi *ParamApiService

	CrowdApi *CrowdApiService

	FlowCtrlApi *FlowCtrlApiService
	// contains filtered or unexported fields
}

APIClient manages communication with the Pairec Experiment Restful Api API v1.0.0 In most cases there should be only one, shared, APIClient.

func NewAPIClient

func NewAPIClient(cfg *Configuration) *APIClient

NewAPIClient 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 (*APIClient) ChangeBasePath

func (c *APIClient) ChangeBasePath(path string)

Change base path to allow switching to mocks

type APIKey

type APIKey struct {
	Key    string
	Prefix string
}

APIKey provides API key based authentication to a request passed via context using ContextAPIKey

type BaseResponse

type BaseResponse struct {
	RequestId string `json:"request_id,omitempty"`
	Code      string `json:"code,omitempty"`
	Message   string `json:"message,omitempty"`
}

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 Configuration

type Configuration struct {
	BasePath      string            `json:"basePath,omitempty"`
	Host          string            `json:"host,omitempty"`
	Token         string            `json:"token,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(host, token string) *Configuration

func (*Configuration) AddDefaultHeader

func (c *Configuration) AddDefaultHeader(key string, value string)

type CrowdApiService

type CrowdApiService service

func (*CrowdApiService) GetCrowdUsersById

func (a *CrowdApiService) GetCrowdUsersById(ctx context.Context, crowdId int64) (ListCrowdUsersResponse, error)

CrowdApiService Get Crowd users By crowd ID Get Crowd users By crowd ID

  • @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
  • @param sceneId Scene Id to get scene info

@return InlineResponse2001

type ExperimentApiListExperimentsOpts

type ExperimentApiListExperimentsOpts struct {
	Status optional.Uint32
}

type ExperimentApiService

type ExperimentApiService service

func (*ExperimentApiService) AddExperiment

func (a *ExperimentApiService) AddExperiment(ctx context.Context, body model.Experiment) (Response, error)

ExperimentApiService Create a new experiment

  • @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
  • @param body Experiment object that needs to be added

@return Response

func (*ExperimentApiService) CloneExperiment

func (a *ExperimentApiService) CloneExperiment(ctx context.Context, experimentId int64) (Response, error)

ExperimentApiService Clone the experiment to creat new experiment

  • @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
  • @param experimentId Experiment Id to get experiment data

@return Response

func (*ExperimentApiService) DeleteExperimentById

func (a *ExperimentApiService) DeleteExperimentById(ctx context.Context, experimentId int64) (Response, error)

ExperimentApiService Delete Experiment By experiment_id when the experiment status is offline

  • @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
  • @param experimentId Experiment Id to delete

@return Response

func (*ExperimentApiService) GetExperimentById

func (a *ExperimentApiService) GetExperimentById(ctx context.Context, experimentId int64) (Response, error)

ExperimentApiService Get Experiment By experiment_id Get Experiment By experiment_id

  • @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
  • @param experimentId Experiment Id to get experiment data

@return Response

func (*ExperimentApiService) ListExperiments

func (a *ExperimentApiService) ListExperiments(ctx context.Context, expGroupId int64, localVarOptionals *ExperimentApiListExperimentsOpts) (ListExperimentsResponse, error)

func (*ExperimentApiService) OfflineExperiment

func (a *ExperimentApiService) OfflineExperiment(ctx context.Context, experimentId int64) (Response, error)

ExperimentApiService change the status of experiment to offline

  • @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
  • @param experimentId Experiment Id to get experiment data

@return Response

func (*ExperimentApiService) OnlineExperiment

func (a *ExperimentApiService) OnlineExperiment(ctx context.Context, experimentId int64) (Response, error)

ExperimentApiService change the status of experiment to online

  • @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
  • @param experimentId Experiment Id to get experiment data

@return Response

func (*ExperimentApiService) UpdateExperiment

func (a *ExperimentApiService) UpdateExperiment(ctx context.Context, body model.Experiment, experimentId int64) (Response, error)

ExperimentApiService update experiment data

  • @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
  • @param body Experiment object that needs to be update
  • @param experimentId ID of experiment to update

@return Response

type ExperimentGroupApiListExperimentGroupsOpts

type ExperimentGroupApiListExperimentGroupsOpts struct {
	Status optional.Uint32
}

type ExperimentGroupApiService

type ExperimentGroupApiService service

func (*ExperimentGroupApiService) AddExperimentGroup

func (a *ExperimentGroupApiService) AddExperimentGroup(ctx context.Context, body model.ExperimentGroup) (Response, error)

ExperimentGroupApiService Create a new experiment group

  • @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
  • @param body ExperimentGroup object that needs to be added

@return InlineResponse2008

func (*ExperimentGroupApiService) DeleteExperimentGroupById

func (a *ExperimentGroupApiService) DeleteExperimentGroupById(ctx context.Context, expGroupId int64) (Response, error)

ExperimentGroupApiService Delete ExperimentGroup By exp_group_id

  • @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
  • @param expGroupId ExperimentGroup Id to delete

@return ModelApiResponse

func (*ExperimentGroupApiService) GetExperimentGroupById

func (a *ExperimentGroupApiService) GetExperimentGroupById(ctx context.Context, expGroupId int64) (Response, error)

ExperimentGroupApiService Get ExperimentGroup By exp_group_id

  • @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
  • @param expGroupId Experiment Id to get experiment data

@return Response

func (*ExperimentGroupApiService) ListExperimentGroups

func (*ExperimentGroupApiService) OfflineExperimentGroup

func (a *ExperimentGroupApiService) OfflineExperimentGroup(ctx context.Context, expGroupId int64) (Response, error)

ExperimentGroupApiService change the status of experiment group to offline

  • @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
  • @param expGroupId ExperimentGroup Id to get experiment group data

@return Response

func (*ExperimentGroupApiService) OnlineExperimentGroup

func (a *ExperimentGroupApiService) OnlineExperimentGroup(ctx context.Context, expGroupId int64) (Response, error)

ExperimentGroupApiService change the status of experiment group to online

  • @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
  • @param expGroupId ExperimentGroup Id to get experiment group data

@return Response

func (*ExperimentGroupApiService) UpdateExperimentGroup

func (a *ExperimentGroupApiService) UpdateExperimentGroup(ctx context.Context, body model.ExperimentGroup, expGroupId int64) (Response, error)

ExperimentGroupApiService update experiment group data

  • @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
  • @param body ExperimentGroup object that needs to be update
  • @param expGroupId ID of experiment group to update

@return Response

type ExperimentRoomApiCloneExperimentRoomOpts

type ExperimentRoomApiCloneExperimentRoomOpts struct {
	Environment optional.Int64
}

type ExperimentRoomApiListExperimentRoomsOpts

type ExperimentRoomApiListExperimentRoomsOpts struct {
	SceneId optional.Int64
	Status  optional.Uint32
}

type ExperimentRoomApiService

type ExperimentRoomApiService service

func (*ExperimentRoomApiService) AddExperimentRoom

func (a *ExperimentRoomApiService) AddExperimentRoom(ctx context.Context, body model.ExperimentRoom) (Response, error)

ExperimentRoomApiService Create a new experiment_room

  • @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
  • @param body ExperimentRoom object that needs to be added

@return InlineResponse2002

func (*ExperimentRoomApiService) CloneExperimentRoom

func (a *ExperimentRoomApiService) CloneExperimentRoom(ctx context.Context, expRoomId int64, localVarOptionals *ExperimentRoomApiCloneExperimentRoomOpts) (Response, error)

func (*ExperimentRoomApiService) DeleteExperimentRoomById

func (a *ExperimentRoomApiService) DeleteExperimentRoomById(ctx context.Context, expRoomId int64) (Response, error)

ExperimentRoomApiService Delete ExperimentRoom By scene ID Delete ExperimentRoom By scene ID

  • @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
  • @param expRoomId ExperimentRoom Id to delete

@return Response

func (*ExperimentRoomApiService) GetExperimentRoomById

func (a *ExperimentRoomApiService) GetExperimentRoomById(ctx context.Context, expRoomId int64) (Response, error)

ExperimentRoomApiService Get ExperimentRoom By exp_room_id Get ExperimentRoom By exp_room_id

  • @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
  • @param expRoomId ExperimentRoom Id to get experiment room data

@return InlineResponse2003

func (*ExperimentRoomApiService) ListExperimentRooms

func (a *ExperimentRoomApiService) ListExperimentRooms(ctx context.Context, environment string, localVarOptionals *ExperimentRoomApiListExperimentRoomsOpts) (ListExperimentRoomsResponse, error)

func (*ExperimentRoomApiService) OfflineExperimentRoom

func (a *ExperimentRoomApiService) OfflineExperimentRoom(ctx context.Context, expRoomId int64) (Response, error)

ExperimentRoomApiService change the status of experiment room to offline

  • @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
  • @param expRoomId ExperimentRoom Id to get experiment room data

@return Response

func (*ExperimentRoomApiService) OnlineExperimentRoom

func (a *ExperimentRoomApiService) OnlineExperimentRoom(ctx context.Context, expRoomId int64) (Response, error)

ExperimentRoomApiService change the status of experiment room to online

  • @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
  • @param expRoomId ExperimentRoom Id to get experiment room data

@return InlineResponse2004

func (*ExperimentRoomApiService) UpdateExperimentRoom

func (a *ExperimentRoomApiService) UpdateExperimentRoom(ctx context.Context, body model.ExperimentRoom, expRoomId int64) (Response, error)

ExperimentRoomApiService update experiment room data

  • @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
  • @param body ExperimentRoom object that needs to be update
  • @param expRoomId ID of experiment room to update

@return Response

type FlowCtrlApiListFlowCtrlPlansOpts

type FlowCtrlApiListFlowCtrlPlansOpts struct {
	SceneId optional.Int32
	Status  optional.String
	Env     optional.String
}

type FlowCtrlApiService

type FlowCtrlApiService service

func (*FlowCtrlApiService) ListFlowCtrlPlans

func (a *FlowCtrlApiService) ListFlowCtrlPlans(ctx context.Context, localVarOptionals *FlowCtrlApiListFlowCtrlPlansOpts) (ListFlowCtrlPlansResponse, error)

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 LayerApiService

type LayerApiService service

func (*LayerApiService) AddLayer

func (a *LayerApiService) AddLayer(ctx context.Context, body model.Layer) (Response, error)

LayerApiService Create a new layer

  • @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
  • @param body Layer object that needs to be added

@return Response

func (*LayerApiService) DeleteLayerById

func (a *LayerApiService) DeleteLayerById(ctx context.Context, layerId int64) (Response, error)

LayerApiService Delete layer By layer id

  • @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
  • @param layerId Layer Id to delete

@return Response

func (*LayerApiService) GetLayerById

func (a *LayerApiService) GetLayerById(ctx context.Context, layerId int64) (Response, error)

LayerApiService Get layer By layer_id

  • @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
  • @param layerId Layer Id to get layer info

@return Response

func (*LayerApiService) ListLayers

func (a *LayerApiService) ListLayers(ctx context.Context, expRoomId int64) (ListLayersResponse, error)

LayerApiService list all Layers By filter condition

  • @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
  • @param expRoomId list all layers of the experiment room

@return Response

func (*LayerApiService) UpdateLayer

func (a *LayerApiService) UpdateLayer(ctx context.Context, body model.Layer, layerId int64) (Response, error)

LayerApiService update layer data

  • @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
  • @param body Layer object that needs to be update
  • @param layerId ID of layer to update

@return Response

type ListCrowdUsersResponse

type ListCrowdUsersResponse struct {
	BaseResponse
	Data map[string][]string `json:"data,omitempty"`
}

type ListExperimentGroupsResponse

type ListExperimentGroupsResponse struct {
	BaseResponse
	Data map[string][]*model.ExperimentGroup `json:"data,omitempty"`
}

type ListExperimentRoomsResponse

type ListExperimentRoomsResponse struct {
	BaseResponse
	Data map[string][]*model.ExperimentRoom `json:"data,omitempty"`
}

type ListExperimentsResponse

type ListExperimentsResponse struct {
	BaseResponse
	Data map[string][]*model.Experiment `json:"data,omitempty"`
}

type ListFlowCtrlPlansResponse

type ListFlowCtrlPlansResponse struct {
	BaseResponse
	Data struct {
		Plans []model.FlowCtrlPlan `json:"plans"`
	} `json:"data,omitempty"`
}

type ListLayersResponse

type ListLayersResponse struct {
	BaseResponse
	Data map[string][]*model.Layer `json:"data,omitempty"`
}

type ListParamsResponse

type ListParamsResponse struct {
	BaseResponse
	Data map[string][]*model.Param `json:"data,omitempty"`
}

type ListScenesResponse

type ListScenesResponse struct {
	BaseResponse
	Data map[string][]*model.Scene `json:"data,omitempty"`
}

type ParamApiGetParamOpts

type ParamApiGetParamOpts struct {
	Environment optional.String
	ParamId     optional.Int64
	ParamName   optional.String
}

type ParamApiService

type ParamApiService service

func (*ParamApiService) AddParam

func (a *ParamApiService) AddParam(ctx context.Context, body model.Param) (Response, error)

ParamApiService add param data

  • @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
  • @param body Param object that needs to be add

@return Response

func (*ParamApiService) DeleteParam

func (a *ParamApiService) DeleteParam(ctx context.Context, paramId int64) (Response, error)

ParamApiService Delete Param By scene id

  • @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
  • @param paramId param id

@return Response

func (*ParamApiService) GetParam

func (a *ParamApiService) GetParam(ctx context.Context, sceneId int64, localVarOptionals *ParamApiGetParamOpts) (ListParamsResponse, error)

func (*ParamApiService) UpdateParam

func (a *ParamApiService) UpdateParam(ctx context.Context, body model.Param, paramId int64) (Response, error)

ParamApiService update param data

  • @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
  • @param body Param object that needs to be add
  • @param paramId param Id

@return Response

type Response

type Response struct {
	BaseResponse
	Data map[string]interface{} `json:"data,omitempty"`
}

type SceneApiService

type SceneApiService service

func (*SceneApiService) AddScene

func (a *SceneApiService) AddScene(ctx context.Context, body model.Scene) (Response, error)

SceneApiService Create a new scene

  • @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
  • @param body Scene object that needs to be added

@return Response

func (*SceneApiService) GetSceneById

func (a *SceneApiService) GetSceneById(ctx context.Context, sceneId int64) (Response, error)

SceneApiService Get Scene By scene ID Get Scene By scene ID

  • @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
  • @param sceneId Scene Id to get scene info

@return InlineResponse2001

func (*SceneApiService) ListAllScenes

func (a *SceneApiService) ListAllScenes(ctx context.Context) (ListScenesResponse, error)

SceneApiService Get all scenes Get all scenes

  • @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().

@return InlineResponse2001

func (*SceneApiService) UpdateScene

func (a *SceneApiService) UpdateScene(ctx context.Context, body model.Scene, sceneId int64) (Response, error)

SceneApiService update scene data

  • @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
  • @param body Scene object that needs to be update
  • @param sceneId ID of scene to update

@return ModelApiResponse

Jump to

Keyboard shortcuts

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