templatefox 1.0.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,562 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ TemplateFox API
5
+
6
+ Generate PDFs from HTML templates via API. Design once, generate thousands.
7
+
8
+ The version of the OpenAPI document: 1.0.0
9
+ Contact: support@pdftemplateapi.com
10
+ Generated by OpenAPI Generator (https://openapi-generator.tech)
11
+
12
+ Do not edit the class manually.
13
+ """ # noqa: E501
14
+
15
+ import warnings
16
+ from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt
17
+ from typing import Any, Dict, List, Optional, Tuple, Union
18
+ from typing_extensions import Annotated
19
+
20
+ from pydantic import StrictStr
21
+ from typing import List
22
+ from templatefox.models.template_field import TemplateField
23
+ from templatefox.models.templates_list_response import TemplatesListResponse
24
+
25
+ from templatefox.api_client import ApiClient, RequestSerialized
26
+ from templatefox.api_response import ApiResponse
27
+ from templatefox.rest import RESTResponseType
28
+
29
+
30
+ class TemplatesApi:
31
+ """NOTE: This class is auto generated by OpenAPI Generator
32
+ Ref: https://openapi-generator.tech
33
+
34
+ Do not edit the class manually.
35
+ """
36
+
37
+ def __init__(self, api_client=None) -> None:
38
+ if api_client is None:
39
+ api_client = ApiClient.get_default()
40
+ self.api_client = api_client
41
+
42
+
43
+ @validate_call
44
+ def get_template_fields(
45
+ self,
46
+ template_id: StrictStr,
47
+ _request_timeout: Union[
48
+ None,
49
+ Annotated[StrictFloat, Field(gt=0)],
50
+ Tuple[
51
+ Annotated[StrictFloat, Field(gt=0)],
52
+ Annotated[StrictFloat, Field(gt=0)]
53
+ ]
54
+ ] = None,
55
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
56
+ _content_type: Optional[StrictStr] = None,
57
+ _headers: Optional[Dict[StrictStr, Any]] = None,
58
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
59
+ ) -> List[TemplateField]:
60
+ """Get template fields
61
+
62
+ Get the dynamic fields for a template. **Authentication:** API Key required (`x-api-key` header) or JWT token **Usage:** This endpoint is designed for Zapier Dynamic Fields integration. It returns an array of field definitions that Zapier uses to dynamically generate input forms. **Response format:** Array of objects compatible with Zapier InputFieldsSchema. Each field has: `key`, `label`, `type`, `required`, and optional `helpText`. **Field types:** - `string`: Text input (also used for JSON arrays/objects) - `integer`: Integer number - `number`: Decimal number - `boolean`: True/False checkbox **Arrays and objects:** Complex types are returned as `string` type with a `helpText` showing the expected JSON format. **No credits consumed:** This is a read-only endpoint.
63
+
64
+ :param template_id: (required)
65
+ :type template_id: str
66
+ :param _request_timeout: timeout setting for this request. If one
67
+ number provided, it will be total request
68
+ timeout. It can also be a pair (tuple) of
69
+ (connection, read) timeouts.
70
+ :type _request_timeout: int, tuple(int, int), optional
71
+ :param _request_auth: set to override the auth_settings for an a single
72
+ request; this effectively ignores the
73
+ authentication in the spec for a single request.
74
+ :type _request_auth: dict, optional
75
+ :param _content_type: force content-type for the request.
76
+ :type _content_type: str, Optional
77
+ :param _headers: set to override the headers for a single
78
+ request; this effectively ignores the headers
79
+ in the spec for a single request.
80
+ :type _headers: dict, optional
81
+ :param _host_index: set to override the host_index for a single
82
+ request; this effectively ignores the host_index
83
+ in the spec for a single request.
84
+ :type _host_index: int, optional
85
+ :return: Returns the result object.
86
+ """ # noqa: E501
87
+
88
+ _param = self._get_template_fields_serialize(
89
+ template_id=template_id,
90
+ _request_auth=_request_auth,
91
+ _content_type=_content_type,
92
+ _headers=_headers,
93
+ _host_index=_host_index
94
+ )
95
+
96
+ _response_types_map: Dict[str, Optional[str]] = {
97
+ '200': "List[TemplateField]",
98
+ '403': None,
99
+ '404': None,
100
+ '422': "HTTPValidationError",
101
+ }
102
+ response_data = self.api_client.call_api(
103
+ *_param,
104
+ _request_timeout=_request_timeout
105
+ )
106
+ response_data.read()
107
+ return self.api_client.response_deserialize(
108
+ response_data=response_data,
109
+ response_types_map=_response_types_map,
110
+ ).data
111
+
112
+
113
+ @validate_call
114
+ def get_template_fields_with_http_info(
115
+ self,
116
+ template_id: StrictStr,
117
+ _request_timeout: Union[
118
+ None,
119
+ Annotated[StrictFloat, Field(gt=0)],
120
+ Tuple[
121
+ Annotated[StrictFloat, Field(gt=0)],
122
+ Annotated[StrictFloat, Field(gt=0)]
123
+ ]
124
+ ] = None,
125
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
126
+ _content_type: Optional[StrictStr] = None,
127
+ _headers: Optional[Dict[StrictStr, Any]] = None,
128
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
129
+ ) -> ApiResponse[List[TemplateField]]:
130
+ """Get template fields
131
+
132
+ Get the dynamic fields for a template. **Authentication:** API Key required (`x-api-key` header) or JWT token **Usage:** This endpoint is designed for Zapier Dynamic Fields integration. It returns an array of field definitions that Zapier uses to dynamically generate input forms. **Response format:** Array of objects compatible with Zapier InputFieldsSchema. Each field has: `key`, `label`, `type`, `required`, and optional `helpText`. **Field types:** - `string`: Text input (also used for JSON arrays/objects) - `integer`: Integer number - `number`: Decimal number - `boolean`: True/False checkbox **Arrays and objects:** Complex types are returned as `string` type with a `helpText` showing the expected JSON format. **No credits consumed:** This is a read-only endpoint.
133
+
134
+ :param template_id: (required)
135
+ :type template_id: str
136
+ :param _request_timeout: timeout setting for this request. If one
137
+ number provided, it will be total request
138
+ timeout. It can also be a pair (tuple) of
139
+ (connection, read) timeouts.
140
+ :type _request_timeout: int, tuple(int, int), optional
141
+ :param _request_auth: set to override the auth_settings for an a single
142
+ request; this effectively ignores the
143
+ authentication in the spec for a single request.
144
+ :type _request_auth: dict, optional
145
+ :param _content_type: force content-type for the request.
146
+ :type _content_type: str, Optional
147
+ :param _headers: set to override the headers for a single
148
+ request; this effectively ignores the headers
149
+ in the spec for a single request.
150
+ :type _headers: dict, optional
151
+ :param _host_index: set to override the host_index for a single
152
+ request; this effectively ignores the host_index
153
+ in the spec for a single request.
154
+ :type _host_index: int, optional
155
+ :return: Returns the result object.
156
+ """ # noqa: E501
157
+
158
+ _param = self._get_template_fields_serialize(
159
+ template_id=template_id,
160
+ _request_auth=_request_auth,
161
+ _content_type=_content_type,
162
+ _headers=_headers,
163
+ _host_index=_host_index
164
+ )
165
+
166
+ _response_types_map: Dict[str, Optional[str]] = {
167
+ '200': "List[TemplateField]",
168
+ '403': None,
169
+ '404': None,
170
+ '422': "HTTPValidationError",
171
+ }
172
+ response_data = self.api_client.call_api(
173
+ *_param,
174
+ _request_timeout=_request_timeout
175
+ )
176
+ response_data.read()
177
+ return self.api_client.response_deserialize(
178
+ response_data=response_data,
179
+ response_types_map=_response_types_map,
180
+ )
181
+
182
+
183
+ @validate_call
184
+ def get_template_fields_without_preload_content(
185
+ self,
186
+ template_id: StrictStr,
187
+ _request_timeout: Union[
188
+ None,
189
+ Annotated[StrictFloat, Field(gt=0)],
190
+ Tuple[
191
+ Annotated[StrictFloat, Field(gt=0)],
192
+ Annotated[StrictFloat, Field(gt=0)]
193
+ ]
194
+ ] = None,
195
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
196
+ _content_type: Optional[StrictStr] = None,
197
+ _headers: Optional[Dict[StrictStr, Any]] = None,
198
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
199
+ ) -> RESTResponseType:
200
+ """Get template fields
201
+
202
+ Get the dynamic fields for a template. **Authentication:** API Key required (`x-api-key` header) or JWT token **Usage:** This endpoint is designed for Zapier Dynamic Fields integration. It returns an array of field definitions that Zapier uses to dynamically generate input forms. **Response format:** Array of objects compatible with Zapier InputFieldsSchema. Each field has: `key`, `label`, `type`, `required`, and optional `helpText`. **Field types:** - `string`: Text input (also used for JSON arrays/objects) - `integer`: Integer number - `number`: Decimal number - `boolean`: True/False checkbox **Arrays and objects:** Complex types are returned as `string` type with a `helpText` showing the expected JSON format. **No credits consumed:** This is a read-only endpoint.
203
+
204
+ :param template_id: (required)
205
+ :type template_id: str
206
+ :param _request_timeout: timeout setting for this request. If one
207
+ number provided, it will be total request
208
+ timeout. It can also be a pair (tuple) of
209
+ (connection, read) timeouts.
210
+ :type _request_timeout: int, tuple(int, int), optional
211
+ :param _request_auth: set to override the auth_settings for an a single
212
+ request; this effectively ignores the
213
+ authentication in the spec for a single request.
214
+ :type _request_auth: dict, optional
215
+ :param _content_type: force content-type for the request.
216
+ :type _content_type: str, Optional
217
+ :param _headers: set to override the headers for a single
218
+ request; this effectively ignores the headers
219
+ in the spec for a single request.
220
+ :type _headers: dict, optional
221
+ :param _host_index: set to override the host_index for a single
222
+ request; this effectively ignores the host_index
223
+ in the spec for a single request.
224
+ :type _host_index: int, optional
225
+ :return: Returns the result object.
226
+ """ # noqa: E501
227
+
228
+ _param = self._get_template_fields_serialize(
229
+ template_id=template_id,
230
+ _request_auth=_request_auth,
231
+ _content_type=_content_type,
232
+ _headers=_headers,
233
+ _host_index=_host_index
234
+ )
235
+
236
+ _response_types_map: Dict[str, Optional[str]] = {
237
+ '200': "List[TemplateField]",
238
+ '403': None,
239
+ '404': None,
240
+ '422': "HTTPValidationError",
241
+ }
242
+ response_data = self.api_client.call_api(
243
+ *_param,
244
+ _request_timeout=_request_timeout
245
+ )
246
+ return response_data.response
247
+
248
+
249
+ def _get_template_fields_serialize(
250
+ self,
251
+ template_id,
252
+ _request_auth,
253
+ _content_type,
254
+ _headers,
255
+ _host_index,
256
+ ) -> RequestSerialized:
257
+
258
+ _host = None
259
+
260
+ _collection_formats: Dict[str, str] = {
261
+ }
262
+
263
+ _path_params: Dict[str, str] = {}
264
+ _query_params: List[Tuple[str, str]] = []
265
+ _header_params: Dict[str, Optional[str]] = _headers or {}
266
+ _form_params: List[Tuple[str, str]] = []
267
+ _files: Dict[
268
+ str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
269
+ ] = {}
270
+ _body_params: Optional[bytes] = None
271
+
272
+ # process the path parameters
273
+ if template_id is not None:
274
+ _path_params['template_id'] = template_id
275
+ # process the query parameters
276
+ # process the header parameters
277
+ # process the form parameters
278
+ # process the body parameter
279
+
280
+
281
+ # set the HTTP header `Accept`
282
+ if 'Accept' not in _header_params:
283
+ _header_params['Accept'] = self.api_client.select_header_accept(
284
+ [
285
+ 'application/json'
286
+ ]
287
+ )
288
+
289
+
290
+ # authentication setting
291
+ _auth_settings: List[str] = [
292
+ 'ApiKeyAuth'
293
+ ]
294
+
295
+ return self.api_client.param_serialize(
296
+ method='GET',
297
+ resource_path='/v1/templates/{template_id}/fields',
298
+ path_params=_path_params,
299
+ query_params=_query_params,
300
+ header_params=_header_params,
301
+ body=_body_params,
302
+ post_params=_form_params,
303
+ files=_files,
304
+ auth_settings=_auth_settings,
305
+ collection_formats=_collection_formats,
306
+ _host=_host,
307
+ _request_auth=_request_auth
308
+ )
309
+
310
+
311
+
312
+
313
+ @validate_call
314
+ def list_templates(
315
+ self,
316
+ _request_timeout: Union[
317
+ None,
318
+ Annotated[StrictFloat, Field(gt=0)],
319
+ Tuple[
320
+ Annotated[StrictFloat, Field(gt=0)],
321
+ Annotated[StrictFloat, Field(gt=0)]
322
+ ]
323
+ ] = None,
324
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
325
+ _content_type: Optional[StrictStr] = None,
326
+ _headers: Optional[Dict[StrictStr, Any]] = None,
327
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
328
+ ) -> TemplatesListResponse:
329
+ """List templates
330
+
331
+ List all templates for the authenticated user. **Authentication:** API Key required (`x-api-key` header) or JWT token **Usage:** This endpoint is designed for no-code tools (Zapier, Make, n8n) to populate template selection dropdowns. **No credits consumed:** This is a read-only endpoint.
332
+
333
+ :param _request_timeout: timeout setting for this request. If one
334
+ number provided, it will be total request
335
+ timeout. It can also be a pair (tuple) of
336
+ (connection, read) timeouts.
337
+ :type _request_timeout: int, tuple(int, int), optional
338
+ :param _request_auth: set to override the auth_settings for an a single
339
+ request; this effectively ignores the
340
+ authentication in the spec for a single request.
341
+ :type _request_auth: dict, optional
342
+ :param _content_type: force content-type for the request.
343
+ :type _content_type: str, Optional
344
+ :param _headers: set to override the headers for a single
345
+ request; this effectively ignores the headers
346
+ in the spec for a single request.
347
+ :type _headers: dict, optional
348
+ :param _host_index: set to override the host_index for a single
349
+ request; this effectively ignores the host_index
350
+ in the spec for a single request.
351
+ :type _host_index: int, optional
352
+ :return: Returns the result object.
353
+ """ # noqa: E501
354
+
355
+ _param = self._list_templates_serialize(
356
+ _request_auth=_request_auth,
357
+ _content_type=_content_type,
358
+ _headers=_headers,
359
+ _host_index=_host_index
360
+ )
361
+
362
+ _response_types_map: Dict[str, Optional[str]] = {
363
+ '200': "TemplatesListResponse",
364
+ '403': None,
365
+ '422': "HTTPValidationError",
366
+ }
367
+ response_data = self.api_client.call_api(
368
+ *_param,
369
+ _request_timeout=_request_timeout
370
+ )
371
+ response_data.read()
372
+ return self.api_client.response_deserialize(
373
+ response_data=response_data,
374
+ response_types_map=_response_types_map,
375
+ ).data
376
+
377
+
378
+ @validate_call
379
+ def list_templates_with_http_info(
380
+ self,
381
+ _request_timeout: Union[
382
+ None,
383
+ Annotated[StrictFloat, Field(gt=0)],
384
+ Tuple[
385
+ Annotated[StrictFloat, Field(gt=0)],
386
+ Annotated[StrictFloat, Field(gt=0)]
387
+ ]
388
+ ] = None,
389
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
390
+ _content_type: Optional[StrictStr] = None,
391
+ _headers: Optional[Dict[StrictStr, Any]] = None,
392
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
393
+ ) -> ApiResponse[TemplatesListResponse]:
394
+ """List templates
395
+
396
+ List all templates for the authenticated user. **Authentication:** API Key required (`x-api-key` header) or JWT token **Usage:** This endpoint is designed for no-code tools (Zapier, Make, n8n) to populate template selection dropdowns. **No credits consumed:** This is a read-only endpoint.
397
+
398
+ :param _request_timeout: timeout setting for this request. If one
399
+ number provided, it will be total request
400
+ timeout. It can also be a pair (tuple) of
401
+ (connection, read) timeouts.
402
+ :type _request_timeout: int, tuple(int, int), optional
403
+ :param _request_auth: set to override the auth_settings for an a single
404
+ request; this effectively ignores the
405
+ authentication in the spec for a single request.
406
+ :type _request_auth: dict, optional
407
+ :param _content_type: force content-type for the request.
408
+ :type _content_type: str, Optional
409
+ :param _headers: set to override the headers for a single
410
+ request; this effectively ignores the headers
411
+ in the spec for a single request.
412
+ :type _headers: dict, optional
413
+ :param _host_index: set to override the host_index for a single
414
+ request; this effectively ignores the host_index
415
+ in the spec for a single request.
416
+ :type _host_index: int, optional
417
+ :return: Returns the result object.
418
+ """ # noqa: E501
419
+
420
+ _param = self._list_templates_serialize(
421
+ _request_auth=_request_auth,
422
+ _content_type=_content_type,
423
+ _headers=_headers,
424
+ _host_index=_host_index
425
+ )
426
+
427
+ _response_types_map: Dict[str, Optional[str]] = {
428
+ '200': "TemplatesListResponse",
429
+ '403': None,
430
+ '422': "HTTPValidationError",
431
+ }
432
+ response_data = self.api_client.call_api(
433
+ *_param,
434
+ _request_timeout=_request_timeout
435
+ )
436
+ response_data.read()
437
+ return self.api_client.response_deserialize(
438
+ response_data=response_data,
439
+ response_types_map=_response_types_map,
440
+ )
441
+
442
+
443
+ @validate_call
444
+ def list_templates_without_preload_content(
445
+ self,
446
+ _request_timeout: Union[
447
+ None,
448
+ Annotated[StrictFloat, Field(gt=0)],
449
+ Tuple[
450
+ Annotated[StrictFloat, Field(gt=0)],
451
+ Annotated[StrictFloat, Field(gt=0)]
452
+ ]
453
+ ] = None,
454
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
455
+ _content_type: Optional[StrictStr] = None,
456
+ _headers: Optional[Dict[StrictStr, Any]] = None,
457
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
458
+ ) -> RESTResponseType:
459
+ """List templates
460
+
461
+ List all templates for the authenticated user. **Authentication:** API Key required (`x-api-key` header) or JWT token **Usage:** This endpoint is designed for no-code tools (Zapier, Make, n8n) to populate template selection dropdowns. **No credits consumed:** This is a read-only endpoint.
462
+
463
+ :param _request_timeout: timeout setting for this request. If one
464
+ number provided, it will be total request
465
+ timeout. It can also be a pair (tuple) of
466
+ (connection, read) timeouts.
467
+ :type _request_timeout: int, tuple(int, int), optional
468
+ :param _request_auth: set to override the auth_settings for an a single
469
+ request; this effectively ignores the
470
+ authentication in the spec for a single request.
471
+ :type _request_auth: dict, optional
472
+ :param _content_type: force content-type for the request.
473
+ :type _content_type: str, Optional
474
+ :param _headers: set to override the headers for a single
475
+ request; this effectively ignores the headers
476
+ in the spec for a single request.
477
+ :type _headers: dict, optional
478
+ :param _host_index: set to override the host_index for a single
479
+ request; this effectively ignores the host_index
480
+ in the spec for a single request.
481
+ :type _host_index: int, optional
482
+ :return: Returns the result object.
483
+ """ # noqa: E501
484
+
485
+ _param = self._list_templates_serialize(
486
+ _request_auth=_request_auth,
487
+ _content_type=_content_type,
488
+ _headers=_headers,
489
+ _host_index=_host_index
490
+ )
491
+
492
+ _response_types_map: Dict[str, Optional[str]] = {
493
+ '200': "TemplatesListResponse",
494
+ '403': None,
495
+ '422': "HTTPValidationError",
496
+ }
497
+ response_data = self.api_client.call_api(
498
+ *_param,
499
+ _request_timeout=_request_timeout
500
+ )
501
+ return response_data.response
502
+
503
+
504
+ def _list_templates_serialize(
505
+ self,
506
+ _request_auth,
507
+ _content_type,
508
+ _headers,
509
+ _host_index,
510
+ ) -> RequestSerialized:
511
+
512
+ _host = None
513
+
514
+ _collection_formats: Dict[str, str] = {
515
+ }
516
+
517
+ _path_params: Dict[str, str] = {}
518
+ _query_params: List[Tuple[str, str]] = []
519
+ _header_params: Dict[str, Optional[str]] = _headers or {}
520
+ _form_params: List[Tuple[str, str]] = []
521
+ _files: Dict[
522
+ str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
523
+ ] = {}
524
+ _body_params: Optional[bytes] = None
525
+
526
+ # process the path parameters
527
+ # process the query parameters
528
+ # process the header parameters
529
+ # process the form parameters
530
+ # process the body parameter
531
+
532
+
533
+ # set the HTTP header `Accept`
534
+ if 'Accept' not in _header_params:
535
+ _header_params['Accept'] = self.api_client.select_header_accept(
536
+ [
537
+ 'application/json'
538
+ ]
539
+ )
540
+
541
+
542
+ # authentication setting
543
+ _auth_settings: List[str] = [
544
+ 'ApiKeyAuth'
545
+ ]
546
+
547
+ return self.api_client.param_serialize(
548
+ method='GET',
549
+ resource_path='/v1/templates',
550
+ path_params=_path_params,
551
+ query_params=_query_params,
552
+ header_params=_header_params,
553
+ body=_body_params,
554
+ post_params=_form_params,
555
+ files=_files,
556
+ auth_settings=_auth_settings,
557
+ collection_formats=_collection_formats,
558
+ _host=_host,
559
+ _request_auth=_request_auth
560
+ )
561
+
562
+