diff --git a/README.md b/README.md index d2405c2..69a6ee4 100644 --- a/README.md +++ b/README.md @@ -175,7 +175,7 @@ from pipedream import Pipedream client = Pipedream( ..., httpx_client=httpx.Client( - proxies="http://my.test.proxy.example.com", + proxy="http://my.test.proxy.example.com", transport=httpx.HTTPTransport(local_address="0.0.0.0"), ), ) diff --git a/pyproject.toml b/pyproject.toml index 6a115d7..6f60434 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -3,7 +3,7 @@ name = "pipedream" [tool.poetry] name = "pipedream" -version = "1.0.6" +version = "1.0.7" description = "" readme = "README.md" authors = [] diff --git a/src/pipedream/accounts/raw_client.py b/src/pipedream/accounts/raw_client.py index bc012a9..7fffbeb 100644 --- a/src/pipedream/accounts/raw_client.py +++ b/src/pipedream/accounts/raw_client.py @@ -10,6 +10,7 @@ from ..core.pagination import AsyncPager, BaseHttpResponse, SyncPager from ..core.pydantic_utilities import parse_obj_as from ..core.request_options import RequestOptions +from ..errors.too_many_requests_error import TooManyRequestsError from ..types.account import Account from ..types.list_accounts_response import ListAccountsResponse @@ -108,6 +109,17 @@ def list( return SyncPager( has_next=_has_next, items=_items, get_next=_get_next, response=BaseHttpResponse(response=_response) ) + 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) @@ -188,6 +200,17 @@ def create( ), ) return HttpResponse(response=_response, data=_data) + 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) @@ -236,6 +259,17 @@ def retrieve( ), ) return HttpResponse(response=_response, data=_data) + 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) @@ -264,6 +298,17 @@ def delete(self, account_id: str, *, request_options: typing.Optional[RequestOpt 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) @@ -294,6 +339,17 @@ def delete_by_app( 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) @@ -394,6 +450,17 @@ async def _get_next(): return AsyncPager( has_next=_has_next, items=_items, get_next=_get_next, response=BaseHttpResponse(response=_response) ) + 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) @@ -474,6 +541,17 @@ async def create( ), ) return AsyncHttpResponse(response=_response, data=_data) + 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) @@ -522,6 +600,17 @@ async def retrieve( ), ) return AsyncHttpResponse(response=_response, data=_data) + 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) @@ -552,6 +641,17 @@ async def delete( 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) @@ -582,6 +682,17 @@ async def delete_by_app( 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) diff --git a/src/pipedream/actions/client.py b/src/pipedream/actions/client.py index a7a44f6..20db8b9 100644 --- a/src/pipedream/actions/client.py +++ b/src/pipedream/actions/client.py @@ -7,7 +7,6 @@ from ..core.request_options import RequestOptions from ..types.component import Component from ..types.configure_prop_response import ConfigurePropResponse -from ..types.configured_props import ConfiguredProps from ..types.reload_props_response import ReloadPropsResponse from ..types.run_action_opts_stash_id import RunActionOptsStashId from ..types.run_action_response import RunActionResponse @@ -132,7 +131,7 @@ def configure_prop( external_user_id: str, prop_name: str, blocking: typing.Optional[bool] = OMIT, - configured_props: typing.Optional[ConfiguredProps] = OMIT, + configured_props: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = OMIT, dynamic_props_id: typing.Optional[str] = OMIT, page: typing.Optional[float] = OMIT, prev_context: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = OMIT, @@ -156,7 +155,8 @@ def configure_prop( blocking : typing.Optional[bool] Whether this operation should block until completion - configured_props : typing.Optional[ConfiguredProps] + configured_props : typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] + The configured properties for the component dynamic_props_id : typing.Optional[str] The ID for dynamic props @@ -214,7 +214,7 @@ def reload_props( id: str, external_user_id: str, blocking: typing.Optional[bool] = OMIT, - configured_props: typing.Optional[ConfiguredProps] = OMIT, + configured_props: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = OMIT, dynamic_props_id: typing.Optional[str] = OMIT, request_options: typing.Optional[RequestOptions] = None, ) -> ReloadPropsResponse: @@ -232,7 +232,8 @@ def reload_props( blocking : typing.Optional[bool] Whether this operation should block until completion - configured_props : typing.Optional[ConfiguredProps] + configured_props : typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] + The configured properties for the component dynamic_props_id : typing.Optional[str] The ID for dynamic props @@ -275,7 +276,7 @@ def run( *, id: str, external_user_id: str, - configured_props: typing.Optional[ConfiguredProps] = OMIT, + configured_props: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = OMIT, dynamic_props_id: typing.Optional[str] = OMIT, stash_id: typing.Optional[RunActionOptsStashId] = OMIT, request_options: typing.Optional[RequestOptions] = None, @@ -291,7 +292,8 @@ def run( external_user_id : str The external user ID - configured_props : typing.Optional[ConfiguredProps] + configured_props : typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] + The configured properties for the action dynamic_props_id : typing.Optional[str] The ID for dynamic props @@ -466,7 +468,7 @@ async def configure_prop( external_user_id: str, prop_name: str, blocking: typing.Optional[bool] = OMIT, - configured_props: typing.Optional[ConfiguredProps] = OMIT, + configured_props: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = OMIT, dynamic_props_id: typing.Optional[str] = OMIT, page: typing.Optional[float] = OMIT, prev_context: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = OMIT, @@ -490,7 +492,8 @@ async def configure_prop( blocking : typing.Optional[bool] Whether this operation should block until completion - configured_props : typing.Optional[ConfiguredProps] + configured_props : typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] + The configured properties for the component dynamic_props_id : typing.Optional[str] The ID for dynamic props @@ -556,7 +559,7 @@ async def reload_props( id: str, external_user_id: str, blocking: typing.Optional[bool] = OMIT, - configured_props: typing.Optional[ConfiguredProps] = OMIT, + configured_props: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = OMIT, dynamic_props_id: typing.Optional[str] = OMIT, request_options: typing.Optional[RequestOptions] = None, ) -> ReloadPropsResponse: @@ -574,7 +577,8 @@ async def reload_props( blocking : typing.Optional[bool] Whether this operation should block until completion - configured_props : typing.Optional[ConfiguredProps] + configured_props : typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] + The configured properties for the component dynamic_props_id : typing.Optional[str] The ID for dynamic props @@ -625,7 +629,7 @@ async def run( *, id: str, external_user_id: str, - configured_props: typing.Optional[ConfiguredProps] = OMIT, + configured_props: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = OMIT, dynamic_props_id: typing.Optional[str] = OMIT, stash_id: typing.Optional[RunActionOptsStashId] = OMIT, request_options: typing.Optional[RequestOptions] = None, @@ -641,7 +645,8 @@ async def run( external_user_id : str The external user ID - configured_props : typing.Optional[ConfiguredProps] + configured_props : typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] + The configured properties for the action dynamic_props_id : typing.Optional[str] The ID for dynamic props diff --git a/src/pipedream/actions/raw_client.py b/src/pipedream/actions/raw_client.py index 026d20d..6e8af2d 100644 --- a/src/pipedream/actions/raw_client.py +++ b/src/pipedream/actions/raw_client.py @@ -11,9 +11,9 @@ from ..core.pydantic_utilities import parse_obj_as from ..core.request_options import RequestOptions from ..core.serialization import convert_and_respect_annotation_metadata +from ..errors.too_many_requests_error import TooManyRequestsError from ..types.component import Component from ..types.configure_prop_response import ConfigurePropResponse -from ..types.configured_props import ConfiguredProps from ..types.get_component_response import GetComponentResponse from ..types.get_components_response import GetComponentsResponse from ..types.reload_props_response import ReloadPropsResponse @@ -104,6 +104,17 @@ def list( return SyncPager( has_next=_has_next, items=_items, get_next=_get_next, response=BaseHttpResponse(response=_response) ) + 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) @@ -144,6 +155,17 @@ def retrieve( ) _data = _parsed_response.data return HttpResponse(response=_response, data=_data) + 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) @@ -156,7 +178,7 @@ def configure_prop( external_user_id: str, prop_name: str, blocking: typing.Optional[bool] = OMIT, - configured_props: typing.Optional[ConfiguredProps] = OMIT, + configured_props: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = OMIT, dynamic_props_id: typing.Optional[str] = OMIT, page: typing.Optional[float] = OMIT, prev_context: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = OMIT, @@ -180,7 +202,8 @@ def configure_prop( blocking : typing.Optional[bool] Whether this operation should block until completion - configured_props : typing.Optional[ConfiguredProps] + configured_props : typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] + The configured properties for the component dynamic_props_id : typing.Optional[str] The ID for dynamic props @@ -210,9 +233,7 @@ def configure_prop( "external_user_id": external_user_id, "prop_name": prop_name, "blocking": blocking, - "configured_props": convert_and_respect_annotation_metadata( - object_=configured_props, annotation=ConfiguredProps, direction="write" - ), + "configured_props": configured_props, "dynamic_props_id": dynamic_props_id, "page": page, "prev_context": prev_context, @@ -234,6 +255,17 @@ def configure_prop( ), ) return HttpResponse(response=_response, data=_data) + 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) @@ -245,7 +277,7 @@ def reload_props( id: str, external_user_id: str, blocking: typing.Optional[bool] = OMIT, - configured_props: typing.Optional[ConfiguredProps] = OMIT, + configured_props: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = OMIT, dynamic_props_id: typing.Optional[str] = OMIT, request_options: typing.Optional[RequestOptions] = None, ) -> HttpResponse[ReloadPropsResponse]: @@ -263,7 +295,8 @@ def reload_props( blocking : typing.Optional[bool] Whether this operation should block until completion - configured_props : typing.Optional[ConfiguredProps] + configured_props : typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] + The configured properties for the component dynamic_props_id : typing.Optional[str] The ID for dynamic props @@ -283,9 +316,7 @@ def reload_props( "id": id, "external_user_id": external_user_id, "blocking": blocking, - "configured_props": convert_and_respect_annotation_metadata( - object_=configured_props, annotation=ConfiguredProps, direction="write" - ), + "configured_props": configured_props, "dynamic_props_id": dynamic_props_id, }, headers={ @@ -304,6 +335,17 @@ def reload_props( ), ) return HttpResponse(response=_response, data=_data) + 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) @@ -314,7 +356,7 @@ def run( *, id: str, external_user_id: str, - configured_props: typing.Optional[ConfiguredProps] = OMIT, + configured_props: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = OMIT, dynamic_props_id: typing.Optional[str] = OMIT, stash_id: typing.Optional[RunActionOptsStashId] = OMIT, request_options: typing.Optional[RequestOptions] = None, @@ -330,7 +372,8 @@ def run( external_user_id : str The external user ID - configured_props : typing.Optional[ConfiguredProps] + configured_props : typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] + The configured properties for the action dynamic_props_id : typing.Optional[str] The ID for dynamic props @@ -351,9 +394,7 @@ def run( json={ "id": id, "external_user_id": external_user_id, - "configured_props": convert_and_respect_annotation_metadata( - object_=configured_props, annotation=ConfiguredProps, direction="write" - ), + "configured_props": configured_props, "dynamic_props_id": dynamic_props_id, "stash_id": convert_and_respect_annotation_metadata( object_=stash_id, annotation=RunActionOptsStashId, direction="write" @@ -375,6 +416,17 @@ def run( ), ) return HttpResponse(response=_response, data=_data) + 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) @@ -464,6 +516,17 @@ async def _get_next(): return AsyncPager( has_next=_has_next, items=_items, get_next=_get_next, response=BaseHttpResponse(response=_response) ) + 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) @@ -504,6 +567,17 @@ async def retrieve( ) _data = _parsed_response.data return AsyncHttpResponse(response=_response, data=_data) + 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) @@ -516,7 +590,7 @@ async def configure_prop( external_user_id: str, prop_name: str, blocking: typing.Optional[bool] = OMIT, - configured_props: typing.Optional[ConfiguredProps] = OMIT, + configured_props: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = OMIT, dynamic_props_id: typing.Optional[str] = OMIT, page: typing.Optional[float] = OMIT, prev_context: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = OMIT, @@ -540,7 +614,8 @@ async def configure_prop( blocking : typing.Optional[bool] Whether this operation should block until completion - configured_props : typing.Optional[ConfiguredProps] + configured_props : typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] + The configured properties for the component dynamic_props_id : typing.Optional[str] The ID for dynamic props @@ -570,9 +645,7 @@ async def configure_prop( "external_user_id": external_user_id, "prop_name": prop_name, "blocking": blocking, - "configured_props": convert_and_respect_annotation_metadata( - object_=configured_props, annotation=ConfiguredProps, direction="write" - ), + "configured_props": configured_props, "dynamic_props_id": dynamic_props_id, "page": page, "prev_context": prev_context, @@ -594,6 +667,17 @@ async def configure_prop( ), ) return AsyncHttpResponse(response=_response, data=_data) + 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) @@ -605,7 +689,7 @@ async def reload_props( id: str, external_user_id: str, blocking: typing.Optional[bool] = OMIT, - configured_props: typing.Optional[ConfiguredProps] = OMIT, + configured_props: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = OMIT, dynamic_props_id: typing.Optional[str] = OMIT, request_options: typing.Optional[RequestOptions] = None, ) -> AsyncHttpResponse[ReloadPropsResponse]: @@ -623,7 +707,8 @@ async def reload_props( blocking : typing.Optional[bool] Whether this operation should block until completion - configured_props : typing.Optional[ConfiguredProps] + configured_props : typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] + The configured properties for the component dynamic_props_id : typing.Optional[str] The ID for dynamic props @@ -643,9 +728,7 @@ async def reload_props( "id": id, "external_user_id": external_user_id, "blocking": blocking, - "configured_props": convert_and_respect_annotation_metadata( - object_=configured_props, annotation=ConfiguredProps, direction="write" - ), + "configured_props": configured_props, "dynamic_props_id": dynamic_props_id, }, headers={ @@ -664,6 +747,17 @@ async def reload_props( ), ) return AsyncHttpResponse(response=_response, data=_data) + 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) @@ -674,7 +768,7 @@ async def run( *, id: str, external_user_id: str, - configured_props: typing.Optional[ConfiguredProps] = OMIT, + configured_props: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = OMIT, dynamic_props_id: typing.Optional[str] = OMIT, stash_id: typing.Optional[RunActionOptsStashId] = OMIT, request_options: typing.Optional[RequestOptions] = None, @@ -690,7 +784,8 @@ async def run( external_user_id : str The external user ID - configured_props : typing.Optional[ConfiguredProps] + configured_props : typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] + The configured properties for the action dynamic_props_id : typing.Optional[str] The ID for dynamic props @@ -711,9 +806,7 @@ async def run( json={ "id": id, "external_user_id": external_user_id, - "configured_props": convert_and_respect_annotation_metadata( - object_=configured_props, annotation=ConfiguredProps, direction="write" - ), + "configured_props": configured_props, "dynamic_props_id": dynamic_props_id, "stash_id": convert_and_respect_annotation_metadata( object_=stash_id, annotation=RunActionOptsStashId, direction="write" @@ -735,6 +828,17 @@ async def run( ), ) return AsyncHttpResponse(response=_response, data=_data) + 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) diff --git a/src/pipedream/client.py b/src/pipedream/client.py index 7fbf529..0c2fbdd 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..24f78d8 100644 --- a/src/pipedream/components/client.py +++ b/src/pipedream/components/client.py @@ -6,9 +6,7 @@ from ..core.pagination import AsyncPager, SyncPager from ..core.request_options import RequestOptions from ..types.component import Component -from ..types.component_type import ComponentType from ..types.configure_prop_response import ConfigurePropResponse -from ..types.configured_props import ConfiguredProps from ..types.reload_props_response import ReloadPropsResponse from .raw_client import AsyncRawComponentsClient, RawComponentsClient @@ -39,7 +37,6 @@ def list( limit: typing.Optional[int] = None, q: typing.Optional[str] = None, app: typing.Optional[str] = None, - component_type: typing.Optional[ComponentType] = None, request_options: typing.Optional[RequestOptions] = None, ) -> SyncPager[Component]: """ @@ -62,9 +59,6 @@ def list( app : typing.Optional[str] The ID or name slug of the app to filter the components - component_type : typing.Optional[ComponentType] - The type of the component to filter the components - request_options : typing.Optional[RequestOptions] Request-specific configuration. @@ -91,13 +85,7 @@ def list( yield page """ return self._raw_client.list( - after=after, - before=before, - limit=limit, - q=q, - app=app, - component_type=component_type, - request_options=request_options, + after=after, before=before, limit=limit, q=q, app=app, request_options=request_options ) def retrieve(self, component_id: str, *, request_options: typing.Optional[RequestOptions] = None) -> Component: @@ -141,7 +129,7 @@ def configure_prop( external_user_id: str, prop_name: str, blocking: typing.Optional[bool] = OMIT, - configured_props: typing.Optional[ConfiguredProps] = OMIT, + configured_props: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = OMIT, dynamic_props_id: typing.Optional[str] = OMIT, page: typing.Optional[float] = OMIT, prev_context: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = OMIT, @@ -165,7 +153,8 @@ def configure_prop( blocking : typing.Optional[bool] Whether this operation should block until completion - configured_props : typing.Optional[ConfiguredProps] + configured_props : typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] + The configured properties for the component dynamic_props_id : typing.Optional[str] The ID for dynamic props @@ -223,7 +212,7 @@ def reload_props( id: str, external_user_id: str, blocking: typing.Optional[bool] = OMIT, - configured_props: typing.Optional[ConfiguredProps] = OMIT, + configured_props: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = OMIT, dynamic_props_id: typing.Optional[str] = OMIT, request_options: typing.Optional[RequestOptions] = None, ) -> ReloadPropsResponse: @@ -241,7 +230,8 @@ def reload_props( blocking : typing.Optional[bool] Whether this operation should block until completion - configured_props : typing.Optional[ConfiguredProps] + configured_props : typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] + The configured properties for the component dynamic_props_id : typing.Optional[str] The ID for dynamic props @@ -303,7 +293,6 @@ async def list( limit: typing.Optional[int] = None, q: typing.Optional[str] = None, app: typing.Optional[str] = None, - component_type: typing.Optional[ComponentType] = None, request_options: typing.Optional[RequestOptions] = None, ) -> AsyncPager[Component]: """ @@ -326,9 +315,6 @@ async def list( app : typing.Optional[str] The ID or name slug of the app to filter the components - component_type : typing.Optional[ComponentType] - The type of the component to filter the components - request_options : typing.Optional[RequestOptions] Request-specific configuration. @@ -364,13 +350,7 @@ async def main() -> None: asyncio.run(main()) """ return await self._raw_client.list( - after=after, - before=before, - limit=limit, - q=q, - app=app, - component_type=component_type, - request_options=request_options, + after=after, before=before, limit=limit, q=q, app=app, request_options=request_options ) async def retrieve( @@ -424,7 +404,7 @@ async def configure_prop( external_user_id: str, prop_name: str, blocking: typing.Optional[bool] = OMIT, - configured_props: typing.Optional[ConfiguredProps] = OMIT, + configured_props: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = OMIT, dynamic_props_id: typing.Optional[str] = OMIT, page: typing.Optional[float] = OMIT, prev_context: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = OMIT, @@ -448,7 +428,8 @@ async def configure_prop( blocking : typing.Optional[bool] Whether this operation should block until completion - configured_props : typing.Optional[ConfiguredProps] + configured_props : typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] + The configured properties for the component dynamic_props_id : typing.Optional[str] The ID for dynamic props @@ -514,7 +495,7 @@ async def reload_props( id: str, external_user_id: str, blocking: typing.Optional[bool] = OMIT, - configured_props: typing.Optional[ConfiguredProps] = OMIT, + configured_props: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = OMIT, dynamic_props_id: typing.Optional[str] = OMIT, request_options: typing.Optional[RequestOptions] = None, ) -> ReloadPropsResponse: @@ -532,7 +513,8 @@ async def reload_props( blocking : typing.Optional[bool] Whether this operation should block until completion - configured_props : typing.Optional[ConfiguredProps] + configured_props : typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] + The configured properties for the component dynamic_props_id : typing.Optional[str] The ID for dynamic props diff --git a/src/pipedream/components/raw_client.py b/src/pipedream/components/raw_client.py index b3cf1b2..f9967a3 100644 --- a/src/pipedream/components/raw_client.py +++ b/src/pipedream/components/raw_client.py @@ -10,11 +10,9 @@ from ..core.pagination import AsyncPager, BaseHttpResponse, SyncPager from ..core.pydantic_utilities import parse_obj_as from ..core.request_options import RequestOptions -from ..core.serialization import convert_and_respect_annotation_metadata +from ..errors.too_many_requests_error import TooManyRequestsError from ..types.component import Component -from ..types.component_type import ComponentType from ..types.configure_prop_response import ConfigurePropResponse -from ..types.configured_props import ConfiguredProps from ..types.get_component_response import GetComponentResponse from ..types.get_components_response import GetComponentsResponse from ..types.reload_props_response import ReloadPropsResponse @@ -35,7 +33,6 @@ def list( limit: typing.Optional[int] = None, q: typing.Optional[str] = None, app: typing.Optional[str] = None, - component_type: typing.Optional[ComponentType] = None, request_options: typing.Optional[RequestOptions] = None, ) -> SyncPager[Component]: """ @@ -58,9 +55,6 @@ def list( app : typing.Optional[str] The ID or name slug of the app to filter the components - component_type : typing.Optional[ComponentType] - The type of the component to filter the components - request_options : typing.Optional[RequestOptions] Request-specific configuration. @@ -78,7 +72,6 @@ def list( "limit": limit, "q": q, "app": app, - "component_type": component_type, }, request_options=request_options, ) @@ -103,12 +96,22 @@ def list( limit=limit, q=q, app=app, - component_type=component_type, request_options=request_options, ) return SyncPager( has_next=_has_next, items=_items, get_next=_get_next, response=BaseHttpResponse(response=_response) ) + 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) @@ -149,6 +152,17 @@ def retrieve( ) _data = _parsed_response.data return HttpResponse(response=_response, data=_data) + 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) @@ -161,7 +175,7 @@ def configure_prop( external_user_id: str, prop_name: str, blocking: typing.Optional[bool] = OMIT, - configured_props: typing.Optional[ConfiguredProps] = OMIT, + configured_props: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = OMIT, dynamic_props_id: typing.Optional[str] = OMIT, page: typing.Optional[float] = OMIT, prev_context: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = OMIT, @@ -185,7 +199,8 @@ def configure_prop( blocking : typing.Optional[bool] Whether this operation should block until completion - configured_props : typing.Optional[ConfiguredProps] + configured_props : typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] + The configured properties for the component dynamic_props_id : typing.Optional[str] The ID for dynamic props @@ -215,9 +230,7 @@ def configure_prop( "external_user_id": external_user_id, "prop_name": prop_name, "blocking": blocking, - "configured_props": convert_and_respect_annotation_metadata( - object_=configured_props, annotation=ConfiguredProps, direction="write" - ), + "configured_props": configured_props, "dynamic_props_id": dynamic_props_id, "page": page, "prev_context": prev_context, @@ -239,6 +252,17 @@ def configure_prop( ), ) return HttpResponse(response=_response, data=_data) + 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) @@ -250,7 +274,7 @@ def reload_props( id: str, external_user_id: str, blocking: typing.Optional[bool] = OMIT, - configured_props: typing.Optional[ConfiguredProps] = OMIT, + configured_props: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = OMIT, dynamic_props_id: typing.Optional[str] = OMIT, request_options: typing.Optional[RequestOptions] = None, ) -> HttpResponse[ReloadPropsResponse]: @@ -268,7 +292,8 @@ def reload_props( blocking : typing.Optional[bool] Whether this operation should block until completion - configured_props : typing.Optional[ConfiguredProps] + configured_props : typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] + The configured properties for the component dynamic_props_id : typing.Optional[str] The ID for dynamic props @@ -288,9 +313,7 @@ def reload_props( "id": id, "external_user_id": external_user_id, "blocking": blocking, - "configured_props": convert_and_respect_annotation_metadata( - object_=configured_props, annotation=ConfiguredProps, direction="write" - ), + "configured_props": configured_props, "dynamic_props_id": dynamic_props_id, }, headers={ @@ -309,6 +332,17 @@ def reload_props( ), ) return HttpResponse(response=_response, data=_data) + 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) @@ -327,7 +361,6 @@ async def list( limit: typing.Optional[int] = None, q: typing.Optional[str] = None, app: typing.Optional[str] = None, - component_type: typing.Optional[ComponentType] = None, request_options: typing.Optional[RequestOptions] = None, ) -> AsyncPager[Component]: """ @@ -350,9 +383,6 @@ async def list( app : typing.Optional[str] The ID or name slug of the app to filter the components - component_type : typing.Optional[ComponentType] - The type of the component to filter the components - request_options : typing.Optional[RequestOptions] Request-specific configuration. @@ -370,7 +400,6 @@ async def list( "limit": limit, "q": q, "app": app, - "component_type": component_type, }, request_options=request_options, ) @@ -397,13 +426,23 @@ async def _get_next(): limit=limit, q=q, app=app, - component_type=component_type, request_options=request_options, ) return AsyncPager( has_next=_has_next, items=_items, get_next=_get_next, response=BaseHttpResponse(response=_response) ) + 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) @@ -444,6 +483,17 @@ async def retrieve( ) _data = _parsed_response.data return AsyncHttpResponse(response=_response, data=_data) + 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) @@ -456,7 +506,7 @@ async def configure_prop( external_user_id: str, prop_name: str, blocking: typing.Optional[bool] = OMIT, - configured_props: typing.Optional[ConfiguredProps] = OMIT, + configured_props: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = OMIT, dynamic_props_id: typing.Optional[str] = OMIT, page: typing.Optional[float] = OMIT, prev_context: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = OMIT, @@ -480,7 +530,8 @@ async def configure_prop( blocking : typing.Optional[bool] Whether this operation should block until completion - configured_props : typing.Optional[ConfiguredProps] + configured_props : typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] + The configured properties for the component dynamic_props_id : typing.Optional[str] The ID for dynamic props @@ -510,9 +561,7 @@ async def configure_prop( "external_user_id": external_user_id, "prop_name": prop_name, "blocking": blocking, - "configured_props": convert_and_respect_annotation_metadata( - object_=configured_props, annotation=ConfiguredProps, direction="write" - ), + "configured_props": configured_props, "dynamic_props_id": dynamic_props_id, "page": page, "prev_context": prev_context, @@ -534,6 +583,17 @@ async def configure_prop( ), ) return AsyncHttpResponse(response=_response, data=_data) + 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) @@ -545,7 +605,7 @@ async def reload_props( id: str, external_user_id: str, blocking: typing.Optional[bool] = OMIT, - configured_props: typing.Optional[ConfiguredProps] = OMIT, + configured_props: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = OMIT, dynamic_props_id: typing.Optional[str] = OMIT, request_options: typing.Optional[RequestOptions] = None, ) -> AsyncHttpResponse[ReloadPropsResponse]: @@ -563,7 +623,8 @@ async def reload_props( blocking : typing.Optional[bool] Whether this operation should block until completion - configured_props : typing.Optional[ConfiguredProps] + configured_props : typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] + The configured properties for the component dynamic_props_id : typing.Optional[str] The ID for dynamic props @@ -583,9 +644,7 @@ async def reload_props( "id": id, "external_user_id": external_user_id, "blocking": blocking, - "configured_props": convert_and_respect_annotation_metadata( - object_=configured_props, annotation=ConfiguredProps, direction="write" - ), + "configured_props": configured_props, "dynamic_props_id": dynamic_props_id, }, headers={ @@ -604,6 +663,17 @@ async def reload_props( ), ) return AsyncHttpResponse(response=_response, data=_data) + 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) diff --git a/src/pipedream/core/client_wrapper.py b/src/pipedream/core/client_wrapper.py index ceedd88..834c9b6 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.6", + "User-Agent": "pipedream/1.0.7", "X-Fern-Language": "Python", "X-Fern-SDK-Name": "pipedream", - "X-Fern-SDK-Version": "1.0.6", + "X-Fern-SDK-Version": "1.0.7", **(self.get_custom_headers() or {}), } if self._project_environment is not None: diff --git a/src/pipedream/core/pydantic_utilities.py b/src/pipedream/core/pydantic_utilities.py index dd7d89f..8906cdf 100644 --- a/src/pipedream/core/pydantic_utilities.py +++ b/src/pipedream/core/pydantic_utilities.py @@ -61,7 +61,7 @@ class UniversalBaseModel(pydantic.BaseModel): @pydantic.model_serializer(mode="plain", when_used="json") # type: ignore[attr-defined] def serialize_model(self) -> Any: # type: ignore[name-defined] - serialized = self.model_dump() # type: ignore[attr-defined] + serialized = self.dict() # type: ignore[attr-defined] data = {k: serialize_datetime(v) if isinstance(v, dt.datetime) else v for k, v in serialized.items()} return data diff --git a/src/pipedream/deployed_triggers/client.py b/src/pipedream/deployed_triggers/client.py index 9493eef..f2f5a7d 100644 --- a/src/pipedream/deployed_triggers/client.py +++ b/src/pipedream/deployed_triggers/client.py @@ -5,7 +5,6 @@ from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper from ..core.pagination import AsyncPager, SyncPager from ..core.request_options import RequestOptions -from ..types.configured_props import ConfiguredProps from ..types.deployed_component import DeployedComponent from ..types.emitted_event import EmittedEvent from ..types.get_trigger_webhooks_response import GetTriggerWebhooksResponse @@ -135,7 +134,7 @@ def update( *, external_user_id: str, active: typing.Optional[bool] = OMIT, - configured_props: typing.Optional[ConfiguredProps] = OMIT, + configured_props: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = OMIT, name: typing.Optional[str] = OMIT, request_options: typing.Optional[RequestOptions] = None, ) -> DeployedComponent: @@ -152,7 +151,8 @@ def update( active : typing.Optional[bool] Whether the trigger should be active - configured_props : typing.Optional[ConfiguredProps] + configured_props : typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] + The configured properties for the trigger name : typing.Optional[str] The name of the trigger @@ -609,7 +609,7 @@ async def update( *, external_user_id: str, active: typing.Optional[bool] = OMIT, - configured_props: typing.Optional[ConfiguredProps] = OMIT, + configured_props: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = OMIT, name: typing.Optional[str] = OMIT, request_options: typing.Optional[RequestOptions] = None, ) -> DeployedComponent: @@ -626,7 +626,8 @@ async def update( active : typing.Optional[bool] Whether the trigger should be active - configured_props : typing.Optional[ConfiguredProps] + configured_props : typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] + The configured properties for the trigger name : typing.Optional[str] The name of the trigger diff --git a/src/pipedream/deployed_triggers/raw_client.py b/src/pipedream/deployed_triggers/raw_client.py index 9ff533b..203558f 100644 --- a/src/pipedream/deployed_triggers/raw_client.py +++ b/src/pipedream/deployed_triggers/raw_client.py @@ -10,8 +10,7 @@ from ..core.pagination import AsyncPager, BaseHttpResponse, SyncPager from ..core.pydantic_utilities import parse_obj_as from ..core.request_options import RequestOptions -from ..core.serialization import convert_and_respect_annotation_metadata -from ..types.configured_props import ConfiguredProps +from ..errors.too_many_requests_error import TooManyRequestsError from ..types.deployed_component import DeployedComponent from ..types.emitted_event import EmittedEvent from ..types.get_trigger_events_response import GetTriggerEventsResponse @@ -98,6 +97,17 @@ def list( return SyncPager( has_next=_has_next, items=_items, get_next=_get_next, response=BaseHttpResponse(response=_response) ) + 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) @@ -143,6 +153,17 @@ def retrieve( ) _data = _parsed_response.data return HttpResponse(response=_response, data=_data) + 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) @@ -154,7 +175,7 @@ def update( *, external_user_id: str, active: typing.Optional[bool] = OMIT, - configured_props: typing.Optional[ConfiguredProps] = OMIT, + configured_props: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = OMIT, name: typing.Optional[str] = OMIT, request_options: typing.Optional[RequestOptions] = None, ) -> HttpResponse[DeployedComponent]: @@ -171,7 +192,8 @@ def update( active : typing.Optional[bool] Whether the trigger should be active - configured_props : typing.Optional[ConfiguredProps] + configured_props : typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] + The configured properties for the trigger name : typing.Optional[str] The name of the trigger @@ -192,9 +214,7 @@ def update( }, json={ "active": active, - "configured_props": convert_and_respect_annotation_metadata( - object_=configured_props, annotation=ConfiguredProps, direction="write" - ), + "configured_props": configured_props, "name": name, }, headers={ @@ -214,6 +234,17 @@ def update( ) _data = _parsed_response.data return HttpResponse(response=_response, data=_data) + 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) @@ -259,6 +290,17 @@ def delete( 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) @@ -313,6 +355,17 @@ def list_events( ) _data = _parsed_response.data return HttpResponse(response=_response, data=_data) + 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) @@ -357,6 +410,17 @@ def list_workflows( ), ) return HttpResponse(response=_response, data=_data) + 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) @@ -416,6 +480,17 @@ def update_workflows( ), ) return HttpResponse(response=_response, data=_data) + 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) @@ -460,6 +535,17 @@ def list_webhooks( ), ) return HttpResponse(response=_response, data=_data) + 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) @@ -519,6 +605,17 @@ def update_webhooks( ), ) return HttpResponse(response=_response, data=_data) + 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) @@ -602,6 +699,17 @@ async def _get_next(): return AsyncPager( has_next=_has_next, items=_items, get_next=_get_next, response=BaseHttpResponse(response=_response) ) + 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) @@ -647,6 +755,17 @@ async def retrieve( ) _data = _parsed_response.data return AsyncHttpResponse(response=_response, data=_data) + 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) @@ -658,7 +777,7 @@ async def update( *, external_user_id: str, active: typing.Optional[bool] = OMIT, - configured_props: typing.Optional[ConfiguredProps] = OMIT, + configured_props: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = OMIT, name: typing.Optional[str] = OMIT, request_options: typing.Optional[RequestOptions] = None, ) -> AsyncHttpResponse[DeployedComponent]: @@ -675,7 +794,8 @@ async def update( active : typing.Optional[bool] Whether the trigger should be active - configured_props : typing.Optional[ConfiguredProps] + configured_props : typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] + The configured properties for the trigger name : typing.Optional[str] The name of the trigger @@ -696,9 +816,7 @@ async def update( }, json={ "active": active, - "configured_props": convert_and_respect_annotation_metadata( - object_=configured_props, annotation=ConfiguredProps, direction="write" - ), + "configured_props": configured_props, "name": name, }, headers={ @@ -718,6 +836,17 @@ async def update( ) _data = _parsed_response.data return AsyncHttpResponse(response=_response, data=_data) + 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) @@ -763,6 +892,17 @@ async def delete( 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) @@ -817,6 +957,17 @@ async def list_events( ) _data = _parsed_response.data return AsyncHttpResponse(response=_response, data=_data) + 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) @@ -861,6 +1012,17 @@ async def list_workflows( ), ) return AsyncHttpResponse(response=_response, data=_data) + 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) @@ -920,6 +1082,17 @@ async def update_workflows( ), ) return AsyncHttpResponse(response=_response, data=_data) + 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) @@ -964,6 +1137,17 @@ async def list_webhooks( ), ) return AsyncHttpResponse(response=_response, data=_data) + 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) @@ -1023,6 +1207,17 @@ async def update_webhooks( ), ) return AsyncHttpResponse(response=_response, data=_data) + 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) diff --git a/src/pipedream/errors/__init__.py b/src/pipedream/errors/__init__.py new file mode 100644 index 0000000..32ca4d5 --- /dev/null +++ b/src/pipedream/errors/__init__.py @@ -0,0 +1,32 @@ +# This file was auto-generated by Fern from our API Definition. + +# isort: skip_file + +import typing +from importlib import import_module + +if typing.TYPE_CHECKING: + from .too_many_requests_error import TooManyRequestsError +_dynamic_imports: typing.Dict[str, str] = {"TooManyRequestsError": ".too_many_requests_error"} + + +def __getattr__(attr_name: str) -> typing.Any: + module_name = _dynamic_imports.get(attr_name) + if module_name is None: + 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 + except ImportError as e: + raise ImportError(f"Failed to import {attr_name} from {module_name}: {e}") from e + except AttributeError as e: + raise AttributeError(f"Failed to get {attr_name} from {module_name}: {e}") from e + + +def __dir__(): + lazy_attrs = list(_dynamic_imports.keys()) + return sorted(lazy_attrs) + + +__all__ = ["TooManyRequestsError"] diff --git a/src/pipedream/errors/too_many_requests_error.py b/src/pipedream/errors/too_many_requests_error.py new file mode 100644 index 0000000..2705399 --- /dev/null +++ b/src/pipedream/errors/too_many_requests_error.py @@ -0,0 +1,10 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +from ..core.api_error import ApiError + + +class TooManyRequestsError(ApiError): + def __init__(self, body: typing.Optional[typing.Any], headers: typing.Optional[typing.Dict[str, str]] = None): + super().__init__(status_code=429, headers=headers, body=body) diff --git a/src/pipedream/projects/raw_client.py b/src/pipedream/projects/raw_client.py index 3af4a43..54d4b1c 100644 --- a/src/pipedream/projects/raw_client.py +++ b/src/pipedream/projects/raw_client.py @@ -9,6 +9,7 @@ from ..core.jsonable_encoder import jsonable_encoder from ..core.pydantic_utilities import parse_obj_as from ..core.request_options import RequestOptions +from ..errors.too_many_requests_error import TooManyRequestsError from ..types.project_info_response import ProjectInfoResponse @@ -47,6 +48,17 @@ def retrieve_info( ), ) return HttpResponse(response=_response, data=_data) + 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) @@ -88,6 +100,17 @@ async def retrieve_info( ), ) return AsyncHttpResponse(response=_response, data=_data) + 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) diff --git a/src/pipedream/proxy/raw_client.py b/src/pipedream/proxy/raw_client.py index 00ba213..6825954 100644 --- a/src/pipedream/proxy/raw_client.py +++ b/src/pipedream/proxy/raw_client.py @@ -9,6 +9,7 @@ from ..core.jsonable_encoder import jsonable_encoder from ..core.pydantic_utilities import parse_obj_as from ..core.request_options import RequestOptions +from ..errors.too_many_requests_error import TooManyRequestsError from ..types.proxy_response import ProxyResponse # this is used as the default value for optional parameters @@ -70,6 +71,17 @@ def get( ), ) return HttpResponse(response=_response, data=_data) + 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) @@ -134,6 +146,17 @@ def post( ), ) return HttpResponse(response=_response, data=_data) + 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) @@ -198,6 +221,17 @@ def put( ), ) return HttpResponse(response=_response, data=_data) + 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) @@ -254,6 +288,17 @@ def delete( ), ) return HttpResponse(response=_response, data=_data) + 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) @@ -318,6 +363,17 @@ def patch( ), ) return HttpResponse(response=_response, data=_data) + 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) @@ -379,6 +435,17 @@ async def get( ), ) return AsyncHttpResponse(response=_response, data=_data) + 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) @@ -443,6 +510,17 @@ async def post( ), ) return AsyncHttpResponse(response=_response, data=_data) + 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) @@ -507,6 +585,17 @@ async def put( ), ) return AsyncHttpResponse(response=_response, data=_data) + 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) @@ -563,6 +652,17 @@ async def delete( ), ) return AsyncHttpResponse(response=_response, data=_data) + 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) @@ -627,6 +727,17 @@ async def patch( ), ) return AsyncHttpResponse(response=_response, data=_data) + 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) diff --git a/src/pipedream/tokens/raw_client.py b/src/pipedream/tokens/raw_client.py index 1ea55e9..4370714 100644 --- a/src/pipedream/tokens/raw_client.py +++ b/src/pipedream/tokens/raw_client.py @@ -9,6 +9,7 @@ from ..core.jsonable_encoder import jsonable_encoder from ..core.pydantic_utilities import parse_obj_as from ..core.request_options import RequestOptions +from ..errors.too_many_requests_error import TooManyRequestsError from ..types.connect_token import ConnectToken from ..types.create_token_response import CreateTokenResponse from ..types.validate_token_response import ValidateTokenResponse @@ -85,6 +86,17 @@ def create( ), ) return HttpResponse(response=_response, data=_data) + 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) @@ -138,6 +150,17 @@ def validate( ), ) return HttpResponse(response=_response, data=_data) + 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) @@ -212,6 +235,17 @@ async def create( ), ) return AsyncHttpResponse(response=_response, data=_data) + 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) @@ -265,6 +299,17 @@ async def validate( ), ) return AsyncHttpResponse(response=_response, data=_data) + 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) diff --git a/src/pipedream/triggers/client.py b/src/pipedream/triggers/client.py index 32bf25d..ecefa64 100644 --- a/src/pipedream/triggers/client.py +++ b/src/pipedream/triggers/client.py @@ -7,7 +7,6 @@ from ..core.request_options import RequestOptions 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.reload_props_response import ReloadPropsResponse from .raw_client import AsyncRawTriggersClient, RawTriggersClient @@ -131,7 +130,7 @@ def configure_prop( external_user_id: str, prop_name: str, blocking: typing.Optional[bool] = OMIT, - configured_props: typing.Optional[ConfiguredProps] = OMIT, + configured_props: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = OMIT, dynamic_props_id: typing.Optional[str] = OMIT, page: typing.Optional[float] = OMIT, prev_context: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = OMIT, @@ -155,7 +154,8 @@ def configure_prop( blocking : typing.Optional[bool] Whether this operation should block until completion - configured_props : typing.Optional[ConfiguredProps] + configured_props : typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] + The configured properties for the component dynamic_props_id : typing.Optional[str] The ID for dynamic props @@ -213,7 +213,7 @@ def reload_props( id: str, external_user_id: str, blocking: typing.Optional[bool] = OMIT, - configured_props: typing.Optional[ConfiguredProps] = OMIT, + configured_props: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = OMIT, dynamic_props_id: typing.Optional[str] = OMIT, request_options: typing.Optional[RequestOptions] = None, ) -> ReloadPropsResponse: @@ -231,7 +231,8 @@ def reload_props( blocking : typing.Optional[bool] Whether this operation should block until completion - configured_props : typing.Optional[ConfiguredProps] + configured_props : typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] + The configured properties for the component dynamic_props_id : typing.Optional[str] The ID for dynamic props @@ -274,7 +275,7 @@ def deploy( *, id: str, external_user_id: str, - configured_props: typing.Optional[ConfiguredProps] = OMIT, + configured_props: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = OMIT, dynamic_props_id: typing.Optional[str] = OMIT, webhook_url: typing.Optional[str] = OMIT, request_options: typing.Optional[RequestOptions] = None, @@ -290,7 +291,8 @@ def deploy( external_user_id : str The external user ID - configured_props : typing.Optional[ConfiguredProps] + configured_props : typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] + The configured properties for the trigger dynamic_props_id : typing.Optional[str] The ID for dynamic props @@ -466,7 +468,7 @@ async def configure_prop( external_user_id: str, prop_name: str, blocking: typing.Optional[bool] = OMIT, - configured_props: typing.Optional[ConfiguredProps] = OMIT, + configured_props: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = OMIT, dynamic_props_id: typing.Optional[str] = OMIT, page: typing.Optional[float] = OMIT, prev_context: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = OMIT, @@ -490,7 +492,8 @@ async def configure_prop( blocking : typing.Optional[bool] Whether this operation should block until completion - configured_props : typing.Optional[ConfiguredProps] + configured_props : typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] + The configured properties for the component dynamic_props_id : typing.Optional[str] The ID for dynamic props @@ -556,7 +559,7 @@ async def reload_props( id: str, external_user_id: str, blocking: typing.Optional[bool] = OMIT, - configured_props: typing.Optional[ConfiguredProps] = OMIT, + configured_props: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = OMIT, dynamic_props_id: typing.Optional[str] = OMIT, request_options: typing.Optional[RequestOptions] = None, ) -> ReloadPropsResponse: @@ -574,7 +577,8 @@ async def reload_props( blocking : typing.Optional[bool] Whether this operation should block until completion - configured_props : typing.Optional[ConfiguredProps] + configured_props : typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] + The configured properties for the component dynamic_props_id : typing.Optional[str] The ID for dynamic props @@ -625,7 +629,7 @@ async def deploy( *, id: str, external_user_id: str, - configured_props: typing.Optional[ConfiguredProps] = OMIT, + configured_props: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = OMIT, dynamic_props_id: typing.Optional[str] = OMIT, webhook_url: typing.Optional[str] = OMIT, request_options: typing.Optional[RequestOptions] = None, @@ -641,7 +645,8 @@ async def deploy( external_user_id : str The external user ID - configured_props : typing.Optional[ConfiguredProps] + configured_props : typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] + The configured properties for the trigger dynamic_props_id : typing.Optional[str] The ID for dynamic props diff --git a/src/pipedream/triggers/raw_client.py b/src/pipedream/triggers/raw_client.py index e86b621..5e82b42 100644 --- a/src/pipedream/triggers/raw_client.py +++ b/src/pipedream/triggers/raw_client.py @@ -10,10 +10,9 @@ from ..core.pagination import AsyncPager, BaseHttpResponse, SyncPager from ..core.pydantic_utilities import parse_obj_as from ..core.request_options import RequestOptions -from ..core.serialization import convert_and_respect_annotation_metadata +from ..errors.too_many_requests_error import TooManyRequestsError from ..types.component import Component 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.get_component_response import GetComponentResponse @@ -104,6 +103,17 @@ def list( return SyncPager( has_next=_has_next, items=_items, get_next=_get_next, response=BaseHttpResponse(response=_response) ) + 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) @@ -144,6 +154,17 @@ def retrieve( ) _data = _parsed_response.data return HttpResponse(response=_response, data=_data) + 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) @@ -156,7 +177,7 @@ def configure_prop( external_user_id: str, prop_name: str, blocking: typing.Optional[bool] = OMIT, - configured_props: typing.Optional[ConfiguredProps] = OMIT, + configured_props: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = OMIT, dynamic_props_id: typing.Optional[str] = OMIT, page: typing.Optional[float] = OMIT, prev_context: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = OMIT, @@ -180,7 +201,8 @@ def configure_prop( blocking : typing.Optional[bool] Whether this operation should block until completion - configured_props : typing.Optional[ConfiguredProps] + configured_props : typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] + The configured properties for the component dynamic_props_id : typing.Optional[str] The ID for dynamic props @@ -210,9 +232,7 @@ def configure_prop( "external_user_id": external_user_id, "prop_name": prop_name, "blocking": blocking, - "configured_props": convert_and_respect_annotation_metadata( - object_=configured_props, annotation=ConfiguredProps, direction="write" - ), + "configured_props": configured_props, "dynamic_props_id": dynamic_props_id, "page": page, "prev_context": prev_context, @@ -234,6 +254,17 @@ def configure_prop( ), ) return HttpResponse(response=_response, data=_data) + 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) @@ -245,7 +276,7 @@ def reload_props( id: str, external_user_id: str, blocking: typing.Optional[bool] = OMIT, - configured_props: typing.Optional[ConfiguredProps] = OMIT, + configured_props: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = OMIT, dynamic_props_id: typing.Optional[str] = OMIT, request_options: typing.Optional[RequestOptions] = None, ) -> HttpResponse[ReloadPropsResponse]: @@ -263,7 +294,8 @@ def reload_props( blocking : typing.Optional[bool] Whether this operation should block until completion - configured_props : typing.Optional[ConfiguredProps] + configured_props : typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] + The configured properties for the component dynamic_props_id : typing.Optional[str] The ID for dynamic props @@ -283,9 +315,7 @@ def reload_props( "id": id, "external_user_id": external_user_id, "blocking": blocking, - "configured_props": convert_and_respect_annotation_metadata( - object_=configured_props, annotation=ConfiguredProps, direction="write" - ), + "configured_props": configured_props, "dynamic_props_id": dynamic_props_id, }, headers={ @@ -304,6 +334,17 @@ def reload_props( ), ) return HttpResponse(response=_response, data=_data) + 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) @@ -314,7 +355,7 @@ def deploy( *, id: str, external_user_id: str, - configured_props: typing.Optional[ConfiguredProps] = OMIT, + configured_props: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = OMIT, dynamic_props_id: typing.Optional[str] = OMIT, webhook_url: typing.Optional[str] = OMIT, request_options: typing.Optional[RequestOptions] = None, @@ -330,7 +371,8 @@ def deploy( external_user_id : str The external user ID - configured_props : typing.Optional[ConfiguredProps] + configured_props : typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] + The configured properties for the trigger dynamic_props_id : typing.Optional[str] The ID for dynamic props @@ -352,9 +394,7 @@ def deploy( json={ "id": id, "external_user_id": external_user_id, - "configured_props": convert_and_respect_annotation_metadata( - object_=configured_props, annotation=ConfiguredProps, direction="write" - ), + "configured_props": configured_props, "dynamic_props_id": dynamic_props_id, "webhook_url": webhook_url, }, @@ -375,6 +415,17 @@ def deploy( ) _data = _parsed_response.data return HttpResponse(response=_response, data=_data) + 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) @@ -464,6 +515,17 @@ async def _get_next(): return AsyncPager( has_next=_has_next, items=_items, get_next=_get_next, response=BaseHttpResponse(response=_response) ) + 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) @@ -504,6 +566,17 @@ async def retrieve( ) _data = _parsed_response.data return AsyncHttpResponse(response=_response, data=_data) + 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) @@ -516,7 +589,7 @@ async def configure_prop( external_user_id: str, prop_name: str, blocking: typing.Optional[bool] = OMIT, - configured_props: typing.Optional[ConfiguredProps] = OMIT, + configured_props: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = OMIT, dynamic_props_id: typing.Optional[str] = OMIT, page: typing.Optional[float] = OMIT, prev_context: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = OMIT, @@ -540,7 +613,8 @@ async def configure_prop( blocking : typing.Optional[bool] Whether this operation should block until completion - configured_props : typing.Optional[ConfiguredProps] + configured_props : typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] + The configured properties for the component dynamic_props_id : typing.Optional[str] The ID for dynamic props @@ -570,9 +644,7 @@ async def configure_prop( "external_user_id": external_user_id, "prop_name": prop_name, "blocking": blocking, - "configured_props": convert_and_respect_annotation_metadata( - object_=configured_props, annotation=ConfiguredProps, direction="write" - ), + "configured_props": configured_props, "dynamic_props_id": dynamic_props_id, "page": page, "prev_context": prev_context, @@ -594,6 +666,17 @@ async def configure_prop( ), ) return AsyncHttpResponse(response=_response, data=_data) + 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) @@ -605,7 +688,7 @@ async def reload_props( id: str, external_user_id: str, blocking: typing.Optional[bool] = OMIT, - configured_props: typing.Optional[ConfiguredProps] = OMIT, + configured_props: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = OMIT, dynamic_props_id: typing.Optional[str] = OMIT, request_options: typing.Optional[RequestOptions] = None, ) -> AsyncHttpResponse[ReloadPropsResponse]: @@ -623,7 +706,8 @@ async def reload_props( blocking : typing.Optional[bool] Whether this operation should block until completion - configured_props : typing.Optional[ConfiguredProps] + configured_props : typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] + The configured properties for the component dynamic_props_id : typing.Optional[str] The ID for dynamic props @@ -643,9 +727,7 @@ async def reload_props( "id": id, "external_user_id": external_user_id, "blocking": blocking, - "configured_props": convert_and_respect_annotation_metadata( - object_=configured_props, annotation=ConfiguredProps, direction="write" - ), + "configured_props": configured_props, "dynamic_props_id": dynamic_props_id, }, headers={ @@ -664,6 +746,17 @@ async def reload_props( ), ) return AsyncHttpResponse(response=_response, data=_data) + 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) @@ -674,7 +767,7 @@ async def deploy( *, id: str, external_user_id: str, - configured_props: typing.Optional[ConfiguredProps] = OMIT, + configured_props: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = OMIT, dynamic_props_id: typing.Optional[str] = OMIT, webhook_url: typing.Optional[str] = OMIT, request_options: typing.Optional[RequestOptions] = None, @@ -690,7 +783,8 @@ async def deploy( external_user_id : str The external user ID - configured_props : typing.Optional[ConfiguredProps] + configured_props : typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] + The configured properties for the trigger dynamic_props_id : typing.Optional[str] The ID for dynamic props @@ -712,9 +806,7 @@ async def deploy( json={ "id": id, "external_user_id": external_user_id, - "configured_props": convert_and_respect_annotation_metadata( - object_=configured_props, annotation=ConfiguredProps, direction="write" - ), + "configured_props": configured_props, "dynamic_props_id": dynamic_props_id, "webhook_url": webhook_url, }, @@ -735,6 +827,17 @@ async def deploy( ) _data = _parsed_response.data return AsyncHttpResponse(response=_response, data=_data) + 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) diff --git a/src/pipedream/types/__init__.py b/src/pipedream/types/__init__.py index 795559c..9051950 100644 --- a/src/pipedream/types/__init__.py +++ b/src/pipedream/types/__init__.py @@ -7,7 +7,6 @@ if typing.TYPE_CHECKING: from .account import Account - from .account_id import AccountId from .app import App from .app_auth_type import AppAuthType from .app_category import AppCategory @@ -15,7 +14,6 @@ from .client_opts import ClientOpts from .component import Component from .component_stash import ComponentStash - from .component_type import ComponentType from .configurable_prop import ConfigurableProp from .configurable_prop_airtable_base_id import ConfigurablePropAirtableBaseId from .configurable_prop_airtable_field_id import ConfigurablePropAirtableFieldId @@ -43,21 +41,8 @@ from .configurable_prop_timer_default import ConfigurablePropTimerDefault from .configurable_prop_timer_option import ConfigurablePropTimerOption from .configurable_prop_timer_static import ConfigurablePropTimerStatic - from .configurable_prop_type import ConfigurablePropType - from .configure_prop_options import ConfigurePropOptions - from .configure_prop_options_item import ConfigurePropOptionsItem from .configure_prop_opts import ConfigurePropOpts from .configure_prop_response import ConfigurePropResponse - from .configured_prop_value import ConfiguredPropValue - from .configured_prop_value_any import ConfiguredPropValueAny - from .configured_prop_value_app import ConfiguredPropValueApp - from .configured_prop_value_boolean import ConfiguredPropValueBoolean - from .configured_prop_value_integer import ConfiguredPropValueInteger - from .configured_prop_value_object import ConfiguredPropValueObject - from .configured_prop_value_sql import ConfiguredPropValueSql - from .configured_prop_value_string import ConfiguredPropValueString - from .configured_prop_value_string_array import ConfiguredPropValueStringArray - from .configured_props import ConfiguredProps from .connect_token import ConnectToken from .create_o_auth_token_response import CreateOAuthTokenResponse from .create_token_response import CreateTokenResponse @@ -81,14 +66,11 @@ from .list_accounts_response import ListAccountsResponse from .list_app_categories_response import ListAppCategoriesResponse from .list_apps_response import ListAppsResponse - from .observation import Observation - from .observation_error import ObservationError from .page_info import PageInfo from .project_environment import ProjectEnvironment from .project_info_response import ProjectInfoResponse from .project_info_response_app import ProjectInfoResponseApp from .prop_option import PropOption - from .prop_option_nested import PropOptionNested from .proxy_response import ProxyResponse from .reload_props_opts import ReloadPropsOpts from .reload_props_response import ReloadPropsResponse @@ -98,10 +80,10 @@ from .stash_id import StashId from .timer_cron import TimerCron from .timer_interval import TimerInterval + from .too_many_requests_error_body import TooManyRequestsErrorBody from .validate_token_response import ValidateTokenResponse _dynamic_imports: typing.Dict[str, str] = { "Account": ".account", - "AccountId": ".account_id", "App": ".app", "AppAuthType": ".app_auth_type", "AppCategory": ".app_category", @@ -109,7 +91,6 @@ "ClientOpts": ".client_opts", "Component": ".component", "ComponentStash": ".component_stash", - "ComponentType": ".component_type", "ConfigurableProp": ".configurable_prop", "ConfigurablePropAirtableBaseId": ".configurable_prop_airtable_base_id", "ConfigurablePropAirtableFieldId": ".configurable_prop_airtable_field_id", @@ -137,21 +118,8 @@ "ConfigurablePropTimerDefault": ".configurable_prop_timer_default", "ConfigurablePropTimerOption": ".configurable_prop_timer_option", "ConfigurablePropTimerStatic": ".configurable_prop_timer_static", - "ConfigurablePropType": ".configurable_prop_type", - "ConfigurePropOptions": ".configure_prop_options", - "ConfigurePropOptionsItem": ".configure_prop_options_item", "ConfigurePropOpts": ".configure_prop_opts", "ConfigurePropResponse": ".configure_prop_response", - "ConfiguredPropValue": ".configured_prop_value", - "ConfiguredPropValueAny": ".configured_prop_value_any", - "ConfiguredPropValueApp": ".configured_prop_value_app", - "ConfiguredPropValueBoolean": ".configured_prop_value_boolean", - "ConfiguredPropValueInteger": ".configured_prop_value_integer", - "ConfiguredPropValueObject": ".configured_prop_value_object", - "ConfiguredPropValueSql": ".configured_prop_value_sql", - "ConfiguredPropValueString": ".configured_prop_value_string", - "ConfiguredPropValueStringArray": ".configured_prop_value_string_array", - "ConfiguredProps": ".configured_props", "ConnectToken": ".connect_token", "CreateOAuthTokenResponse": ".create_o_auth_token_response", "CreateTokenResponse": ".create_token_response", @@ -175,14 +143,11 @@ "ListAccountsResponse": ".list_accounts_response", "ListAppCategoriesResponse": ".list_app_categories_response", "ListAppsResponse": ".list_apps_response", - "Observation": ".observation", - "ObservationError": ".observation_error", "PageInfo": ".page_info", "ProjectEnvironment": ".project_environment", "ProjectInfoResponse": ".project_info_response", "ProjectInfoResponseApp": ".project_info_response_app", "PropOption": ".prop_option", - "PropOptionNested": ".prop_option_nested", "ProxyResponse": ".proxy_response", "ReloadPropsOpts": ".reload_props_opts", "ReloadPropsResponse": ".reload_props_response", @@ -192,6 +157,7 @@ "StashId": ".stash_id", "TimerCron": ".timer_cron", "TimerInterval": ".timer_interval", + "TooManyRequestsErrorBody": ".too_many_requests_error_body", "ValidateTokenResponse": ".validate_token_response", } @@ -217,7 +183,6 @@ def __dir__(): __all__ = [ "Account", - "AccountId", "App", "AppAuthType", "AppCategory", @@ -225,7 +190,6 @@ def __dir__(): "ClientOpts", "Component", "ComponentStash", - "ComponentType", "ConfigurableProp", "ConfigurablePropAirtableBaseId", "ConfigurablePropAirtableFieldId", @@ -253,21 +217,8 @@ def __dir__(): "ConfigurablePropTimerDefault", "ConfigurablePropTimerOption", "ConfigurablePropTimerStatic", - "ConfigurablePropType", - "ConfigurePropOptions", - "ConfigurePropOptionsItem", "ConfigurePropOpts", "ConfigurePropResponse", - "ConfiguredPropValue", - "ConfiguredPropValueAny", - "ConfiguredPropValueApp", - "ConfiguredPropValueBoolean", - "ConfiguredPropValueInteger", - "ConfiguredPropValueObject", - "ConfiguredPropValueSql", - "ConfiguredPropValueString", - "ConfiguredPropValueStringArray", - "ConfiguredProps", "ConnectToken", "CreateOAuthTokenResponse", "CreateTokenResponse", @@ -291,14 +242,11 @@ def __dir__(): "ListAccountsResponse", "ListAppCategoriesResponse", "ListAppsResponse", - "Observation", - "ObservationError", "PageInfo", "ProjectEnvironment", "ProjectInfoResponse", "ProjectInfoResponseApp", "PropOption", - "PropOptionNested", "ProxyResponse", "ReloadPropsOpts", "ReloadPropsResponse", @@ -308,5 +256,6 @@ def __dir__(): "StashId", "TimerCron", "TimerInterval", + "TooManyRequestsErrorBody", "ValidateTokenResponse", ] diff --git a/src/pipedream/types/account.py b/src/pipedream/types/account.py index 2627d08..7d1dd3f 100644 --- a/src/pipedream/types/account.py +++ b/src/pipedream/types/account.py @@ -5,7 +5,6 @@ import pydantic from ..core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel -from .account_id import AccountId from .app import App @@ -14,7 +13,11 @@ class Account(UniversalBaseModel): End user account data, returned from the API. """ - id: AccountId + id: str = pydantic.Field() + """ + The unique ID of the account. + """ + name: typing.Optional[str] = pydantic.Field(default=None) """ The custom name of the account if set. diff --git a/src/pipedream/types/account_id.py b/src/pipedream/types/account_id.py deleted file mode 100644 index 6a6390c..0000000 --- a/src/pipedream/types/account_id.py +++ /dev/null @@ -1,3 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -AccountId = str diff --git a/src/pipedream/types/component_type.py b/src/pipedream/types/component_type.py deleted file mode 100644 index 18ad740..0000000 --- a/src/pipedream/types/component_type.py +++ /dev/null @@ -1,5 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -ComponentType = typing.Union[typing.Literal["trigger", "action"], typing.Any] diff --git a/src/pipedream/types/configurable_prop.py b/src/pipedream/types/configurable_prop.py index 5f5308b..37d4394 100644 --- a/src/pipedream/types/configurable_prop.py +++ b/src/pipedream/types/configurable_prop.py @@ -6,7 +6,6 @@ import typing_extensions from ..core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel from ..core.serialization import FieldMetadata -from .configurable_prop_type import ConfigurablePropType class ConfigurableProp(UniversalBaseModel): @@ -19,7 +18,7 @@ class ConfigurableProp(UniversalBaseModel): When building `configuredProps`, make sure to use this field as the key when setting the prop value """ - type: ConfigurablePropType + type: typing.Optional[str] = None label: typing.Optional[str] = pydantic.Field(default=None) """ Value to use as an input label. In cases where `type` is "app", should load the app via `getApp`, etc. and show `app.name` instead. diff --git a/src/pipedream/types/configurable_prop_airtable_base_id.py b/src/pipedream/types/configurable_prop_airtable_base_id.py index 45340cd..f4dca84 100644 --- a/src/pipedream/types/configurable_prop_airtable_base_id.py +++ b/src/pipedream/types/configurable_prop_airtable_base_id.py @@ -9,8 +9,10 @@ class ConfigurablePropAirtableBaseId(UniversalBaseModel): - type: typing.Literal["$.airtable.baseId"] = "$.airtable.baseId" - app_prop: typing_extensions.Annotated[str, FieldMetadata(alias="appProp")] = pydantic.Field() + type: typing.Optional[typing.Literal["$.airtable.baseId"]] = None + app_prop: typing_extensions.Annotated[typing.Optional[str], FieldMetadata(alias="appProp")] = pydantic.Field( + default=None + ) """ The name of the app prop that provides Airtable authentication """ diff --git a/src/pipedream/types/configurable_prop_airtable_field_id.py b/src/pipedream/types/configurable_prop_airtable_field_id.py index f9bc3a3..51844f5 100644 --- a/src/pipedream/types/configurable_prop_airtable_field_id.py +++ b/src/pipedream/types/configurable_prop_airtable_field_id.py @@ -9,8 +9,10 @@ class ConfigurablePropAirtableFieldId(UniversalBaseModel): - type: typing.Literal["$.airtable.fieldId"] = "$.airtable.fieldId" - table_id_prop: typing_extensions.Annotated[str, FieldMetadata(alias="tableIdProp")] = pydantic.Field() + type: typing.Optional[typing.Literal["$.airtable.fieldId"]] = None + table_id_prop: typing_extensions.Annotated[typing.Optional[str], FieldMetadata(alias="tableIdProp")] = ( + pydantic.Field(default=None) + ) """ The name of the prop that provides the Airtable table ID """ diff --git a/src/pipedream/types/configurable_prop_airtable_table_id.py b/src/pipedream/types/configurable_prop_airtable_table_id.py index 4124a1e..819a13c 100644 --- a/src/pipedream/types/configurable_prop_airtable_table_id.py +++ b/src/pipedream/types/configurable_prop_airtable_table_id.py @@ -9,8 +9,10 @@ class ConfigurablePropAirtableTableId(UniversalBaseModel): - type: typing.Literal["$.airtable.tableId"] = "$.airtable.tableId" - base_id_prop: typing_extensions.Annotated[str, FieldMetadata(alias="baseIdProp")] = pydantic.Field() + type: typing.Optional[typing.Literal["$.airtable.tableId"]] = None + base_id_prop: typing_extensions.Annotated[typing.Optional[str], FieldMetadata(alias="baseIdProp")] = pydantic.Field( + default=None + ) """ The name of the prop that provides the Airtable base ID """ diff --git a/src/pipedream/types/configurable_prop_airtable_view_id.py b/src/pipedream/types/configurable_prop_airtable_view_id.py index 02bf679..af771e3 100644 --- a/src/pipedream/types/configurable_prop_airtable_view_id.py +++ b/src/pipedream/types/configurable_prop_airtable_view_id.py @@ -9,8 +9,10 @@ class ConfigurablePropAirtableViewId(UniversalBaseModel): - type: typing.Literal["$.airtable.viewId"] = "$.airtable.viewId" - table_id_prop: typing_extensions.Annotated[str, FieldMetadata(alias="tableIdProp")] = pydantic.Field() + type: typing.Optional[typing.Literal["$.airtable.viewId"]] = None + table_id_prop: typing_extensions.Annotated[typing.Optional[str], FieldMetadata(alias="tableIdProp")] = ( + pydantic.Field(default=None) + ) """ The name of the prop that provides the Airtable table ID """ diff --git a/src/pipedream/types/configurable_prop_alert.py b/src/pipedream/types/configurable_prop_alert.py index f0eff88..acd7ea7 100644 --- a/src/pipedream/types/configurable_prop_alert.py +++ b/src/pipedream/types/configurable_prop_alert.py @@ -10,11 +10,11 @@ class ConfigurablePropAlert(UniversalBaseModel): - type: typing.Literal["alert"] = "alert" + type: typing.Optional[typing.Literal["alert"]] = None alert_type: typing_extensions.Annotated[ typing.Optional[ConfigurablePropAlertType], FieldMetadata(alias="alertType") ] = None - content: str = pydantic.Field() + content: typing.Optional[str] = pydantic.Field(default=None) """ The content of the alert, which can include HTML or plain text. """ diff --git a/src/pipedream/types/configurable_prop_any.py b/src/pipedream/types/configurable_prop_any.py index 2b1fe36..aed6dd5 100644 --- a/src/pipedream/types/configurable_prop_any.py +++ b/src/pipedream/types/configurable_prop_any.py @@ -9,7 +9,7 @@ class ConfigurablePropAny(UniversalBaseModel): - type: typing.Literal["any"] = "any" + type: typing.Optional[typing.Literal["any"]] = 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_app.py b/src/pipedream/types/configurable_prop_app.py index 514dbfa..8c1d154 100644 --- a/src/pipedream/types/configurable_prop_app.py +++ b/src/pipedream/types/configurable_prop_app.py @@ -9,8 +9,8 @@ class ConfigurablePropApp(UniversalBaseModel): - type: typing.Literal["app"] = "app" - app: str = pydantic.Field() + type: typing.Optional[typing.Literal["app"]] = None + app: typing.Optional[str] = pydantic.Field(default=None) """ The name slug of the app, e.g. 'github', 'slack', etc. This is used to identify the app for which the account is being configured. """ diff --git a/src/pipedream/types/configurable_prop_apphook.py b/src/pipedream/types/configurable_prop_apphook.py index a2688c2..8dedabf 100644 --- a/src/pipedream/types/configurable_prop_apphook.py +++ b/src/pipedream/types/configurable_prop_apphook.py @@ -9,8 +9,10 @@ class ConfigurablePropApphook(UniversalBaseModel): - type: typing.Literal["$.interface.apphook"] = "$.interface.apphook" - app_prop: typing_extensions.Annotated[str, FieldMetadata(alias="appProp")] = pydantic.Field() + type: typing.Optional[typing.Literal["$.interface.apphook"]] = None + app_prop: typing_extensions.Annotated[typing.Optional[str], FieldMetadata(alias="appProp")] = pydantic.Field( + default=None + ) """ The name of the app prop that this apphook depends on """ diff --git a/src/pipedream/types/configurable_prop_boolean.py b/src/pipedream/types/configurable_prop_boolean.py index 79c8bc5..eda5c42 100644 --- a/src/pipedream/types/configurable_prop_boolean.py +++ b/src/pipedream/types/configurable_prop_boolean.py @@ -9,12 +9,7 @@ class ConfigurablePropBoolean(UniversalBaseModel): - type: typing.Literal["boolean"] = "boolean" - default: typing.Optional[bool] = pydantic.Field(default=None) - """ - The default value for this prop - """ - + type: typing.Optional[typing.Literal["boolean"]] = 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_db.py b/src/pipedream/types/configurable_prop_db.py index 63bbf57..0f28108 100644 --- a/src/pipedream/types/configurable_prop_db.py +++ b/src/pipedream/types/configurable_prop_db.py @@ -9,7 +9,7 @@ class ConfigurablePropDb(UniversalBaseModel): - type: typing.Literal["$.service.db"] = "$.service.db" + type: typing.Optional[typing.Literal["$.service.db"]] = 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_discord.py b/src/pipedream/types/configurable_prop_discord.py index a8e26a6..a1a8fb2 100644 --- a/src/pipedream/types/configurable_prop_discord.py +++ b/src/pipedream/types/configurable_prop_discord.py @@ -9,7 +9,7 @@ class ConfigurablePropDiscord(UniversalBaseModel): - type: typing.Literal["$.discord.channel"] = "$.discord.channel" + type: typing.Optional[typing.Literal["$.discord.channel"]] = 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_discord_channel.py b/src/pipedream/types/configurable_prop_discord_channel.py index 358f0a7..8da21a2 100644 --- a/src/pipedream/types/configurable_prop_discord_channel.py +++ b/src/pipedream/types/configurable_prop_discord_channel.py @@ -9,8 +9,10 @@ class ConfigurablePropDiscordChannel(UniversalBaseModel): - type: typing.Literal["$.discord.channel"] = "$.discord.channel" - app_prop: typing_extensions.Annotated[str, FieldMetadata(alias="appProp")] = pydantic.Field() + type: typing.Optional[typing.Literal["$.discord.channel"]] = None + app_prop: typing_extensions.Annotated[typing.Optional[str], FieldMetadata(alias="appProp")] = pydantic.Field( + default=None + ) """ The name of the app prop that provides Discord authentication """ diff --git a/src/pipedream/types/configurable_prop_discord_channel_array.py b/src/pipedream/types/configurable_prop_discord_channel_array.py index 3e3cb64..b67a467 100644 --- a/src/pipedream/types/configurable_prop_discord_channel_array.py +++ b/src/pipedream/types/configurable_prop_discord_channel_array.py @@ -9,7 +9,7 @@ class ConfigurablePropDiscordChannelArray(UniversalBaseModel): - type: typing.Literal["$.discord.channel[]"] = "$.discord.channel[]" + type: typing.Optional[typing.Literal["$.discord.channel[]"]] = None app_prop: typing_extensions.Annotated[typing.Optional[str], FieldMetadata(alias="appProp")] = pydantic.Field( default=None ) diff --git a/src/pipedream/types/configurable_prop_http.py b/src/pipedream/types/configurable_prop_http.py index 18eb86d..37e98dd 100644 --- a/src/pipedream/types/configurable_prop_http.py +++ b/src/pipedream/types/configurable_prop_http.py @@ -9,7 +9,7 @@ class ConfigurablePropHttp(UniversalBaseModel): - type: typing.Literal["$.interface.http"] = "$.interface.http" + type: typing.Optional[typing.Literal["$.interface.http"]] = None custom_response: typing_extensions.Annotated[typing.Optional[bool], FieldMetadata(alias="customResponse")] = ( pydantic.Field(default=None) ) diff --git a/src/pipedream/types/configurable_prop_integer.py b/src/pipedream/types/configurable_prop_integer.py index 557a182..8ffdd1b 100644 --- a/src/pipedream/types/configurable_prop_integer.py +++ b/src/pipedream/types/configurable_prop_integer.py @@ -9,7 +9,7 @@ class ConfigurablePropInteger(UniversalBaseModel): - type: typing.Literal["integer"] = "integer" + type: typing.Optional[typing.Literal["integer"]] = None min: typing.Optional[int] = pydantic.Field(default=None) """ The minimum value for this integer prop. diff --git a/src/pipedream/types/configurable_prop_integer_array.py b/src/pipedream/types/configurable_prop_integer_array.py index d06dd4a..a50d899 100644 --- a/src/pipedream/types/configurable_prop_integer_array.py +++ b/src/pipedream/types/configurable_prop_integer_array.py @@ -9,7 +9,7 @@ class ConfigurablePropIntegerArray(UniversalBaseModel): - type: typing.Literal["integer[]"] = "integer[]" + type: typing.Optional[typing.Literal["integer[]"]] = None min: typing.Optional[int] = pydantic.Field(default=None) """ The minimum value for integers in this array diff --git a/src/pipedream/types/configurable_prop_object.py b/src/pipedream/types/configurable_prop_object.py index f4c6cb2..0bc4e66 100644 --- a/src/pipedream/types/configurable_prop_object.py +++ b/src/pipedream/types/configurable_prop_object.py @@ -9,7 +9,7 @@ class ConfigurablePropObject(UniversalBaseModel): - type: typing.Literal["object"] = "object" + type: typing.Optional[typing.Literal["object"]] = 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_sql.py b/src/pipedream/types/configurable_prop_sql.py index 1537845..f41481d 100644 --- a/src/pipedream/types/configurable_prop_sql.py +++ b/src/pipedream/types/configurable_prop_sql.py @@ -10,7 +10,7 @@ class ConfigurablePropSql(UniversalBaseModel): - type: typing.Literal["sql"] = "sql" + type: typing.Optional[typing.Literal["sql"]] = None auth: typing.Optional[ConfigurablePropSqlAuth] = None default: typing.Optional[str] = pydantic.Field(default=None) """ diff --git a/src/pipedream/types/configurable_prop_string.py b/src/pipedream/types/configurable_prop_string.py index 2aa20b3..1b8fc0d 100644 --- a/src/pipedream/types/configurable_prop_string.py +++ b/src/pipedream/types/configurable_prop_string.py @@ -9,12 +9,7 @@ class ConfigurablePropString(UniversalBaseModel): - type: typing.Literal["string"] = "string" - default: typing.Optional[str] = pydantic.Field(default=None) - """ - The default value for this prop - """ - + type: typing.Optional[typing.Literal["string"]] = None secret: typing.Optional[bool] = pydantic.Field(default=None) """ If true, this prop is a secret and should not be displayed in plain text. diff --git a/src/pipedream/types/configurable_prop_string_array.py b/src/pipedream/types/configurable_prop_string_array.py index ecc8766..558ec33 100644 --- a/src/pipedream/types/configurable_prop_string_array.py +++ b/src/pipedream/types/configurable_prop_string_array.py @@ -9,12 +9,7 @@ class ConfigurablePropStringArray(UniversalBaseModel): - type: typing.Literal["string[]"] = "string[]" - default: typing.Optional[typing.List[str]] = pydantic.Field(default=None) - """ - The default value for this prop - """ - + type: typing.Optional[typing.Literal["string[]"]] = None secret: typing.Optional[bool] = pydantic.Field(default=None) """ If true, this prop is a secret and should not be displayed in plain text. diff --git a/src/pipedream/types/configurable_prop_timer.py b/src/pipedream/types/configurable_prop_timer.py index 34da42c..7d472bf 100644 --- a/src/pipedream/types/configurable_prop_timer.py +++ b/src/pipedream/types/configurable_prop_timer.py @@ -12,7 +12,7 @@ class ConfigurablePropTimer(UniversalBaseModel): - type: typing.Literal["$.interface.timer"] = "$.interface.timer" + type: typing.Optional[typing.Literal["$.interface.timer"]] = None static: typing.Optional[ConfigurablePropTimerStatic] = None default: typing.Optional[ConfigurablePropTimerDefault] = None options: typing.Optional[typing.List[typing.Optional[ConfigurablePropTimerOption]]] = pydantic.Field(default=None) diff --git a/src/pipedream/types/configurable_prop_type.py b/src/pipedream/types/configurable_prop_type.py deleted file mode 100644 index f87ec6d..0000000 --- a/src/pipedream/types/configurable_prop_type.py +++ /dev/null @@ -1,29 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -ConfigurablePropType = typing.Union[ - typing.Literal[ - "$.airtable.baseId", - "$.airtable.fieldId", - "$.airtable.tableId", - "$.airtable.viewId", - "$.discord.channel", - "$.interface.apphook", - "$.interface.http", - "$.interface.timer", - "$.service.db", - "alert", - "any", - "app", - "boolean", - "data_store", - "dir", - "http_request", - "integer", - "object", - "sql", - "string", - ], - typing.Any, -] diff --git a/src/pipedream/types/configure_prop_options.py b/src/pipedream/types/configure_prop_options.py deleted file mode 100644 index 2200a16..0000000 --- a/src/pipedream/types/configure_prop_options.py +++ /dev/null @@ -1,7 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -from .configure_prop_options_item import ConfigurePropOptionsItem - -ConfigurePropOptions = typing.Optional[typing.List[ConfigurePropOptionsItem]] diff --git a/src/pipedream/types/configure_prop_options_item.py b/src/pipedream/types/configure_prop_options_item.py deleted file mode 100644 index c413487..0000000 --- a/src/pipedream/types/configure_prop_options_item.py +++ /dev/null @@ -1,8 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -from .prop_option import PropOption -from .prop_option_nested import PropOptionNested - -ConfigurePropOptionsItem = typing.Union[PropOption, PropOptionNested] diff --git a/src/pipedream/types/configure_prop_opts.py b/src/pipedream/types/configure_prop_opts.py index 2566173..f24a4e0 100644 --- a/src/pipedream/types/configure_prop_opts.py +++ b/src/pipedream/types/configure_prop_opts.py @@ -4,7 +4,6 @@ import pydantic from ..core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel -from .configured_props import ConfiguredProps class ConfigurePropOpts(UniversalBaseModel): @@ -32,7 +31,11 @@ class ConfigurePropOpts(UniversalBaseModel): Whether this operation should block until completion """ - configured_props: typing.Optional[ConfiguredProps] = None + configured_props: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = pydantic.Field(default=None) + """ + The configured properties for the component + """ + dynamic_props_id: typing.Optional[str] = pydantic.Field(default=None) """ The ID for dynamic props diff --git a/src/pipedream/types/configure_prop_response.py b/src/pipedream/types/configure_prop_response.py index 188645d..c2423d9 100644 --- a/src/pipedream/types/configure_prop_response.py +++ b/src/pipedream/types/configure_prop_response.py @@ -4,8 +4,7 @@ import pydantic from ..core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel -from .configure_prop_options import ConfigurePropOptions -from .observation import Observation +from .prop_option import PropOption class ConfigurePropResponse(UniversalBaseModel): @@ -13,13 +12,21 @@ class ConfigurePropResponse(UniversalBaseModel): Response received after configuring a component's prop """ - options: typing.Optional[ConfigurePropOptions] = None + options: typing.Optional[typing.List[PropOption]] = pydantic.Field(default=None) + """ + Available options (with labels) for the configured prop + """ + string_options: typing.Optional[typing.List[str]] = pydantic.Field(default=None) """ Available options for the configured prop """ - observations: typing.Optional[typing.List[Observation]] = None + observations: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = pydantic.Field(default=None) + """ + Any logs produced during the configuration of the prop + """ + context: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = pydantic.Field(default=None) """ New context after configuring the prop diff --git a/src/pipedream/types/configured_prop_value.py b/src/pipedream/types/configured_prop_value.py deleted file mode 100644 index 0266ac2..0000000 --- a/src/pipedream/types/configured_prop_value.py +++ /dev/null @@ -1,23 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -from .configured_prop_value_any import ConfiguredPropValueAny -from .configured_prop_value_app import ConfiguredPropValueApp -from .configured_prop_value_boolean import ConfiguredPropValueBoolean -from .configured_prop_value_integer import ConfiguredPropValueInteger -from .configured_prop_value_object import ConfiguredPropValueObject -from .configured_prop_value_sql import ConfiguredPropValueSql -from .configured_prop_value_string import ConfiguredPropValueString -from .configured_prop_value_string_array import ConfiguredPropValueStringArray - -ConfiguredPropValue = typing.Union[ - ConfiguredPropValueAny, - ConfiguredPropValueApp, - ConfiguredPropValueBoolean, - ConfiguredPropValueInteger, - ConfiguredPropValueObject, - ConfiguredPropValueSql, - ConfiguredPropValueString, - ConfiguredPropValueStringArray, -] diff --git a/src/pipedream/types/configured_prop_value_any.py b/src/pipedream/types/configured_prop_value_any.py deleted file mode 100644 index 98361e0..0000000 --- a/src/pipedream/types/configured_prop_value_any.py +++ /dev/null @@ -1,5 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -ConfiguredPropValueAny = typing.Optional[typing.Any] diff --git a/src/pipedream/types/configured_prop_value_boolean.py b/src/pipedream/types/configured_prop_value_boolean.py deleted file mode 100644 index 9d6f6e1..0000000 --- a/src/pipedream/types/configured_prop_value_boolean.py +++ /dev/null @@ -1,3 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -ConfiguredPropValueBoolean = bool diff --git a/src/pipedream/types/configured_prop_value_integer.py b/src/pipedream/types/configured_prop_value_integer.py deleted file mode 100644 index 600d5e2..0000000 --- a/src/pipedream/types/configured_prop_value_integer.py +++ /dev/null @@ -1,3 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -ConfiguredPropValueInteger = float diff --git a/src/pipedream/types/configured_prop_value_object.py b/src/pipedream/types/configured_prop_value_object.py deleted file mode 100644 index 3cab1eb..0000000 --- a/src/pipedream/types/configured_prop_value_object.py +++ /dev/null @@ -1,5 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -ConfiguredPropValueObject = typing.Dict[str, typing.Optional[typing.Any]] diff --git a/src/pipedream/types/configured_prop_value_sql.py b/src/pipedream/types/configured_prop_value_sql.py deleted file mode 100644 index 81eb9ad..0000000 --- a/src/pipedream/types/configured_prop_value_sql.py +++ /dev/null @@ -1,41 +0,0 @@ -# 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 ConfiguredPropValueSql(UniversalBaseModel): - value: str = pydantic.Field() - """ - The raw SQL query, as provided by the user - """ - - query: str = pydantic.Field() - """ - The SQL query to execute - """ - - params: typing.List[str] = pydantic.Field() - """ - The list of parameters for the prepared statement - """ - - use_prepared_statements: typing_extensions.Annotated[bool, FieldMetadata(alias="usePreparedStatements")] = ( - pydantic.Field() - ) - """ - Whether to use prepared statements for the query or not - """ - - 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/configured_prop_value_string.py b/src/pipedream/types/configured_prop_value_string.py deleted file mode 100644 index 1bbe935..0000000 --- a/src/pipedream/types/configured_prop_value_string.py +++ /dev/null @@ -1,3 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -ConfiguredPropValueString = str diff --git a/src/pipedream/types/configured_prop_value_string_array.py b/src/pipedream/types/configured_prop_value_string_array.py deleted file mode 100644 index 45af143..0000000 --- a/src/pipedream/types/configured_prop_value_string_array.py +++ /dev/null @@ -1,5 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -ConfiguredPropValueStringArray = typing.List[str] diff --git a/src/pipedream/types/configured_props.py b/src/pipedream/types/configured_props.py deleted file mode 100644 index 230b292..0000000 --- a/src/pipedream/types/configured_props.py +++ /dev/null @@ -1,7 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -from .configured_prop_value import ConfiguredPropValue - -ConfiguredProps = typing.Dict[str, ConfiguredPropValue] diff --git a/src/pipedream/types/deployed_component.py b/src/pipedream/types/deployed_component.py index 9cbbe8a..7413f3f 100644 --- a/src/pipedream/types/deployed_component.py +++ b/src/pipedream/types/deployed_component.py @@ -5,7 +5,6 @@ import pydantic from ..core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel from .configurable_prop import ConfigurableProp -from .configured_props import ConfiguredProps class DeployedComponent(UniversalBaseModel): @@ -33,7 +32,11 @@ class DeployedComponent(UniversalBaseModel): The configurable properties of the component """ - configured_props: ConfiguredProps + configured_props: typing.Dict[str, typing.Optional[typing.Any]] = pydantic.Field() + """ + The configured properties of the component + """ + active: bool = pydantic.Field() """ Whether the deployed component is active diff --git a/src/pipedream/types/observation.py b/src/pipedream/types/observation.py deleted file mode 100644 index 83235d3..0000000 --- a/src/pipedream/types/observation.py +++ /dev/null @@ -1,38 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -import pydantic -from ..core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel -from .observation_error import ObservationError - - -class Observation(UniversalBaseModel): - """ - Any logs produced during the configuration of the prop - """ - - err: typing.Optional[ObservationError] = None - k: str = pydantic.Field() - """ - The source of the log (e.g. `console.log`) - """ - - msg: typing.Optional[str] = pydantic.Field(default=None) - """ - The log message - """ - - ts: float = pydantic.Field() - """ - The time at which the log was produced, as milliseconds since the epoch - """ - - 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/observation_error.py b/src/pipedream/types/observation_error.py deleted file mode 100644 index 11ada30..0000000 --- a/src/pipedream/types/observation_error.py +++ /dev/null @@ -1,36 +0,0 @@ -# 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 ObservationError(UniversalBaseModel): - """ - Details about an observed error message - """ - - name: typing.Optional[str] = pydantic.Field(default=None) - """ - The name of the error/exception - """ - - message: typing.Optional[str] = pydantic.Field(default=None) - """ - The error message - """ - - stack: typing.Optional[str] = pydantic.Field(default=None) - """ - The stack trace of the error - """ - - 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/prop_option_nested.py b/src/pipedream/types/prop_option_nested.py deleted file mode 100644 index 806bf7c..0000000 --- a/src/pipedream/types/prop_option_nested.py +++ /dev/null @@ -1,26 +0,0 @@ -# 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 -from .prop_option import PropOption - - -class PropOptionNested(UniversalBaseModel): - """ - A configuration option for a component's prop (nested under `__lv`) - """ - - lv: typing_extensions.Annotated[PropOption, FieldMetadata(alias="__lv")] - - 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/reload_props_opts.py b/src/pipedream/types/reload_props_opts.py index 124eb34..909833f 100644 --- a/src/pipedream/types/reload_props_opts.py +++ b/src/pipedream/types/reload_props_opts.py @@ -4,7 +4,6 @@ import pydantic from ..core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel -from .configured_props import ConfiguredProps class ReloadPropsOpts(UniversalBaseModel): @@ -27,7 +26,11 @@ class ReloadPropsOpts(UniversalBaseModel): Whether this operation should block until completion """ - configured_props: typing.Optional[ConfiguredProps] = None + configured_props: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = pydantic.Field(default=None) + """ + The configured properties for the component + """ + dynamic_props_id: typing.Optional[str] = pydantic.Field(default=None) """ The ID for dynamic props diff --git a/src/pipedream/types/reload_props_response.py b/src/pipedream/types/reload_props_response.py index 6a138c5..bb7e53c 100644 --- a/src/pipedream/types/reload_props_response.py +++ b/src/pipedream/types/reload_props_response.py @@ -7,7 +7,6 @@ from ..core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel from ..core.serialization import FieldMetadata from .dynamic_props import DynamicProps -from .observation import Observation class ReloadPropsResponse(UniversalBaseModel): @@ -15,7 +14,11 @@ class ReloadPropsResponse(UniversalBaseModel): Response from reloading component props """ - observations: typing.Optional[typing.List[Observation]] = None + observations: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = pydantic.Field(default=None) + """ + Any logs produced during the configuration of the prop + """ + errors: typing.Optional[typing.List[str]] = pydantic.Field(default=None) """ Any errors that occurred during configuration diff --git a/src/pipedream/types/configured_prop_value_app.py b/src/pipedream/types/too_many_requests_error_body.py similarity index 64% rename from src/pipedream/types/configured_prop_value_app.py rename to src/pipedream/types/too_many_requests_error_body.py index acafb83..bbb37ea 100644 --- a/src/pipedream/types/configured_prop_value_app.py +++ b/src/pipedream/types/too_many_requests_error_body.py @@ -3,14 +3,11 @@ import typing import pydantic -import typing_extensions from ..core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel -from ..core.serialization import FieldMetadata -from .account_id import AccountId -class ConfiguredPropValueApp(UniversalBaseModel): - auth_provision_id: typing_extensions.Annotated[AccountId, FieldMetadata(alias="authProvisionId")] +class TooManyRequestsErrorBody(UniversalBaseModel): + error: typing.Optional[str] = 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/users/raw_client.py b/src/pipedream/users/raw_client.py index 9f09157..168f71b 100644 --- a/src/pipedream/users/raw_client.py +++ b/src/pipedream/users/raw_client.py @@ -7,7 +7,9 @@ from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper from ..core.http_response import AsyncHttpResponse, HttpResponse from ..core.jsonable_encoder import jsonable_encoder +from ..core.pydantic_utilities import parse_obj_as from ..core.request_options import RequestOptions +from ..errors.too_many_requests_error import TooManyRequestsError class RawUsersClient: @@ -39,6 +41,17 @@ def delete_external_user( 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) @@ -74,6 +87,17 @@ async def delete_external_user( 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) diff --git a/tests/utils/test_query_encoding.py b/tests/utils/test_query_encoding.py index b363d84..7e4d58f 100644 --- a/tests/utils/test_query_encoding.py +++ b/tests/utils/test_query_encoding.py @@ -1,6 +1,5 @@ # This file was auto-generated by Fern from our API Definition. - from pipedream.core.query_encoder import encode_query