From 9ba43efeb77a1012a591a6d13aa7a936de42efa8 Mon Sep 17 00:00:00 2001 From: fern-api <115122769+fern-api[bot]@users.noreply.github.com> Date: Fri, 18 Jul 2025 16:07:19 +0000 Subject: [PATCH] SDK regeneration --- README.md | 13 +- pyproject.toml | 2 +- reference.md | 144 +++++++-------------- src/pipedream/accounts/client.py | 64 +++------ src/pipedream/accounts/raw_client.py | 26 ++-- src/pipedream/actions/client.py | 30 ++--- src/pipedream/app_categories/client.py | 12 +- src/pipedream/apps/client.py | 12 +- src/pipedream/client.py | 86 ++++-------- src/pipedream/components/client.py | 24 ++-- src/pipedream/core/client_wrapper.py | 32 ++--- src/pipedream/core/oauth_token_provider.py | 34 ----- src/pipedream/deployed_triggers/client.py | 54 +++----- src/pipedream/oauth_tokens/client.py | 6 +- src/pipedream/projects/client.py | 6 +- src/pipedream/proxy/client.py | 30 ++--- src/pipedream/tokens/client.py | 12 +- src/pipedream/triggers/client.py | 30 ++--- src/pipedream/users/client.py | 6 +- 19 files changed, 191 insertions(+), 432 deletions(-) delete mode 100644 src/pipedream/core/oauth_token_provider.py diff --git a/README.md b/README.md index 9bc8b61..4783e45 100644 --- a/README.md +++ b/README.md @@ -25,13 +25,10 @@ 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", + access_token="YOUR_ACCESS_TOKEN", ) client.accounts.create( app_slug="app_slug", - cfmap_json="cfmap_json", - connect_token="connect_token", ) ``` @@ -47,16 +44,13 @@ 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", + access_token="YOUR_ACCESS_TOKEN", ) async def main() -> None: await client.accounts.create( app_slug="app_slug", - cfmap_json="cfmap_json", - connect_token="connect_token", ) @@ -88,8 +82,7 @@ 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", + access_token="YOUR_ACCESS_TOKEN", ) response = client.apps.list() for item in response: diff --git a/pyproject.toml b/pyproject.toml index 61726ce..2dcc934 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -3,7 +3,7 @@ name = "pipedream" [tool.poetry] name = "pipedream" -version = "0.3.2" +version = "0.3.3" description = "" readme = "README.md" authors = [] diff --git a/reference.md b/reference.md index d898404..b529d20 100644 --- a/reference.md +++ b/reference.md @@ -18,8 +18,7 @@ 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", + access_token="YOUR_ACCESS_TOKEN", ) client.app_categories.list() @@ -67,8 +66,7 @@ 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", + access_token="YOUR_ACCESS_TOKEN", ) client.app_categories.retrieve( id="id", @@ -127,8 +125,7 @@ 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", + access_token="YOUR_ACCESS_TOKEN", ) response = client.apps.list() for item in response: @@ -237,8 +234,7 @@ 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", + access_token="YOUR_ACCESS_TOKEN", ) client.apps.retrieve( app_id="app_id", @@ -297,8 +293,7 @@ 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", + access_token="YOUR_ACCESS_TOKEN", ) response = client.accounts.list() for item in response: @@ -407,13 +402,10 @@ 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", + access_token="YOUR_ACCESS_TOKEN", ) client.accounts.create( app_slug="app_slug", - cfmap_json="cfmap_json", - connect_token="connect_token", ) ``` @@ -438,15 +430,7 @@ client.accounts.create(
-**cfmap_json:** `str` — JSON string containing the custom fields mapping - -
-
- -
-
- -**connect_token:** `str` — The connect token for authentication +**app_id:** `typing.Optional[str]` — The app slug or ID to filter accounts by.
@@ -454,7 +438,7 @@ client.accounts.create(
-**app_id:** `typing.Optional[str]` — The app slug or ID to filter accounts by. +**external_user_id:** `typing.Optional[str]`
@@ -462,7 +446,7 @@ client.accounts.create(
-**external_user_id:** `typing.Optional[str]` +**oauth_app_id:** `typing.Optional[str]` — The OAuth app ID to filter by, if applicable
@@ -470,7 +454,7 @@ client.accounts.create(
-**oauth_app_id:** `typing.Optional[str]` — The OAuth app ID to filter by, if applicable +**cfmap_json:** `typing.Optional[str]` — JSON string containing the custom fields mapping
@@ -516,8 +500,7 @@ 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", + access_token="YOUR_ACCESS_TOKEN", ) client.accounts.retrieve( account_id="account_id", @@ -583,8 +566,7 @@ 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", + access_token="YOUR_ACCESS_TOKEN", ) client.accounts.delete( account_id="account_id", @@ -642,8 +624,7 @@ 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", + access_token="YOUR_ACCESS_TOKEN", ) client.accounts.delete_by_app( app_id="app_id", @@ -702,8 +683,7 @@ 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", + access_token="YOUR_ACCESS_TOKEN", ) client.users.delete_external_user( external_user_id="external_user_id", @@ -762,8 +742,7 @@ 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", + access_token="YOUR_ACCESS_TOKEN", ) response = client.components.list() for item in response: @@ -856,8 +835,7 @@ 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", + access_token="YOUR_ACCESS_TOKEN", ) client.components.retrieve( component_id="component_id", @@ -915,8 +893,7 @@ 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", + access_token="YOUR_ACCESS_TOKEN", ) client.components.configure_prop( id="id", @@ -1056,8 +1033,7 @@ 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", + access_token="YOUR_ACCESS_TOKEN", ) client.components.reload_props( id="id", @@ -1165,8 +1141,7 @@ 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", + access_token="YOUR_ACCESS_TOKEN", ) response = client.actions.list() for item in response: @@ -1259,8 +1234,7 @@ 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", + access_token="YOUR_ACCESS_TOKEN", ) client.actions.retrieve( component_id="component_id", @@ -1318,8 +1292,7 @@ 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", + access_token="YOUR_ACCESS_TOKEN", ) client.actions.configure_prop( id="id", @@ -1459,8 +1432,7 @@ 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", + access_token="YOUR_ACCESS_TOKEN", ) client.actions.reload_props( id="id", @@ -1567,8 +1539,7 @@ 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", + access_token="YOUR_ACCESS_TOKEN", ) client.actions.run( id="id", @@ -1660,8 +1631,7 @@ 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", + access_token="YOUR_ACCESS_TOKEN", ) response = client.triggers.list() for item in response: @@ -1754,8 +1724,7 @@ 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", + access_token="YOUR_ACCESS_TOKEN", ) client.triggers.retrieve( component_id="component_id", @@ -1813,8 +1782,7 @@ 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", + access_token="YOUR_ACCESS_TOKEN", ) client.triggers.configure_prop( id="id", @@ -1954,8 +1922,7 @@ 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", + access_token="YOUR_ACCESS_TOKEN", ) client.triggers.reload_props( id="id", @@ -2062,8 +2029,7 @@ 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", + access_token="YOUR_ACCESS_TOKEN", ) client.triggers.deploy( id="id", @@ -2155,8 +2121,7 @@ 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", + access_token="YOUR_ACCESS_TOKEN", ) response = client.deployed_triggers.list( external_user_id="external_user_id", @@ -2243,8 +2208,7 @@ 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", + access_token="YOUR_ACCESS_TOKEN", ) client.deployed_triggers.retrieve( trigger_id="trigger_id", @@ -2311,8 +2275,7 @@ 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", + access_token="YOUR_ACCESS_TOKEN", ) client.deployed_triggers.update( trigger_id="trigger_id", @@ -2403,8 +2366,7 @@ 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", + access_token="YOUR_ACCESS_TOKEN", ) client.deployed_triggers.delete( trigger_id="trigger_id", @@ -2479,8 +2441,7 @@ 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", + access_token="YOUR_ACCESS_TOKEN", ) client.deployed_triggers.list_events( trigger_id="trigger_id", @@ -2555,8 +2516,7 @@ 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", + access_token="YOUR_ACCESS_TOKEN", ) client.deployed_triggers.list_workflows( trigger_id="trigger_id", @@ -2623,8 +2583,7 @@ 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", + access_token="YOUR_ACCESS_TOKEN", ) client.deployed_triggers.update_workflows( trigger_id="trigger_id", @@ -2700,8 +2659,7 @@ 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", + access_token="YOUR_ACCESS_TOKEN", ) client.deployed_triggers.list_webhooks( trigger_id="trigger_id", @@ -2768,8 +2726,7 @@ 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", + access_token="YOUR_ACCESS_TOKEN", ) client.deployed_triggers.update_webhooks( trigger_id="trigger_id", @@ -2846,8 +2803,7 @@ 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", + access_token="YOUR_ACCESS_TOKEN", ) client.projects.retrieve_info() @@ -2896,8 +2852,7 @@ 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", + access_token="YOUR_ACCESS_TOKEN", ) client.proxy.get( url_64="url_64", @@ -2973,8 +2928,7 @@ 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", + access_token="YOUR_ACCESS_TOKEN", ) client.proxy.post( url_64="url_64", @@ -3059,8 +3013,7 @@ 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", + access_token="YOUR_ACCESS_TOKEN", ) client.proxy.put( url_64="url_64", @@ -3145,8 +3098,7 @@ 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", + access_token="YOUR_ACCESS_TOKEN", ) client.proxy.delete( url_64="url_64", @@ -3222,8 +3174,7 @@ 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", + access_token="YOUR_ACCESS_TOKEN", ) client.proxy.patch( url_64="url_64", @@ -3309,8 +3260,7 @@ 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", + access_token="YOUR_ACCESS_TOKEN", ) client.tokens.create( external_user_id="external_user_id", @@ -3409,8 +3359,7 @@ 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", + access_token="YOUR_ACCESS_TOKEN", ) client.tokens.validate( ctok="ctok", @@ -3477,8 +3426,7 @@ 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", + access_token="YOUR_ACCESS_TOKEN", ) client.oauth_tokens.create( client_id="client_id", diff --git a/src/pipedream/accounts/client.py b/src/pipedream/accounts/client.py index b0f86bf..852dffb 100644 --- a/src/pipedream/accounts/client.py +++ b/src/pipedream/accounts/client.py @@ -77,8 +77,7 @@ def list( client = Pipedream( project_id="YOUR_PROJECT_ID", project_environment="YOUR_PROJECT_ENVIRONMENT", - client_id="YOUR_CLIENT_ID", - client_secret="YOUR_CLIENT_SECRET", + access_token="YOUR_ACCESS_TOKEN", ) response = client.accounts.list() for item in response: @@ -102,11 +101,10 @@ def create( self, *, app_slug: str, - cfmap_json: str, - connect_token: str, app_id: typing.Optional[str] = None, external_user_id: typing.Optional[str] = None, oauth_app_id: typing.Optional[str] = None, + cfmap_json: typing.Optional[str] = OMIT, name: typing.Optional[str] = OMIT, request_options: typing.Optional[RequestOptions] = None, ) -> Account: @@ -116,12 +114,6 @@ def create( app_slug : str The app slug for the account - cfmap_json : str - JSON string containing the custom fields mapping - - connect_token : str - The connect token for authentication - app_id : typing.Optional[str] The app slug or ID to filter accounts by. @@ -130,6 +122,9 @@ def create( oauth_app_id : typing.Optional[str] The OAuth app ID to filter by, if applicable + cfmap_json : typing.Optional[str] + JSON string containing the custom fields mapping + name : typing.Optional[str] Optional name for the account @@ -148,22 +143,18 @@ def create( client = Pipedream( project_id="YOUR_PROJECT_ID", project_environment="YOUR_PROJECT_ENVIRONMENT", - client_id="YOUR_CLIENT_ID", - client_secret="YOUR_CLIENT_SECRET", + access_token="YOUR_ACCESS_TOKEN", ) client.accounts.create( app_slug="app_slug", - cfmap_json="cfmap_json", - connect_token="connect_token", ) """ _response = self._raw_client.create( app_slug=app_slug, - cfmap_json=cfmap_json, - connect_token=connect_token, app_id=app_id, external_user_id=external_user_id, oauth_app_id=oauth_app_id, + cfmap_json=cfmap_json, name=name, request_options=request_options, ) @@ -199,8 +190,7 @@ def retrieve( client = Pipedream( project_id="YOUR_PROJECT_ID", project_environment="YOUR_PROJECT_ENVIRONMENT", - client_id="YOUR_CLIENT_ID", - client_secret="YOUR_CLIENT_SECRET", + access_token="YOUR_ACCESS_TOKEN", ) client.accounts.retrieve( account_id="account_id", @@ -231,8 +221,7 @@ def delete(self, account_id: str, *, request_options: typing.Optional[RequestOpt client = Pipedream( project_id="YOUR_PROJECT_ID", project_environment="YOUR_PROJECT_ENVIRONMENT", - client_id="YOUR_CLIENT_ID", - client_secret="YOUR_CLIENT_SECRET", + access_token="YOUR_ACCESS_TOKEN", ) client.accounts.delete( account_id="account_id", @@ -261,8 +250,7 @@ def delete_by_app(self, app_id: str, *, request_options: typing.Optional[Request client = Pipedream( project_id="YOUR_PROJECT_ID", project_environment="YOUR_PROJECT_ENVIRONMENT", - client_id="YOUR_CLIENT_ID", - client_secret="YOUR_CLIENT_SECRET", + access_token="YOUR_ACCESS_TOKEN", ) client.accounts.delete_by_app( app_id="app_id", @@ -339,8 +327,7 @@ async def list( client = AsyncPipedream( project_id="YOUR_PROJECT_ID", project_environment="YOUR_PROJECT_ENVIRONMENT", - client_id="YOUR_CLIENT_ID", - client_secret="YOUR_CLIENT_SECRET", + access_token="YOUR_ACCESS_TOKEN", ) @@ -371,11 +358,10 @@ async def create( self, *, app_slug: str, - cfmap_json: str, - connect_token: str, app_id: typing.Optional[str] = None, external_user_id: typing.Optional[str] = None, oauth_app_id: typing.Optional[str] = None, + cfmap_json: typing.Optional[str] = OMIT, name: typing.Optional[str] = OMIT, request_options: typing.Optional[RequestOptions] = None, ) -> Account: @@ -385,12 +371,6 @@ async def create( app_slug : str The app slug for the account - cfmap_json : str - JSON string containing the custom fields mapping - - connect_token : str - The connect token for authentication - app_id : typing.Optional[str] The app slug or ID to filter accounts by. @@ -399,6 +379,9 @@ async def create( oauth_app_id : typing.Optional[str] The OAuth app ID to filter by, if applicable + cfmap_json : typing.Optional[str] + JSON string containing the custom fields mapping + name : typing.Optional[str] Optional name for the account @@ -419,16 +402,13 @@ async def create( client = AsyncPipedream( project_id="YOUR_PROJECT_ID", project_environment="YOUR_PROJECT_ENVIRONMENT", - client_id="YOUR_CLIENT_ID", - client_secret="YOUR_CLIENT_SECRET", + access_token="YOUR_ACCESS_TOKEN", ) async def main() -> None: await client.accounts.create( app_slug="app_slug", - cfmap_json="cfmap_json", - connect_token="connect_token", ) @@ -436,11 +416,10 @@ async def main() -> None: """ _response = await self._raw_client.create( app_slug=app_slug, - cfmap_json=cfmap_json, - connect_token=connect_token, app_id=app_id, external_user_id=external_user_id, oauth_app_id=oauth_app_id, + cfmap_json=cfmap_json, name=name, request_options=request_options, ) @@ -478,8 +457,7 @@ async def retrieve( client = AsyncPipedream( project_id="YOUR_PROJECT_ID", project_environment="YOUR_PROJECT_ENVIRONMENT", - client_id="YOUR_CLIENT_ID", - client_secret="YOUR_CLIENT_SECRET", + access_token="YOUR_ACCESS_TOKEN", ) @@ -518,8 +496,7 @@ async def delete(self, account_id: str, *, request_options: typing.Optional[Requ client = AsyncPipedream( project_id="YOUR_PROJECT_ID", project_environment="YOUR_PROJECT_ENVIRONMENT", - client_id="YOUR_CLIENT_ID", - client_secret="YOUR_CLIENT_SECRET", + access_token="YOUR_ACCESS_TOKEN", ) @@ -556,8 +533,7 @@ async def delete_by_app(self, app_id: str, *, request_options: typing.Optional[R client = AsyncPipedream( project_id="YOUR_PROJECT_ID", project_environment="YOUR_PROJECT_ENVIRONMENT", - client_id="YOUR_CLIENT_ID", - client_secret="YOUR_CLIENT_SECRET", + access_token="YOUR_ACCESS_TOKEN", ) diff --git a/src/pipedream/accounts/raw_client.py b/src/pipedream/accounts/raw_client.py index 2767afd..c918c21 100644 --- a/src/pipedream/accounts/raw_client.py +++ b/src/pipedream/accounts/raw_client.py @@ -115,11 +115,10 @@ def create( self, *, app_slug: str, - cfmap_json: str, - connect_token: str, app_id: typing.Optional[str] = None, external_user_id: typing.Optional[str] = None, oauth_app_id: typing.Optional[str] = None, + cfmap_json: typing.Optional[str] = OMIT, name: typing.Optional[str] = OMIT, request_options: typing.Optional[RequestOptions] = None, ) -> HttpResponse[Account]: @@ -129,12 +128,6 @@ def create( app_slug : str The app slug for the account - cfmap_json : str - JSON string containing the custom fields mapping - - connect_token : str - The connect token for authentication - app_id : typing.Optional[str] The app slug or ID to filter accounts by. @@ -143,6 +136,9 @@ def create( oauth_app_id : typing.Optional[str] The OAuth app ID to filter by, if applicable + cfmap_json : typing.Optional[str] + JSON string containing the custom fields mapping + name : typing.Optional[str] Optional name for the account @@ -165,7 +161,6 @@ def create( json={ "app_slug": app_slug, "cfmap_json": cfmap_json, - "connect_token": connect_token, "name": name, }, headers={ @@ -391,11 +386,10 @@ async def create( self, *, app_slug: str, - cfmap_json: str, - connect_token: str, app_id: typing.Optional[str] = None, external_user_id: typing.Optional[str] = None, oauth_app_id: typing.Optional[str] = None, + cfmap_json: typing.Optional[str] = OMIT, name: typing.Optional[str] = OMIT, request_options: typing.Optional[RequestOptions] = None, ) -> AsyncHttpResponse[Account]: @@ -405,12 +399,6 @@ async def create( app_slug : str The app slug for the account - cfmap_json : str - JSON string containing the custom fields mapping - - connect_token : str - The connect token for authentication - app_id : typing.Optional[str] The app slug or ID to filter accounts by. @@ -419,6 +407,9 @@ async def create( oauth_app_id : typing.Optional[str] The OAuth app ID to filter by, if applicable + cfmap_json : typing.Optional[str] + JSON string containing the custom fields mapping + name : typing.Optional[str] Optional name for the account @@ -441,7 +432,6 @@ async def create( json={ "app_slug": app_slug, "cfmap_json": cfmap_json, - "connect_token": connect_token, "name": name, }, headers={ diff --git a/src/pipedream/actions/client.py b/src/pipedream/actions/client.py index ad8161a..8afcd6f 100644 --- a/src/pipedream/actions/client.py +++ b/src/pipedream/actions/client.py @@ -73,8 +73,7 @@ def list( client = Pipedream( project_id="YOUR_PROJECT_ID", project_environment="YOUR_PROJECT_ENVIRONMENT", - client_id="YOUR_CLIENT_ID", - client_secret="YOUR_CLIENT_SECRET", + access_token="YOUR_ACCESS_TOKEN", ) response = client.actions.list() for item in response: @@ -109,8 +108,7 @@ def retrieve(self, component_id: str, *, request_options: typing.Optional[Reques client = Pipedream( project_id="YOUR_PROJECT_ID", project_environment="YOUR_PROJECT_ENVIRONMENT", - client_id="YOUR_CLIENT_ID", - client_secret="YOUR_CLIENT_SECRET", + access_token="YOUR_ACCESS_TOKEN", ) client.actions.retrieve( component_id="component_id", @@ -185,8 +183,7 @@ def configure_prop( client = Pipedream( project_id="YOUR_PROJECT_ID", project_environment="YOUR_PROJECT_ENVIRONMENT", - client_id="YOUR_CLIENT_ID", - client_secret="YOUR_CLIENT_SECRET", + access_token="YOUR_ACCESS_TOKEN", ) client.actions.configure_prop( id="id", @@ -260,8 +257,7 @@ def reload_props( client = Pipedream( project_id="YOUR_PROJECT_ID", project_environment="YOUR_PROJECT_ENVIRONMENT", - client_id="YOUR_CLIENT_ID", - client_secret="YOUR_CLIENT_SECRET", + access_token="YOUR_ACCESS_TOKEN", ) client.actions.reload_props( id="id", @@ -322,8 +318,7 @@ def run( client = Pipedream( project_id="YOUR_PROJECT_ID", project_environment="YOUR_PROJECT_ENVIRONMENT", - client_id="YOUR_CLIENT_ID", - client_secret="YOUR_CLIENT_SECRET", + access_token="YOUR_ACCESS_TOKEN", ) client.actions.run( id="id", @@ -401,8 +396,7 @@ async def list( client = AsyncPipedream( project_id="YOUR_PROJECT_ID", project_environment="YOUR_PROJECT_ENVIRONMENT", - client_id="YOUR_CLIENT_ID", - client_secret="YOUR_CLIENT_SECRET", + access_token="YOUR_ACCESS_TOKEN", ) @@ -448,8 +442,7 @@ async def retrieve( client = AsyncPipedream( project_id="YOUR_PROJECT_ID", project_environment="YOUR_PROJECT_ENVIRONMENT", - client_id="YOUR_CLIENT_ID", - client_secret="YOUR_CLIENT_SECRET", + access_token="YOUR_ACCESS_TOKEN", ) @@ -532,8 +525,7 @@ async def configure_prop( client = AsyncPipedream( project_id="YOUR_PROJECT_ID", project_environment="YOUR_PROJECT_ENVIRONMENT", - client_id="YOUR_CLIENT_ID", - client_secret="YOUR_CLIENT_SECRET", + access_token="YOUR_ACCESS_TOKEN", ) @@ -615,8 +607,7 @@ async def reload_props( client = AsyncPipedream( project_id="YOUR_PROJECT_ID", project_environment="YOUR_PROJECT_ENVIRONMENT", - client_id="YOUR_CLIENT_ID", - client_secret="YOUR_CLIENT_SECRET", + access_token="YOUR_ACCESS_TOKEN", ) @@ -685,8 +676,7 @@ async def run( client = AsyncPipedream( project_id="YOUR_PROJECT_ID", project_environment="YOUR_PROJECT_ENVIRONMENT", - client_id="YOUR_CLIENT_ID", - client_secret="YOUR_CLIENT_SECRET", + access_token="YOUR_ACCESS_TOKEN", ) diff --git a/src/pipedream/app_categories/client.py b/src/pipedream/app_categories/client.py index ba55a1b..b470a5c 100644 --- a/src/pipedream/app_categories/client.py +++ b/src/pipedream/app_categories/client.py @@ -43,8 +43,7 @@ def list(self, *, request_options: typing.Optional[RequestOptions] = None) -> Li client = Pipedream( project_id="YOUR_PROJECT_ID", project_environment="YOUR_PROJECT_ENVIRONMENT", - client_id="YOUR_CLIENT_ID", - client_secret="YOUR_CLIENT_SECRET", + access_token="YOUR_ACCESS_TOKEN", ) client.app_categories.list() """ @@ -73,8 +72,7 @@ def retrieve(self, id: str, *, request_options: typing.Optional[RequestOptions] client = Pipedream( project_id="YOUR_PROJECT_ID", project_environment="YOUR_PROJECT_ENVIRONMENT", - client_id="YOUR_CLIENT_ID", - client_secret="YOUR_CLIENT_SECRET", + access_token="YOUR_ACCESS_TOKEN", ) client.app_categories.retrieve( id="id", @@ -120,8 +118,7 @@ async def list(self, *, request_options: typing.Optional[RequestOptions] = None) client = AsyncPipedream( project_id="YOUR_PROJECT_ID", project_environment="YOUR_PROJECT_ENVIRONMENT", - client_id="YOUR_CLIENT_ID", - client_secret="YOUR_CLIENT_SECRET", + access_token="YOUR_ACCESS_TOKEN", ) @@ -160,8 +157,7 @@ async def retrieve( client = AsyncPipedream( project_id="YOUR_PROJECT_ID", project_environment="YOUR_PROJECT_ENVIRONMENT", - client_id="YOUR_CLIENT_ID", - client_secret="YOUR_CLIENT_SECRET", + access_token="YOUR_ACCESS_TOKEN", ) diff --git a/src/pipedream/apps/client.py b/src/pipedream/apps/client.py index 30d994c..4ed8535 100644 --- a/src/pipedream/apps/client.py +++ b/src/pipedream/apps/client.py @@ -78,8 +78,7 @@ def list( client = Pipedream( project_id="YOUR_PROJECT_ID", project_environment="YOUR_PROJECT_ENVIRONMENT", - client_id="YOUR_CLIENT_ID", - client_secret="YOUR_CLIENT_SECRET", + access_token="YOUR_ACCESS_TOKEN", ) response = client.apps.list() for item in response: @@ -121,8 +120,7 @@ def retrieve(self, app_id: str, *, request_options: typing.Optional[RequestOptio client = Pipedream( project_id="YOUR_PROJECT_ID", project_environment="YOUR_PROJECT_ENVIRONMENT", - client_id="YOUR_CLIENT_ID", - client_secret="YOUR_CLIENT_SECRET", + access_token="YOUR_ACCESS_TOKEN", ) client.apps.retrieve( app_id="app_id", @@ -200,8 +198,7 @@ async def list( client = AsyncPipedream( project_id="YOUR_PROJECT_ID", project_environment="YOUR_PROJECT_ENVIRONMENT", - client_id="YOUR_CLIENT_ID", - client_secret="YOUR_CLIENT_SECRET", + access_token="YOUR_ACCESS_TOKEN", ) @@ -252,8 +249,7 @@ async def retrieve(self, app_id: str, *, request_options: typing.Optional[Reques client = AsyncPipedream( project_id="YOUR_PROJECT_ID", project_environment="YOUR_PROJECT_ENVIRONMENT", - client_id="YOUR_CLIENT_ID", - client_secret="YOUR_CLIENT_SECRET", + access_token="YOUR_ACCESS_TOKEN", ) diff --git a/src/pipedream/client.py b/src/pipedream/client.py index 24d3539..aa94198 100644 --- a/src/pipedream/client.py +++ b/src/pipedream/client.py @@ -4,15 +4,13 @@ import typing import httpx -from .types.project_environment import ProjectEnvironment +from ._.types.project_environment import ProjectEnvironment from .accounts.client import AccountsClient, AsyncAccountsClient from .actions.client import ActionsClient, AsyncActionsClient from .app_categories.client import AppCategoriesClient, AsyncAppCategoriesClient from .apps.client import AppsClient, AsyncAppsClient from .components.client import AsyncComponentsClient, ComponentsClient -from .core.api_error import ApiError from .core.client_wrapper import AsyncClientWrapper, SyncClientWrapper -from .core.oauth_token_provider import OAuthTokenProvider from .deployed_triggers.client import AsyncDeployedTriggersClient, DeployedTriggersClient from .environment import PipedreamEnvironment from .oauth_tokens.client import AsyncOauthTokensClient, OauthTokensClient @@ -43,9 +41,10 @@ class Client: project_id : str project_environment : typing.Optional[ProjectEnvironment] - client_id : typing.Optional[str] - client_secret : typing.Optional[str] - _token_getter_override : typing.Optional[typing.Callable[[], str]] + access_token : typing.Optional[typing.Union[str, typing.Callable[[], str]]] + headers : typing.Optional[typing.Dict[str, str]] + Additional headers to send with every request. + timeout : typing.Optional[float] The timeout to be used, in seconds, for requests. By default the timeout is 60 seconds, unless a custom httpx client is used, in which case this default is not enforced. @@ -62,8 +61,7 @@ class Client: client = Pipedream( project_id="YOUR_PROJECT_ID", project_environment="YOUR_PROJECT_ENVIRONMENT", - client_id="YOUR_CLIENT_ID", - client_secret="YOUR_CLIENT_SECRET", + access_token="YOUR_ACCESS_TOKEN", ) """ @@ -74,9 +72,10 @@ def __init__( environment: PipedreamEnvironment = PipedreamEnvironment.PROD, project_id: str, project_environment: typing.Optional[ProjectEnvironment] = os.getenv("PIPEDREAM_PROJECT_ENVIRONMENT"), - client_id: typing.Optional[str] = os.getenv("PIPEDREAM_CLIENT_ID"), - client_secret: typing.Optional[str] = os.getenv("PIPEDREAM_CLIENT_SECRET"), - _token_getter_override: typing.Optional[typing.Callable[[], str]] = None, + access_token: typing.Optional[typing.Union[str, typing.Callable[[], str]]] = os.getenv( + "PIPEDREAM_ACCESS_TOKEN" + ), + headers: typing.Optional[typing.Dict[str, str]] = None, timeout: typing.Optional[float] = None, follow_redirects: typing.Optional[bool] = True, httpx_client: typing.Optional[httpx.Client] = None, @@ -84,32 +83,12 @@ def __init__( _defaulted_timeout = ( timeout if timeout is not None else 60 if httpx_client is None else httpx_client.timeout.read ) - if client_id is None: - raise ApiError( - body="The client must be instantiated be either passing in client_id or setting PIPEDREAM_CLIENT_ID" - ) - if client_secret is None: - raise ApiError( - body="The client must be instantiated be either passing in client_secret or setting PIPEDREAM_CLIENT_SECRET" - ) - oauth_token_provider = OAuthTokenProvider( - client_id=client_id, - client_secret=client_secret, - client_wrapper=SyncClientWrapper( - base_url=_get_base_url(base_url=base_url, environment=environment), - project_id=project_id, - project_environment=project_environment, - httpx_client=httpx.Client(timeout=_defaulted_timeout, follow_redirects=follow_redirects) - if follow_redirects is not None - else httpx.Client(timeout=_defaulted_timeout), - timeout=_defaulted_timeout, - ), - ) self._client_wrapper = SyncClientWrapper( base_url=_get_base_url(base_url=base_url, environment=environment), project_id=project_id, project_environment=project_environment, - token=_token_getter_override if _token_getter_override is not None else oauth_token_provider.get_token, + access_token=access_token, + headers=headers, httpx_client=httpx_client if httpx_client is not None else httpx.Client(timeout=_defaulted_timeout, follow_redirects=follow_redirects) @@ -151,9 +130,10 @@ class AsyncClient: project_id : str project_environment : typing.Optional[ProjectEnvironment] - client_id : typing.Optional[str] - client_secret : typing.Optional[str] - _token_getter_override : typing.Optional[typing.Callable[[], str]] + access_token : typing.Optional[typing.Union[str, typing.Callable[[], str]]] + headers : typing.Optional[typing.Dict[str, str]] + Additional headers to send with every request. + timeout : typing.Optional[float] The timeout to be used, in seconds, for requests. By default the timeout is 60 seconds, unless a custom httpx client is used, in which case this default is not enforced. @@ -170,8 +150,7 @@ class AsyncClient: client = AsyncPipedream( project_id="YOUR_PROJECT_ID", project_environment="YOUR_PROJECT_ENVIRONMENT", - client_id="YOUR_CLIENT_ID", - client_secret="YOUR_CLIENT_SECRET", + access_token="YOUR_ACCESS_TOKEN", ) """ @@ -182,9 +161,10 @@ def __init__( environment: PipedreamEnvironment = PipedreamEnvironment.PROD, project_id: str, project_environment: typing.Optional[ProjectEnvironment] = os.getenv("PIPEDREAM_PROJECT_ENVIRONMENT"), - client_id: typing.Optional[str] = os.getenv("PIPEDREAM_CLIENT_ID"), - client_secret: typing.Optional[str] = os.getenv("PIPEDREAM_CLIENT_SECRET"), - _token_getter_override: typing.Optional[typing.Callable[[], str]] = None, + access_token: typing.Optional[typing.Union[str, typing.Callable[[], str]]] = os.getenv( + "PIPEDREAM_ACCESS_TOKEN" + ), + headers: typing.Optional[typing.Dict[str, str]] = None, timeout: typing.Optional[float] = None, follow_redirects: typing.Optional[bool] = True, httpx_client: typing.Optional[httpx.AsyncClient] = None, @@ -192,32 +172,12 @@ def __init__( _defaulted_timeout = ( timeout if timeout is not None else 60 if httpx_client is None else httpx_client.timeout.read ) - if client_id is None: - raise ApiError( - body="The client must be instantiated be either passing in client_id or setting PIPEDREAM_CLIENT_ID" - ) - if client_secret is None: - raise ApiError( - body="The client must be instantiated be either passing in client_secret or setting PIPEDREAM_CLIENT_SECRET" - ) - oauth_token_provider = OAuthTokenProvider( - client_id=client_id, - client_secret=client_secret, - client_wrapper=SyncClientWrapper( - base_url=_get_base_url(base_url=base_url, environment=environment), - project_id=project_id, - project_environment=project_environment, - httpx_client=httpx.Client(timeout=_defaulted_timeout, follow_redirects=follow_redirects) - if follow_redirects is not None - else httpx.Client(timeout=_defaulted_timeout), - timeout=_defaulted_timeout, - ), - ) self._client_wrapper = AsyncClientWrapper( base_url=_get_base_url(base_url=base_url, environment=environment), project_id=project_id, project_environment=project_environment, - token=_token_getter_override if _token_getter_override is not None else oauth_token_provider.get_token, + access_token=access_token, + headers=headers, httpx_client=httpx_client if httpx_client is not None else httpx.AsyncClient(timeout=_defaulted_timeout, follow_redirects=follow_redirects) diff --git a/src/pipedream/components/client.py b/src/pipedream/components/client.py index f7fcbca..f5a99ed 100644 --- a/src/pipedream/components/client.py +++ b/src/pipedream/components/client.py @@ -72,8 +72,7 @@ def list( client = Pipedream( project_id="YOUR_PROJECT_ID", project_environment="YOUR_PROJECT_ENVIRONMENT", - client_id="YOUR_CLIENT_ID", - client_secret="YOUR_CLIENT_SECRET", + access_token="YOUR_ACCESS_TOKEN", ) response = client.components.list() for item in response: @@ -108,8 +107,7 @@ def retrieve(self, component_id: str, *, request_options: typing.Optional[Reques client = Pipedream( project_id="YOUR_PROJECT_ID", project_environment="YOUR_PROJECT_ENVIRONMENT", - client_id="YOUR_CLIENT_ID", - client_secret="YOUR_CLIENT_SECRET", + access_token="YOUR_ACCESS_TOKEN", ) client.components.retrieve( component_id="component_id", @@ -184,8 +182,7 @@ def configure_prop( client = Pipedream( project_id="YOUR_PROJECT_ID", project_environment="YOUR_PROJECT_ENVIRONMENT", - client_id="YOUR_CLIENT_ID", - client_secret="YOUR_CLIENT_SECRET", + access_token="YOUR_ACCESS_TOKEN", ) client.components.configure_prop( id="id", @@ -259,8 +256,7 @@ def reload_props( client = Pipedream( project_id="YOUR_PROJECT_ID", project_environment="YOUR_PROJECT_ENVIRONMENT", - client_id="YOUR_CLIENT_ID", - client_secret="YOUR_CLIENT_SECRET", + access_token="YOUR_ACCESS_TOKEN", ) client.components.reload_props( id="id", @@ -340,8 +336,7 @@ async def list( client = AsyncPipedream( project_id="YOUR_PROJECT_ID", project_environment="YOUR_PROJECT_ENVIRONMENT", - client_id="YOUR_CLIENT_ID", - client_secret="YOUR_CLIENT_SECRET", + access_token="YOUR_ACCESS_TOKEN", ) @@ -387,8 +382,7 @@ async def retrieve( client = AsyncPipedream( project_id="YOUR_PROJECT_ID", project_environment="YOUR_PROJECT_ENVIRONMENT", - client_id="YOUR_CLIENT_ID", - client_secret="YOUR_CLIENT_SECRET", + access_token="YOUR_ACCESS_TOKEN", ) @@ -471,8 +465,7 @@ async def configure_prop( client = AsyncPipedream( project_id="YOUR_PROJECT_ID", project_environment="YOUR_PROJECT_ENVIRONMENT", - client_id="YOUR_CLIENT_ID", - client_secret="YOUR_CLIENT_SECRET", + access_token="YOUR_ACCESS_TOKEN", ) @@ -554,8 +547,7 @@ async def reload_props( client = AsyncPipedream( project_id="YOUR_PROJECT_ID", project_environment="YOUR_PROJECT_ENVIRONMENT", - client_id="YOUR_CLIENT_ID", - client_secret="YOUR_CLIENT_SECRET", + access_token="YOUR_ACCESS_TOKEN", ) diff --git a/src/pipedream/core/client_wrapper.py b/src/pipedream/core/client_wrapper.py index 5cbb73a..9d63a69 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 @@ -13,38 +13,38 @@ def __init__( *, project_id: str, project_environment: typing.Optional[ProjectEnvironment] = None, - token: typing.Optional[typing.Union[str, typing.Callable[[], str]]] = None, + access_token: typing.Optional[typing.Union[str, typing.Callable[[], str]]] = None, headers: typing.Optional[typing.Dict[str, str]] = None, base_url: str, timeout: typing.Optional[float] = None, ): self._project_id = project_id self._project_environment = project_environment - self._token = token + self._access_token = access_token self._headers = headers self._base_url = base_url self._timeout = timeout def get_headers(self) -> typing.Dict[str, str]: headers: typing.Dict[str, str] = { - "User-Agent": "pipedream/0.3.2", + "User-Agent": "pipedream/0.3.3", "X-Fern-Language": "Python", "X-Fern-SDK-Name": "pipedream", - "X-Fern-SDK-Version": "0.3.2", + "X-Fern-SDK-Version": "0.3.3", **(self.get_custom_headers() or {}), } if self._project_environment is not None: headers["x-pd-environment"] = self._project_environment - token = self._get_token() - if token is not None: - headers["Authorization"] = f"Bearer {token}" + access_token = self._get_access_token() + if access_token is not None: + headers["Authorization"] = f"Bearer {access_token}" return headers - def _get_token(self) -> typing.Optional[str]: - if isinstance(self._token, str) or self._token is None: - return self._token + def _get_access_token(self) -> typing.Optional[str]: + if isinstance(self._access_token, str) or self._access_token is None: + return self._access_token else: - return self._token() + return self._access_token() def get_custom_headers(self) -> typing.Optional[typing.Dict[str, str]]: return self._headers @@ -62,7 +62,7 @@ def __init__( *, project_id: str, project_environment: typing.Optional[ProjectEnvironment] = None, - token: typing.Optional[typing.Union[str, typing.Callable[[], str]]] = None, + access_token: typing.Optional[typing.Union[str, typing.Callable[[], str]]] = None, headers: typing.Optional[typing.Dict[str, str]] = None, base_url: str, timeout: typing.Optional[float] = None, @@ -71,7 +71,7 @@ def __init__( super().__init__( project_id=project_id, project_environment=project_environment, - token=token, + access_token=access_token, headers=headers, base_url=base_url, timeout=timeout, @@ -90,7 +90,7 @@ def __init__( *, project_id: str, project_environment: typing.Optional[ProjectEnvironment] = None, - token: typing.Optional[typing.Union[str, typing.Callable[[], str]]] = None, + access_token: typing.Optional[typing.Union[str, typing.Callable[[], str]]] = None, headers: typing.Optional[typing.Dict[str, str]] = None, base_url: str, timeout: typing.Optional[float] = None, @@ -99,7 +99,7 @@ def __init__( super().__init__( project_id=project_id, project_environment=project_environment, - token=token, + access_token=access_token, headers=headers, base_url=base_url, timeout=timeout, diff --git a/src/pipedream/core/oauth_token_provider.py b/src/pipedream/core/oauth_token_provider.py deleted file mode 100644 index c158e70..0000000 --- a/src/pipedream/core/oauth_token_provider.py +++ /dev/null @@ -1,34 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import datetime as dt -import typing - -from ..oauth_tokens.client import OauthTokensClient -from .client_wrapper import SyncClientWrapper - - -class OAuthTokenProvider: - BUFFER_IN_MINUTES = 2 - - def __init__(self, *, client_id: str, client_secret: str, client_wrapper: SyncClientWrapper): - self._client_id = client_id - self._client_secret = client_secret - self._access_token: typing.Optional[str] = None - self._expires_at: dt.datetime = dt.datetime.now() - self._auth_client = OauthTokensClient(client_wrapper=client_wrapper) - - def get_token(self) -> str: - if self._access_token and self._expires_at > dt.datetime.now(): - return self._access_token - return self._refresh() - - def _refresh(self) -> str: - token_response = self._auth_client.create(client_id=self._client_id, client_secret=self._client_secret) - self._access_token = token_response.access_token - self._expires_at = self._get_expires_at( - expires_in_seconds=token_response.expires_in, buffer_in_minutes=self.BUFFER_IN_MINUTES - ) - return self._access_token - - def _get_expires_at(self, *, expires_in_seconds: int, buffer_in_minutes: int): - return dt.datetime.now() + dt.timedelta(seconds=expires_in_seconds) - dt.timedelta(minutes=buffer_in_minutes) diff --git a/src/pipedream/deployed_triggers/client.py b/src/pipedream/deployed_triggers/client.py index dd6c23f..bd7a275 100644 --- a/src/pipedream/deployed_triggers/client.py +++ b/src/pipedream/deployed_triggers/client.py @@ -69,8 +69,7 @@ def list( client = Pipedream( project_id="YOUR_PROJECT_ID", project_environment="YOUR_PROJECT_ENVIRONMENT", - client_id="YOUR_CLIENT_ID", - client_secret="YOUR_CLIENT_SECRET", + access_token="YOUR_ACCESS_TOKEN", ) response = client.deployed_triggers.list( external_user_id="external_user_id", @@ -111,8 +110,7 @@ def retrieve( client = Pipedream( project_id="YOUR_PROJECT_ID", project_environment="YOUR_PROJECT_ENVIRONMENT", - client_id="YOUR_CLIENT_ID", - client_secret="YOUR_CLIENT_SECRET", + access_token="YOUR_ACCESS_TOKEN", ) client.deployed_triggers.retrieve( trigger_id="trigger_id", @@ -166,8 +164,7 @@ def update( client = Pipedream( project_id="YOUR_PROJECT_ID", project_environment="YOUR_PROJECT_ENVIRONMENT", - client_id="YOUR_CLIENT_ID", - client_secret="YOUR_CLIENT_SECRET", + access_token="YOUR_ACCESS_TOKEN", ) client.deployed_triggers.update( trigger_id="trigger_id", @@ -217,8 +214,7 @@ def delete( client = Pipedream( project_id="YOUR_PROJECT_ID", project_environment="YOUR_PROJECT_ENVIRONMENT", - client_id="YOUR_CLIENT_ID", - client_secret="YOUR_CLIENT_SECRET", + access_token="YOUR_ACCESS_TOKEN", ) client.deployed_triggers.delete( trigger_id="trigger_id", @@ -267,8 +263,7 @@ def list_events( client = Pipedream( project_id="YOUR_PROJECT_ID", project_environment="YOUR_PROJECT_ENVIRONMENT", - client_id="YOUR_CLIENT_ID", - client_secret="YOUR_CLIENT_SECRET", + access_token="YOUR_ACCESS_TOKEN", ) client.deployed_triggers.list_events( trigger_id="trigger_id", @@ -306,8 +301,7 @@ def list_workflows( client = Pipedream( project_id="YOUR_PROJECT_ID", project_environment="YOUR_PROJECT_ENVIRONMENT", - client_id="YOUR_CLIENT_ID", - client_secret="YOUR_CLIENT_SECRET", + access_token="YOUR_ACCESS_TOKEN", ) client.deployed_triggers.list_workflows( trigger_id="trigger_id", @@ -353,8 +347,7 @@ def update_workflows( client = Pipedream( project_id="YOUR_PROJECT_ID", project_environment="YOUR_PROJECT_ENVIRONMENT", - client_id="YOUR_CLIENT_ID", - client_secret="YOUR_CLIENT_SECRET", + access_token="YOUR_ACCESS_TOKEN", ) client.deployed_triggers.update_workflows( trigger_id="trigger_id", @@ -393,8 +386,7 @@ def list_webhooks( client = Pipedream( project_id="YOUR_PROJECT_ID", project_environment="YOUR_PROJECT_ENVIRONMENT", - client_id="YOUR_CLIENT_ID", - client_secret="YOUR_CLIENT_SECRET", + access_token="YOUR_ACCESS_TOKEN", ) client.deployed_triggers.list_webhooks( trigger_id="trigger_id", @@ -440,8 +432,7 @@ def update_webhooks( client = Pipedream( project_id="YOUR_PROJECT_ID", project_environment="YOUR_PROJECT_ENVIRONMENT", - client_id="YOUR_CLIENT_ID", - client_secret="YOUR_CLIENT_SECRET", + access_token="YOUR_ACCESS_TOKEN", ) client.deployed_triggers.update_webhooks( trigger_id="trigger_id", @@ -511,8 +502,7 @@ async def list( client = AsyncPipedream( project_id="YOUR_PROJECT_ID", project_environment="YOUR_PROJECT_ENVIRONMENT", - client_id="YOUR_CLIENT_ID", - client_secret="YOUR_CLIENT_SECRET", + access_token="YOUR_ACCESS_TOKEN", ) @@ -562,8 +552,7 @@ async def retrieve( client = AsyncPipedream( project_id="YOUR_PROJECT_ID", project_environment="YOUR_PROJECT_ENVIRONMENT", - client_id="YOUR_CLIENT_ID", - client_secret="YOUR_CLIENT_SECRET", + access_token="YOUR_ACCESS_TOKEN", ) @@ -625,8 +614,7 @@ async def update( client = AsyncPipedream( project_id="YOUR_PROJECT_ID", project_environment="YOUR_PROJECT_ENVIRONMENT", - client_id="YOUR_CLIENT_ID", - client_secret="YOUR_CLIENT_SECRET", + access_token="YOUR_ACCESS_TOKEN", ) @@ -684,8 +672,7 @@ async def delete( client = AsyncPipedream( project_id="YOUR_PROJECT_ID", project_environment="YOUR_PROJECT_ENVIRONMENT", - client_id="YOUR_CLIENT_ID", - client_secret="YOUR_CLIENT_SECRET", + access_token="YOUR_ACCESS_TOKEN", ) @@ -742,8 +729,7 @@ async def list_events( client = AsyncPipedream( project_id="YOUR_PROJECT_ID", project_environment="YOUR_PROJECT_ENVIRONMENT", - client_id="YOUR_CLIENT_ID", - client_secret="YOUR_CLIENT_SECRET", + access_token="YOUR_ACCESS_TOKEN", ) @@ -789,8 +775,7 @@ async def list_workflows( client = AsyncPipedream( project_id="YOUR_PROJECT_ID", project_environment="YOUR_PROJECT_ENVIRONMENT", - client_id="YOUR_CLIENT_ID", - client_secret="YOUR_CLIENT_SECRET", + access_token="YOUR_ACCESS_TOKEN", ) @@ -844,8 +829,7 @@ async def update_workflows( client = AsyncPipedream( project_id="YOUR_PROJECT_ID", project_environment="YOUR_PROJECT_ENVIRONMENT", - client_id="YOUR_CLIENT_ID", - client_secret="YOUR_CLIENT_SECRET", + access_token="YOUR_ACCESS_TOKEN", ) @@ -892,8 +876,7 @@ async def list_webhooks( client = AsyncPipedream( project_id="YOUR_PROJECT_ID", project_environment="YOUR_PROJECT_ENVIRONMENT", - client_id="YOUR_CLIENT_ID", - client_secret="YOUR_CLIENT_SECRET", + access_token="YOUR_ACCESS_TOKEN", ) @@ -947,8 +930,7 @@ async def update_webhooks( client = AsyncPipedream( project_id="YOUR_PROJECT_ID", project_environment="YOUR_PROJECT_ENVIRONMENT", - client_id="YOUR_CLIENT_ID", - client_secret="YOUR_CLIENT_SECRET", + access_token="YOUR_ACCESS_TOKEN", ) diff --git a/src/pipedream/oauth_tokens/client.py b/src/pipedream/oauth_tokens/client.py index 19a4a39..c41e608 100644 --- a/src/pipedream/oauth_tokens/client.py +++ b/src/pipedream/oauth_tokens/client.py @@ -51,8 +51,7 @@ def create( client = Pipedream( project_id="YOUR_PROJECT_ID", project_environment="YOUR_PROJECT_ENVIRONMENT", - client_id="YOUR_CLIENT_ID", - client_secret="YOUR_CLIENT_SECRET", + access_token="YOUR_ACCESS_TOKEN", ) client.oauth_tokens.create( client_id="client_id", @@ -107,8 +106,7 @@ async def create( client = AsyncPipedream( project_id="YOUR_PROJECT_ID", project_environment="YOUR_PROJECT_ENVIRONMENT", - client_id="YOUR_CLIENT_ID", - client_secret="YOUR_CLIENT_SECRET", + access_token="YOUR_ACCESS_TOKEN", ) diff --git a/src/pipedream/projects/client.py b/src/pipedream/projects/client.py index 8ea3273..8e832f9 100644 --- a/src/pipedream/projects/client.py +++ b/src/pipedream/projects/client.py @@ -42,8 +42,7 @@ def retrieve_info(self, *, request_options: typing.Optional[RequestOptions] = No client = Pipedream( project_id="YOUR_PROJECT_ID", project_environment="YOUR_PROJECT_ENVIRONMENT", - client_id="YOUR_CLIENT_ID", - client_secret="YOUR_CLIENT_SECRET", + access_token="YOUR_ACCESS_TOKEN", ) client.projects.retrieve_info() """ @@ -87,8 +86,7 @@ async def retrieve_info(self, *, request_options: typing.Optional[RequestOptions client = AsyncPipedream( project_id="YOUR_PROJECT_ID", project_environment="YOUR_PROJECT_ENVIRONMENT", - client_id="YOUR_CLIENT_ID", - client_secret="YOUR_CLIENT_SECRET", + access_token="YOUR_ACCESS_TOKEN", ) diff --git a/src/pipedream/proxy/client.py b/src/pipedream/proxy/client.py index fe2d96b..b085e8b 100644 --- a/src/pipedream/proxy/client.py +++ b/src/pipedream/proxy/client.py @@ -60,8 +60,7 @@ def get( client = Pipedream( project_id="YOUR_PROJECT_ID", project_environment="YOUR_PROJECT_ENVIRONMENT", - client_id="YOUR_CLIENT_ID", - client_secret="YOUR_CLIENT_SECRET", + access_token="YOUR_ACCESS_TOKEN", ) client.proxy.get( url_64="url_64", @@ -112,8 +111,7 @@ def post( client = Pipedream( project_id="YOUR_PROJECT_ID", project_environment="YOUR_PROJECT_ENVIRONMENT", - client_id="YOUR_CLIENT_ID", - client_secret="YOUR_CLIENT_SECRET", + access_token="YOUR_ACCESS_TOKEN", ) client.proxy.post( url_64="url_64", @@ -169,8 +167,7 @@ def put( client = Pipedream( project_id="YOUR_PROJECT_ID", project_environment="YOUR_PROJECT_ENVIRONMENT", - client_id="YOUR_CLIENT_ID", - client_secret="YOUR_CLIENT_SECRET", + access_token="YOUR_ACCESS_TOKEN", ) client.proxy.put( url_64="url_64", @@ -223,8 +220,7 @@ def delete( client = Pipedream( project_id="YOUR_PROJECT_ID", project_environment="YOUR_PROJECT_ENVIRONMENT", - client_id="YOUR_CLIENT_ID", - client_secret="YOUR_CLIENT_SECRET", + access_token="YOUR_ACCESS_TOKEN", ) client.proxy.delete( url_64="url_64", @@ -275,8 +271,7 @@ def patch( client = Pipedream( project_id="YOUR_PROJECT_ID", project_environment="YOUR_PROJECT_ENVIRONMENT", - client_id="YOUR_CLIENT_ID", - client_secret="YOUR_CLIENT_SECRET", + access_token="YOUR_ACCESS_TOKEN", ) client.proxy.patch( url_64="url_64", @@ -347,8 +342,7 @@ async def get( client = AsyncPipedream( project_id="YOUR_PROJECT_ID", project_environment="YOUR_PROJECT_ENVIRONMENT", - client_id="YOUR_CLIENT_ID", - client_secret="YOUR_CLIENT_SECRET", + access_token="YOUR_ACCESS_TOKEN", ) @@ -407,8 +401,7 @@ async def post( client = AsyncPipedream( project_id="YOUR_PROJECT_ID", project_environment="YOUR_PROJECT_ENVIRONMENT", - client_id="YOUR_CLIENT_ID", - client_secret="YOUR_CLIENT_SECRET", + access_token="YOUR_ACCESS_TOKEN", ) @@ -472,8 +465,7 @@ async def put( client = AsyncPipedream( project_id="YOUR_PROJECT_ID", project_environment="YOUR_PROJECT_ENVIRONMENT", - client_id="YOUR_CLIENT_ID", - client_secret="YOUR_CLIENT_SECRET", + access_token="YOUR_ACCESS_TOKEN", ) @@ -534,8 +526,7 @@ async def delete( client = AsyncPipedream( project_id="YOUR_PROJECT_ID", project_environment="YOUR_PROJECT_ENVIRONMENT", - client_id="YOUR_CLIENT_ID", - client_secret="YOUR_CLIENT_SECRET", + access_token="YOUR_ACCESS_TOKEN", ) @@ -594,8 +585,7 @@ async def patch( client = AsyncPipedream( project_id="YOUR_PROJECT_ID", project_environment="YOUR_PROJECT_ENVIRONMENT", - client_id="YOUR_CLIENT_ID", - client_secret="YOUR_CLIENT_SECRET", + access_token="YOUR_ACCESS_TOKEN", ) diff --git a/src/pipedream/tokens/client.py b/src/pipedream/tokens/client.py index f29691c..9c88340 100644 --- a/src/pipedream/tokens/client.py +++ b/src/pipedream/tokens/client.py @@ -75,8 +75,7 @@ def create( client = Pipedream( project_id="YOUR_PROJECT_ID", project_environment="YOUR_PROJECT_ENVIRONMENT", - client_id="YOUR_CLIENT_ID", - client_secret="YOUR_CLIENT_SECRET", + access_token="YOUR_ACCESS_TOKEN", ) client.tokens.create( external_user_id="external_user_id", @@ -123,8 +122,7 @@ def validate( client = Pipedream( project_id="YOUR_PROJECT_ID", project_environment="YOUR_PROJECT_ENVIRONMENT", - client_id="YOUR_CLIENT_ID", - client_secret="YOUR_CLIENT_SECRET", + access_token="YOUR_ACCESS_TOKEN", ) client.tokens.validate( ctok="ctok", @@ -198,8 +196,7 @@ async def create( client = AsyncPipedream( project_id="YOUR_PROJECT_ID", project_environment="YOUR_PROJECT_ENVIRONMENT", - client_id="YOUR_CLIENT_ID", - client_secret="YOUR_CLIENT_SECRET", + access_token="YOUR_ACCESS_TOKEN", ) @@ -254,8 +251,7 @@ async def validate( client = AsyncPipedream( project_id="YOUR_PROJECT_ID", project_environment="YOUR_PROJECT_ENVIRONMENT", - client_id="YOUR_CLIENT_ID", - client_secret="YOUR_CLIENT_SECRET", + access_token="YOUR_ACCESS_TOKEN", ) diff --git a/src/pipedream/triggers/client.py b/src/pipedream/triggers/client.py index f3ea70e..680b03c 100644 --- a/src/pipedream/triggers/client.py +++ b/src/pipedream/triggers/client.py @@ -73,8 +73,7 @@ def list( client = Pipedream( project_id="YOUR_PROJECT_ID", project_environment="YOUR_PROJECT_ENVIRONMENT", - client_id="YOUR_CLIENT_ID", - client_secret="YOUR_CLIENT_SECRET", + access_token="YOUR_ACCESS_TOKEN", ) response = client.triggers.list() for item in response: @@ -109,8 +108,7 @@ def retrieve(self, component_id: str, *, request_options: typing.Optional[Reques client = Pipedream( project_id="YOUR_PROJECT_ID", project_environment="YOUR_PROJECT_ENVIRONMENT", - client_id="YOUR_CLIENT_ID", - client_secret="YOUR_CLIENT_SECRET", + access_token="YOUR_ACCESS_TOKEN", ) client.triggers.retrieve( component_id="component_id", @@ -185,8 +183,7 @@ def configure_prop( client = Pipedream( project_id="YOUR_PROJECT_ID", project_environment="YOUR_PROJECT_ENVIRONMENT", - client_id="YOUR_CLIENT_ID", - client_secret="YOUR_CLIENT_SECRET", + access_token="YOUR_ACCESS_TOKEN", ) client.triggers.configure_prop( id="id", @@ -260,8 +257,7 @@ def reload_props( client = Pipedream( project_id="YOUR_PROJECT_ID", project_environment="YOUR_PROJECT_ENVIRONMENT", - client_id="YOUR_CLIENT_ID", - client_secret="YOUR_CLIENT_SECRET", + access_token="YOUR_ACCESS_TOKEN", ) client.triggers.reload_props( id="id", @@ -323,8 +319,7 @@ def deploy( client = Pipedream( project_id="YOUR_PROJECT_ID", project_environment="YOUR_PROJECT_ENVIRONMENT", - client_id="YOUR_CLIENT_ID", - client_secret="YOUR_CLIENT_SECRET", + access_token="YOUR_ACCESS_TOKEN", ) client.triggers.deploy( id="id", @@ -402,8 +397,7 @@ async def list( client = AsyncPipedream( project_id="YOUR_PROJECT_ID", project_environment="YOUR_PROJECT_ENVIRONMENT", - client_id="YOUR_CLIENT_ID", - client_secret="YOUR_CLIENT_SECRET", + access_token="YOUR_ACCESS_TOKEN", ) @@ -449,8 +443,7 @@ async def retrieve( client = AsyncPipedream( project_id="YOUR_PROJECT_ID", project_environment="YOUR_PROJECT_ENVIRONMENT", - client_id="YOUR_CLIENT_ID", - client_secret="YOUR_CLIENT_SECRET", + access_token="YOUR_ACCESS_TOKEN", ) @@ -533,8 +526,7 @@ async def configure_prop( client = AsyncPipedream( project_id="YOUR_PROJECT_ID", project_environment="YOUR_PROJECT_ENVIRONMENT", - client_id="YOUR_CLIENT_ID", - client_secret="YOUR_CLIENT_SECRET", + access_token="YOUR_ACCESS_TOKEN", ) @@ -616,8 +608,7 @@ async def reload_props( client = AsyncPipedream( project_id="YOUR_PROJECT_ID", project_environment="YOUR_PROJECT_ENVIRONMENT", - client_id="YOUR_CLIENT_ID", - client_secret="YOUR_CLIENT_SECRET", + access_token="YOUR_ACCESS_TOKEN", ) @@ -687,8 +678,7 @@ async def deploy( client = AsyncPipedream( project_id="YOUR_PROJECT_ID", project_environment="YOUR_PROJECT_ENVIRONMENT", - client_id="YOUR_CLIENT_ID", - client_secret="YOUR_CLIENT_SECRET", + access_token="YOUR_ACCESS_TOKEN", ) diff --git a/src/pipedream/users/client.py b/src/pipedream/users/client.py index e3862a5..bd1821f 100644 --- a/src/pipedream/users/client.py +++ b/src/pipedream/users/client.py @@ -44,8 +44,7 @@ def delete_external_user( client = Pipedream( project_id="YOUR_PROJECT_ID", project_environment="YOUR_PROJECT_ENVIRONMENT", - client_id="YOUR_CLIENT_ID", - client_secret="YOUR_CLIENT_SECRET", + access_token="YOUR_ACCESS_TOKEN", ) client.users.delete_external_user( external_user_id="external_user_id", @@ -94,8 +93,7 @@ async def delete_external_user( client = AsyncPipedream( project_id="YOUR_PROJECT_ID", project_environment="YOUR_PROJECT_ENVIRONMENT", - client_id="YOUR_CLIENT_ID", - client_secret="YOUR_CLIENT_SECRET", + access_token="YOUR_ACCESS_TOKEN", )