Debian Codegraph @

src/auth0/management/users/connected_accounts/client.py

raw symbols SCIP
1 # This file was auto-generated by Fern from our API Definition.
2
3 import typing
4
5 from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
6 from ...core.pagination import AsyncPager, SyncPager
7 from ...core.request_options import RequestOptions
8 from ...types.connected_account import ConnectedAccount
9 from ...types.list_user_connected_accounts_response_content import ListUserConnectedAccountsResponseContent
10 from .raw_client import AsyncRawConnectedAccountsClient, RawConnectedAccountsClient
11
12
13 class ConnectedAccountsClient:
14 def __init__(self, *, client_wrapper: SyncClientWrapper):
15 self._raw_client = RawConnectedAccountsClient(client_wrapper=client_wrapper)
16
17 @property
18 def with_raw_response(self) -> RawConnectedAccountsClient:
19 """
20 Retrieves a raw implementation of this client that returns raw responses.
21
22 Returns
23 -------
24 RawConnectedAccountsClient
25 """
26 return self._raw_client
27
28 def list(
29 self,
30 id: str,
31 *,
32 from_: typing.Optional[str] = None,
33 take: typing.Optional[int] = 50,
34 request_options: typing.Optional[RequestOptions] = None,
35 ) -> SyncPager[ConnectedAccount, ListUserConnectedAccountsResponseContent]:
36 """
37 Retrieve all connected accounts associated with the user.
38
39 Parameters
40 ----------
41 id : str
42 ID of the user to list connected accounts for.
43
44 from_ : typing.Optional[str]
45 Optional Id from which to start selection.
46
47 take : typing.Optional[int]
48 Number of results to return. Defaults to 10 with a maximum of 20
49
50 request_options : typing.Optional[RequestOptions]
51 Request-specific configuration.
52
53 Returns
54 -------
55 SyncPager[ConnectedAccount, ListUserConnectedAccountsResponseContent]
56 Connected accounts successfully retrieved.
57
58 Examples
59 --------
60 from auth0 import Auth0
61
62 client = Auth0(
63 token="YOUR_TOKEN",
64 )
65 response = client.users.connected_accounts.list(
66 id="id",
67 from_="from",
68 take=1,
69 )
70 for item in response:
71 yield item
72 # alternatively, you can paginate page-by-page
73 for page in response.iter_pages():
74 yield page
75 """
76 return self._raw_client.list(id, from_=from_, take=take, request_options=request_options)
77
78
79 class AsyncConnectedAccountsClient:
80 def __init__(self, *, client_wrapper: AsyncClientWrapper):
81 self._raw_client = AsyncRawConnectedAccountsClient(client_wrapper=client_wrapper)
82
83 @property
84 def with_raw_response(self) -> AsyncRawConnectedAccountsClient:
85 """
86 Retrieves a raw implementation of this client that returns raw responses.
87
88 Returns
89 -------
90 AsyncRawConnectedAccountsClient
91 """
92 return self._raw_client
93
94 async def list(
95 self,
96 id: str,
97 *,
98 from_: typing.Optional[str] = None,
99 take: typing.Optional[int] = 50,
100 request_options: typing.Optional[RequestOptions] = None,
101 ) -> AsyncPager[ConnectedAccount, ListUserConnectedAccountsResponseContent]:
102 """
103 Retrieve all connected accounts associated with the user.
104
105 Parameters
106 ----------
107 id : str
108 ID of the user to list connected accounts for.
109
110 from_ : typing.Optional[str]
111 Optional Id from which to start selection.
112
113 take : typing.Optional[int]
114 Number of results to return. Defaults to 10 with a maximum of 20
115
116 request_options : typing.Optional[RequestOptions]
117 Request-specific configuration.
118
119 Returns
120 -------
121 AsyncPager[ConnectedAccount, ListUserConnectedAccountsResponseContent]
122 Connected accounts successfully retrieved.
123
124 Examples
125 --------
126 import asyncio
127
128 from auth0 import AsyncAuth0
129
130 client = AsyncAuth0(
131 token="YOUR_TOKEN",
132 )
133
134
135 async def main() -> None:
136 response = await client.users.connected_accounts.list(
137 id="id",
138 from_="from",
139 take=1,
140 )
141 async for item in response:
142 yield item
143
144 # alternatively, you can paginate page-by-page
145 async for page in response.iter_pages():
146 yield page
147
148
149 asyncio.run(main())
150 """
151 return await self._raw_client.list(id, from_=from_, take=take, request_options=request_options)