Skip to content

Commit 9443c40

Browse files
Generate git
1 parent 5171137 commit 9443c40

15 files changed

+161
-81
lines changed

services/git/src/stackit/git/__init__.py

Lines changed: 47 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -12,35 +12,61 @@
1212
Generated by OpenAPI Generator (https://openapi-generator.tech)
1313
1414
Do not edit the class manually.
15-
""" # noqa: E501 docstring might be too long
15+
""" # noqa: E501
1616

1717

1818
__version__ = "1.0.0"
1919

20+
# Define package exports
21+
__all__ = [
22+
"DefaultApi",
23+
"ApiResponse",
24+
"ApiClient",
25+
"HostConfiguration",
26+
"OpenApiException",
27+
"ApiTypeError",
28+
"ApiValueError",
29+
"ApiKeyError",
30+
"ApiAttributeError",
31+
"ApiException",
32+
"CreateInstancePayload",
33+
"Flavor",
34+
"GenericErrorResponse",
35+
"Instance",
36+
"InternalServerErrorResponse",
37+
"ListFlavors",
38+
"ListInstances",
39+
"UnauthorizedResponse",
40+
]
41+
2042
# import apis into sdk package
21-
from stackit.git.api.default_api import DefaultApi
22-
from stackit.git.api_client import ApiClient
43+
from stackit.git.api.default_api import DefaultApi as DefaultApi
44+
from stackit.git.api_client import ApiClient as ApiClient
2345

2446
# import ApiClient
25-
from stackit.git.api_response import ApiResponse
26-
from stackit.git.configuration import HostConfiguration
27-
from stackit.git.exceptions import (
28-
ApiAttributeError,
29-
ApiException,
30-
ApiKeyError,
31-
ApiTypeError,
32-
ApiValueError,
33-
OpenApiException,
34-
)
47+
from stackit.git.api_response import ApiResponse as ApiResponse
48+
from stackit.git.configuration import HostConfiguration as HostConfiguration
49+
from stackit.git.exceptions import ApiAttributeError as ApiAttributeError
50+
from stackit.git.exceptions import ApiException as ApiException
51+
from stackit.git.exceptions import ApiKeyError as ApiKeyError
52+
from stackit.git.exceptions import ApiTypeError as ApiTypeError
53+
from stackit.git.exceptions import ApiValueError as ApiValueError
54+
from stackit.git.exceptions import OpenApiException as OpenApiException
3555

3656
# import models into sdk package
37-
from stackit.git.models.create_instance_payload import CreateInstancePayload
38-
from stackit.git.models.flavor import Flavor
39-
from stackit.git.models.generic_error_response import GenericErrorResponse
40-
from stackit.git.models.instance import Instance
57+
from stackit.git.models.create_instance_payload import (
58+
CreateInstancePayload as CreateInstancePayload,
59+
)
60+
from stackit.git.models.flavor import Flavor as Flavor
61+
from stackit.git.models.generic_error_response import (
62+
GenericErrorResponse as GenericErrorResponse,
63+
)
64+
from stackit.git.models.instance import Instance as Instance
4165
from stackit.git.models.internal_server_error_response import (
42-
InternalServerErrorResponse,
66+
InternalServerErrorResponse as InternalServerErrorResponse,
67+
)
68+
from stackit.git.models.list_flavors import ListFlavors as ListFlavors
69+
from stackit.git.models.list_instances import ListInstances as ListInstances
70+
from stackit.git.models.unauthorized_response import (
71+
UnauthorizedResponse as UnauthorizedResponse,
4372
)
44-
from stackit.git.models.list_flavors import ListFlavors
45-
from stackit.git.models.list_instances import ListInstances
46-
from stackit.git.models.unauthorized_response import UnauthorizedResponse

services/git/src/stackit/git/api/default_api.py

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
Generated by OpenAPI Generator (https://openapi-generator.tech)
1111
1212
Do not edit the class manually.
13-
""" # noqa: E501 docstring might be too long
13+
""" # noqa: E501
1414

1515
from typing import Any, Dict, List, Optional, Tuple, Union
1616

@@ -89,7 +89,7 @@ def create_instance(
8989
in the spec for a single request.
9090
:type _host_index: int, optional
9191
:return: Returns the result object.
92-
""" # noqa: E501 docstring might be too long
92+
""" # noqa: E501
9393

9494
_param = self._create_instance_serialize(
9595
project_id=project_id,
@@ -157,7 +157,7 @@ def create_instance_with_http_info(
157157
in the spec for a single request.
158158
:type _host_index: int, optional
159159
:return: Returns the result object.
160-
""" # noqa: E501 docstring might be too long
160+
""" # noqa: E501
161161

162162
_param = self._create_instance_serialize(
163163
project_id=project_id,
@@ -225,7 +225,7 @@ def create_instance_without_preload_content(
225225
in the spec for a single request.
226226
:type _host_index: int, optional
227227
:return: Returns the result object.
228-
""" # noqa: E501 docstring might be too long
228+
""" # noqa: E501
229229

230230
_param = self._create_instance_serialize(
231231
project_id=project_id,
@@ -264,7 +264,7 @@ def _create_instance_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, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]] = {}
268268
_body_params: Optional[bytes] = None
269269

270270
# process the path parameters
@@ -352,7 +352,7 @@ def delete_instance(
352352
in the spec for a single request.
353353
:type _host_index: int, optional
354354
:return: Returns the result object.
355-
""" # noqa: E501 docstring might be too long
355+
""" # noqa: E501
356356

357357
_param = self._delete_instance_serialize(
358358
project_id=project_id,
@@ -423,7 +423,7 @@ def delete_instance_with_http_info(
423423
in the spec for a single request.
424424
:type _host_index: int, optional
425425
:return: Returns the result object.
426-
""" # noqa: E501 docstring might be too long
426+
""" # noqa: E501
427427

428428
_param = self._delete_instance_serialize(
429429
project_id=project_id,
@@ -494,7 +494,7 @@ def delete_instance_without_preload_content(
494494
in the spec for a single request.
495495
:type _host_index: int, optional
496496
:return: Returns the result object.
497-
""" # noqa: E501 docstring might be too long
497+
""" # noqa: E501
498498

499499
_param = self._delete_instance_serialize(
500500
project_id=project_id,
@@ -534,7 +534,7 @@ def _delete_instance_serialize(
534534
_query_params: List[Tuple[str, str]] = []
535535
_header_params: Dict[str, Optional[str]] = _headers or {}
536536
_form_params: List[Tuple[str, str]] = []
537-
_files: Dict[str, Union[str, bytes]] = {}
537+
_files: Dict[str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]] = {}
538538
_body_params: Optional[bytes] = None
539539

540540
# process the path parameters
@@ -614,7 +614,7 @@ def get_instance(
614614
in the spec for a single request.
615615
:type _host_index: int, optional
616616
:return: Returns the result object.
617-
""" # noqa: E501 docstring might be too long
617+
""" # noqa: E501
618618

619619
_param = self._get_instance_serialize(
620620
project_id=project_id,
@@ -684,7 +684,7 @@ def get_instance_with_http_info(
684684
in the spec for a single request.
685685
:type _host_index: int, optional
686686
:return: Returns the result object.
687-
""" # noqa: E501 docstring might be too long
687+
""" # noqa: E501
688688

689689
_param = self._get_instance_serialize(
690690
project_id=project_id,
@@ -754,7 +754,7 @@ def get_instance_without_preload_content(
754754
in the spec for a single request.
755755
:type _host_index: int, optional
756756
:return: Returns the result object.
757-
""" # noqa: E501 docstring might be too long
757+
""" # noqa: E501
758758

759759
_param = self._get_instance_serialize(
760760
project_id=project_id,
@@ -793,7 +793,7 @@ def _get_instance_serialize(
793793
_query_params: List[Tuple[str, str]] = []
794794
_header_params: Dict[str, Optional[str]] = _headers or {}
795795
_form_params: List[Tuple[str, str]] = []
796-
_files: Dict[str, Union[str, bytes]] = {}
796+
_files: Dict[str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]] = {}
797797
_body_params: Optional[bytes] = None
798798

799799
# process the path parameters
@@ -875,7 +875,7 @@ def list_flavors(
875875
in the spec for a single request.
876876
:type _host_index: int, optional
877877
:return: Returns the result object.
878-
""" # noqa: E501 docstring might be too long
878+
""" # noqa: E501
879879

880880
_param = self._list_flavors_serialize(
881881
project_id=project_id,
@@ -946,7 +946,7 @@ def list_flavors_with_http_info(
946946
in the spec for a single request.
947947
:type _host_index: int, optional
948948
:return: Returns the result object.
949-
""" # noqa: E501 docstring might be too long
949+
""" # noqa: E501
950950

951951
_param = self._list_flavors_serialize(
952952
project_id=project_id,
@@ -1017,7 +1017,7 @@ def list_flavors_without_preload_content(
10171017
in the spec for a single request.
10181018
:type _host_index: int, optional
10191019
:return: Returns the result object.
1020-
""" # noqa: E501 docstring might be too long
1020+
""" # noqa: E501
10211021

10221022
_param = self._list_flavors_serialize(
10231023
project_id=project_id,
@@ -1054,7 +1054,7 @@ def _list_flavors_serialize(
10541054
_query_params: List[Tuple[str, str]] = []
10551055
_header_params: Dict[str, Optional[str]] = _headers or {}
10561056
_form_params: List[Tuple[str, str]] = []
1057-
_files: Dict[str, Union[str, bytes]] = {}
1057+
_files: Dict[str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]] = {}
10581058
_body_params: Optional[bytes] = None
10591059

10601060
# process the path parameters
@@ -1127,7 +1127,7 @@ def list_instances(
11271127
in the spec for a single request.
11281128
:type _host_index: int, optional
11291129
:return: Returns the result object.
1130-
""" # noqa: E501 docstring might be too long
1130+
""" # noqa: E501
11311131

11321132
_param = self._list_instances_serialize(
11331133
project_id=project_id,
@@ -1190,7 +1190,7 @@ def list_instances_with_http_info(
11901190
in the spec for a single request.
11911191
:type _host_index: int, optional
11921192
:return: Returns the result object.
1193-
""" # noqa: E501 docstring might be too long
1193+
""" # noqa: E501
11941194

11951195
_param = self._list_instances_serialize(
11961196
project_id=project_id,
@@ -1253,7 +1253,7 @@ def list_instances_without_preload_content(
12531253
in the spec for a single request.
12541254
:type _host_index: int, optional
12551255
:return: Returns the result object.
1256-
""" # noqa: E501 docstring might be too long
1256+
""" # noqa: E501
12571257

12581258
_param = self._list_instances_serialize(
12591259
project_id=project_id,
@@ -1289,7 +1289,7 @@ def _list_instances_serialize(
12891289
_query_params: List[Tuple[str, str]] = []
12901290
_header_params: Dict[str, Optional[str]] = _headers or {}
12911291
_form_params: List[Tuple[str, str]] = []
1292-
_files: Dict[str, Union[str, bytes]] = {}
1292+
_files: Dict[str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]] = {}
12931293
_body_params: Optional[bytes] = None
12941294

12951295
# process the path parameters

services/git/src/stackit/git/api_client.py

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
Generated by OpenAPI Generator (https://openapi-generator.tech)
1111
1212
Do not edit the class manually.
13-
""" # noqa: E501 docstring might be too long
13+
""" # noqa: E501
1414

1515
import datetime
1616
import json
@@ -332,6 +332,10 @@ def sanitize_for_serialization(self, obj):
332332
else:
333333
obj_dict = obj.__dict__
334334

335+
if isinstance(obj_dict, list):
336+
# here we handle instances that can either be a list or something else, and only became a real list by calling to_dict()
337+
return self.sanitize_for_serialization(obj_dict)
338+
335339
return {key: self.sanitize_for_serialization(val) for key, val in obj_dict.items()}
336340

337341
def deserialize(self, response_text: str, response_type: str, content_type: Optional[str]):
@@ -351,12 +355,12 @@ def deserialize(self, response_text: str, response_type: str, content_type: Opti
351355
data = json.loads(response_text)
352356
except ValueError:
353357
data = response_text
354-
elif content_type.startswith("application/json"):
358+
elif re.match(r"^application/(json|[\w!#$&.+-^_]+\+json)\s*(;|$)", content_type, re.IGNORECASE):
355359
if response_text == "":
356360
data = ""
357361
else:
358362
data = json.loads(response_text)
359-
elif content_type.startswith("text/plain"):
363+
elif re.match(r"^text\/[a-z.+-]+\s*(;|$)", content_type, re.IGNORECASE):
360364
data = response_text
361365
else:
362366
raise ApiException(status=0, reason="Unsupported content type: {0}".format(content_type))
@@ -458,7 +462,7 @@ def parameters_to_url_query(self, params, collection_formats):
458462
if k in collection_formats:
459463
collection_format = collection_formats[k]
460464
if collection_format == "multi":
461-
new_params.extend((k, str(value)) for value in v)
465+
new_params.extend((k, quote(str(value))) for value in v)
462466
else:
463467
if collection_format == "ssv":
464468
delimiter = " "
@@ -474,7 +478,10 @@ def parameters_to_url_query(self, params, collection_formats):
474478

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

477-
def files_parameters(self, files: Dict[str, Union[str, bytes]]):
481+
def files_parameters(
482+
self,
483+
files: Dict[str, Union[str, bytes, List[str], List[bytes], Tuple[str, bytes]]],
484+
):
478485
"""Builds form parameters.
479486
480487
:param files: File parameters.
@@ -489,6 +496,12 @@ def files_parameters(self, files: Dict[str, Union[str, bytes]]):
489496
elif isinstance(v, bytes):
490497
filename = k
491498
filedata = v
499+
elif isinstance(v, tuple):
500+
filename, filedata = v
501+
elif isinstance(v, list):
502+
for file_param in v:
503+
params.extend(self.files_parameters({k: file_param}))
504+
continue
492505
else:
493506
raise ValueError("Unsupported file value")
494507
mimetype = mimetypes.guess_type(filename)[0] or "application/octet-stream"

0 commit comments

Comments
 (0)