✅ Update test for pagination
This commit is contained in:
1 parent
5dff86e13d
commit
5bf60ff2f1
26 files changed
+84
-26
No files matched your search
+11
-2
@@ -18,6 +18,14 @@ before:
|
||||
- go install github.com/tc-hib/go-winres@latest
|
||||
- go generate ./...
|
||||
|
||||
gomod:
|
||||
proxy: true
|
||||
|
||||
report_sizes: true
|
||||
|
||||
metadata:
|
||||
mod_timestamp: "{{ .CommitTimestamp }}"
|
||||
|
||||
builds:
|
||||
- id: yutu
|
||||
binary: "{{ .ProjectName }}-{{ .Os }}-{{ .Arch }}"
|
||||
@@ -45,10 +53,11 @@ builds:
|
||||
- -X {{ .Env.MODULE_PATH }}/cmd.CommitDate={{ .CommitDate }}
|
||||
- -X {{ .Env.MODULE_PATH }}/cmd.Os={{ .Os }}
|
||||
- -X {{ .Env.MODULE_PATH }}/cmd.Arch={{ .Arch }}
|
||||
mod_timestamp: "{{ .CommitTimestamp }}"
|
||||
|
||||
archives:
|
||||
- format: binary
|
||||
builds:
|
||||
- formats: [ 'binary' ]
|
||||
ids:
|
||||
- yutu
|
||||
name_template: "{{ .Binary }}"
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@ package activity
|
||||
import (
|
||||
"errors"
|
||||
"io"
|
||||
"math"
|
||||
|
||||
"github.com/eat-pray-ai/yutu/pkg"
|
||||
"github.com/eat-pray-ai/yutu/pkg/auth"
|
||||
@@ -127,8 +128,10 @@ func WithHome(home *bool) Option {
|
||||
|
||||
func WithMaxResults(maxResults int64) Option {
|
||||
return func(a *activity) {
|
||||
if maxResults <= 0 {
|
||||
if maxResults < 0 {
|
||||
maxResults = 1
|
||||
} else if maxResults == 0 {
|
||||
maxResults = math.MaxInt64
|
||||
}
|
||||
a.MaxResults = maxResults
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package activity
|
||||
|
||||
import (
|
||||
"math"
|
||||
"reflect"
|
||||
"testing"
|
||||
|
||||
@@ -84,7 +85,7 @@ func TestNewActivity(t *testing.T) {
|
||||
},
|
||||
},
|
||||
want: &activity{
|
||||
MaxResults: 1,
|
||||
MaxResults: math.MaxInt64,
|
||||
},
|
||||
},
|
||||
{
|
||||
|
||||
@@ -4,6 +4,7 @@ import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"io"
|
||||
"math"
|
||||
|
||||
"github.com/eat-pray-ai/yutu/pkg"
|
||||
"github.com/eat-pray-ai/yutu/pkg/auth"
|
||||
@@ -218,8 +219,10 @@ func WithChannelManagedByMe(managedByMe *bool) Option {
|
||||
|
||||
func WithMaxResults(maxResults int64) Option {
|
||||
return func(c *channel) {
|
||||
if maxResults <= 0 {
|
||||
if maxResults < 0 {
|
||||
maxResults = 1
|
||||
} else if maxResults == 0 {
|
||||
maxResults = math.MaxInt64
|
||||
}
|
||||
c.MaxResults = maxResults
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package channel
|
||||
|
||||
import (
|
||||
"math"
|
||||
"reflect"
|
||||
"testing"
|
||||
|
||||
@@ -105,7 +106,7 @@ func TestNewChannel(t *testing.T) {
|
||||
},
|
||||
},
|
||||
want: &channel{
|
||||
MaxResults: 1,
|
||||
MaxResults: math.MaxInt64,
|
||||
},
|
||||
},
|
||||
{
|
||||
|
||||
@@ -4,6 +4,7 @@ import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"io"
|
||||
"math"
|
||||
|
||||
"github.com/eat-pray-ai/yutu/pkg"
|
||||
"github.com/eat-pray-ai/yutu/pkg/auth"
|
||||
@@ -281,8 +282,10 @@ func WithChannelId(channelId string) Option {
|
||||
|
||||
func WithMaxResults(maxResults int64) Option {
|
||||
return func(c *comment) {
|
||||
if maxResults <= 0 {
|
||||
if maxResults < 0 {
|
||||
maxResults = 1
|
||||
} else if maxResults == 0 {
|
||||
maxResults = math.MaxInt64
|
||||
}
|
||||
c.MaxResults = maxResults
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package comment
|
||||
|
||||
import (
|
||||
"math"
|
||||
"reflect"
|
||||
"testing"
|
||||
|
||||
@@ -94,7 +95,7 @@ func TestNewComment(t *testing.T) {
|
||||
},
|
||||
},
|
||||
want: &comment{
|
||||
MaxResults: 1,
|
||||
MaxResults: math.MaxInt64,
|
||||
},
|
||||
},
|
||||
{
|
||||
|
||||
@@ -4,6 +4,7 @@ import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"io"
|
||||
"math"
|
||||
|
||||
"github.com/eat-pray-ai/yutu/pkg"
|
||||
"github.com/eat-pray-ai/yutu/pkg/auth"
|
||||
@@ -190,8 +191,10 @@ func WithIDs(ids []string) Option {
|
||||
|
||||
func WithMaxResults(maxResults int64) Option {
|
||||
return func(c *commentThread) {
|
||||
if maxResults <= 0 {
|
||||
if maxResults < 0 {
|
||||
maxResults = 1
|
||||
} else if maxResults == 0 {
|
||||
maxResults = math.MaxInt64
|
||||
}
|
||||
c.MaxResults = maxResults
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package commentThread
|
||||
|
||||
import (
|
||||
"math"
|
||||
"reflect"
|
||||
"testing"
|
||||
|
||||
@@ -64,7 +65,7 @@ func TestNewCommentThread(t *testing.T) {
|
||||
},
|
||||
},
|
||||
want: &commentThread{
|
||||
MaxResults: 1,
|
||||
MaxResults: math.MaxInt64,
|
||||
},
|
||||
},
|
||||
{
|
||||
|
||||
@@ -3,6 +3,7 @@ package member
|
||||
import (
|
||||
"errors"
|
||||
"io"
|
||||
"math"
|
||||
|
||||
"github.com/eat-pray-ai/yutu/pkg"
|
||||
"github.com/eat-pray-ai/yutu/pkg/auth"
|
||||
@@ -107,8 +108,10 @@ func WithHasAccessToLevel(level string) Option {
|
||||
|
||||
func WithMaxResults(maxResults int64) Option {
|
||||
return func(m *member) {
|
||||
if maxResults <= 0 {
|
||||
if maxResults < 0 {
|
||||
maxResults = 1
|
||||
} else if maxResults == 0 {
|
||||
maxResults = math.MaxInt64
|
||||
}
|
||||
m.MaxResults = maxResults
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package member
|
||||
|
||||
import (
|
||||
"math"
|
||||
"reflect"
|
||||
"testing"
|
||||
|
||||
@@ -50,7 +51,7 @@ func TestNewMember(t *testing.T) {
|
||||
},
|
||||
},
|
||||
want: &member{
|
||||
MaxResults: 1,
|
||||
MaxResults: math.MaxInt64,
|
||||
},
|
||||
},
|
||||
{
|
||||
|
||||
@@ -4,6 +4,7 @@ import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"io"
|
||||
"math"
|
||||
|
||||
"github.com/eat-pray-ai/yutu/pkg"
|
||||
"github.com/eat-pray-ai/yutu/pkg/auth"
|
||||
@@ -253,8 +254,10 @@ func WithHl(hl string) Option {
|
||||
|
||||
func WithMaxResults(maxResults int64) Option {
|
||||
return func(p *playlist) {
|
||||
if maxResults <= 0 {
|
||||
if maxResults < 0 {
|
||||
maxResults = 1
|
||||
} else if maxResults == 0 {
|
||||
maxResults = math.MaxInt64
|
||||
}
|
||||
p.MaxResults = maxResults
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package playlist
|
||||
|
||||
import (
|
||||
"math"
|
||||
"reflect"
|
||||
"testing"
|
||||
|
||||
@@ -89,7 +90,7 @@ func TestNewPlaylist(t *testing.T) {
|
||||
},
|
||||
},
|
||||
want: &playlist{
|
||||
MaxResults: 1,
|
||||
MaxResults: math.MaxInt64,
|
||||
},
|
||||
},
|
||||
{
|
||||
|
||||
@@ -4,6 +4,7 @@ import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"io"
|
||||
"math"
|
||||
|
||||
"github.com/eat-pray-ai/yutu/pkg"
|
||||
"github.com/eat-pray-ai/yutu/pkg/auth"
|
||||
@@ -267,8 +268,10 @@ func WithParent(parent string) Option {
|
||||
|
||||
func WithMaxResults(maxResults int64) Option {
|
||||
return func(pi *playlistImage) {
|
||||
if maxResults <= 0 {
|
||||
if maxResults < 0 {
|
||||
maxResults = 1
|
||||
} else if maxResults == 0 {
|
||||
maxResults = math.MaxInt64
|
||||
}
|
||||
pi.MaxResults = maxResults
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package playlistImage
|
||||
|
||||
import (
|
||||
"math"
|
||||
"reflect"
|
||||
"testing"
|
||||
|
||||
@@ -62,7 +63,7 @@ func TestNewPlaylistImage(t *testing.T) {
|
||||
},
|
||||
},
|
||||
want: &playlistImage{
|
||||
MaxResults: 1,
|
||||
MaxResults: math.MaxInt64,
|
||||
},
|
||||
},
|
||||
{
|
||||
|
||||
@@ -4,6 +4,7 @@ import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"io"
|
||||
"math"
|
||||
|
||||
"github.com/eat-pray-ai/yutu/pkg"
|
||||
"github.com/eat-pray-ai/yutu/pkg/auth"
|
||||
@@ -310,8 +311,10 @@ func WithPrivacy(privacy string) Option {
|
||||
|
||||
func WithMaxResults(maxResults int64) Option {
|
||||
return func(p *playlistItem) {
|
||||
if maxResults <= 0 {
|
||||
if maxResults < 0 {
|
||||
maxResults = 1
|
||||
} else if maxResults == 0 {
|
||||
maxResults = math.MaxInt64
|
||||
}
|
||||
p.MaxResults = maxResults
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package playlistItem
|
||||
|
||||
import (
|
||||
"math"
|
||||
"reflect"
|
||||
"testing"
|
||||
|
||||
@@ -68,7 +69,7 @@ func TestNewPlaylistItem(t *testing.T) {
|
||||
},
|
||||
},
|
||||
want: &playlistItem{
|
||||
MaxResults: 1,
|
||||
MaxResults: math.MaxInt64,
|
||||
},
|
||||
},
|
||||
{
|
||||
|
||||
@@ -3,6 +3,7 @@ package search
|
||||
import (
|
||||
"errors"
|
||||
"io"
|
||||
"math"
|
||||
|
||||
"github.com/eat-pray-ai/yutu/pkg"
|
||||
"github.com/eat-pray-ai/yutu/pkg/auth"
|
||||
@@ -283,8 +284,10 @@ func WithLocationRadius(locationRadius string) Option {
|
||||
|
||||
func WithMaxResults(maxResults int64) Option {
|
||||
return func(s *search) {
|
||||
if maxResults <= 0 {
|
||||
if maxResults < 0 {
|
||||
maxResults = 1
|
||||
} else if maxResults == 0 {
|
||||
maxResults = math.MaxInt64
|
||||
}
|
||||
s.MaxResults = maxResults
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package search
|
||||
|
||||
import (
|
||||
"math"
|
||||
"reflect"
|
||||
"testing"
|
||||
|
||||
@@ -133,7 +134,7 @@ func TestNewSearch(t *testing.T) {
|
||||
},
|
||||
},
|
||||
want: &search{
|
||||
MaxResults: 1,
|
||||
MaxResults: math.MaxInt64,
|
||||
},
|
||||
},
|
||||
{
|
||||
|
||||
@@ -4,6 +4,7 @@ import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"io"
|
||||
"math"
|
||||
|
||||
"github.com/eat-pray-ai/yutu/pkg"
|
||||
"github.com/eat-pray-ai/yutu/pkg/auth"
|
||||
@@ -211,8 +212,10 @@ func WithForChannelId(forChannelId string) Option {
|
||||
|
||||
func WithMaxResults(maxResults int64) Option {
|
||||
return func(s *subscription) {
|
||||
if maxResults <= 0 {
|
||||
if maxResults < 0 {
|
||||
maxResults = 1
|
||||
} else if maxResults == 0 {
|
||||
maxResults = math.MaxInt64
|
||||
}
|
||||
s.MaxResults = maxResults
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package subscription
|
||||
|
||||
import (
|
||||
"math"
|
||||
"reflect"
|
||||
"testing"
|
||||
|
||||
@@ -101,7 +102,7 @@ func TestNewSubscription(t *testing.T) {
|
||||
},
|
||||
},
|
||||
want: &subscription{
|
||||
MaxResults: 1,
|
||||
MaxResults: math.MaxInt64,
|
||||
},
|
||||
},
|
||||
{
|
||||
|
||||
@@ -3,6 +3,7 @@ package superChatEvent
|
||||
import (
|
||||
"errors"
|
||||
"io"
|
||||
"math"
|
||||
|
||||
"github.com/eat-pray-ai/yutu/pkg"
|
||||
"github.com/eat-pray-ai/yutu/pkg/auth"
|
||||
@@ -93,8 +94,10 @@ func WithHl(hl string) Option {
|
||||
|
||||
func WithMaxResults(maxResults int64) Option {
|
||||
return func(s *superChatEvent) {
|
||||
if maxResults <= 0 {
|
||||
if maxResults < 0 {
|
||||
maxResults = 1
|
||||
} else if maxResults == 0 {
|
||||
maxResults = math.MaxInt64
|
||||
}
|
||||
s.MaxResults = maxResults
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package superChatEvent
|
||||
|
||||
import (
|
||||
"math"
|
||||
"reflect"
|
||||
"testing"
|
||||
|
||||
@@ -46,7 +47,7 @@ func TestNewSuperChatEvent(t *testing.T) {
|
||||
},
|
||||
},
|
||||
want: &superChatEvent{
|
||||
MaxResults: 1,
|
||||
MaxResults: math.MaxInt64,
|
||||
},
|
||||
},
|
||||
{
|
||||
|
||||
@@ -12,6 +12,7 @@ const (
|
||||
SilentUsage = "json, yaml, or silent"
|
||||
JPUsage = "JSONPath expression to filter the output"
|
||||
JsonMIME = "application/json"
|
||||
PerPage = 20
|
||||
)
|
||||
|
||||
var (
|
||||
|
||||
+4
-1
@@ -4,6 +4,7 @@ import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"io"
|
||||
"math"
|
||||
"slices"
|
||||
|
||||
"github.com/eat-pray-ai/yutu/pkg"
|
||||
@@ -592,8 +593,10 @@ func WithMaxWidth(maxWidth int64) Option {
|
||||
|
||||
func WithMaxResults(maxResults int64) Option {
|
||||
return func(v *video) {
|
||||
if maxResults <= 0 {
|
||||
if maxResults < 0 {
|
||||
maxResults = 1
|
||||
} else if maxResults == 0 {
|
||||
maxResults = math.MaxInt64
|
||||
}
|
||||
v.MaxResults = maxResults
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package video
|
||||
|
||||
import (
|
||||
"math"
|
||||
"reflect"
|
||||
"testing"
|
||||
|
||||
@@ -154,7 +155,7 @@ func TestNewVideo(t *testing.T) {
|
||||
},
|
||||
},
|
||||
want: &video{
|
||||
MaxResults: 1,
|
||||
MaxResults: math.MaxInt64,
|
||||
},
|
||||
},
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user