Skip to content

Commit 3074672

Browse files
Fix the Connect proxy and token schemas (#40)
* Fix the Connect proxy response schema The response from the Connect proxy endpoint is transparent, so the body is free-form, and the status and headers come back as part of the HTTP response itself. * Fix the Connect token specs The Connect token paths live under the project scope, so their paths should contain `{project_id}`, and not have it inside the request body. --------- Co-authored-by: fern-api <115122769+fern-api[bot]@users.noreply.github.com> Co-authored-by: Jay Vercellone <[email protected]>
1 parent 1d2234d commit 3074672

File tree

6 files changed

+7
-43
lines changed

6 files changed

+7
-43
lines changed

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name = "pipedream"
33

44
[tool.poetry]
55
name = "pipedream"
6-
version = "0.3.3"
6+
version = "0.3.4"
77
description = ""
88
readme = "README.md"
99
authors = []

reference.md

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3314,7 +3314,6 @@ client = Pipedream(
33143314
)
33153315
client.tokens.create(
33163316
external_user_id="external_user_id",
3317-
project_id="project_id",
33183317
)
33193318

33203319
```
@@ -3339,14 +3338,6 @@ client.tokens.create(
33393338
<dl>
33403339
<dd>
33413340

3342-
**project_id:** `str` — The ID of the project
3343-
3344-
</dd>
3345-
</dl>
3346-
3347-
<dl>
3348-
<dd>
3349-
33503341
**allowed_origins:** `typing.Optional[typing.Sequence[str]]` — List of allowed origins for CORS
33513342

33523343
</dd>

src/pipedream/core/client_wrapper.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,10 @@ def __init__(
2727

2828
def get_headers(self) -> typing.Dict[str, str]:
2929
headers: typing.Dict[str, str] = {
30-
"User-Agent": "pipedream/0.3.3",
30+
"User-Agent": "pipedream/0.3.4",
3131
"X-Fern-Language": "Python",
3232
"X-Fern-SDK-Name": "pipedream",
33-
"X-Fern-SDK-Version": "0.3.3",
33+
"X-Fern-SDK-Version": "0.3.4",
3434
**(self.get_custom_headers() or {}),
3535
}
3636
if self._project_environment is not None:

src/pipedream/tokens/client.py

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ def create(
3232
self,
3333
*,
3434
external_user_id: str,
35-
project_id: str,
3635
allowed_origins: typing.Optional[typing.Sequence[str]] = OMIT,
3736
error_redirect_uri: typing.Optional[str] = OMIT,
3837
success_redirect_uri: typing.Optional[str] = OMIT,
@@ -45,9 +44,6 @@ def create(
4544
external_user_id : str
4645
Your end user ID, for whom you're creating the token
4746
48-
project_id : str
49-
The ID of the project
50-
5147
allowed_origins : typing.Optional[typing.Sequence[str]]
5248
List of allowed origins for CORS
5349
@@ -80,12 +76,10 @@ def create(
8076
)
8177
client.tokens.create(
8278
external_user_id="external_user_id",
83-
project_id="project_id",
8479
)
8580
"""
8681
_response = self._raw_client.create(
8782
external_user_id=external_user_id,
88-
project_id=project_id,
8983
allowed_origins=allowed_origins,
9084
error_redirect_uri=error_redirect_uri,
9185
success_redirect_uri=success_redirect_uri,
@@ -153,7 +147,6 @@ async def create(
153147
self,
154148
*,
155149
external_user_id: str,
156-
project_id: str,
157150
allowed_origins: typing.Optional[typing.Sequence[str]] = OMIT,
158151
error_redirect_uri: typing.Optional[str] = OMIT,
159152
success_redirect_uri: typing.Optional[str] = OMIT,
@@ -166,9 +159,6 @@ async def create(
166159
external_user_id : str
167160
Your end user ID, for whom you're creating the token
168161
169-
project_id : str
170-
The ID of the project
171-
172162
allowed_origins : typing.Optional[typing.Sequence[str]]
173163
List of allowed origins for CORS
174164
@@ -206,15 +196,13 @@ async def create(
206196
async def main() -> None:
207197
await client.tokens.create(
208198
external_user_id="external_user_id",
209-
project_id="project_id",
210199
)
211200
212201
213202
asyncio.run(main())
214203
"""
215204
_response = await self._raw_client.create(
216205
external_user_id=external_user_id,
217-
project_id=project_id,
218206
allowed_origins=allowed_origins,
219207
error_redirect_uri=error_redirect_uri,
220208
success_redirect_uri=success_redirect_uri,

src/pipedream/tokens/raw_client.py

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ def create(
2626
self,
2727
*,
2828
external_user_id: str,
29-
project_id: str,
3029
allowed_origins: typing.Optional[typing.Sequence[str]] = OMIT,
3130
error_redirect_uri: typing.Optional[str] = OMIT,
3231
success_redirect_uri: typing.Optional[str] = OMIT,
@@ -39,9 +38,6 @@ def create(
3938
external_user_id : str
4039
Your end user ID, for whom you're creating the token
4140
42-
project_id : str
43-
The ID of the project
44-
4541
allowed_origins : typing.Optional[typing.Sequence[str]]
4642
List of allowed origins for CORS
4743
@@ -63,13 +59,12 @@ def create(
6359
connect token created
6460
"""
6561
_response = self._client_wrapper.httpx_client.request(
66-
"v1/connect/tokens",
62+
f"v1/connect/{jsonable_encoder(self._client_wrapper._project_id)}/tokens",
6763
method="POST",
6864
json={
6965
"allowed_origins": allowed_origins,
7066
"error_redirect_uri": error_redirect_uri,
7167
"external_user_id": external_user_id,
72-
"project_id": project_id,
7368
"success_redirect_uri": success_redirect_uri,
7469
"webhook_uri": webhook_uri,
7570
},
@@ -117,7 +112,7 @@ def validate(
117112
connect token validated
118113
"""
119114
_response = self._client_wrapper.httpx_client.request(
120-
f"v1/connect/tokens/{jsonable_encoder(ctok)}/validate",
115+
f"v1/connect/{jsonable_encoder(self._client_wrapper._project_id)}/tokens/{jsonable_encoder(ctok)}/validate",
121116
method="GET",
122117
params={
123118
"params": convert_and_respect_annotation_metadata(
@@ -150,7 +145,6 @@ async def create(
150145
self,
151146
*,
152147
external_user_id: str,
153-
project_id: str,
154148
allowed_origins: typing.Optional[typing.Sequence[str]] = OMIT,
155149
error_redirect_uri: typing.Optional[str] = OMIT,
156150
success_redirect_uri: typing.Optional[str] = OMIT,
@@ -163,9 +157,6 @@ async def create(
163157
external_user_id : str
164158
Your end user ID, for whom you're creating the token
165159
166-
project_id : str
167-
The ID of the project
168-
169160
allowed_origins : typing.Optional[typing.Sequence[str]]
170161
List of allowed origins for CORS
171162
@@ -187,13 +178,12 @@ async def create(
187178
connect token created
188179
"""
189180
_response = await self._client_wrapper.httpx_client.request(
190-
"v1/connect/tokens",
181+
f"v1/connect/{jsonable_encoder(self._client_wrapper._project_id)}/tokens",
191182
method="POST",
192183
json={
193184
"allowed_origins": allowed_origins,
194185
"error_redirect_uri": error_redirect_uri,
195186
"external_user_id": external_user_id,
196-
"project_id": project_id,
197187
"success_redirect_uri": success_redirect_uri,
198188
"webhook_uri": webhook_uri,
199189
},
@@ -241,7 +231,7 @@ async def validate(
241231
connect token validated
242232
"""
243233
_response = await self._client_wrapper.httpx_client.request(
244-
f"v1/connect/tokens/{jsonable_encoder(ctok)}/validate",
234+
f"v1/connect/{jsonable_encoder(self._client_wrapper._project_id)}/tokens/{jsonable_encoder(ctok)}/validate",
245235
method="GET",
246236
params={
247237
"params": convert_and_respect_annotation_metadata(

src/pipedream/types/connect_token_create_opts.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,6 @@ class ConnectTokenCreateOpts(UniversalBaseModel):
1616
Your end user ID, for whom you're creating the token
1717
"""
1818

19-
project_id: str = pydantic.Field()
20-
"""
21-
The ID of the project
22-
"""
23-
2419
allowed_origins: typing.Optional[typing.List[str]] = pydantic.Field(default=None)
2520
"""
2621
List of allowed origins for CORS

0 commit comments

Comments
 (0)