ytpulse

package module
v0.8.2-1 Latest Latest
Warning

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

Go to latest
Published: Dec 10, 2024 License: MIT Imports: 7 Imported by: 3

README

YouTube Pulse (ytpulse)

GoDoc

A service which provides a way to manage collections of YouTube videos and playlists focused on workouts.

Leverages http://git.sr.ht/~hokiegeek/ytlibrarian

GET /users
    
GET /videos
    
GET /channels
    
GET /queue
    
GET /sessions
    
GET /programs

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddOrUpdateCustomDataToChannel

func AddOrUpdateCustomDataToChannel(librarian *ytlibrarian.Librarian, channel Channel, user User) error

AddOrUpdateCustomDataToChannel links the given data to a Channel on behalf of a User

func AddOrUpdateCustomDataToVideo

func AddOrUpdateCustomDataToVideo(librarian *ytlibrarian.Librarian, video Video, user User) error

AddOrUpdateCustomDataToVideo links the given data to a Video on behalf of a User

func AppendProgramDay

func AppendProgramDay(librarian *ytlibrarian.Librarian, user User, programID, dayID uuid.UUID) error

AppendProgramDay adds a day to the end of a Program

func AppendProgramDayItem

func AppendProgramDayItem(librarian *ytlibrarian.Librarian, user User, programDayID, dayID uuid.UUID) error

AppendProgramDayItem adds a day to the end of a ProgramDay

func AppendSessionItem

func AppendSessionItem(librarian *ytlibrarian.Librarian, user User, sessionID, itemID uuid.UUID) error

AppendSessionItem adds an item to the end of a session

func GetUserChannelCustomData

func GetUserChannelCustomData(librarian *ytlibrarian.Librarian, channel Channel, user User) (string, error)

GetUserChannelCustomData retrieves the given data to a Channel on behalf of a User

func GetUserProgramCustomData

func GetUserProgramCustomData(librarian *ytlibrarian.Librarian, program Program, user User) (string, error)

GetUserProgramCustomData retrieves the given data to a Program on behalf of a User

func GetUserSessionCustomData

func GetUserSessionCustomData(librarian *ytlibrarian.Librarian, session Session, user User) (string, error)

GetUserSessionCustomData retrieves the given data to a Session on behalf of a User

func GetUserVideoCustomData

func GetUserVideoCustomData(librarian *ytlibrarian.Librarian, video Video, user User) (string, error)

GetUserVideoCustomData retrieves the given data to a Video on behalf of a User

func InsertProgramDay

func InsertProgramDay(librarian *ytlibrarian.Librarian, user User, programID, dayID uuid.UUID, dayPos int) error

InsertProgramDay adds a day to a Program

func InsertProgramDayItem

func InsertProgramDayItem(librarian *ytlibrarian.Librarian, user User, programDayID, dayID uuid.UUID, itemPos int) error

InsertProgramDayItem adds a day to a ProgramDay

func InsertSessionItem

func InsertSessionItem(librarian *ytlibrarian.Librarian, user User, sessionID, itemID uuid.UUID, itemPos int) error

InsertSessionItem adds an item to a session

func LinkChannelToUser

func LinkChannelToUser(librarian *ytlibrarian.Librarian, channel Channel, user User, details string) error

LinkChannelToUser adds a relationship between a channel and a user

func LinkProgramToUser

func LinkProgramToUser(librarian *ytlibrarian.Librarian, program Program, user User, details string) error

LinkProgramToUser adds a relationship between a user and a given program as well as the items

func LinkSessionToUser

func LinkSessionToUser(librarian *ytlibrarian.Librarian, session Session, user User, details string) error

LinkSessionToUser adds a relationship between a user and a given session as well as the items

func LinkVideoToUser

func LinkVideoToUser(librarian *ytlibrarian.Librarian, video Video, user User, details string) error

LinkVideoToUser adds a relationship between a video and a user

func PublishProgram

func PublishProgram(librarian *ytlibrarian.Librarian, user User, authToken string, id uuid.UUID) error

PublishProgram inserts or updates the identified program to the given tuber service

func PublishWatchQueue

func PublishWatchQueue(librarian *ytlibrarian.Librarian, user User, authToken string) (watchQueue, error)

PublishWatchQueue inserts or updates the user's watch queue to the given tuber service

func RemoveProgramByID

func RemoveProgramByID(librarian *ytlibrarian.Librarian, id uuid.UUID) error

RemoveProgramByID removes the identified program from the Thinger

func RemoveProgramDay

func RemoveProgramDay(librarian *ytlibrarian.Librarian, user User, programID uuid.UUID, dayPos int) error

RemoveProgramDay removes days in a Program

func RemoveProgramDayItem

func RemoveProgramDayItem(librarian *ytlibrarian.Librarian, user User, programDayID uuid.UUID, itemPos int) error

RemoveProgramDayItem removes days in a ProgramDay

func RemoveSessionByID

func RemoveSessionByID(librarian *ytlibrarian.Librarian, id uuid.UUID) error

RemoveSessionByID removes the identified session from the Thinger

func RemoveSessionItem

func RemoveSessionItem(librarian *ytlibrarian.Librarian, user User, sessionID uuid.UUID, itemPos int) error

RemoveSessionItem removes items in a Session

func RemoveUserByID

func RemoveUserByID(librarian *ytlibrarian.Librarian, id uuid.UUID) error

RemoveUserByID removes an identified User from the given Thinger

func RemoveUserChannelCustomData

func RemoveUserChannelCustomData(librarian *ytlibrarian.Librarian, channel Channel, user User) error

RemoveUserChannelCustomData ... guess what this do!

func RemoveUserProgramCustomData

func RemoveUserProgramCustomData(librarian *ytlibrarian.Librarian, program Program, user User) error

RemoveUserProgramCustomData does what it says on the tin

func RemoveUserSessionCustomData

func RemoveUserSessionCustomData(librarian *ytlibrarian.Librarian, session Session, user User) error

RemoveUserSessionCustomData does what it says on the tin

func RemoveUserVideoCustomData

func RemoveUserVideoCustomData(librarian *ytlibrarian.Librarian, video Video, user User) error

RemoveUserVideoCustomData ... guess what this do!

func RemoveUserWatchQueue

func RemoveUserWatchQueue(librarian *ytlibrarian.Librarian, user User, authToken string) error

RemoveUserWatchQueue removes the watch queue from the given tuber service

func UnlinkChannelAndUser

func UnlinkChannelAndUser(librarian *ytlibrarian.Librarian, channel Channel, user User) error

UnlinkChannelAndUser removes relationship between a channel and a user

func UnlinkProgramAndUser

func UnlinkProgramAndUser(librarian *ytlibrarian.Librarian, program Program, user User) error

UnlinkProgramAndUser removes relationship between a program and a user

func UnlinkSessionAndUser

func UnlinkSessionAndUser(librarian *ytlibrarian.Librarian, session Session, user User) error

UnlinkSessionAndUser removes relationship between a session and a user

func UnlinkVideoAndUser

func UnlinkVideoAndUser(librarian *ytlibrarian.Librarian, video Video, user User) error

UnlinkVideoAndUser removes relationship between a video and a user

func UnpublishProgram

func UnpublishProgram(librarian *ytlibrarian.Librarian, authToken string, id uuid.UUID) error

UnpublishProgram inserts or updates the identified Program to the given tuber service

func UnpublishProgramDay

func UnpublishProgramDay(librarian *ytlibrarian.Librarian, authToken string, id uuid.UUID) error

UnpublishProgramDay inserts or updates the identified program day to the given tuber service

func UnpublishSession

func UnpublishSession(librarian *ytlibrarian.Librarian, authToken string, id uuid.UUID) error

UnpublishSession removes the identified session from the given tuber service

func UpdateProgramCustomData

func UpdateProgramCustomData(librarian *ytlibrarian.Librarian, program Program, user User) error

UpdateProgramCustomData links the given data to a Program on behalf of a User

func UpdateProgramDay

func UpdateProgramDay(librarian *ytlibrarian.Librarian, user User, programID, dayID uuid.UUID, dayPos int) error

UpdateProgramDay adds/removes/changes a single day in a Program

func UpdateProgramDayItem

func UpdateProgramDayItem(librarian *ytlibrarian.Librarian, user User, programDayID, dayID uuid.UUID, itemPos int) error

UpdateProgramDayItem adds/removes/changes a single day in a ProgramDay

func UpdateProgramDayItems

func UpdateProgramDayItems(librarian *ytlibrarian.Librarian, user User, items ProgramDayItems) error

UpdateProgramDayItems adds/removes/changes items in a ProgramDay

func UpdateProgramDays

func UpdateProgramDays(librarian *ytlibrarian.Librarian, user User, days ProgramDays) error

UpdateProgramDays adds/removes/changes days in a ProgramDays

func UpdateSessionCustomData

func UpdateSessionCustomData(librarian *ytlibrarian.Librarian, session Session, user User) error

UpdateSessionCustomData links the given data to a Session on behalf of a User

func UpdateSessionItem

func UpdateSessionItem(librarian *ytlibrarian.Librarian, user User, sessionID, itemID uuid.UUID, itemPos int) error

UpdateSessionItem adds/removes/changes a single session item

func UpdateSessionItems

func UpdateSessionItems(librarian *ytlibrarian.Librarian, user User, items SessionItems) error

UpdateSessionItems adds/removes/changes items in a Session

func UpdateUser

func UpdateUser(librarian *ytlibrarian.Librarian, user User) error

UpdateUser updates an existing User in the given Thinger

func UpdateUserWatchQueue

func UpdateUserWatchQueue(librarian *ytlibrarian.Librarian, user User, authToken string, wq WatchQueue) error

UpdateUserWatchQueue updates the user's watch queue and publishes it to the tuber service

Types

type Channel

type Channel struct {
	ytlibrarian.Channel
	UserData userData `json:"userData,omitempty"`
}

Channel is a reference to a channel along with metadata associated with the requesting user

func AddChannel

func AddChannel(librarian *ytlibrarian.Librarian, authToken, id string) (Channel, error)

AddChannel retrieves channel details from a Tuber and adds a Channel Thing to the given Thinger

func GetChannelByID

func GetChannelByID(librarian *ytlibrarian.Librarian, user User, id uuid.UUID) (Channel, error)

GetChannelByID retrieves the collection which matches the given ID

func GetChannelByReferenceID

func GetChannelByReferenceID(librarian *ytlibrarian.Librarian, user User, refID string) (Channel, error)

GetChannelByReferenceID retrieves the user thing by the given external ID

func GetChannelsByUser

func GetChannelsByUser(librarian *ytlibrarian.Librarian, user User) ([]Channel, error)

GetChannelsByUser retrieves the collections which belong to the given user

type Program

type Program struct {
	ytlibrarian.Collection
	UserData userData `json:"userData,omitempty"`
}

Program collects things and stuff

func CreateProgram

func CreateProgram(librarian *ytlibrarian.Librarian, program Program, user User) (Program, error)

CreateProgram creates a new program in the thinger that is not associated with an external thing

func GetProgramByID

func GetProgramByID(librarian *ytlibrarian.Librarian, user User, id uuid.UUID) (Program, error)

GetProgramByID retrieves the program which matches the given ID

func GetProgramByReferenceID

func GetProgramByReferenceID(librarian *ytlibrarian.Librarian, user User, refID string) (Program, error)

GetProgramByReferenceID retrieves the user thing by the given external ID

func GetProgramsByUser

func GetProgramsByUser(librarian *ytlibrarian.Librarian, user User) ([]Program, error)

GetProgramsByUser retrieves the sessions which belong to the given user

func UpdateProgram

func UpdateProgram(librarian *ytlibrarian.Librarian, program Program, user User) (Program, error)

UpdateProgram updates an existing collection in the thinger

type ProgramDay

type ProgramDay struct {
	ytlibrarian.Collection
	UserData userData `json:"userData,omitempty"`
}

ProgramDay collects the ProgramDays within a Program

func CreateProgramDay

func CreateProgramDay(librarian *ytlibrarian.Librarian, programDay ProgramDay, user User) (ProgramDay, error)

CreateProgramDay creates a new program day in the thinger that is not associated with an external thing

func GetProgramDayByID

func GetProgramDayByID(librarian *ytlibrarian.Librarian, user User, id uuid.UUID) (ProgramDay, error)

GetProgramDayByID retrieves the program which matches the given ID

func GetProgramDayByPos

func GetProgramDayByPos(librarian *ytlibrarian.Librarian, user User, programID uuid.UUID, pos int) (ProgramDay, error)

GetProgramDayByPos retrieves the program day which matches the given position

func PublishProgramDay

func PublishProgramDay(librarian *ytlibrarian.Librarian, user User, authToken string, id uuid.UUID) (ProgramDay, error)

PublishProgramDay inserts or updates the identified program day to the given tuber service

type ProgramDayItem

type ProgramDayItem struct {
	ytlibrarian.CollectionItem
}

ProgramDayItem defines the minimum data to identify an item in a ProgramDay and its position

type ProgramDayItems

type ProgramDayItems struct {
	ProgramDayID string           `json:"programDayId"`
	Items        []ProgramDayItem `json:"items,omitempty"`
	Data         string           `json:"data,omitempty"`
}

ProgramDayItems collects the items within a ProgramDay

func GetProgramDayItems

func GetProgramDayItems(librarian *ytlibrarian.Librarian, programDayID uuid.UUID) (ProgramDayItems, error)

GetProgramDayItems retrieves the items of the ProgramDay which matches the given ID

func (ProgramDayItems) ByPosition

func (c ProgramDayItems) ByPosition(pos int) (ProgramDayItem, error)

type ProgramDays

type ProgramDays struct {
	ProgramID string            `json:"programId"`
	Days      []ProgramDaysItem `json:"days,omitempty"`
	Data      string            `json:"data,omitempty"`
}

ProgramDays collects the items within a Program

func GetProgramDays

func GetProgramDays(librarian *ytlibrarian.Librarian, programID uuid.UUID) (ProgramDays, error)

GetProgramDays retrieves the program days which matches the given ID

func (ProgramDays) ByPosition

func (c ProgramDays) ByPosition(pos int) (ProgramDaysItem, error)

type ProgramDaysItem

type ProgramDaysItem struct {
	ID       string `json:"id"`
	Position int    `json:"position"`
}

ProgramDaysItem defines the minimum data to identify an item in a ProgramDay and its position in a Program

type Session

type Session struct {
	ytlibrarian.Collection
	UserData userData `json:"userData,omitempty"`
}

Session hmm...

func AddSession

func AddSession(librarian *ytlibrarian.Librarian, authToken string, user User, id string) (session Session, err error)

AddSession retrieves session details from a Tuber and adds a Session Thing to the given Thinger

func CreateSession

func CreateSession(librarian *ytlibrarian.Librarian, session Session, user User) (Session, error)

CreateSession creates a new session in the thinger that is not associated with an external thing

func GetSessionByID

func GetSessionByID(librarian *ytlibrarian.Librarian, user User, id uuid.UUID) (Session, error)

GetSessionByID retrieves the session which matches the given ID

func GetSessionByReferenceID

func GetSessionByReferenceID(librarian *ytlibrarian.Librarian, user User, refID string) (Session, error)

GetSessionByReferenceID retrieves the user thing by the given external ID

func GetSessionsByUser

func GetSessionsByUser(librarian *ytlibrarian.Librarian, user User) ([]Session, error)

GetSessionsByUser retrieves the sessions which belong to the given user

func PublishSession

func PublishSession(librarian *ytlibrarian.Librarian, user User, authToken string, id uuid.UUID) (Session, error)

PublishSession inserts or updates the identified session to the given tuber service

func UpdateSession

func UpdateSession(librarian *ytlibrarian.Librarian, session Session, user User) (Session, error)

UpdateSession updates an existing collection in the thinger

type SessionItem

type SessionItem struct {
	ytlibrarian.CollectionItem
}

SessionItem defines the minimum data to identify an item in a collection and its position

type SessionItems

type SessionItems struct {
	SessionID string        `json:"sessionId"`
	Items     []SessionItem `json:"items,omitempty"`
}

SessionItems collects the items within a collection

func GetSessionItems

func GetSessionItems(librarian *ytlibrarian.Librarian, sessionID uuid.UUID) (SessionItems, error)

GetSessionItems retrieves the session which matches the given ID

func (SessionItems) ByPosition

func (s SessionItems) ByPosition(pos int) (SessionItem, error)

type User

type User struct {
	ytlibrarian.User
}

User is a reference to ... user ... data

func AddUser

func AddUser(librarian *ytlibrarian.Librarian, user User) (User, error)

AddUser adds a User to the given Thinger

func GetUserByReferenceID

func GetUserByReferenceID(librarian *ytlibrarian.Librarian, refID string) (User, error)

GetUserByReferenceID retrieves the user thing by the given external ID

type Video

type Video struct {
	ytlibrarian.Video
	UserData userData `json:"userData,omitempty"`
}

Video is a reference to a video along with metadata associated with the requesting user

func AddVideo

func AddVideo(librarian *ytlibrarian.Librarian, authToken, id string) (Video, error)

AddVideo if missing from Thinger retrieves video details from the Tuber and adds it

func GetVideoByID

func GetVideoByID(librarian *ytlibrarian.Librarian, user User, id uuid.UUID) (Video, error)

GetVideoByID retrieves the collection which matches the given ID

func GetVideoByReferenceID

func GetVideoByReferenceID(librarian *ytlibrarian.Librarian, user User, refID string) (Video, error)

GetVideoByReferenceID retrieves the user thing by the given external ID

func GetVideosByReferenceIDs

func GetVideosByReferenceIDs(librarian *ytlibrarian.Librarian, user User, refIDs []string) ([]Video, error)

GetVideosByReferenceIDs retrieves the user thing by the given external ID

func GetVideosByUser

func GetVideosByUser(librarian *ytlibrarian.Librarian, user User) ([]Video, error)

GetVideosByUser retrieves the collections which belong to the given user

type WatchQueue

type WatchQueue struct {
	Name  string   `json:"name"`
	URL   string   `json:"url,omitempty"`
	Items []string `json:"items"`
}

func GetUserWatchQueue

func GetUserWatchQueue(librarian *ytlibrarian.Librarian, user User) (WatchQueue, error)

GetUserWatchQueue retrieves the collection used to collect the user's

Directories

Path Synopsis
cmd
Package httpserver provides a gin HTTP server and routing functionality
Package httpserver provides a gin HTTP server and routing functionality

Jump to

Keyboard shortcuts

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