Documentation
¶
Index ¶
- Constants
- type API
- type Client
- func (c *Client) CreateProject(workspaceID string, project model.Project) (*CreateProjectResponse, error)
- func (c *Client) CreateStudy(study model.CreateStudy) (*model.Study, error)
- func (c *Client) CreateWorkspace(workspace model.Workspace) (*CreateWorkspacesResponse, error)
- func (c *Client) DuplicateStudy(ID string) (*model.Study, error)
- func (c *Client) Execute(method, url string, body any, response any) (*http.Response, error)
- func (c *Client) GetAITaskBuilderBatch(batchID string) (*GetAITaskBuilderBatchResponse, error)
- func (c *Client) GetAITaskBuilderBatchStatus(batchID string) (*GetAITaskBuilderBatchStatusResponse, error)
- func (c *Client) GetAITaskBuilderBatches(workspaceID string) (*GetAITaskBuilderBatchesResponse, error)
- func (c *Client) GetAITaskBuilderDatasetStatus(datasetID string) (*GetAITaskBuilderDatasetStatusResponse, error)
- func (c *Client) GetAITaskBuilderResponses(batchID string) (*GetAITaskBuilderResponsesResponse, error)
- func (c *Client) GetCampaigns(workspaceID string, limit, offset int) (*ListCampaignsResponse, error)
- func (c *Client) GetEligibilityRequirements() (*ListRequirementsResponse, error)
- func (c *Client) GetEvents(subscriptionID string, limit, offset int) (*ListHookEventsResponse, error)
- func (c *Client) GetFilterSet(ID string) (*model.FilterSet, error)
- func (c *Client) GetFilterSets(workspaceID string, limit, offset int) (*ListFilterSetsResponse, error)
- func (c *Client) GetFilters() (*ListFiltersResponse, error)
- func (c *Client) GetHookEventTypes() (*ListHookEventTypesResponse, error)
- func (c *Client) GetHookSecrets(workspaceID string) (*ListSecretsResponse, error)
- func (c *Client) GetHooks(workspaceID string, enabled bool, limit, offset int) (*ListHooksResponse, error)
- func (c *Client) GetMe() (*MeResponse, error)
- func (c *Client) GetMessages(userID *string, createdAfter *string) (*ListMessagesResponse, error)
- func (c *Client) GetParticipantGroup(groupID string) (*ViewParticipantGroupResponse, error)
- func (c *Client) GetParticipantGroups(projectID string, limit, offset int) (*ListParticipantGroupsResponse, error)
- func (c *Client) GetProject(ID string) (*model.Project, error)
- func (c *Client) GetProjects(workspaceID string, limit, offset int) (*ListProjectsResponse, error)
- func (c *Client) GetStudies(status, projectID string) (*ListStudiesResponse, error)
- func (c *Client) GetStudy(ID string) (*model.Study, error)
- func (c *Client) GetSubmissions(ID string, limit, offset int) (*ListSubmissionsResponse, error)
- func (c *Client) GetUnreadMessages() (*ListUnreadMessagesResponse, error)
- func (c *Client) GetWorkspaces(limit, offset int) (*ListWorkspacesResponse, error)
- func (c *Client) SendMessage(body string, recipientID string, studyID string) error
- func (c *Client) TransitionStudy(ID, action string) (*TransitionStudyResponse, error)
- func (c *Client) UpdateStudy(ID string, study model.UpdateStudy) (*model.Study, error)
- type CreateProjectResponse
- type CreateWorkspacesResponse
- type GetAITaskBuilderBatchResponse
- type GetAITaskBuilderBatchStatusResponse
- type GetAITaskBuilderBatchesResponse
- type GetAITaskBuilderDatasetStatusResponse
- type GetAITaskBuilderResponsesResponse
- type JSONAPIError
- type JSONAPILinks
- type JSONAPIMeta
- type ListCampaignsResponse
- type ListFilterSetsResponse
- type ListFiltersResponse
- type ListHookEventTypesResponse
- type ListHookEventsResponse
- type ListHooksResponse
- type ListMessagesResponse
- type ListParticipantGroupsResponse
- type ListProjectsResponse
- type ListRequirementsResponse
- type ListSecretsResponse
- type ListStudiesResponse
- type ListSubmissionsResponse
- type ListUnreadMessagesResponse
- type ListWorkspacesResponse
- type MeResponse
- type ResponseMeta
- type SendMessagePayload
- type TransitionStudyResponse
- type ViewParticipantGroupResponse
Constants ¶
const DefaultRecordLimit = 200
DefaultRecordLimit defines how many records to return by default.
const DefaultRecordOffset = 0
DefaultRecordOffset defines how many records we should offset to start with.
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, limit, offset int) (*ListSubmissionsResponse, error)
TransitionStudy(ID, action string) (*TransitionStudyResponse, error)
UpdateStudy(ID string, study model.UpdateStudy) (*model.Study, error)
GetCampaigns(workspaceID string, limit, offset int) (*ListCampaignsResponse, error)
GetHooks(workspaceID string, enabled bool, limit, offset int) (*ListHooksResponse, error)
GetHookEventTypes() (*ListHookEventTypesResponse, error)
GetHookSecrets(workspaceID string) (*ListSecretsResponse, error)
GetEvents(subscriptionID string, limit, offset int) (*ListHookEventsResponse, error)
GetWorkspaces(limit, offset int) (*ListWorkspacesResponse, error)
CreateWorkspace(workspace model.Workspace) (*CreateWorkspacesResponse, error)
GetProjects(workspaceID string, limit, offset int) (*ListProjectsResponse, error)
CreateProject(workspaceID string, project model.Project) (*CreateProjectResponse, error)
GetProject(ID string) (*model.Project, error)
GetParticipantGroups(projectID string, limit, offset int) (*ListParticipantGroupsResponse, error)
GetParticipantGroup(groupID string) (*ViewParticipantGroupResponse, error)
GetFilters() (*ListFiltersResponse, error)
GetFilterSets(workspaceID string, limit, offset int) (*ListFilterSetsResponse, error)
GetFilterSet(ID string) (*model.FilterSet, error)
GetMessages(userID *string, createdAfter *string) (*ListMessagesResponse, error)
SendMessage(body, recipientID, studyID string) error
GetUnreadMessages() (*ListUnreadMessagesResponse, error)
GetAITaskBuilderBatch(batchID string) (*GetAITaskBuilderBatchResponse, error)
GetAITaskBuilderBatchStatus(batchID string) (*GetAITaskBuilderBatchStatusResponse, error)
GetAITaskBuilderBatches(workspaceID string) (*GetAITaskBuilderBatchesResponse, error)
GetAITaskBuilderResponses(batchID string) (*GetAITaskBuilderResponsesResponse, error)
GetAITaskBuilderDatasetStatus(datasetID string) (*GetAITaskBuilderDatasetStatusResponse, error)
}
API represents what is allowed to be called on the Prolific client.
type Client ¶
Client is responsible for interacting with the Prolific API.
func (*Client) CreateProject ¶
func (c *Client) CreateProject(workspaceID string, project model.Project) (*CreateProjectResponse, error)
CreateProject will create you a project
func (*Client) CreateStudy ¶
CreateStudy is responsible for hitting the Prolific API to create a study.
func (*Client) CreateWorkspace ¶
func (c *Client) CreateWorkspace(workspace model.Workspace) (*CreateWorkspacesResponse, error)
CreateWorkspace will create you a workspace
func (*Client) DuplicateStudy ¶
DuplicateStudy will duplicate an existing study.
func (*Client) GetAITaskBuilderBatch ¶
func (c *Client) GetAITaskBuilderBatch(batchID string) (*GetAITaskBuilderBatchResponse, error)
GetAITaskBuilderBatch will return details of an AI Task Builder batch.
func (*Client) GetAITaskBuilderBatchStatus ¶
func (c *Client) GetAITaskBuilderBatchStatus(batchID string) (*GetAITaskBuilderBatchStatusResponse, error)
GetAITaskBuilderBatchStatus will return the status of an AI Task Builder batch.
func (*Client) GetAITaskBuilderBatches ¶
func (c *Client) GetAITaskBuilderBatches(workspaceID string) (*GetAITaskBuilderBatchesResponse, error)
GetAITaskBuilderBatches will return the batches for a given workspace.
func (*Client) GetAITaskBuilderDatasetStatus ¶
func (c *Client) GetAITaskBuilderDatasetStatus(datasetID string) (*GetAITaskBuilderDatasetStatusResponse, error)
GetAITaskBuilderDatasetStatus will return the status of an AI Task Builder dataset.
func (*Client) GetAITaskBuilderResponses ¶
func (c *Client) GetAITaskBuilderResponses(batchID string) (*GetAITaskBuilderResponsesResponse, error)
GetAITaskBuilderResponses will return the responses for an AI Task Builder batch.
func (*Client) GetCampaigns ¶
func (c *Client) GetCampaigns(workspaceID string, limit, offset int) (*ListCampaignsResponse, error)
GetCampaigns will return you a list of Campaign objects.
func (*Client) GetEligibilityRequirements ¶
func (c *Client) GetEligibilityRequirements() (*ListRequirementsResponse, error)
GetEligibilityRequirements will return requirement data.
func (*Client) GetEvents ¶
func (c *Client) GetEvents(subscriptionID string, limit, offset int) (*ListHookEventsResponse, error)
GetEvents will return events created for a subscription
func (*Client) GetFilterSet ¶
GetFilterSet will return the filter set for the given filter set ID
func (*Client) GetFilterSets ¶
func (c *Client) GetFilterSets(workspaceID string, limit, offset int) (*ListFilterSetsResponse, error)
GetFilterSets will return the filter sets in a workspace
func (*Client) GetFilters ¶
func (c *Client) GetFilters() (*ListFiltersResponse, error)
func (*Client) GetHookEventTypes ¶
func (c *Client) GetHookEventTypes() (*ListHookEventTypesResponse, error)
GetHookEventTypes will return all of the event types you can subscribe a hook for.
func (*Client) GetHookSecrets ¶
func (c *Client) GetHookSecrets(workspaceID string) (*ListSecretsResponse, error)
GetHookSecrets will return the secrets for a Workspace
func (*Client) GetHooks ¶
func (c *Client) GetHooks(workspaceID string, enabled bool, limit, offset int) (*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) GetMessages ¶
func (c *Client) GetMessages(userID *string, createdAfter *string) (*ListMessagesResponse, error)
GetMessages will return the messages for the authenticated user
func (*Client) GetParticipantGroup ¶
func (c *Client) GetParticipantGroup(groupID string) (*ViewParticipantGroupResponse, error)
GetParticipantGroup will return the membership in the group
func (*Client) GetParticipantGroups ¶
func (c *Client) GetParticipantGroups(projectID string, limit, offset int) (*ListParticipantGroupsResponse, error)
GetParticipantGroups will return all the participant groups you have access to for a given ProjectID
func (*Client) GetProject ¶
GetProject will return the project for the given project ID
func (*Client) GetProjects ¶
func (c *Client) GetProjects(workspaceID string, limit, offset int) (*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) GetSubmissions ¶
func (c *Client) GetSubmissions(ID string, limit, offset int) (*ListSubmissionsResponse, error)
GetSubmissions will return submission data for a given study.
func (*Client) GetUnreadMessages ¶
func (c *Client) GetUnreadMessages() (*ListUnreadMessagesResponse, error)
GetMessages will return the unread messages for the authenticated user
func (*Client) GetWorkspaces ¶
func (c *Client) GetWorkspaces(limit, offset int) (*ListWorkspacesResponse, error)
GetWorkspaces will return you the workspaces you can see
func (*Client) SendMessage ¶
SendMessage will send a message
func (*Client) TransitionStudy ¶
func (c *Client) TransitionStudy(ID, action string) (*TransitionStudyResponse, error)
TransitionStudy will move the study status to a desired state.
func (*Client) UpdateStudy ¶
UpdateStudy is responsible for updating the Study with a PATCH request.
type CreateProjectResponse ¶
CreateProjectResponse is the response for creating a project.
type CreateWorkspacesResponse ¶
CreateWorkspacesResponse is the response for creating a workspace.
type GetAITaskBuilderBatchResponse ¶
type GetAITaskBuilderBatchResponse struct {
model.AITaskBuilderBatch
}
GetAITaskBuilderBatchResponse is the response for the get AI Task Builder get batch endpoint.
type GetAITaskBuilderBatchStatusResponse ¶
type GetAITaskBuilderBatchStatusResponse struct {
model.AITaskBuilderBatchStatus
}
GetAITaskBuilderBatchStatusResponse is the response for the get AI Task Builder get batch status endpoint.
type GetAITaskBuilderBatchesResponse ¶
type GetAITaskBuilderBatchesResponse struct {
Results []model.AITaskBuilderBatch `json:"results"`
}
GetAITaskBuilderBatchesResponse is the response for the get AI Task Builder get batches by workspace endpoint.
type GetAITaskBuilderDatasetStatusResponse ¶
type GetAITaskBuilderDatasetStatusResponse struct {
Status string `json:"status"`
}
GetAITaskBuilderDatasetStatusResponse is the response for the get AI Task Builder dataset status endpoint.
type GetAITaskBuilderResponsesResponse ¶
type GetAITaskBuilderResponsesResponse struct {
Results []model.AITaskBuilderResponse `json:"results"`
Meta ResponseMeta `json:"meta"`
}
GetAITaskBuilderResponsesResponse is the response for the get AI Task Builder responses endpoint.
type JSONAPIError ¶
type JSONAPILinks ¶
type JSONAPILinks struct {
Links struct {
Self struct {
Href string `json:"href"`
Title string `json:"title"`
} `json:"self"`
Next struct {
Href any `json:"href"`
Title string `json:"title"`
} `json:"next"`
Previous struct {
Href any `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 ¶
type JSONAPIMeta struct {
Meta struct {
Count int `json:"count"`
} `json:"meta"`
}
JSONAPIMeta is the standard meta data structure.
type ListCampaignsResponse ¶
type ListCampaignsResponse struct {
Results []model.Campaign `json:"results"`
*JSONAPILinks
*JSONAPIMeta
}
ListCampaignsResponse is the response for the campaigns request.
type ListFilterSetsResponse ¶
type ListFilterSetsResponse struct {
Results []model.FilterSet `json:"results"`
*JSONAPILinks
*JSONAPIMeta
}
type ListFiltersResponse ¶
type ListFiltersResponse struct {
Results []model.Filter `json:"results"`
*JSONAPILinks
*JSONAPIMeta
}
type ListHookEventTypesResponse ¶
type ListHookEventTypesResponse struct {
Results []model.HookEventType `json:"results"`
}
ListHookEventTypesResponse is the response for the event types hook API.
type ListHookEventsResponse ¶
type ListHookEventsResponse struct {
Results []model.HookEvent `json:"results"`
*JSONAPIMeta
}
ListHookEventsResponse is the response for the hook events API.
type ListHooksResponse ¶
type ListHooksResponse struct {
Results []model.Hook `json:"results"`
*JSONAPIMeta
}
ListHooksResponse is the response for the hook subscriptions.
type ListMessagesResponse ¶
type ListMessagesResponse struct {
Results []model.Message `json:"results"`
*JSONAPILinks
*JSONAPIMeta
}
ListMessagesResponse is the response for the list messages endpoint.
type ListParticipantGroupsResponse ¶
type ListParticipantGroupsResponse struct {
Results []model.ParticipantGroup `json:"results"`
*JSONAPILinks
*JSONAPIMeta
}
ListParticipantGroupsResponse is the list of participant groups response.
type ListProjectsResponse ¶
type ListProjectsResponse struct {
Results []model.Project `json:"results"`
*JSONAPIMeta
}
ListProjectsResponse is the response for the list projects endpoint.
type ListRequirementsResponse ¶
type ListRequirementsResponse struct {
Results []model.Requirement `json:"results"`
*JSONAPILinks
*JSONAPIMeta
}
ListRequirementsResponse is the response for the requirements request.
type ListSecretsResponse ¶
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 ListUnreadMessagesResponse ¶
type ListUnreadMessagesResponse struct {
Results []model.UnreadMessage `json:"results"`
*JSONAPILinks
*JSONAPIMeta
}
ListUnreadMessagesResponse is the response for the unread messages endpoint.
type ListWorkspacesResponse ¶
type ListWorkspacesResponse struct {
Results []model.Workspace `json:"results"`
*JSONAPIMeta
}
ListWorkspacesResponse is the response for the list workspaces endpoint.
type MeResponse ¶
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 ResponseMeta ¶
type ResponseMeta struct {
Count int `json:"count"`
}
ResponseMeta contains metadata about the response.
type SendMessagePayload ¶
type SendMessagePayload struct {
RecipientID string `json:"recipient_id"`
StudyID string `json:"study_id"`
Body string `json:"body"`
}
MessagePayload represents the JSON payload for sending a message
type TransitionStudyResponse ¶
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 []any `json:"peripheral_requirements"`
EligibilityRequirements []any `json:"eligibility_requirements"`
Status string `json:"status"`
}
TransitionStudyResponse is the response for transitioning a study to another status.
type ViewParticipantGroupResponse ¶
type ViewParticipantGroupResponse struct {
Results []model.ParticipantGroupMembership `json:"results"`
}
ViewParticipantGroupResponse is the list of members in a group.