|
2 | 2 |
|
3 | 3 | from __future__ import annotations |
4 | 4 |
|
5 | | -from typing import Type, cast |
| 5 | +from typing import Any, cast |
6 | 6 |
|
7 | 7 | import httpx |
8 | 8 |
|
@@ -78,16 +78,21 @@ def get( |
78 | 78 | raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") |
79 | 79 | if not operation_id: |
80 | 80 | raise ValueError(f"Expected a non-empty value for `operation_id` but received {operation_id!r}") |
81 | | - return self._get( |
82 | | - f"/accounts/{account_id}/rules/lists/bulk_operations/{operation_id}", |
83 | | - options=make_request_options( |
84 | | - extra_headers=extra_headers, |
85 | | - extra_query=extra_query, |
86 | | - extra_body=extra_body, |
87 | | - timeout=timeout, |
88 | | - post_parser=ResultWrapper[BulkOperationGetResponse]._unwrapper, |
| 81 | + return cast( |
| 82 | + BulkOperationGetResponse, |
| 83 | + self._get( |
| 84 | + f"/accounts/{account_id}/rules/lists/bulk_operations/{operation_id}", |
| 85 | + options=make_request_options( |
| 86 | + extra_headers=extra_headers, |
| 87 | + extra_query=extra_query, |
| 88 | + extra_body=extra_body, |
| 89 | + timeout=timeout, |
| 90 | + post_parser=ResultWrapper[BulkOperationGetResponse]._unwrapper, |
| 91 | + ), |
| 92 | + cast_to=cast( |
| 93 | + Any, ResultWrapper[BulkOperationGetResponse] |
| 94 | + ), # Union types cannot be passed in as arguments in the type system |
89 | 95 | ), |
90 | | - cast_to=cast(Type[BulkOperationGetResponse], ResultWrapper[BulkOperationGetResponse]), |
91 | 96 | ) |
92 | 97 |
|
93 | 98 |
|
@@ -147,16 +152,21 @@ async def get( |
147 | 152 | raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") |
148 | 153 | if not operation_id: |
149 | 154 | raise ValueError(f"Expected a non-empty value for `operation_id` but received {operation_id!r}") |
150 | | - return await self._get( |
151 | | - f"/accounts/{account_id}/rules/lists/bulk_operations/{operation_id}", |
152 | | - options=make_request_options( |
153 | | - extra_headers=extra_headers, |
154 | | - extra_query=extra_query, |
155 | | - extra_body=extra_body, |
156 | | - timeout=timeout, |
157 | | - post_parser=ResultWrapper[BulkOperationGetResponse]._unwrapper, |
| 155 | + return cast( |
| 156 | + BulkOperationGetResponse, |
| 157 | + await self._get( |
| 158 | + f"/accounts/{account_id}/rules/lists/bulk_operations/{operation_id}", |
| 159 | + options=make_request_options( |
| 160 | + extra_headers=extra_headers, |
| 161 | + extra_query=extra_query, |
| 162 | + extra_body=extra_body, |
| 163 | + timeout=timeout, |
| 164 | + post_parser=ResultWrapper[BulkOperationGetResponse]._unwrapper, |
| 165 | + ), |
| 166 | + cast_to=cast( |
| 167 | + Any, ResultWrapper[BulkOperationGetResponse] |
| 168 | + ), # Union types cannot be passed in as arguments in the type system |
158 | 169 | ), |
159 | | - cast_to=cast(Type[BulkOperationGetResponse], ResultWrapper[BulkOperationGetResponse]), |
160 | 170 | ) |
161 | 171 |
|
162 | 172 |
|
|
0 commit comments