diff --git a/README.md b/README.md index 69a6ee4..ea4d0a3 100644 --- a/README.md +++ b/README.md @@ -36,7 +36,7 @@ client.actions.run( ## Async Client -The SDK also exports an `async` client so that you can make non-blocking calls to our API. +The SDK also exports an `async` client so that you can make non-blocking calls to our API. Note that if you are constructing an Async httpx client class to pass into this client, use `httpx.AsyncClient()` instead of `httpx.Client()` (e.g. for the `httpx_client` parameter of this client). ```python import asyncio @@ -89,7 +89,14 @@ client = Pipedream( client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET", ) -response = client.apps.list() +response = client.apps.list( + after="after", + before="before", + limit=1, + q="q", + sort_key="name", + sort_direction="asc", +) for item in response: yield item # alternatively, you can paginate page-by-page diff --git a/pyproject.toml b/pyproject.toml index 121e3b7..69392a3 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -3,7 +3,7 @@ name = "pipedream" [tool.poetry] name = "pipedream" -version = "1.0.8" +version = "1.0.9" description = "" readme = "README.md" authors = [] diff --git a/src/pipedream/accounts/client.py b/src/pipedream/accounts/client.py index 854b919..84f3fdf 100644 --- a/src/pipedream/accounts/client.py +++ b/src/pipedream/accounts/client.py @@ -30,12 +30,12 @@ def with_raw_response(self) -> RawAccountsClient: def list( self, *, - app_id: typing.Optional[str] = None, external_user_id: typing.Optional[str] = None, oauth_app_id: typing.Optional[str] = None, after: typing.Optional[str] = None, before: typing.Optional[str] = None, limit: typing.Optional[int] = None, + app: typing.Optional[str] = None, include_credentials: typing.Optional[bool] = None, request_options: typing.Optional[RequestOptions] = None, ) -> SyncPager[Account]: @@ -44,9 +44,6 @@ def list( Parameters ---------- - app_id : typing.Optional[str] - The app slug or ID to filter accounts by. - external_user_id : typing.Optional[str] oauth_app_id : typing.Optional[str] @@ -61,6 +58,9 @@ def list( limit : typing.Optional[int] The maximum number of results to return + app : typing.Optional[str] + The app slug or ID to filter accounts by. + include_credentials : typing.Optional[bool] Whether to retrieve the account's credentials or not @@ -82,7 +82,15 @@ def list( client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET", ) - response = client.accounts.list() + response = client.accounts.list( + external_user_id="external_user_id", + oauth_app_id="oauth_app_id", + after="after", + before="before", + limit=1, + app="app", + include_credentials=True, + ) for item in response: yield item # alternatively, you can paginate page-by-page @@ -90,12 +98,12 @@ def list( yield page """ return self._raw_client.list( - app_id=app_id, external_user_id=external_user_id, oauth_app_id=oauth_app_id, after=after, before=before, limit=limit, + app=app, include_credentials=include_credentials, request_options=request_options, ) @@ -106,7 +114,6 @@ def create( app_slug: str, cfmap_json: str, connect_token: str, - app_id: typing.Optional[str] = None, external_user_id: typing.Optional[str] = None, oauth_app_id: typing.Optional[str] = None, name: typing.Optional[str] = OMIT, @@ -126,9 +133,6 @@ def create( connect_token : str The connect token for authentication - app_id : typing.Optional[str] - The app slug or ID to filter accounts by. - external_user_id : typing.Optional[str] oauth_app_id : typing.Optional[str] @@ -156,6 +160,8 @@ def create( client_secret="YOUR_CLIENT_SECRET", ) client.accounts.create( + external_user_id="external_user_id", + oauth_app_id="oauth_app_id", app_slug="app_slug", cfmap_json="cfmap_json", connect_token="connect_token", @@ -165,7 +171,6 @@ def create( app_slug=app_slug, cfmap_json=cfmap_json, connect_token=connect_token, - app_id=app_id, external_user_id=external_user_id, oauth_app_id=oauth_app_id, name=name, @@ -210,6 +215,7 @@ def retrieve( ) client.accounts.retrieve( account_id="account_id", + include_credentials=True, ) """ _response = self._raw_client.retrieve( @@ -300,12 +306,12 @@ def with_raw_response(self) -> AsyncRawAccountsClient: async def list( self, *, - app_id: typing.Optional[str] = None, external_user_id: typing.Optional[str] = None, oauth_app_id: typing.Optional[str] = None, after: typing.Optional[str] = None, before: typing.Optional[str] = None, limit: typing.Optional[int] = None, + app: typing.Optional[str] = None, include_credentials: typing.Optional[bool] = None, request_options: typing.Optional[RequestOptions] = None, ) -> AsyncPager[Account]: @@ -314,9 +320,6 @@ async def list( Parameters ---------- - app_id : typing.Optional[str] - The app slug or ID to filter accounts by. - external_user_id : typing.Optional[str] oauth_app_id : typing.Optional[str] @@ -331,6 +334,9 @@ async def list( limit : typing.Optional[int] The maximum number of results to return + app : typing.Optional[str] + The app slug or ID to filter accounts by. + include_credentials : typing.Optional[bool] Whether to retrieve the account's credentials or not @@ -357,7 +363,15 @@ async def list( async def main() -> None: - response = await client.accounts.list() + response = await client.accounts.list( + external_user_id="external_user_id", + oauth_app_id="oauth_app_id", + after="after", + before="before", + limit=1, + app="app", + include_credentials=True, + ) async for item in response: yield item @@ -369,12 +383,12 @@ async def main() -> None: asyncio.run(main()) """ return await self._raw_client.list( - app_id=app_id, external_user_id=external_user_id, oauth_app_id=oauth_app_id, after=after, before=before, limit=limit, + app=app, include_credentials=include_credentials, request_options=request_options, ) @@ -385,7 +399,6 @@ async def create( app_slug: str, cfmap_json: str, connect_token: str, - app_id: typing.Optional[str] = None, external_user_id: typing.Optional[str] = None, oauth_app_id: typing.Optional[str] = None, name: typing.Optional[str] = OMIT, @@ -405,9 +418,6 @@ async def create( connect_token : str The connect token for authentication - app_id : typing.Optional[str] - The app slug or ID to filter accounts by. - external_user_id : typing.Optional[str] oauth_app_id : typing.Optional[str] @@ -440,6 +450,8 @@ async def create( async def main() -> None: await client.accounts.create( + external_user_id="external_user_id", + oauth_app_id="oauth_app_id", app_slug="app_slug", cfmap_json="cfmap_json", connect_token="connect_token", @@ -452,7 +464,6 @@ async def main() -> None: app_slug=app_slug, cfmap_json=cfmap_json, connect_token=connect_token, - app_id=app_id, external_user_id=external_user_id, oauth_app_id=oauth_app_id, name=name, @@ -502,6 +513,7 @@ async def retrieve( async def main() -> None: await client.accounts.retrieve( account_id="account_id", + include_credentials=True, ) diff --git a/src/pipedream/accounts/raw_client.py b/src/pipedream/accounts/raw_client.py index 7fffbeb..ac44791 100644 --- a/src/pipedream/accounts/raw_client.py +++ b/src/pipedream/accounts/raw_client.py @@ -25,12 +25,12 @@ def __init__(self, *, client_wrapper: SyncClientWrapper): def list( self, *, - app_id: typing.Optional[str] = None, external_user_id: typing.Optional[str] = None, oauth_app_id: typing.Optional[str] = None, after: typing.Optional[str] = None, before: typing.Optional[str] = None, limit: typing.Optional[int] = None, + app: typing.Optional[str] = None, include_credentials: typing.Optional[bool] = None, request_options: typing.Optional[RequestOptions] = None, ) -> SyncPager[Account]: @@ -39,9 +39,6 @@ def list( Parameters ---------- - app_id : typing.Optional[str] - The app slug or ID to filter accounts by. - external_user_id : typing.Optional[str] oauth_app_id : typing.Optional[str] @@ -56,6 +53,9 @@ def list( limit : typing.Optional[int] The maximum number of results to return + app : typing.Optional[str] + The app slug or ID to filter accounts by. + include_credentials : typing.Optional[bool] Whether to retrieve the account's credentials or not @@ -71,12 +71,12 @@ def list( f"v1/connect/{jsonable_encoder(self._client_wrapper._project_id)}/accounts", method="GET", params={ - "app_id": app_id, "external_user_id": external_user_id, "oauth_app_id": oauth_app_id, "after": after, "before": before, "limit": limit, + "app": app, "include_credentials": include_credentials, }, request_options=request_options, @@ -97,12 +97,12 @@ def list( _parsed_next = _parsed_response.page_info.end_cursor _has_next = _parsed_next is not None and _parsed_next != "" _get_next = lambda: self.list( - app_id=app_id, external_user_id=external_user_id, oauth_app_id=oauth_app_id, after=_parsed_next, before=before, limit=limit, + app=app, include_credentials=include_credentials, request_options=request_options, ) @@ -131,7 +131,6 @@ def create( app_slug: str, cfmap_json: str, connect_token: str, - app_id: typing.Optional[str] = None, external_user_id: typing.Optional[str] = None, oauth_app_id: typing.Optional[str] = None, name: typing.Optional[str] = OMIT, @@ -151,9 +150,6 @@ def create( connect_token : str The connect token for authentication - app_id : typing.Optional[str] - The app slug or ID to filter accounts by. - external_user_id : typing.Optional[str] oauth_app_id : typing.Optional[str] @@ -174,7 +170,6 @@ def create( f"v1/connect/{jsonable_encoder(self._client_wrapper._project_id)}/accounts", method="POST", params={ - "app_id": app_id, "external_user_id": external_user_id, "oauth_app_id": oauth_app_id, }, @@ -363,12 +358,12 @@ def __init__(self, *, client_wrapper: AsyncClientWrapper): async def list( self, *, - app_id: typing.Optional[str] = None, external_user_id: typing.Optional[str] = None, oauth_app_id: typing.Optional[str] = None, after: typing.Optional[str] = None, before: typing.Optional[str] = None, limit: typing.Optional[int] = None, + app: typing.Optional[str] = None, include_credentials: typing.Optional[bool] = None, request_options: typing.Optional[RequestOptions] = None, ) -> AsyncPager[Account]: @@ -377,9 +372,6 @@ async def list( Parameters ---------- - app_id : typing.Optional[str] - The app slug or ID to filter accounts by. - external_user_id : typing.Optional[str] oauth_app_id : typing.Optional[str] @@ -394,6 +386,9 @@ async def list( limit : typing.Optional[int] The maximum number of results to return + app : typing.Optional[str] + The app slug or ID to filter accounts by. + include_credentials : typing.Optional[bool] Whether to retrieve the account's credentials or not @@ -409,12 +404,12 @@ async def list( f"v1/connect/{jsonable_encoder(self._client_wrapper._project_id)}/accounts", method="GET", params={ - "app_id": app_id, "external_user_id": external_user_id, "oauth_app_id": oauth_app_id, "after": after, "before": before, "limit": limit, + "app": app, "include_credentials": include_credentials, }, request_options=request_options, @@ -437,12 +432,12 @@ async def list( async def _get_next(): return await self.list( - app_id=app_id, external_user_id=external_user_id, oauth_app_id=oauth_app_id, after=_parsed_next, before=before, limit=limit, + app=app, include_credentials=include_credentials, request_options=request_options, ) @@ -472,7 +467,6 @@ async def create( app_slug: str, cfmap_json: str, connect_token: str, - app_id: typing.Optional[str] = None, external_user_id: typing.Optional[str] = None, oauth_app_id: typing.Optional[str] = None, name: typing.Optional[str] = OMIT, @@ -492,9 +486,6 @@ async def create( connect_token : str The connect token for authentication - app_id : typing.Optional[str] - The app slug or ID to filter accounts by. - external_user_id : typing.Optional[str] oauth_app_id : typing.Optional[str] @@ -515,7 +506,6 @@ async def create( f"v1/connect/{jsonable_encoder(self._client_wrapper._project_id)}/accounts", method="POST", params={ - "app_id": app_id, "external_user_id": external_user_id, "oauth_app_id": oauth_app_id, }, diff --git a/src/pipedream/actions/client.py b/src/pipedream/actions/client.py index a7a44f6..17efbe0 100644 --- a/src/pipedream/actions/client.py +++ b/src/pipedream/actions/client.py @@ -80,7 +80,13 @@ def list( client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET", ) - response = client.actions.list() + response = client.actions.list( + after="after", + before="before", + limit=1, + q="q", + app="app", + ) for item in response: yield item # alternatively, you can paginate page-by-page @@ -400,7 +406,13 @@ async def list( async def main() -> None: - response = await client.actions.list() + response = await client.actions.list( + after="after", + before="before", + limit=1, + q="q", + app="app", + ) async for item in response: yield item diff --git a/src/pipedream/apps/__init__.py b/src/pipedream/apps/__init__.py index 28a82cb..3a7655e 100644 --- a/src/pipedream/apps/__init__.py +++ b/src/pipedream/apps/__init__.py @@ -16,8 +16,10 @@ def __getattr__(attr_name: str) -> typing.Any: raise AttributeError(f"No {attr_name} found in _dynamic_imports for module name -> {__name__}") try: module = import_module(module_name, __package__) - result = getattr(module, attr_name) - return result + if module_name == f".{attr_name}": + return module + else: + return getattr(module, attr_name) except ImportError as e: raise ImportError(f"Failed to import {attr_name} from {module_name}: {e}") from e except AttributeError as e: diff --git a/src/pipedream/apps/client.py b/src/pipedream/apps/client.py index 5d44a36..512d8df 100644 --- a/src/pipedream/apps/client.py +++ b/src/pipedream/apps/client.py @@ -83,7 +83,14 @@ def list( client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET", ) - response = client.apps.list() + response = client.apps.list( + after="after", + before="before", + limit=1, + q="q", + sort_key="name", + sort_direction="asc", + ) for item in response: yield item # alternatively, you can paginate page-by-page @@ -212,7 +219,14 @@ async def list( async def main() -> None: - response = await client.apps.list() + response = await client.apps.list( + after="after", + before="before", + limit=1, + q="q", + sort_key="name", + sort_direction="asc", + ) async for item in response: yield item diff --git a/src/pipedream/apps/types/__init__.py b/src/pipedream/apps/types/__init__.py index a6c7583..08c3a02 100644 --- a/src/pipedream/apps/types/__init__.py +++ b/src/pipedream/apps/types/__init__.py @@ -20,8 +20,10 @@ def __getattr__(attr_name: str) -> typing.Any: raise AttributeError(f"No {attr_name} found in _dynamic_imports for module name -> {__name__}") try: module = import_module(module_name, __package__) - result = getattr(module, attr_name) - return result + if module_name == f".{attr_name}": + return module + else: + return getattr(module, attr_name) except ImportError as e: raise ImportError(f"Failed to import {attr_name} from {module_name}: {e}") from e except AttributeError as e: diff --git a/src/pipedream/client.py b/src/pipedream/client.py index 6f4accc..cfb7782 100644 --- a/src/pipedream/client.py +++ b/src/pipedream/client.py @@ -6,7 +6,7 @@ import typing import httpx -from .types.project_environment import ProjectEnvironment +from ._.types.project_environment import ProjectEnvironment from .core.api_error import ApiError from .core.client_wrapper import AsyncClientWrapper, SyncClientWrapper from .core.oauth_token_provider import OAuthTokenProvider diff --git a/src/pipedream/components/client.py b/src/pipedream/components/client.py index cb6a9c5..1fe5af7 100644 --- a/src/pipedream/components/client.py +++ b/src/pipedream/components/client.py @@ -83,7 +83,14 @@ def list( client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET", ) - response = client.components.list() + response = client.components.list( + after="after", + before="before", + limit=1, + q="q", + app="app", + component_type="trigger", + ) for item in response: yield item # alternatively, you can paginate page-by-page @@ -352,7 +359,14 @@ async def list( async def main() -> None: - response = await client.components.list() + response = await client.components.list( + after="after", + before="before", + limit=1, + q="q", + app="app", + component_type="trigger", + ) async for item in response: yield item diff --git a/src/pipedream/core/__init__.py b/src/pipedream/core/__init__.py index f20f6b0..bfce76d 100644 --- a/src/pipedream/core/__init__.py +++ b/src/pipedream/core/__init__.py @@ -64,8 +64,10 @@ def __getattr__(attr_name: str) -> typing.Any: raise AttributeError(f"No {attr_name} found in _dynamic_imports for module name -> {__name__}") try: module = import_module(module_name, __package__) - result = getattr(module, attr_name) - return result + if module_name == f".{attr_name}": + return module + else: + return getattr(module, attr_name) except ImportError as e: raise ImportError(f"Failed to import {attr_name} from {module_name}: {e}") from e except AttributeError as e: diff --git a/src/pipedream/core/client_wrapper.py b/src/pipedream/core/client_wrapper.py index 72d55cd..554e659 100644 --- a/src/pipedream/core/client_wrapper.py +++ b/src/pipedream/core/client_wrapper.py @@ -3,7 +3,7 @@ import typing import httpx -from ..types.project_environment import ProjectEnvironment +from .._.types.project_environment import ProjectEnvironment from .http_client import AsyncHttpClient, HttpClient @@ -27,10 +27,10 @@ def __init__( def get_headers(self) -> typing.Dict[str, str]: headers: typing.Dict[str, str] = { - "User-Agent": "pipedream/1.0.8", + "User-Agent": "pipedream/1.0.9", "X-Fern-Language": "Python", "X-Fern-SDK-Name": "pipedream", - "X-Fern-SDK-Version": "1.0.8", + "X-Fern-SDK-Version": "1.0.9", **(self.get_custom_headers() or {}), } if self._project_environment is not None: diff --git a/src/pipedream/deployed_triggers/client.py b/src/pipedream/deployed_triggers/client.py index 9493eef..8980f5a 100644 --- a/src/pipedream/deployed_triggers/client.py +++ b/src/pipedream/deployed_triggers/client.py @@ -76,6 +76,9 @@ def list( client_secret="YOUR_CLIENT_SECRET", ) response = client.deployed_triggers.list( + after="after", + before="before", + limit=1, external_user_id="external_user_id", ) for item in response: @@ -231,6 +234,7 @@ def delete( client.deployed_triggers.delete( trigger_id="trigger_id", external_user_id="external_user_id", + ignore_hook_errors=True, ) """ _response = self._raw_client.delete( @@ -283,6 +287,7 @@ def list_events( client.deployed_triggers.list_events( trigger_id="trigger_id", external_user_id="external_user_id", + n=1, ) """ _response = self._raw_client.list_events( @@ -538,6 +543,9 @@ async def list( async def main() -> None: response = await client.deployed_triggers.list( + after="after", + before="before", + limit=1, external_user_id="external_user_id", ) async for item in response: @@ -718,6 +726,7 @@ async def main() -> None: await client.deployed_triggers.delete( trigger_id="trigger_id", external_user_id="external_user_id", + ignore_hook_errors=True, ) @@ -778,6 +787,7 @@ async def main() -> None: await client.deployed_triggers.list_events( trigger_id="trigger_id", external_user_id="external_user_id", + n=1, ) diff --git a/src/pipedream/errors/__init__.py b/src/pipedream/errors/__init__.py index 32ca4d5..a6d06ac 100644 --- a/src/pipedream/errors/__init__.py +++ b/src/pipedream/errors/__init__.py @@ -16,8 +16,10 @@ def __getattr__(attr_name: str) -> typing.Any: raise AttributeError(f"No {attr_name} found in _dynamic_imports for module name -> {__name__}") try: module = import_module(module_name, __package__) - result = getattr(module, attr_name) - return result + if module_name == f".{attr_name}": + return module + else: + return getattr(module, attr_name) except ImportError as e: raise ImportError(f"Failed to import {attr_name} from {module_name}: {e}") from e except AttributeError as e: diff --git a/src/pipedream/file_stash/client.py b/src/pipedream/file_stash/client.py index 4c7ca3f..f0469a8 100644 --- a/src/pipedream/file_stash/client.py +++ b/src/pipedream/file_stash/client.py @@ -22,7 +22,9 @@ def with_raw_response(self) -> RawFileStashClient: """ return self._raw_client - def download_file(self, *, s_3_key: str, request_options: typing.Optional[RequestOptions] = None) -> None: + def download_file( + self, *, s_3_key: str, request_options: typing.Optional[RequestOptions] = None + ) -> typing.Iterator[bytes]: """ Download a file from File Stash @@ -31,11 +33,12 @@ def download_file(self, *, s_3_key: str, request_options: typing.Optional[Reques s_3_key : str request_options : typing.Optional[RequestOptions] - Request-specific configuration. + Request-specific configuration. You can pass in configuration such as `chunk_size`, and more to customize the request and response. Returns ------- - None + typing.Iterator[bytes] + file contents Examples -------- @@ -51,8 +54,8 @@ def download_file(self, *, s_3_key: str, request_options: typing.Optional[Reques s_3_key="s3_key", ) """ - _response = self._raw_client.download_file(s_3_key=s_3_key, request_options=request_options) - return _response.data + with self._raw_client.download_file(s_3_key=s_3_key, request_options=request_options) as r: + yield from r.data class AsyncFileStashClient: @@ -70,7 +73,9 @@ def with_raw_response(self) -> AsyncRawFileStashClient: """ return self._raw_client - async def download_file(self, *, s_3_key: str, request_options: typing.Optional[RequestOptions] = None) -> None: + async def download_file( + self, *, s_3_key: str, request_options: typing.Optional[RequestOptions] = None + ) -> typing.AsyncIterator[bytes]: """ Download a file from File Stash @@ -79,11 +84,12 @@ async def download_file(self, *, s_3_key: str, request_options: typing.Optional[ s_3_key : str request_options : typing.Optional[RequestOptions] - Request-specific configuration. + Request-specific configuration. You can pass in configuration such as `chunk_size`, and more to customize the request and response. Returns ------- - None + typing.AsyncIterator[bytes] + file contents Examples -------- @@ -107,5 +113,6 @@ async def main() -> None: asyncio.run(main()) """ - _response = await self._raw_client.download_file(s_3_key=s_3_key, request_options=request_options) - return _response.data + async with self._raw_client.download_file(s_3_key=s_3_key, request_options=request_options) as r: + async for _chunk in r.data: + yield _chunk diff --git a/src/pipedream/file_stash/raw_client.py b/src/pipedream/file_stash/raw_client.py index 17ae805..0a4d576 100644 --- a/src/pipedream/file_stash/raw_client.py +++ b/src/pipedream/file_stash/raw_client.py @@ -1,5 +1,6 @@ # This file was auto-generated by Fern from our API Definition. +import contextlib import typing from json.decoder import JSONDecodeError @@ -16,9 +17,10 @@ class RawFileStashClient: def __init__(self, *, client_wrapper: SyncClientWrapper): self._client_wrapper = client_wrapper + @contextlib.contextmanager def download_file( self, *, s_3_key: str, request_options: typing.Optional[RequestOptions] = None - ) -> HttpResponse[None]: + ) -> typing.Iterator[HttpResponse[typing.Iterator[bytes]]]: """ Download a file from File Stash @@ -27,47 +29,59 @@ def download_file( s_3_key : str request_options : typing.Optional[RequestOptions] - Request-specific configuration. + Request-specific configuration. You can pass in configuration such as `chunk_size`, and more to customize the request and response. Returns ------- - HttpResponse[None] + typing.Iterator[HttpResponse[typing.Iterator[bytes]]] + file contents """ - _response = self._client_wrapper.httpx_client.request( + with self._client_wrapper.httpx_client.stream( f"v1/connect/{jsonable_encoder(self._client_wrapper._project_id)}/file_stash/download", method="GET", params={ "s3_key": s_3_key, }, request_options=request_options, - ) - try: - if 200 <= _response.status_code < 300: - return HttpResponse(response=_response, data=None) - if _response.status_code == 429: - raise TooManyRequestsError( - headers=dict(_response.headers), - body=typing.cast( - typing.Optional[typing.Any], - parse_obj_as( - type_=typing.Optional[typing.Any], # type: ignore - object_=_response.json(), - ), - ), - ) - _response_json = _response.json() - except JSONDecodeError: - raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) - raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + ) as _response: + + def _stream() -> HttpResponse[typing.Iterator[bytes]]: + try: + if 200 <= _response.status_code < 300: + _chunk_size = request_options.get("chunk_size", None) if request_options is not None else None + return HttpResponse( + response=_response, data=(_chunk for _chunk in _response.iter_bytes(chunk_size=_chunk_size)) + ) + _response.read() + if _response.status_code == 429: + raise TooManyRequestsError( + headers=dict(_response.headers), + body=typing.cast( + typing.Optional[typing.Any], + parse_obj_as( + type_=typing.Optional[typing.Any], # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.text + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + yield _stream() class AsyncRawFileStashClient: def __init__(self, *, client_wrapper: AsyncClientWrapper): self._client_wrapper = client_wrapper + @contextlib.asynccontextmanager async def download_file( self, *, s_3_key: str, request_options: typing.Optional[RequestOptions] = None - ) -> AsyncHttpResponse[None]: + ) -> typing.AsyncIterator[AsyncHttpResponse[typing.AsyncIterator[bytes]]]: """ Download a file from File Stash @@ -76,35 +90,47 @@ async def download_file( s_3_key : str request_options : typing.Optional[RequestOptions] - Request-specific configuration. + Request-specific configuration. You can pass in configuration such as `chunk_size`, and more to customize the request and response. Returns ------- - AsyncHttpResponse[None] + typing.AsyncIterator[AsyncHttpResponse[typing.AsyncIterator[bytes]]] + file contents """ - _response = await self._client_wrapper.httpx_client.request( + async with self._client_wrapper.httpx_client.stream( f"v1/connect/{jsonable_encoder(self._client_wrapper._project_id)}/file_stash/download", method="GET", params={ "s3_key": s_3_key, }, request_options=request_options, - ) - try: - if 200 <= _response.status_code < 300: - return AsyncHttpResponse(response=_response, data=None) - if _response.status_code == 429: - raise TooManyRequestsError( - headers=dict(_response.headers), - body=typing.cast( - typing.Optional[typing.Any], - parse_obj_as( - type_=typing.Optional[typing.Any], # type: ignore - object_=_response.json(), - ), - ), - ) - _response_json = _response.json() - except JSONDecodeError: - raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) - raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + ) as _response: + + async def _stream() -> AsyncHttpResponse[typing.AsyncIterator[bytes]]: + try: + if 200 <= _response.status_code < 300: + _chunk_size = request_options.get("chunk_size", None) if request_options is not None else None + return AsyncHttpResponse( + response=_response, + data=(_chunk async for _chunk in _response.aiter_bytes(chunk_size=_chunk_size)), + ) + await _response.aread() + if _response.status_code == 429: + raise TooManyRequestsError( + headers=dict(_response.headers), + body=typing.cast( + typing.Optional[typing.Any], + parse_obj_as( + type_=typing.Optional[typing.Any], # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.text + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + yield await _stream() diff --git a/src/pipedream/tokens/client.py b/src/pipedream/tokens/client.py index cbe1c64..f37eccf 100644 --- a/src/pipedream/tokens/client.py +++ b/src/pipedream/tokens/client.py @@ -132,6 +132,7 @@ def validate( client.tokens.validate( ctok="ctok", app_id="app_id", + oauth_app_id="oauth_app_id", ) """ _response = self._raw_client.validate( @@ -272,6 +273,7 @@ async def main() -> None: await client.tokens.validate( ctok="ctok", app_id="app_id", + oauth_app_id="oauth_app_id", ) diff --git a/src/pipedream/triggers/client.py b/src/pipedream/triggers/client.py index 32bf25d..faf4a2a 100644 --- a/src/pipedream/triggers/client.py +++ b/src/pipedream/triggers/client.py @@ -8,7 +8,7 @@ from ..types.component import Component from ..types.configure_prop_response import ConfigurePropResponse from ..types.configured_props import ConfiguredProps -from ..types.deployed_component import DeployedComponent +from ..types.deploy_trigger_response_data import DeployTriggerResponseData from ..types.reload_props_response import ReloadPropsResponse from .raw_client import AsyncRawTriggersClient, RawTriggersClient @@ -79,7 +79,13 @@ def list( client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET", ) - response = client.triggers.list() + response = client.triggers.list( + after="after", + before="before", + limit=1, + q="q", + app="app", + ) for item in response: yield item # alternatively, you can paginate page-by-page @@ -278,7 +284,7 @@ def deploy( dynamic_props_id: typing.Optional[str] = OMIT, webhook_url: typing.Optional[str] = OMIT, request_options: typing.Optional[RequestOptions] = None, - ) -> DeployedComponent: + ) -> DeployTriggerResponseData: """ Deploy a trigger to listen for and emit events @@ -303,7 +309,7 @@ def deploy( Returns ------- - DeployedComponent + DeployTriggerResponseData trigger deployed Examples @@ -400,7 +406,13 @@ async def list( async def main() -> None: - response = await client.triggers.list() + response = await client.triggers.list( + after="after", + before="before", + limit=1, + q="q", + app="app", + ) async for item in response: yield item @@ -629,7 +641,7 @@ async def deploy( dynamic_props_id: typing.Optional[str] = OMIT, webhook_url: typing.Optional[str] = OMIT, request_options: typing.Optional[RequestOptions] = None, - ) -> DeployedComponent: + ) -> DeployTriggerResponseData: """ Deploy a trigger to listen for and emit events @@ -654,7 +666,7 @@ async def deploy( Returns ------- - DeployedComponent + DeployTriggerResponseData trigger deployed Examples diff --git a/src/pipedream/triggers/raw_client.py b/src/pipedream/triggers/raw_client.py index faf7bee..abeb4de 100644 --- a/src/pipedream/triggers/raw_client.py +++ b/src/pipedream/triggers/raw_client.py @@ -16,7 +16,7 @@ from ..types.configure_prop_response import ConfigurePropResponse from ..types.configured_props import ConfiguredProps from ..types.deploy_trigger_response import DeployTriggerResponse -from ..types.deployed_component import DeployedComponent +from ..types.deploy_trigger_response_data import DeployTriggerResponseData from ..types.get_component_response import GetComponentResponse from ..types.get_components_response import GetComponentsResponse from ..types.reload_props_response import ReloadPropsResponse @@ -363,7 +363,7 @@ def deploy( dynamic_props_id: typing.Optional[str] = OMIT, webhook_url: typing.Optional[str] = OMIT, request_options: typing.Optional[RequestOptions] = None, - ) -> HttpResponse[DeployedComponent]: + ) -> HttpResponse[DeployTriggerResponseData]: """ Deploy a trigger to listen for and emit events @@ -388,7 +388,7 @@ def deploy( Returns ------- - HttpResponse[DeployedComponent] + HttpResponse[DeployTriggerResponseData] trigger deployed """ _response = self._client_wrapper.httpx_client.request( @@ -778,7 +778,7 @@ async def deploy( dynamic_props_id: typing.Optional[str] = OMIT, webhook_url: typing.Optional[str] = OMIT, request_options: typing.Optional[RequestOptions] = None, - ) -> AsyncHttpResponse[DeployedComponent]: + ) -> AsyncHttpResponse[DeployTriggerResponseData]: """ Deploy a trigger to listen for and emit events @@ -803,7 +803,7 @@ async def deploy( Returns ------- - AsyncHttpResponse[DeployedComponent] + AsyncHttpResponse[DeployTriggerResponseData] trigger deployed """ _response = await self._client_wrapper.httpx_client.request( diff --git a/src/pipedream/types/__init__.py b/src/pipedream/types/__init__.py index 535fbf0..f2d56e7 100644 --- a/src/pipedream/types/__init__.py +++ b/src/pipedream/types/__init__.py @@ -24,9 +24,11 @@ from .configurable_prop_alert import ConfigurablePropAlert from .configurable_prop_alert_type import ConfigurablePropAlertType from .configurable_prop_any import ConfigurablePropAny + from .configurable_prop_any_options_item import ConfigurablePropAnyOptionsItem from .configurable_prop_app import ConfigurablePropApp from .configurable_prop_apphook import ConfigurablePropApphook from .configurable_prop_boolean import ConfigurablePropBoolean + from .configurable_prop_boolean_options_item import ConfigurablePropBooleanOptionsItem from .configurable_prop_db import ConfigurablePropDb from .configurable_prop_discord import ConfigurablePropDiscord from .configurable_prop_discord_channel import ConfigurablePropDiscordChannel @@ -34,6 +36,7 @@ from .configurable_prop_http import ConfigurablePropHttp from .configurable_prop_integer import ConfigurablePropInteger from .configurable_prop_integer_array import ConfigurablePropIntegerArray + from .configurable_prop_integer_options_item import ConfigurablePropIntegerOptionsItem from .configurable_prop_object import ConfigurablePropObject from .configurable_prop_sql import ConfigurablePropSql from .configurable_prop_sql_auth import ConfigurablePropSqlAuth @@ -63,6 +66,7 @@ from .create_token_response import CreateTokenResponse from .delete_trigger_opts import DeleteTriggerOpts from .deploy_trigger_response import DeployTriggerResponse + from .deploy_trigger_response_data import DeployTriggerResponseData from .deployed_component import DeployedComponent from .dynamic_props import DynamicProps from .emitted_event import EmittedEvent @@ -78,6 +82,7 @@ from .get_trigger_webhooks_response import GetTriggerWebhooksResponse from .get_trigger_workflows_response import GetTriggerWorkflowsResponse from .get_triggers_response import GetTriggersResponse + from .http_interface import HttpInterface from .list_accounts_response import ListAccountsResponse from .list_app_categories_response import ListAppCategoriesResponse from .list_apps_response import ListAppsResponse @@ -98,8 +103,10 @@ from .start_connect_opts import StartConnectOpts from .stash_id import StashId from .timer_cron import TimerCron + from .timer_interface import TimerInterface from .timer_interval import TimerInterval from .too_many_requests_error_body import TooManyRequestsErrorBody + from .tool_annotations import ToolAnnotations from .validate_token_response import ValidateTokenResponse _dynamic_imports: typing.Dict[str, str] = { "Account": ".account", @@ -120,9 +127,11 @@ "ConfigurablePropAlert": ".configurable_prop_alert", "ConfigurablePropAlertType": ".configurable_prop_alert_type", "ConfigurablePropAny": ".configurable_prop_any", + "ConfigurablePropAnyOptionsItem": ".configurable_prop_any_options_item", "ConfigurablePropApp": ".configurable_prop_app", "ConfigurablePropApphook": ".configurable_prop_apphook", "ConfigurablePropBoolean": ".configurable_prop_boolean", + "ConfigurablePropBooleanOptionsItem": ".configurable_prop_boolean_options_item", "ConfigurablePropDb": ".configurable_prop_db", "ConfigurablePropDiscord": ".configurable_prop_discord", "ConfigurablePropDiscordChannel": ".configurable_prop_discord_channel", @@ -130,6 +139,7 @@ "ConfigurablePropHttp": ".configurable_prop_http", "ConfigurablePropInteger": ".configurable_prop_integer", "ConfigurablePropIntegerArray": ".configurable_prop_integer_array", + "ConfigurablePropIntegerOptionsItem": ".configurable_prop_integer_options_item", "ConfigurablePropObject": ".configurable_prop_object", "ConfigurablePropSql": ".configurable_prop_sql", "ConfigurablePropSqlAuth": ".configurable_prop_sql_auth", @@ -159,6 +169,7 @@ "CreateTokenResponse": ".create_token_response", "DeleteTriggerOpts": ".delete_trigger_opts", "DeployTriggerResponse": ".deploy_trigger_response", + "DeployTriggerResponseData": ".deploy_trigger_response_data", "DeployedComponent": ".deployed_component", "DynamicProps": ".dynamic_props", "EmittedEvent": ".emitted_event", @@ -174,6 +185,7 @@ "GetTriggerWebhooksResponse": ".get_trigger_webhooks_response", "GetTriggerWorkflowsResponse": ".get_trigger_workflows_response", "GetTriggersResponse": ".get_triggers_response", + "HttpInterface": ".http_interface", "ListAccountsResponse": ".list_accounts_response", "ListAppCategoriesResponse": ".list_app_categories_response", "ListAppsResponse": ".list_apps_response", @@ -194,8 +206,10 @@ "StartConnectOpts": ".start_connect_opts", "StashId": ".stash_id", "TimerCron": ".timer_cron", + "TimerInterface": ".timer_interface", "TimerInterval": ".timer_interval", "TooManyRequestsErrorBody": ".too_many_requests_error_body", + "ToolAnnotations": ".tool_annotations", "ValidateTokenResponse": ".validate_token_response", } @@ -206,8 +220,10 @@ def __getattr__(attr_name: str) -> typing.Any: raise AttributeError(f"No {attr_name} found in _dynamic_imports for module name -> {__name__}") try: module = import_module(module_name, __package__) - result = getattr(module, attr_name) - return result + if module_name == f".{attr_name}": + return module + else: + return getattr(module, attr_name) except ImportError as e: raise ImportError(f"Failed to import {attr_name} from {module_name}: {e}") from e except AttributeError as e: @@ -238,9 +254,11 @@ def __dir__(): "ConfigurablePropAlert", "ConfigurablePropAlertType", "ConfigurablePropAny", + "ConfigurablePropAnyOptionsItem", "ConfigurablePropApp", "ConfigurablePropApphook", "ConfigurablePropBoolean", + "ConfigurablePropBooleanOptionsItem", "ConfigurablePropDb", "ConfigurablePropDiscord", "ConfigurablePropDiscordChannel", @@ -248,6 +266,7 @@ def __dir__(): "ConfigurablePropHttp", "ConfigurablePropInteger", "ConfigurablePropIntegerArray", + "ConfigurablePropIntegerOptionsItem", "ConfigurablePropObject", "ConfigurablePropSql", "ConfigurablePropSqlAuth", @@ -277,6 +296,7 @@ def __dir__(): "CreateTokenResponse", "DeleteTriggerOpts", "DeployTriggerResponse", + "DeployTriggerResponseData", "DeployedComponent", "DynamicProps", "EmittedEvent", @@ -292,6 +312,7 @@ def __dir__(): "GetTriggerWebhooksResponse", "GetTriggerWorkflowsResponse", "GetTriggersResponse", + "HttpInterface", "ListAccountsResponse", "ListAppCategoriesResponse", "ListAppsResponse", @@ -312,7 +333,9 @@ def __dir__(): "StartConnectOpts", "StashId", "TimerCron", + "TimerInterface", "TimerInterval", "TooManyRequestsErrorBody", + "ToolAnnotations", "ValidateTokenResponse", ] diff --git a/src/pipedream/types/component.py b/src/pipedream/types/component.py index 5ea1ff2..d707695 100644 --- a/src/pipedream/types/component.py +++ b/src/pipedream/types/component.py @@ -6,6 +6,7 @@ from ..core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel from .component_stash import ComponentStash from .configurable_prop import ConfigurableProp +from .tool_annotations import ToolAnnotations class Component(UniversalBaseModel): @@ -36,6 +37,7 @@ class Component(UniversalBaseModel): """ stash: typing.Optional[ComponentStash] = None + annotations: typing.Optional[ToolAnnotations] = None if IS_PYDANTIC_V2: model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 diff --git a/src/pipedream/types/configurable_prop_any.py b/src/pipedream/types/configurable_prop_any.py index 2b1fe36..dff60a9 100644 --- a/src/pipedream/types/configurable_prop_any.py +++ b/src/pipedream/types/configurable_prop_any.py @@ -6,10 +6,14 @@ import typing_extensions from ..core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel from ..core.serialization import FieldMetadata +from .configurable_prop_any_options_item import ConfigurablePropAnyOptionsItem +from .configured_prop_value_any import ConfiguredPropValueAny class ConfigurablePropAny(UniversalBaseModel): type: typing.Literal["any"] = "any" + default: typing.Optional[ConfiguredPropValueAny] = None + options: typing.Optional[typing.List[ConfigurablePropAnyOptionsItem]] = None name: str = pydantic.Field() """ When building `configuredProps`, make sure to use this field as the key when setting the prop value diff --git a/src/pipedream/types/configurable_prop_any_options_item.py b/src/pipedream/types/configurable_prop_any_options_item.py new file mode 100644 index 0000000..3e523ab --- /dev/null +++ b/src/pipedream/types/configurable_prop_any_options_item.py @@ -0,0 +1,8 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +from .prop_option import PropOption +from .prop_option_nested import PropOptionNested + +ConfigurablePropAnyOptionsItem = typing.Union[PropOption, PropOptionNested] diff --git a/src/pipedream/types/configurable_prop_boolean.py b/src/pipedream/types/configurable_prop_boolean.py index 79c8bc5..649ef51 100644 --- a/src/pipedream/types/configurable_prop_boolean.py +++ b/src/pipedream/types/configurable_prop_boolean.py @@ -6,15 +6,14 @@ import typing_extensions from ..core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel from ..core.serialization import FieldMetadata +from .configurable_prop_boolean_options_item import ConfigurablePropBooleanOptionsItem +from .configured_prop_value_boolean import ConfiguredPropValueBoolean class ConfigurablePropBoolean(UniversalBaseModel): type: typing.Literal["boolean"] = "boolean" - default: typing.Optional[bool] = pydantic.Field(default=None) - """ - The default value for this prop - """ - + default: typing.Optional[ConfiguredPropValueBoolean] = None + options: typing.Optional[typing.List[ConfigurablePropBooleanOptionsItem]] = None name: str = pydantic.Field() """ When building `configuredProps`, make sure to use this field as the key when setting the prop value diff --git a/src/pipedream/types/configurable_prop_boolean_options_item.py b/src/pipedream/types/configurable_prop_boolean_options_item.py new file mode 100644 index 0000000..e323fa8 --- /dev/null +++ b/src/pipedream/types/configurable_prop_boolean_options_item.py @@ -0,0 +1,8 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +from .prop_option import PropOption +from .prop_option_nested import PropOptionNested + +ConfigurablePropBooleanOptionsItem = typing.Union[PropOption, PropOptionNested] diff --git a/src/pipedream/types/configurable_prop_integer.py b/src/pipedream/types/configurable_prop_integer.py index 557a182..a19f6f0 100644 --- a/src/pipedream/types/configurable_prop_integer.py +++ b/src/pipedream/types/configurable_prop_integer.py @@ -6,6 +6,8 @@ import typing_extensions from ..core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel from ..core.serialization import FieldMetadata +from .configurable_prop_integer_options_item import ConfigurablePropIntegerOptionsItem +from .configured_prop_value_integer import ConfiguredPropValueInteger class ConfigurablePropInteger(UniversalBaseModel): @@ -20,12 +22,8 @@ class ConfigurablePropInteger(UniversalBaseModel): The maximum value for this integer prop. """ - default: typing.Optional[int] = pydantic.Field(default=None) - """ - Default integer value - """ - - options: typing.Optional[typing.List[int]] = pydantic.Field(default=None) + default: typing.Optional[ConfiguredPropValueInteger] = None + options: typing.Optional[typing.List[ConfigurablePropIntegerOptionsItem]] = pydantic.Field(default=None) """ Available integer options """ diff --git a/src/pipedream/types/configurable_prop_integer_options_item.py b/src/pipedream/types/configurable_prop_integer_options_item.py new file mode 100644 index 0000000..49547be --- /dev/null +++ b/src/pipedream/types/configurable_prop_integer_options_item.py @@ -0,0 +1,8 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +from .prop_option import PropOption +from .prop_option_nested import PropOptionNested + +ConfigurablePropIntegerOptionsItem = typing.Union[PropOption, PropOptionNested] diff --git a/src/pipedream/types/deploy_trigger_response.py b/src/pipedream/types/deploy_trigger_response.py index bdb7143..3ef2b0b 100644 --- a/src/pipedream/types/deploy_trigger_response.py +++ b/src/pipedream/types/deploy_trigger_response.py @@ -4,7 +4,7 @@ import pydantic from ..core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel -from .deployed_component import DeployedComponent +from .deploy_trigger_response_data import DeployTriggerResponseData class DeployTriggerResponse(UniversalBaseModel): @@ -12,7 +12,7 @@ class DeployTriggerResponse(UniversalBaseModel): Response received after deploying a trigger """ - data: DeployedComponent + data: DeployTriggerResponseData if IS_PYDANTIC_V2: model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 diff --git a/src/pipedream/types/deploy_trigger_response_data.py b/src/pipedream/types/deploy_trigger_response_data.py new file mode 100644 index 0000000..3a175e2 --- /dev/null +++ b/src/pipedream/types/deploy_trigger_response_data.py @@ -0,0 +1,9 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +from .deployed_component import DeployedComponent +from .http_interface import HttpInterface +from .timer_interface import TimerInterface + +DeployTriggerResponseData = typing.Union[DeployedComponent, HttpInterface, TimerInterface] diff --git a/src/pipedream/types/http_interface.py b/src/pipedream/types/http_interface.py new file mode 100644 index 0000000..7c32c5f --- /dev/null +++ b/src/pipedream/types/http_interface.py @@ -0,0 +1,39 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel + + +class HttpInterface(UniversalBaseModel): + """ + An HTTP interface instance + """ + + id: str = pydantic.Field() + """ + The unique ID of the HTTP interface + """ + + key: str + endpoint_url: str + custom_response: bool + created_at: int = pydantic.Field() + """ + The timestamp when the HTTP interface was created (epoch milliseconds) + """ + + updated_at: typing.Optional[int] = pydantic.Field(default=None) + """ + The timestamp when the HTTP interface was last updated (epoch milliseconds) + """ + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/pipedream/types/timer_interface.py b/src/pipedream/types/timer_interface.py new file mode 100644 index 0000000..ee2a0f8 --- /dev/null +++ b/src/pipedream/types/timer_interface.py @@ -0,0 +1,40 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel + + +class TimerInterface(UniversalBaseModel): + """ + A timer interface instance + """ + + id: str = pydantic.Field() + """ + The unique ID of the timer interface + """ + + interval_seconds: typing.Optional[float] = None + cron: typing.Optional[str] = None + timezone: str + schedule_changed_at: int + created_at: int = pydantic.Field() + """ + The timestamp when the timer interface was created (epoch milliseconds) + """ + + updated_at: typing.Optional[int] = pydantic.Field(default=None) + """ + The timestamp when the timer interface was last updated (epoch milliseconds) + """ + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/pipedream/types/tool_annotations.py b/src/pipedream/types/tool_annotations.py new file mode 100644 index 0000000..a66f513 --- /dev/null +++ b/src/pipedream/types/tool_annotations.py @@ -0,0 +1,56 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +import typing_extensions +from ..core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel +from ..core.serialization import FieldMetadata + + +class ToolAnnotations(UniversalBaseModel): + """ + Optional properties describing component behavior + """ + + destructive_hint: typing_extensions.Annotated[typing.Optional[bool], FieldMetadata(alias="destructiveHint")] = ( + pydantic.Field(default=None) + ) + """ + If true, the component may perform destructive updates to its environment. If false, the component performs only additive updates. + """ + + idempotent_hint: typing_extensions.Annotated[typing.Optional[bool], FieldMetadata(alias="idempotentHint")] = ( + pydantic.Field(default=None) + ) + """ + If true, calling the component repeatedly with the same arguments will have no additional effect on the its environment. + """ + + open_world_hint: typing_extensions.Annotated[typing.Optional[bool], FieldMetadata(alias="openWorldHint")] = ( + pydantic.Field(default=None) + ) + """ + If true, this component may interact with an “open world” of external entities. If false, the component's domain of interaction is closed. For example, the world of a web search component is open, whereas that of a memory component is not. + """ + + read_only_hint: typing_extensions.Annotated[typing.Optional[bool], FieldMetadata(alias="readOnlyHint")] = ( + pydantic.Field(default=None) + ) + """ + If true, the component does not modify its environment. + """ + + title: typing.Optional[str] = pydantic.Field(default=None) + """ + A human-readable title for the component. + """ + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow