Documentation
¶
Index ¶
- Constants
- func HandleEndpointError(err error, w http.ResponseWriter)
- func HandleEndpointNotFound(w http.ResponseWriter)
- func HandleEndpointSuccess(msg string, w http.ResponseWriter)
- type ApiEndpoint
- type ApiEndpointSchema
- type ApiResponse
- type AuthEndpoint
- type EndpointResponseCodec
- type EndpointResponseItem
- type SoundCloudEndpoint
- type SoundCloudEndpointError
- type SoundCloudEndpointResponse
- type SoundCloudItem
- type SoundCloudPlaylist
- type StreamEndpoint
- type StreamList
- type TwitchClipItem
- type TwitchClipItemThumbnail
- type TwitchClipItemVod
- type TwitchEndpoint
- type TwitchEndpointResponse
- type TwitchItem
- type TwitchItemChannel
- type TwitchItemCodec
- type TwitchItemThumbnail
- type YoutubeEndpoint
- type YoutubeEndpointResponse
- type YoutubeItem
- type YoutubeItemInfo
- type YoutubeItemSnippet
- type YoutubeItemSnippetResource
- type YoutubeItemThumbnail
- type YoutubeItemThumbnails
Constants ¶
const ( SC_ENDPOINT_PREFIX = "/soundcloud" SoundCloudPlaylistItem = "soundcloud#playlistItem" SoundCloudStreamItem = "soundcloud#stream" )
const ( TWITCH_ENDPOINT_PREFIX = "/twitch" TWITCH_RESULT_KIND_VIDEO = "twitch#video" TWITCH_RESULT_KIND_CLIP = "twitch#clip" )
const ( YOUTUBE_ENDPOINT_PREFIX = "/youtube" YoutubePlaylistItem = "youtube#playlistItem" YoutubeSearchResult = "youtube#searchResult" YoutubeVideoKind = "youtube#video" )
const (
AUTH_ENDPOINT_PREFIX = "/auth"
)
const STREAM_ENDPOINT_PREFIX = "/stream"
Variables ¶
This section is empty.
Functions ¶
func HandleEndpointError ¶
func HandleEndpointError(err error, w http.ResponseWriter)
func HandleEndpointNotFound ¶
func HandleEndpointNotFound(w http.ResponseWriter)
func HandleEndpointSuccess ¶
func HandleEndpointSuccess(msg string, w http.ResponseWriter)
Types ¶
type ApiEndpoint ¶
type ApiEndpoint interface { // GetPath returns the full api request path for the current endpoint handler GetPath() string // Handle receives an array of url "segments", and an http writer and request. // "segments" are defined as a string slice consisting of each piece of the // api request path, minus the api request root ("/api/"). Hence for a request // path "/api/stream/verb/noun", the "segments" received would be: // ["stream", "verb", "noun"]. Handle(connection.ConnectionHandler, []string, http.ResponseWriter, *http.Request) }
ApiEndpoint provides a REST handler for an api request
func NewAuthEndpoint ¶
func NewAuthEndpoint() ApiEndpoint
func NewSoundCloudEndpoint ¶
func NewSoundCloudEndpoint() ApiEndpoint
func NewStreamEndpoint ¶
func NewStreamEndpoint() ApiEndpoint
func NewTwitchEndpoint ¶
func NewTwitchEndpoint() ApiEndpoint
func NewYoutubeEndpoint ¶
func NewYoutubeEndpoint() ApiEndpoint
type ApiEndpointSchema ¶
type ApiEndpointSchema struct {
// contains filtered or unexported fields
}
func (*ApiEndpointSchema) GetPath ¶
func (e *ApiEndpointSchema) GetPath() string
type ApiResponse ¶
type AuthEndpoint ¶
type AuthEndpoint struct {
*ApiEndpointSchema
}
AuthEndpoint implements ApiEndpoint
func (*AuthEndpoint) Handle ¶
func (e *AuthEndpoint) Handle(connHandler connection.ConnectionHandler, segments []string, w http.ResponseWriter, r *http.Request)
sets a cookie with rbac roles from the given connection id
type EndpointResponseCodec ¶
type EndpointResponseItem ¶
type EndpointResponseItem struct { Kind string `json:"kind"` Id string `json:"id"` UId string `json:"_id"` Thumb string `json:"thumb"` Url string `json:"url"` Title string `json:"title"` }
func (*EndpointResponseItem) Decode ¶
func (i *EndpointResponseItem) Decode(b []byte) error
type SoundCloudEndpoint ¶
type SoundCloudEndpoint struct {
*ApiEndpointSchema
}
SoundCloudEndpoint implements ApiEndpoint
func (*SoundCloudEndpoint) Handle ¶
func (e *SoundCloudEndpoint) Handle(connHandler connection.ConnectionHandler, segments []string, w http.ResponseWriter, r *http.Request)
Handle returns a "discovery" of all local streams in the server data root.
type SoundCloudEndpointError ¶
type SoundCloudEndpointError struct {
Message string `json:"error_message"`
}
type SoundCloudEndpointResponse ¶
type SoundCloudEndpointResponse struct {
Items []*SoundCloudItem `json:"items"`
}
type SoundCloudItem ¶
type SoundCloudItem struct { *EndpointResponseItem Id int `json:"id"` Permalink string `json:"permalink_url"` Artwork string `json:"artwork_url"` Errors []SoundCloudEndpointError `json:"errors"` }
type SoundCloudPlaylist ¶
type SoundCloudPlaylist struct {
Tracks []*SoundCloudItem `json:"tracks"`
}
type StreamEndpoint ¶
type StreamEndpoint struct {
*ApiEndpointSchema
}
StreamEndpoint implements ApiEndpoint
func (*StreamEndpoint) Handle ¶
func (e *StreamEndpoint) Handle(connHandler connection.ConnectionHandler, segments []string, w http.ResponseWriter, r *http.Request)
Handle returns a "discovery" of all local streams in the server data root.
type StreamList ¶
StreamList composes a slice of Stream
func (*StreamList) Serialize ¶
func (s *StreamList) Serialize() ([]byte, error)
type TwitchClipItem ¶
type TwitchClipItem struct { *EndpointResponseItem VideoId string `json:"slug"` Language string `json:"language"` Views int `json:"views"` PublishedAt string `json:"created_at"` Duration float64 `json:"duration"` Length int `json:"length"` Preview string `json:"animated_preview_url"` Game string `json:"game"` Thumbnails TwitchClipItemThumbnail `json:"thumbnails"` Vod TwitchClipItemVod `json:"vod"` }
func (*TwitchClipItem) Decode ¶
func (t *TwitchClipItem) Decode(b []byte) error
type TwitchClipItemThumbnail ¶
type TwitchClipItemThumbnail struct {
Medium string `json:"medium"`
}
type TwitchClipItemVod ¶
type TwitchEndpoint ¶
type TwitchEndpoint struct {
*ApiEndpointSchema
}
TwitchEndpoint implements ApiEndpoint
func (*TwitchEndpoint) Handle ¶
func (e *TwitchEndpoint) Handle(connHandler connection.ConnectionHandler, segments []string, w http.ResponseWriter, r *http.Request)
Handle returns a "discovery" of all local streams in the server data root.
type TwitchEndpointResponse ¶
type TwitchEndpointResponse struct {
Items interface{} `json:"items"`
}
type TwitchItem ¶
type TwitchItem struct { *EndpointResponseItem Status string `json:"status"` Language string `json:"language"` Views int `json:"views"` PublishedAt string `json:"published_at"` Length int `json:"length"` Preview string `json:"animated_preview_url"` Thumbnails []TwitchItemThumbnail `json:"thumbnails"` Channel TwitchItemChannel `json:"channel"` VideoId string `json:"_id"` Game string `json:"game"` }
func (*TwitchItem) Decode ¶
func (t *TwitchItem) Decode(b []byte) error
type TwitchItemChannel ¶
type TwitchItemCodec ¶
TwitchItemCodec receives bytes and returns an encoded TwitchItem
type TwitchItemThumbnail ¶
type TwitchItemThumbnail struct {
Url string `json:"url"`
}
type YoutubeEndpoint ¶
type YoutubeEndpoint struct {
*ApiEndpointSchema
}
YoutubeEndpoint implements ApiEndpoint
func (*YoutubeEndpoint) Handle ¶
func (e *YoutubeEndpoint) Handle(connHandler connection.ConnectionHandler, segments []string, w http.ResponseWriter, r *http.Request)
Handle returns a "discovery" of all local streams in the server data root.
type YoutubeEndpointResponse ¶
type YoutubeEndpointResponse struct {
Items []*YoutubeItem `json:"items"`
}
func (*YoutubeEndpointResponse) Encode ¶
func (r *YoutubeEndpointResponse) Encode() ([]byte, error)
type YoutubeItem ¶
type YoutubeItem struct { *EndpointResponseItem Info YoutubeItemInfo `json:"info"` Snippet YoutubeItemSnippet `json:"snippet"` }
type YoutubeItemInfo ¶
holds an "id" struct for youtube videos
type YoutubeItemSnippet ¶
type YoutubeItemSnippet struct { PublishedAt string `json:"publishedAt"` ChannelId string `json:"channelId"` Title string `json:"title"` Description string `json:"description"` PlaylistId string `json:"playlistId"` Thumbnails YoutubeItemThumbnails `json:"thumbnails"` ResourceId YoutubeItemSnippetResource `json:"resourceId"` }
type YoutubeItemThumbnail ¶
type YoutubeItemThumbnails ¶
type YoutubeItemThumbnails struct { Default YoutubeItemThumbnail `json:"default"` Medium YoutubeItemThumbnail `json:"medium"` High YoutubeItemThumbnail `json:"high"` Standard YoutubeItemThumbnail `json:"standard"` }