| 1 |
|
| 2 |
|
| 3 |
import typing |
| 4 |
|
| 5 |
try: |
| 6 |
from typing import NotRequired |
| 7 |
except ImportError: |
| 8 |
from typing_extensions import NotRequired |
| 9 |
|
| 10 |
|
| 11 |
class RequestOptions(typing.TypedDict, total=False): |
| 12 |
""" |
| 13 |
Additional options for request-specific configuration when calling APIs via the SDK. |
| 14 |
This is used primarily as an optional final parameter for service functions. |
| 15 |
|
| 16 |
Attributes: |
| 17 |
- timeout: float. The number of seconds to await an API call before timing out. |
| 18 |
|
| 19 |
- timeout_in_seconds: int. Deprecated alias for `timeout`; both are in seconds. Prefer `timeout`. |
| 20 |
|
| 21 |
- max_retries: int. The max number of retries to attempt if the API call fails. |
| 22 |
|
| 23 |
- additional_headers: typing.Dict[str, typing.Any]. A dictionary containing additional parameters to spread into the request's header dict |
| 24 |
|
| 25 |
- additional_query_parameters: typing.Dict[str, typing.Any]. A dictionary containing additional parameters to spread into the request's query parameters dict |
| 26 |
|
| 27 |
- additional_body_parameters: typing.Dict[str, typing.Any]. A dictionary containing additional parameters to spread into the request's body parameters dict |
| 28 |
|
| 29 |
- chunk_size: int. The size, in bytes, to process each chunk of data being streamed back within the response. This equates to leveraging `chunk_size` within `requests` or `httpx`, and is only leveraged for file downloads. |
| 30 |
""" |
| 31 |
|
| 32 |
timeout: NotRequired[float] |
| 33 |
timeout_in_seconds: NotRequired[int] |
| 34 |
max_retries: NotRequired[int] |
| 35 |
additional_headers: NotRequired[typing.Dict[str, typing.Any]] |
| 36 |
additional_query_parameters: NotRequired[typing.Dict[str, typing.Any]] |
| 37 |
additional_body_parameters: NotRequired[typing.Dict[str, typing.Any]] |
| 38 |
chunk_size: NotRequired[int] |
| 39 |
stream_reconnection_enabled: NotRequired[bool] |
| 40 |
max_stream_reconnection_attempts: NotRequired[int] |