model

package
v0.0.0-...-ad4e74a Latest Latest
Warning

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

Go to latest
Published: Dec 19, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewPeriod

func NewPeriod(period string) (startedAt, endedAt time.Time, err error)

NewPeriod returns the start and end time of the period.

func VideoTypeToMemberTypes

func VideoTypeToMemberTypes(vt VideoType) []string

VideoTypeToMemberTypes represents the type of video.

Types

type Channel

type Channel struct {
	ID          string
	CreatorID   string
	Youtube     ChannelSnippet
	Twitch      ChannelSnippet
	TwitCasting ChannelSnippet
	Niconico    ChannelSnippet
}

Channel represents a channel.

type ChannelSnippet

type ChannelSnippet struct {
	ID              string
	Name            string
	Description     string
	ThumbnailURL    ThumbnailURL
	PublishedAt     time.Time
	TotalViewCount  int
	SubscriberCount int
	TotalVideoCount int
	UpdateAt        time.Time
	IsDeleted       bool
}

ChannelSnippet represents a channel snippet.

type Channels

type Channels []*Channel

Channels represents a list of channels.

func (Channels) FilterUpdateTarget

func (cs Channels) FilterUpdateTarget(comparisonChannels Channels) Channels

FilterUpdateTarget is ...

func (Channels) RetrieveYoutubeIDs

func (cs Channels) RetrieveYoutubeIDs() []string

RetrieveYoutubeIDs is ...

type Creator

type Creator struct {
	ID           string
	Name         string
	MemberType   MemberType
	ThumbnailURL ThumbnailURL
	Channel      Channel
}

Creator represents a content creator.

func NewCreator

func NewCreator(id, name string, memberType MemberType, thumbnailURL ThumbnailURL, channel Channel) *Creator

NewCreator creates a new Creator.

type CreatorInfo

type CreatorInfo struct {
	ID           string
	ChannelID    string
	Name         string
	ThumbnailURL ThumbnailURL
}

CreatorInfo represents the information about the creator of a video.

type Creators

type Creators []*Creator

Creators is a slice of pointers to Creator.

func NewCreators

func NewCreators(cs []Creator) Creators

NewCreators creates a new Creators.

func (Creators) RetrieveChannels

func (cs Creators) RetrieveChannels() Channels

RetrieveChannels is ...

type MemberType

type MemberType string
const (
	MemberTypeVspoJP  MemberType = "vspo_jp"
	MemberTypeVspoEN  MemberType = "vspo_en"
	MemberTypeGeneral MemberType = "general"
)

func NewMemberType

func NewMemberType(s string) (MemberType, error)

NewMemberType creates a new MemberType.

func (MemberType) String

func (t MemberType) String() string

type Pagination

type Pagination struct {
	CurrentPage uint64
	PrevPage    uint64
	NextPage    uint64
	TotalPage   uint64
	TotalCount  uint64
	HasNext     bool
}

Pagination struct holds the information about the pagination of data.

func NewPagination

func NewPagination(
	page uint64,
	limit uint64,
	totalCount uint64,
) *Pagination

NewPagination is a function to create a new Pagination instance. It takes the current page number, limit per page, and total count of items as parameters.

type Period

type Period string
const (
	PeriodAll   Period = "all"
	PeriodDay   Period = "day"
	PeriodMonth Period = "month"
	PeriodWeek  Period = "week"
)

func (Period) String

func (p Period) String() string

type Platform

type Platform string

Platform represents a live platform.

const (
	PlatformYouTube     Platform = "youtube"
	PlatformTwitch      Platform = "twitch"
	PlatformTwitCasting Platform = "twitcasting"
	PlatformNiconico    Platform = "niconico"
	PlatformUnknown     Platform = "unknown"
)

func NewPlatform

func NewPlatform(
	platform string,
) (Platform, error)

NewPlatform creates a new Platform type based on the provided string.

func (Platform) String

func (p Platform) String() string

type Platforms

type Platforms []Platform

func NewPlatforms

func NewPlatforms(
	platforms []string,
) (Platforms, error)

NewPlatforms creates a new Platform type based on the provided string slice.

func (Platforms) String

func (p Platforms) String() []string

type Status

type Status string

Status represents the status of a video.

const (
	StatusLive     Status = "live"
	StatusUpcoming Status = "upcoming"
	StatusEnded    Status = "ended"
)

func (Status) String

func (s Status) String() string

type ThumbnailURL

type ThumbnailURL string

ThumbnailURL is a struct that represents the thumbnail of a video

func (ThumbnailURL) String

func (t ThumbnailURL) String() string

type Video

type Video struct {
	ID           string
	Title        string
	Description  string
	PublishedAt  *time.Time
	StartedAt    *time.Time
	EndedAt      *time.Time
	Platform     Platform
	Status       Status
	Tags         []string
	ViewCount    uint64
	ThumbnailURL ThumbnailURL
	VideoType    VideoType
	IsDeleted    bool
	CreatorInfo  CreatorInfo
}

Video represents each platform video

type VideoType

type VideoType string

VideoType represents the type of video.

const (
	VideoTypeVspoStream VideoType = "vspo_stream"
	VideoTypeClip       VideoType = "clip"
	VideoTypeFreechat   VideoType = "freechat"
)

func NewVideoType

func NewVideoType(s string) (VideoType, error)

NewVideoType is ...

func (VideoType) String

func (t VideoType) String() string

type Videos

type Videos []*Video

Videos is a slice of pointers to Video.

func (Videos) FilterByChannels

func (vs Videos) FilterByChannels(channels Channels) Videos

func (Videos) FilterDeletedVideos

func (vs Videos) FilterDeletedVideos(comparedVideos Videos) Videos

func (Videos) FilterUpdatedVideos

func (vs Videos) FilterUpdatedVideos(comparedVideos Videos) Videos

func (Videos) IDs

func (vs Videos) IDs() []string

VideoIDs returns a slice of video IDs.

func (Videos) SetVideoType

func (vs Videos) SetVideoType(t VideoType) Videos

SetVideoType sets the video type of all videos in the slice.

func (Videos) UpdateCreatorInfo

func (vs Videos) UpdateCreatorInfo(cs Creators) Videos

Jump to

Keyboard shortcuts

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