🎧 Your Personal Streaming Service
Go airsonicmadsonicmedia-servermusicmusic-servernavidromeopensubsonicraspberry-piself-hostedstreamerstreaming-apistreaming-audiosubsonicsubsonic-server
// Code generated by ndpgen. DO NOT EDIT.
//
// This file contains mock implementations for non-WASM builds.
// These mocks allow IDE support, compilation, and unit testing on non-WASM platforms.
// Plugin authors can use the exported mock instances to set expectations in tests.
//
//go:build !wasip1
package host
import (
"github.com/stretchr/testify/mock"
)
// ScrobbleCountOptions represents the ScrobbleCountOptions data structure.
// ScrobbleCountOptions carries optional parameters for counting user scrobbles
type ScrobbleCountOptions struct {
FromTimestamp *int64 `json:"fromTimestamp"`
ToTimestamp *int64 `json:"toTimestamp"`
}
// ScrobbleOptions represents the ScrobbleOptions data structure.
// ScrobbleOptions carries optional parameters for retrieving user scrobbles
type ScrobbleOptions struct {
FromTimestamp *int64 `json:"fromTimestamp"`
ToTimestamp *int64 `json:"toTimestamp"`
Descending bool `json:"descending"`
MaxItems int `json:"maxItems"`
Offset int `json:"offset"`
}
// ScrobbleRef represents the ScrobbleRef data structure.
// ScrobbleRef represents one instance of a scrobble (instance id, file id, submission time)
type ScrobbleRef struct {
ID int64 `json:"id"`
MediaFileID string `json:"mediaFileId"`
SubmissionTime int64 `json:"submissionTime"`
}
// mockScrobbleRetrieverService is the mock implementation for testing.
type mockScrobbleRetrieverService struct {
mock.Mock
}
// ScrobbleRetrieverMock is the auto-instantiated mock instance for testing.
// Use this to set expectations: host.ScrobbleRetrieverMock.On("MethodName", args...).Return(values...)
var ScrobbleRetrieverMock = &mockScrobbleRetrieverService{}
// GetFirstTimestamp is the mock method for ScrobbleRetrieverGetFirstTimestamp.
func (m *mockScrobbleRetrieverService) GetFirstTimestamp(username string) (*int64, error) {
args := m.Called(username)
var r0 *int64
if v := args.Get(0); v != nil {
r0 = v.(*int64)
}
return r0, args.Error(1)
}
// ScrobbleRetrieverGetFirstTimestamp delegates to the mock instance.
// GetFirstTimestamp returns the unix timestamp of the oldest scrobble for the user.
// If the user has no scrobbles, returns nil
func ScrobbleRetrieverGetFirstTimestamp(username string) (*int64, error) {
return ScrobbleRetrieverMock.GetFirstTimestamp(username)
}
// GetLastTimestamp is the mock method for ScrobbleRetrieverGetLastTimestamp.
func (m *mockScrobbleRetrieverService) GetLastTimestamp(username string) (*int64, error) {
args := m.Called(username)
var r0 *int64
if v := args.Get(0); v != nil {
r0 = v.(*int64)
}
return r0, args.Error(1)
}
// ScrobbleRetrieverGetLastTimestamp delegates to the mock instance.
// GetLastTimestamp returns the unix timestamp of the most recent scrobble for the user
// If the user has no scrobbles, return nil
func ScrobbleRetrieverGetLastTimestamp(username string) (*int64, error) {
return ScrobbleRetrieverMock.GetLastTimestamp(username)
}
// GetScrobbles is the mock method for ScrobbleRetrieverGetScrobbles.
func (m *mockScrobbleRetrieverService) GetScrobbles(username string, options ScrobbleOptions) ([]ScrobbleRef, *ScrobbleOptions, error) {
args := m.Called(username, options)
var r0 []ScrobbleRef
if v := args.Get(0); v != nil {
r0 = v.([]ScrobbleRef)
}
var r1 *ScrobbleOptions
if v := args.Get(1); v != nil {
r1 = v.(*ScrobbleOptions)
}
return r0, r1, args.Error(2)
}
// ScrobbleRetrieverGetScrobbles delegates to the mock instance.
// GetScrobbles returns one page of scrobbles for a user.
//
// Parameters:
// - username: the user to query for scrobbles
// - options.FromTimestamp: If specified, the first UNIX timestamp to start fetching scrobbles (inclusive). Otherwise, start from the first scrobble
// - options.ToTimestamp: If specified, the last UNIX timestamp to fetch (inclusive). Otherwise, end at the last scrobble
// - options.Descending: If true, order from newest to oldest. Otherwise, oldest to newest
// - options.MaxItems: The maximum number of items to retrieve. The maximum value (and default) if not specified is 5000
// - options.Offset: Pagination state; only valid as received on the options returned by a previous call. Never set it manually
//
// Returns:
// - scrobbles: The scrobbles in the requested range, ordered by submission time
// (ties broken by scrobble ID) in the direction given by options.Descending
// - next: The options for the following page, or nil once no scrobbles remain.
// Pass it back to GetScrobbles unchanged and repeat until it is nil. It carries an
// adjusted FromTimestamp/ToTimestamp, so keep a copy if you still need the original range
func ScrobbleRetrieverGetScrobbles(username string, options ScrobbleOptions) ([]ScrobbleRef, *ScrobbleOptions, error) {
return ScrobbleRetrieverMock.GetScrobbles(username, options)
}
// GetScrobbleCount is the mock method for ScrobbleRetrieverGetScrobbleCount.
func (m *mockScrobbleRetrieverService) GetScrobbleCount(username string, options ScrobbleCountOptions) (int64, error) {
args := m.Called(username, options)
return args.Get(0).(int64), args.Error(1)
}
// ScrobbleRetrieverGetScrobbleCount delegates to the mock instance.
// GetScrobbleCount returns the number of scrobbles for a user in a given range
//
// Parameters:
// - username: the user to query for scrobbles
// - options.FromTimestamp: If specified, the first UNIX timestamp to start fetching scrobbles (inclusive). Otherwise, start from the first scrobble
// - options.ToTimestamp: If specified, the last UNIX timestamp to fetch (inclusive). Otherwise, end at the last scrobble
//
// Returns:
// - the number of scrobbles in the given range, or 0
func ScrobbleRetrieverGetScrobbleCount(username string, options ScrobbleCountOptions) (int64, error) {
return ScrobbleRetrieverMock.GetScrobbleCount(username, options)
}