README.md•7.21 kB
# gamebrain - the C# library for the GameBrain API
GameBrain API
This C# SDK is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project:
- API version: 1.0.1
- SDK version: 1.0.2
- Generator version: 7.8.0-SNAPSHOT
- Build package: org.openapitools.codegen.languages.CSharpClientCodegen
<a id="frameworks-supported"></a>
## Frameworks supported
<a id="dependencies"></a>
## Dependencies
- [RestSharp](https://www.nuget.org/packages/RestSharp) - 106.13.0 or later
- [Json.NET](https://www.nuget.org/packages/Newtonsoft.Json/) - 13.0.2 or later
- [JsonSubTypes](https://www.nuget.org/packages/JsonSubTypes/) - 1.8.0 or later
- [System.ComponentModel.Annotations](https://www.nuget.org/packages/System.ComponentModel.Annotations) - 5.0.0 or later
The DLLs included in the package may not be the latest version. We recommend using [NuGet](https://docs.nuget.org/consume/installing-nuget) to obtain the latest version of the packages:
```
Install-Package RestSharp
Install-Package Newtonsoft.Json
Install-Package JsonSubTypes
Install-Package System.ComponentModel.Annotations
```
NOTE: RestSharp versions greater than 105.1.0 have a bug which causes file uploads to fail. See [RestSharp#742](https://github.com/restsharp/RestSharp/issues/742).
NOTE: RestSharp for .Net Core creates a new socket for each api call, which can lead to a socket exhaustion problem. See [RestSharp#1406](https://github.com/restsharp/RestSharp/issues/1406).
<a id="installation"></a>
## Installation
Run the following command to generate the DLL
- [Mac/Linux] `/bin/sh build.sh`
- [Windows] `build.bat`
Then include the DLL (under the `bin` folder) in the C# project, and use the namespaces:
```csharp
using gamebrain.Api;
using gamebrain.Client;
using gamebrain.Model;
```
<a id="packaging"></a>
## Packaging
A `.nuspec` is included with the project. You can follow the Nuget quickstart to [create](https://docs.microsoft.com/en-us/nuget/quickstart/create-and-publish-a-package#create-the-package) and [publish](https://docs.microsoft.com/en-us/nuget/quickstart/create-and-publish-a-package#publish-the-package) packages.
This `.nuspec` uses placeholders from the `.csproj`, so build the `.csproj` directly:
```
nuget pack -Build -OutputDirectory out gamebrain.csproj
```
Then, publish to a [local feed](https://docs.microsoft.com/en-us/nuget/hosting-packages/local-feeds) or [other host](https://docs.microsoft.com/en-us/nuget/hosting-packages/overview) and consume the new package via Nuget as usual.
<a id="usage"></a>
## Usage
To use the API client with a HTTP proxy, setup a `System.Net.WebProxy`
```csharp
Configuration c = new Configuration();
System.Net.WebProxy webProxy = new System.Net.WebProxy("http://myProxyUrl:80/");
webProxy.Credentials = System.Net.CredentialCache.DefaultCredentials;
c.Proxy = webProxy;
```
<a id="getting-started"></a>
## Getting Started
```csharp
using System.Collections.Generic;
using System.Diagnostics;
using gamebrain.Api;
using gamebrain.Client;
using gamebrain.Model;
namespace Example
{
public class Example
{
public static void Main()
{
Configuration config = new Configuration();
config.BasePath = "https://api.gamebrain.co/v1";
// Configure API key authorization: apiKey
config.ApiKey.Add("api-key", "YOUR_API_KEY");
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// config.ApiKeyPrefix.Add("api-key", "Bearer");
// Configure API key authorization: headerApiKey
config.ApiKey.Add("x-api-key", "YOUR_API_KEY");
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// config.ApiKeyPrefix.Add("x-api-key", "Bearer");
var apiInstance = new DefaultApi(config);
var id = 56; // int | The unique identifier of the game.
var apiKey = abc123; // string | Your API key for authentication.
try
{
// Get Game Details
GameResponse result = apiInstance.Detail(id, apiKey);
Debug.WriteLine(result);
}
catch (ApiException e)
{
Debug.Print("Exception when calling DefaultApi.Detail: " + e.Message );
Debug.Print("Status Code: "+ e.ErrorCode);
Debug.Print(e.StackTrace);
}
}
}
}
```
<a id="documentation-for-api-endpoints"></a>
## Documentation for API Endpoints
All URIs are relative to *https://api.gamebrain.co/v1*
Class | Method | HTTP request | Description
------------ | ------------- | ------------- | -------------
*DefaultApi* | [**Detail**](docs/DefaultApi.md#detail) | **GET** /games/{id} | Get Game Details
*DefaultApi* | [**News**](docs/DefaultApi.md#news) | **GET** /games/{id}/news | Get Game News
*DefaultApi* | [**Search**](docs/DefaultApi.md#search) | **GET** /games | Search Games
*DefaultApi* | [**Similar**](docs/DefaultApi.md#similar) | **GET** /games/{id}/similar | Get Similar Games
*DefaultApi* | [**Suggest**](docs/DefaultApi.md#suggest) | **GET** /games/suggestions | Get Game Suggestions
<a id="documentation-for-models"></a>
## Documentation for Models
- [Model.GameNewsItem](docs/GameNewsItem.md)
- [Model.GameNewsResponse](docs/GameNewsResponse.md)
- [Model.GameResponse](docs/GameResponse.md)
- [Model.GameResponseOffersInner](docs/GameResponseOffersInner.md)
- [Model.GameResponseOffersInnerPrice](docs/GameResponseOffersInnerPrice.md)
- [Model.GameResponseOfficialStoresInner](docs/GameResponseOfficialStoresInner.md)
- [Model.GameResponsePlatformsInner](docs/GameResponsePlatformsInner.md)
- [Model.GameResponsePlaytime](docs/GameResponsePlaytime.md)
- [Model.GameResponseRating](docs/GameResponseRating.md)
- [Model.SearchResponse](docs/SearchResponse.md)
- [Model.SearchResponseActiveFilterOptionsInner](docs/SearchResponseActiveFilterOptionsInner.md)
- [Model.SearchResponseActiveFilterOptionsInnerValuesInner](docs/SearchResponseActiveFilterOptionsInnerValuesInner.md)
- [Model.SearchResponseFilterOptionsInner](docs/SearchResponseFilterOptionsInner.md)
- [Model.SearchResponseFilterOptionsInnerValuesInner](docs/SearchResponseFilterOptionsInnerValuesInner.md)
- [Model.SearchResponseResultsInner](docs/SearchResponseResultsInner.md)
- [Model.SearchResponseResultsInnerRating](docs/SearchResponseResultsInnerRating.md)
- [Model.SearchResponseSorting](docs/SearchResponseSorting.md)
- [Model.SearchResponseSortingOptionsInner](docs/SearchResponseSortingOptionsInner.md)
- [Model.SearchSuggestionResponse](docs/SearchSuggestionResponse.md)
- [Model.SearchSuggestionResponseResultsInner](docs/SearchSuggestionResponseResultsInner.md)
- [Model.SimilarGamesResponse](docs/SimilarGamesResponse.md)
<a id="documentation-for-authorization"></a>
## Documentation for Authorization
Authentication schemes defined for the API:
<a id="apiKey"></a>
### apiKey
- **Type**: API key
- **API key parameter name**: api-key
- **Location**: URL query string
<a id="headerApiKey"></a>
### headerApiKey
- **Type**: API key
- **API key parameter name**: x-api-key
- **Location**: HTTP header