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