MagicTheGathering / mtg-sdk-dotnet

Magic: The Gathering SDK - C#.NET
MIT License
63 stars 22 forks source link

Add id and multiverseid query parameters #69

Closed billybimbob closed 2 years ago

billybimbob commented 2 years ago

Property values Id and MultiverseId are added to the type CardQueryParameter.

The MTG Api cards endpoint allow for both an id and multiverseid value to be specified, so adding the properties allow for the ICardService to better reflect the source api.

The extra properties may have overlap with the FindAsync method. However, one main benefit of the change is that multiple ids or multiverseids can be specified in a single request. As compared to FindAsync, only a max of one id or multiverseid can be searched per request.

The following test case is made possible with the addition of the above properties. Multiple multiverseids can be specified, which also results in receiving multiple cards in a single request.

[Fact]
public async Task Where_AddMultiverseIdNoMock_Success()
{
    const string MULTIPLE_MULTIS = "3|4|5|6";

    var serviceProvider = new MtgServiceProvider();
    var service = serviceProvider.GetCardService();

    var result = await service
        .Where(x => x.MultiverseId, MULTIPLE_MULTIS)
        .AllAsync();

    Assert.True(result.IsSuccess);
    Assert.Equal(4, result.Value.Count);
}
jregnier commented 2 years ago

Makes perfect sense to me! Thanks for adding this!