/// <summary> /// Overload for more sophisticated rendering. /// </summary> /// <param name="request">ram name="request">Description of rendering process <see cref="RenderRequest"/></param> /// <exception cref="JsReportException"></exception> /// <returns>Report result promise</returns> public async Task <Report> RenderAsync(RenderRequest request) { request.options = request.options ?? new RenderOptions(); request.CopyDynamicAttributes(); request.Validate(); var client = CreateClient(); var settings = new JsonSerializerSettings() { NullValueHandling = NullValueHandling.Ignore, ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Serialize, PreserveReferencesHandling = PreserveReferencesHandling.All }; var response = await client.PostAsync("api/report", new StringContent(JsonConvert.SerializeObject(request, settings), Encoding.UTF8, "application/json")).ConfigureAwait(false); if (response.StatusCode != HttpStatusCode.OK) { throw JsReportException.Create("Unable to render template. ", response); } response.EnsureSuccessStatusCode(); return(await ReportFromResponse(response).ConfigureAwait(false)); }
/// <summary> /// Overload for more sophisticated rendering. /// </summary> /// <param name="request">ram name="request">Description of rendering process <see cref="RenderRequest"/></param> /// <exception cref="JsReportException"></exception> /// <returns>Report result promise</returns> public async Task<Report> RenderAsync(RenderRequest request) { request.options = request.options ?? new RenderOptions(); request.CopyDynamicAttributes(); request.Validate(); var client = CreateClient(); var settings = new JsonSerializerSettings() { NullValueHandling = NullValueHandling.Ignore, ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Serialize, PreserveReferencesHandling = PreserveReferencesHandling.All }; var response = await client.PostAsync("/api/report", new StringContent(JsonConvert.SerializeObject(request, settings), Encoding.UTF8, "application/json")).ConfigureAwait(false); if (response.StatusCode != HttpStatusCode.OK) throw JsReportException.Create("Unable to render template. ", response); response.EnsureSuccessStatusCode(); return await ReportFromResponse(response).ConfigureAwait(false); }