mtx-api-py 0.4.0__tar.gz → 0.5.2__tar.gz

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 (36) hide show
  1. mtx_api_py-0.5.2/PKG-INFO +715 -0
  2. mtx_api_py-0.5.2/README.md +690 -0
  3. {mtx_api_py-0.4.0 → mtx_api_py-0.5.2}/pyproject.toml +1 -1
  4. {mtx_api_py-0.4.0 → mtx_api_py-0.5.2}/src/mtx_api/__init__.py +1 -1
  5. mtx_api_py-0.5.2/src/mtx_api/_doc.py +99 -0
  6. {mtx_api_py-0.4.0 → mtx_api_py-0.5.2}/src/mtx_api/client/_auth_client.py +28 -20
  7. {mtx_api_py-0.4.0 → mtx_api_py-0.5.2}/src/mtx_api/client/_base_client.py +2 -2
  8. {mtx_api_py-0.4.0 → mtx_api_py-0.5.2}/src/mtx_api/client/_jurisdiction_client.py +16 -12
  9. {mtx_api_py-0.4.0 → mtx_api_py-0.5.2}/src/mtx_api/client/_jurisdiction_elements_client.py +5 -4
  10. {mtx_api_py-0.4.0 → mtx_api_py-0.5.2}/src/mtx_api/client/_location_client.py +7 -7
  11. {mtx_api_py-0.4.0 → mtx_api_py-0.5.2}/src/mtx_api/client/_request_client.py +106 -78
  12. {mtx_api_py-0.4.0 → mtx_api_py-0.5.2}/src/mtx_api/client/_service_client.py +21 -18
  13. {mtx_api_py-0.4.0 → mtx_api_py-0.5.2}/src/mtx_api/client/_typology_client.py +19 -14
  14. {mtx_api_py-0.4.0 → mtx_api_py-0.5.2}/src/mtx_api/client/_user_client.py +27 -17
  15. {mtx_api_py-0.4.0 → mtx_api_py-0.5.2}/src/mtx_api/client/mtx_client.py +6 -0
  16. {mtx_api_py-0.4.0 → mtx_api_py-0.5.2}/src/mtx_api/models/additional_data.py +3 -10
  17. {mtx_api_py-0.4.0 → mtx_api_py-0.5.2}/src/mtx_api/models/common.py +1 -2
  18. {mtx_api_py-0.4.0 → mtx_api_py-0.5.2}/src/mtx_api/models/request.py +5 -13
  19. {mtx_api_py-0.4.0 → mtx_api_py-0.5.2}/src/mtx_api/models/service.py +2 -6
  20. mtx_api_py-0.4.0/PKG-INFO +0 -323
  21. mtx_api_py-0.4.0/README.md +0 -298
  22. {mtx_api_py-0.4.0 → mtx_api_py-0.5.2}/.gitignore +0 -0
  23. {mtx_api_py-0.4.0 → mtx_api_py-0.5.2}/LICENSE.txt +0 -0
  24. {mtx_api_py-0.4.0 → mtx_api_py-0.5.2}/src/mtx_api/client/__init__.py +0 -0
  25. {mtx_api_py-0.4.0 → mtx_api_py-0.5.2}/src/mtx_api/client/_mtx_http_client.py +0 -0
  26. {mtx_api_py-0.4.0 → mtx_api_py-0.5.2}/src/mtx_api/models/__init__.py +0 -0
  27. {mtx_api_py-0.4.0 → mtx_api_py-0.5.2}/src/mtx_api/models/auth.py +0 -0
  28. {mtx_api_py-0.4.0 → mtx_api_py-0.5.2}/src/mtx_api/models/base.py +0 -0
  29. {mtx_api_py-0.4.0 → mtx_api_py-0.5.2}/src/mtx_api/models/errors.py +0 -0
  30. {mtx_api_py-0.4.0 → mtx_api_py-0.5.2}/src/mtx_api/models/jurisdiction.py +0 -0
  31. {mtx_api_py-0.4.0 → mtx_api_py-0.5.2}/src/mtx_api/models/medias.py +0 -0
  32. {mtx_api_py-0.4.0 → mtx_api_py-0.5.2}/src/mtx_api/models/request_comment.py +0 -0
  33. {mtx_api_py-0.4.0 → mtx_api_py-0.5.2}/src/mtx_api/models/request_media.py +0 -0
  34. {mtx_api_py-0.4.0 → mtx_api_py-0.5.2}/src/mtx_api/models/typology.py +0 -0
  35. {mtx_api_py-0.4.0 → mtx_api_py-0.5.2}/src/mtx_api/py.typed +0 -0
  36. {mtx_api_py-0.4.0 → mtx_api_py-0.5.2}/src/mtx_api/settings.py +0 -0
@@ -0,0 +1,715 @@
1
+ Metadata-Version: 2.4
2
+ Name: mtx-api-py
3
+ Version: 0.5.2
4
+ Summary: SDK (wrapper) en Python para la API externa de MTX
5
+ Project-URL: Repository, https://bitbucket.org/radmas/mtx_api_py
6
+ Author-email: Álvaro Martín Rodríguez <alvaro.martin@radmas.com>
7
+ License: MIT
8
+ License-File: LICENSE.txt
9
+ Keywords: api,mtx,sdk
10
+ Classifier: Development Status :: 3 - Alpha
11
+ Classifier: Intended Audience :: Developers
12
+ Classifier: License :: OSI Approved :: MIT License
13
+ Classifier: Programming Language :: Python
14
+ Classifier: Programming Language :: Python :: 3
15
+ Classifier: Programming Language :: Python :: 3 :: Only
16
+ Classifier: Programming Language :: Python :: 3.12
17
+ Classifier: Topic :: Software Development :: Libraries
18
+ Classifier: Typing :: Typed
19
+ Requires-Python: >=3.12.0
20
+ Requires-Dist: httpx~=0.28.1
21
+ Requires-Dist: pydantic-settings~=2.12.0
22
+ Requires-Dist: pydantic~=2.12.4
23
+ Requires-Dist: pyjwt~=2.10.1
24
+ Description-Content-Type: text/markdown
25
+
26
+ # MTX API PY
27
+
28
+ Python SDK (wrapper) to consume the MTX API.
29
+
30
+ ## Installation
31
+
32
+ ```bash
33
+ pip install mtx-api-py
34
+ ```
35
+
36
+ ## Quick start
37
+
38
+ ```python
39
+ import asyncio
40
+ from mtx_api import MTXClient
41
+
42
+
43
+ async def main():
44
+ async with MTXClient(
45
+ base_url="https://api.mtx.example.com",
46
+ client_id="YOUR_CLIENT_ID",
47
+ jwt_secret="BASE64_SECRET", # optional; only if you will use auth.login_jwt
48
+ ) as client:
49
+ ok = await client.base.status(access_token="<ACCESS_TOKEN>")
50
+ print(ok)
51
+
52
+
53
+ asyncio.run(main())
54
+ ```
55
+
56
+ ## Configure via environment variables (.env)
57
+
58
+ You can configure the client using environment variables or a `.env` file at the project root:
59
+
60
+ ```bash
61
+ # .env
62
+ MTX_BASE_URL=https://api.mtx.example.com
63
+ MTX_CLIENT_ID=YOUR_CLIENT_ID
64
+ MTX_JWT_SECRET=BASE64_SECRET # Optional: only needed if you will use login_jwt
65
+ ```
66
+
67
+ ```python
68
+ import asyncio
69
+ from mtx_api import MTXClient
70
+ from dotenv import load_dotenv
71
+
72
+ load_dotenv() # Load environment variables from .env
73
+
74
+
75
+ async def main():
76
+ async with MTXClient() as client:
77
+ ok = await client.base.status(access_token="<ACCESS_TOKEN>")
78
+ print(ok)
79
+
80
+
81
+ asyncio.run(main())
82
+ ```
83
+
84
+ # MTX Client Reference
85
+
86
+ All available functions accept their parameters as keyword arguments.
87
+ You can omit arguments that are not needed and accept None.
88
+
89
+ ## auth
90
+
91
+ ### login
92
+
93
+ #### Signature
94
+ ```python
95
+ auth.login(*, username: str, password: str) -> mtx_api.models.auth.Authentication
96
+ ```
97
+
98
+ #### Docstring
99
+ Authenticates a user using their username (email) and password.
100
+
101
+ Use this tool for standard user login to obtain access credentials.
102
+
103
+ **Args:**
104
+ - **username (str)**: The user's email address.
105
+ - **password (str)**: The user's password.
106
+
107
+ **Returns:**
108
+ - **Authentication**: A model containing access and refresh tokens.
109
+
110
+ **Raises:**
111
+ - **MissingArgumentError**: If `username` or `password` is missing.
112
+
113
+ ### login_anonymous
114
+
115
+ #### Signature
116
+ ```python
117
+ auth.login_anonymous(*, device_id: str) -> mtx_api.models.auth.Authentication
118
+ ```
119
+
120
+ #### Docstring
121
+ Authenticates a user anonymously using a unique device identifier.
122
+
123
+ Use this tool to log in a user who does not have a registered account,
124
+ identifying them solely by their device ID. This enables access to
125
+ features that require authentication without user registration.
126
+
127
+ **Args:**
128
+ - **device_id (str)**: A stable and unique identifier for the device.
129
+
130
+ **Returns:**
131
+ - **Authentication**: A model containing access and refresh tokens.
132
+
133
+ **Raises:**
134
+ - **MissingArgumentError**: If `device_id` is empty or None.
135
+
136
+ ### login_jwt
137
+
138
+ #### Signature
139
+ ```python
140
+ auth.login_jwt(*, email: str, first_name: str | None = None, last_name: str | None = None, register: bool | None = None, legal_terms_accepted: bool | None = None) -> mtx_api.models.auth.Authentication
141
+ ```
142
+
143
+ #### Docstring
144
+ Authenticates a user using a signed JSON Web Token (JWT).
145
+
146
+ Use this tool for trusted server-side authentication or Single Sign-On (SSO)
147
+ integration. It facilitates logging in or registering a user based on their
148
+ email address.
149
+
150
+ **Args:**
151
+ - **email (str)**: The user's email address.
152
+ - **first_name (str, opcional)**: Optional user's first name. Defaults to None.
153
+ - **last_name (str, opcional)**: Optional user's last name. Defaults to None.
154
+ - **register (bool, opcional)**: Optional. If True, registers the user if they do not exist.
155
+ Defaults to None.
156
+ - **legal_terms_accepted (bool, opcional)**: Optional. Whether the user has accepted the
157
+ legal terms. Defaults to None.
158
+
159
+ **Returns:**
160
+ - **Authentication**: A model containing access and refresh tokens.
161
+
162
+ **Raises:**
163
+ - **InvalidEmailError**: If the provided email format is invalid.
164
+ - **MissingJwtSecretError**: If the JWT secret is not configured in the client.
165
+
166
+ ### login_refresh
167
+
168
+ #### Signature
169
+ ```python
170
+ auth.login_refresh(*, refresh_token: str) -> mtx_api.models.auth.Authentication
171
+ ```
172
+
173
+ #### Docstring
174
+ Refreshes an existing authentication session using a valid refresh token.
175
+
176
+ Use this tool to obtain a new access token when the current one has expired,
177
+ allowing the user's session to continue without requiring re-authentication.
178
+
179
+ **Args:**
180
+ - **refresh_token (str)**: The token issued during a previous authentication, used
181
+ to refresh the session.
182
+
183
+ **Returns:**
184
+ - **Authentication**: A model containing access and refresh tokens.
185
+
186
+ **Raises:**
187
+ - **MissingArgumentError**: If `refresh_token` is empty or None.
188
+
189
+ ### register
190
+
191
+ #### Signature
192
+ ```python
193
+ auth.register(*, username: str, password: str, first_name: str, last_name: str, legal_terms_accepted: bool, jurisdiction_code: str | None = None) -> mtx_api.models.auth.Authentication
194
+ ```
195
+
196
+ #### Docstring
197
+ Registers a new user account and immediately authenticates the user.
198
+
199
+ Use this tool to create a new user profile with the provided credentials
200
+ and personal information. This action also logs the user in.
201
+
202
+ **Args:**
203
+ - **username (str)**: The email address to use as the username.
204
+ - **password (str)**: The password for the new account.
205
+ - **first_name (str)**: The user's first name.
206
+ - **last_name (str)**: The user's last name.
207
+ - **legal_terms_accepted (bool)**: Must be True to indicate acceptance of legal terms.
208
+ - **jurisdiction_code (str, opcional)**: Optional jurisdiction code for the user.
209
+ Defaults to None.
210
+
211
+ **Returns:**
212
+ - **Authentication**: A model containing access and refresh tokens.
213
+
214
+ **Raises:**
215
+ - **MissingArgumentError**: If any required argument (username, password,
216
+ first_name, last_name) is missing.
217
+
218
+ ## base
219
+
220
+ ### openapi
221
+
222
+ #### Signature
223
+ ```python
224
+ base.openapi() -> 'str'
225
+ ```
226
+
227
+ #### Docstring
228
+ Retrieves the OpenAPI specification of the platform.
229
+
230
+ Fetches the complete OpenAPI documentation in plain text. This provides details on available
231
+ tools, operation structures, and expected responses.
232
+
233
+ **Returns:**
234
+ - **str**: The OpenAPI document content as a string.
235
+
236
+ ### status
237
+
238
+ #### Signature
239
+ ```python
240
+ base.status(*, access_token: 'str | None' = None) -> 'bool'
241
+ ```
242
+
243
+ #### Docstring
244
+ Checks the operational status of the platform.
245
+
246
+ Verifies if the platform is running and reachable. Use this tool
247
+ to confirm platform availability before performing other operations.
248
+
249
+ **Args:**
250
+ - **access_token**: Optional token used for authentication. If not provided, the operation
251
+ will be made without authentication.
252
+
253
+ **Returns:**
254
+ - **bool**: True if the platform is available and the operation succeeds.
255
+
256
+ ## jurisdiction_elements
257
+
258
+ ### list
259
+
260
+ #### Signature
261
+ ```python
262
+ jurisdiction_elements.list(*, access_token: str | None = None, jurisdiction_code: str) -> mtx_api.models.jurisdiction.JurisdictionElementList
263
+ ```
264
+
265
+ #### Docstring
266
+ Retrieves jurisdiction elements associated with a specific jurisdiction code.
267
+
268
+ Use this tool to find all jurisdiction elements linked to a given jurisdiction code
269
+ from the platform.
270
+
271
+ **Args:**
272
+ - **access_token (str, opcional)**: Optional token used for authentication. If not provided,
273
+ the operation will be made without authentication. Defaults to None.
274
+ - **jurisdiction_code (str)**: The unique string code of the jurisdiction to query.
275
+
276
+ **Returns:**
277
+ - **JurisdictionElementList**: An object containing the list of retrieved
278
+ jurisdiction elements.
279
+
280
+ **Raises:**
281
+ - **MissingJurisdictionCodesError**: If the `jurisdiction_code` argument is missing or empty.
282
+
283
+ ## jurisdictions
284
+
285
+ ### detail
286
+
287
+ #### Signature
288
+ ```python
289
+ jurisdictions.detail(*, access_token: 'str | None' = None, jurisdiction_code: 'str') -> 'Jurisdiction'
290
+ ```
291
+
292
+ #### Docstring
293
+ Retrieves detailed information for a specific jurisdiction.
294
+
295
+ This tool fetches the complete details of a jurisdiction using its unique code.
296
+ Use this tool when you need more information about a specific jurisdiction than what is
297
+ provided in the list.
298
+
299
+ **Args:**
300
+ - **access_token (str, opcional)**: Optional token used for authentication. If not provided,
301
+ the operation will be made without authentication. Defaults to None.
302
+ - **jurisdiction_code (str)**: The unique string code of the jurisdiction to query.
303
+
304
+ **Returns:**
305
+ - **Jurisdiction**: An object containing comprehensive information about the jurisdiction.
306
+
307
+ **Raises:**
308
+ - **MissingJurisdictionCodesError**: If the provided jurisdiction_code is empty.
309
+
310
+ ### list
311
+
312
+ #### Signature
313
+ ```python
314
+ jurisdictions.list(*, access_token: 'str | None' = None, lat: 'float | None' = None, lng: 'float | None' = None) -> 'JurisdictionList'
315
+ ```
316
+
317
+ #### Docstring
318
+ Retrieves a list of jurisdictions from the platform.
319
+
320
+ This tool allows you to list all available jurisdictions or find those closest to a
321
+ specific location if coordinates are provided.
322
+
323
+ **Args:**
324
+ - **access_token (str, opcional)**: Optional token used for authentication. If not provided,
325
+ the operation will be made without authentication. Defaults to None.
326
+ - **lat (float, opcional)**: Optional latitude coordinate to filter jurisdictions by
327
+ proximity. Defaults to None.
328
+ - **lng (float, opcional)**: Optional longitude coordinate to filter jurisdictions by
329
+ proximity. Defaults to None.
330
+
331
+ **Returns:**
332
+ - **JurisdictionList**: A collection of Jurisdiction objects with basic details.
333
+
334
+ ## location
335
+
336
+ ### resolve
337
+
338
+ #### Signature
339
+ ```python
340
+ location.resolve(*, jurisdiction_element_id: str, formatted_address: str | None = None, lat: float | None = None, lng: float | None = None) -> mtx_api.models.additional_data.LocationAdditionalDataList
341
+ ```
342
+
343
+ #### Docstring
344
+ Retrieves latitude and longitude information from an address, or vice versa.
345
+
346
+ This tool fetches location-specific questions configured for a
347
+ jurisdiction element. You can identify the location by providing either a formatted
348
+ address, geographic coordinates (lat, lng), or both. Regardless of which parameters
349
+ you provide, the tool always returns the complete location information including
350
+ formatted address, geographic coordinates, and the list of additional data questions.
351
+
352
+ Use this tool when you need to know what additional information should be collected
353
+ for a specific location.
354
+
355
+ **Args:**
356
+ - **jurisdiction_element_id (str)**: The unique identifier string of the jurisdiction element
357
+ where the location is being queried.
358
+ - **formatted_address (str, opcional)**: Optional complete address string in human-readable
359
+ format to identify the location. Defaults to None.
360
+ - **lat (float, opcional)**: Optional latitude coordinate as a decimal number to identify
361
+ the location. Must be provided together with lng. Defaults to None.
362
+ - **lng (float, opcional)**: Optional longitude coordinate as a decimal number to identify
363
+ the location. Must be provided together with lat. Defaults to None.
364
+
365
+ **Returns:**
366
+ - **LocationAdditionalDataList**: A collection of location entries. Each entry always
367
+ contains the formatted address, geographic coordinates (latitude and longitude),
368
+ and a list of additional data questions configured for that location, regardless
369
+ of which input parameters were used to identify the location.
370
+
371
+ **Raises:**
372
+ - **MissingJurisdictionElementIdError**: If jurisdiction_element_id is empty or not provided.
373
+
374
+ ## requests
375
+
376
+ ### attach_comment
377
+
378
+ #### Signature
379
+ ```python
380
+ requests.attach_comment(*, access_token: 'str | None' = None, request_id: 'str', comment: 'str | None' = None, files: 'Sequence[tuple[str, bytes]]' = ()) -> 'RequestComment'
381
+ ```
382
+
383
+ #### Docstring
384
+ Attach a comment to an existing request.
385
+
386
+ **Args:**
387
+ - **access_token (str, opcional)**: Optional token used for authentication. If not provided, the operation
388
+ will be made without authentication. Defaults to None.
389
+ - **request_id (str)**: The identifier of the request to which the comment will be added.
390
+ - **Note**: this is the internal request `id`, not the `service_request_id`.
391
+ - **comment (str, opcional)**: Optional text of the comment. Can be empty. Defaults to None.
392
+ - **files (Sequence[tuple[str, bytes]], opcional)**: Optional sequence of files to attach with the comment.
393
+ Each file is a tuple containing the file name (str) and the file content (bytes). Defaults to ().
394
+
395
+ **Returns:**
396
+ - **RequestComment**: The created comment object.
397
+
398
+ **Raises:**
399
+ - **MissingRequestIdError**: If request_id is missing.
400
+
401
+ ### attach_media
402
+
403
+ #### Signature
404
+ ```python
405
+ requests.attach_media(*, access_token: 'str | None' = None, request_id: 'str', jurisdiction_code: 'str', file: 'tuple[str, bytes]') -> 'RequestMedia'
406
+ ```
407
+
408
+ #### Docstring
409
+ Attach a media file to an existing request.
410
+
411
+ **Args:**
412
+ - **access_token (str, opcional)**: Optional token used for authentication. If not provided, the operation
413
+ will be made without authentication. Defaults to None.
414
+ - **request_id (str)**: The identifier of the request to which the media will be attached.
415
+ - **Note**: this is the internal request `id`, not the `service_request_id`.
416
+ - **jurisdiction_code (str)**: The code of the jurisdiction associated with the request.
417
+ - **file (tuple[str, bytes])**: A tuple containing the file name (str) and the file content (bytes).
418
+
419
+ **Returns:**
420
+ - **RequestMedia**: The object representing the attached media.
421
+
422
+ **Raises:**
423
+ - **MissingRequestIdError**: If request_id is missing.
424
+ - **MissingJurisdictionCodesError**: If jurisdiction_code is missing.
425
+ - **MissingArgumentError**: If file content or file name is empty, or if extension is missing.
426
+
427
+ ### create
428
+
429
+ #### Signature
430
+ ```python
431
+ requests.create(*, access_token: 'str | None' = None, service_id: 'str', jurisdiction_code: 'str', jurisdiction_element_id: 'str | None' = None, origin_device_id: 'str | None' = None, description: 'str | None' = None, public: 'bool | None' = None, lat: 'float | None' = None, lng: 'float | None' = None, address_string: 'str | None' = None, email: 'str | None' = None, first_name: 'str | None' = None, last_name: 'str | None' = None, phone: 'str | None' = None, twitter_nickname: 'str | None' = None, additional_data: 'Sequence[AdditionalDataValue] | None' = None) -> 'CreatedRequest'
432
+ ```
433
+
434
+ #### Docstring
435
+ Create a new request in the platform.
436
+
437
+ This function allows creating a new request (issue report) within a specific jurisdiction.
438
+
439
+ **Args:**
440
+ - **access_token (str, opcional)**: Optional token used for authentication. If not provided,
441
+ the operation will be made without authentication. Defaults to None.
442
+ - **service_id (str)**: Identifier of the service to request.
443
+ - **jurisdiction_code (str)**: Code of the jurisdiction where the request is made.
444
+ - **jurisdiction_element_id (str, opcional)**: Optional ID of a specific element within the
445
+ jurisdiction. Defaults to None.
446
+ - **origin_device_id (str, opcional)**: Optional ID of the device making the request.
447
+ Can be found on Jurisdiction detail. Defaults to None.
448
+ - **description (str, opcional)**: Optional textual description of the request.
449
+ Defaults to None.
450
+ - **public (bool, opcional)**: Optional boolean. If True, the request is public; if False,
451
+ it is private. Defaults to None.
452
+ - **lat (float, opcional)**: Optional latitude coordinate of the request location.
453
+ Defaults to None.
454
+ - **lng (float, opcional)**: Optional longitude coordinate of the request location.
455
+ Defaults to None.
456
+ - **address_string (str, opcional)**: Optional physical address associated with the request.
457
+ Defaults to None.
458
+ - **email (str, opcional)**: Optional email address of the person making the request.
459
+ Defaults to None.
460
+ - **first_name (str, opcional)**: Optional first name of the person making the request.
461
+ Defaults to None.
462
+ - **last_name (str, opcional)**: Optional last name of the person making the request.
463
+ Defaults to None.
464
+ - **phone (str, opcional)**: Optional phone number of the person making the request.
465
+ Defaults to None.
466
+ - **twitter_nickname (str, opcional)**: Optional Twitter handle of the person making the
467
+ request. Defaults to None.
468
+ - **additional_data (Sequence[AdditionalDataValue], opcional)**: Optional sequence of additional
469
+ data values required by the service. Defaults to None.
470
+
471
+ **Returns:**
472
+ - **CreatedRequest**: The created request instance with its details.
473
+
474
+ **Raises:**
475
+ - **MissingJurisdictionCodesError**: If jurisdiction_code is missing.
476
+ - **MissingServiceIdError**: If service_id is missing.
477
+
478
+ ### detail
479
+
480
+ #### Signature
481
+ ```python
482
+ requests.detail(*, access_token: 'str | None' = None, request_id: 'str') -> 'Request'
483
+ ```
484
+
485
+ #### Docstring
486
+ Retrieve detailed information about a specific request.
487
+
488
+ **Args:**
489
+ - **access_token (str, opcional)**: Optional token used for authentication. If not provided, the operation
490
+ will be made without authentication. Defaults to None.
491
+ - **request_id (str)**: The unique identifier of the request to fetch.
492
+ - **Note**: this is the internal request `id`, not the `service_request_id`.
493
+
494
+ **Returns:**
495
+ - **Request**: The detailed Request object containing all information.
496
+
497
+ **Raises:**
498
+ - **MissingRequestIdError**: If request_id is missing.
499
+
500
+ ### list
501
+
502
+ #### Signature
503
+ ```python
504
+ requests.list(*, access_token: 'str | None' = None, jurisdiction_codes: 'list[str] | None' = None, service_request_ids: 'list[str] | None' = None, service_ids: 'list[str] | None' = None, start_date: 'str | None' = None, end_date: 'str | None' = None, own: 'bool | None' = None, lat: 'float | None' = None, lng: 'float | None' = None, page: 'int | None' = None, limit: 'int | None' = None, address_and_service_request_id: 'str | None' = None, status: 'list[str] | None' = None, typology_ids: 'list[str] | None' = None, distance: 'int | None' = None, following: 'bool | None' = None, order: 'str | None' = None, complaints: 'bool | None' = None, reiterations: 'bool | None' = None, user_reiterated: 'bool | None' = None, user_complaint: 'bool | None' = None, jurisdiction_element_ids: 'list[str] | None' = None, level: 'int | None' = None, polygon: 'list[float] | None' = None, final_ok: 'bool | None' = None, final_not_ok: 'bool | None' = None, final_status: 'bool | None' = None, interested: 'bool | None' = None, timezone: 'str | None' = None) -> 'RequestList'
505
+ ```
506
+
507
+ #### Docstring
508
+ List and filter requests from the platform.
509
+
510
+ This function retrieves a list of requests based on multiple filtering criteria.
511
+
512
+ **Args:**
513
+ - **access_token (str, opcional)**: Optional token used for authentication. If not provided,
514
+ the operation will be made without authentication. Defaults to None.
515
+ - **jurisdiction_codes (list[str], opcional)**: Optional list of jurisdiction codes to filter by.
516
+ Defaults to None.
517
+ - **service_request_ids (list[str], opcional)**: Optional list of specific request IDs to retrieve.
518
+ Defaults to None.
519
+ - **service_ids (list[str], opcional)**: Optional list of service IDs to filter by. Defaults to None.
520
+ - **start_date (str, opcional)**: Optional ISO date-time string (inclusive) to filter requests created
521
+ after this date. Defaults to None.
522
+ - **end_date (str, opcional)**: Optional ISO date-time string (inclusive) to filter requests created
523
+ before this date. Defaults to None.
524
+ - **own (bool, opcional)**: Optional boolean. If True, returns only requests created by the
525
+ authenticated user. Defaults to None.
526
+ - **lat (float, opcional)**: Optional latitude to be used for distance filtering or ordering by
527
+ proximity. Defaults to None.
528
+ - **lng (float, opcional)**: Optional longitude to be used for distance filtering or ordering by
529
+ proximity. Defaults to None.
530
+ - **page (int, opcional)**: Optional page number for pagination. Defaults to None.
531
+ - **limit (int, opcional)**: Optional number of items per page. Defaults to None.
532
+ - **address_and_service_request_id (str, opcional)**: Optional free text search for address or
533
+ service request ID. Defaults to None.
534
+ - **status (list[str], opcional)**: Optional list of status codes to filter by. Defaults to None.
535
+ - **typology_ids (list[str], opcional)**: Optional list of typology IDs to filter by. Defaults to None.
536
+ - **distance (int, opcional)**: Optional radius in meters to filter requests around the provided
537
+ lat/lng. Defaults to None.
538
+ - **following (bool, opcional)**: Optional boolean. If True, returns only requests followed by the
539
+ authenticated user. Defaults to None.
540
+ - **order (str, opcional)**: Optional ordering strategy (e.g., "newest_date_desc"). Defaults to None.
541
+ - **complaints (bool, opcional)**: Optional boolean. If True, filters only complaints.
542
+ Defaults to None.
543
+ - **reiterations (bool, opcional)**: Optional boolean. If True, filters only reiterations.
544
+ Defaults to None.
545
+ - **user_reiterated (bool, opcional)**: Optional boolean. If True, filters requests reiterated by
546
+ the authenticated user. Defaults to None.
547
+ - **user_complaint (bool, opcional)**: Optional boolean. If True, filters complaints made by the
548
+ authenticated user. Defaults to None.
549
+ - **jurisdiction_element_ids (list[str], opcional)**: Optional list of jurisdiction element IDs to
550
+ filter by. Defaults to None.
551
+ - **level (int, opcional)**: Optional floor level to filter by. Defaults to None.
552
+ - **polygon (list[float], opcional)**: Optional list of float coordinates describing a polygon area
553
+ to filter requests within. Defaults to None.
554
+ - **final_ok (bool, opcional)**: Optional boolean. If True, filters requests with a final
555
+ status of OK. Defaults to None.
556
+ - **final_not_ok (bool, opcional)**: Optional boolean. If True, filters requests with a final
557
+ status of NOT OK. Defaults to None.
558
+ - **final_status (bool, opcional)**: Optional boolean. If True, filters requests with any
559
+ final status. Defaults to None.
560
+ - **interested (bool, opcional)**: Optional boolean. If True, filters requests where the user has
561
+ expressed interest. Defaults to None.
562
+ - **timezone (str, opcional)**: Optional IANA timezone string used by the backend for date filtering.
563
+ Defaults to None.
564
+
565
+ **Returns:**
566
+ - **RequestList**: A list of Request items matching the criteria.
567
+
568
+ ## services
569
+
570
+ ### detail
571
+
572
+ #### Signature
573
+ ```python
574
+ services.detail(*, access_token: str | None = None, service_id: str, jurisdiction_code: str) -> mtx_api.models.service.Service
575
+ ```
576
+
577
+ #### Docstring
578
+ Retrieves the detailed information of a specific service.
579
+
580
+ This function fetches the full details of a service identified by its ID
581
+ within a specific jurisdiction. Details include additional_data and other
582
+ relevant information.
583
+
584
+ **Args:**
585
+ - **access_token (str, opcional)**: Optional token used for authentication. If not provided, the operation
586
+ will be made without authentication. Defaults to None.
587
+ - **service_id (str)**: The identifier of the service to fetch details for.
588
+ - **jurisdiction_code (str)**: The jurisdiction code where the service is located.
589
+
590
+ **Returns:**
591
+ - **Service**: The detailed information of the requested service.
592
+
593
+ **Raises:**
594
+ - **MissingJurisdictionCodesError**: If the jurisdiction code is not provided.
595
+ - **MissingServiceIdError**: If the service ID is not provided.
596
+
597
+ ## typologies
598
+
599
+ ## user
600
+
601
+ ### accept_terms
602
+
603
+ #### Signature
604
+ ```python
605
+ user.accept_terms(*, access_token: str) -> bool
606
+ ```
607
+
608
+ #### Docstring
609
+ Accepts the legal terms and conditions for the currently authenticated user.
610
+
611
+ Use this tool to register the acceptance of legal terms for a previously
612
+ registered user. Accepting these terms allows the user to use the platform.
613
+ If not accepted, the user will not be allowed to use the platform.
614
+
615
+ Should be used if a 451 error is received.
616
+
617
+ **Args:**
618
+ - **access_token (str)**: Optional token used for authentication. If not provided,
619
+ the operation will be made without authentication.
620
+
621
+ **Returns:**
622
+ - **bool**: True if the terms were successfully accepted.
623
+
624
+ ### legal_terms
625
+
626
+ #### Signature
627
+ ```python
628
+ user.legal_terms() -> mtx_api.models.common.LegalTerms
629
+ ```
630
+
631
+ #### Docstring
632
+ Retrieves the current legal terms and conditions content.
633
+
634
+ Use this function to fetch the complete legal terms and conditions content
635
+ that users must accept to use the platform. The returned content may include
636
+ plain text, formatted text, or links to external legal documents. This is
637
+ typically given to users during registration or when terms have been
638
+ updated and require re-acceptance.
639
+
640
+ **Returns:**
641
+ - **LegalTerms**: A model containing the legal terms content, which may include
642
+ privacy policy, terms of use, and cookies policy. Each field can
643
+ contain text or links to legal documents.
644
+
645
+ ### profile
646
+
647
+ #### Signature
648
+ ```python
649
+ user.profile(*, access_token: str | None = None) -> mtx_api.models.auth.Profile
650
+ ```
651
+
652
+ #### Docstring
653
+ Retrieves the profile information of the currently authenticated user.
654
+
655
+ Use this tool to fetch details about the current user, including personal
656
+ information and account settings.
657
+
658
+ **Args:**
659
+ - **access_token (str, opcional)**: Optional token used for authentication. If not provided,
660
+ the operation will be made without authentication. Defaults to None.
661
+
662
+ **Returns:**
663
+ - **Profile**: A model containing the user's profile details.
664
+
665
+ ### update_profile
666
+
667
+ #### Signature
668
+ ```python
669
+ user.update_profile(*, access_token: str | None = None, email: str | None = None, username: str | None = None, first_name: str | None = None, last_name: str | None = None, twitter_nickname: str | None = None, phone: str | None = None, gender: Gender | None = None, birthday: str | None = None) -> mtx_api.models.auth.Profile
670
+ ```
671
+
672
+ #### Docstring
673
+ Updates the profile information of the currently authenticated user.
674
+
675
+ Use this tool to modify the personal details and account information of
676
+ the user. Only the fields provided will be updated; fields set to None
677
+ will remain unchanged.
678
+
679
+ **Args:**
680
+ - **access_token (str, opcional)**: Optional token used for authentication. If not provided,
681
+ the operation will be made without authentication. Defaults to None.
682
+ - **email (str, opcional)**: Optional new email address for the user. Defaults to None.
683
+ - **username (str, opcional)**: Optional new username for the user, typically their email
684
+ address. Defaults to None.
685
+ - **first_name (str, opcional)**: Optional new first name or given name for the user.
686
+ Defaults to None.
687
+ - **last_name (str, opcional)**: Optional new last name or family name for the user.
688
+ Defaults to None.
689
+ - **twitter_nickname (str, opcional)**: Optional new shown name or twitter_nickname visible to
690
+ others. Defaults to None.
691
+ - **phone (str, opcional)**: Optional new primary phone number for contact purposes.
692
+ Defaults to None.
693
+ - **gender (Gender, opcional)**: Optional new gender identification for the user.
694
+ Defaults to None.
695
+ - **birthday (str, opcional)**: Optional new date of birth in format YYYY-MM-DD.
696
+ Defaults to None.
697
+
698
+ **Returns:**
699
+ - **Profile**: A model containing the updated user's profile details.
700
+
701
+
702
+
703
+ ## Errors
704
+
705
+ - HTTP errors raise `ApiError` with fields `status_code`, `code`, and `description`.
706
+ - Response model decoding/validation errors raise `ApiDecodingError`.
707
+ - SDK parameter validation errors raise specific exceptions (all extend `ValueError`):
708
+ - `MissingBaseUrlError`: missing `base_url` configuration (via `MTX_BASE_URL` or `base_url` parameter).
709
+ - `MissingClientIdError`: missing `client_id` configuration (via `MTX_CLIENT_ID` or `client_id` parameter).
710
+ - `MissingJwtSecretError`: missing JWT secret configuration (via `MTX_JWT_SECRET` or `jwt_secret` parameter) when using `auth.login_jwt`.
711
+ - `MissingJurisdictionCodesError`: missing `jurisdiction_codes`/`jurisdiction_code` in calls that require it.
712
+ - `MissingServiceIdError`: missing `service_id` in calls that require it.
713
+ - `MissingRequestIdError`: missing `request_id` in calls that require it.
714
+ - `MissingArgumentError`: a required argument is missing.
715
+ - `InvalidEmailError`: the email is not valid.