surveygo
facilitates the creation and management of surveys. It provides data structures and methods for creating
surveys, questions, and groups of questions, as well as handling validations.
- All
survey
structures will have a unique identifier callednameId
. - Every reference to a
nameId
must be unique, or in other words:- A question can only be associated with one group.
- A group can only be associated with one question or the initial set of groups
groupsOrder
.
Structure representing a complete survey.
Fields
title
: Survey title. (Required)version
: Survey version. (Required)description
: Survey description. (Optional)questions
: Map of questions. (Required)groups
: Map of groups. (Required)groupsOrder
: Order of the groups. (Required)
Structure representing a question within a survey.
Fields
nameId
: Question identifier. (Required)visible
: Indicates if the question is visible. (Required)type
: Type of the question. (Required)label
: Question label. (Required)required
: Indicates if the question is mandatory to answer. (Required)Value
: Object representing the value of the question. Varies depending on the type of question. (Required)
Structure representing a group of questions in a survey.
Fields
nameId
: Group identifier. (Required)title
: Group title. (Optional)description
: Group description. (Optional)visible
: Indicates if the group is visible. (Required)isExternalSurvey
: Indicates if the group is an external survey. (Optional)questionsIds
: Identifiers of the questions that belong to the group. (Required)
If the group is an external survey, this field will indicate the identifier of the external survey.
single_select
: Single selectmulti_select
: Multiple selectradio
: Single selectcheckbox
: Multiple select
email
: Emailtelephone
: Telephonetext_area
: Free textinput_text
: Free textinformation
: Information field, not editable
external_question
: External question
Structure for all questions in the Choice
group.
placeholder
: Placeholder text for the question. (Optional)defaults
: List of default values for the question. Each value must be a validnameId
of an option. (Optional)options
: Question options. (Required)nameId
: Option identifier. (Required)label
: Option label. (Required)groupsIds
: Identifiers of the groups to be displayed when the option is selected. (Optional)
Email (email
)
placeholder
: Placeholder text for the question. (Optional)allowedDomains
: Allowed domains for the email. (Optional)
Telephone (telephone
)
placeholder
: Placeholder text for the question. (Optional)allowedCountryCodes
: List of allowed country codes. (Optional)
FreeText (input_text
and text_area
)
placeholder
: Placeholder text for the question. (Optional)min
: Minimum length of the text. (Optional)max
: Maximum length of the text. (Optional)
Information (information
)
text
: Text to be displayed. (Required)
Used to create an external questions.
External Question (external_question
)
placeholder
: Placeholder for the question. (Optional)defaults
: List of default values for the question. (Optional)questionType
: Type of the question. Refer to Types of Questions. (Required)externalType
: Type of the external question. (Required)description
: Description of the external question. (Optional)src
: Source of the external question. (Optional)
The Asset
category includes question types designed to handle various types of multimedia assets such as images, videos, audios, and documents. These types allow the incorporation and management of multimedia content in surveys.
image
: For images.video
: For videos.audio
: For audio files.document
: For documents.
Represents an image type question.
Fields
AltText
: Alternative text for improving accessibility. (Optional, max 255 characters)Tags
: Keywords associated with the image. (Optional)Metadata
: A map of key/value pairs for storing additional information. (Optional)MaxSize
: Maximum allowed file size in bytes. (Optional, must be a positive number)AllowedContentTypes
: List of permitted content types (e.g., "image/png", "image/jpeg"). (Optional)
Represents a video type question.
Fields
Caption
: Description or additional information about the video. (Optional, max 255 characters)MaxSize
: Maximum allowed file size in bytes. (Optional, must be a positive number)Tags
: Keywords associated with the video. (Optional)Metadata
: A map of key/value pairs for storing additional information. (Optional)AllowedContentTypes
: List of permitted content types (e.g., "video/mp4", "video/ogg"). (Optional)
Represents an audio type question.
Fields
Caption
: Description or additional information about the audio. (Optional, max 255 characters)MaxSize
: Maximum allowed file size in bytes. (Optional, must be a positive number)Tags
: Keywords associated with the audio. (Optional)Metadata
: A map of key/value pairs for storing additional information. (Optional)AllowedContentTypes
: List of permitted content types (e.g., "audio/mpeg", "audio/wav"). (Optional)
Represents a document type question.
Fields
Caption
: Description or additional information about the document. (Optional, max 255 characters)MaxSize
: Maximum allowed file size in bytes. (Optional, must be a positive number)Tags
: Keywords associated with the document. (Optional)Metadata
: A map of key/value pairs for storing additional information. (Optional)AllowedContentTypes
: List of permitted content types (e.g., "application/pdf", "application/msword"). (Optional)
For the complete list of available functions and methods, please refer to the files:
- operation.go: Basic survey operations (construction, validation, answers review, etc.).
- operation_de_serializers.go: Survey serialization and deserialization.
- operation_group.go: Operations on groups (add, remove, etc.).
- operation_question.go: Operations on questions (add, remove, etc.).