public GetPublishersListResponse List() { using (HttpClient client = new HttpClient()) { client.Timeout = TimeSpan.FromMinutes(1); string requestUri = $"{baseURL}/affiliate/list?token={token}&limit=10&offset=10"; using (HttpResponseMessage response = client.GetAsync(requestUri).Result) using (HttpContent content = response.Content) { string responseContent = content.ReadAsStringAsync().Result; GetPublishersListResponse getAdvertisersListResponse; try { getAdvertisersListResponse = GetPublishersListResponse.FromJson(responseContent); } catch (Exception ex) { throw new AdsException("There is error in parsing data from HasOffers. Problem in HasOffers API."); } return(getAdvertisersListResponse); } } }
public static string ToJson(this GetPublishersListResponse self) => JsonConvert.SerializeObject(self, Converter.Settings);