public async Task GetAsync() { var apiConnection = Substitute.For <IApiConnection>(); var client = new ReadingListClient(apiConnection); await client.GetAsync(); await apiConnection.Received().ExecutePaginationGetAsync <ReadingList>("readinglist", Arg.Any <PageQueryOption>()); }
/// <summary> /// API client /// </summary> /// <remarks> /// See the <a href="https://docs.dev.to/api/#section/Authentication/api_key">Authentication</a> for more information /// </remarks> /// <param name="apiUrl">API connection url</param> /// <param name="token">API key</param> public DevToClient(string apiUrl, string token) { var restClient = new RestClient(apiUrl); restClient.AddDefaultHeader("api-key", token); restClient.AddDefaultHeader("User-Agent", "DevToAPI-client-dotnet"); var apiConnection = new ApiConnection(restClient); AdminConfigurations = new AdminConfigurationClient(apiConnection); Articles = new ArticleClient(apiConnection); Comments = new CommentClient(apiConnection); Followers = new FollowerClient(apiConnection); Follows = new FollowClient(apiConnection); Listings = new ListingClient(apiConnection); Organizations = new OrganizationClient(apiConnection); PodcastEpisodes = new PodcastEpisodeClient(apiConnection); ReadingLists = new ReadingListClient(apiConnection); Tags = new TagClient(apiConnection); Users = new UserClient(apiConnection); Videos = new VideoClient(apiConnection); Webhooks = new WebhookClient(apiConnection); ProfileImages = new ProfileImageClient(apiConnection); }