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,96 @@
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
+
16
+ from __future__ import annotations
17
+ import pprint
18
+ import re # noqa: F401
19
+ import json
20
+
21
+ from pydantic import BaseModel, ConfigDict
22
+ from typing import Any, ClassVar, Dict, List, Optional
23
+ from templatefox.models.validation_error import ValidationError
24
+ from typing import Optional, Set
25
+ from typing_extensions import Self
26
+
27
+ class HTTPValidationError(BaseModel):
28
+ """
29
+ HTTPValidationError
30
+ """ # noqa: E501
31
+ detail: Optional[List[ValidationError]] = None
32
+ __properties: ClassVar[List[str]] = ["detail"]
33
+
34
+ model_config = ConfigDict(
35
+ populate_by_name=True,
36
+ validate_assignment=True,
37
+ protected_namespaces=(),
38
+ )
39
+
40
+
41
+ def to_str(self) -> str:
42
+ """Returns the string representation of the model using alias"""
43
+ return pprint.pformat(self.model_dump(by_alias=True))
44
+
45
+ def to_json(self) -> str:
46
+ """Returns the JSON representation of the model using alias"""
47
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
48
+ return json.dumps(self.to_dict())
49
+
50
+ @classmethod
51
+ def from_json(cls, json_str: str) -> Optional[Self]:
52
+ """Create an instance of HTTPValidationError from a JSON string"""
53
+ return cls.from_dict(json.loads(json_str))
54
+
55
+ def to_dict(self) -> Dict[str, Any]:
56
+ """Return the dictionary representation of the model using alias.
57
+
58
+ This has the following differences from calling pydantic's
59
+ `self.model_dump(by_alias=True)`:
60
+
61
+ * `None` is only added to the output dict for nullable fields that
62
+ were set at model initialization. Other fields with value `None`
63
+ are ignored.
64
+ """
65
+ excluded_fields: Set[str] = set([
66
+ ])
67
+
68
+ _dict = self.model_dump(
69
+ by_alias=True,
70
+ exclude=excluded_fields,
71
+ exclude_none=True,
72
+ )
73
+ # override the default output from pydantic by calling `to_dict()` of each item in detail (list)
74
+ _items = []
75
+ if self.detail:
76
+ for _item_detail in self.detail:
77
+ if _item_detail:
78
+ _items.append(_item_detail.to_dict())
79
+ _dict['detail'] = _items
80
+ return _dict
81
+
82
+ @classmethod
83
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
84
+ """Create an instance of HTTPValidationError from a dict"""
85
+ if obj is None:
86
+ return None
87
+
88
+ if not isinstance(obj, dict):
89
+ return cls.model_validate(obj)
90
+
91
+ _obj = cls.model_validate({
92
+ "detail": [ValidationError.from_dict(_item) for _item in obj["detail"]] if obj.get("detail") is not None else None
93
+ })
94
+ return _obj
95
+
96
+
@@ -0,0 +1,139 @@
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
+
16
+ from __future__ import annotations
17
+ from inspect import getfullargspec
18
+ import json
19
+ import pprint
20
+ import re # noqa: F401
21
+ from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr, ValidationError, field_validator
22
+ from typing import Optional
23
+ from typing import Union, Any, List, Set, TYPE_CHECKING, Optional, Dict
24
+ from typing_extensions import Literal, Self
25
+ from pydantic import Field
26
+
27
+ LOCATIONINNER_ANY_OF_SCHEMAS = ["int", "str"]
28
+
29
+ class LocationInner(BaseModel):
30
+ """
31
+ LocationInner
32
+ """
33
+
34
+ # data type: str
35
+ anyof_schema_1_validator: Optional[StrictStr] = None
36
+ # data type: int
37
+ anyof_schema_2_validator: Optional[StrictInt] = None
38
+ if TYPE_CHECKING:
39
+ actual_instance: Optional[Union[int, str]] = None
40
+ else:
41
+ actual_instance: Any = None
42
+ any_of_schemas: Set[str] = { "int", "str" }
43
+
44
+ model_config = {
45
+ "validate_assignment": True,
46
+ "protected_namespaces": (),
47
+ }
48
+
49
+ def __init__(self, *args, **kwargs) -> None:
50
+ if args:
51
+ if len(args) > 1:
52
+ raise ValueError("If a position argument is used, only 1 is allowed to set `actual_instance`")
53
+ if kwargs:
54
+ raise ValueError("If a position argument is used, keyword arguments cannot be used.")
55
+ super().__init__(actual_instance=args[0])
56
+ else:
57
+ super().__init__(**kwargs)
58
+
59
+ @field_validator('actual_instance')
60
+ def actual_instance_must_validate_anyof(cls, v):
61
+ instance = LocationInner.model_construct()
62
+ error_messages = []
63
+ # validate data type: str
64
+ try:
65
+ instance.anyof_schema_1_validator = v
66
+ return v
67
+ except (ValidationError, ValueError) as e:
68
+ error_messages.append(str(e))
69
+ # validate data type: int
70
+ try:
71
+ instance.anyof_schema_2_validator = v
72
+ return v
73
+ except (ValidationError, ValueError) as e:
74
+ error_messages.append(str(e))
75
+ if error_messages:
76
+ # no match
77
+ raise ValueError("No match found when setting the actual_instance in LocationInner with anyOf schemas: int, str. Details: " + ", ".join(error_messages))
78
+ else:
79
+ return v
80
+
81
+ @classmethod
82
+ def from_dict(cls, obj: Dict[str, Any]) -> Self:
83
+ return cls.from_json(json.dumps(obj))
84
+
85
+ @classmethod
86
+ def from_json(cls, json_str: str) -> Self:
87
+ """Returns the object represented by the json string"""
88
+ instance = cls.model_construct()
89
+ error_messages = []
90
+ # deserialize data into str
91
+ try:
92
+ # validation
93
+ instance.anyof_schema_1_validator = json.loads(json_str)
94
+ # assign value to actual_instance
95
+ instance.actual_instance = instance.anyof_schema_1_validator
96
+ return instance
97
+ except (ValidationError, ValueError) as e:
98
+ error_messages.append(str(e))
99
+ # deserialize data into int
100
+ try:
101
+ # validation
102
+ instance.anyof_schema_2_validator = json.loads(json_str)
103
+ # assign value to actual_instance
104
+ instance.actual_instance = instance.anyof_schema_2_validator
105
+ return instance
106
+ except (ValidationError, ValueError) as e:
107
+ error_messages.append(str(e))
108
+
109
+ if error_messages:
110
+ # no match
111
+ raise ValueError("No match found when deserializing the JSON string into LocationInner with anyOf schemas: int, str. Details: " + ", ".join(error_messages))
112
+ else:
113
+ return instance
114
+
115
+ def to_json(self) -> str:
116
+ """Returns the JSON representation of the actual instance"""
117
+ if self.actual_instance is None:
118
+ return "null"
119
+
120
+ if hasattr(self.actual_instance, "to_json") and callable(self.actual_instance.to_json):
121
+ return self.actual_instance.to_json()
122
+ else:
123
+ return json.dumps(self.actual_instance)
124
+
125
+ def to_dict(self) -> Optional[Union[Dict[str, Any], int, str]]:
126
+ """Returns the dict representation of the actual instance"""
127
+ if self.actual_instance is None:
128
+ return None
129
+
130
+ if hasattr(self.actual_instance, "to_dict") and callable(self.actual_instance.to_dict):
131
+ return self.actual_instance.to_dict()
132
+ else:
133
+ return self.actual_instance
134
+
135
+ def to_str(self) -> str:
136
+ """Returns the string representation of the actual instance"""
137
+ return pprint.pformat(self.model_dump())
138
+
139
+
@@ -0,0 +1,126 @@
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
+
16
+ from __future__ import annotations
17
+ import pprint
18
+ import re # noqa: F401
19
+ import json
20
+
21
+ from pydantic import BaseModel, ConfigDict, Field, field_validator
22
+ from typing import Any, ClassVar, Dict, List, Optional
23
+ from typing_extensions import Annotated
24
+ from typing import Optional, Set
25
+ from typing_extensions import Self
26
+
27
+ class S3ConfigRequest(BaseModel):
28
+ """
29
+ Request model for S3 configuration
30
+ """ # noqa: E501
31
+ endpoint_url: Annotated[str, Field(min_length=10, strict=True, max_length=200)] = Field(description="S3-compatible endpoint URL. Must start with https://")
32
+ access_key_id: Annotated[str, Field(min_length=16, strict=True, max_length=128)] = Field(description="Access key ID for S3 authentication")
33
+ secret_access_key: Optional[Annotated[str, Field(min_length=16, strict=True, max_length=128)]] = None
34
+ bucket_name: Annotated[str, Field(min_length=3, strict=True, max_length=63)] = Field(description="S3 bucket name. Must follow S3 naming conventions (lowercase, no underscores)")
35
+ default_prefix: Optional[Annotated[str, Field(strict=True, max_length=500)]] = Field(default='', description="Default path prefix for uploaded files. Can include slashes for folder structure")
36
+ __properties: ClassVar[List[str]] = ["endpoint_url", "access_key_id", "secret_access_key", "bucket_name", "default_prefix"]
37
+
38
+ @field_validator('endpoint_url')
39
+ def endpoint_url_validate_regular_expression(cls, value):
40
+ """Validates the regular expression"""
41
+ if not re.match(r"^https:\/\/", value):
42
+ raise ValueError(r"must validate the regular expression /^https:\/\//")
43
+ return value
44
+
45
+ @field_validator('bucket_name')
46
+ def bucket_name_validate_regular_expression(cls, value):
47
+ """Validates the regular expression"""
48
+ if not re.match(r"^[a-z0-9][a-z0-9.\-]*[a-z0-9]$", value):
49
+ raise ValueError(r"must validate the regular expression /^[a-z0-9][a-z0-9.\-]*[a-z0-9]$/")
50
+ return value
51
+
52
+ @field_validator('default_prefix')
53
+ def default_prefix_validate_regular_expression(cls, value):
54
+ """Validates the regular expression"""
55
+ if value is None:
56
+ return value
57
+
58
+ if not re.match(r"^[a-zA-Z0-9_\-\.\/]*$", value):
59
+ raise ValueError(r"must validate the regular expression /^[a-zA-Z0-9_\-\.\/]*$/")
60
+ return value
61
+
62
+ model_config = ConfigDict(
63
+ populate_by_name=True,
64
+ validate_assignment=True,
65
+ protected_namespaces=(),
66
+ )
67
+
68
+
69
+ def to_str(self) -> str:
70
+ """Returns the string representation of the model using alias"""
71
+ return pprint.pformat(self.model_dump(by_alias=True))
72
+
73
+ def to_json(self) -> str:
74
+ """Returns the JSON representation of the model using alias"""
75
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
76
+ return json.dumps(self.to_dict())
77
+
78
+ @classmethod
79
+ def from_json(cls, json_str: str) -> Optional[Self]:
80
+ """Create an instance of S3ConfigRequest from a JSON string"""
81
+ return cls.from_dict(json.loads(json_str))
82
+
83
+ def to_dict(self) -> Dict[str, Any]:
84
+ """Return the dictionary representation of the model using alias.
85
+
86
+ This has the following differences from calling pydantic's
87
+ `self.model_dump(by_alias=True)`:
88
+
89
+ * `None` is only added to the output dict for nullable fields that
90
+ were set at model initialization. Other fields with value `None`
91
+ are ignored.
92
+ """
93
+ excluded_fields: Set[str] = set([
94
+ ])
95
+
96
+ _dict = self.model_dump(
97
+ by_alias=True,
98
+ exclude=excluded_fields,
99
+ exclude_none=True,
100
+ )
101
+ # set to None if secret_access_key (nullable) is None
102
+ # and model_fields_set contains the field
103
+ if self.secret_access_key is None and "secret_access_key" in self.model_fields_set:
104
+ _dict['secret_access_key'] = None
105
+
106
+ return _dict
107
+
108
+ @classmethod
109
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
110
+ """Create an instance of S3ConfigRequest from a dict"""
111
+ if obj is None:
112
+ return None
113
+
114
+ if not isinstance(obj, dict):
115
+ return cls.model_validate(obj)
116
+
117
+ _obj = cls.model_validate({
118
+ "endpoint_url": obj.get("endpoint_url"),
119
+ "access_key_id": obj.get("access_key_id"),
120
+ "secret_access_key": obj.get("secret_access_key"),
121
+ "bucket_name": obj.get("bucket_name"),
122
+ "default_prefix": obj.get("default_prefix") if obj.get("default_prefix") is not None else ''
123
+ })
124
+ return _obj
125
+
126
+
@@ -0,0 +1,98 @@
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
+
16
+ from __future__ import annotations
17
+ import pprint
18
+ import re # noqa: F401
19
+ import json
20
+
21
+ from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictStr
22
+ from typing import Any, ClassVar, Dict, List
23
+ from typing import Optional, Set
24
+ from typing_extensions import Self
25
+
26
+ class S3ConfigResponse(BaseModel):
27
+ """
28
+ Response for S3 configuration (with masked secret)
29
+ """ # noqa: E501
30
+ configured: StrictBool = Field(description="Whether S3 is configured")
31
+ endpoint_url: StrictStr = Field(description="S3-compatible endpoint URL")
32
+ access_key_id: StrictStr = Field(description="Access key ID")
33
+ secret_access_key_masked: StrictStr = Field(description="Masked secret access key (shows first 4 and last 4 characters)")
34
+ bucket_name: StrictStr = Field(description="S3 bucket name")
35
+ default_prefix: StrictStr = Field(description="Default path prefix for uploads")
36
+ __properties: ClassVar[List[str]] = ["configured", "endpoint_url", "access_key_id", "secret_access_key_masked", "bucket_name", "default_prefix"]
37
+
38
+ model_config = ConfigDict(
39
+ populate_by_name=True,
40
+ validate_assignment=True,
41
+ protected_namespaces=(),
42
+ )
43
+
44
+
45
+ def to_str(self) -> str:
46
+ """Returns the string representation of the model using alias"""
47
+ return pprint.pformat(self.model_dump(by_alias=True))
48
+
49
+ def to_json(self) -> str:
50
+ """Returns the JSON representation of the model using alias"""
51
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
52
+ return json.dumps(self.to_dict())
53
+
54
+ @classmethod
55
+ def from_json(cls, json_str: str) -> Optional[Self]:
56
+ """Create an instance of S3ConfigResponse from a JSON string"""
57
+ return cls.from_dict(json.loads(json_str))
58
+
59
+ def to_dict(self) -> Dict[str, Any]:
60
+ """Return the dictionary representation of the model using alias.
61
+
62
+ This has the following differences from calling pydantic's
63
+ `self.model_dump(by_alias=True)`:
64
+
65
+ * `None` is only added to the output dict for nullable fields that
66
+ were set at model initialization. Other fields with value `None`
67
+ are ignored.
68
+ """
69
+ excluded_fields: Set[str] = set([
70
+ ])
71
+
72
+ _dict = self.model_dump(
73
+ by_alias=True,
74
+ exclude=excluded_fields,
75
+ exclude_none=True,
76
+ )
77
+ return _dict
78
+
79
+ @classmethod
80
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
81
+ """Create an instance of S3ConfigResponse from a dict"""
82
+ if obj is None:
83
+ return None
84
+
85
+ if not isinstance(obj, dict):
86
+ return cls.model_validate(obj)
87
+
88
+ _obj = cls.model_validate({
89
+ "configured": obj.get("configured"),
90
+ "endpoint_url": obj.get("endpoint_url"),
91
+ "access_key_id": obj.get("access_key_id"),
92
+ "secret_access_key_masked": obj.get("secret_access_key_masked"),
93
+ "bucket_name": obj.get("bucket_name"),
94
+ "default_prefix": obj.get("default_prefix")
95
+ })
96
+ return _obj
97
+
98
+
@@ -0,0 +1,88 @@
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
+
16
+ from __future__ import annotations
17
+ import pprint
18
+ import re # noqa: F401
19
+ import json
20
+
21
+ from pydantic import BaseModel, ConfigDict, Field, StrictBool
22
+ from typing import Any, ClassVar, Dict, List
23
+ from typing import Optional, Set
24
+ from typing_extensions import Self
25
+
26
+ class S3SuccessResponse(BaseModel):
27
+ """
28
+ Generic success response for S3 operations
29
+ """ # noqa: E501
30
+ success: StrictBool = Field(description="Whether the operation succeeded")
31
+ __properties: ClassVar[List[str]] = ["success"]
32
+
33
+ model_config = ConfigDict(
34
+ populate_by_name=True,
35
+ validate_assignment=True,
36
+ protected_namespaces=(),
37
+ )
38
+
39
+
40
+ def to_str(self) -> str:
41
+ """Returns the string representation of the model using alias"""
42
+ return pprint.pformat(self.model_dump(by_alias=True))
43
+
44
+ def to_json(self) -> str:
45
+ """Returns the JSON representation of the model using alias"""
46
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
47
+ return json.dumps(self.to_dict())
48
+
49
+ @classmethod
50
+ def from_json(cls, json_str: str) -> Optional[Self]:
51
+ """Create an instance of S3SuccessResponse from a JSON string"""
52
+ return cls.from_dict(json.loads(json_str))
53
+
54
+ def to_dict(self) -> Dict[str, Any]:
55
+ """Return the dictionary representation of the model using alias.
56
+
57
+ This has the following differences from calling pydantic's
58
+ `self.model_dump(by_alias=True)`:
59
+
60
+ * `None` is only added to the output dict for nullable fields that
61
+ were set at model initialization. Other fields with value `None`
62
+ are ignored.
63
+ """
64
+ excluded_fields: Set[str] = set([
65
+ ])
66
+
67
+ _dict = self.model_dump(
68
+ by_alias=True,
69
+ exclude=excluded_fields,
70
+ exclude_none=True,
71
+ )
72
+ return _dict
73
+
74
+ @classmethod
75
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
76
+ """Create an instance of S3SuccessResponse from a dict"""
77
+ if obj is None:
78
+ return None
79
+
80
+ if not isinstance(obj, dict):
81
+ return cls.model_validate(obj)
82
+
83
+ _obj = cls.model_validate({
84
+ "success": obj.get("success")
85
+ })
86
+ return _obj
87
+
88
+
@@ -0,0 +1,90 @@
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
+
16
+ from __future__ import annotations
17
+ import pprint
18
+ import re # noqa: F401
19
+ import json
20
+
21
+ from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictStr
22
+ from typing import Any, ClassVar, Dict, List
23
+ from typing import Optional, Set
24
+ from typing_extensions import Self
25
+
26
+ class S3TestResponse(BaseModel):
27
+ """
28
+ Response for S3 connection test
29
+ """ # noqa: E501
30
+ success: StrictBool = Field(description="Whether the connection test succeeded")
31
+ message: StrictStr = Field(description="Test result message")
32
+ __properties: ClassVar[List[str]] = ["success", "message"]
33
+
34
+ model_config = ConfigDict(
35
+ populate_by_name=True,
36
+ validate_assignment=True,
37
+ protected_namespaces=(),
38
+ )
39
+
40
+
41
+ def to_str(self) -> str:
42
+ """Returns the string representation of the model using alias"""
43
+ return pprint.pformat(self.model_dump(by_alias=True))
44
+
45
+ def to_json(self) -> str:
46
+ """Returns the JSON representation of the model using alias"""
47
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
48
+ return json.dumps(self.to_dict())
49
+
50
+ @classmethod
51
+ def from_json(cls, json_str: str) -> Optional[Self]:
52
+ """Create an instance of S3TestResponse from a JSON string"""
53
+ return cls.from_dict(json.loads(json_str))
54
+
55
+ def to_dict(self) -> Dict[str, Any]:
56
+ """Return the dictionary representation of the model using alias.
57
+
58
+ This has the following differences from calling pydantic's
59
+ `self.model_dump(by_alias=True)`:
60
+
61
+ * `None` is only added to the output dict for nullable fields that
62
+ were set at model initialization. Other fields with value `None`
63
+ are ignored.
64
+ """
65
+ excluded_fields: Set[str] = set([
66
+ ])
67
+
68
+ _dict = self.model_dump(
69
+ by_alias=True,
70
+ exclude=excluded_fields,
71
+ exclude_none=True,
72
+ )
73
+ return _dict
74
+
75
+ @classmethod
76
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
77
+ """Create an instance of S3TestResponse from a dict"""
78
+ if obj is None:
79
+ return None
80
+
81
+ if not isinstance(obj, dict):
82
+ return cls.model_validate(obj)
83
+
84
+ _obj = cls.model_validate({
85
+ "success": obj.get("success"),
86
+ "message": obj.get("message")
87
+ })
88
+ return _obj
89
+
90
+