Skip to content

Commit e4beca3

Browse files
committed
Update python SDK from OpenAPI Generator
1 parent bb55d1d commit e4beca3

12 files changed

+475
-2
lines changed

.openapi-generator/FILES

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,8 @@ docs/HelloAssoApiV5ModelsEnumsSortField.md
4848
docs/HelloAssoApiV5ModelsEnumsSortOrder.md
4949
docs/HelloAssoApiV5ModelsEnumsTagType.md
5050
docs/HelloAssoApiV5ModelsEnumsTierType.md
51+
docs/HelloAssoApiV5ModelsFormsCustomFieldPublicModel.md
52+
docs/HelloAssoApiV5ModelsFormsExtraOptionPublicModel.md
5153
docs/HelloAssoApiV5ModelsFormsFormBasicModel.md
5254
docs/HelloAssoApiV5ModelsFormsFormLightModel.md
5355
docs/HelloAssoApiV5ModelsFormsFormPublicModel.md
@@ -172,6 +174,8 @@ helloasso_python/models/hello_asso_api_v5_models_enums_sort_field.py
172174
helloasso_python/models/hello_asso_api_v5_models_enums_sort_order.py
173175
helloasso_python/models/hello_asso_api_v5_models_enums_tag_type.py
174176
helloasso_python/models/hello_asso_api_v5_models_enums_tier_type.py
177+
helloasso_python/models/hello_asso_api_v5_models_forms_custom_field_public_model.py
178+
helloasso_python/models/hello_asso_api_v5_models_forms_extra_option_public_model.py
175179
helloasso_python/models/hello_asso_api_v5_models_forms_form_basic_model.py
176180
helloasso_python/models/hello_asso_api_v5_models_forms_form_light_model.py
177181
helloasso_python/models/hello_asso_api_v5_models_forms_form_public_model.py
@@ -235,4 +239,6 @@ setup.cfg
235239
setup.py
236240
test-requirements.txt
237241
test/__init__.py
242+
test/test_hello_asso_api_v5_models_forms_custom_field_public_model.py
243+
test/test_hello_asso_api_v5_models_forms_extra_option_public_model.py
238244
tox.ini
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# HelloAssoApiV5ModelsFormsCustomFieldPublicModel
2+
3+
A custom field can be assigned to a Tier or an ExtraOption It is used to give extra information during the reservation of a tier
4+
5+
## Properties
6+
7+
Name | Type | Description | Notes
8+
------------ | ------------- | ------------- | -------------
9+
**id** | **int** | Id of the customField | [optional] [readonly]
10+
**values** | **List[str]** | The list of possible values if type is a CHOICE_LIST | [optional] [readonly]
11+
**is_required** | **bool** | True if the custom field must be filled by the user before validating a cart | [optional] [readonly]
12+
**type** | [**HelloAssoApiV5ModelsEnumsFieldType**](HelloAssoApiV5ModelsEnumsFieldType.md) | | [optional]
13+
**label** | **str** | The label to be displayed to the user | [optional] [readonly]
14+
15+
## Example
16+
17+
```python
18+
from helloasso_python.models.hello_asso_api_v5_models_forms_custom_field_public_model import HelloAssoApiV5ModelsFormsCustomFieldPublicModel
19+
20+
# TODO update the JSON string below
21+
json = "{}"
22+
# create an instance of HelloAssoApiV5ModelsFormsCustomFieldPublicModel from a JSON string
23+
hello_asso_api_v5_models_forms_custom_field_public_model_instance = HelloAssoApiV5ModelsFormsCustomFieldPublicModel.from_json(json)
24+
# print the JSON string representation of the object
25+
print(HelloAssoApiV5ModelsFormsCustomFieldPublicModel.to_json())
26+
27+
# convert the object into a dict
28+
hello_asso_api_v5_models_forms_custom_field_public_model_dict = hello_asso_api_v5_models_forms_custom_field_public_model_instance.to_dict()
29+
# create an instance of HelloAssoApiV5ModelsFormsCustomFieldPublicModel from a dict
30+
hello_asso_api_v5_models_forms_custom_field_public_model_from_dict = HelloAssoApiV5ModelsFormsCustomFieldPublicModel.from_dict(hello_asso_api_v5_models_forms_custom_field_public_model_dict)
31+
```
32+
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
33+
34+
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# HelloAssoApiV5ModelsFormsExtraOptionPublicModel
2+
3+
ExtraOptionFullModel
4+
5+
## Properties
6+
7+
Name | Type | Description | Notes
8+
------------ | ------------- | ------------- | -------------
9+
**custom_fields** | [**List[HelloAssoApiV5ModelsFormsCustomFieldPublicModel]**](HelloAssoApiV5ModelsFormsCustomFieldPublicModel.md) | List of custom fields to be filled by the user | [optional]
10+
**id** | **int** | Id | [optional]
11+
**price** | **int** | Price of the extraOption, can be free | [optional]
12+
**vat_rate** | **float** | Vat rate if applicable Amount have to be 0.10 for 10% | [optional]
13+
**label** | **str** | The name of the option | [optional]
14+
**description** | **str** | The description of the option | [optional]
15+
**is_required** | **bool** | Additional option is required/mandatory | [optional] [readonly]
16+
17+
## Example
18+
19+
```python
20+
from helloasso_python.models.hello_asso_api_v5_models_forms_extra_option_public_model import HelloAssoApiV5ModelsFormsExtraOptionPublicModel
21+
22+
# TODO update the JSON string below
23+
json = "{}"
24+
# create an instance of HelloAssoApiV5ModelsFormsExtraOptionPublicModel from a JSON string
25+
hello_asso_api_v5_models_forms_extra_option_public_model_instance = HelloAssoApiV5ModelsFormsExtraOptionPublicModel.from_json(json)
26+
# print the JSON string representation of the object
27+
print(HelloAssoApiV5ModelsFormsExtraOptionPublicModel.to_json())
28+
29+
# convert the object into a dict
30+
hello_asso_api_v5_models_forms_extra_option_public_model_dict = hello_asso_api_v5_models_forms_extra_option_public_model_instance.to_dict()
31+
# create an instance of HelloAssoApiV5ModelsFormsExtraOptionPublicModel from a dict
32+
hello_asso_api_v5_models_forms_extra_option_public_model_from_dict = HelloAssoApiV5ModelsFormsExtraOptionPublicModel.from_dict(hello_asso_api_v5_models_forms_extra_option_public_model_dict)
33+
```
34+
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
35+
36+

docs/HelloAssoApiV5ModelsFormsTierPublicModel.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ TierPublicModel class
66

77
Name | Type | Description | Notes
88
------------ | ------------- | ------------- | -------------
9+
**custom_fields** | [**List[HelloAssoApiV5ModelsFormsCustomFieldPublicModel]**](HelloAssoApiV5ModelsFormsCustomFieldPublicModel.md) | List of custom fields to be filled by the user | [optional]
10+
**extra_options** | [**List[HelloAssoApiV5ModelsFormsExtraOptionPublicModel]**](HelloAssoApiV5ModelsFormsExtraOptionPublicModel.md) | List of available extra options to buy along the tier | [optional]
911
**id** | **int** | id | [optional]
1012
**label** | **str** | label | [optional]
1113
**description** | **str** | description | [optional]

helloasso_python/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,8 @@
8484
from helloasso_python.models.hello_asso_api_v5_models_enums_sort_order import HelloAssoApiV5ModelsEnumsSortOrder
8585
from helloasso_python.models.hello_asso_api_v5_models_enums_tag_type import HelloAssoApiV5ModelsEnumsTagType
8686
from helloasso_python.models.hello_asso_api_v5_models_enums_tier_type import HelloAssoApiV5ModelsEnumsTierType
87+
from helloasso_python.models.hello_asso_api_v5_models_forms_custom_field_public_model import HelloAssoApiV5ModelsFormsCustomFieldPublicModel
88+
from helloasso_python.models.hello_asso_api_v5_models_forms_extra_option_public_model import HelloAssoApiV5ModelsFormsExtraOptionPublicModel
8789
from helloasso_python.models.hello_asso_api_v5_models_forms_form_basic_model import HelloAssoApiV5ModelsFormsFormBasicModel
8890
from helloasso_python.models.hello_asso_api_v5_models_forms_form_light_model import HelloAssoApiV5ModelsFormsFormLightModel
8991
from helloasso_python.models.hello_asso_api_v5_models_forms_form_public_model import HelloAssoApiV5ModelsFormsFormPublicModel

helloasso_python/models/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,8 @@
5757
from helloasso_python.models.hello_asso_api_v5_models_enums_sort_order import HelloAssoApiV5ModelsEnumsSortOrder
5858
from helloasso_python.models.hello_asso_api_v5_models_enums_tag_type import HelloAssoApiV5ModelsEnumsTagType
5959
from helloasso_python.models.hello_asso_api_v5_models_enums_tier_type import HelloAssoApiV5ModelsEnumsTierType
60+
from helloasso_python.models.hello_asso_api_v5_models_forms_custom_field_public_model import HelloAssoApiV5ModelsFormsCustomFieldPublicModel
61+
from helloasso_python.models.hello_asso_api_v5_models_forms_extra_option_public_model import HelloAssoApiV5ModelsFormsExtraOptionPublicModel
6062
from helloasso_python.models.hello_asso_api_v5_models_forms_form_basic_model import HelloAssoApiV5ModelsFormsFormBasicModel
6163
from helloasso_python.models.hello_asso_api_v5_models_forms_form_light_model import HelloAssoApiV5ModelsFormsFormLightModel
6264
from helloasso_python.models.hello_asso_api_v5_models_forms_form_public_model import HelloAssoApiV5ModelsFormsFormPublicModel
Lines changed: 114 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,114 @@
1+
# coding: utf-8
2+
3+
"""
4+
HelloAsso API
5+
6+
HelloAsso auto-generated SDK
7+
8+
The version of the OpenAPI document: public
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, StrictBool, StrictInt, StrictStr
21+
from typing import Any, ClassVar, Dict, List, Optional
22+
from helloasso_python.models.hello_asso_api_v5_models_enums_field_type import HelloAssoApiV5ModelsEnumsFieldType
23+
from typing import Optional, Set
24+
from typing_extensions import Self
25+
26+
class HelloAssoApiV5ModelsFormsCustomFieldPublicModel(BaseModel):
27+
"""
28+
A custom field can be assigned to a Tier or an ExtraOption It is used to give extra information during the reservation of a tier
29+
""" # noqa: E501
30+
id: Optional[StrictInt] = Field(default=None, description="Id of the customField")
31+
values: Optional[List[StrictStr]] = Field(default=None, description="The list of possible values if type is a CHOICE_LIST")
32+
is_required: Optional[StrictBool] = Field(default=None, description="True if the custom field must be filled by the user before validating a cart", alias="isRequired")
33+
type: Optional[HelloAssoApiV5ModelsEnumsFieldType] = None
34+
label: Optional[StrictStr] = Field(default=None, description="The label to be displayed to the user")
35+
__properties: ClassVar[List[str]] = ["id", "values", "isRequired", "type", "label"]
36+
37+
model_config = ConfigDict(
38+
populate_by_name=True,
39+
validate_assignment=True,
40+
protected_namespaces=(),
41+
)
42+
43+
44+
def to_str(self) -> str:
45+
"""Returns the string representation of the model using alias"""
46+
return pprint.pformat(self.model_dump(by_alias=True))
47+
48+
def to_json(self) -> str:
49+
"""Returns the JSON representation of the model using alias"""
50+
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
51+
return json.dumps(self.to_dict())
52+
53+
@classmethod
54+
def from_json(cls, json_str: str) -> Optional[Self]:
55+
"""Create an instance of HelloAssoApiV5ModelsFormsCustomFieldPublicModel from a JSON string"""
56+
return cls.from_dict(json.loads(json_str))
57+
58+
def to_dict(self) -> Dict[str, Any]:
59+
"""Return the dictionary representation of the model using alias.
60+
61+
This has the following differences from calling pydantic's
62+
`self.model_dump(by_alias=True)`:
63+
64+
* `None` is only added to the output dict for nullable fields that
65+
were set at model initialization. Other fields with value `None`
66+
are ignored.
67+
* OpenAPI `readOnly` fields are excluded.
68+
* OpenAPI `readOnly` fields are excluded.
69+
* OpenAPI `readOnly` fields are excluded.
70+
* OpenAPI `readOnly` fields are excluded.
71+
"""
72+
excluded_fields: Set[str] = set([
73+
"id",
74+
"values",
75+
"is_required",
76+
"label",
77+
])
78+
79+
_dict = self.model_dump(
80+
by_alias=True,
81+
exclude=excluded_fields,
82+
exclude_none=True,
83+
)
84+
# set to None if values (nullable) is None
85+
# and model_fields_set contains the field
86+
if self.values is None and "values" in self.model_fields_set:
87+
_dict['values'] = None
88+
89+
# set to None if label (nullable) is None
90+
# and model_fields_set contains the field
91+
if self.label is None and "label" in self.model_fields_set:
92+
_dict['label'] = None
93+
94+
return _dict
95+
96+
@classmethod
97+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
98+
"""Create an instance of HelloAssoApiV5ModelsFormsCustomFieldPublicModel from a dict"""
99+
if obj is None:
100+
return None
101+
102+
if not isinstance(obj, dict):
103+
return cls.model_validate(obj)
104+
105+
_obj = cls.model_validate({
106+
"id": obj.get("id"),
107+
"values": obj.get("values"),
108+
"isRequired": obj.get("isRequired"),
109+
"type": obj.get("type"),
110+
"label": obj.get("label")
111+
})
112+
return _obj
113+
114+
Lines changed: 124 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,124 @@
1+
# coding: utf-8
2+
3+
"""
4+
HelloAsso API
5+
6+
HelloAsso auto-generated SDK
7+
8+
The version of the OpenAPI document: public
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, StrictBool, StrictFloat, StrictInt, StrictStr
21+
from typing import Any, ClassVar, Dict, List, Optional, Union
22+
from helloasso_python.models.hello_asso_api_v5_models_forms_custom_field_public_model import HelloAssoApiV5ModelsFormsCustomFieldPublicModel
23+
from typing import Optional, Set
24+
from typing_extensions import Self
25+
26+
class HelloAssoApiV5ModelsFormsExtraOptionPublicModel(BaseModel):
27+
"""
28+
ExtraOptionFullModel
29+
""" # noqa: E501
30+
custom_fields: Optional[List[HelloAssoApiV5ModelsFormsCustomFieldPublicModel]] = Field(default=None, description="List of custom fields to be filled by the user", alias="customFields")
31+
id: Optional[StrictInt] = Field(default=None, description="Id")
32+
price: Optional[StrictInt] = Field(default=None, description="Price of the extraOption, can be free")
33+
vat_rate: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, description="Vat rate if applicable Amount have to be 0.10 for 10%", alias="vatRate")
34+
label: Optional[StrictStr] = Field(default=None, description="The name of the option")
35+
description: Optional[StrictStr] = Field(default=None, description="The description of the option")
36+
is_required: Optional[StrictBool] = Field(default=None, description="Additional option is required/mandatory", alias="isRequired")
37+
__properties: ClassVar[List[str]] = ["customFields", "id", "price", "vatRate", "label", "description", "isRequired"]
38+
39+
model_config = ConfigDict(
40+
populate_by_name=True,
41+
validate_assignment=True,
42+
protected_namespaces=(),
43+
)
44+
45+
46+
def to_str(self) -> str:
47+
"""Returns the string representation of the model using alias"""
48+
return pprint.pformat(self.model_dump(by_alias=True))
49+
50+
def to_json(self) -> str:
51+
"""Returns the JSON representation of the model using alias"""
52+
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
53+
return json.dumps(self.to_dict())
54+
55+
@classmethod
56+
def from_json(cls, json_str: str) -> Optional[Self]:
57+
"""Create an instance of HelloAssoApiV5ModelsFormsExtraOptionPublicModel from a JSON string"""
58+
return cls.from_dict(json.loads(json_str))
59+
60+
def to_dict(self) -> Dict[str, Any]:
61+
"""Return the dictionary representation of the model using alias.
62+
63+
This has the following differences from calling pydantic's
64+
`self.model_dump(by_alias=True)`:
65+
66+
* `None` is only added to the output dict for nullable fields that
67+
were set at model initialization. Other fields with value `None`
68+
are ignored.
69+
* OpenAPI `readOnly` fields are excluded.
70+
"""
71+
excluded_fields: Set[str] = set([
72+
"is_required",
73+
])
74+
75+
_dict = self.model_dump(
76+
by_alias=True,
77+
exclude=excluded_fields,
78+
exclude_none=True,
79+
)
80+
# override the default output from pydantic by calling `to_dict()` of each item in custom_fields (list)
81+
_items = []
82+
if self.custom_fields:
83+
for _item_custom_fields in self.custom_fields:
84+
if _item_custom_fields:
85+
_items.append(_item_custom_fields.to_dict())
86+
_dict['customFields'] = _items
87+
# set to None if custom_fields (nullable) is None
88+
# and model_fields_set contains the field
89+
if self.custom_fields is None and "custom_fields" in self.model_fields_set:
90+
_dict['customFields'] = None
91+
92+
# set to None if label (nullable) is None
93+
# and model_fields_set contains the field
94+
if self.label is None and "label" in self.model_fields_set:
95+
_dict['label'] = None
96+
97+
# set to None if description (nullable) is None
98+
# and model_fields_set contains the field
99+
if self.description is None and "description" in self.model_fields_set:
100+
_dict['description'] = None
101+
102+
return _dict
103+
104+
@classmethod
105+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
106+
"""Create an instance of HelloAssoApiV5ModelsFormsExtraOptionPublicModel from a dict"""
107+
if obj is None:
108+
return None
109+
110+
if not isinstance(obj, dict):
111+
return cls.model_validate(obj)
112+
113+
_obj = cls.model_validate({
114+
"customFields": [HelloAssoApiV5ModelsFormsCustomFieldPublicModel.from_dict(_item) for _item in obj["customFields"]] if obj.get("customFields") is not None else None,
115+
"id": obj.get("id"),
116+
"price": obj.get("price"),
117+
"vatRate": obj.get("vatRate"),
118+
"label": obj.get("label"),
119+
"description": obj.get("description"),
120+
"isRequired": obj.get("isRequired")
121+
})
122+
return _obj
123+
124+

0 commit comments

Comments
 (0)