44
55import httpx
66
7- from ...._types import Body , Omit , Query , Headers , NoneType , NotGiven , omit , not_given
7+ from ...._types import Body , Omit , Query , Headers , NoneType , NotGiven , SequenceNotStr , omit , not_given
88from ...._utils import maybe_transform , async_maybe_transform
99from ...._compat import cached_property
1010from .invocations import (
2626from ...._base_client import AsyncPaginator , make_request_options
2727from ....types .agents import auth_list_params , auth_create_params
2828from ....types .agents .auth_agent import AuthAgent
29- from ....types .agents .reauth_response import ReauthResponse
3029
3130__all__ = ["AuthResource" , "AsyncAuthResource" ]
3231
@@ -58,8 +57,9 @@ def with_streaming_response(self) -> AuthResourceWithStreamingResponse:
5857 def create (
5958 self ,
6059 * ,
60+ domain : str ,
6161 profile_name : str ,
62- target_domain : str ,
62+ allowed_domains : SequenceNotStr [ str ] | Omit = omit ,
6363 credential_name : str | Omit = omit ,
6464 login_url : str | Omit = omit ,
6565 proxy : auth_create_params .Proxy | Omit = omit ,
@@ -77,9 +77,13 @@ def create(
7777 invocation - use POST /agents/auth/invocations to start an auth flow.
7878
7979 Args:
80+ domain: Domain for authentication
81+
8082 profile_name: Name of the profile to use for this auth agent
8183
82- target_domain: Target domain for authentication
84+ allowed_domains: Additional domains that are valid for this auth agent's authentication flow
85+ (besides the primary domain). Useful when login pages redirect to different
86+ domains.
8387
8488 credential_name: Optional name of an existing credential to use for this auth agent. If provided,
8589 the credential will be linked to the agent and its values will be used to
@@ -102,8 +106,9 @@ def create(
102106 "/agents/auth" ,
103107 body = maybe_transform (
104108 {
109+ "domain" : domain ,
105110 "profile_name" : profile_name ,
106- "target_domain " : target_domain ,
111+ "allowed_domains " : allowed_domains ,
107112 "credential_name" : credential_name ,
108113 "login_url" : login_url ,
109114 "proxy" : proxy ,
@@ -154,10 +159,10 @@ def retrieve(
154159 def list (
155160 self ,
156161 * ,
162+ domain : str | Omit = omit ,
157163 limit : int | Omit = omit ,
158164 offset : int | Omit = omit ,
159165 profile_name : str | Omit = omit ,
160- target_domain : str | Omit = omit ,
161166 # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
162167 # The extra values given here take precedence over values defined on the client or passed to this method.
163168 extra_headers : Headers | None = None ,
@@ -166,17 +171,17 @@ def list(
166171 timeout : float | httpx .Timeout | None | NotGiven = not_given ,
167172 ) -> SyncOffsetPagination [AuthAgent ]:
168173 """
169- List auth agents with optional filters for profile_name and target_domain .
174+ List auth agents with optional filters for profile_name and domain .
170175
171176 Args:
177+ domain: Filter by domain
178+
172179 limit: Maximum number of results to return
173180
174181 offset: Number of results to skip
175182
176183 profile_name: Filter by profile name
177184
178- target_domain: Filter by target domain
179-
180185 extra_headers: Send extra headers
181186
182187 extra_query: Add additional query parameters to the request
@@ -195,10 +200,10 @@ def list(
195200 timeout = timeout ,
196201 query = maybe_transform (
197202 {
203+ "domain" : domain ,
198204 "limit" : limit ,
199205 "offset" : offset ,
200206 "profile_name" : profile_name ,
201- "target_domain" : target_domain ,
202207 },
203208 auth_list_params .AuthListParams ,
204209 ),
@@ -245,42 +250,6 @@ def delete(
245250 cast_to = NoneType ,
246251 )
247252
248- def reauth (
249- self ,
250- id : str ,
251- * ,
252- # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
253- # The extra values given here take precedence over values defined on the client or passed to this method.
254- extra_headers : Headers | None = None ,
255- extra_query : Query | None = None ,
256- extra_body : Body | None = None ,
257- timeout : float | httpx .Timeout | None | NotGiven = not_given ,
258- ) -> ReauthResponse :
259- """
260- Triggers automatic re-authentication for an auth agent using stored credentials.
261- Requires the auth agent to have a linked credential, stored selectors, and
262- login_url. Returns immediately with status indicating whether re-auth was
263- started.
264-
265- Args:
266- extra_headers: Send extra headers
267-
268- extra_query: Add additional query parameters to the request
269-
270- extra_body: Add additional JSON properties to the request
271-
272- timeout: Override the client-level default timeout for this request, in seconds
273- """
274- if not id :
275- raise ValueError (f"Expected a non-empty value for `id` but received { id !r} " )
276- return self ._post (
277- f"/agents/auth/{ id } /reauth" ,
278- options = make_request_options (
279- extra_headers = extra_headers , extra_query = extra_query , extra_body = extra_body , timeout = timeout
280- ),
281- cast_to = ReauthResponse ,
282- )
283-
284253
285254class AsyncAuthResource (AsyncAPIResource ):
286255 @cached_property
@@ -309,8 +278,9 @@ def with_streaming_response(self) -> AsyncAuthResourceWithStreamingResponse:
309278 async def create (
310279 self ,
311280 * ,
281+ domain : str ,
312282 profile_name : str ,
313- target_domain : str ,
283+ allowed_domains : SequenceNotStr [ str ] | Omit = omit ,
314284 credential_name : str | Omit = omit ,
315285 login_url : str | Omit = omit ,
316286 proxy : auth_create_params .Proxy | Omit = omit ,
@@ -328,9 +298,13 @@ async def create(
328298 invocation - use POST /agents/auth/invocations to start an auth flow.
329299
330300 Args:
301+ domain: Domain for authentication
302+
331303 profile_name: Name of the profile to use for this auth agent
332304
333- target_domain: Target domain for authentication
305+ allowed_domains: Additional domains that are valid for this auth agent's authentication flow
306+ (besides the primary domain). Useful when login pages redirect to different
307+ domains.
334308
335309 credential_name: Optional name of an existing credential to use for this auth agent. If provided,
336310 the credential will be linked to the agent and its values will be used to
@@ -353,8 +327,9 @@ async def create(
353327 "/agents/auth" ,
354328 body = await async_maybe_transform (
355329 {
330+ "domain" : domain ,
356331 "profile_name" : profile_name ,
357- "target_domain " : target_domain ,
332+ "allowed_domains " : allowed_domains ,
358333 "credential_name" : credential_name ,
359334 "login_url" : login_url ,
360335 "proxy" : proxy ,
@@ -405,10 +380,10 @@ async def retrieve(
405380 def list (
406381 self ,
407382 * ,
383+ domain : str | Omit = omit ,
408384 limit : int | Omit = omit ,
409385 offset : int | Omit = omit ,
410386 profile_name : str | Omit = omit ,
411- target_domain : str | Omit = omit ,
412387 # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
413388 # The extra values given here take precedence over values defined on the client or passed to this method.
414389 extra_headers : Headers | None = None ,
@@ -417,17 +392,17 @@ def list(
417392 timeout : float | httpx .Timeout | None | NotGiven = not_given ,
418393 ) -> AsyncPaginator [AuthAgent , AsyncOffsetPagination [AuthAgent ]]:
419394 """
420- List auth agents with optional filters for profile_name and target_domain .
395+ List auth agents with optional filters for profile_name and domain .
421396
422397 Args:
398+ domain: Filter by domain
399+
423400 limit: Maximum number of results to return
424401
425402 offset: Number of results to skip
426403
427404 profile_name: Filter by profile name
428405
429- target_domain: Filter by target domain
430-
431406 extra_headers: Send extra headers
432407
433408 extra_query: Add additional query parameters to the request
@@ -446,10 +421,10 @@ def list(
446421 timeout = timeout ,
447422 query = maybe_transform (
448423 {
424+ "domain" : domain ,
449425 "limit" : limit ,
450426 "offset" : offset ,
451427 "profile_name" : profile_name ,
452- "target_domain" : target_domain ,
453428 },
454429 auth_list_params .AuthListParams ,
455430 ),
@@ -496,42 +471,6 @@ async def delete(
496471 cast_to = NoneType ,
497472 )
498473
499- async def reauth (
500- self ,
501- id : str ,
502- * ,
503- # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
504- # The extra values given here take precedence over values defined on the client or passed to this method.
505- extra_headers : Headers | None = None ,
506- extra_query : Query | None = None ,
507- extra_body : Body | None = None ,
508- timeout : float | httpx .Timeout | None | NotGiven = not_given ,
509- ) -> ReauthResponse :
510- """
511- Triggers automatic re-authentication for an auth agent using stored credentials.
512- Requires the auth agent to have a linked credential, stored selectors, and
513- login_url. Returns immediately with status indicating whether re-auth was
514- started.
515-
516- Args:
517- extra_headers: Send extra headers
518-
519- extra_query: Add additional query parameters to the request
520-
521- extra_body: Add additional JSON properties to the request
522-
523- timeout: Override the client-level default timeout for this request, in seconds
524- """
525- if not id :
526- raise ValueError (f"Expected a non-empty value for `id` but received { id !r} " )
527- return await self ._post (
528- f"/agents/auth/{ id } /reauth" ,
529- options = make_request_options (
530- extra_headers = extra_headers , extra_query = extra_query , extra_body = extra_body , timeout = timeout
531- ),
532- cast_to = ReauthResponse ,
533- )
534-
535474
536475class AuthResourceWithRawResponse :
537476 def __init__ (self , auth : AuthResource ) -> None :
@@ -549,9 +488,6 @@ def __init__(self, auth: AuthResource) -> None:
549488 self .delete = to_raw_response_wrapper (
550489 auth .delete ,
551490 )
552- self .reauth = to_raw_response_wrapper (
553- auth .reauth ,
554- )
555491
556492 @cached_property
557493 def invocations (self ) -> InvocationsResourceWithRawResponse :
@@ -574,9 +510,6 @@ def __init__(self, auth: AsyncAuthResource) -> None:
574510 self .delete = async_to_raw_response_wrapper (
575511 auth .delete ,
576512 )
577- self .reauth = async_to_raw_response_wrapper (
578- auth .reauth ,
579- )
580513
581514 @cached_property
582515 def invocations (self ) -> AsyncInvocationsResourceWithRawResponse :
@@ -599,9 +532,6 @@ def __init__(self, auth: AuthResource) -> None:
599532 self .delete = to_streamed_response_wrapper (
600533 auth .delete ,
601534 )
602- self .reauth = to_streamed_response_wrapper (
603- auth .reauth ,
604- )
605535
606536 @cached_property
607537 def invocations (self ) -> InvocationsResourceWithStreamingResponse :
@@ -624,9 +554,6 @@ def __init__(self, auth: AsyncAuthResource) -> None:
624554 self .delete = async_to_streamed_response_wrapper (
625555 auth .delete ,
626556 )
627- self .reauth = async_to_streamed_response_wrapper (
628- auth .reauth ,
629- )
630557
631558 @cached_property
632559 def invocations (self ) -> AsyncInvocationsResourceWithStreamingResponse :
0 commit comments