Skip to content

Commit 5c12be6

Browse files
feat: updated api code according to recent spec
1 parent 8354d0f commit 5c12be6

9 files changed

Lines changed: 534 additions & 0 deletions
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# AllocationsData
2+
3+
4+
## Properties
5+
6+
Name | Type | Description | Notes
7+
------------ | ------------- | ------------- | -------------
8+
**receipt_id** | **int** | | [optional]
9+
**source_id** | **int** | | [optional]
10+
**source_identifier** | **str** | | [optional]
11+
**source_kind** | [**SourceKind**](SourceKind.md) | | [optional]
12+
**allocations** | [**List[SingleAllocation]**](SingleAllocation.md) | | [optional]
13+
14+
## Example
15+
16+
```python
17+
from cloudbeds_fiscal_document.models.allocations_data import AllocationsData
18+
19+
# TODO update the JSON string below
20+
json = "{}"
21+
# create an instance of AllocationsData from a JSON string
22+
allocations_data_instance = AllocationsData.from_json(json)
23+
# print the JSON string representation of the object
24+
print(AllocationsData.to_json())
25+
26+
# convert the object into a dict
27+
allocations_data_dict = allocations_data_instance.to_dict()
28+
# create an instance of AllocationsData from a dict
29+
allocations_data_from_dict = AllocationsData.from_dict(allocations_data_dict)
30+
```
31+
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
32+
33+
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# FiscalDocumentTransactionAllocation
2+
3+
4+
## Properties
5+
6+
Name | Type | Description | Notes
7+
------------ | ------------- | ------------- | -------------
8+
**receipt_number** | **str** | | [optional]
9+
10+
## Example
11+
12+
```python
13+
from cloudbeds_fiscal_document.models.fiscal_document_transaction_allocation import FiscalDocumentTransactionAllocation
14+
15+
# TODO update the JSON string below
16+
json = "{}"
17+
# create an instance of FiscalDocumentTransactionAllocation from a JSON string
18+
fiscal_document_transaction_allocation_instance = FiscalDocumentTransactionAllocation.from_json(json)
19+
# print the JSON string representation of the object
20+
print(FiscalDocumentTransactionAllocation.to_json())
21+
22+
# convert the object into a dict
23+
fiscal_document_transaction_allocation_dict = fiscal_document_transaction_allocation_instance.to_dict()
24+
# create an instance of FiscalDocumentTransactionAllocation from a dict
25+
fiscal_document_transaction_allocation_from_dict = FiscalDocumentTransactionAllocation.from_dict(fiscal_document_transaction_allocation_dict)
26+
```
27+
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
28+
29+
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# SingleAllocation
2+
3+
4+
## Properties
5+
6+
Name | Type | Description | Notes
7+
------------ | ------------- | ------------- | -------------
8+
**transaction_id** | **int** | | [optional]
9+
**allocated_amount** | **float** | | [optional]
10+
11+
## Example
12+
13+
```python
14+
from cloudbeds_fiscal_document.models.single_allocation import SingleAllocation
15+
16+
# TODO update the JSON string below
17+
json = "{}"
18+
# create an instance of SingleAllocation from a JSON string
19+
single_allocation_instance = SingleAllocation.from_json(json)
20+
# print the JSON string representation of the object
21+
print(SingleAllocation.to_json())
22+
23+
# convert the object into a dict
24+
single_allocation_dict = single_allocation_instance.to_dict()
25+
# create an instance of SingleAllocation from a dict
26+
single_allocation_from_dict = SingleAllocation.from_dict(single_allocation_dict)
27+
```
28+
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
29+
30+
Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
# coding: utf-8
2+
3+
"""
4+
Fiscal document service API
5+
6+
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
7+
8+
The version of the OpenAPI document: v1
9+
Generated by OpenAPI Generator (https://openapi-generator.tech)
10+
11+
Do not edit the class manually.
12+
""" # noqa: E501
13+
14+
15+
from __future__ import annotations
16+
import pprint
17+
import re # noqa: F401
18+
import json
19+
20+
from pydantic import BaseModel, ConfigDict, StrictInt, StrictStr
21+
from typing import Any, ClassVar, Dict, List, Optional
22+
from cloudbeds_fiscal_document.models.single_allocation import SingleAllocation
23+
from cloudbeds_fiscal_document.models.source_kind import SourceKind
24+
from typing import Optional, Set
25+
from typing_extensions import Self
26+
27+
class AllocationsData(BaseModel):
28+
"""
29+
AllocationsData
30+
""" # noqa: E501
31+
receipt_id: Optional[StrictInt] = None
32+
source_id: Optional[StrictInt] = None
33+
source_identifier: Optional[StrictStr] = None
34+
source_kind: Optional[SourceKind] = None
35+
allocations: Optional[List[SingleAllocation]] = None
36+
__properties: ClassVar[List[str]] = ["receipt_id", "source_id", "source_identifier", "source_kind", "allocations"]
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 AllocationsData 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+
# override the default output from pydantic by calling `to_dict()` of each item in allocations (list)
78+
_items = []
79+
if self.allocations:
80+
for _item_allocations in self.allocations:
81+
if _item_allocations:
82+
_items.append(_item_allocations.to_dict())
83+
_dict['allocations'] = _items
84+
return _dict
85+
86+
@classmethod
87+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
88+
"""Create an instance of AllocationsData from a dict"""
89+
if obj is None:
90+
return None
91+
92+
if not isinstance(obj, dict):
93+
return cls.model_validate(obj)
94+
95+
_obj = cls.model_validate({
96+
"receipt_id": obj.get("receipt_id"),
97+
"source_id": obj.get("source_id"),
98+
"source_identifier": obj.get("source_identifier"),
99+
"source_kind": obj.get("source_kind"),
100+
"allocations": [SingleAllocation.from_dict(_item) for _item in obj["allocations"]] if obj.get("allocations") is not None else None
101+
})
102+
return _obj
103+
104+
Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
# coding: utf-8
2+
3+
"""
4+
Fiscal document service API
5+
6+
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
7+
8+
The version of the OpenAPI document: v1
9+
Generated by OpenAPI Generator (https://openapi-generator.tech)
10+
11+
Do not edit the class manually.
12+
""" # noqa: E501
13+
14+
15+
from __future__ import annotations
16+
import pprint
17+
import re # noqa: F401
18+
import json
19+
20+
from pydantic import BaseModel, ConfigDict, Field, StrictStr
21+
from typing import Any, ClassVar, Dict, List, Optional
22+
from typing import Optional, Set
23+
from typing_extensions import Self
24+
25+
class FiscalDocumentTransactionAllocation(BaseModel):
26+
"""
27+
FiscalDocumentTransactionAllocation
28+
""" # noqa: E501
29+
receipt_number: Optional[StrictStr] = Field(default=None, alias="receiptNumber")
30+
__properties: ClassVar[List[str]] = ["receiptNumber"]
31+
32+
model_config = ConfigDict(
33+
populate_by_name=True,
34+
validate_assignment=True,
35+
protected_namespaces=(),
36+
)
37+
38+
39+
def to_str(self) -> str:
40+
"""Returns the string representation of the model using alias"""
41+
return pprint.pformat(self.model_dump(by_alias=True))
42+
43+
def to_json(self) -> str:
44+
"""Returns the JSON representation of the model using alias"""
45+
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
46+
return json.dumps(self.to_dict())
47+
48+
@classmethod
49+
def from_json(cls, json_str: str) -> Optional[Self]:
50+
"""Create an instance of FiscalDocumentTransactionAllocation from a JSON string"""
51+
return cls.from_dict(json.loads(json_str))
52+
53+
def to_dict(self) -> Dict[str, Any]:
54+
"""Return the dictionary representation of the model using alias.
55+
56+
This has the following differences from calling pydantic's
57+
`self.model_dump(by_alias=True)`:
58+
59+
* `None` is only added to the output dict for nullable fields that
60+
were set at model initialization. Other fields with value `None`
61+
are ignored.
62+
"""
63+
excluded_fields: Set[str] = set([
64+
])
65+
66+
_dict = self.model_dump(
67+
by_alias=True,
68+
exclude=excluded_fields,
69+
exclude_none=True,
70+
)
71+
return _dict
72+
73+
@classmethod
74+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
75+
"""Create an instance of FiscalDocumentTransactionAllocation from a dict"""
76+
if obj is None:
77+
return None
78+
79+
if not isinstance(obj, dict):
80+
return cls.model_validate(obj)
81+
82+
_obj = cls.model_validate({
83+
"receiptNumber": obj.get("receiptNumber")
84+
})
85+
return _obj
86+
87+
Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
# coding: utf-8
2+
3+
"""
4+
Fiscal document service API
5+
6+
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
7+
8+
The version of the OpenAPI document: v1
9+
Generated by OpenAPI Generator (https://openapi-generator.tech)
10+
11+
Do not edit the class manually.
12+
""" # noqa: E501
13+
14+
15+
from __future__ import annotations
16+
import pprint
17+
import re # noqa: F401
18+
import json
19+
20+
from pydantic import BaseModel, ConfigDict, StrictFloat, StrictInt
21+
from typing import Any, ClassVar, Dict, List, Optional, Union
22+
from typing import Optional, Set
23+
from typing_extensions import Self
24+
25+
class SingleAllocation(BaseModel):
26+
"""
27+
SingleAllocation
28+
""" # noqa: E501
29+
transaction_id: Optional[StrictInt] = None
30+
allocated_amount: Optional[Union[StrictFloat, StrictInt]] = None
31+
__properties: ClassVar[List[str]] = ["transaction_id", "allocated_amount"]
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 SingleAllocation 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 SingleAllocation 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+
"transaction_id": obj.get("transaction_id"),
85+
"allocated_amount": obj.get("allocated_amount")
86+
})
87+
return _obj
88+
89+

0 commit comments

Comments
 (0)