weheat 2024.11.1__py3-none-any.whl → 2025.11.24rc1__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.
Files changed (42) hide show
  1. weheat/__init__.py +6 -2
  2. weheat/abstractions/__init__.py +1 -1
  3. weheat/abstractions/discovery.py +11 -7
  4. weheat/abstractions/heat_pump.py +223 -81
  5. weheat/abstractions/user.py +16 -11
  6. weheat/api/__init__.py +1 -0
  7. weheat/api/energy_log_api.py +615 -127
  8. weheat/api/heat_pump_api.py +580 -374
  9. weheat/api/heat_pump_log_api.py +884 -360
  10. weheat/api/user_api.py +260 -115
  11. weheat/api_client.py +238 -265
  12. weheat/api_response.py +11 -15
  13. weheat/configuration.py +14 -9
  14. weheat/exceptions.py +59 -25
  15. weheat/models/__init__.py +8 -0
  16. weheat/models/boiler_type.py +8 -3
  17. weheat/models/device_state.py +9 -5
  18. weheat/models/dhw_type.py +8 -3
  19. weheat/models/energy_view_dto.py +87 -65
  20. weheat/models/heat_pump_log_view_dto.py +1394 -559
  21. weheat/models/heat_pump_model.py +8 -3
  22. weheat/models/heat_pump_status_enum.py +9 -4
  23. weheat/models/pagination_metadata.py +95 -0
  24. weheat/models/raw_heat_pump_log_dto.py +438 -375
  25. weheat/models/raw_heatpump_log_and_is_online_dto.py +578 -0
  26. weheat/models/read_all_heat_pump_dto.py +69 -53
  27. weheat/models/read_all_heat_pump_dto_paged_response.py +107 -0
  28. weheat/models/read_heat_pump_dto.py +64 -48
  29. weheat/models/read_user_dto.py +55 -37
  30. weheat/models/read_user_me_dto.py +124 -0
  31. weheat/models/role.py +10 -4
  32. weheat/models/total_energy_aggregate.py +111 -0
  33. weheat/rest.py +152 -259
  34. weheat-2025.11.24rc1.dist-info/METADATA +104 -0
  35. weheat-2025.11.24rc1.dist-info/RECORD +39 -0
  36. {weheat-2024.11.1.dist-info → weheat-2025.11.24rc1.dist-info}/WHEEL +1 -1
  37. weheat/abstractions/auth.py +0 -34
  38. weheat/models/heat_pump_type.py +0 -42
  39. weheat-2024.11.1.dist-info/METADATA +0 -107
  40. weheat-2024.11.1.dist-info/RECORD +0 -36
  41. {weheat-2024.11.1.dist-info → weheat-2025.11.24rc1.dist-info/licenses}/LICENSE +0 -0
  42. {weheat-2024.11.1.dist-info → weheat-2025.11.24rc1.dist-info}/top_level.txt +0 -0
weheat/api/user_api.py CHANGED
@@ -12,25 +12,28 @@
12
12
  """ # noqa: E501
13
13
 
14
14
 
15
- import re # noqa: F401
16
15
  import io
17
16
  import warnings
18
17
 
19
- from pydantic import validate_arguments, ValidationError
18
+ from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt
19
+ from typing import Dict, List, Optional, Tuple, Union, Any
20
20
 
21
+ try:
22
+ from typing import Annotated
23
+ except ImportError:
24
+ from typing_extensions import Annotated
25
+
26
+ from pydantic import Field
21
27
  from typing_extensions import Annotated
22
- from pydantic import Field, StrictStr
28
+ from pydantic import StrictStr
23
29
 
24
30
  from typing import Optional
25
31
 
26
- from weheat.models.read_user_dto import ReadUserDto
32
+ from weheat.models.read_user_me_dto import ReadUserMeDto
27
33
 
28
34
  from weheat.api_client import ApiClient
29
35
  from weheat.api_response import ApiResponse
30
- from weheat.exceptions import ( # noqa: F401
31
- ApiTypeError,
32
- ApiValueError
33
- )
36
+ from weheat.rest import RESTResponseType
34
37
 
35
38
 
36
39
  class UserApi:
@@ -45,147 +48,289 @@ class UserApi:
45
48
  api_client = ApiClient.get_default()
46
49
  self.api_client = api_client
47
50
 
48
- @validate_arguments
49
- def api_v1_users_me_get(self, x_version : Annotated[Optional[StrictStr], Field(description="Optional version parameter for frontend applications to check if an update / refresh is needed")] = None, **kwargs) -> ReadUserDto: # noqa: E501
50
- """Me endpoint to verify everything is ok after login (also sets Name of user after registration) Please always call this after login so backend (and frontend) can verify everything is correct. # noqa: E501
51
-
52
- This method makes a synchronous HTTP request by default. To make an
53
- asynchronous HTTP request, please pass async_req=True
51
+ @validate_call
52
+ async def api_v1_users_me_get(
53
+ self,
54
+ x_version: Annotated[Optional[StrictStr], Field(description="Optional version parameter for frontend applications to check if an update / refresh is needed")] = None,
55
+ x_backend_version: Annotated[Optional[StrictStr], Field(description="Optional version parameter that the frontend can use to know whether this specific endpoint got a backwards incompatible change.")] = None,
56
+ _request_timeout: Union[
57
+ None,
58
+ Annotated[StrictFloat, Field(gt=0)],
59
+ Tuple[
60
+ Annotated[StrictFloat, Field(gt=0)],
61
+ Annotated[StrictFloat, Field(gt=0)]
62
+ ]
63
+ ] = None,
64
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
65
+ _content_type: Optional[StrictStr] = None,
66
+ _headers: Optional[Dict[StrictStr, Any]] = None,
67
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
68
+ ) -> ReadUserMeDto:
69
+ """Me endpoint to verify everything is ok after login (also sets Name of user after registration) Please always call this after login so backend (and frontend) can verify everything is correct.
54
70
 
55
- >>> thread = api.api_v1_users_me_get(x_version, async_req=True)
56
- >>> result = thread.get()
57
71
 
58
72
  :param x_version: Optional version parameter for frontend applications to check if an update / refresh is needed
59
73
  :type x_version: str
60
- :param async_req: Whether to execute the request asynchronously.
61
- :type async_req: bool, optional
62
- :param _request_timeout: timeout setting for this request.
63
- If one number provided, it will be total request
64
- timeout. It can also be a pair (tuple) of
65
- (connection, read) timeouts.
74
+ :param x_backend_version: Optional version parameter that the frontend can use to know whether this specific endpoint got a backwards incompatible change.
75
+ :type x_backend_version: str
76
+ :param _request_timeout: timeout setting for this request. If one
77
+ number provided, it will be total request
78
+ timeout. It can also be a pair (tuple) of
79
+ (connection, read) timeouts.
80
+ :type _request_timeout: int, tuple(int, int), optional
81
+ :param _request_auth: set to override the auth_settings for an a single
82
+ request; this effectively ignores the
83
+ authentication in the spec for a single request.
84
+ :type _request_auth: dict, optional
85
+ :param _content_type: force content-type for the request.
86
+ :type _content_type: str, Optional
87
+ :param _headers: set to override the headers for a single
88
+ request; this effectively ignores the headers
89
+ in the spec for a single request.
90
+ :type _headers: dict, optional
91
+ :param _host_index: set to override the host_index for a single
92
+ request; this effectively ignores the host_index
93
+ in the spec for a single request.
94
+ :type _host_index: int, optional
66
95
  :return: Returns the result object.
67
- If the method is called asynchronously,
68
- returns the request thread.
69
- :rtype: ReadUserDto
70
- """
71
- kwargs['_return_http_data_only'] = True
72
- if '_preload_content' in kwargs:
73
- message = "Error! Please call the api_v1_users_me_get_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501
74
- raise ValueError(message)
75
- return self.api_v1_users_me_get_with_http_info(x_version, **kwargs) # noqa: E501
76
-
77
- @validate_arguments
78
- def api_v1_users_me_get_with_http_info(self, x_version : Annotated[Optional[StrictStr], Field(description="Optional version parameter for frontend applications to check if an update / refresh is needed")] = None, **kwargs) -> ApiResponse: # noqa: E501
79
- """Me endpoint to verify everything is ok after login (also sets Name of user after registration) Please always call this after login so backend (and frontend) can verify everything is correct. # noqa: E501
80
-
81
- This method makes a synchronous HTTP request by default. To make an
82
- asynchronous HTTP request, please pass async_req=True
83
-
84
- >>> thread = api.api_v1_users_me_get_with_http_info(x_version, async_req=True)
85
- >>> result = thread.get()
96
+ """ # noqa: E501
97
+
98
+ _param = self._api_v1_users_me_get_serialize(
99
+ x_version=x_version,
100
+ x_backend_version=x_backend_version,
101
+ _request_auth=_request_auth,
102
+ _content_type=_content_type,
103
+ _headers=_headers,
104
+ _host_index=_host_index
105
+ )
106
+
107
+ _response_types_map: Dict[str, Optional[str]] = {
108
+ '403': "str",
109
+ '500': None,
110
+ '505': None,
111
+ '200': "ReadUserMeDto",
112
+ '400': None,
113
+ '404': None,
114
+ '409': None,
115
+ }
116
+ response_data = await self.api_client.call_api(
117
+ *_param,
118
+ _request_timeout=_request_timeout
119
+ )
120
+ await response_data.read()
121
+ return self.api_client.response_deserialize(
122
+ response_data=response_data,
123
+ response_types_map=_response_types_map,
124
+ ).data
125
+
126
+
127
+ @validate_call
128
+ async def api_v1_users_me_get_with_http_info(
129
+ self,
130
+ x_version: Annotated[Optional[StrictStr], Field(description="Optional version parameter for frontend applications to check if an update / refresh is needed")] = None,
131
+ x_backend_version: Annotated[Optional[StrictStr], Field(description="Optional version parameter that the frontend can use to know whether this specific endpoint got a backwards incompatible change.")] = None,
132
+ _request_timeout: Union[
133
+ None,
134
+ Annotated[StrictFloat, Field(gt=0)],
135
+ Tuple[
136
+ Annotated[StrictFloat, Field(gt=0)],
137
+ Annotated[StrictFloat, Field(gt=0)]
138
+ ]
139
+ ] = None,
140
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
141
+ _content_type: Optional[StrictStr] = None,
142
+ _headers: Optional[Dict[StrictStr, Any]] = None,
143
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
144
+ ) -> ApiResponse[ReadUserMeDto]:
145
+ """Me endpoint to verify everything is ok after login (also sets Name of user after registration) Please always call this after login so backend (and frontend) can verify everything is correct.
146
+
86
147
 
87
148
  :param x_version: Optional version parameter for frontend applications to check if an update / refresh is needed
88
149
  :type x_version: str
89
- :param async_req: Whether to execute the request asynchronously.
90
- :type async_req: bool, optional
91
- :param _preload_content: if False, the ApiResponse.data will
92
- be set to none and raw_data will store the
93
- HTTP response body without reading/decoding.
94
- Default is True.
95
- :type _preload_content: bool, optional
96
- :param _return_http_data_only: response data instead of ApiResponse
97
- object with status code, headers, etc
98
- :type _return_http_data_only: bool, optional
150
+ :param x_backend_version: Optional version parameter that the frontend can use to know whether this specific endpoint got a backwards incompatible change.
151
+ :type x_backend_version: str
99
152
  :param _request_timeout: timeout setting for this request. If one
100
153
  number provided, it will be total request
101
154
  timeout. It can also be a pair (tuple) of
102
155
  (connection, read) timeouts.
156
+ :type _request_timeout: int, tuple(int, int), optional
103
157
  :param _request_auth: set to override the auth_settings for an a single
104
- request; this effectively ignores the authentication
105
- in the spec for a single request.
158
+ request; this effectively ignores the
159
+ authentication in the spec for a single request.
106
160
  :type _request_auth: dict, optional
107
- :type _content_type: string, optional: force content-type for the request
161
+ :param _content_type: force content-type for the request.
162
+ :type _content_type: str, Optional
163
+ :param _headers: set to override the headers for a single
164
+ request; this effectively ignores the headers
165
+ in the spec for a single request.
166
+ :type _headers: dict, optional
167
+ :param _host_index: set to override the host_index for a single
168
+ request; this effectively ignores the host_index
169
+ in the spec for a single request.
170
+ :type _host_index: int, optional
108
171
  :return: Returns the result object.
109
- If the method is called asynchronously,
110
- returns the request thread.
111
- :rtype: tuple(ReadUserDto, status_code(int), headers(HTTPHeaderDict))
112
- """
172
+ """ # noqa: E501
173
+
174
+ _param = self._api_v1_users_me_get_serialize(
175
+ x_version=x_version,
176
+ x_backend_version=x_backend_version,
177
+ _request_auth=_request_auth,
178
+ _content_type=_content_type,
179
+ _headers=_headers,
180
+ _host_index=_host_index
181
+ )
182
+
183
+ _response_types_map: Dict[str, Optional[str]] = {
184
+ '403': "str",
185
+ '500': None,
186
+ '505': None,
187
+ '200': "ReadUserMeDto",
188
+ '400': None,
189
+ '404': None,
190
+ '409': None,
191
+ }
192
+ response_data = await self.api_client.call_api(
193
+ *_param,
194
+ _request_timeout=_request_timeout
195
+ )
196
+ await response_data.read()
197
+ return self.api_client.response_deserialize(
198
+ response_data=response_data,
199
+ response_types_map=_response_types_map,
200
+ )
113
201
 
114
- _params = locals()
115
202
 
116
- _all_params = [
117
- 'x_version'
118
- ]
119
- _all_params.extend(
120
- [
121
- 'async_req',
122
- '_return_http_data_only',
123
- '_preload_content',
124
- '_request_timeout',
125
- '_request_auth',
126
- '_content_type',
127
- '_headers'
203
+ @validate_call
204
+ async def api_v1_users_me_get_without_preload_content(
205
+ self,
206
+ x_version: Annotated[Optional[StrictStr], Field(description="Optional version parameter for frontend applications to check if an update / refresh is needed")] = None,
207
+ x_backend_version: Annotated[Optional[StrictStr], Field(description="Optional version parameter that the frontend can use to know whether this specific endpoint got a backwards incompatible change.")] = None,
208
+ _request_timeout: Union[
209
+ None,
210
+ Annotated[StrictFloat, Field(gt=0)],
211
+ Tuple[
212
+ Annotated[StrictFloat, Field(gt=0)],
213
+ Annotated[StrictFloat, Field(gt=0)]
128
214
  ]
215
+ ] = None,
216
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
217
+ _content_type: Optional[StrictStr] = None,
218
+ _headers: Optional[Dict[StrictStr, Any]] = None,
219
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
220
+ ) -> RESTResponseType:
221
+ """Me endpoint to verify everything is ok after login (also sets Name of user after registration) Please always call this after login so backend (and frontend) can verify everything is correct.
222
+
223
+
224
+ :param x_version: Optional version parameter for frontend applications to check if an update / refresh is needed
225
+ :type x_version: str
226
+ :param x_backend_version: Optional version parameter that the frontend can use to know whether this specific endpoint got a backwards incompatible change.
227
+ :type x_backend_version: str
228
+ :param _request_timeout: timeout setting for this request. If one
229
+ number provided, it will be total request
230
+ timeout. It can also be a pair (tuple) of
231
+ (connection, read) timeouts.
232
+ :type _request_timeout: int, tuple(int, int), optional
233
+ :param _request_auth: set to override the auth_settings for an a single
234
+ request; this effectively ignores the
235
+ authentication in the spec for a single request.
236
+ :type _request_auth: dict, optional
237
+ :param _content_type: force content-type for the request.
238
+ :type _content_type: str, Optional
239
+ :param _headers: set to override the headers for a single
240
+ request; this effectively ignores the headers
241
+ in the spec for a single request.
242
+ :type _headers: dict, optional
243
+ :param _host_index: set to override the host_index for a single
244
+ request; this effectively ignores the host_index
245
+ in the spec for a single request.
246
+ :type _host_index: int, optional
247
+ :return: Returns the result object.
248
+ """ # noqa: E501
249
+
250
+ _param = self._api_v1_users_me_get_serialize(
251
+ x_version=x_version,
252
+ x_backend_version=x_backend_version,
253
+ _request_auth=_request_auth,
254
+ _content_type=_content_type,
255
+ _headers=_headers,
256
+ _host_index=_host_index
257
+ )
258
+
259
+ _response_types_map: Dict[str, Optional[str]] = {
260
+ '403': "str",
261
+ '500': None,
262
+ '505': None,
263
+ '200': "ReadUserMeDto",
264
+ '400': None,
265
+ '404': None,
266
+ '409': None,
267
+ }
268
+ response_data = await self.api_client.call_api(
269
+ *_param,
270
+ _request_timeout=_request_timeout
129
271
  )
272
+ return response_data.response
130
273
 
131
- # validate the arguments
132
- for _key, _val in _params['kwargs'].items():
133
- if _key not in _all_params:
134
- raise ApiTypeError(
135
- "Got an unexpected keyword argument '%s'"
136
- " to method api_v1_users_me_get" % _key
137
- )
138
- _params[_key] = _val
139
- del _params['kwargs']
140
274
 
141
- _collection_formats = {}
275
+ def _api_v1_users_me_get_serialize(
276
+ self,
277
+ x_version,
278
+ x_backend_version,
279
+ _request_auth,
280
+ _content_type,
281
+ _headers,
282
+ _host_index,
283
+ ) -> Tuple:
142
284
 
143
- # process the path parameters
144
- _path_params = {}
285
+ _host = None
286
+
287
+ _collection_formats: Dict[str, str] = {
288
+ }
289
+
290
+ _path_params: Dict[str, str] = {}
291
+ _query_params: List[Tuple[str, str]] = []
292
+ _header_params: Dict[str, Optional[str]] = _headers or {}
293
+ _form_params: List[Tuple[str, str]] = []
294
+ _files: Dict[str, str] = {}
295
+ _body_params: Optional[bytes] = None
145
296
 
297
+ # process the path parameters
146
298
  # process the query parameters
147
- _query_params = []
148
299
  # process the header parameters
149
- _header_params = dict(_params.get('_headers', {}))
150
- if _params['x_version'] is not None:
151
- _header_params['x-version'] = _params['x_version']
152
-
300
+ if x_version is not None:
301
+ _header_params['x-version'] = x_version
302
+ if x_backend_version is not None:
303
+ _header_params['x-backend-version'] = x_backend_version
153
304
  # process the form parameters
154
- _form_params = []
155
- _files = {}
156
305
  # process the body parameter
157
- _body_params = None
306
+
307
+
158
308
  # set the HTTP header `Accept`
159
309
  _header_params['Accept'] = self.api_client.select_header_accept(
160
- ['text/plain', 'application/json', 'text/json']) # noqa: E501
310
+ [
311
+ 'text/plain',
312
+ 'application/json',
313
+ 'text/json'
314
+ ]
315
+ )
161
316
 
162
- # authentication setting
163
- _auth_settings = ['oauth2'] # noqa: E501
164
317
 
165
- _response_types_map = {
166
- '403': "str",
167
- '505': None,
168
- '200': "ReadUserDto",
169
- '400': None,
170
- '404': None,
171
- '409': None,
172
- '500': None,
173
- }
318
+ # authentication setting
319
+ _auth_settings: List[str] = [
320
+ 'oauth2'
321
+ ]
174
322
 
175
- return self.api_client.call_api(
176
- '/api/v1/users/me', 'GET',
177
- _path_params,
178
- _query_params,
179
- _header_params,
323
+ return self.api_client.param_serialize(
324
+ method='GET',
325
+ resource_path='/api/v1/users/me',
326
+ path_params=_path_params,
327
+ query_params=_query_params,
328
+ header_params=_header_params,
180
329
  body=_body_params,
181
330
  post_params=_form_params,
182
331
  files=_files,
183
- response_types_map=_response_types_map,
184
332
  auth_settings=_auth_settings,
185
- async_req=_params.get('async_req'),
186
- _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501
187
- _preload_content=_params.get('_preload_content', True),
188
- _request_timeout=_params.get('_request_timeout'),
189
333
  collection_formats=_collection_formats,
190
- _request_auth=_params.get('_request_auth'))
191
-
334
+ _host=_host,
335
+ _request_auth=_request_auth
336
+ )