/// <summary> /// Calls the Article API. /// </summary> /// <param name="url">Article URL to process.</param> /// <param name="fields">Array with the fields that will be returned by the API.</param> /// <returns>Returns information about the primary article content on the submitted page.</returns> public async Task <ImageResult> GetImagesAsync(string url, string[] fields, Dictionary <string, string> optionalParameters) { try { JObject result = await diffbotCall.ApiGetAsync(url, this.token, "image", fields, this.version, optionalParameters); return(CreateImages(result)); } catch (Exception ex) { throw ex; //TODO: better exception handler } }
/// <summary> /// Calls the API. /// </summary> /// <param name="url">URL to process.</param> /// <param name="fields">Array with the fields that will be returned by the API.</param> /// <returns>Returns information about the primary article content on the submitted page.</returns> public async Task <ClassifierResult> GetPageClassificationAsync(string url, string[] fields, PageType?mode = null, bool stats = false) { try { Dictionary <string, string> optionalParameters = new Dictionary <string, string>(); if (mode != null) { optionalParameters.Add("mode", mode.Value.ToString().ToLowerInvariant()); } if (stats) { optionalParameters.Add("mode", "true"); } JObject result = await diffbotCall.ApiGetAsync(url, this.token, "analyze", fields, this.version, optionalParameters); return(CreateClassifierResult(result)); } catch (Exception ex) { throw ex; //TODO: better exception handler } }