henry-sarabia / igdb Goto Github PK
View Code? Open in Web Editor NEWGo client for the Internet Game Database API
Home Page: https://api.igdb.com/
License: MIT License
Go client for the Internet Game Database API
Home Page: https://api.igdb.com/
License: MIT License
The API has a rate limit of 4 per second. If exceeded, returns status 429 Too Many Requests
.
If an error of this nature is received by the client, it is, by definition, temporary.
The error returned to the user should implement the Temporary behavior.
See this article for more info.
IGDB announced that they are making some impactful changes to their API in v4
.
The changes are too extensive to be listed here, please see their documentation on migration:
https://api-docs.igdb.com/#upgrading-to-v4-from-v3
Various functions for checking for whitespace or blank arguments can be replaced with the whitespace package.
Executing the characterphotos example will not display the character names or the URLs to the character images.
I seem to have missed several endpoints when migrating to IGDBv3.
These are the unsupported endpoints:
With the API v3 update, Search got its own endpoint. This endpoint should be fully supported to search for Characters, Collections, Games, People, Platforms, and Themes.
IGDB has a set of private endpoints meant for pro tier users. Three of these endpoints are listed under the regular list of endpoints so they are already implemented, but there still remains a dozen unimplemented endpoints.
After the implementation of the apicalypse package, FuncOption can now be changed to simply Option.
Lines 188 to 202 in 1a22d94
Some helper functions do not belong in the scope of this package and should be factored out into their own related packages.
checkResults
function needs refactoring and tests.checkResponse
tests need to be updated to match current standards.With the update to API v3 and the introduction of Apicalypse, a new option for excluding fields for a request has been added. The package is still missing this functionality.
In the majority of test files, json.Unmarshal is called but the error is not checked. These errors should be checked.
unwrapOptions
currently has no units tests. They should be added to ensure the function behaves as it is supposed to.
IGDB has updated from version 2 to version 3 of their API. With this update comes several changes that need to be adopted in this package.
Migration from v2 to v3 will make breaking changes.
Every exported constant should have a comment explaining what it is.
Lines 32 to 34 in 1a22d94
errors.Cause(err) != test.wantErr
The following files need these changes:
The following import paths should be upgraded to github.com/Henry-Sarabia/igdb/v2
igdb/examples/characterphotos/main.go
Line 8 in 3ee0f6b
igdb/examples/companycount/main.go
Line 7 in 3ee0f6b
igdb/examples/topgames/main.go
Line 8 in 3ee0f6b
Igdb tests are being ignored using build tags. They should be unignored and fixed for API v3
There may be an additional required header to be sent in each request for pro and enterprise tier users. If this is the case, the auth token must be supported in the NewClient function or another function entirely.
The following fields from the Client struct are obsolete and should be removed:
Package whitespace
has been updated to v2.0.0 with breaking changes including a name change. Change all occurrences of this package with new naming scheme.
Several exported variables, constants, and groups of variables and constants are still missing documentation. In addition, most if not all of the private endpoint types are still missing documentation.
The following objects have had their fields altered by the API:
See this for full changes.
The respective structs should be updated accordingly.
API URL is changing to https://api.igdb.com/v4
.
The IGDB API now supports field expansion. Field expansion allows a user to denote subfields to retrieve in addition to the regular fields of a request. Because Go is a statically typed language, when additional subfields are sent back in the JSON object, the object will no longer match the defined struct and the JSON decoder will return an error.
Here are three options for dealing with this problem.
Would be nice to have support to the scroll api
Image tests are currently being ignored using build tags. If unignored, the tests will not compile. This should be fixed.
The current README has examples and information that no longer reflects the current state of the repository due to the API v3 migration. The README should be updated with appropriate examples and information.
IGDB has removed the tier system. Instead, everyone gets the formerly pro-tier permissions.
Tier information can be found in the following:
Hey! I'm new to using this project and looks like it will be perfect if I can get it running.
When getting the project from github (and when trying to build my own project) I'm getting the following error:
../../../../../github.com/Henry-Sarabia/igdb/testing.go:44: ts.Client undefined (type *httptest.Server has no field or method Client)
I pulled the latest about an hour ago.
Thanks!
With the update to IGDB API v4, the TestDummy endpoint seems to have been dropped.
Client support for the defunct TestDummy endpoint should also be dropped.
The following files need to be altered:
The following files should be deleted:
A number of endpoints will stop being supported by the API.
For a full list, see here
These endpoints should be removed.
The API will stop accepting the user-key
header for authentication.
Instead, the following headers will be expected:
Client-ID
: Twitch Developer Application Client IDAuthorization
: Twitch Developer Application Access Token// Screenshot represents a screenshot of a particular game.
// For more information visit: https://api-docs.igdb.com/#screenshot
type Screenshot struct {
Image
ID int json:"id"
Game int json:"game"
}
A new API Status endpoint was added and should be supported
Test coverage has dropped to 92% after the most recent pull request. It would be prudent to reevaluate the current suite of tests to raise the overall test coverage.
equalSlice is a function used to check if the contents of two slices are equal. It it primarily used in the unit tests of many functions. It is designed to work with slices of any type. As such, the function makes use of reflection and empty interfaces. This should be replaced by a more type-safe and faster alternative.
equalSlice is used in place of reflect.DeepEqual because the output of the functions being tested do not always produce slices in the same order. To replace equalSlice, these slices should instead simply be sorted before being tested for equality.
Adopting semantic versioning using git tags will allow users to differentiate versions of the package and, more importantly, identify when the package has made a breaking change.
After updating to API v3, all of the old examples are out of date. They should be updated and new ones should be added.
When attempting to assert that the errors.Cause(err)
of a returned error
from a service is Temporary
for the new ratelimiting requirements:
type temporary interface {
Temporary() bool
}
func IsTemporary(err error) bool {
te, ok := errors.Cause(err).(temporary)
fmt.Printf("IS TEMPORARY %#v %t\n", errors.Cause(err), ok)
return ok && te.Temporary()
}
This prints:
IS TEMPORARY igdb.ServerError{Status:429, Msg:"too many requests", Temp:true} false
errors.Cause()
returns a plain igdb.ServerError
, not *igdb.ServerError
, and a plain igdb.ServerError
does not implement temporary
. Only *igdb.ServerError
has the required Temporary
method:
Line 72 in dcac61d
Is there any reason we can't define this method on igdb.ServerError
as that will cover both plain struct and pointer?
The IGDB API will stop accepting GET requests with a body.
The current code is compliant with the Apicalypse schema which writes to the request body.
As such, these GET requests must change to use the POST method.
Endpoint tests are being ignored using build tags. They should be unignored and fixed for API v3
SizedImageURL has an integer parameter for the DPR ratio of the requested image. The issue is that there is only 2 possible ratios allowed for the image service. So, the DPR ratio can either be factored out into two distinct functions or be changed to a boolean parameter.
As of now, there are errors scattered around the repository instead of either being consolidated in one file or logically grouped together. Certain errors messages are also redundant and should be updated to match the rest.
Hello.
IDs where nil and my script worked fine. Now the ids are required. Why?
My script is getting game realeases between two dates where ids are not existing. Is there other way i could achieve that after update.
Beginning on v1.0.3, igdb will be its own module
The README states users need Go 1.9 but as of v1.0.3 (specifically issue #64) of this package, users will need Go 1.13
IGDB has updated their Game Category enums to include:
This update breaks current functionality.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.