mirror of
https://github.com/navidrome/navidrome.git
synced 2026-10-18 07:30:29 +00:00
chore(plugins): fix typos in scrobble retriever
Rename newScrobbleRetreverService, and fix FromTImestamp/nonero in the ScrobbleRetriever doc comments, which generate into the Go and Rust PDKs. Also corrects two mislabelled test entries.
This commit is contained in:
parent
44a933f72e
commit
6982bbc285
@ -10,7 +10,7 @@ type ScrobbleList struct {
|
||||
// If additional items are available, the timestamp of the next scrobble to fetch
|
||||
NextTimestamp *int64 `json:"nextTimestamp,omitempty"`
|
||||
// In the event that multiple scrobbles were submitted at the same time, cursor
|
||||
// will be populated to enable future queries. If this cursor is nonero
|
||||
// will be populated to enable future queries. If this cursor is nonzero
|
||||
// it should be passed on for the next request
|
||||
Cursor int `json:"cursor,omitempty"`
|
||||
}
|
||||
@ -81,7 +81,7 @@ type ScrobbleRetrieverService interface {
|
||||
// Returns:
|
||||
// - Scrobbles: A list of scrobbles within the constraints given (if any). The order
|
||||
// of the items depends on the options: if ToTimestamp is specified AND
|
||||
// FromTImestamp is not specified, the order is in descending submission time.
|
||||
// FromTimestamp is not specified, the order is in descending submission time.
|
||||
// Otherwise, the scrobbles are returned in ascending submission time.
|
||||
// - NextTimestamp: If there are additional items to retrieve in the range, the timestamp
|
||||
// of the next scrobble that would be retrieved in the order (asc or desc)
|
||||
|
||||
@ -15,7 +15,7 @@ type scrobbleRetrieverServiceImpl struct {
|
||||
users userAccess
|
||||
}
|
||||
|
||||
func newScrobbleRetreverService(ds model.DataStore, users userAccess) host.ScrobbleRetrieverService {
|
||||
func newScrobbleRetrieverService(ds model.DataStore, users userAccess) host.ScrobbleRetrieverService {
|
||||
return &scrobbleRetrieverServiceImpl{
|
||||
ds: ds,
|
||||
users: users,
|
||||
|
||||
@ -24,7 +24,7 @@ import (
|
||||
. "github.com/onsi/gomega"
|
||||
)
|
||||
|
||||
var _ = Describe("Scrobbble Retriever Host Function", Ordered, func() {
|
||||
var _ = Describe("Scrobble Retriever Host Function", Ordered, func() {
|
||||
var (
|
||||
manager *Manager
|
||||
tmpDir string
|
||||
@ -257,12 +257,12 @@ var _ = Describe("Scrobbble Retriever Host Function", Ordered, func() {
|
||||
}))
|
||||
},
|
||||
Entry("calls scrobbles in ascending order", `{"username":"adminuser"}`, scrobbles, nil, 0),
|
||||
Entry("calls scrobbles in ascending order by request", `{"username":"adminuser","descending":true}`, scrobblesReversed, nil, 0),
|
||||
Entry("calls scrobbles in descending order by request", `{"username":"adminuser","descending":true}`, scrobblesReversed, nil, 0),
|
||||
Entry("calls scrobbles in ascending order, beyond range", `{"username":"adminuser","fromTimestamp":-1, "toTimestamp": 1000}`, scrobbles, nil, 0),
|
||||
Entry("calls subset of scrobbles in ascending order, next timestamp", `{"username":"adminuser","maxItems":2}`, scrobbles[:2], p(2), 0),
|
||||
Entry("calls subset of scrobbles in ascending order, with offset next timestamp", `{"username":"adminuser","maxItems":2,"fromTimestamp":1}`, scrobbles[1:3], p(2), 1),
|
||||
Entry("calls subset of scrobbles in ascending order, from and to timestamp", `{"username":"adminuser","toTimestamp":2,"fromTimestamp":1}`, scrobbles[1:], nil, 0),
|
||||
Entry("calls subset of scrobbles in descing order, from and to timestamp", `{"username":"adminuser","toTimestamp":2,"fromTimestamp":1,"descending":true}`, scrobblesReversed[:3], nil, 0),
|
||||
Entry("calls subset of scrobbles in descending order, from and to timestamp", `{"username":"adminuser","toTimestamp":2,"fromTimestamp":1,"descending":true}`, scrobblesReversed[:3], nil, 0),
|
||||
Entry("calls in reverse order, full", `{"username":"adminuser","toTimestamp":2}`, scrobblesReversed, nil, 0),
|
||||
Entry("calls in reverse order, with count", `{"username":"adminuser","toTimestamp":2, "maxItems": 3}`, scrobblesReversed[:3], p(0), 0),
|
||||
Entry("calls in reverse order, with count of 1", `{"username":"adminuser","toTimestamp":2, "maxItems": 1}`, scrobblesReversed[:1], p(2), 1),
|
||||
|
||||
@ -181,7 +181,7 @@ var hostServices = []hostServiceEntry{
|
||||
name: "ScrobbleRetriever",
|
||||
hasPermission: func(p *Permissions) bool { return p != nil && p.ScrobbleRetriever != nil },
|
||||
create: func(ctx *serviceContext) ([]extism.HostFunction, io.Closer, error) {
|
||||
service := newScrobbleRetreverService(ctx.manager.ds, newUserAccess(ctx.allowedUsers, ctx.allUsers))
|
||||
service := newScrobbleRetrieverService(ctx.manager.ds, newUserAccess(ctx.allowedUsers, ctx.allUsers))
|
||||
return host.RegisterScrobbleRetrieverHostFunctions(service), nil, nil
|
||||
},
|
||||
},
|
||||
|
||||
@ -190,7 +190,7 @@ func ScrobbleRetrieverGetLastTimestamp(username string) (*int64, error) {
|
||||
// Returns:
|
||||
// - Scrobbles: A list of scrobbles within the constraints given (if any). The order
|
||||
// of the items depends on the options: if ToTimestamp is specified AND
|
||||
// FromTImestamp is not specified, the order is in descending submission time.
|
||||
// FromTimestamp is not specified, the order is in descending submission time.
|
||||
// Otherwise, the scrobbles are returned in ascending submission time.
|
||||
// - NextTimestamp: If there are additional items to retrieve in the range, the timestamp
|
||||
// of the next scrobble that would be retrieved in the order (asc or desc)
|
||||
|
||||
@ -99,7 +99,7 @@ func (m *mockScrobbleRetrieverService) GetScrobbles(username string, options Scr
|
||||
// Returns:
|
||||
// - Scrobbles: A list of scrobbles within the constraints given (if any). The order
|
||||
// of the items depends on the options: if ToTimestamp is specified AND
|
||||
// FromTImestamp is not specified, the order is in descending submission time.
|
||||
// FromTimestamp is not specified, the order is in descending submission time.
|
||||
// Otherwise, the scrobbles are returned in ascending submission time.
|
||||
// - NextTimestamp: If there are additional items to retrieve in the range, the timestamp
|
||||
// of the next scrobble that would be retrieved in the order (asc or desc)
|
||||
|
||||
@ -182,7 +182,7 @@ pub fn get_last_timestamp(username: &str) -> Result<Option<i64>, Error> {
|
||||
/// Returns:
|
||||
/// - Scrobbles: A list of scrobbles within the constraints given (if any). The order
|
||||
/// of the items depends on the options: if ToTimestamp is specified AND
|
||||
/// FromTImestamp is not specified, the order is in descending submission time.
|
||||
/// FromTimestamp is not specified, the order is in descending submission time.
|
||||
/// Otherwise, the scrobbles are returned in ascending submission time.
|
||||
/// - NextTimestamp: If there are additional items to retrieve in the range, the timestamp
|
||||
/// of the next scrobble that would be retrieved in the order (asc or desc)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user