-
-
Notifications
You must be signed in to change notification settings - Fork 8
Home
Kamran Ayub edited this page Feb 19, 2021
·
7 revisions
You can see examples in the tests project but the API is simple to use:
var giantBomb = new GiantBombRestClient("your token");
var game = giantBomb.GetGame(id);
You can unit test by programming against the interface and injecting the dependency:
public class MyClass {
public MyClass() {
GiantBomb = new GiantBombRestClient(apiKey);
}
public MyClass(IGiantBombRestClient giantBomb) {
GiantBomb = giantBomb;
}
protected IGiantBombRestClient GiantBomb { get; private set; }
}
You can use any DI framework of your choice.
The new API v2 supports filtering on list resources. With GBC#, you can add filtering like this:
var filters = new Dictionary<string, object>() {
{"id", 556}
};
return gbClient.GetReleases(filter: filters);
The API also supports multiple values for certain fields, like ID, separated by |
(pipes):
var ids = new string[] { 667.ToString(), 332.ToString() };
var filters = new Dictionary<string, object>() {
{"id", String.Join("|", ids)}
};
return gbClient.GetReleases(filter: filters);