Skip to content

Latest commit

 

History

History
29 lines (25 loc) · 1019 Bytes

README.md

File metadata and controls

29 lines (25 loc) · 1019 Bytes

Scryfall API Client

Build status

Getting Started

Until I can get better documentation, see the samples project for examples.


.NET Core Instructions

Add a service definition to your startup.cs file's ConfigureServices method.

services.AddHttpClient<ScryfallApiClient>(client =>
{
    client.BaseAddress = new Uri("https://api.scryfall.com/");
});

Add a ScryfallApiClient parameter and member to your Controller or Razor Page

ScryfallApiClient _scryfallApi { get; }

public IndexModel(ScryfallApiClient scryfallApi)
{
    _scryfallApi = scryfallApi ?? throw new ArgumentNullException(nameof(scryfallApi));
}

Use the client

var randomCard = await _scryfallApi.Cards.GetRandom();