Skip to content

Commit

Permalink
Merge pull request #101 from Henry-Sarabia/iss-100
Browse files Browse the repository at this point in the history
Iss 100
  • Loading branch information
Henry Sarabia authored Dec 15, 2020
2 parents e41b178 + da175e4 commit 8ae2243
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
6 changes: 3 additions & 3 deletions options.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ func SetOrder(field string, order order) Option {
// For more information, visit: https://api-docs.igdb.com/#pagination
func SetLimit(lim int) Option {
return func() (apicalypse.Option, error) {
if lim <= 0 || lim > 5000 {
if lim <= 0 || lim > 500 {
return nil, ErrOutOfRange
}

Expand All @@ -103,12 +103,12 @@ func SetLimit(lim int) Option {
}

// SetOffset is a functional option used to offset the results from an API
// call. The default offset is 0. The maximum offest is 5000.
// call. The default offset is 0.
//
// For more information, visit: https://api-docs.igdb.com/#pagination
func SetOffset(off int) Option {
return func() (apicalypse.Option, error) {
if off < 0 || off > 5000 {
if off < 0 {
return nil, ErrOutOfRange
}

Expand Down
7 changes: 4 additions & 3 deletions options_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@ package igdb

import (
"fmt"
"github.com/Henry-Sarabia/apicalypse"
"github.com/pkg/errors"
"log"
"strings"
"testing"

"github.com/Henry-Sarabia/apicalypse"
"github.com/pkg/errors"
)

func TestComposeOptions(t *testing.T) {
Expand Down Expand Up @@ -159,7 +160,7 @@ func TestSetLimit(t *testing.T) {
{"Limit within range", 5, "5", nil},
{"Zero limit", 0, "", ErrOutOfRange},
{"Limit below range", -10, "", ErrOutOfRange},
{"Limit above range", 5001, "", ErrOutOfRange},
{"Limit above range", 501, "", ErrOutOfRange},
}

for _, test := range tests {
Expand Down

0 comments on commit 8ae2243

Please sign in to comment.