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