Documentation
¶
Index ¶
- func NewNarrationRequest(ssml string, voice narrationpb.ResolveRequest_TtsVoice, ...) *narrationpb.TtsRequest
- type ContextResolveError
- type ContextResolver
- func (r *ContextResolver) Metadata() map[string]string
- func (r *ContextResolver) Page(ctx context.Context, idx int) ([]*connectpb.ContextTrack, error)
- func (r *ContextResolver) Restrictions() *connectpb.Restrictions
- func (r *ContextResolver) Type() librespot.SpotifyIdType
- func (r *ContextResolver) Uri() string
- type RateLimitedError
- type Spclient
- func (c *Spclient) ContextResolve(ctx context.Context, uri string) (*connectpb.Context, error)
- func (c *Spclient) ContextResolveAutoplay(ctx context.Context, reqProto *playerpb.AutoplayContextRequest) (*connectpb.Context, error)
- func (c *Spclient) ContextResolveUrl(ctx context.Context, hmUrl string) (*connectpb.Context, error)
- func (c *Spclient) CreateResumePointRevision(ctx context.Context, reqProto *resumptionpb.CreateResumePointRevisionRequest) (*resumptionpb.CreateResumePointRevisionResponse, error)
- func (c *Spclient) ExtendedMetadata(ctx context.Context, req *extmetadatapb.BatchedEntityRequest) (*extmetadatapb.BatchedExtensionResponse, error)
- func (c *Spclient) ExtendedMetadataSimple(ctx context.Context, id librespot.SpotifyId, ext extmetadatapb.ExtensionKind, ...) error
- func (c *Spclient) GetAccessToken(ctx context.Context, force bool) (string, error)
- func (c *Spclient) ListCurrentStates(ctx context.Context, reqProto *resumptionpb.ListCurrentStatesRequest) (*resumptionpb.ListCurrentStatesResponse, error)
- func (c *Spclient) NarrationUrl(ctx context.Context, req *narrationpb.TtsRequest) (string, error)
- func (c *Spclient) NetFortune(ctx context.Context, bandwidth int) (*netfortunepb.NetFortuneV2Response, error)
- func (c *Spclient) PlayPlayRequest(ctx context.Context, fileId []byte, ...) (*streamingpb.PlayPlayLicenseResponse, error)
- func (c *Spclient) PlaylistSignals(ctx context.Context, playlist librespot.SpotifyId, ...) (*playlist4pb.SelectedListContent, error)
- func (c *Spclient) PublishEvents(ctx context.Context, reqProto *eventsenderpb.PublishEventsRequest) (*eventsenderpb.PublishEventsResponse, error)
- func (c *Spclient) PutConnectState(ctx context.Context, spotConnId string, reqProto *connectpb.PutStateRequest) (*connectpb.Cluster, error)
- func (c *Spclient) PutConnectStateInactive(ctx context.Context, spotConnId string, notify bool) error
- func (c *Spclient) PutConnectStateRaw(ctx context.Context, spotConnId string, reason connectpb.PutStateReason, ...) (*connectpb.Cluster, error)
- func (c *Spclient) Request(ctx context.Context, method string, path string, query url.Values, ...) (*http.Response, error)
- func (c *Spclient) RequestHm(ctx context.Context, method string, hmUrl string, header http.Header, ...) (*http.Response, error)
- func (c *Spclient) RequestNoRedirect(ctx context.Context, method string, path string, query url.Values, ...) (*http.Response, error)
- func (c *Spclient) ResolveStorageInteractive(ctx context.Context, fileId []byte, format *metadatapb.AudioFile_Format, ...) (*storagepb.StorageResolveResponse, error)
- func (c *Spclient) ResumePositionMs(ctx context.Context, id librespot.SpotifyId) (int64, error)
- func (c *Spclient) SetResumeFinished(ctx context.Context, id librespot.SpotifyId) error
- func (c *Spclient) SetResumePositionMs(ctx context.Context, id librespot.SpotifyId, positionMs int64) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewNarrationRequest ¶ added in v0.9.0
func NewNarrationRequest(ssml string, voice narrationpb.ResolveRequest_TtsVoice, provider narrationpb.ResolveRequest_TtsProvider, sampleRate int32) *narrationpb.TtsRequest
Types ¶
type ContextResolveError ¶ added in v0.10.1
type ContextResolveError struct {
StatusCode int
// contains filtered or unexported fields
}
ContextResolveError reports that the backend answered a context resolve with something other than 200. Transient statuses never get this far, they are retried by the request itself, so what arrives here is the backend's final word: 403 and 404 in particular mean this account may not have the context.
func (*ContextResolveError) Error ¶ added in v0.10.1
func (e *ContextResolveError) Error() string
func (*ContextResolveError) IsAccessDenied ¶ added in v0.10.1
func (e *ContextResolveError) IsAccessDenied() bool
IsAccessDenied reports whether the backend refused the context to this account rather than failing to produce it.
type ContextResolver ¶
type ContextResolver struct {
// contains filtered or unexported fields
}
func NewContextResolver ¶
func (*ContextResolver) Metadata ¶
func (r *ContextResolver) Metadata() map[string]string
func (*ContextResolver) Page ¶
func (r *ContextResolver) Page(ctx context.Context, idx int) ([]*connectpb.ContextTrack, error)
func (*ContextResolver) Restrictions ¶
func (r *ContextResolver) Restrictions() *connectpb.Restrictions
func (*ContextResolver) Type ¶
func (r *ContextResolver) Type() librespot.SpotifyIdType
func (*ContextResolver) Uri ¶
func (r *ContextResolver) Uri() string
type RateLimitedError ¶ added in v0.8.0
RateLimitedError reports a connect-state 429; RetryAfter is the advised cooldown.
func (*RateLimitedError) Error ¶ added in v0.8.0
func (e *RateLimitedError) Error() string
func (*RateLimitedError) Unwrap ¶ added in v0.8.0
func (e *RateLimitedError) Unwrap() error
type Spclient ¶
type Spclient struct {
// contains filtered or unexported fields
}
func NewSpclient ¶
func (*Spclient) ContextResolve ¶
func (*Spclient) ContextResolveAutoplay ¶
func (*Spclient) ContextResolveUrl ¶ added in v0.9.0
ContextResolveUrl resolves a context through the hm:// url the Context carries rather than through /context-resolve/v1.
func (*Spclient) CreateResumePointRevision ¶ added in v0.8.0
func (c *Spclient) CreateResumePointRevision(ctx context.Context, reqProto *resumptionpb.CreateResumePointRevisionRequest) (*resumptionpb.CreateResumePointRevisionResponse, error)
func (*Spclient) ExtendedMetadata ¶ added in v0.3.3
func (c *Spclient) ExtendedMetadata(ctx context.Context, req *extmetadatapb.BatchedEntityRequest) (*extmetadatapb.BatchedExtensionResponse, error)
func (*Spclient) ExtendedMetadataSimple ¶ added in v0.3.3
func (c *Spclient) ExtendedMetadataSimple(ctx context.Context, id librespot.SpotifyId, ext extmetadatapb.ExtensionKind, data proto.Message) error
func (*Spclient) GetAccessToken ¶
func (*Spclient) ListCurrentStates ¶ added in v0.8.0
func (c *Spclient) ListCurrentStates(ctx context.Context, reqProto *resumptionpb.ListCurrentStatesRequest) (*resumptionpb.ListCurrentStatesResponse, error)
func (*Spclient) NarrationUrl ¶ added in v0.9.0
func (c *Spclient) NarrationUrl(ctx context.Context, req *narrationpb.TtsRequest) (string, error)
NarrationUrl turns a narration script into the url of its synthesized audio.
func (*Spclient) NetFortune ¶ added in v0.3.0
func (c *Spclient) NetFortune(ctx context.Context, bandwidth int) (*netfortunepb.NetFortuneV2Response, error)
func (*Spclient) PlayPlayRequest ¶ added in v0.5.1
func (c *Spclient) PlayPlayRequest(ctx context.Context, fileId []byte, reqProto *streamingpb.PlayPlayLicenseRequest) (*streamingpb.PlayPlayLicenseResponse, error)
func (*Spclient) PlaylistSignals ¶
func (c *Spclient) PlaylistSignals(ctx context.Context, playlist librespot.SpotifyId, reqProto *playlist4pb.ListSignals, lenses []string) (*playlist4pb.SelectedListContent, error)
func (*Spclient) PublishEvents ¶ added in v0.3.0
func (c *Spclient) PublishEvents(ctx context.Context, reqProto *eventsenderpb.PublishEventsRequest) (*eventsenderpb.PublishEventsResponse, error)
func (*Spclient) PutConnectState ¶
func (*Spclient) PutConnectStateInactive ¶
func (*Spclient) PutConnectStateRaw ¶ added in v0.10.0
func (c *Spclient) PutConnectStateRaw(ctx context.Context, spotConnId string, reason connectpb.PutStateReason, reqBody []byte) (*connectpb.Cluster, error)
PutConnectStateRaw PUTs an already marshalled PutStateRequest. Marshalling in the caller lets it hand over a snapshot of state it goes on mutating, rather than a proto this call would walk from another goroutine.
func (*Spclient) RequestHm ¶ added in v0.9.0
func (c *Spclient) RequestHm(ctx context.Context, method string, hmUrl string, header http.Header, body []byte) (*http.Response, error)
RequestHm issues a request against an hm:// URL, the form Spotify uses to name spclient endpoints inside payloads.
The remainder cannot simply be handed to Request as a path: JoinPath escapes the "?" of a query string. The query is kept verbatim rather than being parsed and re-encoded, so that a contextUri keeps its unescaped colons.
func (*Spclient) RequestNoRedirect ¶ added in v0.9.0
func (c *Spclient) RequestNoRedirect(ctx context.Context, method string, path string, query url.Values, header http.Header, body []byte) (*http.Response, error)
RequestNoRedirect is Request but returns the redirect itself rather than following it, for endpoints that answer with a Location instead of a body.
func (*Spclient) ResolveStorageInteractive ¶
func (c *Spclient) ResolveStorageInteractive(ctx context.Context, fileId []byte, format *metadatapb.AudioFile_Format, prefetch bool) (*storagepb.StorageResolveResponse, error)
func (*Spclient) ResumePositionMs ¶ added in v0.8.0
ResumePositionMs returns where playback of the given entity should start, in milliseconds. Zero means "from the beginning": either the backend has never seen the entity, or it was listened to the end and the next play is meant to restart it.
Only episodes and audiobook chapters have resume points; callers should not bother asking for tracks.
func (*Spclient) SetResumeFinished ¶ added in v0.8.0
SetResumeFinished marks the given entity as listened to the end, so the next play starts it over rather than resuming a position near the end.