Writing our DiscogsClient class

When we write our DiscogsClient class, we already have the contract that it will be based on, along with the interface definition. This tells us that our class starts off like this:

public class DiscogsClient : IDiscogsClient{  public async Task<Results> GetByArtist(string artist)  {  }}

The definition of our class looks slightly different to our interface because we didn't have to say that GetByArtist was public or that the method was async. When we use async in a method declaration, we are setting a compilation expectation that the method will have the await keyword inside it. This should be very familiar to us from our TypeScript use of async/await.

When we call the Discogs API, it always starts off with the ...

Get Advanced TypeScript Programming Projects now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.