Skip to content

Commit cc9946f

Browse files
committed
Regenerate code using V7.4.0 of openapi generator
1 parent 5668afd commit cc9946f

File tree

10 files changed

+42
-59
lines changed

10 files changed

+42
-59
lines changed

monday_code/api/environment_variables_api.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
from typing_extensions import Annotated
1818

1919
from pydantic import StrictStr
20-
from typing import List
2120
from monday_code.models.json_value import JsonValue
2221

2322
from monday_code.api_client import ApiClient, RequestSerialized
@@ -253,7 +252,7 @@ def _get_environment_variable_serialize(
253252
_query_params: List[Tuple[str, str]] = []
254253
_header_params: Dict[str, Optional[str]] = _headers or {}
255254
_form_params: List[Tuple[str, str]] = []
256-
_files: Dict[str, Union[str, bytes]] = {}
255+
_files: Dict[str, str] = {}
257256
_body_params: Optional[bytes] = None
258257

259258
# process the path parameters
@@ -494,7 +493,7 @@ def _get_environment_variable_keys_serialize(
494493
_query_params: List[Tuple[str, str]] = []
495494
_header_params: Dict[str, Optional[str]] = _headers or {}
496495
_form_params: List[Tuple[str, str]] = []
497-
_files: Dict[str, Union[str, bytes]] = {}
496+
_files: Dict[str, str] = {}
498497
_body_params: Optional[bytes] = None
499498

500499
# process the path parameters

monday_code/api/logs_api.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@ def _write_log_serialize(
248248
_query_params: List[Tuple[str, str]] = []
249249
_header_params: Dict[str, Optional[str]] = _headers or {}
250250
_form_params: List[Tuple[str, str]] = []
251-
_files: Dict[str, Union[str, bytes]] = {}
251+
_files: Dict[str, str] = {}
252252
_body_params: Optional[bytes] = None
253253

254254
# process the path parameters

monday_code/api/queue_api.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,7 @@ def _publish_message_serialize(
251251
_query_params: List[Tuple[str, str]] = []
252252
_header_params: Dict[str, Optional[str]] = _headers or {}
253253
_form_params: List[Tuple[str, str]] = []
254-
_files: Dict[str, Union[str, bytes]] = {}
254+
_files: Dict[str, str] = {}
255255
_body_params: Optional[bytes] = None
256256

257257
# process the path parameters
@@ -518,7 +518,7 @@ def _validate_secret_serialize(
518518
_query_params: List[Tuple[str, str]] = []
519519
_header_params: Dict[str, Optional[str]] = _headers or {}
520520
_form_params: List[Tuple[str, str]] = []
521-
_files: Dict[str, Union[str, bytes]] = {}
521+
_files: Dict[str, str] = {}
522522
_body_params: Optional[bytes] = None
523523

524524
# process the path parameters

monday_code/api/secrets_api.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
from typing_extensions import Annotated
1818

1919
from pydantic import StrictStr
20-
from typing import List
2120

2221
from monday_code.api_client import ApiClient, RequestSerialized
2322
from monday_code.api_response import ApiResponse
@@ -252,7 +251,7 @@ def _get_secret_serialize(
252251
_query_params: List[Tuple[str, str]] = []
253252
_header_params: Dict[str, Optional[str]] = _headers or {}
254253
_form_params: List[Tuple[str, str]] = []
255-
_files: Dict[str, Union[str, bytes]] = {}
254+
_files: Dict[str, str] = {}
256255
_body_params: Optional[bytes] = None
257256

258257
# process the path parameters
@@ -493,7 +492,7 @@ def _get_secret_keys_serialize(
493492
_query_params: List[Tuple[str, str]] = []
494493
_header_params: Dict[str, Optional[str]] = _headers or {}
495494
_form_params: List[Tuple[str, str]] = []
496-
_files: Dict[str, Union[str, bytes]] = {}
495+
_files: Dict[str, str] = {}
497496
_body_params: Optional[bytes] = None
498497

499498
# process the path parameters

monday_code/api/secure_storage_api.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
from typing_extensions import Annotated
1818

1919
from pydantic import StrictStr
20-
from typing import Any
2120
from monday_code.models.secure_storage_data_contract import SecureStorageDataContract
2221

2322
from monday_code.api_client import ApiClient, RequestSerialized
@@ -250,7 +249,7 @@ def _delete_secure_storage_serialize(
250249
_query_params: List[Tuple[str, str]] = []
251250
_header_params: Dict[str, Optional[str]] = _headers or {}
252251
_form_params: List[Tuple[str, str]] = []
253-
_files: Dict[str, Union[str, bytes]] = {}
252+
_files: Dict[str, str] = {}
254253
_body_params: Optional[bytes] = None
255254

256255
# process the path parameters
@@ -501,7 +500,7 @@ def _get_secure_storage_serialize(
501500
_query_params: List[Tuple[str, str]] = []
502501
_header_params: Dict[str, Optional[str]] = _headers or {}
503502
_form_params: List[Tuple[str, str]] = []
504-
_files: Dict[str, Union[str, bytes]] = {}
503+
_files: Dict[str, str] = {}
505504
_body_params: Optional[bytes] = None
506505

507506
# process the path parameters
@@ -768,7 +767,7 @@ def _put_secure_storage_serialize(
768767
_query_params: List[Tuple[str, str]] = []
769768
_header_params: Dict[str, Optional[str]] = _headers or {}
770769
_form_params: List[Tuple[str, str]] = []
771-
_files: Dict[str, Union[str, bytes]] = {}
770+
_files: Dict[str, str] = {}
772771
_body_params: Optional[bytes] = None
773772

774773
# process the path parameters

monday_code/api/storage_api.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
from typing_extensions import Annotated
1818

1919
from pydantic import StrictBool, StrictStr
20-
from typing import Any, Optional
20+
from typing import Optional
2121
from monday_code.models.increment_counter_params import IncrementCounterParams
2222
from monday_code.models.storage_data_contract import StorageDataContract
2323

@@ -264,7 +264,7 @@ def _delete_by_key_from_storage_serialize(
264264
_query_params: List[Tuple[str, str]] = []
265265
_header_params: Dict[str, Optional[str]] = _headers or {}
266266
_form_params: List[Tuple[str, str]] = []
267-
_files: Dict[str, Union[str, bytes]] = {}
267+
_files: Dict[str, str] = {}
268268
_body_params: Optional[bytes] = None
269269

270270
# process the path parameters
@@ -546,7 +546,7 @@ def _get_by_key_from_storage_serialize(
546546
_query_params: List[Tuple[str, str]] = []
547547
_header_params: Dict[str, Optional[str]] = _headers or {}
548548
_form_params: List[Tuple[str, str]] = []
549-
_files: Dict[str, Union[str, bytes]] = {}
549+
_files: Dict[str, str] = {}
550550
_body_params: Optional[bytes] = None
551551

552552
# process the path parameters
@@ -819,7 +819,7 @@ def _increment_counter_serialize(
819819
_query_params: List[Tuple[str, str]] = []
820820
_header_params: Dict[str, Optional[str]] = _headers or {}
821821
_form_params: List[Tuple[str, str]] = []
822-
_files: Dict[str, Union[str, bytes]] = {}
822+
_files: Dict[str, str] = {}
823823
_body_params: Optional[bytes] = None
824824

825825
# process the path parameters
@@ -1140,7 +1140,7 @@ def _upsert_by_key_from_storage_serialize(
11401140
_query_params: List[Tuple[str, str]] = []
11411141
_header_params: Dict[str, Optional[str]] = _headers or {}
11421142
_form_params: List[Tuple[str, str]] = []
1143-
_files: Dict[str, Union[str, bytes]] = {}
1143+
_files: Dict[str, str] = {}
11441144
_body_params: Optional[bytes] = None
11451145

11461146
# process the path parameters

monday_code/api_client.py

Lines changed: 23 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,7 @@
2222
import tempfile
2323

2424
from urllib.parse import quote
25-
from typing import Tuple, Optional, List, Dict, Union
26-
from pydantic import SecretStr
25+
from typing import Tuple, Optional, List, Dict
2726

2827
from monday_code.configuration import Configuration
2928
from monday_code.api_response import ApiResponse, T as ApiResponseT
@@ -208,8 +207,7 @@ def param_serialize(
208207
post_params,
209208
collection_formats
210209
)
211-
if files:
212-
post_params.extend(self.files_parameters(files))
210+
post_params.extend(self.files_parameters(files))
213211

214212
# auth setting
215213
self.update_params_for_auth(
@@ -314,10 +312,7 @@ def response_deserialize(
314312
match = re.search(r"charset=([a-zA-Z\-\d]+)[\s;]?", content_type)
315313
encoding = match.group(1) if match else "utf-8"
316314
response_text = response_data.data.decode(encoding)
317-
if response_type in ["bytearray", "str"]:
318-
return_data = self.__deserialize_primitive(response_text, response_type)
319-
else:
320-
return_data = self.deserialize(response_text, response_type)
315+
return_data = self.deserialize(response_text, response_type)
321316
finally:
322317
if not 200 <= response_data.status <= 299:
323318
raise ApiException.from_response(
@@ -337,7 +332,6 @@ def sanitize_for_serialization(self, obj):
337332
"""Builds a JSON POST object.
338333
339334
If obj is None, return None.
340-
If obj is SecretStr, return obj.get_secret_value()
341335
If obj is str, int, long, float, bool, return directly.
342336
If obj is datetime.datetime, datetime.date
343337
convert to string in iso8601 format.
@@ -350,10 +344,6 @@ def sanitize_for_serialization(self, obj):
350344
"""
351345
if obj is None:
352346
return None
353-
elif isinstance(obj, Enum):
354-
return obj.value
355-
elif isinstance(obj, SecretStr):
356-
return obj.get_secret_value()
357347
elif isinstance(obj, self.PRIMITIVE_TYPES):
358348
return obj
359349
elif isinstance(obj, list):
@@ -375,10 +365,7 @@ def sanitize_for_serialization(self, obj):
375365
# and attributes which value is not None.
376366
# Convert attribute name to json key in
377367
# model definition for request.
378-
if hasattr(obj, 'to_dict') and callable(getattr(obj, 'to_dict')):
379-
obj_dict = obj.to_dict()
380-
else:
381-
obj_dict = obj.__dict__
368+
obj_dict = obj.to_dict()
382369

383370
return {
384371
key: self.sanitize_for_serialization(val)
@@ -517,30 +504,31 @@ def parameters_to_url_query(self, params, collection_formats):
517504

518505
return "&".join(["=".join(map(str, item)) for item in new_params])
519506

520-
def files_parameters(self, files: Dict[str, Union[str, bytes]]):
507+
def files_parameters(self, files=None):
521508
"""Builds form parameters.
522509
523510
:param files: File parameters.
524511
:return: Form parameters with files.
525512
"""
526513
params = []
527-
for k, v in files.items():
528-
if isinstance(v, str):
529-
with open(v, 'rb') as f:
530-
filename = os.path.basename(f.name)
531-
filedata = f.read()
532-
elif isinstance(v, bytes):
533-
filename = k
534-
filedata = v
535-
else:
536-
raise ValueError("Unsupported file value")
537-
mimetype = (
538-
mimetypes.guess_type(filename)[0]
539-
or 'application/octet-stream'
540-
)
541-
params.append(
542-
tuple([k, tuple([filename, filedata, mimetype])])
543-
)
514+
515+
if files:
516+
for k, v in files.items():
517+
if not v:
518+
continue
519+
file_names = v if type(v) is list else [v]
520+
for n in file_names:
521+
with open(n, 'rb') as f:
522+
filename = os.path.basename(f.name)
523+
filedata = f.read()
524+
mimetype = (
525+
mimetypes.guess_type(filename)[0]
526+
or 'application/octet-stream'
527+
)
528+
params.append(
529+
tuple([k, tuple([filename, filedata, mimetype])])
530+
)
531+
544532
return params
545533

546534
def select_header_accept(self, accepts: List[str]) -> Optional[str]:

monday_code/models/json_value.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
import re # noqa: F401
2020
from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictFloat, StrictInt, StrictStr, ValidationError, field_validator
2121
from typing import Dict, List, Optional, Union
22-
from typing import Union, Any, List, Set, TYPE_CHECKING, Optional, Dict
22+
from typing import Union, Any, List, TYPE_CHECKING, Optional, Dict
2323
from typing_extensions import Literal, Self
2424
from pydantic import Field
2525

@@ -44,7 +44,7 @@ class JsonValue(BaseModel):
4444
actual_instance: Optional[Union[Dict[str, JsonValue], List[JsonValue], bool, float, str]] = None
4545
else:
4646
actual_instance: Any = None
47-
any_of_schemas: Set[str] = { "Dict[str, JsonValue]", "List[JsonValue]", "bool", "float", "str" }
47+
any_of_schemas: List[str] = Field(default=Literal["Dict[str, JsonValue]", "List[JsonValue]", "bool", "float", "str"])
4848

4949
model_config = {
5050
"validate_assignment": True,

monday_code/models/write_log_request_body_error.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
import re # noqa: F401
2020
from pydantic import BaseModel, ConfigDict, Field, StrictStr, ValidationError, field_validator
2121
from typing import Any, Dict, Optional
22-
from typing import Union, Any, List, Set, TYPE_CHECKING, Optional, Dict
22+
from typing import Union, Any, List, TYPE_CHECKING, Optional, Dict
2323
from typing_extensions import Literal, Self
2424
from pydantic import Field
2525

@@ -38,7 +38,7 @@ class WriteLogRequestBodyError(BaseModel):
3838
actual_instance: Optional[Union[Dict[str, object], str]] = None
3939
else:
4040
actual_instance: Any = None
41-
any_of_schemas: Set[str] = { "Dict[str, object]", "str" }
41+
any_of_schemas: List[str] = Field(default=Literal["Dict[str, object]", "str"])
4242

4343
model_config = {
4444
"validate_assignment": True,

monday_code/rest.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -202,8 +202,6 @@ def request(
202202
# Content-Type which generated by urllib3 will be
203203
# overwritten.
204204
del headers['Content-Type']
205-
# Ensures that dict objects are serialized
206-
post_params = [(a, json.dumps(b)) if isinstance(b, dict) else (a,b) for a, b in post_params]
207205
r = self.pool_manager.request(
208206
method,
209207
url,

0 commit comments

Comments
 (0)