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