public async static Task <ThingResponse.Item> GetGameAsync(this IBoardGameGeekXmlApi2Client client, int gameId) { if (client == null) { throw new ArgumentNullException(nameof(client)); } var request = new ThingRequest(new[] { gameId }); var response = await client.GetThingAsync(request); return(response.Result.FirstOrDefault()); }
public static async Task <ThingResponse.Item> GetBoardGameAsync(this IBoardGameGeekXmlApi2Client bggClient, int id) { var request = new ThingRequest( new[] { id }, types: new[] { "boardgame" }, stats: true); ThingResponse response = await bggClient.GetThingAsync(request); return(response.Result.FirstOrDefault()); }
public async static Task <UserResponse.User> GetUserAsync(this IBoardGameGeekXmlApi2Client client, string username) { if (client == null) { throw new ArgumentNullException(nameof(client)); } if (username == null) { throw new ArgumentNullException(nameof(username)); } var request = new UserRequest(username); var response = await client.GetUserAsync(request); return(response.Result); }
public BoardGameGeekClientTests() { bgg = new BoardGameGeekXmlApi2Client(new HttpClient()); }
public GamesController(IGameRepository gameRepository, IBoardGameGeekXmlApi2Client bggClient) { _gameRepository = gameRepository; _bgg = bggClient; }
/// <summary> /// Retrieves a players collection from boardgamegeek.com /// </summary> /// <param name="client">A boardgamegeek client instance.</param> /// <param name="username">The username of the player on boardgamegeek.com.</param> /// <returns></returns> public async static Task <CollectionResponse.ItemCollection> GetCollectionAsync(this IBoardGameGeekXmlApi2Client client, string username) { if (client == null) { throw new ArgumentNullException(nameof(client)); } if (username == null) { throw new ArgumentNullException(nameof(username)); } var request = new CollectionRequest(username, own: true); var response = await client.GetCollectionAsync(request); return(response.Result); }
public static async Task <ThingResponse.Item> GetBoardGameAsync(this IBoardGameGeekXmlApi2Client bggClient, int id) => (await GetBoardGamesAsync(bggClient, id)).FirstOrDefault();
public static async Task <IEnumerable <ThingResponse.Item> > GetBoardGamesAsync(this IBoardGameGeekXmlApi2Client bggClient, params int[] ids) { var request = new ThingRequest( ids, types: new[] { "boardgame" }, stats: true); ThingResponse response = await bggClient.GetThingAsync(request); return(response.Result); }