public async Task <AppAccessToken> GetAppAccessTokenAsync() { var result = JObject.Parse(await http.GetAsync($"https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid={config["AppId"]}&secret={config["Secret"]}")); return(new AppAccessToken { access_token = result["access_token"].Value <string>(), expires_in = result["expires_in"].Value <int>(), time_stamp = provider.GetNow() }); }
public void Update() { string endPoint = setting.Google.Endpoint + "?client=api&apikey={0}&version=".FormatWith(setting.Google.ApiKey); string phishingEndPoint = endPoint + "goog-black-hash:"; string malwareEndPoint = endPoint + "goog-malware-hash:"; phishingEndPoint = MakeVersionable(phishingEndPoint, setting.Google.PhishingFile); malwareEndPoint = MakeVersionable(malwareEndPoint, setting.Google.MalwareFile); http.GetAsync(phishingEndPoint, httpResponse => UpdatePhishingFingerPrints(httpResponse.Content)); http.GetAsync(malwareEndPoint, httpResponse => UpdateMalwareFingerPrints(httpResponse.Content)); }
public void Capture(string url) { Check.Argument.IsNotNullOrEmpty(url, "shortUrl"); string requestUrl = "{0}/request?devkey={1}&url={2}".FormatWith(settings.Thumbnail.Endpoint, settings.Thumbnail.ApiKey, url); http.GetAsync(requestUrl); }
/// <summary> /// Calls the topstories endpoint and returns a parsed array of post ids. /// </summary> /// <returns></returns> public async Task <int[]> GetTopPostsIdsAsync() { int[] ids; try { var result = await _http.GetAsync("https://hacker-news.firebaseio.com/v0/topstories.json"); JArray idArray = JArray.Parse(result); ids = idArray.ToObject <int[]>(); } catch (Exception) { throw; } return(ids); }
public override void Control(dynamic scope) { scope.getStringData = (Action)(() => _http.GetAsync("/foo/bar") .ContinueWith(task => { scope.status = task.Result.Status; scope.data = task.Result.Data; })); scope.getObjectData = (Action)(() => _http.GetAsync("/foo/bar") .ContinueWith(task => { scope.status = task.Result.Status; var dataObject = task.Result.DataAs <FooBar>(); scope.dataObjectId = dataObject.Id; })); }
public static void GetAsync(this IHttp instance, string url, Action <HttpResponse> onComplete) { Check.Argument.IsNotNull(instance, "instance"); instance.GetAsync(url, Http.DefaultUserAgent, Http.DefaultTimeout, Http.DefaultRequestCompressed, Http.DefaultMaximumRedirects, null, null, null, null, null, onComplete, null); }
public Task <IEnumerable <Product> > GetAllProducts() { return(_http.GetAsync("/api/products") .ContinueWith(result => result.Result.DataAs <IEnumerable <Product> >())); }
public HttpWebRequest GetAsync(Action <HttpResponse> action) { return(_rawHttp.GetAsync(action)); }