collection

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Apr 8, 2026 License: Apache-2.0 Imports: 21 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 AI Task Builder Collections (see DCP-2152)
	FeatureNameAITBCollection       = "AI Task Builder Collections"
	FeatureContactURLAITBCollection = "https://researcher-help.prolific.com/en/"
)

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 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 ExportOptions added in v0.0.64

type ExportOptions struct {
	Args   []string
	Output 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