public static System.Threading.Tasks.Task <RenderMarkdownResult> RenderMarkdownAsync(this Meziantou.GitLab.IGitLabMarkdownClient client, string text, bool?gfm = default(bool?), Meziantou.GitLab.PathWithNamespace?project = default(Meziantou.GitLab.PathWithNamespace?), Meziantou.GitLab.RequestOptions?requestOptions = default(Meziantou.GitLab.RequestOptions), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { Meziantou.GitLab.RenderMarkdownRequest request = new Meziantou.GitLab.RenderMarkdownRequest(text); request.Gfm = gfm; request.Project = project; return(client.RenderMarkdownAsync(request, requestOptions, cancellationToken)); }
private async System.Threading.Tasks.Task <RenderMarkdownResult> Markdown_RenderMarkdownAsync(Meziantou.GitLab.RenderMarkdownRequest request, Meziantou.GitLab.RequestOptions?requestOptions = default(Meziantou.GitLab.RequestOptions), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { string url = Meziantou.GitLab.GitLabClient.Markdown_RenderMarkdownAsync_BuildUrl(); using (System.Net.Http.HttpRequestMessage requestMessage = new System.Net.Http.HttpRequestMessage()) { requestMessage.Method = System.Net.Http.HttpMethod.Post; requestMessage.RequestUri = new System.Uri(url, System.UriKind.RelativeOrAbsolute); requestMessage.Content = new Meziantou.GitLab.Internals.JsonContent(request, Meziantou.GitLab.Serialization.JsonSerialization.Options); HttpResponse?response = null; try { response = await this.SendAsync(requestMessage, requestOptions, cancellationToken).ConfigureAwait(false); await response.EnsureStatusCodeAsync(cancellationToken).ConfigureAwait(false); RenderMarkdownResult?result = await response.ToObjectAsync <RenderMarkdownResult>(cancellationToken).ConfigureAwait(false); if ((result == null)) { throw new Meziantou.GitLab.GitLabException(response.RequestMethod, response.RequestUri, response.StatusCode, "The response cannot be converted to 'RenderMarkdownResult' because the body is null or empty"); } return(result); } finally { if ((response != null)) { response.Dispose(); } } } }
System.Threading.Tasks.Task <RenderMarkdownResult> Meziantou.GitLab.IGitLabMarkdownClient.RenderMarkdownAsync(Meziantou.GitLab.RenderMarkdownRequest request, Meziantou.GitLab.RequestOptions?requestOptions, System.Threading.CancellationToken cancellationToken) { return(this.Markdown_RenderMarkdownAsync(request, requestOptions, cancellationToken)); }