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,138 @@
1
+ from __future__ import annotations
2
+
3
+ import datetime
4
+ from collections.abc import Mapping
5
+ from typing import TYPE_CHECKING, Any, TypeVar
6
+
7
+ from attrs import define as _attrs_define
8
+ from attrs import field as _attrs_field
9
+ from dateutil.parser import isoparse
10
+
11
+ from ..models.process_type_enum import ProcessTypeEnum
12
+ from ..models.processing_status_enum import ProcessingStatusEnum
13
+
14
+ if TYPE_CHECKING:
15
+ from ..models.processing_job_summary import ProcessingJobSummary
16
+ from ..models.service_details import ServiceDetails
17
+
18
+
19
+ T = TypeVar("T", bound="UpscalingTask")
20
+
21
+
22
+ @_attrs_define
23
+ class UpscalingTask:
24
+ """
25
+ Attributes:
26
+ id (int): Unique identifier of the upscaling task
27
+ title (str): Title of the upscaling task
28
+ label (ProcessTypeEnum):
29
+ status (ProcessingStatusEnum):
30
+ service (ServiceDetails):
31
+ created (datetime.datetime): Creation time of the processing job
32
+ updated (datetime.datetime): Timestamp representing the last time that the job details were updated
33
+ jobs (list[ProcessingJobSummary]): List of processing jobs that were launched with the upscaling request
34
+ """
35
+
36
+ id: int
37
+ title: str
38
+ label: ProcessTypeEnum
39
+ status: ProcessingStatusEnum
40
+ service: ServiceDetails
41
+ created: datetime.datetime
42
+ updated: datetime.datetime
43
+ jobs: list[ProcessingJobSummary]
44
+ additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
45
+
46
+ def to_dict(self) -> dict[str, Any]:
47
+ id = self.id
48
+
49
+ title = self.title
50
+
51
+ label = self.label.value
52
+
53
+ status = self.status.value
54
+
55
+ service = self.service.to_dict()
56
+
57
+ created = self.created.isoformat()
58
+
59
+ updated = self.updated.isoformat()
60
+
61
+ jobs = []
62
+ for jobs_item_data in self.jobs:
63
+ jobs_item = jobs_item_data.to_dict()
64
+ jobs.append(jobs_item)
65
+
66
+ field_dict: dict[str, Any] = {}
67
+ field_dict.update(self.additional_properties)
68
+ field_dict.update(
69
+ {
70
+ "id": id,
71
+ "title": title,
72
+ "label": label,
73
+ "status": status,
74
+ "service": service,
75
+ "created": created,
76
+ "updated": updated,
77
+ "jobs": jobs,
78
+ }
79
+ )
80
+
81
+ return field_dict
82
+
83
+ @classmethod
84
+ def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
85
+ from ..models.processing_job_summary import ProcessingJobSummary
86
+ from ..models.service_details import ServiceDetails
87
+
88
+ d = dict(src_dict)
89
+ id = d.pop("id")
90
+
91
+ title = d.pop("title")
92
+
93
+ label = ProcessTypeEnum(d.pop("label"))
94
+
95
+ status = ProcessingStatusEnum(d.pop("status"))
96
+
97
+ service = ServiceDetails.from_dict(d.pop("service"))
98
+
99
+ created = isoparse(d.pop("created"))
100
+
101
+ updated = isoparse(d.pop("updated"))
102
+
103
+ jobs = []
104
+ _jobs = d.pop("jobs")
105
+ for jobs_item_data in _jobs:
106
+ jobs_item = ProcessingJobSummary.from_dict(jobs_item_data)
107
+
108
+ jobs.append(jobs_item)
109
+
110
+ upscaling_task = cls(
111
+ id=id,
112
+ title=title,
113
+ label=label,
114
+ status=status,
115
+ service=service,
116
+ created=created,
117
+ updated=updated,
118
+ jobs=jobs,
119
+ )
120
+
121
+ upscaling_task.additional_properties = d
122
+ return upscaling_task
123
+
124
+ @property
125
+ def additional_keys(self) -> list[str]:
126
+ return list(self.additional_properties.keys())
127
+
128
+ def __getitem__(self, key: str) -> Any:
129
+ return self.additional_properties[key]
130
+
131
+ def __setitem__(self, key: str, value: Any) -> None:
132
+ self.additional_properties[key] = value
133
+
134
+ def __delitem__(self, key: str) -> None:
135
+ del self.additional_properties[key]
136
+
137
+ def __contains__(self, key: str) -> bool:
138
+ return key in self.additional_properties
@@ -0,0 +1,118 @@
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.parameter_dimension import ParameterDimension
14
+ from ..models.service_details import ServiceDetails
15
+ from ..models.upscaling_task_request_parameters import (
16
+ UpscalingTaskRequestParameters,
17
+ )
18
+
19
+
20
+ T = TypeVar("T", bound="UpscalingTaskRequest")
21
+
22
+
23
+ @_attrs_define
24
+ class UpscalingTaskRequest:
25
+ """
26
+ Attributes:
27
+ title (str): Title of the job to execute
28
+ label (ProcessTypeEnum):
29
+ service (ServiceDetails):
30
+ parameters (UpscalingTaskRequestParameters): JSON representing the parameters for the service execution
31
+ format_ (OutputFormatEnum):
32
+ dimension (ParameterDimension):
33
+ """
34
+
35
+ title: str
36
+ label: ProcessTypeEnum
37
+ service: ServiceDetails
38
+ parameters: UpscalingTaskRequestParameters
39
+ format_: OutputFormatEnum
40
+ dimension: ParameterDimension
41
+ additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
42
+
43
+ def to_dict(self) -> dict[str, Any]:
44
+ title = self.title
45
+
46
+ label = self.label.value
47
+
48
+ service = self.service.to_dict()
49
+
50
+ parameters = self.parameters.to_dict()
51
+
52
+ format_ = self.format_.value
53
+
54
+ dimension = self.dimension.to_dict()
55
+
56
+ field_dict: dict[str, Any] = {}
57
+ field_dict.update(self.additional_properties)
58
+ field_dict.update(
59
+ {
60
+ "title": title,
61
+ "label": label,
62
+ "service": service,
63
+ "parameters": parameters,
64
+ "format": format_,
65
+ "dimension": dimension,
66
+ }
67
+ )
68
+
69
+ return field_dict
70
+
71
+ @classmethod
72
+ def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
73
+ from ..models.parameter_dimension import ParameterDimension
74
+ from ..models.service_details import ServiceDetails
75
+ from ..models.upscaling_task_request_parameters import (
76
+ UpscalingTaskRequestParameters,
77
+ )
78
+
79
+ d = dict(src_dict)
80
+ title = d.pop("title")
81
+
82
+ label = ProcessTypeEnum(d.pop("label"))
83
+
84
+ service = ServiceDetails.from_dict(d.pop("service"))
85
+
86
+ parameters = UpscalingTaskRequestParameters.from_dict(d.pop("parameters"))
87
+
88
+ format_ = OutputFormatEnum(d.pop("format"))
89
+
90
+ dimension = ParameterDimension.from_dict(d.pop("dimension"))
91
+
92
+ upscaling_task_request = cls(
93
+ title=title,
94
+ label=label,
95
+ service=service,
96
+ parameters=parameters,
97
+ format_=format_,
98
+ dimension=dimension,
99
+ )
100
+
101
+ upscaling_task_request.additional_properties = d
102
+ return upscaling_task_request
103
+
104
+ @property
105
+ def additional_keys(self) -> list[str]:
106
+ return list(self.additional_properties.keys())
107
+
108
+ def __getitem__(self, key: str) -> Any:
109
+ return self.additional_properties[key]
110
+
111
+ def __setitem__(self, key: str, value: Any) -> None:
112
+ self.additional_properties[key] = value
113
+
114
+ def __delitem__(self, key: str) -> None:
115
+ del self.additional_properties[key]
116
+
117
+ def __contains__(self, key: str) -> bool:
118
+ return key in self.additional_properties
@@ -0,0 +1,47 @@
1
+ from __future__ import annotations
2
+
3
+ from collections.abc import Mapping
4
+ from typing import Any, TypeVar
5
+
6
+ from attrs import define as _attrs_define
7
+ from attrs import field as _attrs_field
8
+
9
+ T = TypeVar("T", bound="UpscalingTaskRequestParameters")
10
+
11
+
12
+ @_attrs_define
13
+ class UpscalingTaskRequestParameters:
14
+ """JSON representing the parameters for the service execution"""
15
+
16
+ additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
17
+
18
+ def to_dict(self) -> dict[str, Any]:
19
+
20
+ field_dict: dict[str, Any] = {}
21
+ field_dict.update(self.additional_properties)
22
+
23
+ return field_dict
24
+
25
+ @classmethod
26
+ def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
27
+ d = dict(src_dict)
28
+ upscaling_task_request_parameters = cls()
29
+
30
+ upscaling_task_request_parameters.additional_properties = d
31
+ return upscaling_task_request_parameters
32
+
33
+ @property
34
+ def additional_keys(self) -> list[str]:
35
+ return list(self.additional_properties.keys())
36
+
37
+ def __getitem__(self, key: str) -> Any:
38
+ return self.additional_properties[key]
39
+
40
+ def __setitem__(self, key: str, value: Any) -> None:
41
+ self.additional_properties[key] = value
42
+
43
+ def __delitem__(self, key: str) -> None:
44
+ del self.additional_properties[key]
45
+
46
+ def __contains__(self, key: str) -> bool:
47
+ return key in self.additional_properties
@@ -0,0 +1,88 @@
1
+ from __future__ import annotations
2
+
3
+ from collections.abc import Mapping
4
+ from typing import Any, TypeVar
5
+
6
+ from attrs import define as _attrs_define
7
+ from attrs import field as _attrs_field
8
+
9
+ from ..models.process_type_enum import ProcessTypeEnum
10
+ from ..models.processing_status_enum import ProcessingStatusEnum
11
+
12
+ T = TypeVar("T", bound="UpscalingTaskSummary")
13
+
14
+
15
+ @_attrs_define
16
+ class UpscalingTaskSummary:
17
+ """
18
+ Attributes:
19
+ id (int): Unique identifier of the upscaling task
20
+ title (str): Title of the upscaling task
21
+ label (ProcessTypeEnum):
22
+ status (ProcessingStatusEnum):
23
+ """
24
+
25
+ id: int
26
+ title: str
27
+ label: ProcessTypeEnum
28
+ status: ProcessingStatusEnum
29
+ additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
30
+
31
+ def to_dict(self) -> dict[str, Any]:
32
+ id = self.id
33
+
34
+ title = self.title
35
+
36
+ label = self.label.value
37
+
38
+ status = self.status.value
39
+
40
+ field_dict: dict[str, Any] = {}
41
+ field_dict.update(self.additional_properties)
42
+ field_dict.update(
43
+ {
44
+ "id": id,
45
+ "title": title,
46
+ "label": label,
47
+ "status": status,
48
+ }
49
+ )
50
+
51
+ return field_dict
52
+
53
+ @classmethod
54
+ def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
55
+ d = dict(src_dict)
56
+ id = d.pop("id")
57
+
58
+ title = d.pop("title")
59
+
60
+ label = ProcessTypeEnum(d.pop("label"))
61
+
62
+ status = ProcessingStatusEnum(d.pop("status"))
63
+
64
+ upscaling_task_summary = cls(
65
+ id=id,
66
+ title=title,
67
+ label=label,
68
+ status=status,
69
+ )
70
+
71
+ upscaling_task_summary.additional_properties = d
72
+ return upscaling_task_summary
73
+
74
+ @property
75
+ def additional_keys(self) -> list[str]:
76
+ return list(self.additional_properties.keys())
77
+
78
+ def __getitem__(self, key: str) -> Any:
79
+ return self.additional_properties[key]
80
+
81
+ def __setitem__(self, key: str, value: Any) -> None:
82
+ self.additional_properties[key] = value
83
+
84
+ def __delitem__(self, key: str) -> None:
85
+ del self.additional_properties[key]
86
+
87
+ def __contains__(self, key: str) -> bool:
88
+ return key in self.additional_properties
@@ -0,0 +1,123 @@
1
+ from __future__ import annotations
2
+
3
+ from collections.abc import Mapping
4
+ from typing import TYPE_CHECKING, 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
+ if TYPE_CHECKING:
12
+ from ..models.validation_error_context import ValidationErrorContext
13
+
14
+
15
+ T = TypeVar("T", bound="ValidationError")
16
+
17
+
18
+ @_attrs_define
19
+ class ValidationError:
20
+ """
21
+ Attributes:
22
+ loc (list[int | str]):
23
+ msg (str):
24
+ type_ (str):
25
+ input_ (Any | Unset):
26
+ ctx (ValidationErrorContext | Unset):
27
+ """
28
+
29
+ loc: list[int | str]
30
+ msg: str
31
+ type_: str
32
+ input_: Any | Unset = UNSET
33
+ ctx: ValidationErrorContext | Unset = UNSET
34
+ additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
35
+
36
+ def to_dict(self) -> dict[str, Any]:
37
+ loc = []
38
+ for loc_item_data in self.loc:
39
+ loc_item: int | str
40
+ loc_item = loc_item_data
41
+ loc.append(loc_item)
42
+
43
+ msg = self.msg
44
+
45
+ type_ = self.type_
46
+
47
+ input_ = self.input_
48
+
49
+ ctx: dict[str, Any] | Unset = UNSET
50
+ if not isinstance(self.ctx, Unset):
51
+ ctx = self.ctx.to_dict()
52
+
53
+ field_dict: dict[str, Any] = {}
54
+ field_dict.update(self.additional_properties)
55
+ field_dict.update(
56
+ {
57
+ "loc": loc,
58
+ "msg": msg,
59
+ "type": type_,
60
+ }
61
+ )
62
+ if input_ is not UNSET:
63
+ field_dict["input"] = input_
64
+ if ctx is not UNSET:
65
+ field_dict["ctx"] = ctx
66
+
67
+ return field_dict
68
+
69
+ @classmethod
70
+ def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
71
+ from ..models.validation_error_context import ValidationErrorContext
72
+
73
+ d = dict(src_dict)
74
+ loc = []
75
+ _loc = d.pop("loc")
76
+ for loc_item_data in _loc:
77
+
78
+ def _parse_loc_item(data: object) -> int | str:
79
+ return cast(int | str, data)
80
+
81
+ loc_item = _parse_loc_item(loc_item_data)
82
+
83
+ loc.append(loc_item)
84
+
85
+ msg = d.pop("msg")
86
+
87
+ type_ = d.pop("type")
88
+
89
+ input_ = d.pop("input", UNSET)
90
+
91
+ _ctx = d.pop("ctx", UNSET)
92
+ ctx: ValidationErrorContext | Unset
93
+ if isinstance(_ctx, Unset):
94
+ ctx = UNSET
95
+ else:
96
+ ctx = ValidationErrorContext.from_dict(_ctx)
97
+
98
+ validation_error = cls(
99
+ loc=loc,
100
+ msg=msg,
101
+ type_=type_,
102
+ input_=input_,
103
+ ctx=ctx,
104
+ )
105
+
106
+ validation_error.additional_properties = d
107
+ return validation_error
108
+
109
+ @property
110
+ def additional_keys(self) -> list[str]:
111
+ return list(self.additional_properties.keys())
112
+
113
+ def __getitem__(self, key: str) -> Any:
114
+ return self.additional_properties[key]
115
+
116
+ def __setitem__(self, key: str, value: Any) -> None:
117
+ self.additional_properties[key] = value
118
+
119
+ def __delitem__(self, key: str) -> None:
120
+ del self.additional_properties[key]
121
+
122
+ def __contains__(self, key: str) -> bool:
123
+ return key in self.additional_properties
@@ -0,0 +1,47 @@
1
+ from __future__ import annotations
2
+
3
+ from collections.abc import Mapping
4
+ from typing import Any, TypeVar
5
+
6
+ from attrs import define as _attrs_define
7
+ from attrs import field as _attrs_field
8
+
9
+ T = TypeVar("T", bound="ValidationErrorContext")
10
+
11
+
12
+ @_attrs_define
13
+ class ValidationErrorContext:
14
+ """ """
15
+
16
+ additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
17
+
18
+ def to_dict(self) -> dict[str, Any]:
19
+
20
+ field_dict: dict[str, Any] = {}
21
+ field_dict.update(self.additional_properties)
22
+
23
+ return field_dict
24
+
25
+ @classmethod
26
+ def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
27
+ d = dict(src_dict)
28
+ validation_error_context = cls()
29
+
30
+ validation_error_context.additional_properties = d
31
+ return validation_error_context
32
+
33
+ @property
34
+ def additional_keys(self) -> list[str]:
35
+ return list(self.additional_properties.keys())
36
+
37
+ def __getitem__(self, key: str) -> Any:
38
+ return self.additional_properties[key]
39
+
40
+ def __setitem__(self, key: str, value: Any) -> None:
41
+ self.additional_properties[key] = value
42
+
43
+ def __delitem__(self, key: str) -> None:
44
+ del self.additional_properties[key]
45
+
46
+ def __contains__(self, key: str) -> bool:
47
+ return key in self.additional_properties
@@ -0,0 +1,54 @@
1
+ """Contains some shared types for properties"""
2
+
3
+ from collections.abc import Mapping, MutableMapping
4
+ from http import HTTPStatus
5
+ from typing import IO, BinaryIO, Generic, Literal, TypeVar
6
+
7
+ from attrs import define
8
+
9
+
10
+ class Unset:
11
+ def __bool__(self) -> Literal[False]:
12
+ return False
13
+
14
+
15
+ UNSET: Unset = Unset()
16
+
17
+ # The types that `httpx.Client(files=)` can accept, copied from that library.
18
+ FileContent = IO[bytes] | bytes | str
19
+ FileTypes = (
20
+ # (filename, file (or bytes), content_type)
21
+ tuple[str | None, FileContent, str | None]
22
+ # (filename, file (or bytes), content_type, headers)
23
+ | tuple[str | None, FileContent, str | None, Mapping[str, str]]
24
+ )
25
+ RequestFiles = list[tuple[str, FileTypes]]
26
+
27
+
28
+ @define
29
+ class File:
30
+ """Contains information for file uploads"""
31
+
32
+ payload: BinaryIO
33
+ file_name: str | None = None
34
+ mime_type: str | None = None
35
+
36
+ def to_tuple(self) -> FileTypes:
37
+ """Return a tuple representation that httpx will accept for multipart/form-data"""
38
+ return self.file_name, self.payload, self.mime_type
39
+
40
+
41
+ T = TypeVar("T")
42
+
43
+
44
+ @define
45
+ class Response(Generic[T]):
46
+ """A response from an endpoint"""
47
+
48
+ status_code: HTTPStatus
49
+ content: bytes
50
+ headers: MutableMapping[str, str]
51
+ parsed: T | None
52
+
53
+
54
+ __all__ = ["UNSET", "File", "FileTypes", "RequestFiles", "Response", "Unset"]