|
1 | | -# pylint: disable=protected-access |
2 | 1 | # ------------------------------------ |
3 | 2 | # Copyright (c) Microsoft Corporation. |
4 | 3 | # Licensed under the MIT License. |
|
7 | 6 |
|
8 | 7 | Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize |
9 | 8 | """ |
10 | | -from typing import ( |
11 | | - Any, |
12 | | - IO, |
13 | | - Optional, |
14 | | - Dict, |
15 | | - Union, |
16 | | - cast, |
17 | | - overload, |
18 | | - List, |
19 | | - MutableMapping, |
20 | | - TypeVar, |
21 | | - Callable, |
22 | | - TYPE_CHECKING, |
23 | | -) # pylint: disable=line-too-long |
24 | | -from azure.core.credentials import AzureKeyCredential |
25 | | -from azure.core.rest import HttpRequest, HttpResponse |
26 | | -from azure.core.pipeline import PipelineResponse |
27 | | -from azure.core.polling import LROPoller, NoPolling, PollingMethod |
28 | | -from azure.core.polling.base_polling import LROBasePolling |
29 | | -from azure.core.tracing.decorator import distributed_trace |
30 | | -from azure.core.utils import case_insensitive_dict |
| 9 | +from typing import List |
31 | 10 |
|
32 | | -from . import models as _models |
33 | | -from ._model_base import _deserialize |
34 | | -from ._client import RadiologyInsightsClient as _RadiologyInsightsClient |
35 | | - |
36 | | - |
37 | | -JSON = MutableMapping[str, Any] # pylint: disable=unsubscriptable-object |
38 | | -T = TypeVar("T") |
39 | | -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] |
40 | | - |
41 | | -if TYPE_CHECKING: |
42 | | - # pylint: disable=unused-import,ungrouped-imports |
43 | | - from azure.core.credentials import TokenCredential |
44 | | - |
45 | | - |
46 | | -class RadiologyInsightsClient: # pylint: disable=client-accepts-api-version-keyword |
47 | | - """RadiologyInsightsClient. |
48 | | -
|
49 | | - :param endpoint: Supported Cognitive Services endpoints (protocol and hostname, for example: |
50 | | - https://westus2.api.cognitive.microsoft.com). Required. |
51 | | - :type endpoint: str |
52 | | - :param credential: Credential used to authenticate requests to the service. Is either a |
53 | | - AzureKeyCredential type or a TokenCredential type. Required. |
54 | | - :type credential: ~azure.core.credentials.AzureKeyCredential or |
55 | | - ~azure.core.credentials.TokenCredential |
56 | | - :keyword api_version: The API version to use for this operation. Default value is "2024-04-01". |
57 | | - Note that overriding this default value may result in unsupported behavior. |
58 | | - :paramtype api_version: str |
59 | | - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no |
60 | | - Retry-After header is present. |
61 | | - """ |
62 | | - |
63 | | - def __init__(self, endpoint: str, credential: Union[AzureKeyCredential, "TokenCredential"], **kwargs: Any) -> None: |
64 | | - self._client = _RadiologyInsightsClient(endpoint=endpoint, credential=credential, **kwargs) |
65 | | - |
66 | | - @overload |
67 | | - def begin_infer_radiology_insights( |
68 | | - self, |
69 | | - id: str, |
70 | | - resource: _models.RadiologyInsightsJob, |
71 | | - *, |
72 | | - expand: Optional[List[str]] = None, |
73 | | - content_type: str = "application/json", |
74 | | - **kwargs: Any |
75 | | - ) -> LROPoller[_models.RadiologyInsightsInferenceResult]: |
76 | | - # pylint: disable=line-too-long |
77 | | - """Create Radiology Insights inference result. |
78 | | -
|
79 | | - Creates a Radiology Insights inference result with the given request body. |
80 | | -
|
81 | | - :param id: The unique ID of the inference result. Required. |
82 | | - :type id: str |
83 | | - :param resource: The resource instance. Required. |
84 | | - :type resource: ~azure.healthinsights.radiologyinsights.models.RadiologyInsightsJob |
85 | | - :keyword expand: Expand the indicated resources into the response. Default value is None. |
86 | | - :paramtype expand: list[str] |
87 | | - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". |
88 | | - :paramtype content_type: str |
89 | | - :return: An instance of LROPoller that returns RadiologyInsightsInferenceResult. The RadiologyInsightsInferenceResult is compatible with MutableMapping |
90 | | - :rtype: ~azure.core.polling.LROPoller[~azure.healthinsights.radiologyinsights.models.RadiologyInsightsResult] |
91 | | - :raises ~azure.core.exceptions.HttpResponseError:""" |
92 | | - |
93 | | - @overload |
94 | | - def begin_infer_radiology_insights( |
95 | | - self, |
96 | | - id: str, |
97 | | - resource: JSON, |
98 | | - *, |
99 | | - expand: Optional[List[str]] = None, |
100 | | - content_type: str = "application/json", |
101 | | - **kwargs: Any |
102 | | - ) -> LROPoller[_models.RadiologyInsightsInferenceResult]: |
103 | | - # pylint: disable=line-too-long |
104 | | - """Create Radiology Insights inference result. |
105 | | -
|
106 | | - Creates a Radiology Insights inference result with the given request body. |
107 | | -
|
108 | | - :param id: The unique ID of the inference result. Required. |
109 | | - :type id: str |
110 | | - :param resource: The resource instance. Required. |
111 | | - :type resource: JSON |
112 | | - :keyword expand: Expand the indicated resources into the response. Default value is None. |
113 | | - :paramtype expand: list[str] |
114 | | - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". |
115 | | - :paramtype content_type: str |
116 | | - :return: An instance of LROPoller that returns RadiologyInsightsInferenceResult. The RadiologyInsightsInferenceResult is compatible with MutableMapping |
117 | | - :rtype: ~azure.core.polling.LROPoller[~azure.healthinsights.radiologyinsights.models.RadiologyInsightsInferenceResult] |
118 | | - :raises ~azure.core.exceptions.HttpResponseError:""" |
119 | | - |
120 | | - @overload |
121 | | - def begin_infer_radiology_insights( |
122 | | - self, |
123 | | - id: str, |
124 | | - resource: IO[bytes], |
125 | | - *, |
126 | | - expand: Optional[List[str]] = None, |
127 | | - content_type: str = "application/json", |
128 | | - **kwargs: Any |
129 | | - ) -> LROPoller[_models.RadiologyInsightsInferenceResult]: |
130 | | - # pylint: disable=line-too-long |
131 | | - """Create Radiology Insights inference result. |
132 | | -
|
133 | | - Creates a Radiology Insights inference result with the given request body. |
134 | | -
|
135 | | - :param id: The unique ID of the inference result. Required. |
136 | | - :type id: str |
137 | | - :param resource: The resource instance. Required. |
138 | | - :type resource: IO[bytes] |
139 | | - :keyword expand: Expand the indicated resources into the response. Default value is None. |
140 | | - :paramtype expand: list[str] |
141 | | - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". |
142 | | - :paramtype content_type: str |
143 | | - :return: An instance of LROPoller that returns RadiologyInsightsInferenceResult. The RadiologyInsightsInferenceResult is compatible with MutableMapping |
144 | | - :rtype: ~azure.core.polling.LROPoller[~azure.healthinsights.radiologyinsights.models.RadiologyInsightsInferenceResult] |
145 | | - :raises ~azure.core.exceptions.HttpResponseError:""" |
146 | | - |
147 | | - @distributed_trace |
148 | | - def begin_infer_radiology_insights( |
149 | | - self, |
150 | | - id: str, |
151 | | - resource: Union[_models.RadiologyInsightsJob, JSON, IO[bytes]], |
152 | | - *, |
153 | | - expand: Optional[List[str]] = None, |
154 | | - **kwargs: Any |
155 | | - ) -> LROPoller[_models.RadiologyInsightsInferenceResult]: |
156 | | - # pylint: disable=line-too-long |
157 | | - """Create Radiology Insights inference result. |
158 | | -
|
159 | | - Creates a Radiology Insights inference result with the given request body. |
160 | | -
|
161 | | - :param id: The unique ID of the inference result. Required. |
162 | | - :type id: str |
163 | | - :param resource: The resource instance. Is one of the following types: RadiologyInsightsJob, JSON, IO[bytes] Required. |
164 | | - :type resource: ~azure.healthinsights.radiologyinsights.models.RadiologyInsightsJob or JSON or IO[bytes] |
165 | | - :keyword expand: Expand the indicated resources into the response. Default value is None. |
166 | | - :paramtype expand: list[str] |
167 | | - :return: An instance of LROPoller that returns RadiologyInsightsInferenceResult. The RadiologyInsightsInferenceResult is compatible with MutableMapping |
168 | | - :rtype: ~azure.core.polling.LROPoller[~azure.healthinsights.radiologyinsights.models.RadiologyInsightsInferenceResult] |
169 | | - :raises ~azure.core.exceptions.HttpResponseError:""" |
170 | | - |
171 | | - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) |
172 | | - _params = kwargs.pop("params", {}) or {} |
173 | | - |
174 | | - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) |
175 | | - cls: ClsType[_models.RadiologyInsightsJob] = kwargs.pop("cls", None) |
176 | | - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) |
177 | | - lro_delay = kwargs.pop( |
178 | | - "polling_interval", self._client._config.polling_interval # pylint: disable=protected-access |
179 | | - ) |
180 | | - cont_token: Optional[str] = kwargs.pop("continuation_token", None) |
181 | | - if cont_token is None: |
182 | | - raw_result = self._client._infer_radiology_insights_initial( # pylint: disable=protected-access |
183 | | - id=id, |
184 | | - resource=resource, |
185 | | - expand=expand, |
186 | | - content_type=content_type, |
187 | | - cls=lambda x, y, z: x, |
188 | | - headers=_headers, |
189 | | - params=_params, |
190 | | - **kwargs |
191 | | - ) |
192 | | - raw_result.http_response.read() # type: ignore |
193 | | - kwargs.pop("error_map", None) |
194 | | - |
195 | | - def get_long_running_output(pipeline_response): |
196 | | - response_headers = {} |
197 | | - response = pipeline_response.http_response |
198 | | - response_headers["x-ms-request-id"] = self._client._deserialize( # pylint: disable=protected-access |
199 | | - "str", response.headers.get("x-ms-request-id") |
200 | | - ) |
201 | | - response_headers["Operation-Location"] = self._client._deserialize( # pylint: disable=protected-access |
202 | | - "str", response.headers.get("Operation-Location") |
203 | | - ) |
204 | | - deserialized = _deserialize(_models.RadiologyInsightsInferenceResult, response.json().get("result")) |
205 | | - if cls: |
206 | | - return cls(pipeline_response, deserialized, response_headers) # type: ignore |
207 | | - return deserialized |
208 | | - |
209 | | - path_format_arguments = { |
210 | | - "endpoint": self._client._serialize.url( # pylint: disable=protected-access |
211 | | - "self._client._config.endpoint", self._client._config.endpoint, "str", skip_quote=True |
212 | | - ), |
213 | | - } |
214 | | - |
215 | | - if polling is True: |
216 | | - polling_method: PollingMethod = cast( |
217 | | - PollingMethod, LROBasePolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) |
218 | | - ) |
219 | | - elif polling is False: |
220 | | - polling_method = cast(PollingMethod, NoPolling()) |
221 | | - else: |
222 | | - polling_method = polling |
223 | | - if cont_token: |
224 | | - return LROPoller[_models.RadiologyInsightsInferenceResult].from_continuation_token( |
225 | | - polling_method=polling_method, |
226 | | - continuation_token=cont_token, |
227 | | - client=self._client._client, # pylint: disable=protected-access |
228 | | - deserialization_callback=get_long_running_output, |
229 | | - ) |
230 | | - return LROPoller[_models.RadiologyInsightsInferenceResult]( |
231 | | - self._client._client, raw_result, get_long_running_output, polling_method # type: ignore # pylint: disable=protected-access |
232 | | - ) |
233 | | - |
234 | | - def send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: Any) -> HttpResponse: |
235 | | - """Runs the network request through the client's chained policies. |
236 | | -
|
237 | | - >>> from azure.core.rest import HttpRequest |
238 | | - >>> request = HttpRequest("GET", "https://www.example.org/") |
239 | | - <HttpRequest [GET], url: 'https://www.example.org/'> |
240 | | - >>> response = client.send_request(request) |
241 | | - <HttpResponse: 200 OK> |
242 | | -
|
243 | | - For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request |
244 | | -
|
245 | | - :param request: The network request you want to make. Required. |
246 | | - :type request: ~azure.core.rest.HttpRequest |
247 | | - :keyword bool stream: Whether the response payload will be streamed. Defaults to False. |
248 | | - :return: The response of your network call. Does not do error handling on your response. |
249 | | - :rtype: ~azure.core.rest.HttpResponse |
250 | | - """ |
251 | | - |
252 | | - return self._client.send_request(request, stream=stream, **kwargs) # type: ignore |
253 | | - |
254 | | - def close(self) -> None: |
255 | | - self._client.close() |
256 | | - |
257 | | - def __enter__(self) -> "RadiologyInsightsClient": |
258 | | - self._client.__enter__() |
259 | | - return self |
260 | | - |
261 | | - def __exit__(self, *exc_details: Any) -> None: |
262 | | - self._client.__exit__(*exc_details) |
263 | | - |
264 | | - |
265 | | -__all__: List[str] = [ |
266 | | - "RadiologyInsightsClient" |
267 | | -] # Add all objects you want publicly available to users at this package level # pylint: disable=line-too-long |
| 11 | +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level |
268 | 12 |
|
269 | 13 |
|
270 | 14 | def patch_sdk(): |
|
0 commit comments