Documentation
¶
Overview ¶
Package frontendtest supplies configurable fakes for protocol implementations.
Index ¶
- type Capabilities
- type Experience
- func (f Experience) Ancestors(c context.Context, v *core.Viewer, d core.Device, k core.RatingKey) ([]core.Title, error)
- func (f Experience) Children(c context.Context, v *core.Viewer, d core.Device, k core.RatingKey, ...) (core.Page, error)
- func (f Experience) Collections(c context.Context, v *core.Viewer, d core.Device, q frontend.CollectionQuery) (frontend.CollectionPage, error)
- func (f Experience) EntityFavorites(c context.Context, v *core.Viewer, refs []frontend.FavoriteRef) (map[frontend.FavoriteRef]bool, error)
- func (f Experience) Facets(c context.Context, v *core.Viewer, d core.Device, id, name string) ([]core.FacetValue, error)
- func (f Experience) Item(c context.Context, r frontend.ItemRequest) (frontend.ItemDetail, error)
- func (f Experience) ItemArtwork(c context.Context, v *core.Viewer, d core.Device, k core.RatingKey) ([]frontend.Image, bool, error)
- func (f Experience) LibraryCount(c context.Context, v *core.Viewer, id string) (int, error)
- func (f Experience) LibraryItems(c context.Context, v *core.Viewer, d core.Device, id string, ...) (core.Page, error)
- func (f Experience) NamedFacetIDs(c context.Context, v *core.Viewer, d core.Device, key core.RatingKey, ...) (map[string]string, error)
- func (f Experience) NotInterested(c context.Context, v *core.Viewer, d core.Device, q frontend.PageQuery) (frontend.NotInterestedPage, error)
- func (f Experience) NotInterestedItem(c context.Context, v *core.Viewer, d core.Device, k core.RatingKey) (frontend.NotInterestedEntry, error)
- func (f Experience) PersonFacetIDs(c context.Context, v *core.Viewer, d core.Device, key core.RatingKey, ...) (map[int64]string, error)
- func (f Experience) RemoveFromContinue(c context.Context, v *core.Viewer, k core.RatingKey) error
- func (f Experience) ReportRowInteraction(c context.Context, interaction frontend.RowInteraction) error
- func (f Experience) ResolveEventSubject(c context.Context, v *core.Viewer, d core.Device, ref frontend.FavoriteRef) (frontend.ResolvedEventSubject, error)
- func (f Experience) ResolveExternal(c context.Context, v *core.Viewer, d core.Device, r frontend.ExternalRequest) (core.RatingKey, error)
- func (f Experience) ResolveFacet(c context.Context, v *core.Viewer, d core.Device, view, kind, id string) (core.FacetValue, error)
- func (f Experience) Rows(c context.Context, r frontend.RowRequest) ([]frontend.Row, error)
- func (f Experience) Search(c context.Context, v *core.Viewer, d core.Device, s string, ...) (frontend.SearchPage, error)
- func (f Experience) SetEntityFavorite(c context.Context, v *core.Viewer, ref frontend.FavoriteRef, on bool) error
- func (f Experience) SetFavorite(c context.Context, v *core.Viewer, k core.RatingKey, on bool) error
- func (f Experience) SetLikes(c context.Context, v *core.Viewer, k core.RatingKey, likes *bool) error
- func (f Experience) SetNotInterested(c context.Context, v *core.Viewer, k core.RatingKey, on bool) error
- func (f Experience) SetPlayed(c context.Context, v *core.Viewer, k core.RatingKey) error
- func (f Experience) SetRating(c context.Context, v *core.Viewer, k core.RatingKey, rating float64) error
- func (f Experience) SetUnplayed(c context.Context, v *core.Viewer, k core.RatingKey) error
- func (f Experience) SetWatchlist(c context.Context, v *core.Viewer, k core.RatingKey, on bool) error
- func (f Experience) Similar(c context.Context, v *core.Viewer, d core.Device, k core.RatingKey, ...) (frontend.SearchPage, error)
- func (f Experience) UserData(c context.Context, v *core.Viewer, k []core.RatingKey) (map[core.RatingKey]core.WatchStatus, error)
- func (f Experience) Views(c context.Context, v *core.Viewer) ([]frontend.View, error)
- type GrantDeviceIdentity
- type Identity
- func (f Identity) IssueRefresh(ctx context.Context, token string, d core.Device) (string, error)
- func (f Identity) PublicViewers(ctx context.Context) ([]frontend.PublicViewer, error)
- func (f Identity) QuickConnectApprove(ctx context.Context, viewer *core.Viewer, code string) error
- func (f Identity) QuickConnectDetails(ctx context.Context, secret string) (frontend.QuickConnectDetails, error)
- func (f Identity) QuickConnectInitiate(ctx context.Context, d core.Device) (string, string, error)
- func (f Identity) QuickConnectPoll(ctx context.Context, secret string) (string, error)
- func (f Identity) QuickConnectStatus(ctx context.Context, secret string) (bool, error)
- func (f Identity) Refresh(ctx context.Context, token string, d core.Device) (string, string, error)
- func (f Identity) Resolve(ctx context.Context, credential string) (*core.Viewer, error)
- func (f Identity) ResolveDevice(ctx context.Context, credential string, device core.Device) (*core.Viewer, time.Time, error)
- func (f Identity) Revoke(ctx context.Context, grant string) error
- func (f Identity) SetupComplete() bool
- func (f Identity) SignIn(ctx context.Context, user, password string, d core.Device) (string, error)
- func (f Identity) ViewerTimes(ctx context.Context, credential string, viewerID int64) (frontend.ViewerTimes, error)
- type ImageGrants
- func (f ImageGrants) Issue(ctx context.Context, req frontend.ImageGrantRequest) (string, error)
- func (f ImageGrants) IssueBatch(ctx context.Context, req frontend.ImageBatchRequest) ([]frontend.ImageBatchItem, error)
- func (f ImageGrants) Revoke(ctx context.Context, credential, secret string) error
- func (f ImageGrants) Serve(w http.ResponseWriter, r *http.Request, secret string)
- type LiveTV
- func (f LiveTV) Channels(ctx context.Context, v *core.Viewer) ([]frontend.LiveChannel, error)
- func (f LiveTV) Guide(ctx context.Context, v *core.Viewer, q frontend.LiveGuideQuery) ([]frontend.LiveProgramme, error)
- func (f LiveTV) ResolveChannelGUID(ctx context.Context, v *core.Viewer, id string) (frontend.LiveChannel, error)
- func (f LiveTV) ResolveProgrammeGUID(ctx context.Context, v *core.Viewer, id string, q frontend.LiveGuideQuery) (frontend.LiveProgramme, error)
- type Preferences
- func (f Preferences) Delete(ctx context.Context, v *core.Viewer, client, key string) error
- func (f Preferences) Get(ctx context.Context, v *core.Viewer, client, key string) (json.RawMessage, error)
- func (f Preferences) Put(ctx context.Context, v *core.Viewer, client, key string, data json.RawMessage) error
- type Sessions
- func (f Sessions) Capabilities(c context.Context, a frontend.SessionAccess) (frontend.SessionCapabilities, error)
- func (f Sessions) Command(c context.Context, actor *core.Viewer, id string, cmd frontend.Command) error
- func (f Sessions) Events(c context.Context, s frontend.EventScope) (<-chan frontend.Event, error)
- func (f Sessions) Markers(c context.Context, a frontend.SessionAccess, id string) (frontend.SessionMarkers, error)
- func (f Sessions) Open(c context.Context, r frontend.OpenRequest) (frontend.Session, error)
- func (f Sessions) Plan(c context.Context, r frontend.PlanRequest) (frontend.PlayPlan, error)
- func (f Sessions) Recover(c context.Context, id, url string, at time.Duration) error
- func (f Sessions) Report(c context.Context, a frontend.SessionAccess, id string, t frontend.Timeline) error
- func (f Sessions) ReportItemProgress(c context.Context, a frontend.SessionAccess, item core.RatingKey, ...) error
- func (f Sessions) ReportSample(ctx context.Context, a frontend.SessionAccess, id string, ...) (frontend.ReportOutcome, error)
- func (f Sessions) ServeMedia(w http.ResponseWriter, r *http.Request)
- func (f Sessions) Sessions(c context.Context, a frontend.SessionAccess) ([]frontend.Session, error)
- func (f Sessions) StartStream(c context.Context, a frontend.SessionAccess, id string, ...) (string, error)
- func (f Sessions) Stop(c context.Context, a frontend.SessionAccess, id string) error
- func (f Sessions) SubtitleURL(c context.Context, a frontend.SessionAccess, id string, index int, ...) (string, error)
- func (f Sessions) TranscodeFor(c context.Context, id string) (core.HLSSession, bool)
- func (f Sessions) UpdateCapabilities(c context.Context, a frontend.SessionAccess, v frontend.SessionCapabilities) error
- type TrackPreferences
- type VirtualPaths
- func (f VirtualPaths) Base(ctx context.Context, r *http.Request) (string, error)
- func (f VirtualPaths) Path(ctx context.Context, v *core.Viewer, d core.Device, key core.RatingKey) (string, error)
- func (f VirtualPaths) Paths(ctx context.Context, v *core.Viewer, d core.Device, keys []core.RatingKey) (map[core.RatingKey]string, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Capabilities ¶
type Capabilities struct {
BuildFunc func(context.Context, frontend.CapabilityRequest) (frontend.CapabilityResult, error)
}
Capabilities is a configurable fake for the host capability provider.
func (Capabilities) Build ¶
func (f Capabilities) Build(ctx context.Context, req frontend.CapabilityRequest) (frontend.CapabilityResult, error)
type Experience ¶
type Experience struct {
CollectionsFunc func(context.Context, *core.Viewer, core.Device, frontend.CollectionQuery) (frontend.CollectionPage, error)
NotInterestedFunc func(context.Context, *core.Viewer, core.Device, frontend.PageQuery) (frontend.NotInterestedPage, error)
NotInterestedItemFunc func(context.Context, *core.Viewer, core.Device, core.RatingKey) (frontend.NotInterestedEntry, error)
ResolveExternalFunc func(context.Context, *core.Viewer, core.Device, frontend.ExternalRequest) (core.RatingKey, error)
ResolveEventSubjectFunc func(context.Context, *core.Viewer, core.Device, frontend.FavoriteRef) (frontend.ResolvedEventSubject, error)
SetNotInterestedFunc func(context.Context, *core.Viewer, core.RatingKey, bool) error
NamedFacetIDsFunc func(context.Context, *core.Viewer, core.Device, core.RatingKey, string, []string) (map[string]string, error)
PersonFacetIDsFunc func(context.Context, *core.Viewer, core.Device, core.RatingKey, []int64) (map[int64]string, error)
ResolveFacetFunc func(context.Context, *core.Viewer, core.Device, string, string, string) (core.FacetValue, error)
SetLikesFunc func(context.Context, *core.Viewer, core.RatingKey, *bool) error
SetEntityFavoriteFunc func(context.Context, *core.Viewer, frontend.FavoriteRef, bool) error
EntityFavoritesFunc func(context.Context, *core.Viewer, []frontend.FavoriteRef) (map[frontend.FavoriteRef]bool, error)
SimilarFunc func(context.Context, *core.Viewer, core.Device, core.RatingKey, frontend.ItemQuery) (frontend.SearchPage, error)
AncestorsFunc func(context.Context, *core.Viewer, core.Device, core.RatingKey) ([]core.Title, error)
FacetsFunc func(context.Context, *core.Viewer, core.Device, string, string) ([]core.FacetValue, error)
LibraryItemsFunc func(context.Context, *core.Viewer, core.Device, string, frontend.ItemQuery) (core.Page, error)
LibraryCountFunc func(context.Context, *core.Viewer, string) (int, error)
SetPlayedFunc func(context.Context, *core.Viewer, core.RatingKey) error
SetUnplayedFunc func(context.Context, *core.Viewer, core.RatingKey) error
SetWatchlistFunc func(context.Context, *core.Viewer, core.RatingKey, bool) error
SetFavoriteFunc func(context.Context, *core.Viewer, core.RatingKey, bool) error
SetRatingFunc func(context.Context, *core.Viewer, core.RatingKey, float64) error
RemoveFromContinueFunc func(context.Context, *core.Viewer, core.RatingKey) error
ReportRowInteractionFunc func(context.Context, frontend.RowInteraction) error
ViewsFunc func(context.Context, *core.Viewer) ([]frontend.View, error)
RowsFunc func(context.Context, frontend.RowRequest) ([]frontend.Row, error)
ItemFunc func(context.Context, frontend.ItemRequest) (frontend.ItemDetail, error)
ItemArtworkFunc func(context.Context, *core.Viewer, core.Device, core.RatingKey) ([]frontend.Image, bool, error)
ChildrenFunc func(context.Context, *core.Viewer, core.Device, core.RatingKey, frontend.ItemQuery) (core.Page, error)
SearchFunc func(context.Context, *core.Viewer, core.Device, string, frontend.ItemQuery) (frontend.SearchPage, error)
UserDataFunc func(context.Context, *core.Viewer, []core.RatingKey) (map[core.RatingKey]core.WatchStatus, error)
}
Experience implements frontend.Experience with optional function hooks.
func (Experience) Collections ¶
func (f Experience) Collections(c context.Context, v *core.Viewer, d core.Device, q frontend.CollectionQuery) (frontend.CollectionPage, error)
func (Experience) EntityFavorites ¶
func (f Experience) EntityFavorites(c context.Context, v *core.Viewer, refs []frontend.FavoriteRef) (map[frontend.FavoriteRef]bool, error)
func (Experience) Item ¶
func (f Experience) Item(c context.Context, r frontend.ItemRequest) (frontend.ItemDetail, error)
func (Experience) ItemArtwork ¶
func (Experience) LibraryCount ¶
func (Experience) LibraryItems ¶
func (Experience) NamedFacetIDs ¶
func (Experience) NotInterested ¶
func (Experience) NotInterestedItem ¶
func (Experience) PersonFacetIDs ¶
func (Experience) RemoveFromContinue ¶
func (Experience) ReportRowInteraction ¶
func (f Experience) ReportRowInteraction(c context.Context, interaction frontend.RowInteraction) error
func (Experience) ResolveEventSubject ¶
func (f Experience) ResolveEventSubject(c context.Context, v *core.Viewer, d core.Device, ref frontend.FavoriteRef) (frontend.ResolvedEventSubject, error)
func (Experience) ResolveExternal ¶
func (Experience) ResolveFacet ¶
func (Experience) Rows ¶
func (f Experience) Rows(c context.Context, r frontend.RowRequest) ([]frontend.Row, error)
func (Experience) SetEntityFavorite ¶
func (f Experience) SetEntityFavorite(c context.Context, v *core.Viewer, ref frontend.FavoriteRef, on bool) error
func (Experience) SetFavorite ¶
func (Experience) SetNotInterested ¶
func (Experience) SetUnplayed ¶
func (Experience) SetWatchlist ¶
type GrantDeviceIdentity ¶
type GrantDeviceIdentity struct {
Identity
ResolveGrantDeviceFunc func(context.Context, string, string) (*core.Viewer, core.Device, time.Time, error)
}
GrantDeviceIdentity opts a fake identity into the optional grant-device API.
type Identity ¶
type Identity struct {
IssueRefreshFunc func(context.Context, string, core.Device) (string, error)
RefreshFunc func(context.Context, string, core.Device) (string, string, error)
ResolveFunc func(context.Context, string) (*core.Viewer, error)
ResolveDeviceFunc func(context.Context, string, core.Device) (*core.Viewer, time.Time, error)
ViewerTimesFunc func(context.Context, string, int64) (frontend.ViewerTimes, error)
PublicViewersFunc func(context.Context) ([]frontend.PublicViewer, error)
SignInFunc func(context.Context, string, string, core.Device) (string, error)
InitiateFunc func(context.Context, core.Device) (string, string, error)
StatusFunc func(context.Context, string) (bool, error)
DetailsFunc func(context.Context, string) (frontend.QuickConnectDetails, error)
PollFunc func(context.Context, string) (string, error)
ApproveFunc func(context.Context, *core.Viewer, string) error
RevokeFunc func(context.Context, string) error
SetupCompleteFunc func() bool
}
Identity implements a configurable surface-bound identity for protocol tests.
func (Identity) IssueRefresh ¶
func (Identity) PublicViewers ¶
func (Identity) QuickConnectApprove ¶
func (Identity) QuickConnectDetails ¶
func (Identity) QuickConnectInitiate ¶
func (Identity) QuickConnectPoll ¶
func (Identity) QuickConnectStatus ¶
func (Identity) ResolveDevice ¶
func (Identity) SetupComplete ¶
func (Identity) ViewerTimes ¶
type ImageGrants ¶
type ImageGrants struct {
IssueFunc func(context.Context, frontend.ImageGrantRequest) (string, error)
IssueBatchFunc func(context.Context, frontend.ImageBatchRequest) ([]frontend.ImageBatchItem, error)
RevokeFunc func(context.Context, string, string) error
ServeFunc func(http.ResponseWriter, *http.Request, string)
}
ImageGrants provides optional hooks for scoped individual and batch grants.
func (ImageGrants) Issue ¶
func (f ImageGrants) Issue(ctx context.Context, req frontend.ImageGrantRequest) (string, error)
func (ImageGrants) IssueBatch ¶
func (f ImageGrants) IssueBatch(ctx context.Context, req frontend.ImageBatchRequest) ([]frontend.ImageBatchItem, error)
func (ImageGrants) Revoke ¶
func (f ImageGrants) Revoke(ctx context.Context, credential, secret string) error
func (ImageGrants) Serve ¶
func (f ImageGrants) Serve(w http.ResponseWriter, r *http.Request, secret string)
type LiveTV ¶
type LiveTV struct {
ChannelsFunc func(context.Context, *core.Viewer) ([]frontend.LiveChannel, error)
GuideFunc func(context.Context, *core.Viewer, frontend.LiveGuideQuery) ([]frontend.LiveProgramme, error)
ResolveChannelFunc func(context.Context, *core.Viewer, string) (frontend.LiveChannel, error)
ResolveProgrammeFunc func(context.Context, *core.Viewer, string, frontend.LiveGuideQuery) (frontend.LiveProgramme, error)
}
LiveTV is a configurable fake for viewer-scoped live television.
func (LiveTV) Guide ¶
func (f LiveTV) Guide(ctx context.Context, v *core.Viewer, q frontend.LiveGuideQuery) ([]frontend.LiveProgramme, error)
func (LiveTV) ResolveChannelGUID ¶
func (LiveTV) ResolveProgrammeGUID ¶
type Preferences ¶
type Preferences struct {
GetFunc func(context.Context, *core.Viewer, string, string) (json.RawMessage, error)
PutFunc func(context.Context, *core.Viewer, string, string, json.RawMessage) error
DeleteFunc func(context.Context, *core.Viewer, string, string) error
}
Preferences is a configurable fake for protocol presentation state.
type Sessions ¶
type Sessions struct {
PlanFunc func(context.Context, frontend.PlanRequest) (frontend.PlayPlan, error)
OpenFunc func(context.Context, frontend.OpenRequest) (frontend.Session, error)
StartStreamFunc func(context.Context, frontend.SessionAccess, string, frontend.StreamRequest) (string, error)
SubtitleURLFunc func(context.Context, frontend.SessionAccess, string, int, string) (string, error)
MarkersFunc func(context.Context, frontend.SessionAccess, string) (frontend.SessionMarkers, error)
ServeMediaFunc func(http.ResponseWriter, *http.Request)
ReportSampleFunc func(context.Context, frontend.SessionAccess, string, frontend.ProgressSample) (frontend.ReportOutcome, error)
ReportFunc func(context.Context, frontend.SessionAccess, string, frontend.Timeline) error
ReportItemFunc func(context.Context, frontend.SessionAccess, core.RatingKey, frontend.Timeline) error
StopFunc func(context.Context, frontend.SessionAccess, string) error
CommandFunc func(context.Context, *core.Viewer, string, frontend.Command) error
UpdateCapabilitiesFunc func(context.Context, frontend.SessionAccess, frontend.SessionCapabilities) error
CapabilitiesFunc func(context.Context, frontend.SessionAccess) (frontend.SessionCapabilities, error)
SessionsFunc func(context.Context, frontend.SessionAccess) ([]frontend.Session, error)
RecoverFunc func(context.Context, string, string, time.Duration) error
TranscodeForFunc func(context.Context, string) (core.HLSSession, bool)
EventsFunc func(context.Context, frontend.EventScope) (<-chan frontend.Event, error)
}
Sessions implements frontend.Sessions with optional function hooks.
func (Sessions) Capabilities ¶
func (f Sessions) Capabilities(c context.Context, a frontend.SessionAccess) (frontend.SessionCapabilities, error)
func (Sessions) Markers ¶
func (f Sessions) Markers(c context.Context, a frontend.SessionAccess, id string) (frontend.SessionMarkers, error)
func (Sessions) ReportItemProgress ¶
func (Sessions) ReportSample ¶
func (f Sessions) ReportSample(ctx context.Context, a frontend.SessionAccess, id string, sample frontend.ProgressSample) (frontend.ReportOutcome, error)
func (Sessions) ServeMedia ¶
func (f Sessions) ServeMedia(w http.ResponseWriter, r *http.Request)
func (Sessions) StartStream ¶
func (f Sessions) StartStream(c context.Context, a frontend.SessionAccess, id string, r frontend.StreamRequest) (string, error)
func (Sessions) SubtitleURL ¶
func (Sessions) TranscodeFor ¶
func (Sessions) UpdateCapabilities ¶
func (f Sessions) UpdateCapabilities(c context.Context, a frontend.SessionAccess, v frontend.SessionCapabilities) error
type TrackPreferences ¶
type TrackPreferences struct {
GetFunc func(context.Context, *core.Viewer) (frontend.TrackPreferences, error)
SetFunc func(context.Context, *core.Viewer, []string, string) error
}
TrackPreferences is a configurable fake for shared viewer track settings.
func (TrackPreferences) Get ¶
func (f TrackPreferences) Get(ctx context.Context, v *core.Viewer) (frontend.TrackPreferences, error)
func (TrackPreferences) SetSubtitle ¶
type VirtualPaths ¶
type VirtualPaths struct {
PathFunc func(context.Context, *core.Viewer, core.Device, core.RatingKey) (string, error)
PathsFunc func(context.Context, *core.Viewer, core.Device, []core.RatingKey) (map[core.RatingKey]string, error)
BaseFunc func(context.Context, *http.Request) (string, error)
}
VirtualPaths supplies configurable viewer-scoped virtual paths.