Documentation ¶
Overview ¶
Package items provides API services for items managing.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AskHintRequest ¶
type AskHintRequest struct { TaskToken *token.Task HintToken *token.Hint // contains filtered or unexported fields }
AskHintRequest represents a JSON request body format needed by items.askHint()
func (*AskHintRequest) Bind ¶
func (requestData *AskHintRequest) Bind(r *http.Request) error
Bind of AskHintRequest checks that the asked hint is present
func (*AskHintRequest) UnmarshalJSON ¶
func (requestData *AskHintRequest) UnmarshalJSON(raw []byte) error
UnmarshalJSON unmarshals the items/askHint request data from JSON
type Item ¶
type Item struct { // Nullable URL *string `json:"url"` // Nullable Options *string `json:"options" validate:"null|options"` // default: false EntryFrozenTeams bool `json:"entry_frozen_teams"` // default: false NoScore bool `json:"no_score"` // Identifier to reference the task. // Unique // Nullable TextID *string `json:"text_id"` DisplayDetailsInParent bool `json:"display_details_in_parent"` ReadOnly bool `json:"read_only"` // enum: List,Grid ChildrenLayout string `json:"children_layout"` // enum: forceYes,forceNo,default FullScreen string `json:"full_screen" validate:"oneof=forceYes forceNo default"` HintsAllowed bool `json:"hints_allowed"` FixedRanks bool `json:"fixed_ranks"` // enum: None,All,AllButOne,Categories,One,Manual // default: All ValidationType string `json:"validation_type" validate:"oneof=None All AllButOne Categories One Manual"` // enum: All,Half,One,None // default: None EntryMinAdmittedMembersRatio string `json:"entry_min_admitted_members_ratio" validate:"oneof=All Half One None"` EnteringTimeMin time.Time `json:"entering_time_min"` EnteringTimeMax time.Time `json:"entering_time_max"` EntryMaxTeamSize int32 `json:"entry_max_team_size"` TitleBarVisible bool `json:"title_bar_visible"` AllowsMultipleAttempts bool `json:"allows_multiple_attempts"` // enum: User,Team EntryParticipantType string `json:"entry_participant_type" validate:"oneof=User Team"` // Nullable // // MySQL time (max value is 838:59:59), cannot be set for skills // pattern: ^\d{1,3}:[0-5]?\d:[0-5]?\d$ // example: 838:59:59 Duration *string `json:"duration" validate:"omitempty,duration,cannot_be_set_for_skills,duration_requires_explicit_entry"` // should be true when the duration is not null, cannot be set for skill items RequiresExplicitEntry bool `json:"requires_explicit_entry" validate:"cannot_be_set_for_skills,duration_requires_explicit_entry"` ShowUserInfos bool `json:"show_user_infos"` UsesAPI bool `json:"uses_api"` PromptToJoinGroupByCode bool `json:"prompt_to_join_group_by_code"` }
Item represents input fields that are common to itemCreate & itemUpdate
type ItemWithDefaultLanguageTag ¶
type ItemWithDefaultLanguageTag struct { Item `json:"item,squash"` // nolint:staticcheck SA5008: unknown JSON option "squash" // new `default_language_tag` of the item can only be set to a language // for that an `items_strings` row exists // minLength: 1 // maxLength: 6 DefaultLanguageTag string `json:"default_language_tag" validate:"min=1,max=6"` }
ItemWithDefaultLanguageTag represents common item fields plus 'default_language_tag'
type ItemWithRequiredType ¶
type ItemWithRequiredType struct { Item `json:"item,squash"` // nolint:staticcheck SA5008: unknown JSON option "squash" // Can be equal to 'Skill' only if the parent's type is 'Skill' // required: true // enum: Chapter,Task,Skill Type string `json:"type" validate:"set,oneof=Chapter Task Skill,type_skill"` }
ItemWithRequiredType represents common item fields plus the required type field
type NewItemRequest ¶
type NewItemRequest struct { // `default_language_tag` of the item // required: true LanguageTag string `json:"language_tag" validate:"set,language_tag"` Parent itemParent `json:"parent"` AsRootOfGroupID int64 `json:"as_root_of_group_id,string" validate:"as_root_of_group_id"` // Nullable fields are of pointer types ItemWithRequiredType `json:"item,squash"` // nolint:staticcheck SA5008: unknown JSON option "squash" Children []itemChild `json:"children" validate:"children,children_allowed,dive,child_type_non_skill"` // contains filtered or unexported fields }
NewItemRequest is the expected input for new created item swagger:model itemCreateRequest
type Permission ¶
type Permission struct { ItemID int64 CanViewGeneratedValue int CanGrantViewGeneratedValue int CanWatchGeneratedValue int CanEditGeneratedValue int }
Permission represents item permissions + ItemID
type RawCommonItemFields ¶
type RawCommonItemFields struct { // items ID int64 Type string DisplayDetailsInParent bool ValidationType string EntryParticipantType string EnteringTimeMin database.Time EnteringTimeMax database.Time AllowsMultipleAttempts bool Duration *string NoScore bool DefaultLanguageTag string RequiresExplicitEntry bool *database.RawGeneratedPermissionFields }
RawCommonItemFields represents DB data fields that are common for itemView & itemChildrenView
type RawItemResultFields ¶
type RawItemResultFields struct { // results AttemptID *int64 ScoreComputed float32 Validated bool StartedAt *database.Time LatestActivityAt database.Time EndedAt *database.Time // attempts AttemptAllowsSubmissionsUntil database.Time }
RawItemResultFields represents DB data fields for item results used by itemNavigationView & itemChildrenView
type RawListItem ¶
type RawListItem struct { *RawCommonItemFields // from items_strings: in the user’s default language or (if not available) default language of the item StringLanguageTag string `sql:"column:language_tag"` StringTitle *string `sql:"column:title"` StringImageURL *string `sql:"column:image_url"` StringSubtitle *string `sql:"column:subtitle"` // items_items Category string Order int32 `sql:"column:child_order"` // max from results of the current participant BestScore float32 *RawItemResultFields *RawWatchedGroupStatFields }
RawListItem contains raw fields common for itemChildrenView & itemParentsView
type RawWatchedGroupStatFields ¶
type RawWatchedGroupStatFields struct { CanWatchForGroupResults bool WatchedGroupCanView int WatchedGroupAvgScore float32 WatchedGroupAllValidated bool }
RawWatchedGroupStatFields represents DB data fields for watched group stats used by itemNavigationView & itemChildrenView
Source Files ¶
- apply_dependency.go
- ask_hint.go
- create_attempt.go
- create_dependency.go
- create_item.go
- delete_dependency.go
- delete_item.go
- end_attempt.go
- enter.go
- generate_task_token.go
- get_activity_log.go
- get_breadcrumbs.go
- get_breadcrumbs_from_roots.go
- get_children.go
- get_dependencies.go
- get_entry_state.go
- get_item.go
- get_navigation.go
- get_parents.go
- get_prerequisites.go
- items.go
- list_attempts.go
- list_official_sessions.go
- navigation_data_mapper.go
- path_from_root.go
- publish_result.go
- raw_common_item_fields.go
- raw_item_result_fields.go
- raw_watched_group_stat_fields.go
- save_grade.go
- search_for_items.go
- start_result.go
- start_result_path.go
- update_item.go
- update_item_string.go
- update_result.go