common

package
v0.0.0-...-05a13f1 Latest Latest
Warning

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

Go to latest
Published: Jan 22, 2025 License: Apache-2.0 Imports: 13 Imported by: 2

Documentation

Index

Constants

View Source
const (
	TypeHLSCmaf = "hls_cmaf"
	TypeDash    = "dash"
)
View Source
const (
	ImageStyleDefault  = ImageStyle("default")
	ImageStyleIcon     = ImageStyle("icon")
	ImageStyleFeatured = ImageStyle("featured")
	ImageStylePoster   = ImageStyle("poster")
)

ImageStyles

View Source
const (
	StatusDraft     = Status("draft")
	StatusPublished = Status("published")
	StatusUnlisted  = Status("unlisted")
	StatusArchived  = Status("archived")
)

Status constants

View Source
const (
	TaskTypeQuestion = StudyTaskType("question")
	TaskTypeImage    = StudyTaskType("image")
	TaskTypeVideo    = StudyTaskType("video")
	TaskTypeLink     = StudyTaskType("link")

	QuestionTaskTypeAlternatives = QuestionTaskType("alternatives")
	QuestionTaskTypeText         = QuestionTaskType("text")

	ImageTaskTypePoster = ImageTaskType("poster")
	ImageTaskTypeQuote  = ImageTaskType("quote")
)

TaskTypes

View Source
const (
	StreamServiceAzureMedia = "azure_media_services"
)

StreamServiceAzureMedia Various media services that we have available

View Source
const TargetTypeUsergroups = "usergroups"

Variables

View Source
var (
	ContributionTypeLyricist = ContributionType{"lyricist"}
	ContributionTypeArranger = ContributionType{"arranger"}
	ContributionTypeSinger   = ContributionType{"singer"}
	ContributionTypeSpeaker  = ContributionType{"speaker"}
	ContributionTypeUnknown  = ContributionType{"unknown"}
	ContributionTypes        = enum.New(
		ContributionTypeLyricist,
		ContributionTypeArranger,
		ContributionTypeSinger,
		ContributionTypeSpeaker,
		ContributionTypeUnknown,
	)
)
View Source
var (
	ErrItemNotFound         = newError("item/not-found", "item not found", "Item not found!")
	ErrProfileNotSet        = newError("user/not-authenticated", "profile not set / user unauthenticated", "You must be authenticated for this to work!")
	ErrItemNotPublished     = newError("item/not-published", "item is not published", "Item is not published!")
	ErrItemNoAccess         = newError("item/no-access", "user has no access to this item", "You do not have access to this item!")
	ErrTaskAlreadyCompleted = newError("task/already-completed", "task was already completed", "Task is already completed!")
	ErrInvalidUUID          = newError("uuid/invalid", "invalid uuid passed", "UUID is invalid!")
)

Errors

View Source
var (
	CollectionUnknown     = ItemCollection{"unknown"}
	CollectionShows       = ItemCollection{"shows"}
	CollectionSeasons     = ItemCollection{"seasons"}
	CollectionEpisodes    = ItemCollection{"episodes"}
	CollectionPages       = ItemCollection{"pages"}
	CollectionGames       = ItemCollection{"games"}
	CollectionLinks       = ItemCollection{"links"}
	CollectionPlaylists   = ItemCollection{"playlists"}
	CollectionStudyTopics = ItemCollection{"studytopics"}
	CollectionShorts      = ItemCollection{"shorts"}
	CollectionPersons     = ItemCollection{"persons"}
	Collections           = enum.New(
		CollectionUnknown,
		CollectionShows,
		CollectionSeasons,
		CollectionEpisodes,
		CollectionPages,
		CollectionGames,
		CollectionLinks,
		CollectionPlaylists,
		CollectionStudyTopics,
		CollectionShorts,
		CollectionPersons,
	)
)

Types of items

View Source
var (
	ContentTypeSong      = ContentType{Value: "song"}
	ContentTypeSpeech    = ContentType{Value: "speech"}
	ContentTypeTestimony = ContentType{Value: "testimony"}
	ContentTypeSingAlong = ContentType{Value: "sing_along"}
	ContentTypeOther     = ContentType{Value: "other"}
	ContentTypeTheme     = ContentType{Value: "theme"}
	ContentTypeInterview = ContentType{Value: "interview"}
	ContentTypes         = enum.New(OrderedContentTypes...)
)
View Source
var DefaultLanguages = []string{"en", "no"}

DefaultLanguages is the order of languages if none is defined by the user

View Source
var (
	// IgnoreEpisodeAssetEndpoint is here for ignoring a specific endpoint because it doesn't work.
	IgnoreEpisodeAssetEndpoints = []string{
		"7c011f242c6f4875a52e400061ef784a",
		"942b3eed46ad4ec48e539fa12f81b50e",
	}
)

Functions

This section is empty.

Types

type Achieved

type Achieved struct {
	ID          uuid.UUID
	AchievedAt  time.Time
	ConfirmedAt null.Time
}

Achieved struct

func (Achieved) GetKey

func (a Achieved) GetKey() uuid.UUID

GetKey returns key for this item

type Achievement

type Achievement struct {
	ID          uuid.UUID
	Title       LocaleString
	Description LocaleString
	Images      LocaleMap[null.String]
	GroupID     uuid.NullUUID
	Conditions  []AchievementCondition
}

Achievement is the struct for achievements.sql

func (Achievement) GetKey

func (a Achievement) GetKey() uuid.UUID

GetKey returns key for this item

type AchievementCondition

type AchievementCondition struct {
	ID         uuid.UUID
	Collection string
	Action     string
	Amount     int
}

AchievementCondition is a condition for which an achievement should be completed

type AchievementGroup

type AchievementGroup struct {
	ID    uuid.UUID
	Title LocaleString
}

AchievementGroup is a group of different achievements.sql

func (AchievementGroup) GetKey

func (a AchievementGroup) GetKey() uuid.UUID

GetKey returns key for this item

type AppConfig

type AppConfig struct {
	MinVersion string
}

AppConfig contains configuration of the app.

type Application

type Application struct {
	ID                  int
	UUID                uuid.UUID
	GroupID             uuid.UUID
	Default             bool
	Code                string
	ClientVersion       string
	DefaultPageID       null.Int
	SearchPageID        null.Int
	GamesPageID         null.Int
	RelatedCollectionID null.Int
	SupportEmail        null.String
	Roles               []string
	LivestreamRoles     []string
}

Application contains data for

func (Application) GetKey

func (i Application) GetKey() int

GetKey returns the key for this item

type ApplicationGroup

type ApplicationGroup struct {
	ID    uuid.UUID
	Roles []string
}

ApplicationGroup contains data for

func (ApplicationGroup) GetKey

func (i ApplicationGroup) GetKey() uuid.UUID

GetKey returns the key for this item

type Availability

type Availability struct {
	Unlisted    bool
	Published   bool
	From        time.Time
	To          time.Time
	PublishedOn time.Time
}

Availability struct for availability on items

type BatchLoaders

type BatchLoaders struct {
	ApplicationLoader           *loaders.Loader[int, *Application]
	ApplicationIDFromCodeLoader *loaders.Loader[string, *int]
	ApplicationGroupLoader      *loaders.Loader[uuid.UUID, *ApplicationGroup]

	RedirectLoader                     *loaders.Loader[uuid.UUID, *Redirect]
	RedirectIDFromCodeLoader           *loaders.Loader[string, *uuid.UUID]
	PageLoader                         *loaders.Loader[int, *Page]
	PageIDFromCodeLoader               *loaders.Loader[string, *int]
	CollectionIDFromSlugLoader         *loaders.Loader[string, *int]
	SectionLoader                      *loaders.Loader[int, *Section]
	CollectionLoader                   *loaders.Loader[int, *Collection]
	CollectionItemLoader               *loaders.Loader[int, []*CollectionItem]
	StudyTopicLoader                   *loaders.Loader[uuid.UUID, *StudyTopic]
	StudyLessonLoader                  *loaders.Loader[uuid.UUID, *Lesson]
	StudyTaskLoader                    *loaders.Loader[uuid.UUID, *Task]
	StudyQuestionAlternativesLoader    *loaders.Loader[uuid.UUID, []*QuestionAlternative]
	ShowLoader                         *loaders.Loader[int, *Show]
	SeasonLoader                       *loaders.Loader[int, *Season]
	EpisodeLoader                      *loaders.Loader[int, *Episode]
	EpisodeIDFromLegacyIDLoader        *loaders.Loader[int, *int]
	EpisodeIDFromLegacyProgramIDLoader *loaders.Loader[int, *int]
	LinkLoader                         *loaders.Loader[int, *Link]
	PlaylistLoader                     *loaders.Loader[uuid.UUID, *Playlist]

	FilesLoader   *loaders.Loader[int, []*File]
	StreamsLoader *loaders.Loader[int, []*Stream]

	AssetFilesLoader   *loaders.Loader[int, []*File]
	AssetStreamsLoader *loaders.Loader[int, []*Stream]

	EventLoader        *loaders.Loader[int, *Event]
	EventEntriesLoader *loaders.Loader[int, []*int]

	FAQCategoryLoader    *loaders.Loader[uuid.UUID, *FAQCategory]
	QuestionLoader       *loaders.Loader[uuid.UUID, *Question]
	MessageGroupLoader   *loaders.Loader[int, *MessageGroup]
	SurveyLoader         *loaders.Loader[uuid.UUID, *Survey]
	SurveyQuestionLoader *loaders.Loader[uuid.UUID, *SurveyQuestion]
	GameLoader           *loaders.Loader[uuid.UUID, *Game]
	ShortLoader          *loaders.Loader[uuid.UUID, *Short]
	ShortsMediaIDLoader  *loaders.Loader[uuid.UUID, *uuid.UUID]

	MemberLoader       *loaders.Loader[int, *members.Member]
	OrganizationLoader *loaders.Loader[uuid.UUID, *members.Organization]

	EpisodeProgressLoader   *loaders.Loader[uuid.UUID, []*int]
	EpisodeIDFromUuidLoader *loaders.Loader[uuid.UUID, *int]
	ShowIDFromUuidLoader    *loaders.Loader[uuid.UUID, *int]
	// Permissions
	ShowPermissionLoader    *loaders.Loader[int, *Permissions[int]]
	SeasonPermissionLoader  *loaders.Loader[int, *Permissions[int]]
	EpisodePermissionLoader *loaders.Loader[int, *Permissions[int]]
	PagePermissionLoader    *loaders.Loader[int, *Permissions[int]]
	SectionPermissionLoader *loaders.Loader[int, *Permissions[int]]

	CompletedTopicsLoader         *loaders.Loader[uuid.UUID, []*uuid.UUID]
	CompletedLessonsLoader        *loaders.Loader[uuid.UUID, []*uuid.UUID]
	CompletedTasksLoader          *loaders.Loader[uuid.UUID, []*uuid.UUID]
	CompletedAndLockedTasksLoader *loaders.Loader[uuid.UUID, []*uuid.UUID]

	// Achievements
	AchievementLoader             *loaders.Loader[uuid.UUID, *Achievement]
	AchievementGroupLoader        *loaders.Loader[uuid.UUID, *AchievementGroup]
	AchievementsLoader            *loaders.Loader[uuid.UUID, []*uuid.UUID]
	UnconfirmedAchievementsLoader *loaders.Loader[uuid.UUID, []*uuid.UUID]

	AchievementGroupAchievementsLoader *loaders.Loader[uuid.UUID, []*uuid.UUID]

	ComputedDataLoader *loaders.Loader[uuid.UUID, []*ComputedData]

	UserLoader *loaders.Loader[string, *User]

	// UserCollections
	UserCollectionLoader         *loaders.Loader[uuid.UUID, *UserCollection]
	UserCollectionEntryLoader    *loaders.Loader[uuid.UUID, *UserCollectionEntry]
	UserCollectionEntryIDsLoader *loaders.Loader[uuid.UUID, []*uuid.UUID]

	ProfileUserCollectionIDsLoader *loaders.Loader[uuid.UUID, []*uuid.UUID]
	ProfileMyListCollectionID      *loaders.Loader[uuid.UUID, *uuid.UUID]

	PromptLoader *loaders.Loader[uuid.UUID, *Prompt]

	MediaItemPrimaryEpisodeIDLoader *loaders.Loader[uuid.UUID, *int]
	TimedMetadataLoader             *loaders.Loader[uuid.UUID, *TimedMetadata]
	ChaptersLoader                  *loaders.Loader[int, []*TimedMetadata]
	PersonLoader                    *loaders.Loader[uuid.UUID, *Person]
	SongLoader                      *loaders.Loader[uuid.UUID, *Song]
	PhraseLoader                    *loaders.Loader[string, *Phrase]
	ContributionsLoader             *loaders.Loader[int32, *Contribution]
}

BatchLoaders contains loaders for the different items

type CalendarEntry

type CalendarEntry struct {
	ID          int
	EventID     null.Int
	Title       LocaleString
	Description LocaleString
	Start       time.Time
	End         time.Time
	Type        null.String
	IsReplay    bool
	ItemID      null.Int
}

CalendarEntry contains details about a specific TvGuide entry

func (CalendarEntry) GetKey

func (i CalendarEntry) GetKey() int

GetKey returns the key for this item

type Collection

type Collection struct {
	ID             int          `json:"id"`
	Slugs          LocaleString `json:"slugs"`
	Title          LocaleString `json:"title"`
	Type           string       `json:"type"`
	AdvancedType   null.String  `json:"advancedType"`
	Filter         *Filter      `json:"filter"`
	NumberInTitles bool         `json:"numberInTitles"`
}

Collection is the definition of the Collection object

func (Collection) GetKey

func (i Collection) GetKey() int

GetKey returns the key for this item

type CollectionItem

type CollectionItem struct {
	ID           int            `json:"id"`
	Sort         int            `json:"sort"`
	CollectionID int            `json:"collectionId"`
	Type         ItemCollection `json:"type"`
	ItemID       string         `json:"itemId"`
}

CollectionItem is the definition of the CollectionItem object

func (CollectionItem) GetKey

func (s CollectionItem) GetKey() int

GetKey returns the key for this item

type ComputedCondition

type ComputedCondition struct {
	ID       uuid.UUID
	Type     string
	Operator string
	Value    string
}

ComputedCondition is to assert if the computed should be applied

type ComputedData

type ComputedData struct {
	GroupID    uuid.UUID
	ID         uuid.UUID
	Result     string
	Conditions []ComputedCondition
}

ComputedData contains computed things

type ContentType

type ContentType enum.Member[string]

type Contribution

type Contribution struct {
	ItemID      string    `json:"itemId"`
	ItemType    string    `json:"itemType"`
	MediaItemID uuid.UUID `json:"mediaItemId"`
	Type        string    `json:"type"`
	PersonID    uuid.UUID `json:"personId"`
	ContentType string    `json:"contentType"`
}

type ContributionType

type ContributionType enum.Member[string]

type Device

type Device struct {
	Token     string
	ProfileID uuid.UUID
	UpdatedAt time.Time
	Name      string
	Languages []string
}

Device is a profile-linked device with a token for notifications

type Episode

type Episode struct {
	ID                    int       `json:"id"`
	UUID                  uuid.UUID `json:"uuid"`
	Status                Status    `json:"unlisted"`
	Type                  string    `json:"type"`
	PreventPublicIndexing bool      `json:"preventPublicIndexing"`
	LegacyID              null.Int  `json:"legacyId"`
	LegacyProgramID       null.Int  `json:"legacyProgramId"`
	SeasonID              null.Int  `json:"seasonId"`
	ProductionDateInTitle bool      `json:"publishDateInTitle"`
	PublishDate           time.Time `json:"publishDate"`
	ProductionDate        time.Time `json:"productionDate"`
	AvailableFrom         time.Time `json:"availableFrom"`
	AvailableTo           time.Time `json:"availableTo"`
	Number                null.Int  `json:"number"`
	Duration              int       `json:"duration"`
	AgeRating             string    `json:"ageRating"`

	AssetID      null.Int       `json:"assetId"`
	Assets       LocaleMap[int] `json:"assets"`
	AssetVersion string         `json:"assetVersion"`

	Images Images `json:"images"`
	TagIDs []int  `json:"tagIds"`

	PublicTitle      null.String  `json:"publicTitle"`
	Title            LocaleString `json:"title"`
	Description      LocaleString `json:"description"`
	ExtraDescription LocaleString `json:"extraDescription"`
	NumberInTitle    bool         `json:"numberInTitle"`

	ContentType null.String `json:"contentType"`
	Audience    null.String `json:"audience"`
}

Episode is the definition of the Episode object

func (Episode) GetKey

func (i Episode) GetKey() int

GetKey returns the key for this item

func (Episode) GetStatus

func (i Episode) GetStatus() Status

GetStatus returns the status for this item

func (Episode) GetTagIDs

func (i Episode) GetTagIDs() []int

GetTagIDs returns ids of related tags

func (Episode) Unlisted

func (i Episode) Unlisted() bool

Unlisted returns true if item is unlisted

type EpisodeContext

type EpisodeContext struct {
	CollectionID null.Int
	Cursor       null.String
	Shuffle      null.Bool
}

EpisodeContext contains context for episode

type Event

type Event struct {
	ID    int
	Title LocaleString
	Start time.Time
	End   time.Time
}

Event contains details about a calendar event

func (Event) GetKey

func (i Event) GetKey() int

GetKey returns the key for this item

type FAQCategory

type FAQCategory struct {
	ID    uuid.UUID
	Title LocaleString
}

FAQCategory contains the name of the FAQ category

func (FAQCategory) GetKey

func (i FAQCategory) GetKey() uuid.UUID

GetKey returns the key for this item

type File

type File struct {
	ID               int         `json:"id"`
	Type             string      `json:"type"`
	EpisodeID        int         `json:"episodeId"`
	AssetID          int         `json:"assetId"`
	AudioLanguage    null.String `json:"audioLanguage"`
	SubtitleLanguage null.String `json:"subtitleLanguage"`
	Path             string      `json:"path"`
	Storage          string      `json:"storage"`
	MimeType         string      `json:"mimeType"`
	Resolution       string      `json:"resolution"`
	Size             int         `json:"size"`
}

File item type

type Filter

type Filter struct {
	Filter          json.RawMessage
	SortBy          string
	SortByDirection string
	Limit           *int
}

Filter struct contains filter data

type FilteredLoaders

type FilteredLoaders struct {
	Key string

	EpisodeFilterLoader          *loaders.Loader[int, *int]
	EpisodeUUIDFilterLoader      *loaders.Loader[uuid.UUID, *uuid.UUID]
	EpisodesLoader               *loaders.Loader[int, []*int]
	TagEpisodesLoader            *loaders.Loader[int, []*int]
	SeasonFilterLoader           *loaders.Loader[int, *int]
	SeasonsLoader                *loaders.Loader[int, []*int]
	ShowFilterLoader             *loaders.Loader[int, *int]
	ShowUUIDFilterLoader         *loaders.Loader[uuid.UUID, *uuid.UUID]
	SectionsLoader               *loaders.Loader[int, []*int]
	CollectionItemsLoader        *loaders.Loader[int, []*CollectionItem]
	CollectionItemIDsLoader      *loaders.Loader[int, []Identifier]
	CalendarEntryLoader          *loaders.Loader[int, *CalendarEntry]
	StudyTopicFilterLoader       *loaders.Loader[uuid.UUID, *uuid.UUID]
	StudyLessonsLoader           *loaders.Loader[uuid.UUID, []*uuid.UUID]
	StudyLessonFilterLoader      *loaders.Loader[uuid.UUID, *uuid.UUID]
	StudyTasksLoader             *loaders.Loader[uuid.UUID, []*uuid.UUID]
	StudyTaskFilterLoader        *loaders.Loader[uuid.UUID, *uuid.UUID]
	SurveyQuestionsLoader        *loaders.Loader[uuid.UUID, []*uuid.UUID]
	ContributionsForPersonLoader *loaders.Loader[uuid.UUID, []*Contribution]

	FAQQuestionsLoader *loaders.Loader[uuid.UUID, []*uuid.UUID]

	//Relations
	StudyLessonEpisodesLoader *loaders.Loader[uuid.UUID, []*int]
	EpisodeStudyLessonsLoader *loaders.Loader[int, []*uuid.UUID]
	StudyLessonLinksLoader    *loaders.Loader[uuid.UUID, []*int]
	LinkStudyLessonsLoader    *loaders.Loader[int, []*uuid.UUID]

	// Lists
	PromptIDsLoader       func(ctx context.Context) ([]uuid.UUID, error)
	FAQCategoryIDsLoader  func(ctx context.Context) ([]uuid.UUID, error)
	ShortIDsLoader        func(ctx context.Context) ([][]uuid.UUID, error)
	ShortWithScoresLoader func(ctx context.Context) ([]ShortIDWithMeta, error)
}

FilteredLoaders contains loaders that will be filtered by permissions.

type Game

type Game struct {
	ID           uuid.UUID `json:"id"`
	Title        LocaleString
	Description  LocaleString
	Images       Images
	Url          string
	RequiresAuth bool
}

Game contains details for a game

type GlobalConfig

type GlobalConfig struct {
	LiveOnline  bool
	NPAWEnabled bool
}

GlobalConfig contains configuration of all clients

type Identifier

type Identifier struct {
	Collection string
	ID         string
}

Identifier contains basic data for identifying an item in a list

type ImageStyle

type ImageStyle = string

ImageStyle is the specific styles

type ImageTaskType

type ImageTaskType = string

ImageTaskType "poster" "quote"

type Images

type Images map[string]LocaleMap[string]

Images is a map of styles with related images

func (Images) GetDefault

func (i Images) GetDefault(languages []string, style ImageStyle) *string

GetDefault returns the default image for language and style

func (Images) GetForLanguages

func (i Images) GetForLanguages(languages []string) map[ImageStyle]*string

GetForLanguages retrieves Image for

func (Images) GetStrict

func (i Images) GetStrict(languages []string, style ImageStyle) *string

GetStrict returns only an image with the specified style

type ItemCollection

type ItemCollection enum.Member[string]

ItemCollection is what type of item current struct is

type Lesson

type Lesson struct {
	ID          uuid.UUID
	TopicID     uuid.UUID
	Title       LocaleString
	Description LocaleString
	Images      Images
}

Lesson is a lesson within a topic

func (Lesson) GetKey

func (i Lesson) GetKey() uuid.UUID

GetKey returns the key for this item

type Link struct {
	ID                  int           `json:"id"`
	Title               LocaleString  `json:"title"`
	Description         LocaleString  `json:"description"`
	URL                 string        `json:"url"`
	Images              Images        `json:"images"`
	Type                LinkType      `json:"type"`
	ComputedDataGroupID uuid.NullUUID `json:"computedDataGroupId"`
}

Link contains link data

func (Link) GetKey

func (i Link) GetKey() int

GetKey returns the key for this item

type LinkType

type LinkType = string

LinkType is the general type of the link

type LocaleMap

type LocaleMap[T any] map[string]T

LocaleMap is a map of strings to nullable strings

func (LocaleMap[T]) Get

func (localeMap LocaleMap[T]) Get(languages []string) T

Get from a translation map based on the fallbacks

func (LocaleMap[T]) GetValueOrNil

func (localeMap LocaleMap[T]) GetValueOrNil(languages []string) *T

GetValueOrNil returns either the value for selected languages or nil

func (LocaleMap[T]) Has

func (localeMap LocaleMap[T]) Has(key string) bool

Has returns true if the map has the specified key

type LocaleString

type LocaleString LocaleMap[null.String]

LocaleString is a map of strings to nullable strings

func (LocaleString) Any

func (localeString LocaleString) Any() bool

Any returns true if there's any valid value in the map

func (LocaleString) AsJSON

func (localeString LocaleString) AsJSON() []byte

AsJSON returns the values as a JSON string

For example: ```

{
	"de": "Wilkommen",
 "en": "Welcome",
}

func (LocaleString) Get

func (localeString LocaleString) Get(languages []string) string

Get from a translation map based on the fallbacks

func (LocaleString) GetValueOrNil

func (localeString LocaleString) GetValueOrNil(languages []string) *string

GetValueOrNil returns either the value for selected languages or nil

func (LocaleString) Has

func (localeString LocaleString) Has(key string) bool

Has returns a bool if the LocaleString contains a value for the specified key

func (LocaleString) Placeholder

func (localeString LocaleString) Placeholder(placeholder string, replacementMap LocaleString) LocaleString

Placeholder replaces the specified placeholder with values from the replacementMap

func (LocaleString) Prefix

func (localeString LocaleString) Prefix(prefix string) LocaleString

Prefix all entries with prefix, returns new map after

type MediaProgress

type MediaProgress struct {
	ProfileID uuid.UUID `json:"profileId"`
	MediaID   uuid.UUID `json:"itemId"`
	Progress  float64   `json:"progress"`
	Duration  float64   `json:"duration"`
	Watched   int       `json:"watched"`
	WatchedAt null.Time `json:"watchedAt"`
	UpdatedAt time.Time `json:"updatedAt"`
	FromStart bool      `json:"fromStart"`
}

MediaProgress is the profile progress for a specific media item

type Message

type Message struct {
	ID      int          `json:"id"`
	Style   string       `json:"style"`
	Title   LocaleString `json:"message"`
	Content LocaleString `json:"details"`
}

Message is a message

type MessageGroup

type MessageGroup struct {
	ID       int       `json:"id"`
	Enabled  bool      `json:"enabled"`
	Messages []Message `json:"messages"`
}

MessageGroup is a group of messages

func (MessageGroup) GetKey

func (i MessageGroup) GetKey() int

GetKey returns key for this item

type Notification

type Notification struct {
	ID                 uuid.UUID
	Status             Status
	Title              LocaleString           `json:"title"`
	Description        LocaleString           `json:"description"`
	Images             LocaleMap[null.String] `json:"images"`
	ScheduleAt         null.Time              `json:"scheduleAt"`
	SendStarted        null.Time              `json:"sendStarted"`
	SendCompleted      null.Time              `json:"sendCompleted"`
	DeepLink           null.String            `json:"deepLink"`
	Action             null.String            `json:"action"`
	HighPriority       bool                   `json:"highPriority"`
	TargetIDs          []uuid.UUID            `json:"targetIds"`
	ApplicationGroupID uuid.UUID

	// inherited from the application group
	FirebaseProjectID null.String `json:"firebaseProjectId"`
}

Notification contains notification data

type Page

type Page struct {
	ID          int          `json:"id"`
	Code        string       `json:"code"`
	Title       LocaleString `json:"title"`
	Description LocaleString `json:"description"`
	Images      Images       `json:"images"`
}

Page is the definition of the Page object

func (Page) GetKey

func (i Page) GetKey() int

GetKey returns the key for this item

type Permissions

type Permissions[k comparable] struct {
	ItemID       k
	Availability Availability
	Roles        Roles
}

Permissions contains permissions that restrict access to items

type Person

type Person struct {
	ID     uuid.UUID
	Name   string
	Images Images
}

Person contains some metadata for people

type Phrase

type Phrase struct {
	Key   string
	Value LocaleString
}

Phrase is a key value pair for translations

type Playlist

type Playlist struct {
	ID           uuid.UUID
	CollectionID null.Int
	Title        LocaleString
	Description  LocaleString
	Images       Images
}

Playlist is a collection of items

func (Playlist) GetKey

func (i Playlist) GetKey() uuid.UUID

GetKey returns the key for this item

type Profile

type Profile struct {
	ID     uuid.UUID
	UserID string
	Name   string
}

Profile is the entry point for most user-specific content

type ProfileLoaders

type ProfileLoaders struct {
	ProgressLoader                *loaders.Loader[int, *Progress]
	TaskCompletedLoader           *loaders.Loader[uuid.UUID, *uuid.UUID]
	AchievementAchievedAtLoader   *loaders.Loader[uuid.UUID, *Achieved]
	GetSelectedAlternativesLoader *loaders.Loader[uuid.UUID, *SelectedAlternatives]

	SeasonDefaultEpisodeLoader *loaders.Loader[int, *int]
	ShowDefaultEpisodeLoader   *loaders.Loader[int, *int]

	MediaProgressLoader *loaders.Loader[uuid.UUID, *MediaProgress]

	TopicDefaultLessonLoader *loaders.Loader[uuid.UUID, *uuid.UUID]
}

ProfileLoaders contains loaders per profile

type Progress

type Progress struct {
	EpisodeID int
	ShowID    null.Int
	Progress  int
	Duration  int
	Watched   int
	WatchedAt null.Time
	UpdatedAt time.Time
	Context   EpisodeContext
}

Progress contains basic data for progress

func (Progress) GetKey

func (i Progress) GetKey() int

GetKey returns the key for this item

type Prompt

type Prompt struct {
	ID             uuid.UUID `json:"id"`
	Type           string
	Title          LocaleString
	SecondaryTitle LocaleString
	SurveyID       uuid.NullUUID
	From           time.Time
	To             time.Time
}

Prompt is a prompt that shows up in app

type Question

type Question struct {
	ID         uuid.UUID
	CategoryID uuid.UUID
	Question   LocaleString
	Answer     LocaleString
}

Question contains question data

func (Question) GetKey

func (i Question) GetKey() uuid.UUID

GetKey returns the key for this item

type QuestionAlternative

type QuestionAlternative struct {
	ID        uuid.UUID
	TaskID    uuid.UUID
	Title     LocaleString
	IsCorrect bool
}

QuestionAlternative is an alternative for a question

func (QuestionAlternative) GetKey

func (i QuestionAlternative) GetKey() uuid.UUID

GetKey returns the key for this item

type QuestionTaskType

type QuestionTaskType = string

QuestionTaskType "alternatives" "text"

type Redirect

type Redirect struct {
	ID                     uuid.UUID
	Code                   string
	TargetURL              string
	IncludeToken           bool
	RequiresAuthentication bool
}

Redirect contains data for an authenticated redirect

func (Redirect) GetKey

func (r Redirect) GetKey() uuid.UUID

GetKey returns the identifier for this object

type Roles

type Roles struct {
	Access      []string
	Download    []string
	EarlyAccess []string
}

Roles struct for roles on item

type SearchQuery

type SearchQuery struct {
	Query    string  `json:"query"`
	Limit    *int    `json:"limit"`
	Offset   *int    `json:"offset"`
	Type     *string `json:"type"`
	MinScore *int    `json:"minScore"`
}

SearchQuery used as body in the POST request to the API

type SearchResult

type SearchResult struct {
	ResultCount int                `json:"resultCount"`
	Result      []SearchResultItem `json:"result"`
	HitCount    int                `json:"hitCount"`
	Page        int                `json:"page"`
	PageCount   int                `json:"pageCount"`
	TopScore    int                `json:"topScore"`
}

SearchResult for exposing a list of search results

type SearchResultItem

type SearchResultItem struct {
	ID          int     `json:"id"`
	LegacyID    *int    `json:"legacyID"`
	Duration    *int    `json:"duration"`
	AgeRating   *string `json:"ageRating"`
	Collection  string  `json:"collection"`
	Title       string  `json:"title"`
	Header      *string `json:"header"`
	Description *string `json:"description"`
	ShowID      *int    `json:"showId,omitempty"`
	Show        *string `json:"show,omitempty"`
	SeasonID    *int    `json:"seasonId,omitempty"`
	Season      *string `json:"season,omitempty"`
	Highlight   *string `json:"highlight"`
	Image       *string `json:"thumbnail"`
	Url         string  `json:"url"`
}

SearchResultItem for exposing search results through the API

type Season

type Season struct {
	ID          int          `json:"id"`
	Status      Status       `json:"status"`
	LegacyID    null.Int     `json:"legacyId"`
	TagIDs      []int        `json:"tagIds"`
	Number      int          `json:"number"`
	AgeRating   string       `json:"ageRating"`
	PublicTitle null.String  `json:"publicTitle"`
	Title       LocaleString `json:"title"`
	Description LocaleString `json:"description"`
	ShowID      int          `json:"showId"`
	Image       null.String  `json:"image"`
	Images      Images       `json:"images"`
}

Season is the definition of the Season object

func (Season) GetKey

func (i Season) GetKey() int

GetKey returns the key for this item

func (Season) GetStatus

func (i Season) GetStatus() Status

GetStatus returns the status for this item

func (Season) GetTagIDs

func (i Season) GetTagIDs() []int

GetTagIDs returns ids of related tags

func (Season) Unlisted

func (i Season) Unlisted() bool

Unlisted returns true if item is unlisted

type Section

type Section struct {
	ID                  int            `json:"id"`
	Sort                int            `json:"sort"`
	PageID              int            `json:"pageId"`
	Type                string         `json:"type"`
	ShowTitle           bool           `json:"showTitle"`
	Title               LocaleString   `json:"title"`
	Description         LocaleString   `json:"description"`
	Style               string         `json:"style"`
	Size                string         `json:"size"`
	CollectionID        null.Int       `json:"collectionId"`
	MessageID           null.Int       `json:"messageId"`
	EmbedUrl            null.String    `json:"embedUrl"`
	EmbedAspectRatio    null.Float     `json:"embedAspectRatio"`
	EmbedHeight         null.Int       `json:"embedHeight"`
	NeedsAuthentication null.Bool      `json:"needsAuthentication"`
	Options             SectionOptions `json:"options"`
	AchievementsSource  null.String    `json:"achievementsSource"`
}

Section is the definition of the Section object

func (Section) GetKey

func (i Section) GetKey() int

GetKey returns the key for this item

type SectionOptions

type SectionOptions struct {
	SecondaryTitles    bool
	MyList             bool
	ContinueWatching   bool
	UseContext         bool
	PrependLiveElement bool
	Limit              int
}

SectionOptions contains options for this section

type SelectedAlternatives

type SelectedAlternatives struct {
	ID       uuid.UUID
	Selected []uuid.UUID
	Locked   bool
}

SelectedAlternatives is a struct for getting selected alternatives of a question

func (SelectedAlternatives) GetKey

func (sa SelectedAlternatives) GetKey() uuid.UUID

GetKey returns the key for this item

type Short

type Short struct {
	ID          uuid.UUID
	MediaID     uuid.UUID
	AssetID     null.Int
	Title       LocaleString
	Description LocaleString
	Images      Images
	Score       float64
	EpisodeID   null.Int
	StartsAt    null.Float
	EndsAt      null.Float
	Label       string
	Status      Status
	DateUpdated time.Time
	TagIDs      []int
}

Short item type

type ShortIDWithMeta

type ShortIDWithMeta struct {
	ID              uuid.UUID
	AgeInDays       int
	ParentEpisodeID null.Int
	FinalScore      float64
}

ShortIDWithMeta

Age - Age of the short in days ParentEpisodeID - ID of the full episode where the short was extracted from FinalScore - Final score of the short, with all adjustments

type Show

type Show struct {
	ID                      int          `json:"id"`
	Status                  Status       `json:"status"`
	Type                    string       `json:"type"`
	TagIDs                  []int        `json:"tagIds"`
	LegacyID                null.Int     `json:"legacyId"`
	PublicTitle             null.String  `json:"publicTitle"`
	Title                   LocaleString `json:"title"`
	Description             LocaleString `json:"description"`
	Image                   null.String  `json:"image"`
	Images                  Images       `json:"images"`
	DefaultEpisodeBehaviour null.String  `json:"defaultEpisode"`
	RelatedCollectionID     null.Int     `json:"relatedCollectionId"`
}

Show is the definition of the Show object

func (Show) GetKey

func (i Show) GetKey() int

GetKey returns the key for this item

func (Show) GetStatus

func (i Show) GetStatus() Status

GetStatus returns the status for this item

func (Show) GetTagIDs

func (i Show) GetTagIDs() []int

GetTagIDs returns ids of related tags

func (Show) Unlisted

func (i Show) Unlisted() bool

Unlisted returns true if item is unlisted

type Song

type Song struct {
	ID    uuid.UUID
	Title LocaleString
}

Song contains some metadata for songs

type Status

type Status string

Status is a global enum for directus status

func MostRestrictiveStatus

func MostRestrictiveStatus(statuses ...Status) (status Status)

MostRestrictiveStatus returns the most restrictive status

func StatusFrom

func StatusFrom(s string) Status

StatusFrom string

type Stream

type Stream struct {
	ID                int         `json:"id"`
	Type              string      `json:"type"`
	EpisodeID         int         `json:"episodeId"`
	AssetID           int         `json:"assetId"`
	AudioLanguages    []string    `json:"audioLanguages"`
	SubtitleLanguages []string    `json:"subtitleLanguages"`
	Path              string      `json:"path"`
	Service           string      `json:"service"`
	Url               string      `json:"url"`
	EncryptionKeyID   null.String `json:"encryptionKeyId"`
	ConfigurationId   null.String `json:"configurationId"`
}

Stream item type

type StudyTaskType

type StudyTaskType = string

StudyTaskType is the type of lesson

type StudyTopic

type StudyTopic struct {
	ID          uuid.UUID
	Title       LocaleString
	Description LocaleString
	Images      Images
}

StudyTopic is a topic for studying something specific

func (StudyTopic) GetKey

func (i StudyTopic) GetKey() uuid.UUID

GetKey returns the key for this item

type Survey

type Survey struct {
	ID          uuid.UUID `json:"id"`
	Title       LocaleString
	Description LocaleString
}

Survey is a survey

type SurveyQuestion

type SurveyQuestion struct {
	ID               uuid.UUID `json:"id"`
	Title            LocaleString
	Description      LocaleString
	Type             string
	CancelButtonText LocaleString
	ActionButtonText LocaleString
	URL              null.String
}

SurveyQuestion is a question in a survey

type Tag

type Tag struct {
	ID   int          `json:"id"`
	Code string       `json:"code"`
	Name LocaleString `json:"name"`
}

Tag struct

func (Tag) GetKey

func (i Tag) GetKey() int

GetKey returns the key for this item

type Target

type Target struct {
	ID         uuid.UUID
	Type       string
	GroupCodes []string
}

Target specific groups

type Task

type Task struct {
	ID              uuid.UUID
	LessonID        uuid.UUID
	Title           LocaleString
	Type            StudyTaskType
	QuestionType    QuestionTaskType
	ImageType       ImageTaskType
	LinkID          null.Int
	EpisodeID       null.Int
	Images          LocaleMap[string]
	MultiSelect     null.Bool
	CompetitionMode bool
	Alternatives    []QuestionAlternative
	SecondaryTitle  LocaleString
	Description     LocaleString
}

Task is the struct for Tasks

func (Task) GetKey

func (i Task) GetKey() uuid.UUID

GetKey returns the key for this item

type TimedMetadata

type TimedMetadata struct {
	ID              uuid.UUID
	Type            string
	Timestamp       float64
	Duration        float64
	Title           LocaleString `json:"title"`
	Description     LocaleString `json:"description"`
	ContentType     ContentType
	PersonIDs       []uuid.UUID
	SongID          uuid.NullUUID
	MediaItemID     uuid.NullUUID
	Images          Images
	ParentEpisodeID int
}

TimedMetadata item type

type TranslationData

type TranslationData struct {
	Language string
	Value    json.RawMessage
	ID       string
}

type User

type User struct {
	FirstName             string
	DisplayName           string
	Roles                 []string
	Email                 string
	EmailVerified         bool
	PersonID              string
	Anonymous             bool
	ActiveBCC             bool
	AgeGroup              string
	Gender                string
	ChurchIDs             []int
	Age                   int
	CompletedRegistration bool
}

User represents an actual user in the system

func (User) IsActiveBCC

func (u User) IsActiveBCC() bool

IsActiveBCC user?

func (User) IsAnonymous

func (u User) IsAnonymous() bool

IsAnonymous user?

func (User) IsRegistered

func (u User) IsRegistered() bool

IsRegistered user?

type UserCollection

type UserCollection struct {
	ID                 uuid.UUID
	ApplicationGroupID uuid.UUID
	ProfileID          uuid.UUID
	Title              string
	Metadata           UserCollectionMetadata
	UpdatedAt          time.Time
	CreatedAt          time.Time
}

UserCollection is a collection created by a user

type UserCollectionEntry

type UserCollectionEntry struct {
	ID           uuid.UUID
	CollectionID uuid.UUID
	Type         string
	ItemID       uuid.UUID
	Sort         int
	UpdatedAt    time.Time
	CreatedAt    time.Time
}

UserCollectionEntry is an entry in a user collection

type UserCollectionMetadata

type UserCollectionMetadata struct {
	MyList bool `json:"myList"`
}

UserCollectionMetadata contains options that can specify extra options for a user

type Visibility

type Visibility struct {
	Published     bool
	AvailableFrom *time.Time
	AvailableTo   *time.Time
}

func (*Visibility) Merge

func (v *Visibility) Merge(vm Visibility) (r Visibility)

Jump to

Keyboard shortcuts

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