Documentation ¶
Index ¶
- Constants
- func AddOrUpdateCustomDataToChannel(thinger Thinger, channel Channel, user User, data string) error
- func AddOrUpdateCustomDataToVideo(thinger Thinger, video Video, user User, data string) error
- func AppendCollectionItem(thinger Thinger, user User, collectionID, itemID uuid.UUID) error
- func GetUserChannelCustomData(thinger Thinger, channel Channel, user User) (string, error)
- func GetUserCollectionCustomData(thinger Thinger, collection Collection, user User) (string, error)
- func GetUserVideoCustomData(thinger Thinger, video Video, user User) (string, error)
- func InsertCollectionItem(thinger Thinger, user User, collectionID, itemID uuid.UUID, itemPos int) error
- func LinkChannelToUser(thinger Thinger, channel Channel, user User, details string) error
- func LinkCollectionToUser(thinger Thinger, collection Collection, user User, details string) error
- func LinkVideoToUser(thinger Thinger, video Video, user User, details string) error
- func ListenAndServe(port string, store Thinger) error
- func NewGoogleOAuth2Config(clientID, secret string) *oauth2.Config
- func RemoveChannelByID(thinger Thinger, id uuid.UUID) error
- func RemoveCollectionByID(thinger Thinger, id uuid.UUID) error
- func RemoveCollectionItem(thinger Thinger, user User, collectionID uuid.UUID, itemPos int) error
- func RemoveUserByID(thinger Thinger, id uuid.UUID) error
- func RemoveUserChannelCustomData(thinger Thinger, channel Channel, user User) error
- func RemoveUserCollectionCustomData(thinger Thinger, collection Collection, user User) error
- func RemoveUserVideoCustomData(thinger Thinger, video Video, user User) error
- func RemoveVideoByID(thinger Thinger, id uuid.UUID) error
- func ScorchedEarth(store Thinger)
- func TokenFromAuthCode(code string) (*oauth2.Token, error)
- func UnlinkChannelAndUser(thinger Thinger, channel Channel, user User) error
- func UnlinkCollectionAndUser(thinger Thinger, collection Collection, user User) error
- func UnlinkVideoAndUser(thinger Thinger, video Video, user User) error
- func UnpublishCollection(thinger Thinger, tuber Tuber, id uuid.UUID) error
- func UpdateCollectionCustomData(thinger Thinger, collection Collection, user User, data string) error
- func UpdateCollectionItem(thinger Thinger, user User, collectionID, itemID uuid.UUID, itemPos int) (err error)
- func UpdateCollectionItems(thinger Thinger, user User, items CollectionItems) error
- type BulkItemError
- type Channel
- func AddChannel(thinger Thinger, tuber Tuber, id string) (channel Channel, err error)
- func GetChannelByID(thinger Thinger, user User, id uuid.UUID) (Channel, error)
- func GetChannelByReferenceID(thinger Thinger, user User, refID string) (Channel, error)
- func GetChannelsByUser(thinger Thinger, user User) ([]Channel, error)
- type ChannelRequest
- type Collection
- func AddCollection(thinger Thinger, tuber Tuber, user User, id string) (collection Collection, err error)
- func CreateCollection(thinger Thinger, collection Collection, user User) (Collection, error)
- func GetCollectionByID(thinger Thinger, user User, id uuid.UUID) (Collection, error)
- func GetCollectionByReferenceID(thinger Thinger, user User, refID string) (Collection, error)
- func GetCollectionsByUser(thinger Thinger, user User) ([]Collection, error)
- func PublishCollection(thinger Thinger, tuber Tuber, user User, id uuid.UUID) (collection Collection, err error)
- func UpdateCollection(thinger Thinger, collection Collection, user User) (Collection, error)
- type CollectionItem
- type CollectionItemAdd
- type CollectionItems
- type GcpDatastoreClient
- type Librarian
- type ThingNotFoundError
- type ThingNotLinkedError
- type Thinger
- type Tuber
- type User
- type UserNotLinkedError
- type UserRequest
- type Video
- func AddVideo(thinger Thinger, tuber Tuber, id string) (video Video, err error)
- func GetVideoByID(thinger Thinger, user User, id uuid.UUID) (Video, error)
- func GetVideoByReferenceID(thinger Thinger, user User, refID string) (Video, error)
- func GetVideosByUser(thinger Thinger, user User) ([]Video, error)
- type VideoRequest
- type YoutubeClient
Constants ¶
const ( // ItemUser = thingTypeUser ItemVideo = thingTypeVideo ItemChannel = thingTypeChannel ItemCollection = thingTypeCollection )
Item types
Variables ¶
This section is empty.
Functions ¶
func AddOrUpdateCustomDataToChannel ¶
AddOrUpdateCustomDataToChannel links the given data to a Channel on behalf of a User
func AddOrUpdateCustomDataToVideo ¶
AddOrUpdateCustomDataToVideo links the given data to a Video on behalf of a User
func AppendCollectionItem ¶
AppendCollectionItem adds an item to the end of a collection
func GetUserChannelCustomData ¶
GetUserChannelCustomData retrieves the given data to a Channel on behalf of a User
func GetUserCollectionCustomData ¶
func GetUserCollectionCustomData(thinger Thinger, collection Collection, user User) (string, error)
GetUserCollectionCustomData retrieves the given data to a Collection on behalf of a User
func GetUserVideoCustomData ¶
GetUserVideoCustomData retrieves the given data to a Video on behalf of a User
func InsertCollectionItem ¶
func InsertCollectionItem(thinger Thinger, user User, collectionID, itemID uuid.UUID, itemPos int) error
InsertCollectionItem adds an item to a collection
func LinkChannelToUser ¶
LinkChannelToUser adds a relationship between a channel and a user
func LinkCollectionToUser ¶
func LinkCollectionToUser(thinger Thinger, collection Collection, user User, details string) error
LinkCollectionToUser adds a relationship between a user and a given collection as well as the items
func LinkVideoToUser ¶
LinkVideoToUser adds a relationship between a video and a user
func ListenAndServe ¶
ListenAndServe provides the HTTP server handler
func NewGoogleOAuth2Config ¶
NewGoogleOAuth2Config creates an OAuth2 configuration object with the needed YouTube scopes for the given client info
func RemoveChannelByID ¶
RemoveChannelByID removes the identified collection from the Thinger
func RemoveCollectionByID ¶
RemoveCollectionByID removes the identified collection from the Thinger
func RemoveCollectionItem ¶
RemoveCollectionItem removes items in a Collection
func RemoveUserByID ¶
RemoveUserByID removes an identified User from the given Thinger
func RemoveUserChannelCustomData ¶
RemoveUserChannelCustomData ... guess what this do!
func RemoveUserCollectionCustomData ¶
func RemoveUserCollectionCustomData(thinger Thinger, collection Collection, user User) error
RemoveUserCollectionCustomData ... guess what this do!
func RemoveUserVideoCustomData ¶
RemoveUserVideoCustomData ... guess what this do!
func RemoveVideoByID ¶
RemoveVideoByID removes the identified collection from the Thinger
func ScorchedEarth ¶
func ScorchedEarth(store Thinger)
func TokenFromAuthCode ¶
TokenFromAuthCode exchanges a Google one-time auth code for an OAuth2 token
func UnlinkChannelAndUser ¶
UnlinkChannelAndUser removes relationship between a channel and a user
func UnlinkCollectionAndUser ¶
func UnlinkCollectionAndUser(thinger Thinger, collection Collection, user User) error
UnlinkCollectionAndUser removes relationship between a collection and a user
func UnlinkVideoAndUser ¶
UnlinkVideoAndUser removes relationship between a video and a user
func UnpublishCollection ¶
UnpublishCollection inserts or updates the identified collection to the given tuber service
func UpdateCollectionCustomData ¶
func UpdateCollectionCustomData(thinger Thinger, collection Collection, user User, data string) error
UpdateCollectionCustomData links the given data to a Collection on behalf of a User
func UpdateCollectionItem ¶
func UpdateCollectionItem(thinger Thinger, user User, collectionID, itemID uuid.UUID, itemPos int) (err error)
UpdateCollectionItem adds/removes/changes a single collection item
func UpdateCollectionItems ¶
func UpdateCollectionItems(thinger Thinger, user User, items CollectionItems) error
UpdateCollectionItems adds/removes/changes items in a Collection
Types ¶
type BulkItemError ¶
BulkItemError collects the multiple errors encountered when collecting multiples
func (*BulkItemError) Error ¶
func (e *BulkItemError) Error() string
type Channel ¶
type Channel struct { UserLinked bool `json:"user_linked,omitempty"` Data string `json:"data,omitempty"` // contains filtered or unexported fields }
Channel is a reference to a channel along with metadata associated with the requesting user
func AddChannel ¶
AddChannel retrieves channel details from a Tuber and adds a Channel Thing to the given Thinger
func GetChannelByID ¶
GetChannelByID retrieves the collection which matches the given ID
func GetChannelByReferenceID ¶
GetChannelByReferenceID retrieves the user thing by the given external ID
type ChannelRequest ¶
type ChannelRequest struct {
Data string `json:"data,omitempty"`
}
ChannelRequest is used with the PUT /channels endpoint
type Collection ¶
type Collection struct { Data string `json:"data,omitempty"` // contains filtered or unexported fields }
Collection is a reference to a channel along with metadata associated with the requesting user
func AddCollection ¶
func AddCollection(thinger Thinger, tuber Tuber, user User, id string) (collection Collection, err error)
AddCollection retrieves collection details from a Tuber and adds a Collection Thing to the given Thinger
func CreateCollection ¶
func CreateCollection(thinger Thinger, collection Collection, user User) (Collection, error)
CreateCollection creates a new collection in the thinger that is not associated with an external thing
func GetCollectionByID ¶
GetCollectionByID retrieves the collection which matches the given ID
func GetCollectionByReferenceID ¶
func GetCollectionByReferenceID(thinger Thinger, user User, refID string) (Collection, error)
GetCollectionByReferenceID retrieves the user thing by the given external ID
func GetCollectionsByUser ¶
func GetCollectionsByUser(thinger Thinger, user User) ([]Collection, error)
GetCollectionsByUser retrieves the collections which belong to the given user
func PublishCollection ¶
func PublishCollection(thinger Thinger, tuber Tuber, user User, id uuid.UUID) (collection Collection, err error)
PublishCollection inserts or updates the identified collection to the given tuber service
func UpdateCollection ¶
func UpdateCollection(thinger Thinger, collection Collection, user User) (Collection, error)
UpdateCollection updates an existing collection in the thinger
type CollectionItem ¶
type CollectionItem struct { Kind string `json:"kind"` ID string `json:"id"` Position int `json:"position"` }
CollectionItem defines the minimum data to identify an item in a collection and its position
type CollectionItemAdd ¶
type CollectionItemAdd struct {
ID string `json:"id,omitempty"`
}
CollectionItemAdd adds the indicated item by internal ID
type CollectionItems ¶
type CollectionItems struct { CollectionID string `json:"collection_id"` Items []CollectionItem `json:"items,omitempty"` Data string `json:"data,omitempty"` }
CollectionItems collects the items within a collection
func AddCollectionItems ¶
func AddCollectionItems(thinger Thinger, tuber Tuber, user User, collection Collection) (CollectionItems, error)
AddCollectionItems retrieves collection items from a Tuber and adds a Collection Thing to the given Thinger
func GetCollectionItems ¶
func GetCollectionItems(thinger Thinger, collectionID uuid.UUID) (CollectionItems, error)
GetCollectionItems retrieves the collection which matches the given ID
type GcpDatastoreClient ¶
type GcpDatastoreClient struct {
// contains filtered or unexported fields
}
GcpDatastoreClient is the client struct
func NewGcpDatastoreClient ¶
func NewGcpDatastoreClient(projectID string) (c *GcpDatastoreClient, err error)
NewGcpDatastoreClient creates a new GcpDatastoreClient
type ThingNotFoundError ¶
ThingNotFoundError is an error thingy that can be checked for when a Thing was not found
func (*ThingNotFoundError) Error ¶
func (e *ThingNotFoundError) Error() string
type ThingNotLinkedError ¶
ThingNotLinkedError is an error thingy that can be checked for when a Thing was not found
func (*ThingNotLinkedError) Error ¶
func (e *ThingNotLinkedError) Error() string
type Thinger ¶
type Thinger interface {
// contains filtered or unexported methods
}
Thinger defines the interface needed by any database client
type Tuber ¶
type Tuber interface { // channelVideos returns all of the videos for the given channel // channelVideos(id string) ([]videoThing, error) GetMyPlaylists() ([]collectionThing, error) // contains filtered or unexported methods }
Tuber defines the interface needed by the service where videos and stuff will be sourced from
type User ¶
type User struct {
// contains filtered or unexported fields
}
User is a reference to ... user ... data
type UserNotLinkedError ¶
UserNotLinkedError is an error thingy that can be checked for when a Thing was not found
func (*UserNotLinkedError) Error ¶
func (e *UserNotLinkedError) Error() string
type UserRequest ¶
type UserRequest struct { ReferenceID string `json:"reference_id,omitempty"` CustomData string `json:"custom_data,omitempty"` }
UserRequest is used with the POST /users endpoint
type Video ¶
type Video struct { UserLinked bool `json:"user_linked,omitempty"` Data string `json:"data,omitempty"` // contains filtered or unexported fields }
Video is a reference to a video along with metadata associated with the requesting user
func GetVideoByID ¶
GetVideoByID retrieves the collection which matches the given ID
func GetVideoByReferenceID ¶
GetVideoByReferenceID retrieves the user thing by the given external ID
type VideoRequest ¶
type VideoRequest struct {
Data string `json:"data,omitempty"`
}
VideoRequest is used with the PUT /videos endpoint
type YoutubeClient ¶
type YoutubeClient struct {
// contains filtered or unexported fields
}
YoutubeClient is a Tuber implementation that communicates with YouTube
func NewYoutubeClient ¶
func NewYoutubeClient(clientID, secret string, token *oauth2.Token) (*YoutubeClient, error)
NewYoutubeClient creates an instance of the YouTube Service for the given user
func (YoutubeClient) GetMyPlaylists ¶
func (c YoutubeClient) GetMyPlaylists() ([]collectionThing, error)