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