client

package
v0.0.59 Latest Latest
Warning

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

Go to latest
Published: Feb 26, 2026 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Overview

Package client provides an HTTP client for interacting with the Prolific API. It handles authentication, request execution, and response parsing for all supported Prolific resources including studies, workspaces, projects, hooks, messages, and AI Task Builder operations.

Index

Constants

View Source
const DefaultRecordLimit = 200

DefaultRecordLimit defines how many records to return by default.

View Source
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)
	GetStudyCredentialsUsageReportCSV(ID string) (string, error)
	CreateCredentialPool(credentials string, workspaceID string) (*CredentialPoolResponse, error)
	UpdateCredentialPool(credentialPoolID string, credentials string, workspaceID string) (*CredentialPoolResponse, error)
	ListCredentialPools(workspaceID string) (*ListCredentialPoolsResponse, error)

	GetCampaigns(workspaceID string, limit, offset int) (*ListCampaignsResponse, error)

	GetCollections(workspaceID string, limit, offset int) (*ListCollectionsResponse, error)
	GetCollection(ID string) (*model.Collection, error)
	UpdateCollection(ID string, collection model.UpdateCollection) (*model.Collection, 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(workspaceID 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)
	BulkSendMessage(ids []string, body, studyID string) error
	SendGroupMessage(participantGroupID, body string, studyID *string) error

	CreateBonusPayments(payload CreateBonusPaymentsPayload) (*CreateBonusPaymentsResponse, error)
	PayBonusPayments(id string) error

	CreateAITaskBuilderBatch(params CreateBatchParams) (*CreateAITaskBuilderBatchResponse, error)
	CreateAITaskBuilderInstructions(batchID string, instructions CreateAITaskBuilderInstructionsPayload) (*CreateAITaskBuilderInstructionsResponse, error)
	SetupAITaskBuilderBatch(batchID, datasetID string, tasksPerGroup int) (*SetupAITaskBuilderBatchResponse, error)
	CreateAITaskBuilderDataset(workspaceID string, payload CreateAITaskBuilderDatasetPayload) (*CreateAITaskBuilderDatasetResponse, error)
	CreateAITaskBuilderCollection(payload model.CreateAITaskBuilderCollection) (*CreateAITaskBuilderCollectionResponse, error)
	GetAITaskBuilderBatch(batchID string) (*GetAITaskBuilderBatchResponse, error)
	GetAITaskBuilderBatchStatus(batchID string) (*GetAITaskBuilderBatchStatusResponse, error)
	GetAITaskBuilderBatches(workspaceID string) (*GetAITaskBuilderBatchesResponse, error)
	GetAITaskBuilderResponses(batchID string) (*GetAITaskBuilderResponsesResponse, error)
	GetAITaskBuilderTasks(batchID string) (*GetAITaskBuilderTasksResponse, error)
	GetAITaskBuilderDatasetStatus(datasetID string) (*GetAITaskBuilderDatasetStatusResponse, error)
	GetAITaskBuilderDatasetUploadURL(datasetID, fileName string) (*GetAITaskBuilderDatasetUploadURLResponse, error)
}

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

type BulkSendMessagePayload added in v0.0.58

type BulkSendMessagePayload struct {
	IDs     []string `json:"ids"`
	Body    string   `json:"body"`
	StudyID string   `json:"study_id"`
}

BulkSendMessagePayload represents the JSON payload for sending a message to multiple participants.

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) BulkSendMessage added in v0.0.58

func (c *Client) BulkSendMessage(ids []string, body, studyID string) error

BulkSendMessage will send a message to multiple participants

func (*Client) CreateAITaskBuilderBatch added in v0.0.57

func (c *Client) CreateAITaskBuilderBatch(params CreateBatchParams) (*CreateAITaskBuilderBatchResponse, error)

CreateAITaskBuilderBatch will create an AI Task Builder batch.

func (*Client) CreateAITaskBuilderCollection added in v0.0.58

func (c *Client) CreateAITaskBuilderCollection(payload model.CreateAITaskBuilderCollection) (*CreateAITaskBuilderCollectionResponse, error)

CreateAITaskBuilderCollection creates a new AI Task Builder collection.

func (*Client) CreateAITaskBuilderDataset added in v0.0.57

func (c *Client) CreateAITaskBuilderDataset(workspaceID string, payload CreateAITaskBuilderDatasetPayload) (*CreateAITaskBuilderDatasetResponse, error)

CreateAITaskBuilderDataset will create a new AI Task Builder dataset. The workspaceID parameter specifies which workspace the dataset belongs to.

func (*Client) CreateAITaskBuilderInstructions added in v0.0.57

func (c *Client) CreateAITaskBuilderInstructions(batchID string, instructions CreateAITaskBuilderInstructionsPayload) (*CreateAITaskBuilderInstructionsResponse, error)

CreateAITaskBuilderInstructions will create instructions for an AI Task Builder batch.

func (*Client) CreateBonusPayments added in v0.0.58

func (c *Client) CreateBonusPayments(payload CreateBonusPaymentsPayload) (*CreateBonusPaymentsResponse, error)

CreateBonusPayments creates bonus payment records for participants in a study.

func (*Client) CreateCredentialPool added in v0.0.57

func (c *Client) CreateCredentialPool(credentials string, workspaceID string) (*CredentialPoolResponse, error)

CreateCredentialPool creates a new credential pool with the provided credentials. credentials should be a comma-separated string with newlines between entries.

func (*Client) CreateProject

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

CreateProject will create you a project

func (*Client) CreateStudy

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

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

CreateWorkspace will create you a workspace

func (*Client) DuplicateStudy

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

DuplicateStudy will duplicate an existing study.

func (*Client) Execute

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

Execute runs an HTTP request.

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) GetAITaskBuilderDatasetUploadURL added in v0.0.57

func (c *Client) GetAITaskBuilderDatasetUploadURL(datasetID, fileName string) (*GetAITaskBuilderDatasetUploadURLResponse, error)

GetAITaskBuilderDatasetUploadURL will get an upload URL for 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) GetAITaskBuilderTasks added in v0.0.57

func (c *Client) GetAITaskBuilderTasks(batchID string) (*GetAITaskBuilderTasksResponse, error)

GetAITaskBuilderTasks will return the tasks 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) GetCollection added in v0.0.58

func (c *Client) GetCollection(ID string) (*model.Collection, error)

GetCollection will return a single Collection by ID.

func (*Client) GetCollections added in v0.0.58

func (c *Client) GetCollections(workspaceID string, limit, offset int) (*ListCollectionsResponse, error)

GetCollections will return a list of Collection objects for a workspace.

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

func (c *Client) GetFilterSet(ID string) (*model.FilterSet, error)

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(workspaceID string, limit, offset int) (*ListParticipantGroupsResponse, error)

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

func (*Client) GetProject

func (c *Client) GetProject(ID string) (*model.Project, error)

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) GetStudy

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

GetStudy will return a single study

func (*Client) GetStudyCredentialsUsageReportCSV added in v0.0.57

func (c *Client) GetStudyCredentialsUsageReportCSV(ID string) (string, error)

GetStudyCredentialsUsageReportCSV will return the credentials usage report for a study as CSV.

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)

GetUnreadMessages 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) ListCredentialPools added in v0.0.57

func (c *Client) ListCredentialPools(workspaceID string) (*ListCredentialPoolsResponse, error)

ListCredentialPools retrieves a list of credential pools for a specific workspace.

func (*Client) PayBonusPayments added in v0.0.58

func (c *Client) PayBonusPayments(id string) error

PayBonusPayments triggers asynchronous payment of previously created bonus records.

func (*Client) SendGroupMessage added in v0.0.58

func (c *Client) SendGroupMessage(participantGroupID, body string, studyID *string) error

SendGroupMessage will send a message to a participant group

func (*Client) SendMessage

func (c *Client) SendMessage(body string, recipientID string, studyID string) error

SendMessage will send a message

func (*Client) SetupAITaskBuilderBatch added in v0.0.57

func (c *Client) SetupAITaskBuilderBatch(batchID, datasetID string, tasksPerGroup int) (*SetupAITaskBuilderBatchResponse, error)

SetupAITaskBuilderBatch will setup an AI Task Builder batch.

func (*Client) TransitionStudy

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

TransitionStudy will move the study status to a desired state.

func (*Client) UpdateCollection added in v0.0.58

func (c *Client) UpdateCollection(ID string, collection model.UpdateCollection) (*model.Collection, error)

UpdateCollection will update a collection with the given ID

func (*Client) UpdateCredentialPool added in v0.0.57

func (c *Client) UpdateCredentialPool(credentialPoolID string, credentials string, workspaceID string) (*CredentialPoolResponse, error)

UpdateCredentialPool updates an existing credential pool with new credentials. credentials should be a comma-separated string with newlines between entries.

func (*Client) UpdateStudy

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

UpdateStudy is responsible for updating the Study with a PATCH request.

type CreateAITaskBuilderBatchPayload added in v0.0.57

type CreateAITaskBuilderBatchPayload struct {
	Name        string      `json:"name"`
	WorkspaceID string      `json:"workspace_id"`
	DatasetID   string      `json:"dataset_id"`
	TaskDetails TaskDetails `json:"task_details"`
}

CreateAITaskBuilderBatchPayload represents the JSON payload for creating an AI Task Builder batch

type CreateAITaskBuilderBatchResponse added in v0.0.57

type CreateAITaskBuilderBatchResponse struct {
	ID                    string              `json:"id"`
	CreatedAt             string              `json:"created_at"`
	CreatedBy             string              `json:"created_by"`
	Name                  string              `json:"name"`
	Status                string              `json:"status"`
	TotalTaskCount        int                 `json:"total_task_count"`
	TotalInstructionCount int                 `json:"total_instruction_count"`
	TotalTaskGroups       *int                `json:"total_task_groups,omitempty"`
	WorkspaceID           string              `json:"workspace_id"`
	Datasets              []DatasetReference  `json:"datasets"`
	TaskDetails           TaskDetailsResponse `json:"task_details"`
}

CreateAITaskBuilderBatchResponse is the response for creating an AI Task Builder batch.

type CreateAITaskBuilderCollectionResponse added in v0.0.58

type CreateAITaskBuilderCollectionResponse struct {
	ID              string                 `json:"id"`
	Name            string                 `json:"name"`
	WorkspaceID     string                 `json:"workspace_id"`
	SchemaVersion   int                    `json:"schema_version"`
	CreatedBy       string                 `json:"created_by"`
	TaskDetails     *model.TaskDetails     `json:"task_details,omitempty"`
	CollectionItems []model.CollectionPage `json:"collection_items"`
}

CreateAITaskBuilderCollectionResponse is the response for creating an AI Task Builder collection.

type CreateAITaskBuilderDatasetPayload added in v0.0.57

type CreateAITaskBuilderDatasetPayload struct {
	Name        string `json:"name"`
	WorkspaceID string `json:"workspace_id"`
}

CreateAITaskBuilderDatasetPayload represents the request for creating a dataset

type CreateAITaskBuilderDatasetResponse added in v0.0.57

type CreateAITaskBuilderDatasetResponse struct {
	ID                  string              `json:"id"`
	Name                string              `json:"name"`
	CreatedAt           string              `json:"created_at"`
	CreatedBy           string              `json:"created_by"`
	Status              model.DatasetStatus `json:"status"`
	TotalDatapointCount int                 `json:"total_datapoint_count"`
	WorkspaceID         string              `json:"workspace_id"`
}

CreateAITaskBuilderDatasetResponse is the response for creating a dataset

type CreateAITaskBuilderInstructionsPayload added in v0.0.57

type CreateAITaskBuilderInstructionsPayload struct {
	Instructions []Instruction `json:"instructions"`
}

CreateAITaskBuilderInstructionsPayload represents the JSON payload for creating AI Task Builder instructions

type CreateAITaskBuilderInstructionsResponse added in v0.0.57

type CreateAITaskBuilderInstructionsResponse []model.Instruction

CreateAITaskBuilderInstructionsResponse is the response for creating AI Task Builder instructions.

type CreateBatchParams added in v0.0.57

type CreateBatchParams struct {
	Name             string `json:"name"`
	WorkspaceID      string `json:"workspace_id"`
	DatasetID        string `json:"dataset_id"`
	TaskName         string `json:"task_name"`
	TaskIntroduction string `json:"task_introduction"`
	TaskSteps        string `json:"task_steps"`
}

CreateBatchParams represents the parameters for creating an AI Task Builder batch.

type CreateBonusPaymentsPayload added in v0.0.58

type CreateBonusPaymentsPayload struct {
	StudyID    string `json:"study_id"`
	CSVBonuses string `json:"csv_bonuses"`
}

CreateBonusPaymentsPayload represents the JSON payload for creating bonus payments

type CreateBonusPaymentsResponse added in v0.0.58

type CreateBonusPaymentsResponse struct {
	ID          string  `json:"id"`
	Study       string  `json:"study"`
	Amount      float64 `json:"amount"`
	Fees        float64 `json:"fees"`
	VAT         float64 `json:"vat"`
	TotalAmount float64 `json:"total_amount"`
}

CreateBonusPaymentsResponse is the response for creating bonus payments. Monetary fields are returned by the API as floats in minor currency units (e.g., 100.0 = £1.00). Divide by 100 before display via ui.RenderMoney().

type CreateProjectResponse

type CreateProjectResponse struct {
	model.Project
}

CreateProjectResponse is the response for creating a project.

type CreateWorkspacesResponse

type CreateWorkspacesResponse struct {
	model.Workspace
}

CreateWorkspacesResponse is the response for creating a workspace.

type CredentialPoolPayload added in v0.0.57

type CredentialPoolPayload struct {
	Credentials string `json:"credentials"`
	WorkspaceID string `json:"workspace_id"`
}

CredentialPoolPayload represents the JSON payload for creating a credential pool

type CredentialPoolResponse added in v0.0.57

type CredentialPoolResponse struct {
	CredentialPoolID string `json:"credential_pool_id"`
}

CredentialPoolResponse is the response for creating or updating a credential pool.

type CredentialPoolSummary added in v0.0.57

type CredentialPoolSummary struct {
	CredentialPoolID     string `json:"credential_pool_id"`
	TotalCredentials     int    `json:"total_credentials"`
	AvailableCredentials int    `json:"available_credentials"`
}

CredentialPoolSummary represents a summary of a credential pool.

type DatasetReference added in v0.0.57

type DatasetReference struct {
	ID                  string `json:"id"`
	TotalDatapointCount int    `json:"total_datapoint_count"`
}

DatasetReference represents a dataset reference in the batch response

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 model.DatasetStatus `json:"status"`
}

GetAITaskBuilderDatasetStatusResponse is the response for the get AI Task Builder dataset status endpoint.

type GetAITaskBuilderDatasetUploadURLResponse added in v0.0.57

type GetAITaskBuilderDatasetUploadURLResponse struct {
	DatasetID  string `json:"dataset_id"`
	ExpiresAt  string `json:"expires_at"`
	HTTPMethod string `json:"http_method"`
	UploadURL  string `json:"upload_url"`
}

GetAITaskBuilderDatasetUploadURLResponse is the response for getting an upload URL for an AI Task Builder dataset.

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 GetAITaskBuilderTasksResponse added in v0.0.57

type GetAITaskBuilderTasksResponse []string

GetAITaskBuilderTasksResponse is the response for the get AI Task Builder tasks endpoint. The API returns a simple array of task ID strings.

type Instruction added in v0.0.57

type Instruction struct {
	Type                 InstructionType     `json:"type"`
	CreatedBy            string              `json:"created_by"`
	Description          string              `json:"description"`
	Options              []InstructionOption `json:"options,omitempty"`
	AnswerLimit          *int                `json:"answer_limit,omitempty"`
	UnitOptions          []UnitOption        `json:"unit_options,omitempty"`
	DefaultUnit          string              `json:"default_unit,omitempty"`
	UnitPosition         string              `json:"unit_position,omitempty"`
	HelperText           string              `json:"helper_text,omitempty"`
	PlaceholderTextInput string              `json:"placeholder_text_input,omitempty"`
	AcceptedFileTypes    []string            `json:"accepted_file_types,omitempty"`
	MaxFileSizeMB        *float64            `json:"max_file_size_mb,omitempty"`
	MinFileCount         *int                `json:"min_file_count,omitempty"`
	MaxFileCount         *int                `json:"max_file_count,omitempty"`
}

Instruction represents a single instruction in the request payload

type InstructionOption added in v0.0.57

type InstructionOption struct {
	Label   string `json:"label"`
	Value   string `json:"value"`
	Heading string `json:"heading,omitempty"`
}

InstructionOption represents an option for multiple choice instructions

type InstructionType added in v0.0.57

type InstructionType string

InstructionType represents the type of instruction.

const (
	// InstructionTypeMultipleChoice represents a multiple choice instruction.
	InstructionTypeMultipleChoice InstructionType = "multiple_choice"
	// InstructionTypeFreeText represents a free text instruction.
	InstructionTypeFreeText InstructionType = "free_text"
	// InstructionTypeMultipleChoiceWithFreeText represents a multiple choice instruction with free text.
	InstructionTypeMultipleChoiceWithFreeText InstructionType = "multiple_choice_with_free_text"
	// InstructionTypeFreeTextWithUnit represents a free text instruction with unit selection.
	InstructionTypeFreeTextWithUnit InstructionType = "free_text_with_unit"
	// InstructionTypeFileUpload represents a file upload instruction.
	InstructionTypeFileUpload InstructionType = "file_upload"
)

type JSONAPIError

type JSONAPIError struct {
	Error struct {
		Status                int    `json:"status"`
		Title                 string `json:"title"`
		ErrorCode             int    `json:"error_code"`
		Detail                any    `json:"detail"`
		AdditionalInformation string `json:"additional_information"`
	} `json:"error"`
}
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 ListCollectionsResponse added in v0.0.58

type ListCollectionsResponse struct {
	Results []model.Collection `json:"results"`
	*JSONAPIMeta
}

ListCollectionsResponse is the response for the collections API.

type ListCredentialPoolsResponse added in v0.0.57

type ListCredentialPoolsResponse struct {
	CredentialPools []CredentialPoolSummary `json:"credential_pools"`
}

ListCredentialPoolsResponse is the response for listing credential pools.

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

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 ListUnreadMessagesResponse

type ListUnreadMessagesResponse struct {
	Results []model.Message `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 SendGroupMessagePayload added in v0.0.58

type SendGroupMessagePayload struct {
	ParticipantGroupID string `json:"participant_group_id"`
	Body               string `json:"body"`
	StudyID            string `json:"study_id,omitempty"`
}

SendGroupMessagePayload represents the JSON payload for sending a message to a participant group.

type SendMessagePayload

type SendMessagePayload struct {
	RecipientID string `json:"recipient_id"`
	StudyID     string `json:"study_id"`
	Body        string `json:"body"`
}

SendMessagePayload represents the JSON payload for sending a message.

type SetupAITaskBuilderBatchPayload added in v0.0.57

type SetupAITaskBuilderBatchPayload struct {
	DatasetID     string `json:"dataset_id"`
	TasksPerGroup int    `json:"tasks_per_group"`
}

SetupAITaskBuilderBatchPayload represents the JSON payload for setting up an AI Task Builder batch

type SetupAITaskBuilderBatchResponse added in v0.0.57

type SetupAITaskBuilderBatchResponse struct {
}

SetupAITaskBuilderBatchResponse is the response for setting up an AI Task Builder batch. The API returns 202 Accepted with an empty response body.

type SimpleAPIError added in v0.0.57

type SimpleAPIError struct {
	Message string `json:"message"`
	Detail  string `json:"detail"`
}

SimpleAPIError represents a simpler error format used by some endpoints

type TaskDetails added in v0.0.57

type TaskDetails struct {
	TaskName         string `json:"task_name"`
	TaskIntroduction string `json:"task_introduction"`
	TaskSteps        string `json:"task_steps"`
}

TaskDetails represents the task configuration details for batch creation

type TaskDetailsResponse added in v0.0.57

type TaskDetailsResponse struct {
	TaskName         string `json:"task_name"`
	TaskIntroduction string `json:"task_introduction"`
	TaskSteps        string `json:"task_steps"`
}

TaskDetailsResponse represents the task details in the batch response

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 UnitOption added in v0.0.58

type UnitOption struct {
	Label string `json:"label"`
	Value string `json:"value"`
}

UnitOption represents a unit option for free_text_with_unit instructions

type UpdateCredentialPoolPayload added in v0.0.57

type UpdateCredentialPoolPayload struct {
	Credentials string `json:"credentials"`
}

UpdateCredentialPoolPayload represents the JSON payload for updating a credential pool

type ViewParticipantGroupResponse

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