Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name = "pipedream"

[tool.poetry]
name = "pipedream"
version = "1.0.7"
version = "1.0.8"
description = ""
readme = "README.md"
authors = []
Expand Down
21 changes: 20 additions & 1 deletion src/pipedream/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import typing

import httpx
from .types.project_environment import ProjectEnvironment
from ._.types.project_environment import ProjectEnvironment
from .core.api_error import ApiError
from .core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
from .core.oauth_token_provider import OAuthTokenProvider
Expand All @@ -19,6 +19,7 @@
from .apps.client import AppsClient, AsyncAppsClient
from .components.client import AsyncComponentsClient, ComponentsClient
from .deployed_triggers.client import AsyncDeployedTriggersClient, DeployedTriggersClient
from .file_stash.client import AsyncFileStashClient, FileStashClient
from .oauth_tokens.client import AsyncOauthTokensClient, OauthTokensClient
from .projects.client import AsyncProjectsClient, ProjectsClient
from .proxy.client import AsyncProxyClient, ProxyClient
Expand Down Expand Up @@ -130,6 +131,7 @@ def __init__(
self._triggers: typing.Optional[TriggersClient] = None
self._deployed_triggers: typing.Optional[DeployedTriggersClient] = None
self._projects: typing.Optional[ProjectsClient] = None
self._file_stash: typing.Optional[FileStashClient] = None
self._proxy: typing.Optional[ProxyClient] = None
self._tokens: typing.Optional[TokensClient] = None
self._oauth_tokens: typing.Optional[OauthTokensClient] = None
Expand Down Expand Up @@ -206,6 +208,14 @@ def projects(self):
self._projects = ProjectsClient(client_wrapper=self._client_wrapper)
return self._projects

@property
def file_stash(self):
if self._file_stash is None:
from .file_stash.client import FileStashClient # noqa: E402

self._file_stash = FileStashClient(client_wrapper=self._client_wrapper)
return self._file_stash

@property
def proxy(self):
if self._proxy is None:
Expand Down Expand Up @@ -334,6 +344,7 @@ def __init__(
self._triggers: typing.Optional[AsyncTriggersClient] = None
self._deployed_triggers: typing.Optional[AsyncDeployedTriggersClient] = None
self._projects: typing.Optional[AsyncProjectsClient] = None
self._file_stash: typing.Optional[AsyncFileStashClient] = None
self._proxy: typing.Optional[AsyncProxyClient] = None
self._tokens: typing.Optional[AsyncTokensClient] = None
self._oauth_tokens: typing.Optional[AsyncOauthTokensClient] = None
Expand Down Expand Up @@ -410,6 +421,14 @@ def projects(self):
self._projects = AsyncProjectsClient(client_wrapper=self._client_wrapper)
return self._projects

@property
def file_stash(self):
if self._file_stash is None:
from .file_stash.client import AsyncFileStashClient # noqa: E402

self._file_stash = AsyncFileStashClient(client_wrapper=self._client_wrapper)
return self._file_stash

@property
def proxy(self):
if self._proxy is None:
Expand Down
6 changes: 3 additions & 3 deletions src/pipedream/core/client_wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand All @@ -27,10 +27,10 @@ def __init__(

def get_headers(self) -> typing.Dict[str, str]:
headers: typing.Dict[str, str] = {
"User-Agent": "pipedream/1.0.7",
"User-Agent": "pipedream/1.0.8",
"X-Fern-Language": "Python",
"X-Fern-SDK-Name": "pipedream",
"X-Fern-SDK-Version": "1.0.7",
"X-Fern-SDK-Version": "1.0.8",
**(self.get_custom_headers() or {}),
}
if self._project_environment is not None:
Expand Down
4 changes: 4 additions & 0 deletions src/pipedream/file_stash/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# This file was auto-generated by Fern from our API Definition.

# isort: skip_file

111 changes: 111 additions & 0 deletions src/pipedream/file_stash/client.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
# 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 .raw_client import AsyncRawFileStashClient, RawFileStashClient


class FileStashClient:
def __init__(self, *, client_wrapper: SyncClientWrapper):
self._raw_client = RawFileStashClient(client_wrapper=client_wrapper)

@property
def with_raw_response(self) -> RawFileStashClient:
"""
Retrieves a raw implementation of this client that returns raw responses.

Returns
-------
RawFileStashClient
"""
return self._raw_client

def download_file(self, *, s_3_key: str, request_options: typing.Optional[RequestOptions] = None) -> None:
"""
Download a file from File Stash

Parameters
----------
s_3_key : str

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.file_stash.download_file(
s_3_key="s3_key",
)
"""
_response = self._raw_client.download_file(s_3_key=s_3_key, request_options=request_options)
return _response.data


class AsyncFileStashClient:
def __init__(self, *, client_wrapper: AsyncClientWrapper):
self._raw_client = AsyncRawFileStashClient(client_wrapper=client_wrapper)

@property
def with_raw_response(self) -> AsyncRawFileStashClient:
"""
Retrieves a raw implementation of this client that returns raw responses.

Returns
-------
AsyncRawFileStashClient
"""
return self._raw_client

async def download_file(self, *, s_3_key: str, request_options: typing.Optional[RequestOptions] = None) -> None:
"""
Download a file from File Stash

Parameters
----------
s_3_key : str

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.file_stash.download_file(
s_3_key="s3_key",
)


asyncio.run(main())
"""
_response = await self._raw_client.download_file(s_3_key=s_3_key, request_options=request_options)
return _response.data
110 changes: 110 additions & 0 deletions src/pipedream/file_stash/raw_client.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
# 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


class RawFileStashClient:
def __init__(self, *, client_wrapper: SyncClientWrapper):
self._client_wrapper = client_wrapper

def download_file(
self, *, s_3_key: str, request_options: typing.Optional[RequestOptions] = None
) -> HttpResponse[None]:
"""
Download a file from File Stash

Parameters
----------
s_3_key : str

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)}/file_stash/download",
method="GET",
params={
"s3_key": s_3_key,
},
request_options=request_options,
)
try:
if 200 <= _response.status_code < 300:
return HttpResponse(response=_response, data=None)
if _response.status_code == 429:
raise TooManyRequestsError(
headers=dict(_response.headers),
body=typing.cast(
typing.Optional[typing.Any],
parse_obj_as(
type_=typing.Optional[typing.Any], # type: ignore
object_=_response.json(),
),
),
)
_response_json = _response.json()
except JSONDecodeError:
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)


class AsyncRawFileStashClient:
def __init__(self, *, client_wrapper: AsyncClientWrapper):
self._client_wrapper = client_wrapper

async def download_file(
self, *, s_3_key: str, request_options: typing.Optional[RequestOptions] = None
) -> AsyncHttpResponse[None]:
"""
Download a file from File Stash

Parameters
----------
s_3_key : str

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)}/file_stash/download",
method="GET",
params={
"s3_key": s_3_key,
},
request_options=request_options,
)
try:
if 200 <= _response.status_code < 300:
return AsyncHttpResponse(response=_response, data=None)
if _response.status_code == 429:
raise TooManyRequestsError(
headers=dict(_response.headers),
body=typing.cast(
typing.Optional[typing.Any],
parse_obj_as(
type_=typing.Optional[typing.Any], # type: ignore
object_=_response.json(),
),
),
)
_response_json = _response.json()
except JSONDecodeError:
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
3 changes: 3 additions & 0 deletions src/pipedream/types/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@
from .project_info_response_app import ProjectInfoResponseApp
from .prop_option import PropOption
from .prop_option_nested import PropOptionNested
from .prop_option_value import PropOptionValue
from .proxy_response import ProxyResponse
from .reload_props_opts import ReloadPropsOpts
from .reload_props_response import ReloadPropsResponse
Expand Down Expand Up @@ -184,6 +185,7 @@
"ProjectInfoResponseApp": ".project_info_response_app",
"PropOption": ".prop_option",
"PropOptionNested": ".prop_option_nested",
"PropOptionValue": ".prop_option_value",
"ProxyResponse": ".proxy_response",
"ReloadPropsOpts": ".reload_props_opts",
"ReloadPropsResponse": ".reload_props_response",
Expand Down Expand Up @@ -301,6 +303,7 @@ def __dir__():
"ProjectInfoResponseApp",
"PropOption",
"PropOptionNested",
"PropOptionValue",
"ProxyResponse",
"ReloadPropsOpts",
"ReloadPropsResponse",
Expand Down
3 changes: 2 additions & 1 deletion src/pipedream/types/prop_option.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

import pydantic
from ..core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel
from .prop_option_value import PropOptionValue


class PropOption(UniversalBaseModel):
Expand All @@ -16,7 +17,7 @@ class PropOption(UniversalBaseModel):
The human-readable label for the option
"""

value: typing.Optional[typing.Any] = None
value: typing.Optional[PropOptionValue] = None

if IS_PYDANTIC_V2:
model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
Expand Down
5 changes: 5 additions & 0 deletions src/pipedream/types/prop_option_value.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# This file was auto-generated by Fern from our API Definition.

import typing

PropOptionValue = typing.Union[str, int, bool]
Loading