Skip to content

Commit ea62530

Browse files
committed
Update the README.md with an example.
1 parent 4c68140 commit ea62530

File tree

1 file changed

+26
-1
lines changed

1 file changed

+26
-1
lines changed

README.md

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,26 @@
1-
# ScryfallApi
1+
# Scryfall API Client
2+
## Getting Started
3+
Until I can get better documentation, see the [samples project](https://github.com/Gonkers/Scryfall-API-Client/tree/master/samples/ScryfallApi.WebSample) for examples.
4+
5+
---
6+
## .NET Core Instructions
7+
### Add a service definition to your `startup.cs` file's `ConfigureServices` method.
8+
```c#
9+
services.AddHttpClient<ScryfallApiClient>(client =>
10+
{
11+
client.BaseAddress = new Uri("https://api.scryfall.com/");
12+
});
13+
```
14+
### Add a `ScryfallApiClient` parameter and member to your Controller or Razor Page
15+
```c#
16+
ScryfallApiClient _scryfallApi { get; }
17+
18+
public IndexModel(ScryfallApiClient scryfallApi)
19+
{
20+
_scryfallApi = scryfallApi ?? throw new ArgumentNullException(nameof(scryfallApi));
21+
}
22+
```
23+
### Use the client
24+
```c#
25+
var randomCard = await _scryfallApi.Cards.GetRandom();
26+
```

0 commit comments

Comments
 (0)