11using System . Diagnostics ;
22using Microsoft . AspNetCore . Mvc ;
33using Oicana . Example . Services ;
4- using Oicana . Inputs ;
54using System . Text . RegularExpressions ;
5+ using Oicana . Example . Models ;
66
77namespace Oicana . Example . Controllers ;
88
@@ -16,7 +16,7 @@ namespace Oicana.Example.Controllers;
1616public class PdfTemplatingController ( ILogger < PdfTemplatingController > logger , ITemplatingService templatingService ) : ControllerBase
1717{
1818 /// <summary>
19- /// Compile a template with given input
19+ /// Compile any example template to PDF with given inputs
2020 /// </summary>
2121 /// <param name="template" example="table"></param>
2222 /// <param name="request"></param>
@@ -49,8 +49,9 @@ public async Task<IActionResult> CompilePdfTemplate([FromRoute] String template,
4949 return StatusCode ( 400 ) ;
5050 }
5151 }
52+
5253 /// <summary>
53- /// Compile a template with given input
54+ /// Compile any example template to PNG with given inputs
5455 /// </summary>
5556 /// <param name="template" example="table"></param>
5657 /// <param name="request"></param>
@@ -128,94 +129,4 @@ public IActionResult DownloadTemplate([FromRoute] String template)
128129 var fileStream = new FileStream ( filePath , FileMode . Open , FileAccess . Read ) ;
129130 return File ( fileStream , "application/zip" , $ "{ template } .zip") ;
130131 }
131- }
132-
133- /// <summary>
134- /// Request to compile a template with given input
135- /// </summary>
136- /// <example>
137- /// {
138- /// "input": [
139- /// {
140- /// "key": "input",
141- /// "value": {
142- /// "description": "from sample data",
143- /// "rows": [
144- /// {
145- /// "name": "Frank",
146- /// "one": "first",
147- /// "two": "second",
148- /// "three": "third"
149- /// },
150- /// {
151- /// "name": "John",
152- /// "one": "first_john",
153- /// "two": "second_john",
154- /// "three": "third_john"
155- /// }
156- /// ]
157- /// }
158- /// }
159- /// ]
160- /// }
161- /// </example>
162- public class CompilePdfRequest
163- {
164- /// <summary>
165- /// Input json to compile the template with
166- /// </summary>
167- /// <example>
168- /// [
169- /// {
170- /// "key": "data",
171- /// "value": {
172- /// "description": "from sample data",
173- /// "rows": [
174- /// {
175- /// "name": "Frank",
176- /// "one": "first",
177- /// "two": "second",
178- /// "three": "third"
179- /// },
180- /// {
181- /// "name": "John",
182- /// "one": "first_john",
183- /// "two": "second_john",
184- /// "three": "third_john"
185- /// }
186- /// ]
187- /// }
188- /// }
189- /// ]
190- /// </example>
191- public required IList < TemplateJsonInput > JsonInputs { get ; init ; }
192-
193- /// <summary>
194- ///
195- /// </summary>
196- /// <example>
197- /// [
198- /// {
199- /// "key": "logo",
200- /// "blobId": "00000000-0000-0000-0000-000000000000"
201- /// }
202- /// ]
203- /// </example>
204- public required IList < StoredBlobInput > BlobInputs { get ; init ; }
205- }
206-
207- /// <summary>
208- /// Pass a blob stored in the service as a blob input to the template
209- /// </summary>
210- public class StoredBlobInput
211- {
212- /// <summary>
213- /// The key of the blob input
214- /// </summary>
215- public required string Key { get ; init ; }
216-
217- /// <summary>
218- /// Identifier of the blob file
219- /// </summary>
220- public required Guid BlobId { get ; init ; }
221- }
132+ }
0 commit comments