apex-dispatch-api-client 0.7.2__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 (71) hide show
  1. apex_dispatch_api_client/__about__.py +15 -0
  2. apex_dispatch_api_client/__init__.py +8 -0
  3. apex_dispatch_api_client/api/__init__.py +1 -0
  4. apex_dispatch_api_client/api/default/__init__.py +1 -0
  5. apex_dispatch_api_client/api/default/health_health_get.py +85 -0
  6. apex_dispatch_api_client/api/unit_jobs/__init__.py +1 -0
  7. apex_dispatch_api_client/api/unit_jobs/create_sync_job_sync_jobs_post.py +178 -0
  8. apex_dispatch_api_client/api/unit_jobs/create_unit_job_unit_jobs_post.py +180 -0
  9. apex_dispatch_api_client/api/unit_jobs/delete_job_unit_jobs_job_id_delete.py +170 -0
  10. apex_dispatch_api_client/api/unit_jobs/get_job_params_params_post.py +179 -0
  11. apex_dispatch_api_client/api/unit_jobs/get_job_results_unit_jobs_job_id_results_get.py +186 -0
  12. apex_dispatch_api_client/api/unit_jobs/get_job_unit_jobs_job_id_get.py +172 -0
  13. apex_dispatch_api_client/api/upscale_tasks/__init__.py +1 -0
  14. apex_dispatch_api_client/api/upscale_tasks/create_upscale_task_upscale_tasks_post.py +180 -0
  15. apex_dispatch_api_client/api/upscale_tasks/get_jobs_status_jobs_status_get.py +192 -0
  16. apex_dispatch_api_client/api/upscale_tasks/get_upscale_task_upscale_tasks_task_id_get.py +172 -0
  17. apex_dispatch_api_client/api/upscale_tasks/split_in_tiles_tiles_post.py +184 -0
  18. apex_dispatch_api_client/client.py +282 -0
  19. apex_dispatch_api_client/errors.py +16 -0
  20. apex_dispatch_api_client/models/__init__.py +99 -0
  21. apex_dispatch_api_client/models/asset.py +155 -0
  22. apex_dispatch_api_client/models/base_job_request.py +104 -0
  23. apex_dispatch_api_client/models/base_job_request_parameters.py +47 -0
  24. apex_dispatch_api_client/models/collection.py +332 -0
  25. apex_dispatch_api_client/models/collection_assets_type_0.py +60 -0
  26. apex_dispatch_api_client/models/collection_summaries_type_0.py +109 -0
  27. apex_dispatch_api_client/models/collection_summaries_type_0_additional_property_type_2.py +47 -0
  28. apex_dispatch_api_client/models/error_response.py +138 -0
  29. apex_dispatch_api_client/models/error_response_details_type_0.py +47 -0
  30. apex_dispatch_api_client/models/extent.py +80 -0
  31. apex_dispatch_api_client/models/geometry_collection.py +247 -0
  32. apex_dispatch_api_client/models/grid_type_enum.py +9 -0
  33. apex_dispatch_api_client/models/http_validation_error.py +79 -0
  34. apex_dispatch_api_client/models/jobs_filter.py +9 -0
  35. apex_dispatch_api_client/models/jobs_status_response.py +97 -0
  36. apex_dispatch_api_client/models/line_string.py +163 -0
  37. apex_dispatch_api_client/models/link.py +123 -0
  38. apex_dispatch_api_client/models/mime_types.py +37 -0
  39. apex_dispatch_api_client/models/multi_line_string.py +180 -0
  40. apex_dispatch_api_client/models/multi_point.py +163 -0
  41. apex_dispatch_api_client/models/multi_polygon.py +191 -0
  42. apex_dispatch_api_client/models/output_format_enum.py +11 -0
  43. apex_dispatch_api_client/models/param_request.py +77 -0
  44. apex_dispatch_api_client/models/param_type_enum.py +16 -0
  45. apex_dispatch_api_client/models/parameter.py +108 -0
  46. apex_dispatch_api_client/models/parameter_dimension.py +69 -0
  47. apex_dispatch_api_client/models/point.py +151 -0
  48. apex_dispatch_api_client/models/polygon.py +180 -0
  49. apex_dispatch_api_client/models/process_type_enum.py +9 -0
  50. apex_dispatch_api_client/models/processing_job.py +130 -0
  51. apex_dispatch_api_client/models/processing_job_parameters.py +47 -0
  52. apex_dispatch_api_client/models/processing_job_summary.py +116 -0
  53. apex_dispatch_api_client/models/processing_job_summary_parameters.py +47 -0
  54. apex_dispatch_api_client/models/processing_status_enum.py +14 -0
  55. apex_dispatch_api_client/models/provider.py +135 -0
  56. apex_dispatch_api_client/models/range_.py +79 -0
  57. apex_dispatch_api_client/models/service_details.py +95 -0
  58. apex_dispatch_api_client/models/spatial_extent.py +96 -0
  59. apex_dispatch_api_client/models/tile_request.py +77 -0
  60. apex_dispatch_api_client/models/time_interval.py +99 -0
  61. apex_dispatch_api_client/models/upscaling_task.py +138 -0
  62. apex_dispatch_api_client/models/upscaling_task_request.py +118 -0
  63. apex_dispatch_api_client/models/upscaling_task_request_parameters.py +47 -0
  64. apex_dispatch_api_client/models/upscaling_task_summary.py +88 -0
  65. apex_dispatch_api_client/models/validation_error.py +123 -0
  66. apex_dispatch_api_client/models/validation_error_context.py +47 -0
  67. apex_dispatch_api_client/types.py +54 -0
  68. apex_dispatch_api_client-0.7.2.dist-info/METADATA +167 -0
  69. apex_dispatch_api_client-0.7.2.dist-info/RECORD +71 -0
  70. apex_dispatch_api_client-0.7.2.dist-info/WHEEL +4 -0
  71. apex_dispatch_api_client-0.7.2.dist-info/licenses/LICENSE +202 -0
@@ -0,0 +1,282 @@
1
+ import ssl
2
+ from typing import Any
3
+
4
+ import httpx
5
+ from attrs import define, evolve, field
6
+
7
+
8
+ @define
9
+ class Client:
10
+ """A class for keeping track of data related to the API
11
+
12
+ The following are accepted as keyword arguments and will be used to construct httpx Clients internally:
13
+
14
+ ``base_url``: The base URL for the API, all requests are made to a relative path to this URL
15
+
16
+ ``cookies``: A dictionary of cookies to be sent with every request
17
+
18
+ ``headers``: A dictionary of headers to be sent with every request
19
+
20
+ ``timeout``: The maximum amount of a time a request can take. API functions will raise
21
+ httpx.TimeoutException if this is exceeded.
22
+
23
+ ``verify_ssl``: Whether or not to verify the SSL certificate of the API server. This should be True in production,
24
+ but can be set to False for testing purposes.
25
+
26
+ ``follow_redirects``: Whether or not to follow redirects. Default value is False.
27
+
28
+ ``httpx_args``: A dictionary of additional arguments to be passed to the ``httpx.Client`` and ``httpx.AsyncClient`` constructor.
29
+
30
+
31
+ Attributes:
32
+ raise_on_unexpected_status: Whether or not to raise an errors.UnexpectedStatus if the API returns a
33
+ status code that was not documented in the source OpenAPI document. Can also be provided as a keyword
34
+ argument to the constructor.
35
+ """
36
+
37
+ raise_on_unexpected_status: bool = field(default=False, kw_only=True)
38
+ _base_url: str = field(alias="base_url")
39
+ _cookies: dict[str, str] = field(factory=dict, kw_only=True, alias="cookies")
40
+ _headers: dict[str, str] = field(factory=dict, kw_only=True, alias="headers")
41
+ _timeout: httpx.Timeout | None = field(default=None, kw_only=True, alias="timeout")
42
+ _verify_ssl: str | bool | ssl.SSLContext = field(
43
+ default=True, kw_only=True, alias="verify_ssl"
44
+ )
45
+ _follow_redirects: bool = field(
46
+ default=False, kw_only=True, alias="follow_redirects"
47
+ )
48
+ _httpx_args: dict[str, Any] = field(factory=dict, kw_only=True, alias="httpx_args")
49
+ _client: httpx.Client | None = field(default=None, init=False)
50
+ _async_client: httpx.AsyncClient | None = field(default=None, init=False)
51
+
52
+ def with_headers(self, headers: dict[str, str]) -> "Client":
53
+ """Get a new client matching this one with additional headers"""
54
+ if self._client is not None:
55
+ self._client.headers.update(headers)
56
+ if self._async_client is not None:
57
+ self._async_client.headers.update(headers)
58
+ return evolve(self, headers={**self._headers, **headers})
59
+
60
+ def with_cookies(self, cookies: dict[str, str]) -> "Client":
61
+ """Get a new client matching this one with additional cookies"""
62
+ if self._client is not None:
63
+ self._client.cookies.update(cookies)
64
+ if self._async_client is not None:
65
+ self._async_client.cookies.update(cookies)
66
+ return evolve(self, cookies={**self._cookies, **cookies})
67
+
68
+ def with_timeout(self, timeout: httpx.Timeout) -> "Client":
69
+ """Get a new client matching this one with a new timeout configuration"""
70
+ if self._client is not None:
71
+ self._client.timeout = timeout
72
+ if self._async_client is not None:
73
+ self._async_client.timeout = timeout
74
+ return evolve(self, timeout=timeout)
75
+
76
+ def set_httpx_client(self, client: httpx.Client) -> "Client":
77
+ """Manually set the underlying httpx.Client
78
+
79
+ **NOTE**: This will override any other settings on the client, including cookies, headers, and timeout.
80
+ """
81
+ self._client = client
82
+ return self
83
+
84
+ def get_httpx_client(self) -> httpx.Client:
85
+ """Get the underlying httpx.Client, constructing a new one if not previously set"""
86
+ if self._client is None:
87
+ self._client = httpx.Client(
88
+ base_url=self._base_url,
89
+ cookies=self._cookies,
90
+ headers=self._headers,
91
+ timeout=self._timeout,
92
+ verify=self._verify_ssl,
93
+ follow_redirects=self._follow_redirects,
94
+ **self._httpx_args,
95
+ )
96
+ return self._client
97
+
98
+ def __enter__(self) -> "Client":
99
+ """Enter a context manager for self.client—you cannot enter twice (see httpx docs)"""
100
+ self.get_httpx_client().__enter__()
101
+ return self
102
+
103
+ def __exit__(self, *args: Any, **kwargs: Any) -> None:
104
+ """Exit a context manager for internal httpx.Client (see httpx docs)"""
105
+ self.get_httpx_client().__exit__(*args, **kwargs)
106
+
107
+ def set_async_httpx_client(self, async_client: httpx.AsyncClient) -> "Client":
108
+ """Manually set the underlying httpx.AsyncClient
109
+
110
+ **NOTE**: This will override any other settings on the client, including cookies, headers, and timeout.
111
+ """
112
+ self._async_client = async_client
113
+ return self
114
+
115
+ def get_async_httpx_client(self) -> httpx.AsyncClient:
116
+ """Get the underlying httpx.AsyncClient, constructing a new one if not previously set"""
117
+ if self._async_client is None:
118
+ self._async_client = httpx.AsyncClient(
119
+ base_url=self._base_url,
120
+ cookies=self._cookies,
121
+ headers=self._headers,
122
+ timeout=self._timeout,
123
+ verify=self._verify_ssl,
124
+ follow_redirects=self._follow_redirects,
125
+ **self._httpx_args,
126
+ )
127
+ return self._async_client
128
+
129
+ async def __aenter__(self) -> "Client":
130
+ """Enter a context manager for underlying httpx.AsyncClient—you cannot enter twice (see httpx docs)"""
131
+ await self.get_async_httpx_client().__aenter__()
132
+ return self
133
+
134
+ async def __aexit__(self, *args: Any, **kwargs: Any) -> None:
135
+ """Exit a context manager for underlying httpx.AsyncClient (see httpx docs)"""
136
+ await self.get_async_httpx_client().__aexit__(*args, **kwargs)
137
+
138
+
139
+ @define
140
+ class AuthenticatedClient:
141
+ """A Client which has been authenticated for use on secured endpoints
142
+
143
+ The following are accepted as keyword arguments and will be used to construct httpx Clients internally:
144
+
145
+ ``base_url``: The base URL for the API, all requests are made to a relative path to this URL
146
+
147
+ ``cookies``: A dictionary of cookies to be sent with every request
148
+
149
+ ``headers``: A dictionary of headers to be sent with every request
150
+
151
+ ``timeout``: The maximum amount of a time a request can take. API functions will raise
152
+ httpx.TimeoutException if this is exceeded.
153
+
154
+ ``verify_ssl``: Whether or not to verify the SSL certificate of the API server. This should be True in production,
155
+ but can be set to False for testing purposes.
156
+
157
+ ``follow_redirects``: Whether or not to follow redirects. Default value is False.
158
+
159
+ ``httpx_args``: A dictionary of additional arguments to be passed to the ``httpx.Client`` and ``httpx.AsyncClient`` constructor.
160
+
161
+
162
+ Attributes:
163
+ raise_on_unexpected_status: Whether or not to raise an errors.UnexpectedStatus if the API returns a
164
+ status code that was not documented in the source OpenAPI document. Can also be provided as a keyword
165
+ argument to the constructor.
166
+ token: The token to use for authentication
167
+ prefix: The prefix to use for the Authorization header
168
+ auth_header_name: The name of the Authorization header
169
+ """
170
+
171
+ raise_on_unexpected_status: bool = field(default=False, kw_only=True)
172
+ _base_url: str = field(alias="base_url")
173
+ _cookies: dict[str, str] = field(factory=dict, kw_only=True, alias="cookies")
174
+ _headers: dict[str, str] = field(factory=dict, kw_only=True, alias="headers")
175
+ _timeout: httpx.Timeout | None = field(default=None, kw_only=True, alias="timeout")
176
+ _verify_ssl: str | bool | ssl.SSLContext = field(
177
+ default=True, kw_only=True, alias="verify_ssl"
178
+ )
179
+ _follow_redirects: bool = field(
180
+ default=False, kw_only=True, alias="follow_redirects"
181
+ )
182
+ _httpx_args: dict[str, Any] = field(factory=dict, kw_only=True, alias="httpx_args")
183
+ _client: httpx.Client | None = field(default=None, init=False)
184
+ _async_client: httpx.AsyncClient | None = field(default=None, init=False)
185
+
186
+ token: str
187
+ prefix: str = "Bearer"
188
+ auth_header_name: str = "Authorization"
189
+
190
+ def with_headers(self, headers: dict[str, str]) -> "AuthenticatedClient":
191
+ """Get a new client matching this one with additional headers"""
192
+ if self._client is not None:
193
+ self._client.headers.update(headers)
194
+ if self._async_client is not None:
195
+ self._async_client.headers.update(headers)
196
+ return evolve(self, headers={**self._headers, **headers})
197
+
198
+ def with_cookies(self, cookies: dict[str, str]) -> "AuthenticatedClient":
199
+ """Get a new client matching this one with additional cookies"""
200
+ if self._client is not None:
201
+ self._client.cookies.update(cookies)
202
+ if self._async_client is not None:
203
+ self._async_client.cookies.update(cookies)
204
+ return evolve(self, cookies={**self._cookies, **cookies})
205
+
206
+ def with_timeout(self, timeout: httpx.Timeout) -> "AuthenticatedClient":
207
+ """Get a new client matching this one with a new timeout configuration"""
208
+ if self._client is not None:
209
+ self._client.timeout = timeout
210
+ if self._async_client is not None:
211
+ self._async_client.timeout = timeout
212
+ return evolve(self, timeout=timeout)
213
+
214
+ def set_httpx_client(self, client: httpx.Client) -> "AuthenticatedClient":
215
+ """Manually set the underlying httpx.Client
216
+
217
+ **NOTE**: This will override any other settings on the client, including cookies, headers, and timeout.
218
+ """
219
+ self._client = client
220
+ return self
221
+
222
+ def get_httpx_client(self) -> httpx.Client:
223
+ """Get the underlying httpx.Client, constructing a new one if not previously set"""
224
+ if self._client is None:
225
+ self._headers[self.auth_header_name] = (
226
+ f"{self.prefix} {self.token}" if self.prefix else self.token
227
+ )
228
+ self._client = httpx.Client(
229
+ base_url=self._base_url,
230
+ cookies=self._cookies,
231
+ headers=self._headers,
232
+ timeout=self._timeout,
233
+ verify=self._verify_ssl,
234
+ follow_redirects=self._follow_redirects,
235
+ **self._httpx_args,
236
+ )
237
+ return self._client
238
+
239
+ def __enter__(self) -> "AuthenticatedClient":
240
+ """Enter a context manager for self.client—you cannot enter twice (see httpx docs)"""
241
+ self.get_httpx_client().__enter__()
242
+ return self
243
+
244
+ def __exit__(self, *args: Any, **kwargs: Any) -> None:
245
+ """Exit a context manager for internal httpx.Client (see httpx docs)"""
246
+ self.get_httpx_client().__exit__(*args, **kwargs)
247
+
248
+ def set_async_httpx_client(
249
+ self, async_client: httpx.AsyncClient
250
+ ) -> "AuthenticatedClient":
251
+ """Manually set the underlying httpx.AsyncClient
252
+
253
+ **NOTE**: This will override any other settings on the client, including cookies, headers, and timeout.
254
+ """
255
+ self._async_client = async_client
256
+ return self
257
+
258
+ def get_async_httpx_client(self) -> httpx.AsyncClient:
259
+ """Get the underlying httpx.AsyncClient, constructing a new one if not previously set"""
260
+ if self._async_client is None:
261
+ self._headers[self.auth_header_name] = (
262
+ f"{self.prefix} {self.token}" if self.prefix else self.token
263
+ )
264
+ self._async_client = httpx.AsyncClient(
265
+ base_url=self._base_url,
266
+ cookies=self._cookies,
267
+ headers=self._headers,
268
+ timeout=self._timeout,
269
+ verify=self._verify_ssl,
270
+ follow_redirects=self._follow_redirects,
271
+ **self._httpx_args,
272
+ )
273
+ return self._async_client
274
+
275
+ async def __aenter__(self) -> "AuthenticatedClient":
276
+ """Enter a context manager for underlying httpx.AsyncClient—you cannot enter twice (see httpx docs)"""
277
+ await self.get_async_httpx_client().__aenter__()
278
+ return self
279
+
280
+ async def __aexit__(self, *args: Any, **kwargs: Any) -> None:
281
+ """Exit a context manager for underlying httpx.AsyncClient (see httpx docs)"""
282
+ await self.get_async_httpx_client().__aexit__(*args, **kwargs)
@@ -0,0 +1,16 @@
1
+ """Contains shared errors types that can be raised from API functions"""
2
+
3
+
4
+ class UnexpectedStatus(Exception):
5
+ """Raised by api functions when the response status an undocumented status and Client.raise_on_unexpected_status is True"""
6
+
7
+ def __init__(self, status_code: int, content: bytes):
8
+ self.status_code = status_code
9
+ self.content = content
10
+
11
+ super().__init__(
12
+ f"Unexpected status code: {status_code}\n\nResponse content:\n{content.decode(errors='ignore')}"
13
+ )
14
+
15
+
16
+ __all__ = ["UnexpectedStatus"]
@@ -0,0 +1,99 @@
1
+ """Contains all the data models used in inputs/outputs"""
2
+
3
+ from .asset import Asset
4
+ from .base_job_request import BaseJobRequest
5
+ from .base_job_request_parameters import BaseJobRequestParameters
6
+ from .collection import Collection
7
+ from .collection_assets_type_0 import CollectionAssetsType0
8
+ from .collection_summaries_type_0 import CollectionSummariesType0
9
+ from .collection_summaries_type_0_additional_property_type_2 import (
10
+ CollectionSummariesType0AdditionalPropertyType2,
11
+ )
12
+ from .error_response import ErrorResponse
13
+ from .error_response_details_type_0 import ErrorResponseDetailsType0
14
+ from .extent import Extent
15
+ from .geometry_collection import GeometryCollection
16
+ from .grid_type_enum import GridTypeEnum
17
+ from .http_validation_error import HTTPValidationError
18
+ from .jobs_filter import JobsFilter
19
+ from .jobs_status_response import JobsStatusResponse
20
+ from .line_string import LineString
21
+ from .link import Link
22
+ from .mime_types import MimeTypes
23
+ from .multi_line_string import MultiLineString
24
+ from .multi_point import MultiPoint
25
+ from .multi_polygon import MultiPolygon
26
+ from .output_format_enum import OutputFormatEnum
27
+ from .param_request import ParamRequest
28
+ from .param_type_enum import ParamTypeEnum
29
+ from .parameter import Parameter
30
+ from .parameter_dimension import ParameterDimension
31
+ from .point import Point
32
+ from .polygon import Polygon
33
+ from .process_type_enum import ProcessTypeEnum
34
+ from .processing_job import ProcessingJob
35
+ from .processing_job_parameters import ProcessingJobParameters
36
+ from .processing_job_summary import ProcessingJobSummary
37
+ from .processing_job_summary_parameters import ProcessingJobSummaryParameters
38
+ from .processing_status_enum import ProcessingStatusEnum
39
+ from .provider import Provider
40
+ from .range_ import Range
41
+ from .service_details import ServiceDetails
42
+ from .spatial_extent import SpatialExtent
43
+ from .tile_request import TileRequest
44
+ from .time_interval import TimeInterval
45
+ from .upscaling_task import UpscalingTask
46
+ from .upscaling_task_request import UpscalingTaskRequest
47
+ from .upscaling_task_request_parameters import UpscalingTaskRequestParameters
48
+ from .upscaling_task_summary import UpscalingTaskSummary
49
+ from .validation_error import ValidationError
50
+ from .validation_error_context import ValidationErrorContext
51
+
52
+ __all__ = (
53
+ "Asset",
54
+ "BaseJobRequest",
55
+ "BaseJobRequestParameters",
56
+ "Collection",
57
+ "CollectionAssetsType0",
58
+ "CollectionSummariesType0",
59
+ "CollectionSummariesType0AdditionalPropertyType2",
60
+ "ErrorResponse",
61
+ "ErrorResponseDetailsType0",
62
+ "Extent",
63
+ "GeometryCollection",
64
+ "GridTypeEnum",
65
+ "HTTPValidationError",
66
+ "JobsFilter",
67
+ "JobsStatusResponse",
68
+ "LineString",
69
+ "Link",
70
+ "MimeTypes",
71
+ "MultiLineString",
72
+ "MultiPoint",
73
+ "MultiPolygon",
74
+ "OutputFormatEnum",
75
+ "Parameter",
76
+ "ParameterDimension",
77
+ "ParamRequest",
78
+ "ParamTypeEnum",
79
+ "Point",
80
+ "Polygon",
81
+ "ProcessingJob",
82
+ "ProcessingJobParameters",
83
+ "ProcessingJobSummary",
84
+ "ProcessingJobSummaryParameters",
85
+ "ProcessingStatusEnum",
86
+ "ProcessTypeEnum",
87
+ "Provider",
88
+ "Range",
89
+ "ServiceDetails",
90
+ "SpatialExtent",
91
+ "TileRequest",
92
+ "TimeInterval",
93
+ "UpscalingTask",
94
+ "UpscalingTaskRequest",
95
+ "UpscalingTaskRequestParameters",
96
+ "UpscalingTaskSummary",
97
+ "ValidationError",
98
+ "ValidationErrorContext",
99
+ )
@@ -0,0 +1,155 @@
1
+ from __future__ import annotations
2
+
3
+ from collections.abc import Mapping
4
+ from typing import Any, TypeVar, cast
5
+
6
+ from attrs import define as _attrs_define
7
+ from attrs import field as _attrs_field
8
+
9
+ from ..types import UNSET, Unset
10
+
11
+ T = TypeVar("T", bound="Asset")
12
+
13
+
14
+ @_attrs_define
15
+ class Asset:
16
+ """https://github.com/radiantearth/stac-spec/blob/v1.0.0/item-spec/item-spec.md#asset-object
17
+
18
+ Attributes:
19
+ href (str):
20
+ type_ (None | str | Unset):
21
+ title (None | str | Unset):
22
+ description (None | str | Unset):
23
+ roles (list[str] | None | Unset):
24
+ """
25
+
26
+ href: str
27
+ type_: None | str | Unset = UNSET
28
+ title: None | str | Unset = UNSET
29
+ description: None | str | Unset = UNSET
30
+ roles: list[str] | None | Unset = UNSET
31
+ additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
32
+
33
+ def to_dict(self) -> dict[str, Any]:
34
+ href = self.href
35
+
36
+ type_: None | str | Unset
37
+ if isinstance(self.type_, Unset):
38
+ type_ = UNSET
39
+ else:
40
+ type_ = self.type_
41
+
42
+ title: None | str | Unset
43
+ if isinstance(self.title, Unset):
44
+ title = UNSET
45
+ else:
46
+ title = self.title
47
+
48
+ description: None | str | Unset
49
+ if isinstance(self.description, Unset):
50
+ description = UNSET
51
+ else:
52
+ description = self.description
53
+
54
+ roles: list[str] | None | Unset
55
+ if isinstance(self.roles, Unset):
56
+ roles = UNSET
57
+ elif isinstance(self.roles, list):
58
+ roles = self.roles
59
+
60
+ else:
61
+ roles = self.roles
62
+
63
+ field_dict: dict[str, Any] = {}
64
+ field_dict.update(self.additional_properties)
65
+ field_dict.update(
66
+ {
67
+ "href": href,
68
+ }
69
+ )
70
+ if type_ is not UNSET:
71
+ field_dict["type"] = type_
72
+ if title is not UNSET:
73
+ field_dict["title"] = title
74
+ if description is not UNSET:
75
+ field_dict["description"] = description
76
+ if roles is not UNSET:
77
+ field_dict["roles"] = roles
78
+
79
+ return field_dict
80
+
81
+ @classmethod
82
+ def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
83
+ d = dict(src_dict)
84
+ href = d.pop("href")
85
+
86
+ def _parse_type_(data: object) -> None | str | Unset:
87
+ if data is None:
88
+ return data
89
+ if isinstance(data, Unset):
90
+ return data
91
+ return cast(None | str | Unset, data)
92
+
93
+ type_ = _parse_type_(d.pop("type", UNSET))
94
+
95
+ def _parse_title(data: object) -> None | str | Unset:
96
+ if data is None:
97
+ return data
98
+ if isinstance(data, Unset):
99
+ return data
100
+ return cast(None | str | Unset, data)
101
+
102
+ title = _parse_title(d.pop("title", UNSET))
103
+
104
+ def _parse_description(data: object) -> None | str | Unset:
105
+ if data is None:
106
+ return data
107
+ if isinstance(data, Unset):
108
+ return data
109
+ return cast(None | str | Unset, data)
110
+
111
+ description = _parse_description(d.pop("description", UNSET))
112
+
113
+ def _parse_roles(data: object) -> list[str] | None | Unset:
114
+ if data is None:
115
+ return data
116
+ if isinstance(data, Unset):
117
+ return data
118
+ try:
119
+ if not isinstance(data, list):
120
+ raise TypeError()
121
+ roles_type_0 = cast(list[str], data)
122
+
123
+ return roles_type_0
124
+ except (TypeError, ValueError, AttributeError, KeyError):
125
+ pass
126
+ return cast(list[str] | None | Unset, data)
127
+
128
+ roles = _parse_roles(d.pop("roles", UNSET))
129
+
130
+ asset = cls(
131
+ href=href,
132
+ type_=type_,
133
+ title=title,
134
+ description=description,
135
+ roles=roles,
136
+ )
137
+
138
+ asset.additional_properties = d
139
+ return asset
140
+
141
+ @property
142
+ def additional_keys(self) -> list[str]:
143
+ return list(self.additional_properties.keys())
144
+
145
+ def __getitem__(self, key: str) -> Any:
146
+ return self.additional_properties[key]
147
+
148
+ def __setitem__(self, key: str, value: Any) -> None:
149
+ self.additional_properties[key] = value
150
+
151
+ def __delitem__(self, key: str) -> None:
152
+ del self.additional_properties[key]
153
+
154
+ def __contains__(self, key: str) -> bool:
155
+ return key in self.additional_properties
@@ -0,0 +1,104 @@
1
+ from __future__ import annotations
2
+
3
+ from collections.abc import Mapping
4
+ from typing import TYPE_CHECKING, Any, TypeVar
5
+
6
+ from attrs import define as _attrs_define
7
+ from attrs import field as _attrs_field
8
+
9
+ from ..models.output_format_enum import OutputFormatEnum
10
+ from ..models.process_type_enum import ProcessTypeEnum
11
+
12
+ if TYPE_CHECKING:
13
+ from ..models.base_job_request_parameters import BaseJobRequestParameters
14
+ from ..models.service_details import ServiceDetails
15
+
16
+
17
+ T = TypeVar("T", bound="BaseJobRequest")
18
+
19
+
20
+ @_attrs_define
21
+ class BaseJobRequest:
22
+ """
23
+ Attributes:
24
+ title (str): Title of the job to execute
25
+ label (ProcessTypeEnum):
26
+ service (ServiceDetails):
27
+ parameters (BaseJobRequestParameters): JSON representing the parameters for the service execution
28
+ format_ (OutputFormatEnum):
29
+ """
30
+
31
+ title: str
32
+ label: ProcessTypeEnum
33
+ service: ServiceDetails
34
+ parameters: BaseJobRequestParameters
35
+ format_: OutputFormatEnum
36
+ additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
37
+
38
+ def to_dict(self) -> dict[str, Any]:
39
+ title = self.title
40
+
41
+ label = self.label.value
42
+
43
+ service = self.service.to_dict()
44
+
45
+ parameters = self.parameters.to_dict()
46
+
47
+ format_ = self.format_.value
48
+
49
+ field_dict: dict[str, Any] = {}
50
+ field_dict.update(self.additional_properties)
51
+ field_dict.update(
52
+ {
53
+ "title": title,
54
+ "label": label,
55
+ "service": service,
56
+ "parameters": parameters,
57
+ "format": format_,
58
+ }
59
+ )
60
+
61
+ return field_dict
62
+
63
+ @classmethod
64
+ def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
65
+ from ..models.base_job_request_parameters import BaseJobRequestParameters
66
+ from ..models.service_details import ServiceDetails
67
+
68
+ d = dict(src_dict)
69
+ title = d.pop("title")
70
+
71
+ label = ProcessTypeEnum(d.pop("label"))
72
+
73
+ service = ServiceDetails.from_dict(d.pop("service"))
74
+
75
+ parameters = BaseJobRequestParameters.from_dict(d.pop("parameters"))
76
+
77
+ format_ = OutputFormatEnum(d.pop("format"))
78
+
79
+ base_job_request = cls(
80
+ title=title,
81
+ label=label,
82
+ service=service,
83
+ parameters=parameters,
84
+ format_=format_,
85
+ )
86
+
87
+ base_job_request.additional_properties = d
88
+ return base_job_request
89
+
90
+ @property
91
+ def additional_keys(self) -> list[str]:
92
+ return list(self.additional_properties.keys())
93
+
94
+ def __getitem__(self, key: str) -> Any:
95
+ return self.additional_properties[key]
96
+
97
+ def __setitem__(self, key: str, value: Any) -> None:
98
+ self.additional_properties[key] = value
99
+
100
+ def __delitem__(self, key: str) -> None:
101
+ del self.additional_properties[key]
102
+
103
+ def __contains__(self, key: str) -> bool:
104
+ return key in self.additional_properties