Henry-Sarabia / igdb

Go client for the Internet Game Database API
https://api.igdb.com/
MIT License
81 stars 17 forks source link

Offset and Limit options have erroneous hard limits #100

Closed ksewo closed 3 years ago

ksewo commented 3 years ago

SetLimit and SetOffset returns error if number higher than 5000 is provided.

There is no limit for offset for IGDB v4 API. image

Limit also changed to 500 (not 5000 as in the code). image

According to: https://api-docs.igdb.com/#pagination

Henry-Sarabia commented 3 years ago

Oh my, that's no good -- nice catch! I'll have this fixed up in the next patch. Thanks for contributing!

ksewo commented 3 years ago

@Henry-Sarabia Thanks for looking into that.

For those who can't wait until next patch, here is temporary fix: Create your own versions of SetOffset and SetLimit. Example:

import (
    "github.com/Henry-Sarabia/apicalypse"
    "github.com/Henry-Sarabia/igdb/v2"
)

func SetOffset(offset int) igdb.Option {
    return func() (apicalypse.Option, error) {
        return apicalypse.Offset(offset), nil
    }
}