/// <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, CancellationToken ct = default(CancellationToken)) { return(await RenderAsync((object)request, ct).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, CancellationToken ct = default(CancellationToken)) { return await RenderAsync((object)request, ct).ConfigureAwait(false); }
/// <summary> /// Specify comnpletely the rendering requests, see https://jsreport.net/learn/api for details /// </summary> /// <param name="request">ram name="request">Description of rendering process</param> /// <exception cref="JsReportException"></exception> /// <returns>Report result promise</returns> public Task <Report> RenderAsync(RenderRequest request, CancellationToken ct = default(CancellationToken)) { return(RenderAsync(SerializerHelper.SerializeRenderRequest(request, ContractResolverForDataProperty), ct)); }
/// <summary> /// Specify comnpletely the rendering requests, see https://jsreport.net/learn/api for details /// </summary> /// <param name="request">ram name="request">Description of rendering process</param> /// <exception cref="JsReportException"></exception> /// <returns>Report result promise</returns> public Task <Report> RenderAsync(RenderRequest request, CancellationToken ct = default(CancellationToken)) { return(RenderAsync(SerializerHelper.SerializeRenderRequest(request), ct)); }
/// <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); }