diff --git a/pyproject.toml b/pyproject.toml index 42da7c7..d107935 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ dynamic = ["version"] [tool.poetry] name = "pipedream" -version = "1.1.6" +version = "1.1.7" description = "" readme = "README.md" authors = [] diff --git a/src/pipedream/client.py b/src/pipedream/client.py index 4713964..a5e7e10 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 AsyncOAuthTokenProvider, OAuthTokenProvider @@ -21,6 +21,7 @@ from .deployed_triggers.client import AsyncDeployedTriggersClient, DeployedTriggersClient from .file_stash.client import AsyncFileStashClient, FileStashClient from .oauth_tokens.client import AsyncOauthTokensClient, OauthTokensClient + from .project_environment.client import AsyncProjectEnvironmentClient, ProjectEnvironmentClient from .projects.client import AsyncProjectsClient, ProjectsClient from .proxy.client import AsyncProxyClient, ProxyClient from .tokens.client import AsyncTokensClient, TokensClient @@ -188,6 +189,7 @@ def __init__( self._actions: typing.Optional[ActionsClient] = None self._triggers: typing.Optional[TriggersClient] = None self._deployed_triggers: typing.Optional[DeployedTriggersClient] = None + self._project_environment: typing.Optional[ProjectEnvironmentClient] = None self._projects: typing.Optional[ProjectsClient] = None self._file_stash: typing.Optional[FileStashClient] = None self._proxy: typing.Optional[ProxyClient] = None @@ -259,6 +261,14 @@ def deployed_triggers(self): self._deployed_triggers = DeployedTriggersClient(client_wrapper=self._client_wrapper) return self._deployed_triggers + @property + def project_environment(self): + if self._project_environment is None: + from .project_environment.client import ProjectEnvironmentClient # noqa: E402 + + self._project_environment = ProjectEnvironmentClient(client_wrapper=self._client_wrapper) + return self._project_environment + @property def projects(self): if self._projects is None: @@ -468,6 +478,7 @@ def __init__( self._actions: typing.Optional[AsyncActionsClient] = None self._triggers: typing.Optional[AsyncTriggersClient] = None self._deployed_triggers: typing.Optional[AsyncDeployedTriggersClient] = None + self._project_environment: typing.Optional[AsyncProjectEnvironmentClient] = None self._projects: typing.Optional[AsyncProjectsClient] = None self._file_stash: typing.Optional[AsyncFileStashClient] = None self._proxy: typing.Optional[AsyncProxyClient] = None @@ -539,6 +550,14 @@ def deployed_triggers(self): self._deployed_triggers = AsyncDeployedTriggersClient(client_wrapper=self._client_wrapper) return self._deployed_triggers + @property + def project_environment(self): + if self._project_environment is None: + from .project_environment.client import AsyncProjectEnvironmentClient # noqa: E402 + + self._project_environment = AsyncProjectEnvironmentClient(client_wrapper=self._client_wrapper) + return self._project_environment + @property def projects(self): if self._projects is None: diff --git a/src/pipedream/core/client_wrapper.py b/src/pipedream/core/client_wrapper.py index 38c370c..8c41e9b 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.1.6", + "User-Agent": "pipedream/1.1.7", "X-Fern-Language": "Python", "X-Fern-SDK-Name": "pipedream", - "X-Fern-SDK-Version": "1.1.6", + "X-Fern-SDK-Version": "1.1.7", **(self.get_custom_headers() or {}), } if self._project_environment is not None: diff --git a/src/pipedream/deployed_triggers/client.py b/src/pipedream/deployed_triggers/client.py index 08dbc65..ad8b433 100644 --- a/src/pipedream/deployed_triggers/client.py +++ b/src/pipedream/deployed_triggers/client.py @@ -12,6 +12,7 @@ from ..types.get_trigger_webhooks_response import GetTriggerWebhooksResponse from ..types.get_trigger_workflows_response import GetTriggerWorkflowsResponse from ..types.get_triggers_response import GetTriggersResponse +from ..types.get_webhook_with_signing_key_response import GetWebhookWithSigningKeyResponse from .raw_client import AsyncRawDeployedTriggersClient, RawDeployedTriggersClient # this is used as the default value for optional parameters @@ -453,7 +454,7 @@ def update_webhooks( request_options: typing.Optional[RequestOptions] = None, ) -> GetTriggerWebhooksResponse: """ - Configure webhook URLs to receive trigger events + Configure webhook URLs to receive trigger events. `signing_key` is only returned for OAuth-authenticated requests. Parameters ---------- @@ -494,6 +495,104 @@ def update_webhooks( ) return _response.data + def retrieve_webhook( + self, + trigger_id: str, + webhook_id: str, + *, + external_user_id: str, + request_options: typing.Optional[RequestOptions] = None, + ) -> GetWebhookWithSigningKeyResponse: + """ + Retrieve a specific webhook for a deployed trigger, including its signing key + + Parameters + ---------- + trigger_id : str + + webhook_id : str + + external_user_id : str + The external user ID who owns the trigger + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + GetWebhookWithSigningKeyResponse + trigger webhook retrieved + + Examples + -------- + from pipedream import Pipedream + + client = Pipedream( + project_id="YOUR_PROJECT_ID", + project_environment="YOUR_PROJECT_ENVIRONMENT", + client_id="YOUR_CLIENT_ID", + client_secret="YOUR_CLIENT_SECRET", + ) + client.deployed_triggers.retrieve_webhook( + trigger_id="trigger_id", + webhook_id="webhook_id", + external_user_id="external_user_id", + ) + """ + _response = self._raw_client.retrieve_webhook( + trigger_id, webhook_id, external_user_id=external_user_id, request_options=request_options + ) + return _response.data + + def regenerate_webhook_signing_key( + self, + trigger_id: str, + webhook_id: str, + *, + external_user_id: str, + request_options: typing.Optional[RequestOptions] = None, + ) -> GetWebhookWithSigningKeyResponse: + """ + Regenerate the signing key for a specific webhook on a deployed trigger + + Parameters + ---------- + trigger_id : str + + webhook_id : str + + external_user_id : str + The external user ID who owns the trigger + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + GetWebhookWithSigningKeyResponse + signing key regenerated + + Examples + -------- + from pipedream import Pipedream + + client = Pipedream( + project_id="YOUR_PROJECT_ID", + project_environment="YOUR_PROJECT_ENVIRONMENT", + client_id="YOUR_CLIENT_ID", + client_secret="YOUR_CLIENT_SECRET", + ) + client.deployed_triggers.regenerate_webhook_signing_key( + trigger_id="trigger_id", + webhook_id="webhook_id", + external_user_id="external_user_id", + ) + """ + _response = self._raw_client.regenerate_webhook_signing_key( + trigger_id, webhook_id, external_user_id=external_user_id, request_options=request_options + ) + return _response.data + class AsyncDeployedTriggersClient: def __init__(self, *, client_wrapper: AsyncClientWrapper): @@ -995,7 +1094,7 @@ async def update_webhooks( request_options: typing.Optional[RequestOptions] = None, ) -> GetTriggerWebhooksResponse: """ - Configure webhook URLs to receive trigger events + Configure webhook URLs to receive trigger events. `signing_key` is only returned for OAuth-authenticated requests. Parameters ---------- @@ -1043,3 +1142,117 @@ async def main() -> None: trigger_id, external_user_id=external_user_id, webhook_urls=webhook_urls, request_options=request_options ) return _response.data + + async def retrieve_webhook( + self, + trigger_id: str, + webhook_id: str, + *, + external_user_id: str, + request_options: typing.Optional[RequestOptions] = None, + ) -> GetWebhookWithSigningKeyResponse: + """ + Retrieve a specific webhook for a deployed trigger, including its signing key + + Parameters + ---------- + trigger_id : str + + webhook_id : str + + external_user_id : str + The external user ID who owns the trigger + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + GetWebhookWithSigningKeyResponse + trigger webhook retrieved + + Examples + -------- + import asyncio + + from pipedream import AsyncPipedream + + client = AsyncPipedream( + project_id="YOUR_PROJECT_ID", + project_environment="YOUR_PROJECT_ENVIRONMENT", + client_id="YOUR_CLIENT_ID", + client_secret="YOUR_CLIENT_SECRET", + ) + + + async def main() -> None: + await client.deployed_triggers.retrieve_webhook( + trigger_id="trigger_id", + webhook_id="webhook_id", + external_user_id="external_user_id", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.retrieve_webhook( + trigger_id, webhook_id, external_user_id=external_user_id, request_options=request_options + ) + return _response.data + + async def regenerate_webhook_signing_key( + self, + trigger_id: str, + webhook_id: str, + *, + external_user_id: str, + request_options: typing.Optional[RequestOptions] = None, + ) -> GetWebhookWithSigningKeyResponse: + """ + Regenerate the signing key for a specific webhook on a deployed trigger + + Parameters + ---------- + trigger_id : str + + webhook_id : str + + external_user_id : str + The external user ID who owns the trigger + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + GetWebhookWithSigningKeyResponse + signing key regenerated + + Examples + -------- + import asyncio + + from pipedream import AsyncPipedream + + client = AsyncPipedream( + project_id="YOUR_PROJECT_ID", + project_environment="YOUR_PROJECT_ENVIRONMENT", + client_id="YOUR_CLIENT_ID", + client_secret="YOUR_CLIENT_SECRET", + ) + + + async def main() -> None: + await client.deployed_triggers.regenerate_webhook_signing_key( + trigger_id="trigger_id", + webhook_id="webhook_id", + external_user_id="external_user_id", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.regenerate_webhook_signing_key( + trigger_id, webhook_id, external_user_id=external_user_id, request_options=request_options + ) + return _response.data diff --git a/src/pipedream/deployed_triggers/raw_client.py b/src/pipedream/deployed_triggers/raw_client.py index 63b6847..8c79783 100644 --- a/src/pipedream/deployed_triggers/raw_client.py +++ b/src/pipedream/deployed_triggers/raw_client.py @@ -21,6 +21,7 @@ from ..types.get_trigger_webhooks_response import GetTriggerWebhooksResponse from ..types.get_trigger_workflows_response import GetTriggerWorkflowsResponse from ..types.get_triggers_response import GetTriggersResponse +from ..types.get_webhook_with_signing_key_response import GetWebhookWithSigningKeyResponse # this is used as the default value for optional parameters OMIT = typing.cast(typing.Any, ...) @@ -573,7 +574,7 @@ def update_webhooks( request_options: typing.Optional[RequestOptions] = None, ) -> HttpResponse[GetTriggerWebhooksResponse]: """ - Configure webhook URLs to receive trigger events + Configure webhook URLs to receive trigger events. `signing_key` is only returned for OAuth-authenticated requests. Parameters ---------- @@ -634,6 +635,130 @@ def update_webhooks( raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + def retrieve_webhook( + self, + trigger_id: str, + webhook_id: str, + *, + external_user_id: str, + request_options: typing.Optional[RequestOptions] = None, + ) -> HttpResponse[GetWebhookWithSigningKeyResponse]: + """ + Retrieve a specific webhook for a deployed trigger, including its signing key + + Parameters + ---------- + trigger_id : str + + webhook_id : str + + external_user_id : str + The external user ID who owns the trigger + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[GetWebhookWithSigningKeyResponse] + trigger webhook retrieved + """ + _response = self._client_wrapper.httpx_client.request( + f"v1/connect/{jsonable_encoder(self._client_wrapper._project_id)}/deployed-triggers/{jsonable_encoder(trigger_id)}/webhooks/{jsonable_encoder(webhook_id)}", + method="GET", + params={ + "external_user_id": external_user_id, + }, + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + GetWebhookWithSigningKeyResponse, + parse_obj_as( + type_=GetWebhookWithSigningKeyResponse, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 429: + raise TooManyRequestsError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + parse_obj_as( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + def regenerate_webhook_signing_key( + self, + trigger_id: str, + webhook_id: str, + *, + external_user_id: str, + request_options: typing.Optional[RequestOptions] = None, + ) -> HttpResponse[GetWebhookWithSigningKeyResponse]: + """ + Regenerate the signing key for a specific webhook on a deployed trigger + + Parameters + ---------- + trigger_id : str + + webhook_id : str + + external_user_id : str + The external user ID who owns the trigger + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[GetWebhookWithSigningKeyResponse] + signing key regenerated + """ + _response = self._client_wrapper.httpx_client.request( + f"v1/connect/{jsonable_encoder(self._client_wrapper._project_id)}/deployed-triggers/{jsonable_encoder(trigger_id)}/webhooks/{jsonable_encoder(webhook_id)}/regenerate_signing_key", + method="POST", + params={ + "external_user_id": external_user_id, + }, + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + GetWebhookWithSigningKeyResponse, + parse_obj_as( + type_=GetWebhookWithSigningKeyResponse, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 429: + raise TooManyRequestsError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + parse_obj_as( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + class AsyncRawDeployedTriggersClient: def __init__(self, *, client_wrapper: AsyncClientWrapper): @@ -1185,7 +1310,7 @@ async def update_webhooks( request_options: typing.Optional[RequestOptions] = None, ) -> AsyncHttpResponse[GetTriggerWebhooksResponse]: """ - Configure webhook URLs to receive trigger events + Configure webhook URLs to receive trigger events. `signing_key` is only returned for OAuth-authenticated requests. Parameters ---------- @@ -1245,3 +1370,127 @@ async def update_webhooks( except JSONDecodeError: raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def retrieve_webhook( + self, + trigger_id: str, + webhook_id: str, + *, + external_user_id: str, + request_options: typing.Optional[RequestOptions] = None, + ) -> AsyncHttpResponse[GetWebhookWithSigningKeyResponse]: + """ + Retrieve a specific webhook for a deployed trigger, including its signing key + + Parameters + ---------- + trigger_id : str + + webhook_id : str + + external_user_id : str + The external user ID who owns the trigger + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[GetWebhookWithSigningKeyResponse] + trigger webhook retrieved + """ + _response = await self._client_wrapper.httpx_client.request( + f"v1/connect/{jsonable_encoder(self._client_wrapper._project_id)}/deployed-triggers/{jsonable_encoder(trigger_id)}/webhooks/{jsonable_encoder(webhook_id)}", + method="GET", + params={ + "external_user_id": external_user_id, + }, + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + GetWebhookWithSigningKeyResponse, + parse_obj_as( + type_=GetWebhookWithSigningKeyResponse, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 429: + raise TooManyRequestsError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + parse_obj_as( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def regenerate_webhook_signing_key( + self, + trigger_id: str, + webhook_id: str, + *, + external_user_id: str, + request_options: typing.Optional[RequestOptions] = None, + ) -> AsyncHttpResponse[GetWebhookWithSigningKeyResponse]: + """ + Regenerate the signing key for a specific webhook on a deployed trigger + + Parameters + ---------- + trigger_id : str + + webhook_id : str + + external_user_id : str + The external user ID who owns the trigger + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[GetWebhookWithSigningKeyResponse] + signing key regenerated + """ + _response = await self._client_wrapper.httpx_client.request( + f"v1/connect/{jsonable_encoder(self._client_wrapper._project_id)}/deployed-triggers/{jsonable_encoder(trigger_id)}/webhooks/{jsonable_encoder(webhook_id)}/regenerate_signing_key", + method="POST", + params={ + "external_user_id": external_user_id, + }, + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + GetWebhookWithSigningKeyResponse, + parse_obj_as( + type_=GetWebhookWithSigningKeyResponse, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 429: + raise TooManyRequestsError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + parse_obj_as( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) diff --git a/src/pipedream/project_environment/__init__.py b/src/pipedream/project_environment/__init__.py new file mode 100644 index 0000000..5cde020 --- /dev/null +++ b/src/pipedream/project_environment/__init__.py @@ -0,0 +1,4 @@ +# This file was auto-generated by Fern from our API Definition. + +# isort: skip_file + diff --git a/src/pipedream/project_environment/client.py b/src/pipedream/project_environment/client.py new file mode 100644 index 0000000..95d9d1b --- /dev/null +++ b/src/pipedream/project_environment/client.py @@ -0,0 +1,325 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from ..core.request_options import RequestOptions +from ..types.get_webhook_response import GetWebhookResponse +from ..types.get_webhook_with_signing_key_response import GetWebhookWithSigningKeyResponse +from ..types.set_webhook_response import SetWebhookResponse +from .raw_client import AsyncRawProjectEnvironmentClient, RawProjectEnvironmentClient + +# this is used as the default value for optional parameters +OMIT = typing.cast(typing.Any, ...) + + +class ProjectEnvironmentClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._raw_client = RawProjectEnvironmentClient(client_wrapper=client_wrapper) + + @property + def with_raw_response(self) -> RawProjectEnvironmentClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + RawProjectEnvironmentClient + """ + return self._raw_client + + def retrieve_webhook(self, *, request_options: typing.Optional[RequestOptions] = None) -> GetWebhookResponse: + """ + Retrieve the webhook configured for a project environment + + Parameters + ---------- + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + GetWebhookResponse + webhook retrieved + + Examples + -------- + from pipedream import Pipedream + + client = Pipedream( + project_id="YOUR_PROJECT_ID", + project_environment="YOUR_PROJECT_ENVIRONMENT", + client_id="YOUR_CLIENT_ID", + client_secret="YOUR_CLIENT_SECRET", + ) + client.project_environment.retrieve_webhook() + """ + _response = self._raw_client.retrieve_webhook(request_options=request_options) + return _response.data + + def update_webhook( + self, *, url: str, request_options: typing.Optional[RequestOptions] = None + ) -> SetWebhookResponse: + """ + Create or update the webhook URL for a project environment. Creating a webhook returns `signing_key`; updating an existing webhook does not. + + Parameters + ---------- + url : str + The webhook URL to set + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + SetWebhookResponse + webhook updated + + Examples + -------- + from pipedream import Pipedream + + client = Pipedream( + project_id="YOUR_PROJECT_ID", + project_environment="YOUR_PROJECT_ENVIRONMENT", + client_id="YOUR_CLIENT_ID", + client_secret="YOUR_CLIENT_SECRET", + ) + client.project_environment.update_webhook( + url="url", + ) + """ + _response = self._raw_client.update_webhook(url=url, request_options=request_options) + return _response.data + + def delete_webhook(self, *, request_options: typing.Optional[RequestOptions] = None) -> None: + """ + Remove the webhook configured for a project environment + + Parameters + ---------- + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + None + + Examples + -------- + from pipedream import Pipedream + + client = Pipedream( + project_id="YOUR_PROJECT_ID", + project_environment="YOUR_PROJECT_ENVIRONMENT", + client_id="YOUR_CLIENT_ID", + client_secret="YOUR_CLIENT_SECRET", + ) + client.project_environment.delete_webhook() + """ + _response = self._raw_client.delete_webhook(request_options=request_options) + return _response.data + + def regenerate_webhook_signing_key( + self, *, request_options: typing.Optional[RequestOptions] = None + ) -> GetWebhookWithSigningKeyResponse: + """ + Regenerate the signing key for the project environment webhook + + Parameters + ---------- + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + GetWebhookWithSigningKeyResponse + signing key regenerated + + Examples + -------- + from pipedream import Pipedream + + client = Pipedream( + project_id="YOUR_PROJECT_ID", + project_environment="YOUR_PROJECT_ENVIRONMENT", + client_id="YOUR_CLIENT_ID", + client_secret="YOUR_CLIENT_SECRET", + ) + client.project_environment.regenerate_webhook_signing_key() + """ + _response = self._raw_client.regenerate_webhook_signing_key(request_options=request_options) + return _response.data + + +class AsyncProjectEnvironmentClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._raw_client = AsyncRawProjectEnvironmentClient(client_wrapper=client_wrapper) + + @property + def with_raw_response(self) -> AsyncRawProjectEnvironmentClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + AsyncRawProjectEnvironmentClient + """ + return self._raw_client + + async def retrieve_webhook(self, *, request_options: typing.Optional[RequestOptions] = None) -> GetWebhookResponse: + """ + Retrieve the webhook configured for a project environment + + Parameters + ---------- + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + GetWebhookResponse + webhook retrieved + + Examples + -------- + import asyncio + + from pipedream import AsyncPipedream + + client = AsyncPipedream( + project_id="YOUR_PROJECT_ID", + project_environment="YOUR_PROJECT_ENVIRONMENT", + client_id="YOUR_CLIENT_ID", + client_secret="YOUR_CLIENT_SECRET", + ) + + + async def main() -> None: + await client.project_environment.retrieve_webhook() + + + asyncio.run(main()) + """ + _response = await self._raw_client.retrieve_webhook(request_options=request_options) + return _response.data + + async def update_webhook( + self, *, url: str, request_options: typing.Optional[RequestOptions] = None + ) -> SetWebhookResponse: + """ + Create or update the webhook URL for a project environment. Creating a webhook returns `signing_key`; updating an existing webhook does not. + + Parameters + ---------- + url : str + The webhook URL to set + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + SetWebhookResponse + webhook updated + + Examples + -------- + import asyncio + + from pipedream import AsyncPipedream + + client = AsyncPipedream( + project_id="YOUR_PROJECT_ID", + project_environment="YOUR_PROJECT_ENVIRONMENT", + client_id="YOUR_CLIENT_ID", + client_secret="YOUR_CLIENT_SECRET", + ) + + + async def main() -> None: + await client.project_environment.update_webhook( + url="url", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.update_webhook(url=url, request_options=request_options) + return _response.data + + async def delete_webhook(self, *, request_options: typing.Optional[RequestOptions] = None) -> None: + """ + Remove the webhook configured for a project environment + + Parameters + ---------- + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + None + + Examples + -------- + import asyncio + + from pipedream import AsyncPipedream + + client = AsyncPipedream( + project_id="YOUR_PROJECT_ID", + project_environment="YOUR_PROJECT_ENVIRONMENT", + client_id="YOUR_CLIENT_ID", + client_secret="YOUR_CLIENT_SECRET", + ) + + + async def main() -> None: + await client.project_environment.delete_webhook() + + + asyncio.run(main()) + """ + _response = await self._raw_client.delete_webhook(request_options=request_options) + return _response.data + + async def regenerate_webhook_signing_key( + self, *, request_options: typing.Optional[RequestOptions] = None + ) -> GetWebhookWithSigningKeyResponse: + """ + Regenerate the signing key for the project environment webhook + + Parameters + ---------- + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + GetWebhookWithSigningKeyResponse + signing key regenerated + + Examples + -------- + import asyncio + + from pipedream import AsyncPipedream + + client = AsyncPipedream( + project_id="YOUR_PROJECT_ID", + project_environment="YOUR_PROJECT_ENVIRONMENT", + client_id="YOUR_CLIENT_ID", + client_secret="YOUR_CLIENT_SECRET", + ) + + + async def main() -> None: + await client.project_environment.regenerate_webhook_signing_key() + + + asyncio.run(main()) + """ + _response = await self._raw_client.regenerate_webhook_signing_key(request_options=request_options) + return _response.data diff --git a/src/pipedream/project_environment/raw_client.py b/src/pipedream/project_environment/raw_client.py new file mode 100644 index 0000000..5bb30a6 --- /dev/null +++ b/src/pipedream/project_environment/raw_client.py @@ -0,0 +1,406 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing +from json.decoder import JSONDecodeError + +from ..core.api_error import ApiError +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 +from ..types.get_webhook_response import GetWebhookResponse +from ..types.get_webhook_with_signing_key_response import GetWebhookWithSigningKeyResponse +from ..types.set_webhook_response import SetWebhookResponse + +# this is used as the default value for optional parameters +OMIT = typing.cast(typing.Any, ...) + + +class RawProjectEnvironmentClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._client_wrapper = client_wrapper + + def retrieve_webhook( + self, *, request_options: typing.Optional[RequestOptions] = None + ) -> HttpResponse[GetWebhookResponse]: + """ + Retrieve the webhook configured for a project environment + + Parameters + ---------- + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[GetWebhookResponse] + webhook retrieved + """ + _response = self._client_wrapper.httpx_client.request( + f"v1/connect/{jsonable_encoder(self._client_wrapper._project_id)}/webhook", + method="GET", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + GetWebhookResponse, + parse_obj_as( + type_=GetWebhookResponse, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 429: + raise TooManyRequestsError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + parse_obj_as( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + def update_webhook( + self, *, url: str, request_options: typing.Optional[RequestOptions] = None + ) -> HttpResponse[SetWebhookResponse]: + """ + Create or update the webhook URL for a project environment. Creating a webhook returns `signing_key`; updating an existing webhook does not. + + Parameters + ---------- + url : str + The webhook URL to set + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[SetWebhookResponse] + webhook updated + """ + _response = self._client_wrapper.httpx_client.request( + f"v1/connect/{jsonable_encoder(self._client_wrapper._project_id)}/webhook", + method="PUT", + json={ + "url": url, + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + SetWebhookResponse, + parse_obj_as( + type_=SetWebhookResponse, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 429: + raise TooManyRequestsError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + parse_obj_as( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + def delete_webhook(self, *, request_options: typing.Optional[RequestOptions] = None) -> HttpResponse[None]: + """ + Remove the webhook configured for a project environment + + Parameters + ---------- + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[None] + """ + _response = self._client_wrapper.httpx_client.request( + f"v1/connect/{jsonable_encoder(self._client_wrapper._project_id)}/webhook", + method="DELETE", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + return HttpResponse(response=_response, data=None) + if _response.status_code == 429: + raise TooManyRequestsError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + parse_obj_as( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + def regenerate_webhook_signing_key( + self, *, request_options: typing.Optional[RequestOptions] = None + ) -> HttpResponse[GetWebhookWithSigningKeyResponse]: + """ + Regenerate the signing key for the project environment webhook + + Parameters + ---------- + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[GetWebhookWithSigningKeyResponse] + signing key regenerated + """ + _response = self._client_wrapper.httpx_client.request( + f"v1/connect/{jsonable_encoder(self._client_wrapper._project_id)}/webhook/regenerate_signing_key", + method="POST", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + GetWebhookWithSigningKeyResponse, + parse_obj_as( + type_=GetWebhookWithSigningKeyResponse, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 429: + raise TooManyRequestsError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + parse_obj_as( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + +class AsyncRawProjectEnvironmentClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._client_wrapper = client_wrapper + + async def retrieve_webhook( + self, *, request_options: typing.Optional[RequestOptions] = None + ) -> AsyncHttpResponse[GetWebhookResponse]: + """ + Retrieve the webhook configured for a project environment + + Parameters + ---------- + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[GetWebhookResponse] + webhook retrieved + """ + _response = await self._client_wrapper.httpx_client.request( + f"v1/connect/{jsonable_encoder(self._client_wrapper._project_id)}/webhook", + method="GET", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + GetWebhookResponse, + parse_obj_as( + type_=GetWebhookResponse, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 429: + raise TooManyRequestsError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + parse_obj_as( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def update_webhook( + self, *, url: str, request_options: typing.Optional[RequestOptions] = None + ) -> AsyncHttpResponse[SetWebhookResponse]: + """ + Create or update the webhook URL for a project environment. Creating a webhook returns `signing_key`; updating an existing webhook does not. + + Parameters + ---------- + url : str + The webhook URL to set + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[SetWebhookResponse] + webhook updated + """ + _response = await self._client_wrapper.httpx_client.request( + f"v1/connect/{jsonable_encoder(self._client_wrapper._project_id)}/webhook", + method="PUT", + json={ + "url": url, + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + SetWebhookResponse, + parse_obj_as( + type_=SetWebhookResponse, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 429: + raise TooManyRequestsError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + parse_obj_as( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def delete_webhook( + self, *, request_options: typing.Optional[RequestOptions] = None + ) -> AsyncHttpResponse[None]: + """ + Remove the webhook configured for a project environment + + Parameters + ---------- + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[None] + """ + _response = await self._client_wrapper.httpx_client.request( + f"v1/connect/{jsonable_encoder(self._client_wrapper._project_id)}/webhook", + method="DELETE", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + return AsyncHttpResponse(response=_response, data=None) + if _response.status_code == 429: + raise TooManyRequestsError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + parse_obj_as( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def regenerate_webhook_signing_key( + self, *, request_options: typing.Optional[RequestOptions] = None + ) -> AsyncHttpResponse[GetWebhookWithSigningKeyResponse]: + """ + Regenerate the signing key for the project environment webhook + + Parameters + ---------- + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[GetWebhookWithSigningKeyResponse] + signing key regenerated + """ + _response = await self._client_wrapper.httpx_client.request( + f"v1/connect/{jsonable_encoder(self._client_wrapper._project_id)}/webhook/regenerate_signing_key", + method="POST", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + GetWebhookWithSigningKeyResponse, + parse_obj_as( + type_=GetWebhookWithSigningKeyResponse, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 429: + raise TooManyRequestsError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + parse_obj_as( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) diff --git a/src/pipedream/types/__init__.py b/src/pipedream/types/__init__.py index ff7e75c..e38ac0f 100644 --- a/src/pipedream/types/__init__.py +++ b/src/pipedream/types/__init__.py @@ -119,6 +119,8 @@ from .get_trigger_webhooks_response import GetTriggerWebhooksResponse from .get_trigger_workflows_response import GetTriggerWorkflowsResponse from .get_triggers_response import GetTriggersResponse + from .get_webhook_response import GetWebhookResponse + from .get_webhook_with_signing_key_response import GetWebhookWithSigningKeyResponse from .http_interface import HttpInterface from .http_request_auth import HttpRequestAuth from .http_request_auth_type import HttpRequestAuthType @@ -147,6 +149,7 @@ from .reload_props_response import ReloadPropsResponse from .run_action_opts_stash_id import RunActionOptsStashId from .run_action_response import RunActionResponse + from .set_webhook_response import SetWebhookResponse from .start_connect_opts import StartConnectOpts from .stash_id import StashId from .timer_cron import TimerCron @@ -154,7 +157,11 @@ from .timer_interval import TimerInterval from .too_many_requests_error_body import TooManyRequestsErrorBody from .tool_annotations import ToolAnnotations + from .trigger_webhook import TriggerWebhook from .validate_token_response import ValidateTokenResponse + from .webhook import Webhook + from .webhook_with_optional_signing_key import WebhookWithOptionalSigningKey + from .webhook_with_signing_key import WebhookWithSigningKey _dynamic_imports: typing.Dict[str, str] = { "Account": ".account", "AccountId": ".account_id", @@ -270,6 +277,8 @@ "GetTriggerWebhooksResponse": ".get_trigger_webhooks_response", "GetTriggerWorkflowsResponse": ".get_trigger_workflows_response", "GetTriggersResponse": ".get_triggers_response", + "GetWebhookResponse": ".get_webhook_response", + "GetWebhookWithSigningKeyResponse": ".get_webhook_with_signing_key_response", "HttpInterface": ".http_interface", "HttpRequestAuth": ".http_request_auth", "HttpRequestAuthType": ".http_request_auth_type", @@ -298,6 +307,7 @@ "ReloadPropsResponse": ".reload_props_response", "RunActionOptsStashId": ".run_action_opts_stash_id", "RunActionResponse": ".run_action_response", + "SetWebhookResponse": ".set_webhook_response", "StartConnectOpts": ".start_connect_opts", "StashId": ".stash_id", "TimerCron": ".timer_cron", @@ -305,7 +315,11 @@ "TimerInterval": ".timer_interval", "TooManyRequestsErrorBody": ".too_many_requests_error_body", "ToolAnnotations": ".tool_annotations", + "TriggerWebhook": ".trigger_webhook", "ValidateTokenResponse": ".validate_token_response", + "Webhook": ".webhook", + "WebhookWithOptionalSigningKey": ".webhook_with_optional_signing_key", + "WebhookWithSigningKey": ".webhook_with_signing_key", } @@ -445,6 +459,8 @@ def __dir__(): "GetTriggerWebhooksResponse", "GetTriggerWorkflowsResponse", "GetTriggersResponse", + "GetWebhookResponse", + "GetWebhookWithSigningKeyResponse", "HttpInterface", "HttpRequestAuth", "HttpRequestAuthType", @@ -473,6 +489,7 @@ def __dir__(): "ReloadPropsResponse", "RunActionOptsStashId", "RunActionResponse", + "SetWebhookResponse", "StartConnectOpts", "StashId", "TimerCron", @@ -480,5 +497,9 @@ def __dir__(): "TimerInterval", "TooManyRequestsErrorBody", "ToolAnnotations", + "TriggerWebhook", "ValidateTokenResponse", + "Webhook", + "WebhookWithOptionalSigningKey", + "WebhookWithSigningKey", ] diff --git a/src/pipedream/types/deployed_component.py b/src/pipedream/types/deployed_component.py index 65e60a9..62065bd 100644 --- a/src/pipedream/types/deployed_component.py +++ b/src/pipedream/types/deployed_component.py @@ -74,6 +74,11 @@ class DeployedComponent(UniversalBaseModel): Whether the trigger emits events during the deploy hook execution. When false, the $emit function is disabled during deploy hook execution. Defaults to true. """ + webhook_signing_key: typing.Optional[str] = pydantic.Field(default=None) + """ + The webhook signing key. Only returned for OAuth-authenticated requests when `webhook_url` is supplied. + """ + if IS_PYDANTIC_V2: model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 else: diff --git a/src/pipedream/types/emitter.py b/src/pipedream/types/emitter.py index b17e466..e9d575f 100644 --- a/src/pipedream/types/emitter.py +++ b/src/pipedream/types/emitter.py @@ -30,6 +30,7 @@ class Emitter_DeployedComponent(UniversalBaseModel): name_slug: str callback_observations: typing.Optional[typing.Any] = None emit_on_deploy: typing.Optional[bool] = None + webhook_signing_key: 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/types/get_trigger_webhooks_response.py b/src/pipedream/types/get_trigger_webhooks_response.py index 1cd7254..3ab2a19 100644 --- a/src/pipedream/types/get_trigger_webhooks_response.py +++ b/src/pipedream/types/get_trigger_webhooks_response.py @@ -4,6 +4,7 @@ import pydantic from ..core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel +from .trigger_webhook import TriggerWebhook class GetTriggerWebhooksResponse(UniversalBaseModel): @@ -12,6 +13,10 @@ class GetTriggerWebhooksResponse(UniversalBaseModel): """ webhook_urls: typing.List[str] + webhooks: typing.Optional[typing.List[TriggerWebhook]] = pydantic.Field(default=None) + """ + Webhook objects for the configured URLs. `signing_key` is only returned for OAuth-authenticated requests. + """ if IS_PYDANTIC_V2: model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 diff --git a/src/pipedream/types/get_webhook_response.py b/src/pipedream/types/get_webhook_response.py new file mode 100644 index 0000000..b5cace0 --- /dev/null +++ b/src/pipedream/types/get_webhook_response.py @@ -0,0 +1,24 @@ +# 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 .webhook import Webhook + + +class GetWebhookResponse(UniversalBaseModel): + """ + Response received when retrieving a webhook + """ + + data: typing.Optional[Webhook] = None + + 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/get_webhook_with_signing_key_response.py b/src/pipedream/types/get_webhook_with_signing_key_response.py new file mode 100644 index 0000000..eb48ed5 --- /dev/null +++ b/src/pipedream/types/get_webhook_with_signing_key_response.py @@ -0,0 +1,24 @@ +# 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 .webhook_with_signing_key import WebhookWithSigningKey + + +class GetWebhookWithSigningKeyResponse(UniversalBaseModel): + """ + Response received when retrieving a webhook with its signing key + """ + + data: WebhookWithSigningKey + + 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/set_webhook_response.py b/src/pipedream/types/set_webhook_response.py new file mode 100644 index 0000000..16486fe --- /dev/null +++ b/src/pipedream/types/set_webhook_response.py @@ -0,0 +1,24 @@ +# 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 .webhook_with_optional_signing_key import WebhookWithOptionalSigningKey + + +class SetWebhookResponse(UniversalBaseModel): + """ + Response received when creating or updating a webhook + """ + + data: WebhookWithOptionalSigningKey + + 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/trigger_webhook.py b/src/pipedream/types/trigger_webhook.py new file mode 100644 index 0000000..b35ccd3 --- /dev/null +++ b/src/pipedream/types/trigger_webhook.py @@ -0,0 +1,41 @@ +# 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 TriggerWebhook(UniversalBaseModel): + """ + A trigger webhook object. `signing_key` is only returned for OAuth-authenticated requests. + """ + + id: str = pydantic.Field() + """ + The unique ID of the webhook + """ + + url: str = pydantic.Field() + """ + The webhook URL + """ + + signing_key: typing.Optional[str] = pydantic.Field(default=None) + """ + The webhook signing key, returned only for OAuth-authenticated requests + """ + + signing_key_set: bool = pydantic.Field() + """ + Whether a signing key has been set for this webhook + """ + + 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/webhook.py b/src/pipedream/types/webhook.py new file mode 100644 index 0000000..162af66 --- /dev/null +++ b/src/pipedream/types/webhook.py @@ -0,0 +1,46 @@ +# 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 Webhook(UniversalBaseModel): + """ + A webhook object + """ + + id: str = pydantic.Field() + """ + The unique ID of the webhook + """ + + url: str = pydantic.Field() + """ + The webhook URL + """ + + signing_key_set: bool = pydantic.Field() + """ + Whether a signing key has been set for this webhook + """ + + created_at: int = pydantic.Field() + """ + The time the webhook was created, in epoch seconds + """ + + updated_at: int = pydantic.Field() + """ + The time the webhook was last updated, in epoch seconds + """ + + 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/webhook_with_optional_signing_key.py b/src/pipedream/types/webhook_with_optional_signing_key.py new file mode 100644 index 0000000..2711f49 --- /dev/null +++ b/src/pipedream/types/webhook_with_optional_signing_key.py @@ -0,0 +1,51 @@ +# 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 WebhookWithOptionalSigningKey(UniversalBaseModel): + """ + A webhook object that may include the signing key. The signing key is returned when a webhook is created, but omitted when an existing webhook is updated. + """ + + id: str = pydantic.Field() + """ + The unique ID of the webhook + """ + + url: str = pydantic.Field() + """ + The webhook URL + """ + + signing_key: typing.Optional[str] = pydantic.Field(default=None) + """ + The webhook signing key, when returned by the endpoint + """ + + signing_key_set: bool = pydantic.Field() + """ + Whether a signing key has been set for this webhook + """ + + created_at: int = pydantic.Field() + """ + The time the webhook was created, in epoch seconds + """ + + updated_at: int = pydantic.Field() + """ + The time the webhook was last updated, in epoch seconds + """ + + 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/webhook_with_signing_key.py b/src/pipedream/types/webhook_with_signing_key.py new file mode 100644 index 0000000..6a066b1 --- /dev/null +++ b/src/pipedream/types/webhook_with_signing_key.py @@ -0,0 +1,51 @@ +# 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 WebhookWithSigningKey(UniversalBaseModel): + """ + A webhook object including the signing key + """ + + id: str = pydantic.Field() + """ + The unique ID of the webhook + """ + + url: str = pydantic.Field() + """ + The webhook URL + """ + + signing_key: str = pydantic.Field() + """ + The webhook signing key + """ + + signing_key_set: bool = pydantic.Field() + """ + Whether a signing key has been set for this webhook + """ + + created_at: int = pydantic.Field() + """ + The time the webhook was created, in epoch seconds + """ + + updated_at: int = pydantic.Field() + """ + The time the webhook was last updated, in epoch seconds + """ + + 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