client

package
v0.0.18 Latest Latest
Warning

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

Go to latest
Published: Jan 27, 2023 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type API

type API interface {
	GetMe() (*MeResponse, error)

	CreateStudy(model.CreateStudy) (*model.Study, error)
	DuplicateStudy(ID string) (*model.Study, error)
	GetEligibilityRequirements() (*ListRequirementsResponse, error)
	GetStudies(status, projectID string) (*ListStudiesResponse, error)
	GetStudy(ID string) (*model.Study, error)
	GetSubmissions(ID string) (*ListSubmissionsResponse, error)
	TransitionStudy(ID, action string) (*TransitionStudyResponse, error)

	GetHooks(enabled bool) (*ListHooksResponse, error)
	GetHookEventTypes() (*ListHookEventTypesResponse, error)
	GetHookSecrets(workspaceID string) (*ListSecretsResponse, error)
	GetEvents(subscriptionID string) (*ListHookEventsResponse, error)

	GetWorkspaces() (*ListWorkspacesResponse, error)
	CreateWorkspace(workspace model.Workspace) (*CreateWorkspacesResponse, error)

	GetProjects(workspaceID string) (*ListProjectsResponse, error)
	CreateProject(workspaceID string, project model.Project) (*CreateProjectResponse, error)

	GetParticipantGroups(projectID string) (*ListParticipantGroupsResponse, error)
	GetParticipantGroup(groupID string) (*ViewParticipantGroupResponse, error)
}

API represents what is allowed to be called on the Prolific client.

type Client

type Client struct {
	Client  *http.Client
	BaseURL string
	Token   string
	Debug   bool
}

Client is responsible for interacting with the Prolific API.

func New

func New() Client

New will return a new Prolific client.

func (*Client) CreateProject added in v0.0.13

func (c *Client) CreateProject(workspaceID string, project model.Project) (*CreateProjectResponse, error)

CreateProject will create you a project

func (*Client) CreateStudy added in v0.0.2

func (c *Client) CreateStudy(study model.CreateStudy) (*model.Study, error)

CreateStudy is responsible for hitting the Prolific API to create a study.

func (*Client) CreateWorkspace added in v0.0.13

func (c *Client) CreateWorkspace(workspace model.Workspace) (*CreateWorkspacesResponse, error)

CreateWorkspace will create you a workspace

func (*Client) DuplicateStudy added in v0.0.15

func (c *Client) DuplicateStudy(ID string) (*model.Study, error)

DuplicateStudy will duplicate an existing study.

func (*Client) Execute added in v0.0.2

func (c *Client) Execute(method, url string, body interface{}, response interface{}) (*http.Response, error)

Execute runs an HTTP request.

func (*Client) GetEligibilityRequirements added in v0.0.2

func (c *Client) GetEligibilityRequirements() (*ListRequirementsResponse, error)

GetEligibilityRequirements will return requirement data.

func (*Client) GetEvents added in v0.0.17

func (c *Client) GetEvents(subscriptionID string) (*ListHookEventsResponse, error)

GetEvents will return events created for a subscription

func (*Client) GetHookEventTypes added in v0.0.11

func (c *Client) GetHookEventTypes() (*ListHookEventTypesResponse, error)

GetHookEventTypes will return all of the event types you can subscribe a hook for.

func (*Client) GetHookSecrets added in v0.0.13

func (c *Client) GetHookSecrets(workspaceID string) (*ListSecretsResponse, error)

GetHookSecrets will return the secrets for a Workspace

func (*Client) GetHooks added in v0.0.10

func (c *Client) GetHooks(enabled bool) (*ListHooksResponse, error)

GetHooks will return the subscriptions to event types for current user.

func (*Client) GetMe

func (c *Client) GetMe() (*MeResponse, error)

GetMe will return your user account details.

func (*Client) GetParticipantGroup added in v0.0.18

func (c *Client) GetParticipantGroup(groupID string) (*ViewParticipantGroupResponse, error)

GetParticipantGroup will return the membership in the group

func (*Client) GetParticipantGroups added in v0.0.18

func (c *Client) GetParticipantGroups(projectID string) (*ListParticipantGroupsResponse, error)

GetParticipantGroups will return all the participant groups you have access to for a given ProjectID

func (*Client) GetProjects added in v0.0.12

func (c *Client) GetProjects(workspaceID string) (*ListProjectsResponse, error)

GetProjects will return the projects for the given workspace ID

func (*Client) GetStudies

func (c *Client) GetStudies(status, projectID string) (*ListStudiesResponse, error)

GetStudies will return you a list of Study objects.

func (*Client) GetStudy

func (c *Client) GetStudy(ID string) (*model.Study, error)

GetStudy will return a single study

func (*Client) GetSubmissions

func (c *Client) GetSubmissions(ID string) (*ListSubmissionsResponse, error)

GetSubmissions will return submission data for a given study.

func (*Client) GetWorkspaces added in v0.0.12

func (c *Client) GetWorkspaces() (*ListWorkspacesResponse, error)

GetWorkspaces will return you the workspaces you can see

func (*Client) TransitionStudy added in v0.0.3

func (c *Client) TransitionStudy(ID, action string) (*TransitionStudyResponse, error)

TransitionStudy will move the study status to a desired state.

type CreateProjectResponse added in v0.0.13

type CreateProjectResponse struct {
	model.Project
}

CreateProjectResponse is the response for creating a project.

type CreateWorkspacesResponse added in v0.0.13

type CreateWorkspacesResponse struct {
	model.Workspace
}

CreateWorkspacesResponse is the response for creating a workspace.

type JSONAPILinks struct {
	Links struct {
		Self struct {
			Href  string `json:"href"`
			Title string `json:"title"`
		} `json:"self"`
		Next struct {
			Href  interface{} `json:"href"`
			Title string      `json:"title"`
		} `json:"next"`
		Previous struct {
			Href  interface{} `json:"href"`
			Title string      `json:"title"`
		} `json:"previous"`
		Last struct {
			Href  string `json:"href"`
			Title string `json:"title"`
		} `json:"last"`
	} `json:"_links"`
}

JSONAPILinks is the standard pagination data structure.

type JSONAPIMeta added in v0.0.13

type JSONAPIMeta struct {
	Meta struct {
		Count int `json:"count"`
	} `json:"meta"`
}

JSONAPIMeta is the standard meta data structure.

type ListHookEventTypesResponse added in v0.0.11

type ListHookEventTypesResponse struct {
	Results []model.HookEventType `json:"results"`
}

ListHookEventTypesResponse is the response for the event types hook API.

type ListHookEventsResponse added in v0.0.17

type ListHookEventsResponse struct {
	Results []model.HookEvent `json:"results"`
}

ListHookEventsResponse is the response for the hook events API.

type ListHooksResponse added in v0.0.10

type ListHooksResponse struct {
	Results []model.Hook `json:"results"`
}

ListHooksResponse is the response for the hook subscriptions.

type ListParticipantGroupsResponse added in v0.0.18

type ListParticipantGroupsResponse struct {
	Results []model.ParticipantGroup `json:"results"`
}

ListParticipantGroupsResponse is the list of participant groups response.

type ListProjectsResponse added in v0.0.12

type ListProjectsResponse struct {
	Results []model.Project `json:"results"`
}

ListProjectsResponse is the response for the list projects endpoint.

type ListRequirementsResponse added in v0.0.2

type ListRequirementsResponse struct {
	Results []model.Requirement `json:"results"`
	*JSONAPILinks
	*JSONAPIMeta
}

ListRequirementsResponse is the response for the requirements request.

type ListSecretsResponse added in v0.0.13

type ListSecretsResponse struct {
	Results []model.Secret `json:"results"`
}

ListSecretsResponse is the list secrets response.

type ListStudiesResponse

type ListStudiesResponse struct {
	Results []model.Study `json:"results"`
	*JSONAPILinks
	*JSONAPIMeta
}

ListStudiesResponse is the response for the /studies API response.

type ListSubmissionsResponse

type ListSubmissionsResponse struct {
	Results []model.Submission `json:"results"`
	*JSONAPILinks
	*JSONAPIMeta
}

ListSubmissionsResponse is the response for the submissions request.

type ListWorkspacesResponse added in v0.0.12

type ListWorkspacesResponse struct {
	Results []model.Workspace `json:"results"`
}

ListWorkspacesResponse is the response for the list workspaces endpoint.

type MeResponse added in v0.0.13

type MeResponse struct {
	ID               string `json:"id"`
	Email            string `json:"email"`
	FirstName        string `json:"first_name"`
	LastName         string `json:"last_name"`
	Name             string `json:"name"`
	Username         string `json:"username"`
	UserType         string `json:"user_type"`
	CurrencyCode     string `json:"currency_code"`
	Balance          int    `json:"balance"`
	AvailableBalance int    `json:"available_balance"`
}

MeResponse is a struct that represents your account.

type TransitionStudyResponse added in v0.0.3

type TransitionStudyResponse struct {
	ID                      string        `json:"id"`
	Name                    string        `json:"name"`
	InternalName            string        `json:"internal_name"`
	Description             string        `json:"description"`
	ExternalStudyURL        string        `json:"external_study_url"`
	ProlificIDOption        string        `json:"prolific_id_option"`
	CompletionCode          string        `json:"completion_code"`
	CompletionOption        string        `json:"completion_option"`
	TotalAvailablePlaces    int           `json:"total_available_places"`
	EstimatedCompletionTime int           `json:"estimated_completion_time"`
	MaximumAllowedTime      int           `json:"maximum_allowed_time"`
	Reward                  int           `json:"reward"`
	DeviceCompatibility     []string      `json:"device_compatibility"`
	PeripheralRequirements  []interface{} `json:"peripheral_requirements"`
	EligibilityRequirements []interface{} `json:"eligibility_requirements"`
	Status                  string        `json:"status"`
}

TransitionStudyResponse is the response for transitioning a study to another status.

type ViewParticipantGroupResponse added in v0.0.18

type ViewParticipantGroupResponse struct {
	Results []model.ParticipantGroupMembership `json:"results"`
}

ViewParticipantGroupResponse is the list of members in a group.

Jump to

Keyboard shortcuts

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