collection

package
v1.3.3 Latest Latest
Warning

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

Go to latest
Published: Nov 9, 2026 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Error messages
	ErrCollectionItemsRequired  = "at least one collection item must be provided"
	ErrPageItemsRequired        = "each page must have at least one item in page_items"
	ErrWorkspaceIDRequired      = "workspace ID is required"
	ErrNameRequired             = "name is required"
	ErrWorkspaceNotFound        = "workspace not found"
	ErrTaskDetailsRequired      = "task_details is required"
	ErrTaskNameRequired         = "task_details.task_name is required"
	ErrTaskIntroductionRequired = "task_details.task_introduction is required"
	ErrTaskStepsRequired        = "task_details.task_steps is required"

	// Feature access constants for Task Builder Collections (see DCP-2152)
	FeatureNameAITBCollection       = "Task Builder Collections"
	FeatureContactURLAITBCollection = "https://researcher-help.prolific.com/en/"
)
View Source
const ExportListFields = "ExportID,Filter,Status,CreatedAt"

ExportListFields are the fields shown in collection export list table and CSV output.

Variables

This section is empty.

Functions

func GetCollectionPreviewPath added in v1.0.0

func GetCollectionPreviewPath(ID string) string

GetCollectionPreviewPath returns the URL path to a collection preview, agnostic of domain

func GetCollectionPreviewURL added in v1.0.0

func GetCollectionPreviewURL(ID string) string

GetCollectionPreviewURL returns the full URL to a collection preview using configuration

func NewCollectionCommand

func NewCollectionCommand(client client.API, w io.Writer) *cobra.Command

NewCollectionCommand creates a new `collection` command

func NewCreateCollectionCommand

func NewCreateCollectionCommand(c client.API, w io.Writer) *cobra.Command

NewCreateCollectionCommand creates a new `collection create` command to allow you to create a collection.

func NewExportCommand added in v0.0.64

func NewExportCommand(c client.API, w io.Writer) *cobra.Command

NewExportCommand creates a new `collection export` command to export a collection's responses as a ZIP archive.

func NewExportDeleteCommand added in v1.3.0

func NewExportDeleteCommand(c client.API, w io.Writer) *cobra.Command

NewExportDeleteCommand creates a new `collection export delete` command to permanently delete an export job for a collection.

func NewExportDownloadCommand added in v1.3.0

func NewExportDownloadCommand(c client.API, w io.Writer) *cobra.Command

NewExportDownloadCommand creates a new `collection export download` command to download an existing export job's ZIP archive without requesting a new export.

func NewExportListCommand added in v1.3.0

func NewExportListCommand(c client.API, w io.Writer) *cobra.Command

NewExportListCommand creates a new `collection export list` command to list every export job requested for a collection.

func NewGetCommand

func NewGetCommand(c client.API, w io.Writer) *cobra.Command

NewGetCommand creates a new `collection get` command to retrieve details about a specific collection.

func NewListCommand

func NewListCommand(c client.API, w io.Writer) *cobra.Command

NewListCommand creates a new `collection list` command to give you details about your collections.

func NewPreviewCommand

func NewPreviewCommand(c client.API, w io.Writer) *cobra.Command

NewPreviewCommand creates a new `collection preview` command to open a collection preview in the browser.

func NewPreviewCommandWithOpener

func NewPreviewCommandWithOpener(c client.API, w io.Writer, browserOpener BrowserOpener) *cobra.Command

NewPreviewCommandWithOpener creates a new `collection preview` command with a custom browser opener. This is useful for testing to avoid opening actual browser windows.

func NewPublishCommand

func NewPublishCommand(c client.API, w io.Writer) *cobra.Command

NewPublishCommand creates a new `collection publish` command to publish a collection as a study.

func NewUpdateCommand

func NewUpdateCommand(client client.API, w io.Writer) *cobra.Command

NewUpdateCommand creates a new `collection update` command to update a collection

func RenderCollection added in v1.0.0

func RenderCollection(collection *model.Collection, w io.Writer) error

RenderCollection will write a detailed view of the selected collection to the provided writer.

Types

type BrowserOpener

type BrowserOpener func(url string) error

BrowserOpener is a function type for opening URLs in a browser. This allows for dependency injection in tests.

var DefaultBrowserOpener BrowserOpener = browser.OpenURL

DefaultBrowserOpener uses the system browser to open URLs.

type CreateCollectionOptions

type CreateCollectionOptions struct {
	Args         []string
	TemplatePath string
}

CreateCollectionOptions is the options for creating a collection command.

type ExportDeleteOptions added in v1.3.0

type ExportDeleteOptions struct {
	Args []string
}

ExportDeleteOptions is the options for the collection export delete command.

type ExportDownloadOptions added in v1.3.0

type ExportDownloadOptions struct {
	Args   []string
	Output string
}

ExportDownloadOptions is the options for the collection export download command.

type ExportListItem added in v1.3.0

type ExportListItem struct {
	ExportID  string
	Filter    string
	Status    string
	CreatedAt string
}

ExportListItem is the flat presentation model used by table and CSV renderers. The API model remains nested (with a pointer Filter field) so JSON output preserves the API response shape.

func NewExportListItems added in v1.3.0

func NewExportListItems(jobs []client.ExportJobListItem) []ExportListItem

NewExportListItems converts export job API models into display-ready rows.

type ExportListOptions added in v1.3.0

type ExportListOptions struct {
	Args   []string
	Output shared.OutputOptions
}

ExportListOptions is the options for the collection export list command.

type ExportOptions added in v0.0.64

type ExportOptions struct {
	Args    []string
	Output  string
	StudyID string
	From    string
	To      string
}

ExportOptions is the options for the collection export command.

type GetOptions

type GetOptions struct {
	Args []string
}

GetOptions is the options for the get collection command.

type InteractiveRenderer added in v1.0.0

type InteractiveRenderer struct{}

InteractiveRenderer runs the bubbles UI framework to provide a rich UI experience for the user.

func (*InteractiveRenderer) Render added in v1.0.0

Render will render the list in an interactive manner.

type ListOptions

type ListOptions struct {
	Args        []string
	Fields      string
	Output      shared.OutputOptions
	WorkspaceID string
	Limit       int
	Offset      int
}

ListOptions is the options for the listing collections command.

type ListView added in v1.0.0

type ListView struct {
	List        list.Model
	Collections map[string]model.Collection
	Collection  *model.Collection
	Client      client.API
}

ListView is responsible for presenting a list view to the user.

func (ListView) Init added in v1.0.0

func (lv ListView) Init() tea.Cmd

Init will initialise the view.

func (ListView) Update added in v1.0.0

func (lv ListView) Update(msg tea.Msg) (tea.Model, tea.Cmd)

Update will update the view.

func (ListView) View added in v1.0.0

func (lv ListView) View() string

View will render the view.

type PreviewOptions

type PreviewOptions struct {
	Args          []string
	BrowserOpener BrowserOpener
}

PreviewOptions is the options for the preview collection command.

type PublishOptions

type PublishOptions struct {
	Args         []string
	Participants int
	Name         string
	Description  string
	TemplatePath string
	Draft        bool
}

PublishOptions is the options for the publish collection command.

type UpdateOptions

type UpdateOptions struct {
	TemplatePath string
}

Jump to

Keyboard shortcuts

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