/// <summary> /// Gets the HTML content of the API resource at the specified URI. /// </summary> /// <param name="connection">The connection to use</param> /// <param name="uri">URI of the API resource to get</param> /// <returns>The API resource's HTML content.</returns> /// <exception cref="ApiException">Thrown when an API error occurs.</exception> public static Task <string> GetHtml(this IApiConnection connection, Uri uri) { Ensure.ArgumentNotNull(connection, "connection"); Ensure.ArgumentNotNull(uri, "uri"); return(connection.GetHtml(uri, null)); }
internal Readme(ReadmeResponse response, IApiConnection client) { Ensure.ArgumentNotNull(response, "response"); Ensure.ArgumentNotNull(client, "client"); Name = response.Name; Url = new Uri(response.Url); HtmlUrl = new Uri(response.HtmlUrl); if (response.Encoding.Equals("base64", StringComparison.OrdinalIgnoreCase)) { var contentAsBytes = Convert.FromBase64String(response.Content); Content = Encoding.UTF8.GetString(contentAsBytes, 0, contentAsBytes.Length); } htmlContent = new Lazy<Task<string>>(async () => await client.GetHtml(Url).ConfigureAwait(false)); }
internal Readme(ReadmeResponse response, IApiConnection client) { Ensure.ArgumentNotNull(response, "response"); Ensure.ArgumentNotNull(client, "client"); Name = response.Name; Url = new Uri(response.Url); HtmlUrl = new Uri(response.HtmlUrl); if (response.Encoding.Equals("base64", StringComparison.OrdinalIgnoreCase)) { var contentAsBytes = Convert.FromBase64String(response.Content); Content = Encoding.UTF8.GetString(contentAsBytes, 0, contentAsBytes.Length); } htmlContent = new Lazy <Task <string> >(async() => await client.GetHtml(Url).ConfigureAwait(false)); }