Skip to content

Commit df1dc5d

Browse files
feat(api): update via SDK Studio
1 parent 3e0d0f2 commit df1dc5d

File tree

9 files changed

+618
-3
lines changed

9 files changed

+618
-3
lines changed

.stats.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
configured_endpoints: 17
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/hyperspell%2Fhyperspell-02e7812c1884f52abc262b661200ba5f97e497d5c981db3e0fdcd45f3df9f1a7.yml
3-
openapi_spec_hash: 7c4d4f673badcf00e63a2bf17fbc149f
1+
configured_endpoints: 20
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/hyperspell%2Fhyperspell-cd8c28747615d8967e4e20e6fd5b9488a3022fece37f1c4c133c9b8d9c4415f3.yml
3+
openapi_spec_hash: 2aa6c5d6faa2cbd4038108b5ebc103b3
44
config_hash: 331712c9dfb31af34bdab84fd3f7d48d

api.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,22 @@ from hyperspell.types import QueryResult
66

77
# Integrations
88

9+
Types:
10+
11+
```python
12+
from hyperspell.types import (
13+
IntegrationListResponse,
14+
IntegrationConnectResponse,
15+
IntegrationRevokeResponse,
16+
)
17+
```
18+
19+
Methods:
20+
21+
- <code title="get /integrations/list">client.integrations.<a href="./src/hyperspell/resources/integrations/integrations.py">list</a>() -> <a href="./src/hyperspell/types/integration_list_response.py">IntegrationListResponse</a></code>
22+
- <code title="get /integrations/{integration_id}/connect">client.integrations.<a href="./src/hyperspell/resources/integrations/integrations.py">connect</a>(integration_id, \*\*<a href="src/hyperspell/types/integration_connect_params.py">params</a>) -> <a href="./src/hyperspell/types/integration_connect_response.py">IntegrationConnectResponse</a></code>
23+
- <code title="get /integrations/{integration_id}/revoke">client.integrations.<a href="./src/hyperspell/resources/integrations/integrations.py">revoke</a>(integration_id) -> <a href="./src/hyperspell/types/integration_revoke_response.py">IntegrationRevokeResponse</a></code>
24+
925
## GoogleCalendar
1026

1127
Types:

src/hyperspell/resources/integrations/integrations.py

Lines changed: 243 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22

33
from __future__ import annotations
44

5+
from typing import Optional
6+
7+
import httpx
8+
59
from .slack import (
610
SlackResource,
711
AsyncSlackResource,
@@ -10,8 +14,17 @@
1014
SlackResourceWithStreamingResponse,
1115
AsyncSlackResourceWithStreamingResponse,
1216
)
17+
from ...types import integration_connect_params
18+
from ..._types import Body, Omit, Query, Headers, NotGiven, omit, not_given
19+
from ..._utils import maybe_transform, async_maybe_transform
1320
from ..._compat import cached_property
1421
from ..._resource import SyncAPIResource, AsyncAPIResource
22+
from ..._response import (
23+
to_raw_response_wrapper,
24+
to_streamed_response_wrapper,
25+
async_to_raw_response_wrapper,
26+
async_to_streamed_response_wrapper,
27+
)
1528
from .web_crawler import (
1629
WebCrawlerResource,
1730
AsyncWebCrawlerResource,
@@ -20,6 +33,7 @@
2033
WebCrawlerResourceWithStreamingResponse,
2134
AsyncWebCrawlerResourceWithStreamingResponse,
2235
)
36+
from ..._base_client import make_request_options
2337
from .google_calendar import (
2438
GoogleCalendarResource,
2539
AsyncGoogleCalendarResource,
@@ -28,6 +42,9 @@
2842
GoogleCalendarResourceWithStreamingResponse,
2943
AsyncGoogleCalendarResourceWithStreamingResponse,
3044
)
45+
from ...types.integration_list_response import IntegrationListResponse
46+
from ...types.integration_revoke_response import IntegrationRevokeResponse
47+
from ...types.integration_connect_response import IntegrationConnectResponse
3148

3249
__all__ = ["IntegrationsResource", "AsyncIntegrationsResource"]
3350

@@ -64,6 +81,99 @@ def with_streaming_response(self) -> IntegrationsResourceWithStreamingResponse:
6481
"""
6582
return IntegrationsResourceWithStreamingResponse(self)
6683

84+
def list(
85+
self,
86+
*,
87+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
88+
# The extra values given here take precedence over values defined on the client or passed to this method.
89+
extra_headers: Headers | None = None,
90+
extra_query: Query | None = None,
91+
extra_body: Body | None = None,
92+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
93+
) -> IntegrationListResponse:
94+
"""List all integrations for the user."""
95+
return self._get(
96+
"/integrations/list",
97+
options=make_request_options(
98+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
99+
),
100+
cast_to=IntegrationListResponse,
101+
)
102+
103+
def connect(
104+
self,
105+
integration_id: str,
106+
*,
107+
redirect_url: Optional[str] | Omit = omit,
108+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
109+
# The extra values given here take precedence over values defined on the client or passed to this method.
110+
extra_headers: Headers | None = None,
111+
extra_query: Query | None = None,
112+
extra_body: Body | None = None,
113+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
114+
) -> IntegrationConnectResponse:
115+
"""
116+
Redirects to the connect URL to link an integration.
117+
118+
Args:
119+
extra_headers: Send extra headers
120+
121+
extra_query: Add additional query parameters to the request
122+
123+
extra_body: Add additional JSON properties to the request
124+
125+
timeout: Override the client-level default timeout for this request, in seconds
126+
"""
127+
if not integration_id:
128+
raise ValueError(f"Expected a non-empty value for `integration_id` but received {integration_id!r}")
129+
return self._get(
130+
f"/integrations/{integration_id}/connect",
131+
options=make_request_options(
132+
extra_headers=extra_headers,
133+
extra_query=extra_query,
134+
extra_body=extra_body,
135+
timeout=timeout,
136+
query=maybe_transform(
137+
{"redirect_url": redirect_url}, integration_connect_params.IntegrationConnectParams
138+
),
139+
),
140+
cast_to=IntegrationConnectResponse,
141+
)
142+
143+
def revoke(
144+
self,
145+
integration_id: str,
146+
*,
147+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
148+
# The extra values given here take precedence over values defined on the client or passed to this method.
149+
extra_headers: Headers | None = None,
150+
extra_query: Query | None = None,
151+
extra_body: Body | None = None,
152+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
153+
) -> IntegrationRevokeResponse:
154+
"""
155+
Revokes Hyperspell's access the given provider and deletes all stored
156+
credentials and indexed data.
157+
158+
Args:
159+
extra_headers: Send extra headers
160+
161+
extra_query: Add additional query parameters to the request
162+
163+
extra_body: Add additional JSON properties to the request
164+
165+
timeout: Override the client-level default timeout for this request, in seconds
166+
"""
167+
if not integration_id:
168+
raise ValueError(f"Expected a non-empty value for `integration_id` but received {integration_id!r}")
169+
return self._get(
170+
f"/integrations/{integration_id}/revoke",
171+
options=make_request_options(
172+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
173+
),
174+
cast_to=IntegrationRevokeResponse,
175+
)
176+
67177

68178
class AsyncIntegrationsResource(AsyncAPIResource):
69179
@cached_property
@@ -97,11 +207,114 @@ def with_streaming_response(self) -> AsyncIntegrationsResourceWithStreamingRespo
97207
"""
98208
return AsyncIntegrationsResourceWithStreamingResponse(self)
99209

210+
async def list(
211+
self,
212+
*,
213+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
214+
# The extra values given here take precedence over values defined on the client or passed to this method.
215+
extra_headers: Headers | None = None,
216+
extra_query: Query | None = None,
217+
extra_body: Body | None = None,
218+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
219+
) -> IntegrationListResponse:
220+
"""List all integrations for the user."""
221+
return await self._get(
222+
"/integrations/list",
223+
options=make_request_options(
224+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
225+
),
226+
cast_to=IntegrationListResponse,
227+
)
228+
229+
async def connect(
230+
self,
231+
integration_id: str,
232+
*,
233+
redirect_url: Optional[str] | Omit = omit,
234+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
235+
# The extra values given here take precedence over values defined on the client or passed to this method.
236+
extra_headers: Headers | None = None,
237+
extra_query: Query | None = None,
238+
extra_body: Body | None = None,
239+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
240+
) -> IntegrationConnectResponse:
241+
"""
242+
Redirects to the connect URL to link an integration.
243+
244+
Args:
245+
extra_headers: Send extra headers
246+
247+
extra_query: Add additional query parameters to the request
248+
249+
extra_body: Add additional JSON properties to the request
250+
251+
timeout: Override the client-level default timeout for this request, in seconds
252+
"""
253+
if not integration_id:
254+
raise ValueError(f"Expected a non-empty value for `integration_id` but received {integration_id!r}")
255+
return await self._get(
256+
f"/integrations/{integration_id}/connect",
257+
options=make_request_options(
258+
extra_headers=extra_headers,
259+
extra_query=extra_query,
260+
extra_body=extra_body,
261+
timeout=timeout,
262+
query=await async_maybe_transform(
263+
{"redirect_url": redirect_url}, integration_connect_params.IntegrationConnectParams
264+
),
265+
),
266+
cast_to=IntegrationConnectResponse,
267+
)
268+
269+
async def revoke(
270+
self,
271+
integration_id: str,
272+
*,
273+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
274+
# The extra values given here take precedence over values defined on the client or passed to this method.
275+
extra_headers: Headers | None = None,
276+
extra_query: Query | None = None,
277+
extra_body: Body | None = None,
278+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
279+
) -> IntegrationRevokeResponse:
280+
"""
281+
Revokes Hyperspell's access the given provider and deletes all stored
282+
credentials and indexed data.
283+
284+
Args:
285+
extra_headers: Send extra headers
286+
287+
extra_query: Add additional query parameters to the request
288+
289+
extra_body: Add additional JSON properties to the request
290+
291+
timeout: Override the client-level default timeout for this request, in seconds
292+
"""
293+
if not integration_id:
294+
raise ValueError(f"Expected a non-empty value for `integration_id` but received {integration_id!r}")
295+
return await self._get(
296+
f"/integrations/{integration_id}/revoke",
297+
options=make_request_options(
298+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
299+
),
300+
cast_to=IntegrationRevokeResponse,
301+
)
302+
100303

101304
class IntegrationsResourceWithRawResponse:
102305
def __init__(self, integrations: IntegrationsResource) -> None:
103306
self._integrations = integrations
104307

308+
self.list = to_raw_response_wrapper(
309+
integrations.list,
310+
)
311+
self.connect = to_raw_response_wrapper(
312+
integrations.connect,
313+
)
314+
self.revoke = to_raw_response_wrapper(
315+
integrations.revoke,
316+
)
317+
105318
@cached_property
106319
def google_calendar(self) -> GoogleCalendarResourceWithRawResponse:
107320
return GoogleCalendarResourceWithRawResponse(self._integrations.google_calendar)
@@ -119,6 +332,16 @@ class AsyncIntegrationsResourceWithRawResponse:
119332
def __init__(self, integrations: AsyncIntegrationsResource) -> None:
120333
self._integrations = integrations
121334

335+
self.list = async_to_raw_response_wrapper(
336+
integrations.list,
337+
)
338+
self.connect = async_to_raw_response_wrapper(
339+
integrations.connect,
340+
)
341+
self.revoke = async_to_raw_response_wrapper(
342+
integrations.revoke,
343+
)
344+
122345
@cached_property
123346
def google_calendar(self) -> AsyncGoogleCalendarResourceWithRawResponse:
124347
return AsyncGoogleCalendarResourceWithRawResponse(self._integrations.google_calendar)
@@ -136,6 +359,16 @@ class IntegrationsResourceWithStreamingResponse:
136359
def __init__(self, integrations: IntegrationsResource) -> None:
137360
self._integrations = integrations
138361

362+
self.list = to_streamed_response_wrapper(
363+
integrations.list,
364+
)
365+
self.connect = to_streamed_response_wrapper(
366+
integrations.connect,
367+
)
368+
self.revoke = to_streamed_response_wrapper(
369+
integrations.revoke,
370+
)
371+
139372
@cached_property
140373
def google_calendar(self) -> GoogleCalendarResourceWithStreamingResponse:
141374
return GoogleCalendarResourceWithStreamingResponse(self._integrations.google_calendar)
@@ -153,6 +386,16 @@ class AsyncIntegrationsResourceWithStreamingResponse:
153386
def __init__(self, integrations: AsyncIntegrationsResource) -> None:
154387
self._integrations = integrations
155388

389+
self.list = async_to_streamed_response_wrapper(
390+
integrations.list,
391+
)
392+
self.connect = async_to_streamed_response_wrapper(
393+
integrations.connect,
394+
)
395+
self.revoke = async_to_streamed_response_wrapper(
396+
integrations.revoke,
397+
)
398+
156399
@cached_property
157400
def google_calendar(self) -> AsyncGoogleCalendarResourceWithStreamingResponse:
158401
return AsyncGoogleCalendarResourceWithStreamingResponse(self._integrations.google_calendar)

src/hyperspell/types/__init__.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,11 @@
1717
from .memory_delete_response import MemoryDeleteResponse as MemoryDeleteResponse
1818
from .memory_status_response import MemoryStatusResponse as MemoryStatusResponse
1919
from .auth_delete_user_response import AuthDeleteUserResponse as AuthDeleteUserResponse
20+
from .integration_list_response import IntegrationListResponse as IntegrationListResponse
21+
from .integration_connect_params import IntegrationConnectParams as IntegrationConnectParams
2022
from .evaluate_score_query_params import EvaluateScoreQueryParams as EvaluateScoreQueryParams
23+
from .integration_revoke_response import IntegrationRevokeResponse as IntegrationRevokeResponse
24+
from .integration_connect_response import IntegrationConnectResponse as IntegrationConnectResponse
2125
from .evaluate_score_query_response import EvaluateScoreQueryResponse as EvaluateScoreQueryResponse
2226
from .evaluate_score_highlight_params import EvaluateScoreHighlightParams as EvaluateScoreHighlightParams
2327
from .evaluate_score_highlight_response import EvaluateScoreHighlightResponse as EvaluateScoreHighlightResponse
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2+
3+
from __future__ import annotations
4+
5+
from typing import Optional
6+
from typing_extensions import TypedDict
7+
8+
__all__ = ["IntegrationConnectParams"]
9+
10+
11+
class IntegrationConnectParams(TypedDict, total=False):
12+
redirect_url: Optional[str]
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2+
3+
from datetime import datetime
4+
5+
from .._models import BaseModel
6+
7+
__all__ = ["IntegrationConnectResponse"]
8+
9+
10+
class IntegrationConnectResponse(BaseModel):
11+
expires_at: datetime
12+
13+
url: str

0 commit comments

Comments
 (0)