dapla-toolbelt-metadata 0.2.6__py3-none-any.whl → 0.4.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.

Potentially problematic release.


This version of dapla-toolbelt-metadata might be problematic. Click here for more details.

Files changed (69) hide show
  1. dapla_metadata/__init__.py +1 -0
  2. dapla_metadata/_shared/__init__.py +1 -0
  3. dapla_metadata/{datasets → _shared}/config.py +42 -11
  4. dapla_metadata/_shared/enums.py +28 -0
  5. dapla_metadata/{datasets → _shared}/user_info.py +30 -3
  6. dapla_metadata/datasets/core.py +4 -2
  7. dapla_metadata/datasets/utility/enums.py +0 -19
  8. dapla_metadata/datasets/utility/utils.py +13 -0
  9. dapla_metadata/variable_definitions/__init__.py +7 -0
  10. dapla_metadata/variable_definitions/_client.py +30 -0
  11. dapla_metadata/variable_definitions/config.py +49 -0
  12. dapla_metadata/variable_definitions/exceptions.py +66 -0
  13. dapla_metadata/variable_definitions/generated/.openapi-generator/FILES +22 -0
  14. dapla_metadata/variable_definitions/generated/.openapi-generator/VERSION +1 -0
  15. dapla_metadata/variable_definitions/generated/.openapi-generator-ignore +6 -0
  16. dapla_metadata/variable_definitions/generated/README.md +148 -0
  17. dapla_metadata/variable_definitions/generated/__init__.py +0 -0
  18. dapla_metadata/variable_definitions/generated/vardef_client/__init__.py +52 -0
  19. dapla_metadata/variable_definitions/generated/vardef_client/api/__init__.py +9 -0
  20. dapla_metadata/variable_definitions/generated/vardef_client/api/data_migration_api.py +313 -0
  21. dapla_metadata/variable_definitions/generated/vardef_client/api/draft_variable_definitions_api.py +919 -0
  22. dapla_metadata/variable_definitions/generated/vardef_client/api/patches_api.py +919 -0
  23. dapla_metadata/variable_definitions/generated/vardef_client/api/public_api.py +915 -0
  24. dapla_metadata/variable_definitions/generated/vardef_client/api/validity_periods_api.py +876 -0
  25. dapla_metadata/variable_definitions/generated/vardef_client/api/variable_definitions_api.py +1205 -0
  26. dapla_metadata/variable_definitions/generated/vardef_client/api_client.py +779 -0
  27. dapla_metadata/variable_definitions/generated/vardef_client/api_response.py +27 -0
  28. dapla_metadata/variable_definitions/generated/vardef_client/configuration.py +474 -0
  29. dapla_metadata/variable_definitions/generated/vardef_client/docs/CompleteResponse.md +51 -0
  30. dapla_metadata/variable_definitions/generated/vardef_client/docs/Contact.md +30 -0
  31. dapla_metadata/variable_definitions/generated/vardef_client/docs/DataMigrationApi.md +90 -0
  32. dapla_metadata/variable_definitions/generated/vardef_client/docs/Draft.md +42 -0
  33. dapla_metadata/variable_definitions/generated/vardef_client/docs/DraftVariableDefinitionsApi.md +259 -0
  34. dapla_metadata/variable_definitions/generated/vardef_client/docs/LanguageStringType.md +31 -0
  35. dapla_metadata/variable_definitions/generated/vardef_client/docs/Owner.md +31 -0
  36. dapla_metadata/variable_definitions/generated/vardef_client/docs/Patch.md +43 -0
  37. dapla_metadata/variable_definitions/generated/vardef_client/docs/PatchesApi.md +249 -0
  38. dapla_metadata/variable_definitions/generated/vardef_client/docs/PublicApi.md +218 -0
  39. dapla_metadata/variable_definitions/generated/vardef_client/docs/SupportedLanguages.md +15 -0
  40. dapla_metadata/variable_definitions/generated/vardef_client/docs/UpdateDraft.md +44 -0
  41. dapla_metadata/variable_definitions/generated/vardef_client/docs/ValidityPeriod.md +42 -0
  42. dapla_metadata/variable_definitions/generated/vardef_client/docs/ValidityPeriodsApi.md +236 -0
  43. dapla_metadata/variable_definitions/generated/vardef_client/docs/VariableDefinitionsApi.md +304 -0
  44. dapla_metadata/variable_definitions/generated/vardef_client/docs/VariableStatus.md +17 -0
  45. dapla_metadata/variable_definitions/generated/vardef_client/exceptions.py +193 -0
  46. dapla_metadata/variable_definitions/generated/vardef_client/models/__init__.py +30 -0
  47. dapla_metadata/variable_definitions/generated/vardef_client/models/complete_response.py +284 -0
  48. dapla_metadata/variable_definitions/generated/vardef_client/models/contact.py +94 -0
  49. dapla_metadata/variable_definitions/generated/vardef_client/models/draft.py +243 -0
  50. dapla_metadata/variable_definitions/generated/vardef_client/models/klass_reference.py +99 -0
  51. dapla_metadata/variable_definitions/generated/vardef_client/models/language_string_type.py +104 -0
  52. dapla_metadata/variable_definitions/generated/vardef_client/models/owner.py +90 -0
  53. dapla_metadata/variable_definitions/generated/vardef_client/models/patch.py +289 -0
  54. dapla_metadata/variable_definitions/generated/vardef_client/models/problem.py +118 -0
  55. dapla_metadata/variable_definitions/generated/vardef_client/models/rendered_contact.py +92 -0
  56. dapla_metadata/variable_definitions/generated/vardef_client/models/rendered_variable_definition.py +235 -0
  57. dapla_metadata/variable_definitions/generated/vardef_client/models/supported_languages.py +33 -0
  58. dapla_metadata/variable_definitions/generated/vardef_client/models/update_draft.py +307 -0
  59. dapla_metadata/variable_definitions/generated/vardef_client/models/validity_period.py +259 -0
  60. dapla_metadata/variable_definitions/generated/vardef_client/models/variable_status.py +33 -0
  61. dapla_metadata/variable_definitions/generated/vardef_client/py.typed +0 -0
  62. dapla_metadata/variable_definitions/generated/vardef_client/rest.py +249 -0
  63. dapla_metadata/variable_definitions/vardef.py +173 -0
  64. dapla_metadata/variable_definitions/variable_definition.py +212 -0
  65. {dapla_toolbelt_metadata-0.2.6.dist-info → dapla_toolbelt_metadata-0.4.0.dist-info}/METADATA +1 -1
  66. dapla_toolbelt_metadata-0.4.0.dist-info/RECORD +80 -0
  67. dapla_toolbelt_metadata-0.2.6.dist-info/RECORD +0 -22
  68. {dapla_toolbelt_metadata-0.2.6.dist-info → dapla_toolbelt_metadata-0.4.0.dist-info}/LICENSE +0 -0
  69. {dapla_toolbelt_metadata-0.2.6.dist-info → dapla_toolbelt_metadata-0.4.0.dist-info}/WHEEL +0 -0
@@ -0,0 +1,919 @@
1
+ """Variable Definitions
2
+
3
+ ## Introduction Variable Definitions are centralized definitions of concrete variables which are typically present in multiple datasets. Variable Definitions support standardization of data and metadata and facilitate sharing and joining of data by clarifying when variables have an identical definition. ## Maintenance of Variable Definitions This API allows for creation, maintenance and access of Variable Definitions. ### Ownership Creation and maintenance of variables may only be performed by Statistics Norway employees representing a specific Dapla team, who are defined as the owners of a given Variable Definition. The team an owner represents must be specified when making a request through the `active_group` query parameter. All maintenance is to be performed by the owners, with no intervention from administrators. ### Status All Variable Definitions have an associated status. The possible values for status are `DRAFT`, `PUBLISHED_INTERNAL` and `PUBLISHED_EXTERNAL`. #### Draft When a Variable Definition is created it is assigned the status `DRAFT`. Under this status the Variable Definition is: - Only visible to Statistics Norway employees. - Mutable (it may be changed directly without need for versioning). - Not suitable to refer to from other systems. This status may be changed to `PUBLISHED_INTERNAL` or `PUBLISHED_EXTERNAL` with a direct update. #### Published Internal Under this status the Variable Definition is: - Only visible to Statistics Norway employees. - Immutable (all changes are versioned). - Suitable to refer to in internal systems for statistics production. - Not suitable to refer to for external use (for example in Statistikkbanken). This status may be changed to `PUBLISHED_EXTERNAL` by creating a Patch version. #### Published External Under this status the Variable Definition is: - Visible to the general public. - Immutable (all changes are versioned). - Suitable to refer to from any system. This status may not be changed as it would break immutability. If a Variable Definition is no longer relevant then its period of validity should be ended by specifying a `valid_until` date in a Patch version. ### Immutability Variable Definitions are immutable. This means that any changes must be performed in a strict versioning system. Consumers can avoid being exposed to breaking changes by specifying a `date_of_validity` when they request a Variable Definition. #### Patches Patches are for changes which do not affect the fundamental meaning of the Variable Definition. #### Validity Periods Validity Periods are versions with a period defined by a `valid_from` date and optionally a `valid_until` date. If the fundamental meaning of a Variable Definition is to be changed, it should be done by creating a new Validity Period.
4
+
5
+ The version of the OpenAPI document: 0.1
6
+ Contact: metadata@ssb.no
7
+ Generated by OpenAPI Generator (https://openapi-generator.tech)
8
+
9
+ Do not edit the class manually.
10
+ """
11
+
12
+ from datetime import date
13
+ from typing import Annotated
14
+ from typing import Any
15
+
16
+ from pydantic import Field
17
+ from pydantic import StrictFloat
18
+ from pydantic import StrictInt
19
+ from pydantic import StrictStr
20
+ from pydantic import validate_call
21
+
22
+ from ..api_client import ApiClient
23
+ from ..api_client import RequestSerialized
24
+ from ..api_response import ApiResponse
25
+ from ..models.complete_response import CompleteResponse
26
+ from ..models.patch import Patch
27
+ from ..rest import RESTResponseType
28
+
29
+
30
+ class PatchesApi:
31
+ """NOTE: This class is auto generated by OpenAPI Generator
32
+ Ref: https://openapi-generator.tech
33
+
34
+ Do not edit the class manually.
35
+ """
36
+
37
+ def __init__(self, api_client=None) -> None:
38
+ if api_client is None:
39
+ api_client = ApiClient.get_default()
40
+ self.api_client = api_client
41
+
42
+ @validate_call
43
+ def create_patch(
44
+ self,
45
+ variable_definition_id: Annotated[
46
+ StrictStr,
47
+ Field(description="Unique identifier for the variable definition."),
48
+ ],
49
+ active_group: Annotated[
50
+ StrictStr,
51
+ Field(description="The group which the user currently represents."),
52
+ ],
53
+ patch: Patch,
54
+ valid_from: Annotated[
55
+ date | None,
56
+ Field(
57
+ description="Valid from date for the specific validity period to be patched."
58
+ ),
59
+ ] = None,
60
+ _request_timeout: None
61
+ | Annotated[StrictFloat, Field(gt=0)]
62
+ | tuple[
63
+ Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]
64
+ ] = None,
65
+ _request_auth: dict[StrictStr, Any] | None = None,
66
+ _content_type: StrictStr | None = None,
67
+ _headers: dict[StrictStr, Any] | None = None,
68
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
69
+ ) -> CompleteResponse:
70
+ """Create a new patch for a variable definition.
71
+
72
+ Create a new patch for a variable definition.
73
+
74
+ :param variable_definition_id: Unique identifier for the variable definition. (required)
75
+ :type variable_definition_id: str
76
+ :param active_group: The group which the user currently represents. (required)
77
+ :type active_group: str
78
+ :param patch: (required)
79
+ :type patch: Patch
80
+ :param valid_from: Valid from date for the specific validity period to be patched.
81
+ :type valid_from: date
82
+ :param _request_timeout: timeout setting for this request. If one
83
+ number provided, it will be total request
84
+ timeout. It can also be a pair (tuple) of
85
+ (connection, read) timeouts.
86
+ :type _request_timeout: int, tuple(int, int), optional
87
+ :param _request_auth: set to override the auth_settings for an a single
88
+ request; this effectively ignores the
89
+ authentication in the spec for a single request.
90
+ :type _request_auth: dict, optional
91
+ :param _content_type: force content-type for the request.
92
+ :type _content_type: str, Optional
93
+ :param _headers: set to override the headers for a single
94
+ request; this effectively ignores the headers
95
+ in the spec for a single request.
96
+ :type _headers: dict, optional
97
+ :param _host_index: set to override the host_index for a single
98
+ request; this effectively ignores the host_index
99
+ in the spec for a single request.
100
+ :type _host_index: int, optional
101
+ :return: Returns the result object.
102
+ """
103
+ _param = self._create_patch_serialize(
104
+ variable_definition_id=variable_definition_id,
105
+ active_group=active_group,
106
+ patch=patch,
107
+ valid_from=valid_from,
108
+ _request_auth=_request_auth,
109
+ _content_type=_content_type,
110
+ _headers=_headers,
111
+ _host_index=_host_index,
112
+ )
113
+
114
+ _response_types_map: dict[str, str | None] = {
115
+ "201": "CompleteResponse",
116
+ "404": "Problem",
117
+ "400": "Problem",
118
+ "405": "Problem",
119
+ }
120
+ response_data = self.api_client.call_api(
121
+ *_param,
122
+ _request_timeout=_request_timeout,
123
+ )
124
+ response_data.read()
125
+ return self.api_client.response_deserialize(
126
+ response_data=response_data,
127
+ response_types_map=_response_types_map,
128
+ ).data
129
+
130
+ @validate_call
131
+ def create_patch_with_http_info(
132
+ self,
133
+ variable_definition_id: Annotated[
134
+ StrictStr,
135
+ Field(description="Unique identifier for the variable definition."),
136
+ ],
137
+ active_group: Annotated[
138
+ StrictStr,
139
+ Field(description="The group which the user currently represents."),
140
+ ],
141
+ patch: Patch,
142
+ valid_from: Annotated[
143
+ date | None,
144
+ Field(
145
+ description="Valid from date for the specific validity period to be patched."
146
+ ),
147
+ ] = None,
148
+ _request_timeout: None
149
+ | Annotated[StrictFloat, Field(gt=0)]
150
+ | tuple[
151
+ Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]
152
+ ] = None,
153
+ _request_auth: dict[StrictStr, Any] | None = None,
154
+ _content_type: StrictStr | None = None,
155
+ _headers: dict[StrictStr, Any] | None = None,
156
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
157
+ ) -> ApiResponse[CompleteResponse]:
158
+ """Create a new patch for a variable definition.
159
+
160
+ Create a new patch for a variable definition.
161
+
162
+ :param variable_definition_id: Unique identifier for the variable definition. (required)
163
+ :type variable_definition_id: str
164
+ :param active_group: The group which the user currently represents. (required)
165
+ :type active_group: str
166
+ :param patch: (required)
167
+ :type patch: Patch
168
+ :param valid_from: Valid from date for the specific validity period to be patched.
169
+ :type valid_from: date
170
+ :param _request_timeout: timeout setting for this request. If one
171
+ number provided, it will be total request
172
+ timeout. It can also be a pair (tuple) of
173
+ (connection, read) timeouts.
174
+ :type _request_timeout: int, tuple(int, int), optional
175
+ :param _request_auth: set to override the auth_settings for an a single
176
+ request; this effectively ignores the
177
+ authentication in the spec for a single request.
178
+ :type _request_auth: dict, optional
179
+ :param _content_type: force content-type for the request.
180
+ :type _content_type: str, Optional
181
+ :param _headers: set to override the headers for a single
182
+ request; this effectively ignores the headers
183
+ in the spec for a single request.
184
+ :type _headers: dict, optional
185
+ :param _host_index: set to override the host_index for a single
186
+ request; this effectively ignores the host_index
187
+ in the spec for a single request.
188
+ :type _host_index: int, optional
189
+ :return: Returns the result object.
190
+ """
191
+ _param = self._create_patch_serialize(
192
+ variable_definition_id=variable_definition_id,
193
+ active_group=active_group,
194
+ patch=patch,
195
+ valid_from=valid_from,
196
+ _request_auth=_request_auth,
197
+ _content_type=_content_type,
198
+ _headers=_headers,
199
+ _host_index=_host_index,
200
+ )
201
+
202
+ _response_types_map: dict[str, str | None] = {
203
+ "201": "CompleteResponse",
204
+ "404": "Problem",
205
+ "400": "Problem",
206
+ "405": "Problem",
207
+ }
208
+ response_data = self.api_client.call_api(
209
+ *_param,
210
+ _request_timeout=_request_timeout,
211
+ )
212
+ response_data.read()
213
+ return self.api_client.response_deserialize(
214
+ response_data=response_data,
215
+ response_types_map=_response_types_map,
216
+ )
217
+
218
+ @validate_call
219
+ def create_patch_without_preload_content(
220
+ self,
221
+ variable_definition_id: Annotated[
222
+ StrictStr,
223
+ Field(description="Unique identifier for the variable definition."),
224
+ ],
225
+ active_group: Annotated[
226
+ StrictStr,
227
+ Field(description="The group which the user currently represents."),
228
+ ],
229
+ patch: Patch,
230
+ valid_from: Annotated[
231
+ date | None,
232
+ Field(
233
+ description="Valid from date for the specific validity period to be patched."
234
+ ),
235
+ ] = None,
236
+ _request_timeout: None
237
+ | Annotated[StrictFloat, Field(gt=0)]
238
+ | tuple[
239
+ Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]
240
+ ] = None,
241
+ _request_auth: dict[StrictStr, Any] | None = None,
242
+ _content_type: StrictStr | None = None,
243
+ _headers: dict[StrictStr, Any] | None = None,
244
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
245
+ ) -> RESTResponseType:
246
+ """Create a new patch for a variable definition.
247
+
248
+ Create a new patch for a variable definition.
249
+
250
+ :param variable_definition_id: Unique identifier for the variable definition. (required)
251
+ :type variable_definition_id: str
252
+ :param active_group: The group which the user currently represents. (required)
253
+ :type active_group: str
254
+ :param patch: (required)
255
+ :type patch: Patch
256
+ :param valid_from: Valid from date for the specific validity period to be patched.
257
+ :type valid_from: date
258
+ :param _request_timeout: timeout setting for this request. If one
259
+ number provided, it will be total request
260
+ timeout. It can also be a pair (tuple) of
261
+ (connection, read) timeouts.
262
+ :type _request_timeout: int, tuple(int, int), optional
263
+ :param _request_auth: set to override the auth_settings for an a single
264
+ request; this effectively ignores the
265
+ authentication in the spec for a single request.
266
+ :type _request_auth: dict, optional
267
+ :param _content_type: force content-type for the request.
268
+ :type _content_type: str, Optional
269
+ :param _headers: set to override the headers for a single
270
+ request; this effectively ignores the headers
271
+ in the spec for a single request.
272
+ :type _headers: dict, optional
273
+ :param _host_index: set to override the host_index for a single
274
+ request; this effectively ignores the host_index
275
+ in the spec for a single request.
276
+ :type _host_index: int, optional
277
+ :return: Returns the result object.
278
+ """
279
+ _param = self._create_patch_serialize(
280
+ variable_definition_id=variable_definition_id,
281
+ active_group=active_group,
282
+ patch=patch,
283
+ valid_from=valid_from,
284
+ _request_auth=_request_auth,
285
+ _content_type=_content_type,
286
+ _headers=_headers,
287
+ _host_index=_host_index,
288
+ )
289
+
290
+ _response_types_map: dict[str, str | None] = {
291
+ "201": "CompleteResponse",
292
+ "404": "Problem",
293
+ "400": "Problem",
294
+ "405": "Problem",
295
+ }
296
+ response_data = self.api_client.call_api(
297
+ *_param,
298
+ _request_timeout=_request_timeout,
299
+ )
300
+ return response_data.response
301
+
302
+ def _create_patch_serialize(
303
+ self,
304
+ variable_definition_id,
305
+ active_group,
306
+ patch,
307
+ valid_from,
308
+ _request_auth,
309
+ _content_type,
310
+ _headers,
311
+ _host_index,
312
+ ) -> RequestSerialized:
313
+ _host = None
314
+
315
+ _collection_formats: dict[str, str] = {}
316
+
317
+ _path_params: dict[str, str] = {}
318
+ _query_params: list[tuple[str, str]] = []
319
+ _header_params: dict[str, str | None] = _headers or {}
320
+ _form_params: list[tuple[str, str]] = []
321
+ _files: dict[
322
+ str,
323
+ str | bytes | list[str] | list[bytes] | list[tuple[str, bytes]],
324
+ ] = {}
325
+ _body_params: bytes | None = None
326
+
327
+ # process the path parameters
328
+ if variable_definition_id is not None:
329
+ _path_params["variable-definition-id"] = variable_definition_id
330
+ # process the query parameters
331
+ if valid_from is not None:
332
+ if isinstance(valid_from, date):
333
+ _query_params.append(
334
+ (
335
+ "valid_from",
336
+ valid_from.strftime(
337
+ self.api_client.configuration.date_format,
338
+ ),
339
+ ),
340
+ )
341
+ else:
342
+ _query_params.append(("valid_from", valid_from))
343
+
344
+ if active_group is not None:
345
+ _query_params.append(("active_group", active_group))
346
+
347
+ # process the header parameters
348
+ # process the form parameters
349
+ # process the body parameter
350
+ if patch is not None:
351
+ _body_params = patch
352
+
353
+ # set the HTTP header `Accept`
354
+ if "Accept" not in _header_params:
355
+ _header_params["Accept"] = self.api_client.select_header_accept(
356
+ [
357
+ "application/json",
358
+ "application/problem+json",
359
+ ],
360
+ )
361
+
362
+ # set the HTTP header `Content-Type`
363
+ if _content_type:
364
+ _header_params["Content-Type"] = _content_type
365
+ else:
366
+ _default_content_type = self.api_client.select_header_content_type(
367
+ [
368
+ "application/json",
369
+ ],
370
+ )
371
+ if _default_content_type is not None:
372
+ _header_params["Content-Type"] = _default_content_type
373
+
374
+ # authentication setting
375
+ _auth_settings: list[str] = [
376
+ "keycloak_token",
377
+ ]
378
+
379
+ return self.api_client.param_serialize(
380
+ method="POST",
381
+ resource_path="/variable-definitions/{variable-definition-id}/patches",
382
+ path_params=_path_params,
383
+ query_params=_query_params,
384
+ header_params=_header_params,
385
+ body=_body_params,
386
+ post_params=_form_params,
387
+ files=_files,
388
+ auth_settings=_auth_settings,
389
+ collection_formats=_collection_formats,
390
+ _host=_host,
391
+ _request_auth=_request_auth,
392
+ )
393
+
394
+ @validate_call
395
+ def get_patch(
396
+ self,
397
+ variable_definition_id: Annotated[
398
+ StrictStr,
399
+ Field(description="Unique identifier for the variable definition."),
400
+ ],
401
+ patch_id: Annotated[
402
+ StrictInt, Field(description="ID of the patch to retrieve")
403
+ ],
404
+ _request_timeout: None
405
+ | Annotated[StrictFloat, Field(gt=0)]
406
+ | tuple[
407
+ Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]
408
+ ] = None,
409
+ _request_auth: dict[StrictStr, Any] | None = None,
410
+ _content_type: StrictStr | None = None,
411
+ _headers: dict[StrictStr, Any] | None = None,
412
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
413
+ ) -> CompleteResponse:
414
+ """Get one concrete patch for the given variable definition.
415
+
416
+ Get one concrete patch for the given variable definition. The full object is returned for comparison purposes.
417
+
418
+ :param variable_definition_id: Unique identifier for the variable definition. (required)
419
+ :type variable_definition_id: str
420
+ :param patch_id: ID of the patch to retrieve (required)
421
+ :type patch_id: int
422
+ :param _request_timeout: timeout setting for this request. If one
423
+ number provided, it will be total request
424
+ timeout. It can also be a pair (tuple) of
425
+ (connection, read) timeouts.
426
+ :type _request_timeout: int, tuple(int, int), optional
427
+ :param _request_auth: set to override the auth_settings for an a single
428
+ request; this effectively ignores the
429
+ authentication in the spec for a single request.
430
+ :type _request_auth: dict, optional
431
+ :param _content_type: force content-type for the request.
432
+ :type _content_type: str, Optional
433
+ :param _headers: set to override the headers for a single
434
+ request; this effectively ignores the headers
435
+ in the spec for a single request.
436
+ :type _headers: dict, optional
437
+ :param _host_index: set to override the host_index for a single
438
+ request; this effectively ignores the host_index
439
+ in the spec for a single request.
440
+ :type _host_index: int, optional
441
+ :return: Returns the result object.
442
+ """
443
+ _param = self._get_patch_serialize(
444
+ variable_definition_id=variable_definition_id,
445
+ patch_id=patch_id,
446
+ _request_auth=_request_auth,
447
+ _content_type=_content_type,
448
+ _headers=_headers,
449
+ _host_index=_host_index,
450
+ )
451
+
452
+ _response_types_map: dict[str, str | None] = {
453
+ "200": "CompleteResponse",
454
+ "404": "Problem",
455
+ }
456
+ response_data = self.api_client.call_api(
457
+ *_param,
458
+ _request_timeout=_request_timeout,
459
+ )
460
+ response_data.read()
461
+ return self.api_client.response_deserialize(
462
+ response_data=response_data,
463
+ response_types_map=_response_types_map,
464
+ ).data
465
+
466
+ @validate_call
467
+ def get_patch_with_http_info(
468
+ self,
469
+ variable_definition_id: Annotated[
470
+ StrictStr,
471
+ Field(description="Unique identifier for the variable definition."),
472
+ ],
473
+ patch_id: Annotated[
474
+ StrictInt, Field(description="ID of the patch to retrieve")
475
+ ],
476
+ _request_timeout: None
477
+ | Annotated[StrictFloat, Field(gt=0)]
478
+ | tuple[
479
+ Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]
480
+ ] = None,
481
+ _request_auth: dict[StrictStr, Any] | None = None,
482
+ _content_type: StrictStr | None = None,
483
+ _headers: dict[StrictStr, Any] | None = None,
484
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
485
+ ) -> ApiResponse[CompleteResponse]:
486
+ """Get one concrete patch for the given variable definition.
487
+
488
+ Get one concrete patch for the given variable definition. The full object is returned for comparison purposes.
489
+
490
+ :param variable_definition_id: Unique identifier for the variable definition. (required)
491
+ :type variable_definition_id: str
492
+ :param patch_id: ID of the patch to retrieve (required)
493
+ :type patch_id: int
494
+ :param _request_timeout: timeout setting for this request. If one
495
+ number provided, it will be total request
496
+ timeout. It can also be a pair (tuple) of
497
+ (connection, read) timeouts.
498
+ :type _request_timeout: int, tuple(int, int), optional
499
+ :param _request_auth: set to override the auth_settings for an a single
500
+ request; this effectively ignores the
501
+ authentication in the spec for a single request.
502
+ :type _request_auth: dict, optional
503
+ :param _content_type: force content-type for the request.
504
+ :type _content_type: str, Optional
505
+ :param _headers: set to override the headers for a single
506
+ request; this effectively ignores the headers
507
+ in the spec for a single request.
508
+ :type _headers: dict, optional
509
+ :param _host_index: set to override the host_index for a single
510
+ request; this effectively ignores the host_index
511
+ in the spec for a single request.
512
+ :type _host_index: int, optional
513
+ :return: Returns the result object.
514
+ """
515
+ _param = self._get_patch_serialize(
516
+ variable_definition_id=variable_definition_id,
517
+ patch_id=patch_id,
518
+ _request_auth=_request_auth,
519
+ _content_type=_content_type,
520
+ _headers=_headers,
521
+ _host_index=_host_index,
522
+ )
523
+
524
+ _response_types_map: dict[str, str | None] = {
525
+ "200": "CompleteResponse",
526
+ "404": "Problem",
527
+ }
528
+ response_data = self.api_client.call_api(
529
+ *_param,
530
+ _request_timeout=_request_timeout,
531
+ )
532
+ response_data.read()
533
+ return self.api_client.response_deserialize(
534
+ response_data=response_data,
535
+ response_types_map=_response_types_map,
536
+ )
537
+
538
+ @validate_call
539
+ def get_patch_without_preload_content(
540
+ self,
541
+ variable_definition_id: Annotated[
542
+ StrictStr,
543
+ Field(description="Unique identifier for the variable definition."),
544
+ ],
545
+ patch_id: Annotated[
546
+ StrictInt, Field(description="ID of the patch to retrieve")
547
+ ],
548
+ _request_timeout: None
549
+ | Annotated[StrictFloat, Field(gt=0)]
550
+ | tuple[
551
+ Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]
552
+ ] = None,
553
+ _request_auth: dict[StrictStr, Any] | None = None,
554
+ _content_type: StrictStr | None = None,
555
+ _headers: dict[StrictStr, Any] | None = None,
556
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
557
+ ) -> RESTResponseType:
558
+ """Get one concrete patch for the given variable definition.
559
+
560
+ Get one concrete patch for the given variable definition. The full object is returned for comparison purposes.
561
+
562
+ :param variable_definition_id: Unique identifier for the variable definition. (required)
563
+ :type variable_definition_id: str
564
+ :param patch_id: ID of the patch to retrieve (required)
565
+ :type patch_id: int
566
+ :param _request_timeout: timeout setting for this request. If one
567
+ number provided, it will be total request
568
+ timeout. It can also be a pair (tuple) of
569
+ (connection, read) timeouts.
570
+ :type _request_timeout: int, tuple(int, int), optional
571
+ :param _request_auth: set to override the auth_settings for an a single
572
+ request; this effectively ignores the
573
+ authentication in the spec for a single request.
574
+ :type _request_auth: dict, optional
575
+ :param _content_type: force content-type for the request.
576
+ :type _content_type: str, Optional
577
+ :param _headers: set to override the headers for a single
578
+ request; this effectively ignores the headers
579
+ in the spec for a single request.
580
+ :type _headers: dict, optional
581
+ :param _host_index: set to override the host_index for a single
582
+ request; this effectively ignores the host_index
583
+ in the spec for a single request.
584
+ :type _host_index: int, optional
585
+ :return: Returns the result object.
586
+ """
587
+ _param = self._get_patch_serialize(
588
+ variable_definition_id=variable_definition_id,
589
+ patch_id=patch_id,
590
+ _request_auth=_request_auth,
591
+ _content_type=_content_type,
592
+ _headers=_headers,
593
+ _host_index=_host_index,
594
+ )
595
+
596
+ _response_types_map: dict[str, str | None] = {
597
+ "200": "CompleteResponse",
598
+ "404": "Problem",
599
+ }
600
+ response_data = self.api_client.call_api(
601
+ *_param,
602
+ _request_timeout=_request_timeout,
603
+ )
604
+ return response_data.response
605
+
606
+ def _get_patch_serialize(
607
+ self,
608
+ variable_definition_id,
609
+ patch_id,
610
+ _request_auth,
611
+ _content_type,
612
+ _headers,
613
+ _host_index,
614
+ ) -> RequestSerialized:
615
+ _host = None
616
+
617
+ _collection_formats: dict[str, str] = {}
618
+
619
+ _path_params: dict[str, str] = {}
620
+ _query_params: list[tuple[str, str]] = []
621
+ _header_params: dict[str, str | None] = _headers or {}
622
+ _form_params: list[tuple[str, str]] = []
623
+ _files: dict[
624
+ str,
625
+ str | bytes | list[str] | list[bytes] | list[tuple[str, bytes]],
626
+ ] = {}
627
+ _body_params: bytes | None = None
628
+
629
+ # process the path parameters
630
+ if variable_definition_id is not None:
631
+ _path_params["variable-definition-id"] = variable_definition_id
632
+ if patch_id is not None:
633
+ _path_params["patch-id"] = patch_id
634
+ # process the query parameters
635
+ # process the header parameters
636
+ # process the form parameters
637
+ # process the body parameter
638
+
639
+ # set the HTTP header `Accept`
640
+ if "Accept" not in _header_params:
641
+ _header_params["Accept"] = self.api_client.select_header_accept(
642
+ [
643
+ "application/json",
644
+ "application/problem+json",
645
+ ],
646
+ )
647
+
648
+ # authentication setting
649
+ _auth_settings: list[str] = [
650
+ "keycloak_token",
651
+ ]
652
+
653
+ return self.api_client.param_serialize(
654
+ method="GET",
655
+ resource_path="/variable-definitions/{variable-definition-id}/patches/{patch-id}",
656
+ path_params=_path_params,
657
+ query_params=_query_params,
658
+ header_params=_header_params,
659
+ body=_body_params,
660
+ post_params=_form_params,
661
+ files=_files,
662
+ auth_settings=_auth_settings,
663
+ collection_formats=_collection_formats,
664
+ _host=_host,
665
+ _request_auth=_request_auth,
666
+ )
667
+
668
+ @validate_call
669
+ def list_patches(
670
+ self,
671
+ variable_definition_id: Annotated[
672
+ StrictStr,
673
+ Field(description="Unique identifier for the variable definition."),
674
+ ],
675
+ _request_timeout: None
676
+ | Annotated[StrictFloat, Field(gt=0)]
677
+ | tuple[
678
+ Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]
679
+ ] = None,
680
+ _request_auth: dict[StrictStr, Any] | None = None,
681
+ _content_type: StrictStr | None = None,
682
+ _headers: dict[StrictStr, Any] | None = None,
683
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
684
+ ) -> list[CompleteResponse]:
685
+ """List all patches for the given variable definition.
686
+
687
+ List all patches for the given variable definition. The full object is returned for comparison purposes.
688
+
689
+ :param variable_definition_id: Unique identifier for the variable definition. (required)
690
+ :type variable_definition_id: str
691
+ :param _request_timeout: timeout setting for this request. If one
692
+ number provided, it will be total request
693
+ timeout. It can also be a pair (tuple) of
694
+ (connection, read) timeouts.
695
+ :type _request_timeout: int, tuple(int, int), optional
696
+ :param _request_auth: set to override the auth_settings for an a single
697
+ request; this effectively ignores the
698
+ authentication in the spec for a single request.
699
+ :type _request_auth: dict, optional
700
+ :param _content_type: force content-type for the request.
701
+ :type _content_type: str, Optional
702
+ :param _headers: set to override the headers for a single
703
+ request; this effectively ignores the headers
704
+ in the spec for a single request.
705
+ :type _headers: dict, optional
706
+ :param _host_index: set to override the host_index for a single
707
+ request; this effectively ignores the host_index
708
+ in the spec for a single request.
709
+ :type _host_index: int, optional
710
+ :return: Returns the result object.
711
+ """
712
+ _param = self._list_patches_serialize(
713
+ variable_definition_id=variable_definition_id,
714
+ _request_auth=_request_auth,
715
+ _content_type=_content_type,
716
+ _headers=_headers,
717
+ _host_index=_host_index,
718
+ )
719
+
720
+ _response_types_map: dict[str, str | None] = {
721
+ "200": "List[CompleteResponse]",
722
+ "404": "Problem",
723
+ }
724
+ response_data = self.api_client.call_api(
725
+ *_param,
726
+ _request_timeout=_request_timeout,
727
+ )
728
+ response_data.read()
729
+ return self.api_client.response_deserialize(
730
+ response_data=response_data,
731
+ response_types_map=_response_types_map,
732
+ ).data
733
+
734
+ @validate_call
735
+ def list_patches_with_http_info(
736
+ self,
737
+ variable_definition_id: Annotated[
738
+ StrictStr,
739
+ Field(description="Unique identifier for the variable definition."),
740
+ ],
741
+ _request_timeout: None
742
+ | Annotated[StrictFloat, Field(gt=0)]
743
+ | tuple[
744
+ Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]
745
+ ] = None,
746
+ _request_auth: dict[StrictStr, Any] | None = None,
747
+ _content_type: StrictStr | None = None,
748
+ _headers: dict[StrictStr, Any] | None = None,
749
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
750
+ ) -> ApiResponse[list[CompleteResponse]]:
751
+ """List all patches for the given variable definition.
752
+
753
+ List all patches for the given variable definition. The full object is returned for comparison purposes.
754
+
755
+ :param variable_definition_id: Unique identifier for the variable definition. (required)
756
+ :type variable_definition_id: str
757
+ :param _request_timeout: timeout setting for this request. If one
758
+ number provided, it will be total request
759
+ timeout. It can also be a pair (tuple) of
760
+ (connection, read) timeouts.
761
+ :type _request_timeout: int, tuple(int, int), optional
762
+ :param _request_auth: set to override the auth_settings for an a single
763
+ request; this effectively ignores the
764
+ authentication in the spec for a single request.
765
+ :type _request_auth: dict, optional
766
+ :param _content_type: force content-type for the request.
767
+ :type _content_type: str, Optional
768
+ :param _headers: set to override the headers for a single
769
+ request; this effectively ignores the headers
770
+ in the spec for a single request.
771
+ :type _headers: dict, optional
772
+ :param _host_index: set to override the host_index for a single
773
+ request; this effectively ignores the host_index
774
+ in the spec for a single request.
775
+ :type _host_index: int, optional
776
+ :return: Returns the result object.
777
+ """
778
+ _param = self._list_patches_serialize(
779
+ variable_definition_id=variable_definition_id,
780
+ _request_auth=_request_auth,
781
+ _content_type=_content_type,
782
+ _headers=_headers,
783
+ _host_index=_host_index,
784
+ )
785
+
786
+ _response_types_map: dict[str, str | None] = {
787
+ "200": "List[CompleteResponse]",
788
+ "404": "Problem",
789
+ }
790
+ response_data = self.api_client.call_api(
791
+ *_param,
792
+ _request_timeout=_request_timeout,
793
+ )
794
+ response_data.read()
795
+ return self.api_client.response_deserialize(
796
+ response_data=response_data,
797
+ response_types_map=_response_types_map,
798
+ )
799
+
800
+ @validate_call
801
+ def list_patches_without_preload_content(
802
+ self,
803
+ variable_definition_id: Annotated[
804
+ StrictStr,
805
+ Field(description="Unique identifier for the variable definition."),
806
+ ],
807
+ _request_timeout: None
808
+ | Annotated[StrictFloat, Field(gt=0)]
809
+ | tuple[
810
+ Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]
811
+ ] = None,
812
+ _request_auth: dict[StrictStr, Any] | None = None,
813
+ _content_type: StrictStr | None = None,
814
+ _headers: dict[StrictStr, Any] | None = None,
815
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
816
+ ) -> RESTResponseType:
817
+ """List all patches for the given variable definition.
818
+
819
+ List all patches for the given variable definition. The full object is returned for comparison purposes.
820
+
821
+ :param variable_definition_id: Unique identifier for the variable definition. (required)
822
+ :type variable_definition_id: str
823
+ :param _request_timeout: timeout setting for this request. If one
824
+ number provided, it will be total request
825
+ timeout. It can also be a pair (tuple) of
826
+ (connection, read) timeouts.
827
+ :type _request_timeout: int, tuple(int, int), optional
828
+ :param _request_auth: set to override the auth_settings for an a single
829
+ request; this effectively ignores the
830
+ authentication in the spec for a single request.
831
+ :type _request_auth: dict, optional
832
+ :param _content_type: force content-type for the request.
833
+ :type _content_type: str, Optional
834
+ :param _headers: set to override the headers for a single
835
+ request; this effectively ignores the headers
836
+ in the spec for a single request.
837
+ :type _headers: dict, optional
838
+ :param _host_index: set to override the host_index for a single
839
+ request; this effectively ignores the host_index
840
+ in the spec for a single request.
841
+ :type _host_index: int, optional
842
+ :return: Returns the result object.
843
+ """
844
+ _param = self._list_patches_serialize(
845
+ variable_definition_id=variable_definition_id,
846
+ _request_auth=_request_auth,
847
+ _content_type=_content_type,
848
+ _headers=_headers,
849
+ _host_index=_host_index,
850
+ )
851
+
852
+ _response_types_map: dict[str, str | None] = {
853
+ "200": "List[CompleteResponse]",
854
+ "404": "Problem",
855
+ }
856
+ response_data = self.api_client.call_api(
857
+ *_param,
858
+ _request_timeout=_request_timeout,
859
+ )
860
+ return response_data.response
861
+
862
+ def _list_patches_serialize(
863
+ self,
864
+ variable_definition_id,
865
+ _request_auth,
866
+ _content_type,
867
+ _headers,
868
+ _host_index,
869
+ ) -> RequestSerialized:
870
+ _host = None
871
+
872
+ _collection_formats: dict[str, str] = {}
873
+
874
+ _path_params: dict[str, str] = {}
875
+ _query_params: list[tuple[str, str]] = []
876
+ _header_params: dict[str, str | None] = _headers or {}
877
+ _form_params: list[tuple[str, str]] = []
878
+ _files: dict[
879
+ str,
880
+ str | bytes | list[str] | list[bytes] | list[tuple[str, bytes]],
881
+ ] = {}
882
+ _body_params: bytes | None = None
883
+
884
+ # process the path parameters
885
+ if variable_definition_id is not None:
886
+ _path_params["variable-definition-id"] = variable_definition_id
887
+ # process the query parameters
888
+ # process the header parameters
889
+ # process the form parameters
890
+ # process the body parameter
891
+
892
+ # set the HTTP header `Accept`
893
+ if "Accept" not in _header_params:
894
+ _header_params["Accept"] = self.api_client.select_header_accept(
895
+ [
896
+ "application/json",
897
+ "application/problem+json",
898
+ ],
899
+ )
900
+
901
+ # authentication setting
902
+ _auth_settings: list[str] = [
903
+ "keycloak_token",
904
+ ]
905
+
906
+ return self.api_client.param_serialize(
907
+ method="GET",
908
+ resource_path="/variable-definitions/{variable-definition-id}/patches",
909
+ path_params=_path_params,
910
+ query_params=_query_params,
911
+ header_params=_header_params,
912
+ body=_body_params,
913
+ post_params=_form_params,
914
+ files=_files,
915
+ auth_settings=_auth_settings,
916
+ collection_formats=_collection_formats,
917
+ _host=_host,
918
+ _request_auth=_request_auth,
919
+ )