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