22
33from __future__ import annotations
44
5+ from typing import Dict , Union , Optional
56from typing_extensions import Literal
67
78import httpx
89
10+ from ..types import connection_list_params , connection_create_params
911from .._types import NOT_GIVEN , Body , Query , Headers , NotGiven
12+ from .._utils import maybe_transform , async_maybe_transform
1013from .._compat import cached_property
1114from .._resource import SyncAPIResource , AsyncAPIResource
1215from .._response import (
@@ -47,6 +50,9 @@ def create(
4750 self ,
4851 provider : Literal ["notion" , "google-drive" , "onedrive" ],
4952 * ,
53+ end_user_id : str | NotGiven = NOT_GIVEN ,
54+ redirect_url : str | NotGiven = NOT_GIVEN ,
55+ metadata : Optional [Dict [str , Union [str , float , bool ]]] | NotGiven = NOT_GIVEN ,
5056 # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
5157 # The extra values given here take precedence over values defined on the client or passed to this method.
5258 extra_headers : Headers | None = None ,
@@ -70,27 +76,54 @@ def create(
7076 raise ValueError (f"Expected a non-empty value for `provider` but received { provider !r} " )
7177 return self ._post (
7278 f"/v3/connections/{ provider } " ,
79+ body = maybe_transform ({"metadata" : metadata }, connection_create_params .ConnectionCreateParams ),
7380 options = make_request_options (
74- extra_headers = extra_headers , extra_query = extra_query , extra_body = extra_body , timeout = timeout
81+ extra_headers = extra_headers ,
82+ extra_query = extra_query ,
83+ extra_body = extra_body ,
84+ timeout = timeout ,
85+ query = maybe_transform (
86+ {
87+ "end_user_id" : end_user_id ,
88+ "redirect_url" : redirect_url ,
89+ },
90+ connection_create_params .ConnectionCreateParams ,
91+ ),
7592 ),
7693 cast_to = ConnectionCreateResponse ,
7794 )
7895
7996 def list (
8097 self ,
8198 * ,
99+ end_user_id : str | NotGiven = NOT_GIVEN ,
82100 # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
83101 # The extra values given here take precedence over values defined on the client or passed to this method.
84102 extra_headers : Headers | None = None ,
85103 extra_query : Query | None = None ,
86104 extra_body : Body | None = None ,
87105 timeout : float | httpx .Timeout | None | NotGiven = NOT_GIVEN ,
88106 ) -> ConnectionListResponse :
89- """List all connections"""
107+ """
108+ List all connections
109+
110+ Args:
111+ extra_headers: Send extra headers
112+
113+ extra_query: Add additional query parameters to the request
114+
115+ extra_body: Add additional JSON properties to the request
116+
117+ timeout: Override the client-level default timeout for this request, in seconds
118+ """
90119 return self ._get (
91120 "/v3/connections" ,
92121 options = make_request_options (
93- extra_headers = extra_headers , extra_query = extra_query , extra_body = extra_body , timeout = timeout
122+ extra_headers = extra_headers ,
123+ extra_query = extra_query ,
124+ extra_body = extra_body ,
125+ timeout = timeout ,
126+ query = maybe_transform ({"end_user_id" : end_user_id }, connection_list_params .ConnectionListParams ),
94127 ),
95128 cast_to = ConnectionListResponse ,
96129 )
@@ -153,6 +186,9 @@ async def create(
153186 self ,
154187 provider : Literal ["notion" , "google-drive" , "onedrive" ],
155188 * ,
189+ end_user_id : str | NotGiven = NOT_GIVEN ,
190+ redirect_url : str | NotGiven = NOT_GIVEN ,
191+ metadata : Optional [Dict [str , Union [str , float , bool ]]] | NotGiven = NOT_GIVEN ,
156192 # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
157193 # The extra values given here take precedence over values defined on the client or passed to this method.
158194 extra_headers : Headers | None = None ,
@@ -176,27 +212,56 @@ async def create(
176212 raise ValueError (f"Expected a non-empty value for `provider` but received { provider !r} " )
177213 return await self ._post (
178214 f"/v3/connections/{ provider } " ,
215+ body = await async_maybe_transform ({"metadata" : metadata }, connection_create_params .ConnectionCreateParams ),
179216 options = make_request_options (
180- extra_headers = extra_headers , extra_query = extra_query , extra_body = extra_body , timeout = timeout
217+ extra_headers = extra_headers ,
218+ extra_query = extra_query ,
219+ extra_body = extra_body ,
220+ timeout = timeout ,
221+ query = await async_maybe_transform (
222+ {
223+ "end_user_id" : end_user_id ,
224+ "redirect_url" : redirect_url ,
225+ },
226+ connection_create_params .ConnectionCreateParams ,
227+ ),
181228 ),
182229 cast_to = ConnectionCreateResponse ,
183230 )
184231
185232 async def list (
186233 self ,
187234 * ,
235+ end_user_id : str | NotGiven = NOT_GIVEN ,
188236 # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
189237 # The extra values given here take precedence over values defined on the client or passed to this method.
190238 extra_headers : Headers | None = None ,
191239 extra_query : Query | None = None ,
192240 extra_body : Body | None = None ,
193241 timeout : float | httpx .Timeout | None | NotGiven = NOT_GIVEN ,
194242 ) -> ConnectionListResponse :
195- """List all connections"""
243+ """
244+ List all connections
245+
246+ Args:
247+ extra_headers: Send extra headers
248+
249+ extra_query: Add additional query parameters to the request
250+
251+ extra_body: Add additional JSON properties to the request
252+
253+ timeout: Override the client-level default timeout for this request, in seconds
254+ """
196255 return await self ._get (
197256 "/v3/connections" ,
198257 options = make_request_options (
199- extra_headers = extra_headers , extra_query = extra_query , extra_body = extra_body , timeout = timeout
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+ {"end_user_id" : end_user_id }, connection_list_params .ConnectionListParams
264+ ),
200265 ),
201266 cast_to = ConnectionListResponse ,
202267 )
0 commit comments