diff --git a/.gitignore b/.gitignore index 4c22f47..611d2e4 100644 --- a/.gitignore +++ b/.gitignore @@ -3,6 +3,7 @@ *.DS_Store #Visual Studio files +.vs/ *.[Oo]bj bin*/*.exe *.pdb diff --git a/GiantBomb.Api/readme.txt b/CHANGELOG.md similarity index 62% rename from GiantBomb.Api/readme.txt rename to CHANGELOG.md index 6f9ada7..370dec1 100644 --- a/GiantBomb.Api/readme.txt +++ b/CHANGELOG.md @@ -1,92 +1,73 @@ -GiantBomb C# ------------- - -[![Build status](https://ci.appveyor.com/api/projects/status/hh268dmpd08qfjqt?svg=true)](https://ci.appveyor.com/project/kamranayub/giantbomb-csharp) - -## 2.3.0 - -- **BUG:** Fixed deserialization exception for single resource errors (e.g. Object Not Found) -- **BUG:** Fixed synchronous API to not deadlock -- Removed fastJSON DLL since it wasn't *actually* being used -- Upgrade to RestSharp 105.2.3 -- Added .NET 4.6 and 4.6.1 support - -## 2.2.1 - -- Better error handling for API exceptions - -## 2.2.0 - -- Upgrade to .NET 4.5.2 (you should too!) -- Upgrade RestSharp to 105.1 -- `async/await` support for all methods -- Better fatal error handling - - If GiantBomb returns a non-JSON response, the library will throw a `GiantBombHttpException` - containing the raw response body -- **FIX:** Issue with searches returning duplicate games from GiantBomb - -## 2.1.0 - -- Add new fields: - - `Platform.Aliases` - - `Platform.InstallBase` - - `Platform.OnlineOnly` - - `Platform.OriginalPrice` - - `Game.Franchises` - - `Release.Game` -- Add exception handling and wrapping for GiantBomb API errors (`GiantBombApiException` class) - - For example, exceeding the 400 requests in 15 minutes rate limit -- Allow overriding `Execute` methods -- Update RestSharp to 105 (fixes #13) - -## 2.0.3 - -- Fixes issue with search paging (`offset` vs. `page` parameter) - -## API v2 Support - -GiantBomb-C# 2.0+ is only compatible with GiantBomb APIv2. Keep using the old packages if you need v1 support, as there are breaking changes in v2! - -### Notable Changes - -* Search is now MUCH better in GiantBomb's v2 API, there's little to no need for `SearchAllGames` now unless you expect/want more than 100 results -* List resources support new `sort` and `filter` options -* All single resource requests must use a resource ID, e.g. "game/3030-33394", which GBCS implements transparently for you -* `Game` and `Release` now have `ExpectedReleaseDay` -* Search results now include platforms -* `Game` has two new fields: - - `Aliases` - newline delimited aliases - - `OriginalGameRating` -* You can now use `GetReleasesForGame()` to directly retrieve releases for a game in one request -* Using [FastJSON](http://www.codeproject.com/Articles/159450/fastJSON) to deserialize, which is... fast, obviously - -## Readme - -This library aims to wrap the GiantBomb REST API in C# with strongly-typed models and is built on top of [RestSharp](https://github.com/johnsheehan/RestSharp). - -It also helps make your life easier when dealing with searching because it recursively fetches your search results all at once to enable better sorting. - -**Note: This is not really needed anymore due to search improvements in APIv2** - - var giantBomb = new GiantBombRestClient(); - - // Get all search results - var results = giantBomb.SearchForAllGames("assassin's creed"); - - // Display - return results.OrderByDescending(g => g.DateAdded) - - -## Nuget -Download and install the GiantBomb.Api Nuget package: - - PM> Install-Package GiantBomb.Api - -## Contributing -Read about [contributing on the wiki](https://github.com/kamranayub/GiantBomb-CSharp/wiki). If you plan to contribute, you **must** read this. - -## Examples -Read about [examples on the wiki](https://github.com/kamranayub/GiantBomb-CSharp/wiki). - -## License -Dual-licensed on MIT & GPL +# Changelog + +## 2.4.0 + +- Switch to [.NET Standard 1.2](https://docs.microsoft.com/en-us/dotnet/standard/library). Adds support for: + - .NET Core 1.0+ + - .NET 4.5.1+ + - Mono 4.6+ + - Xamarin.iOS 10.0+ + - Xamarin.Android 7.0+ + - UWP 10.0+ + - Windows 8.1 + - Windows Phone 8.1 +- Switch to [Fubar.RestSharp.Portable](https://github.com/FubarDevelopment/restsharp.portable) +- More descriptive error handling +- **Temporary:** Remove `Game.ProductCodeType` because API returns incorrect response + +## 2.3.0 + +- **BUG:** Fixed deserialization exception for single resource errors (e.g. Object Not Found) +- **BUG:** Fixed synchronous API to not deadlock +- Removed fastJSON DLL since it wasn't *actually* being used +- Upgrade to RestSharp 105.2.3 +- Added .NET 4.6 and 4.6.1 support + +## 2.2.1 + +- Better error handling for API exceptions + +## 2.2.0 + +- Upgrade to .NET 4.5.2 (you should too!) +- Upgrade RestSharp to 105.1 +- `async/await` support for all methods +- Better fatal error handling + - If GiantBomb returns a non-JSON response, the library will throw a `GiantBombHttpException` + containing the raw response body +- **FIX:** Issue with searches returning duplicate games from GiantBomb + +## 2.1.0 + +- Add new fields: + - `Platform.Aliases` + - `Platform.InstallBase` + - `Platform.OnlineOnly` + - `Platform.OriginalPrice` + - `Game.Franchises` + - `Release.Game` +- Add exception handling and wrapping for GiantBomb API errors (`GiantBombApiException` class) + - For example, exceeding the 400 requests in 15 minutes rate limit +- Allow overriding `Execute` methods +- Update RestSharp to 105 (fixes #13) + +## 2.0.3 + +- Fixes issue with search paging (`offset` vs. `page` parameter) + +## API v2 Support + +GiantBomb-C# 2.0+ is only compatible with GiantBomb APIv2. Keep using the old packages if you need v1 support, as there are breaking changes in v2! + +### Notable Changes + +* Search is now MUCH better in GiantBomb's v2 API, there's little to no need for `SearchAllGames` now unless you expect/want more than 100 results +* List resources support new `sort` and `filter` options +* All single resource requests must use a resource ID, e.g. "game/3030-33394", which GBCS implements transparently for you +* `Game` and `Release` now have `ExpectedReleaseDay` +* Search results now include platforms +* `Game` has two new fields: + - `Aliases` - newline delimited aliases + - `OriginalGameRating` +* You can now use `GetReleasesForGame()` to directly retrieve releases for a game in one request +* Using [FastJSON](http://www.codeproject.com/Articles/159450/fastJSON) to deserialize, which is... fast, obviously diff --git a/Dependencies/fastJSON.dll b/Dependencies/fastJSON.dll deleted file mode 100644 index b56e4a0..0000000 Binary files a/Dependencies/fastJSON.dll and /dev/null differ diff --git a/GiantBomb.Api.Net46/GiantBomb.Api.Net46.csproj b/GiantBomb.Api.Net46/GiantBomb.Api.Net46.csproj deleted file mode 100644 index 5acdbeb..0000000 --- a/GiantBomb.Api.Net46/GiantBomb.Api.Net46.csproj +++ /dev/null @@ -1,127 +0,0 @@ - - - - - Debug - AnyCPU - {0F3123EB-BEE8-4D22-8B82-FEE48332479B} - Library - Properties - GiantBomb.Api - GiantBomb.Api - v4.6 - 512 - - - - true - full - false - ..\bin\Debug\net46\ - DEBUG;TRACE - prompt - 4 - - - pdbonly - true - ..\bin\Release\net46\ - TRACE - prompt - 4 - - - - ..\packages\RestSharp.105.2.3\lib\net46\RestSharp.dll - True - - - - - - - - - - - - - Core.cs - - - GiantBombApiException.cs - - - GiantBombHttpException.cs - - - IGiantBombRestClient.cs - - - Model\Developer.cs - - - Model\Franchise.cs - - - Model\Game.cs - - - Model\Genre.cs - - - Model\GiantBombBase.cs - - - Model\Image.cs - - - Model\Platform.cs - - - Model\Publisher.cs - - - Model\Rating.cs - - - Model\Region.cs - - - Model\Release.cs - - - Resources\Games.cs - - - Resources\Platforms.cs - - - Resources\Regions.cs - - - Resources\Releases.cs - - - Resources\Search.cs - - - ResourceTypes.cs - - - SharedAssemblyInfo.cs - - - - - - - - - \ No newline at end of file diff --git a/GiantBomb.Api.Net46/Properties/AssemblyInfo.cs b/GiantBomb.Api.Net46/Properties/AssemblyInfo.cs deleted file mode 100644 index 190befe..0000000 --- a/GiantBomb.Api.Net46/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,3 +0,0 @@ -using System.Runtime.InteropServices; - -[assembly: Guid("0f3123eb-bee8-4d22-8b82-fee48332479b")] \ No newline at end of file diff --git a/GiantBomb.Api.Net46/packages.config b/GiantBomb.Api.Net46/packages.config deleted file mode 100644 index ba5e32a..0000000 --- a/GiantBomb.Api.Net46/packages.config +++ /dev/null @@ -1,4 +0,0 @@ - - - - \ No newline at end of file diff --git a/GiantBomb.Api.Net461/GiantBomb.Api.Net461.csproj b/GiantBomb.Api.Net461/GiantBomb.Api.Net461.csproj deleted file mode 100644 index 3802b5b..0000000 --- a/GiantBomb.Api.Net461/GiantBomb.Api.Net461.csproj +++ /dev/null @@ -1,127 +0,0 @@ - - - - - Debug - AnyCPU - {64569B67-6E98-490C-A773-E23831189AD7} - Library - Properties - GiantBomb.Api - GiantBomb.Api - v4.6.1 - 512 - - - - true - full - false - ..\bin\Debug\net461\ - DEBUG;TRACE - prompt - 4 - - - pdbonly - true - ..\bin\Release\net461\ - TRACE - prompt - 4 - - - - ..\packages\RestSharp.105.2.3\lib\net46\RestSharp.dll - True - - - - - - - - - - - - - Core.cs - - - GiantBombApiException.cs - - - GiantBombHttpException.cs - - - IGiantBombRestClient.cs - - - Model\Developer.cs - - - Model\Franchise.cs - - - Model\Game.cs - - - Model\Genre.cs - - - Model\GiantBombBase.cs - - - Model\Image.cs - - - Model\Platform.cs - - - Model\Publisher.cs - - - Model\Rating.cs - - - Model\Region.cs - - - Model\Release.cs - - - Resources\Games.cs - - - Resources\Platforms.cs - - - Resources\Regions.cs - - - Resources\Releases.cs - - - Resources\Search.cs - - - ResourceTypes.cs - - - SharedAssemblyInfo.cs - - - - - - - - - \ No newline at end of file diff --git a/GiantBomb.Api.Net461/Properties/AssemblyInfo.cs b/GiantBomb.Api.Net461/Properties/AssemblyInfo.cs deleted file mode 100644 index 54d31a7..0000000 --- a/GiantBomb.Api.Net461/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,3 +0,0 @@ -using System.Runtime.InteropServices; - -[assembly: Guid("64569b67-6e98-490c-a773-e23831189ad7")] \ No newline at end of file diff --git a/GiantBomb.Api.Net461/packages.config b/GiantBomb.Api.Net461/packages.config deleted file mode 100644 index 29f5629..0000000 --- a/GiantBomb.Api.Net461/packages.config +++ /dev/null @@ -1,4 +0,0 @@ - - - - \ No newline at end of file diff --git a/GiantBomb.Api.Tests/Core.cs b/GiantBomb.Api.Tests/Core.cs index efcb438..3ec0cb9 100644 --- a/GiantBomb.Api.Tests/Core.cs +++ b/GiantBomb.Api.Tests/Core.cs @@ -3,9 +3,8 @@ using System.Linq; using System.Text; using System.Threading.Tasks; -using GiantBomb.Api.Tests.Support; using NUnit.Framework; -using RestSharp; +using RestSharp.Portable; namespace GiantBomb.Api.Tests { diff --git a/GiantBomb.Api.Tests/GiantBomb.Api.Tests.csproj b/GiantBomb.Api.Tests/GiantBomb.Api.Tests.csproj index 76b9497..2a50901 100644 --- a/GiantBomb.Api.Tests/GiantBomb.Api.Tests.csproj +++ b/GiantBomb.Api.Tests/GiantBomb.Api.Tests.csproj @@ -36,16 +36,23 @@ false + + ..\packages\FubarCoder.RestSharp.Portable.Core.4.0.8\lib\net45\FubarCoder.RestSharp.Portable.Core.dll + + + ..\packages\FubarCoder.RestSharp.Portable.HttpClient.4.0.8\lib\net45\FubarCoder.RestSharp.Portable.HttpClient.dll + + + ..\packages\Newtonsoft.Json.9.0.1\lib\net45\Newtonsoft.Json.dll + ..\packages\NUnit.2.6.4\lib\nunit.framework.dll True - - ..\packages\RestSharp.105.2.3\lib\net452\RestSharp.dll - True - + + @@ -67,15 +74,15 @@ + + + - {9CB78FD8-C888-4A8C-B16F-AB762A5D5BAB} + {9980b512-d08b-4505-971c-6dfb5cb44e36} GiantBomb.Api - - - + \ No newline at end of file diff --git a/GiantBomb.Api/GiantBombDeserializer.cs b/GiantBomb.Api/GiantBombDeserializer.cs new file mode 100644 index 0000000..291643c --- /dev/null +++ b/GiantBomb.Api/GiantBombDeserializer.cs @@ -0,0 +1,21 @@ +using System; +using System.Collections.Generic; +using System.Text; +using Newtonsoft.Json; +using Newtonsoft.Json.Serialization; +using RestSharp.Portable.Deserializers; + +namespace GiantBomb.Api +{ + class GiantBombDeserializer : JsonDeserializer + { + protected override void ConfigureSerializer(JsonSerializer serializer) + { + serializer.DateFormatString = "yyyy-MM-dd HH:mm:ss"; + serializer.ContractResolver = new DefaultContractResolver() + { + NamingStrategy = new SnakeCaseNamingStrategy() + }; + } + } +} diff --git a/GiantBomb.Api/IGiantBombRestClient.cs b/GiantBomb.Api/IGiantBombRestClient.cs index ac796d2..98e1aea 100644 --- a/GiantBomb.Api/IGiantBombRestClient.cs +++ b/GiantBomb.Api/IGiantBombRestClient.cs @@ -1,291 +1,291 @@ -using System.Collections.Generic; -using System.Threading.Tasks; -using GiantBomb.Api.Model; -using RestSharp; - -namespace GiantBomb.Api -{ - public interface IGiantBombRestClient - { - /// - /// Base URL of API (defaults to http://api.giantbomb.com) - /// - string BaseUrl { get; set; } - - /// - /// Gets a single platform - /// - /// The platform's ID - /// List of field names to include in the response. Use this if you want to reduce the size of the response payload. - /// - Platform GetPlatform(int id, string[] limitFields = null); - - /// - /// Gets a single platform - /// - /// The platform's ID - /// List of field names to include in the response. Use this if you want to reduce the size of the response payload. - /// - Task GetPlatformAsync(int id, string[] limitFields = null); - - /// - /// Gets list of platforms - /// - /// - IEnumerable GetPlatforms(int page = 1, int pageSize = GiantBombBase.DefaultLimit, string[] limitFields = null); - - /// - /// Gets list of platforms - /// - /// - Task> GetPlatformsAsync(int page = 1, int pageSize = GiantBombBase.DefaultLimit, string[] limitFields = null); - - /// - /// Get a region - /// - /// - /// List of field names to include in the response. Use this if you want to reduce the size of the response payload. - /// - Region GetRegion(int id, string[] limitFields = null); - - /// - /// Get a region - /// - /// - /// List of field names to include in the response. Use this if you want to reduce the size of the response payload. - /// - Task GetRegionAsync(int id, string[] limitFields = null); - - /// - /// Gets list of regions - /// - /// The page to retrieve - /// The number of results per page (default: 100) - /// List of field names to include in the response. Use this if you want to reduce the size of the response payload. - /// - IEnumerable GetRegions(int page = 1, int pageSize = GiantBombBase.DefaultLimit, string[] limitFields = null); - - /// - /// Gets list of regions - /// - /// The page to retrieve - /// The number of results per page (default: 100) - /// List of field names to include in the response. Use this if you want to reduce the size of the response payload. - /// - Task> GetRegionsAsync(int page = 1, int pageSize = GiantBombBase.DefaultLimit, string[] limitFields = null); - - /// - /// Gets a game with the given ID - /// - /// The ID of the game - /// List of field names to include in the response. Use this if you want to reduce the size of the response payload. - /// - Game GetGame(int id, string[] limitFields = null); - - /// - /// Gets a game with the given ID - /// - /// The ID of the game - /// List of field names to include in the response. Use this if you want to reduce the size of the response payload. - /// - Task GetGameAsync(int id, string[] limitFields = null); - - /// - /// Gets list of games - /// - /// The page to retrieve - /// The number of results per page (default: 100) - /// List of field names to include in the response. Use this if you want to reduce the size of the response payload. - /// - IEnumerable GetGames(int page = 1, int pageSize = GiantBombBase.DefaultLimit, string[] limitFields = null); - - /// - /// Gets list of games - /// - /// The page to retrieve - /// The number of results per page (default: 100) - /// List of field names to include in the response. Use this if you want to reduce the size of the response payload. - /// - Task> GetGamesAsync(int page = 1, int pageSize = GiantBombBase.DefaultLimit, string[] limitFields = null); - - /// - /// Gets a release with the given ID - /// - /// The ID of the release - /// List of field names to include in the response. Use this if you want to reduce the size of the response payload. - /// - Release GetRelease(int id, string[] limitFields = null); - - /// - /// Gets a release with the given ID - /// - /// The ID of the release - /// List of field names to include in the response. Use this if you want to reduce the size of the response payload. - /// - Task GetReleaseAsync(int id, string[] limitFields = null); - - /// - /// Gets all releases for a game with the given ID (multiple requests) - /// - /// The ID of the game to get releases for - /// List of field names to include in the response. Use this if you want to reduce the size of the response payload. - /// - IEnumerable GetReleasesForGame(int gameId, string[] limitFields = null); - - /// - /// Gets all releases for a game with the given ID (multiple requests) - /// - /// The ID of the game to get releases for - /// List of field names to include in the response. Use this if you want to reduce the size of the response payload. - /// - Task> GetReleasesForGameAsync(int gameId, string[] limitFields = null); - - /// - /// Gets all releases for the given game (multiple requests) - /// - /// The game to get releases for - /// List of field names to include in the response. Use this if you want to reduce the size of the response payload. - /// - IEnumerable GetReleasesForGame(Game game, string[] limitFields = null); - - /// - /// Gets all releases for the given game (multiple requests) - /// - /// The game to get releases for - /// List of field names to include in the response. Use this if you want to reduce the size of the response payload. - /// - Task> GetReleasesForGameAsync(Game game, string[] limitFields = null); - - /// - /// Searches for a game by keyword and gets paged results - /// - /// The search string - /// The page to retrieve - /// The number of results per page (default: 100) - /// List of field names to include in the response. Use this if you want to reduce the size of the response payload. - /// - IEnumerable SearchForGames(string query, int page = 1, int pageSize = GiantBombBase.DefaultLimit, string[] limitFields = null); - - /// - /// Searches for a game by keyword and gets paged results - /// - /// The search string - /// The page to retrieve - /// The number of results per page (default: 100) - /// List of field names to include in the response. Use this if you want to reduce the size of the response payload. - /// - Task> SearchForGamesAsync(string query, int page = 1, int pageSize = GiantBombBase.DefaultLimit, string[] limitFields = null); - - /// - /// Searches for a game by keyword and recursively gets all results to enable sorting, filtering, etc. - /// - /// - /// List of field names to include in the response. Use this if you want to reduce the size of the response payload. - /// - IEnumerable SearchForAllGames(string query, string[] limitFields = null); - - /// - /// Searches for a game by keyword and recursively gets all results to enable sorting, filtering, etc. - /// - /// - /// List of field names to include in the response. Use this if you want to reduce the size of the response payload. - /// - Task> SearchForAllGamesAsync(string query, string[] limitFields = null); - - /// - /// Gets a list resource request - /// - /// The resource name (e.g. "games") - /// The page to fetch (default: 1) - /// The number of results per page (default: 100) - /// List of field names to include in the response. Use this if you want to reduce the size of the response payload. - /// Results will be sorted by field names in the order you specify - /// Results will be filtered by the field name and value you specify - /// - RestRequest GetListResource(string resource, int page = 1, int pageSize = GiantBombBase.DefaultLimit, string[] fieldList = null, IDictionary sortOptions = null, IDictionary filterOptions = null); - - /// - /// Gets a typed list from a GiantBomb list resource request - /// - /// The type of result you expect the request to result in - /// The resource name (e.g. "games") - /// The page to fetch (default: 1) - /// The number of results per page (default: 100) - /// List of field names to include in the response. Use this if you want to reduce the size of the response payload. - /// Results will be sorted by field names in the order you specify - /// Results will be filtered by the field name and value you specify - /// A typed list of TResult - IEnumerable GetListResource(string resource, int page = 1, int pageSize = GiantBombBase.DefaultLimit, string[] fieldList = null, IDictionary sortOptions = null, IDictionary filterOptions = null) where TResult : new(); - - /// - /// Gets a typed list from a GiantBomb list resource request - /// - /// The type of result you expect the request to result in - /// The resource name (e.g. "games") - /// The page to fetch (default: 1) - /// The number of results per page (default: 100) - /// List of field names to include in the response. Use this if you want to reduce the size of the response payload. - /// Results will be sorted by field names in the order you specify - /// Results will be filtered by the field name and value you specify - /// A typed list of TResult - Task> GetListResourceAsync(string resource, int page = 1, int pageSize = GiantBombBase.DefaultLimit, string[] fieldList = null, IDictionary sortOptions = null, IDictionary filterOptions = null) where TResult : new(); - - /// - /// Gets a single resource request - /// - /// The resource name (e.g. "game") - /// The resource type ID (e.g. 3030) - /// The ID of the resource - /// List of field names to include in the response. Use this if you want to reduce the size of the response payload. - /// A REST request object - RestRequest GetSingleResource(string resource, int resourceId, int id, string[] fieldList = null); - - /// - /// Returns a single object from a resource - /// - /// The model of what you expect - /// The resource name (e.g. "game") - /// The resource type ID (e.g. 3030) - /// The ID of the resource - /// List of field names to include in the response. Use this if you want to reduce the size of the response payload. - /// A REST request object - TResult GetSingleResource(string resource, int resourceId, int id, string[] fieldList = null) where TResult : class, new(); - - /// - /// Returns a single object from a resource - /// - /// The model of what you expect - /// The resource name (e.g. "game") - /// The resource type ID (e.g. 3030) - /// The ID of the resource - /// List of field names to include in the response. Use this if you want to reduce the size of the response payload. - /// A REST request object - Task GetSingleResourceAsync(string resource, int resourceId, int id, string[] fieldList = null) where TResult : class, new(); - - /// - /// Execute a manual REST request - /// - /// The type of object to create and populate with the returned data. - /// The RestRequest to execute (will use client credentials) - T Execute(RestRequest request) where T : new(); - - /// - /// Execute a manual REST request - /// - /// The type of object to create and populate with the returned data. - /// The RestRequest to execute (will use client credentials) - Task ExecuteAsync(RestRequest request) where T : new(); - - /// - /// Execute a manual REST request - /// - /// The RestRequest to execute (will use client credentials) - IRestResponse Execute(RestRequest request); - - /// - /// Execute a manual REST request - /// - /// The RestRequest to execute (will use client credentials) - Task ExecuteAsync(RestRequest request); - } +using System.Collections.Generic; +using System.Threading.Tasks; +using GiantBomb.Api.Model; +using RestSharp.Portable; + +namespace GiantBomb.Api +{ + public interface IGiantBombRestClient + { + /// + /// Base URL of API (defaults to http://api.giantbomb.com) + /// + string BaseUrl { get; set; } + + /// + /// Gets a single platform + /// + /// The platform's ID + /// List of field names to include in the response. Use this if you want to reduce the size of the response payload. + /// + Platform GetPlatform(int id, string[] limitFields = null); + + /// + /// Gets a single platform + /// + /// The platform's ID + /// List of field names to include in the response. Use this if you want to reduce the size of the response payload. + /// + Task GetPlatformAsync(int id, string[] limitFields = null); + + /// + /// Gets list of platforms + /// + /// + IEnumerable GetPlatforms(int page = 1, int pageSize = GiantBombBase.DefaultLimit, string[] limitFields = null); + + /// + /// Gets list of platforms + /// + /// + Task> GetPlatformsAsync(int page = 1, int pageSize = GiantBombBase.DefaultLimit, string[] limitFields = null); + + /// + /// Get a region + /// + /// + /// List of field names to include in the response. Use this if you want to reduce the size of the response payload. + /// + Region GetRegion(int id, string[] limitFields = null); + + /// + /// Get a region + /// + /// + /// List of field names to include in the response. Use this if you want to reduce the size of the response payload. + /// + Task GetRegionAsync(int id, string[] limitFields = null); + + /// + /// Gets list of regions + /// + /// The page to retrieve + /// The number of results per page (default: 100) + /// List of field names to include in the response. Use this if you want to reduce the size of the response payload. + /// + IEnumerable GetRegions(int page = 1, int pageSize = GiantBombBase.DefaultLimit, string[] limitFields = null); + + /// + /// Gets list of regions + /// + /// The page to retrieve + /// The number of results per page (default: 100) + /// List of field names to include in the response. Use this if you want to reduce the size of the response payload. + /// + Task> GetRegionsAsync(int page = 1, int pageSize = GiantBombBase.DefaultLimit, string[] limitFields = null); + + /// + /// Gets a game with the given ID + /// + /// The ID of the game + /// List of field names to include in the response. Use this if you want to reduce the size of the response payload. + /// + Game GetGame(int id, string[] limitFields = null); + + /// + /// Gets a game with the given ID + /// + /// The ID of the game + /// List of field names to include in the response. Use this if you want to reduce the size of the response payload. + /// + Task GetGameAsync(int id, string[] limitFields = null); + + /// + /// Gets list of games + /// + /// The page to retrieve + /// The number of results per page (default: 100) + /// List of field names to include in the response. Use this if you want to reduce the size of the response payload. + /// + IEnumerable GetGames(int page = 1, int pageSize = GiantBombBase.DefaultLimit, string[] limitFields = null); + + /// + /// Gets list of games + /// + /// The page to retrieve + /// The number of results per page (default: 100) + /// List of field names to include in the response. Use this if you want to reduce the size of the response payload. + /// + Task> GetGamesAsync(int page = 1, int pageSize = GiantBombBase.DefaultLimit, string[] limitFields = null); + + /// + /// Gets a release with the given ID + /// + /// The ID of the release + /// List of field names to include in the response. Use this if you want to reduce the size of the response payload. + /// + Release GetRelease(int id, string[] limitFields = null); + + /// + /// Gets a release with the given ID + /// + /// The ID of the release + /// List of field names to include in the response. Use this if you want to reduce the size of the response payload. + /// + Task GetReleaseAsync(int id, string[] limitFields = null); + + /// + /// Gets all releases for a game with the given ID (multiple requests) + /// + /// The ID of the game to get releases for + /// List of field names to include in the response. Use this if you want to reduce the size of the response payload. + /// + IEnumerable GetReleasesForGame(int gameId, string[] limitFields = null); + + /// + /// Gets all releases for a game with the given ID (multiple requests) + /// + /// The ID of the game to get releases for + /// List of field names to include in the response. Use this if you want to reduce the size of the response payload. + /// + Task> GetReleasesForGameAsync(int gameId, string[] limitFields = null); + + /// + /// Gets all releases for the given game (multiple requests) + /// + /// The game to get releases for + /// List of field names to include in the response. Use this if you want to reduce the size of the response payload. + /// + IEnumerable GetReleasesForGame(Game game, string[] limitFields = null); + + /// + /// Gets all releases for the given game (multiple requests) + /// + /// The game to get releases for + /// List of field names to include in the response. Use this if you want to reduce the size of the response payload. + /// + Task> GetReleasesForGameAsync(Game game, string[] limitFields = null); + + /// + /// Searches for a game by keyword and gets paged results + /// + /// The search string + /// The page to retrieve + /// The number of results per page (default: 100) + /// List of field names to include in the response. Use this if you want to reduce the size of the response payload. + /// + IEnumerable SearchForGames(string query, int page = 1, int pageSize = GiantBombBase.DefaultLimit, string[] limitFields = null); + + /// + /// Searches for a game by keyword and gets paged results + /// + /// The search string + /// The page to retrieve + /// The number of results per page (default: 100) + /// List of field names to include in the response. Use this if you want to reduce the size of the response payload. + /// + Task> SearchForGamesAsync(string query, int page = 1, int pageSize = GiantBombBase.DefaultLimit, string[] limitFields = null); + + /// + /// Searches for a game by keyword and recursively gets all results to enable sorting, filtering, etc. + /// + /// + /// List of field names to include in the response. Use this if you want to reduce the size of the response payload. + /// + IEnumerable SearchForAllGames(string query, string[] limitFields = null); + + /// + /// Searches for a game by keyword and recursively gets all results to enable sorting, filtering, etc. + /// + /// + /// List of field names to include in the response. Use this if you want to reduce the size of the response payload. + /// + Task> SearchForAllGamesAsync(string query, string[] limitFields = null); + + /// + /// Gets a list resource request + /// + /// The resource name (e.g. "games") + /// The page to fetch (default: 1) + /// The number of results per page (default: 100) + /// List of field names to include in the response. Use this if you want to reduce the size of the response payload. + /// Results will be sorted by field names in the order you specify + /// Results will be filtered by the field name and value you specify + /// + RestRequest GetListResource(string resource, int page = 1, int pageSize = GiantBombBase.DefaultLimit, string[] fieldList = null, IDictionary sortOptions = null, IDictionary filterOptions = null); + + /// + /// Gets a typed list from a GiantBomb list resource request + /// + /// The type of result you expect the request to result in + /// The resource name (e.g. "games") + /// The page to fetch (default: 1) + /// The number of results per page (default: 100) + /// List of field names to include in the response. Use this if you want to reduce the size of the response payload. + /// Results will be sorted by field names in the order you specify + /// Results will be filtered by the field name and value you specify + /// A typed list of TResult + IEnumerable GetListResource(string resource, int page = 1, int pageSize = GiantBombBase.DefaultLimit, string[] fieldList = null, IDictionary sortOptions = null, IDictionary filterOptions = null) where TResult : new(); + + /// + /// Gets a typed list from a GiantBomb list resource request + /// + /// The type of result you expect the request to result in + /// The resource name (e.g. "games") + /// The page to fetch (default: 1) + /// The number of results per page (default: 100) + /// List of field names to include in the response. Use this if you want to reduce the size of the response payload. + /// Results will be sorted by field names in the order you specify + /// Results will be filtered by the field name and value you specify + /// A typed list of TResult + Task> GetListResourceAsync(string resource, int page = 1, int pageSize = GiantBombBase.DefaultLimit, string[] fieldList = null, IDictionary sortOptions = null, IDictionary filterOptions = null) where TResult : new(); + + /// + /// Gets a single resource request + /// + /// The resource name (e.g. "game") + /// The resource type ID (e.g. 3030) + /// The ID of the resource + /// List of field names to include in the response. Use this if you want to reduce the size of the response payload. + /// A REST request object + RestRequest GetSingleResource(string resource, int resourceId, int id, string[] fieldList = null); + + /// + /// Returns a single object from a resource + /// + /// The model of what you expect + /// The resource name (e.g. "game") + /// The resource type ID (e.g. 3030) + /// The ID of the resource + /// List of field names to include in the response. Use this if you want to reduce the size of the response payload. + /// A REST request object + TResult GetSingleResource(string resource, int resourceId, int id, string[] fieldList = null) where TResult : class, new(); + + /// + /// Returns a single object from a resource + /// + /// The model of what you expect + /// The resource name (e.g. "game") + /// The resource type ID (e.g. 3030) + /// The ID of the resource + /// List of field names to include in the response. Use this if you want to reduce the size of the response payload. + /// A REST request object + Task GetSingleResourceAsync(string resource, int resourceId, int id, string[] fieldList = null) where TResult : class, new(); + + /// + /// Execute a manual REST request + /// + /// The type of object to create and populate with the returned data. + /// The RestRequest to execute (will use client credentials) + T Execute(RestRequest request) where T : new(); + + /// + /// Execute a manual REST request + /// + /// The type of object to create and populate with the returned data. + /// The RestRequest to execute (will use client credentials) + Task ExecuteAsync(RestRequest request) where T : new(); + + /// + /// Execute a manual REST request + /// + /// The RestRequest to execute (will use client credentials) + IRestResponse Execute(RestRequest request); + + /// + /// Execute a manual REST request + /// + /// The RestRequest to execute (will use client credentials) + Task ExecuteAsync(RestRequest request); + } } \ No newline at end of file diff --git a/GiantBomb.Api/Model/Developer.cs b/GiantBomb.Api/Model/Developer.cs index 7a2fc34..545f4c2 100644 --- a/GiantBomb.Api/Model/Developer.cs +++ b/GiantBomb.Api/Model/Developer.cs @@ -1,8 +1,8 @@ -namespace GiantBomb.Api.Model { - public class Developer { - public int Id { get; set; } - public string ApiDetailUrl { get; set; } - public string SiteDetailUrl { get; set; } - public string Name { get; set; } - } +namespace GiantBomb.Api.Model { + public class Developer { + public int Id { get; set; } + public string ApiDetailUrl { get; set; } + public string SiteDetailUrl { get; set; } + public string Name { get; set; } + } } \ No newline at end of file diff --git a/GiantBomb.Api/Model/Game.cs b/GiantBomb.Api/Model/Game.cs index 16e10c0..183ad8c 100644 --- a/GiantBomb.Api/Model/Game.cs +++ b/GiantBomb.Api/Model/Game.cs @@ -26,7 +26,7 @@ public class Game { public Image Image { get; set; } public List Images { get; set; } public int NumberOfUserReviews { get; set; } - public string OriginalGameRating { get; set; } + public List OriginalGameRating { get; set; } public DateTime? OriginalReleaseDate { get; set; } public List Platforms { get; set; } public List Publishers { get; set; } @@ -35,6 +35,15 @@ public class Game { public List SimilarGames { get; set; } } + public class GameRating + { + public string ApiDetailUrl { get; set; } + + public int Id { get; set; } + + public string Name { get; set; } + } + public class GameDistinctComparer : IEqualityComparer { public bool Equals(Game x, Game y) diff --git a/GiantBomb.Api/Model/Genre.cs b/GiantBomb.Api/Model/Genre.cs index 275c989..bd7d326 100644 --- a/GiantBomb.Api/Model/Genre.cs +++ b/GiantBomb.Api/Model/Genre.cs @@ -1,10 +1,10 @@ -namespace GiantBomb.Api.Model -{ - public class Genre - { - public int Id { get; set; } - public string ApiDetailUrl { get; set; } - public string SiteDetailUrl { get; set; } - public string Name { get; set; } - } +namespace GiantBomb.Api.Model +{ + public class Genre + { + public int Id { get; set; } + public string ApiDetailUrl { get; set; } + public string SiteDetailUrl { get; set; } + public string Name { get; set; } + } } \ No newline at end of file diff --git a/GiantBomb.Api/Model/GiantBombBase.cs b/GiantBomb.Api/Model/GiantBombBase.cs index c56c52b..6980c41 100644 --- a/GiantBomb.Api/Model/GiantBombBase.cs +++ b/GiantBomb.Api/Model/GiantBombBase.cs @@ -1,32 +1,33 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; - -namespace GiantBomb.Api.Model { - public class GiantBombBase { - public string Error { get; set; } - public int Limit { get; set; } - public int NumberOfPageResults { get; set; } - public int NumberOfTotalResults { get; set; } - public int StatusCode { get; set; } - public string Version { get; set; } - - public const int StatusOk = 1; - public const int StatusApiKeyInvalid = 100; - public const int StatusObjectNotFound = 101; - public const int StatusErrorUrlFormat = 102; - public const int StatusFilterError = 104; - public const int StatusRateLimitExceeded = 107; - public const int DefaultLimit = 100; - } - - public class GiantBombResult : GiantBombBase - { - public TResult Results { get; set; } - } - - public class GiantBombResults : GiantBombBase { - public List Results { get; set; } - } -} +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace GiantBomb.Api.Model { + public class GiantBombBase { + public string Error { get; set; } + public int Limit { get; set; } + public int NumberOfPageResults { get; set; } + public int NumberOfTotalResults { get; set; } + public int StatusCode { get; set; } + public string Version { get; set; } + + public const string ErrorOK = "OK"; + public const int StatusOk = 1; + public const int StatusApiKeyInvalid = 100; + public const int StatusObjectNotFound = 101; + public const int StatusErrorUrlFormat = 102; + public const int StatusFilterError = 104; + public const int StatusRateLimitExceeded = 107; + public const int DefaultLimit = 100; + } + + public class GiantBombResult : GiantBombBase + { + public TResult Results { get; set; } + } + + public class GiantBombResults : GiantBombBase { + public List Results { get; set; } + } +} diff --git a/GiantBomb.Api/Model/Publisher.cs b/GiantBomb.Api/Model/Publisher.cs index 96c635a..7dba313 100644 --- a/GiantBomb.Api/Model/Publisher.cs +++ b/GiantBomb.Api/Model/Publisher.cs @@ -1,8 +1,8 @@ -namespace GiantBomb.Api.Model { - public class Publisher { - public int Id { get; set; } - public string ApiDetailUrl { get; set; } - public string SiteDetailUrl { get; set; } - public string Name { get; set; } - } -} +namespace GiantBomb.Api.Model { + public class Publisher { + public int Id { get; set; } + public string ApiDetailUrl { get; set; } + public string SiteDetailUrl { get; set; } + public string Name { get; set; } + } +} diff --git a/GiantBomb.Api/Model/Rating.cs b/GiantBomb.Api/Model/Rating.cs index 498f487..ff4d660 100644 --- a/GiantBomb.Api/Model/Rating.cs +++ b/GiantBomb.Api/Model/Rating.cs @@ -1,7 +1,7 @@ -namespace GiantBomb.Api.Model { - public class Rating { - public int Id { get; set; } - public string ApiDetailUrl { get; set; } - public string Name { get; set; } - } +namespace GiantBomb.Api.Model { + public class Rating { + public int Id { get; set; } + public string ApiDetailUrl { get; set; } + public string Name { get; set; } + } } \ No newline at end of file diff --git a/GiantBomb.Api/Model/Region.cs b/GiantBomb.Api/Model/Region.cs index 2780d83..56c0594 100644 --- a/GiantBomb.Api/Model/Region.cs +++ b/GiantBomb.Api/Model/Region.cs @@ -1,11 +1,11 @@ -using System; - -namespace GiantBomb.Api.Model { - public class Region { - public int Id { get; set; } - public string ApiDetailUrl { get; set; } - public string Name { get; set; } - public DateTime DateAdded { get; set; } - public DateTime DateLastUpdated { get; set; } - } +using System; + +namespace GiantBomb.Api.Model { + public class Region { + public int Id { get; set; } + public string ApiDetailUrl { get; set; } + public string Name { get; set; } + public DateTime DateAdded { get; set; } + public DateTime DateLastUpdated { get; set; } + } } \ No newline at end of file diff --git a/GiantBomb.Api/Model/Release.cs b/GiantBomb.Api/Model/Release.cs index c3277aa..7459474 100644 --- a/GiantBomb.Api/Model/Release.cs +++ b/GiantBomb.Api/Model/Release.cs @@ -24,7 +24,8 @@ public class Release { public Image Image { get; set; } public Platform Platform { get; set; } public string ProductCodeValue { get; set; } - public string ProductCodeType { get; set; } + // TODO: Enable once value is fixed in API + //public string ProductCodeType { get; set; } public string SiteDetailUrl { get; set; } public Region Region { get; set; } diff --git a/GiantBomb.Api/Properties/AssemblyInfo.cs b/GiantBomb.Api/Properties/AssemblyInfo.cs deleted file mode 100644 index 310170f..0000000 --- a/GiantBomb.Api/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,4 +0,0 @@ -using System.Reflection; -using System.Runtime.InteropServices; - -[assembly: Guid("5d910805-e5ae-48f0-8e39-d37104d7a91e")] \ No newline at end of file diff --git a/GiantBomb.Api/ResourceTypes.cs b/GiantBomb.Api/ResourceTypes.cs index fcbd7e4..73fbc8f 100644 --- a/GiantBomb.Api/ResourceTypes.cs +++ b/GiantBomb.Api/ResourceTypes.cs @@ -1,9 +1,9 @@ -namespace GiantBomb.Api { - public class ResourceTypes - { - public const int Games = 3030; - public const int Platforms = 3045; - public const int Releases = 3050; - public const int Regions = 3075; - } -} +namespace GiantBomb.Api { + public class ResourceTypes + { + public const int Games = 3030; + public const int Platforms = 3045; + public const int Releases = 3050; + public const int Regions = 3075; + } +} diff --git a/GiantBomb.Api/Resources/Platforms.cs b/GiantBomb.Api/Resources/Platforms.cs index 7c47ebb..907526a 100644 --- a/GiantBomb.Api/Resources/Platforms.cs +++ b/GiantBomb.Api/Resources/Platforms.cs @@ -1,30 +1,30 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using GiantBomb.Api.Model; -using RestSharp; - -namespace GiantBomb.Api { - public partial class GiantBombRestClient { - public Platform GetPlatform(int id, string[] limitFields = null) - { - return GetPlatformAsync(id, limitFields).Result; - } - - public async Task GetPlatformAsync(int id, string[] limitFields = null) { - return await GetSingleResourceAsync("platform", ResourceTypes.Platforms, id, limitFields).ConfigureAwait(false); - } - - public IEnumerable GetPlatforms(int page = 1, int pageSize = GiantBombBase.DefaultLimit, - string[] limitFields = null) - { - return GetPlatformsAsync(page, pageSize, limitFields).Result; - } - - public async Task> GetPlatformsAsync(int page = 1, int pageSize = GiantBombBase.DefaultLimit, string[] limitFields = null) { - return await GetListResourceAsync("platforms", page, pageSize, limitFields).ConfigureAwait(false); - } - } -} +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using GiantBomb.Api.Model; +using RestSharp; + +namespace GiantBomb.Api { + public partial class GiantBombRestClient { + public Platform GetPlatform(int id, string[] limitFields = null) + { + return GetPlatformAsync(id, limitFields).Result; + } + + public async Task GetPlatformAsync(int id, string[] limitFields = null) { + return await GetSingleResourceAsync("platform", ResourceTypes.Platforms, id, limitFields).ConfigureAwait(false); + } + + public IEnumerable GetPlatforms(int page = 1, int pageSize = GiantBombBase.DefaultLimit, + string[] limitFields = null) + { + return GetPlatformsAsync(page, pageSize, limitFields).Result; + } + + public async Task> GetPlatformsAsync(int page = 1, int pageSize = GiantBombBase.DefaultLimit, string[] limitFields = null) { + return await GetListResourceAsync("platforms", page, pageSize, limitFields).ConfigureAwait(false); + } + } +} diff --git a/GiantBomb.Api/Resources/Regions.cs b/GiantBomb.Api/Resources/Regions.cs index 5f062db..ac0969d 100644 --- a/GiantBomb.Api/Resources/Regions.cs +++ b/GiantBomb.Api/Resources/Regions.cs @@ -1,32 +1,32 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using GiantBomb.Api.Model; - -namespace GiantBomb.Api -{ - public partial class GiantBombRestClient - { - public Region GetRegion(int id, string[] limitFields = null) - { - return GetRegionAsync(id, limitFields).Result; - } - - public async Task GetRegionAsync(int id, string[] limitFields = null) - { - return await GetSingleResourceAsync("region", ResourceTypes.Regions, id, limitFields).ConfigureAwait(false); - } - - public IEnumerable GetRegions(int page = 1, int pageSize = GiantBombBase.DefaultLimit, string[] limitFields = null) - { - return GetRegionsAsync(page, pageSize, limitFields).Result; - } - - public async Task> GetRegionsAsync(int page = 1, int pageSize = GiantBombBase.DefaultLimit, string[] limitFields = null) - { - return await GetListResourceAsync("regions", page, pageSize, limitFields).ConfigureAwait(false); - } - } -} +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using GiantBomb.Api.Model; + +namespace GiantBomb.Api +{ + public partial class GiantBombRestClient + { + public Region GetRegion(int id, string[] limitFields = null) + { + return GetRegionAsync(id, limitFields).Result; + } + + public async Task GetRegionAsync(int id, string[] limitFields = null) + { + return await GetSingleResourceAsync("region", ResourceTypes.Regions, id, limitFields).ConfigureAwait(false); + } + + public IEnumerable GetRegions(int page = 1, int pageSize = GiantBombBase.DefaultLimit, string[] limitFields = null) + { + return GetRegionsAsync(page, pageSize, limitFields).Result; + } + + public async Task> GetRegionsAsync(int page = 1, int pageSize = GiantBombBase.DefaultLimit, string[] limitFields = null) + { + return await GetListResourceAsync("regions", page, pageSize, limitFields).ConfigureAwait(false); + } + } +} diff --git a/GiantBomb.Api/Resources/Search.cs b/GiantBomb.Api/Resources/Search.cs index 59348fa..91ec24a 100644 --- a/GiantBomb.Api/Resources/Search.cs +++ b/GiantBomb.Api/Resources/Search.cs @@ -5,6 +5,7 @@ using System.Threading.Tasks; using GiantBomb.Api.Model; using RestSharp; +using RestSharp.Portable; namespace GiantBomb.Api { public partial class GiantBombRestClient { diff --git a/GiantBomb.Api/packages.config b/GiantBomb.Api/packages.config deleted file mode 100644 index 43a581e..0000000 --- a/GiantBomb.Api/packages.config +++ /dev/null @@ -1,4 +0,0 @@ - - - - \ No newline at end of file diff --git a/GiantBomb.sln b/GiantBomb.sln index 0afcdae..69502a4 100644 --- a/GiantBomb.sln +++ b/GiantBomb.sln @@ -1,17 +1,16 @@  Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 14 -VisualStudioVersion = 14.0.24720.0 +# Visual Studio 15 +VisualStudioVersion = 15.0.26430.6 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GiantBomb.Api", "GiantBomb.Api\GiantBomb.Api.csproj", "{9CB78FD8-C888-4A8C-B16F-AB762A5D5BAB}" -EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GiantBomb.Api.Tests", "GiantBomb.Api.Tests\GiantBomb.Api.Tests.csproj", "{1B4925AE-F785-4F8D-AFBE-8FAEF0980946}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{4851769F-6AF7-484A-88BE-52F7478878B9}" ProjectSection(SolutionItems) = preProject + .gitignore = .gitignore + CHANGELOG.md = CHANGELOG.md LICENSE.txt = LICENSE.txt Readme.md = Readme.md - SharedAssemblyInfo.cs = SharedAssemblyInfo.cs EndProjectSection EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".nuget", ".nuget", "{9DBE19DE-C523-4B80-88A9-390F46769835}" @@ -20,11 +19,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".nuget", ".nuget", "{9DBE19 .nuget\NuGet.targets = .nuget\NuGet.targets EndProjectSection EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Dependencies", "Dependencies", "{90F6B7F2-5AAE-4D20-A383-F7DEDDC1CD10}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GiantBomb.Api.Net46", "GiantBomb.Api.Net46\GiantBomb.Api.Net46.csproj", "{0F3123EB-BEE8-4D22-8B82-FEE48332479B}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GiantBomb.Api.Net461", "GiantBomb.Api.Net461\GiantBomb.Api.Net461.csproj", "{64569B67-6E98-490C-A773-E23831189AD7}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GiantBomb.Api", "GiantBomb.Api\GiantBomb.Api.csproj", "{9980B512-D08B-4505-971C-6DFB5CB44E36}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -40,26 +35,6 @@ Global Release|x86 = Release|x86 EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution - {9CB78FD8-C888-4A8C-B16F-AB762A5D5BAB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {9CB78FD8-C888-4A8C-B16F-AB762A5D5BAB}.Debug|Any CPU.Build.0 = Debug|Any CPU - {9CB78FD8-C888-4A8C-B16F-AB762A5D5BAB}.Debug|ARM.ActiveCfg = Debug|Any CPU - {9CB78FD8-C888-4A8C-B16F-AB762A5D5BAB}.Debug|ARM.Build.0 = Debug|Any CPU - {9CB78FD8-C888-4A8C-B16F-AB762A5D5BAB}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU - {9CB78FD8-C888-4A8C-B16F-AB762A5D5BAB}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU - {9CB78FD8-C888-4A8C-B16F-AB762A5D5BAB}.Debug|x64.ActiveCfg = Debug|Any CPU - {9CB78FD8-C888-4A8C-B16F-AB762A5D5BAB}.Debug|x64.Build.0 = Debug|Any CPU - {9CB78FD8-C888-4A8C-B16F-AB762A5D5BAB}.Debug|x86.ActiveCfg = Debug|Any CPU - {9CB78FD8-C888-4A8C-B16F-AB762A5D5BAB}.Debug|x86.Build.0 = Debug|Any CPU - {9CB78FD8-C888-4A8C-B16F-AB762A5D5BAB}.Release|Any CPU.ActiveCfg = Release|Any CPU - {9CB78FD8-C888-4A8C-B16F-AB762A5D5BAB}.Release|Any CPU.Build.0 = Release|Any CPU - {9CB78FD8-C888-4A8C-B16F-AB762A5D5BAB}.Release|ARM.ActiveCfg = Release|Any CPU - {9CB78FD8-C888-4A8C-B16F-AB762A5D5BAB}.Release|ARM.Build.0 = Release|Any CPU - {9CB78FD8-C888-4A8C-B16F-AB762A5D5BAB}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU - {9CB78FD8-C888-4A8C-B16F-AB762A5D5BAB}.Release|Mixed Platforms.Build.0 = Release|Any CPU - {9CB78FD8-C888-4A8C-B16F-AB762A5D5BAB}.Release|x64.ActiveCfg = Release|Any CPU - {9CB78FD8-C888-4A8C-B16F-AB762A5D5BAB}.Release|x64.Build.0 = Release|Any CPU - {9CB78FD8-C888-4A8C-B16F-AB762A5D5BAB}.Release|x86.ActiveCfg = Release|Any CPU - {9CB78FD8-C888-4A8C-B16F-AB762A5D5BAB}.Release|x86.Build.0 = Release|Any CPU {1B4925AE-F785-4F8D-AFBE-8FAEF0980946}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {1B4925AE-F785-4F8D-AFBE-8FAEF0980946}.Debug|Any CPU.Build.0 = Debug|Any CPU {1B4925AE-F785-4F8D-AFBE-8FAEF0980946}.Debug|ARM.ActiveCfg = Debug|Any CPU @@ -80,46 +55,26 @@ Global {1B4925AE-F785-4F8D-AFBE-8FAEF0980946}.Release|x64.Build.0 = Release|Any CPU {1B4925AE-F785-4F8D-AFBE-8FAEF0980946}.Release|x86.ActiveCfg = Release|Any CPU {1B4925AE-F785-4F8D-AFBE-8FAEF0980946}.Release|x86.Build.0 = Release|Any CPU - {0F3123EB-BEE8-4D22-8B82-FEE48332479B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {0F3123EB-BEE8-4D22-8B82-FEE48332479B}.Debug|Any CPU.Build.0 = Debug|Any CPU - {0F3123EB-BEE8-4D22-8B82-FEE48332479B}.Debug|ARM.ActiveCfg = Debug|Any CPU - {0F3123EB-BEE8-4D22-8B82-FEE48332479B}.Debug|ARM.Build.0 = Debug|Any CPU - {0F3123EB-BEE8-4D22-8B82-FEE48332479B}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU - {0F3123EB-BEE8-4D22-8B82-FEE48332479B}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU - {0F3123EB-BEE8-4D22-8B82-FEE48332479B}.Debug|x64.ActiveCfg = Debug|Any CPU - {0F3123EB-BEE8-4D22-8B82-FEE48332479B}.Debug|x64.Build.0 = Debug|Any CPU - {0F3123EB-BEE8-4D22-8B82-FEE48332479B}.Debug|x86.ActiveCfg = Debug|Any CPU - {0F3123EB-BEE8-4D22-8B82-FEE48332479B}.Debug|x86.Build.0 = Debug|Any CPU - {0F3123EB-BEE8-4D22-8B82-FEE48332479B}.Release|Any CPU.ActiveCfg = Release|Any CPU - {0F3123EB-BEE8-4D22-8B82-FEE48332479B}.Release|Any CPU.Build.0 = Release|Any CPU - {0F3123EB-BEE8-4D22-8B82-FEE48332479B}.Release|ARM.ActiveCfg = Release|Any CPU - {0F3123EB-BEE8-4D22-8B82-FEE48332479B}.Release|ARM.Build.0 = Release|Any CPU - {0F3123EB-BEE8-4D22-8B82-FEE48332479B}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU - {0F3123EB-BEE8-4D22-8B82-FEE48332479B}.Release|Mixed Platforms.Build.0 = Release|Any CPU - {0F3123EB-BEE8-4D22-8B82-FEE48332479B}.Release|x64.ActiveCfg = Release|Any CPU - {0F3123EB-BEE8-4D22-8B82-FEE48332479B}.Release|x64.Build.0 = Release|Any CPU - {0F3123EB-BEE8-4D22-8B82-FEE48332479B}.Release|x86.ActiveCfg = Release|Any CPU - {0F3123EB-BEE8-4D22-8B82-FEE48332479B}.Release|x86.Build.0 = Release|Any CPU - {64569B67-6E98-490C-A773-E23831189AD7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {64569B67-6E98-490C-A773-E23831189AD7}.Debug|Any CPU.Build.0 = Debug|Any CPU - {64569B67-6E98-490C-A773-E23831189AD7}.Debug|ARM.ActiveCfg = Debug|Any CPU - {64569B67-6E98-490C-A773-E23831189AD7}.Debug|ARM.Build.0 = Debug|Any CPU - {64569B67-6E98-490C-A773-E23831189AD7}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU - {64569B67-6E98-490C-A773-E23831189AD7}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU - {64569B67-6E98-490C-A773-E23831189AD7}.Debug|x64.ActiveCfg = Debug|Any CPU - {64569B67-6E98-490C-A773-E23831189AD7}.Debug|x64.Build.0 = Debug|Any CPU - {64569B67-6E98-490C-A773-E23831189AD7}.Debug|x86.ActiveCfg = Debug|Any CPU - {64569B67-6E98-490C-A773-E23831189AD7}.Debug|x86.Build.0 = Debug|Any CPU - {64569B67-6E98-490C-A773-E23831189AD7}.Release|Any CPU.ActiveCfg = Release|Any CPU - {64569B67-6E98-490C-A773-E23831189AD7}.Release|Any CPU.Build.0 = Release|Any CPU - {64569B67-6E98-490C-A773-E23831189AD7}.Release|ARM.ActiveCfg = Release|Any CPU - {64569B67-6E98-490C-A773-E23831189AD7}.Release|ARM.Build.0 = Release|Any CPU - {64569B67-6E98-490C-A773-E23831189AD7}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU - {64569B67-6E98-490C-A773-E23831189AD7}.Release|Mixed Platforms.Build.0 = Release|Any CPU - {64569B67-6E98-490C-A773-E23831189AD7}.Release|x64.ActiveCfg = Release|Any CPU - {64569B67-6E98-490C-A773-E23831189AD7}.Release|x64.Build.0 = Release|Any CPU - {64569B67-6E98-490C-A773-E23831189AD7}.Release|x86.ActiveCfg = Release|Any CPU - {64569B67-6E98-490C-A773-E23831189AD7}.Release|x86.Build.0 = Release|Any CPU + {9980B512-D08B-4505-971C-6DFB5CB44E36}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {9980B512-D08B-4505-971C-6DFB5CB44E36}.Debug|Any CPU.Build.0 = Debug|Any CPU + {9980B512-D08B-4505-971C-6DFB5CB44E36}.Debug|ARM.ActiveCfg = Debug|Any CPU + {9980B512-D08B-4505-971C-6DFB5CB44E36}.Debug|ARM.Build.0 = Debug|Any CPU + {9980B512-D08B-4505-971C-6DFB5CB44E36}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU + {9980B512-D08B-4505-971C-6DFB5CB44E36}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU + {9980B512-D08B-4505-971C-6DFB5CB44E36}.Debug|x64.ActiveCfg = Debug|Any CPU + {9980B512-D08B-4505-971C-6DFB5CB44E36}.Debug|x64.Build.0 = Debug|Any CPU + {9980B512-D08B-4505-971C-6DFB5CB44E36}.Debug|x86.ActiveCfg = Debug|Any CPU + {9980B512-D08B-4505-971C-6DFB5CB44E36}.Debug|x86.Build.0 = Debug|Any CPU + {9980B512-D08B-4505-971C-6DFB5CB44E36}.Release|Any CPU.ActiveCfg = Release|Any CPU + {9980B512-D08B-4505-971C-6DFB5CB44E36}.Release|Any CPU.Build.0 = Release|Any CPU + {9980B512-D08B-4505-971C-6DFB5CB44E36}.Release|ARM.ActiveCfg = Release|Any CPU + {9980B512-D08B-4505-971C-6DFB5CB44E36}.Release|ARM.Build.0 = Release|Any CPU + {9980B512-D08B-4505-971C-6DFB5CB44E36}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU + {9980B512-D08B-4505-971C-6DFB5CB44E36}.Release|Mixed Platforms.Build.0 = Release|Any CPU + {9980B512-D08B-4505-971C-6DFB5CB44E36}.Release|x64.ActiveCfg = Release|Any CPU + {9980B512-D08B-4505-971C-6DFB5CB44E36}.Release|x64.Build.0 = Release|Any CPU + {9980B512-D08B-4505-971C-6DFB5CB44E36}.Release|x86.ActiveCfg = Release|Any CPU + {9980B512-D08B-4505-971C-6DFB5CB44E36}.Release|x86.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/Readme.md b/Readme.md index 6f9ada7..f4755ed 100644 --- a/Readme.md +++ b/Readme.md @@ -3,85 +3,50 @@ GiantBomb C# [![Build status](https://ci.appveyor.com/api/projects/status/hh268dmpd08qfjqt?svg=true)](https://ci.appveyor.com/project/kamranayub/giantbomb-csharp) -## 2.3.0 - -- **BUG:** Fixed deserialization exception for single resource errors (e.g. Object Not Found) -- **BUG:** Fixed synchronous API to not deadlock -- Removed fastJSON DLL since it wasn't *actually* being used -- Upgrade to RestSharp 105.2.3 -- Added .NET 4.6 and 4.6.1 support - -## 2.2.1 - -- Better error handling for API exceptions - -## 2.2.0 - -- Upgrade to .NET 4.5.2 (you should too!) -- Upgrade RestSharp to 105.1 -- `async/await` support for all methods -- Better fatal error handling - - If GiantBomb returns a non-JSON response, the library will throw a `GiantBombHttpException` - containing the raw response body -- **FIX:** Issue with searches returning duplicate games from GiantBomb - -## 2.1.0 - -- Add new fields: - - `Platform.Aliases` - - `Platform.InstallBase` - - `Platform.OnlineOnly` - - `Platform.OriginalPrice` - - `Game.Franchises` - - `Release.Game` -- Add exception handling and wrapping for GiantBomb API errors (`GiantBombApiException` class) - - For example, exceeding the 400 requests in 15 minutes rate limit -- Allow overriding `Execute` methods -- Update RestSharp to 105 (fixes #13) - -## 2.0.3 - -- Fixes issue with search paging (`offset` vs. `page` parameter) - -## API v2 Support - -GiantBomb-C# 2.0+ is only compatible with GiantBomb APIv2. Keep using the old packages if you need v1 support, as there are breaking changes in v2! - -### Notable Changes - -* Search is now MUCH better in GiantBomb's v2 API, there's little to no need for `SearchAllGames` now unless you expect/want more than 100 results -* List resources support new `sort` and `filter` options -* All single resource requests must use a resource ID, e.g. "game/3030-33394", which GBCS implements transparently for you -* `Game` and `Release` now have `ExpectedReleaseDay` -* Search results now include platforms -* `Game` has two new fields: - - `Aliases` - newline delimited aliases - - `OriginalGameRating` -* You can now use `GetReleasesForGame()` to directly retrieve releases for a game in one request -* Using [FastJSON](http://www.codeproject.com/Articles/159450/fastJSON) to deserialize, which is... fast, obviously - -## Readme - This library aims to wrap the GiantBomb REST API in C# with strongly-typed models and is built on top of [RestSharp](https://github.com/johnsheehan/RestSharp). It also helps make your life easier when dealing with searching because it recursively fetches your search results all at once to enable better sorting. **Note: This is not really needed anymore due to search improvements in APIv2** - var giantBomb = new GiantBombRestClient(); +```c# +var giantBomb = new GiantBombRestClient(); + +// Get all search results +var results = giantBomb.SearchForAllGames("assassin's creed"); + +// Display +return results.OrderByDescending(g => g.DateAdded) +``` - // Get all search results - var results = giantBomb.SearchForAllGames("assassin's creed"); +It's also easy to extend to support other GiantBomb resource types that aren't included by default. +Just create a C# class representing the model and use `GetSingleResource` or `GetListResource`: - // Display - return results.OrderByDescending(g => g.DateAdded) +```c# +var giantBomb = new GiantBombRestClient(); +// Get video +var video = await giantBomb.GetSingleResourceAsync("video", 2300, 123456); +``` ## Nuget Download and install the GiantBomb.Api Nuget package: PM> Install-Package GiantBomb.Api +## Supported Platforms + +This project targets [.NET Standard 1.2](https://docs.microsoft.com/en-us/dotnet/standard/library) + +- .NET Core 1.0+ +- .NET 4.5.1+ +- Mono 4.6+ +- Xamarin.iOS 10.0+ +- Xamarin.Android 7.0+ +- UWP 10.0+ +- Windows 8.1 +- Windows Phone 8.1 + ## Contributing Read about [contributing on the wiki](https://github.com/kamranayub/GiantBomb-CSharp/wiki). If you plan to contribute, you **must** read this. @@ -90,3 +55,7 @@ Read about [examples on the wiki](https://github.com/kamranayub/GiantBomb-CSharp ## License Dual-licensed on MIT & GPL + +## Changelog + +See [CHANGELOG](CHANGELOG.md) \ No newline at end of file diff --git a/SharedAssemblyInfo.cs b/SharedAssemblyInfo.cs deleted file mode 100644 index ac426d9..0000000 --- a/SharedAssemblyInfo.cs +++ /dev/null @@ -1,16 +0,0 @@ -using System.Reflection; -using System.Runtime.InteropServices; - -[assembly: AssemblyTitle("GiantBomb.Api")] -[assembly: AssemblyDescription("RestSharp-based API wrapper for the GiantBomb games database public API")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("kayub")] -[assembly: AssemblyProduct("GiantBomb.Api")] -[assembly: AssemblyCopyright("Copyright © kayub 2015")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] -[assembly: ComVisible(false)] - -[assembly: AssemblyVersion("2.3.0")] -[assembly: AssemblyFileVersion("2.3.0")] -[assembly: AssemblyInformationalVersion("2.3.0")] \ No newline at end of file