Debian Codegraph @

src/auth0/management/clients/connections/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.connection_for_list import ConnectionForList
9 from ...types.connection_strategy_enum import ConnectionStrategyEnum
10 from ...types.list_client_connections_response_content import ListClientConnectionsResponseContent
11 from .raw_client import AsyncRawConnectionsClient, RawConnectionsClient
12
13
14 class ConnectionsClient:
15 def __init__(self, *, client_wrapper: SyncClientWrapper):
16 self._raw_client = RawConnectionsClient(client_wrapper=client_wrapper)
17
18 @property
19 def with_raw_response(self) -> RawConnectionsClient:
20 """
21 Retrieves a raw implementation of this client that returns raw responses.
22
23 Returns
24 -------
25 RawConnectionsClient
26 """
27 return self._raw_client
28
29 def get(
30 self,
31 id: str,
32 *,
33 strategy: typing.Optional[typing.Union[ConnectionStrategyEnum, typing.Sequence[ConnectionStrategyEnum]]] = None,
34 from_: typing.Optional[str] = None,
35 take: typing.Optional[int] = 50,
36 fields: typing.Optional[str] = None,
37 include_fields: typing.Optional[bool] = None,
38 request_options: typing.Optional[RequestOptions] = None,
39 ) -> SyncPager[ConnectionForList, ListClientConnectionsResponseContent]:
40 """
41 Retrieve all connections that are enabled for the specified [Application](https://www.auth0.com/docs/get-started/applications), using checkpoint pagination. A list of fields to include or exclude for each connection may also be specified.
42
43 - This endpoint requires the `read:connections` scope and any one of `read:clients` or `read:client_summary`.
44 - **Note**: The first time you call this endpoint, omit the `from` parameter. If there are more results, a `next` value is included in the response. You can use this for subsequent API calls. When `next` is no longer included in the response, no further results are remaining.
45
46 Parameters
47 ----------
48 id : str
49 ID of the client for which to retrieve enabled connections.
50
51 strategy : typing.Optional[typing.Union[ConnectionStrategyEnum, typing.Sequence[ConnectionStrategyEnum]]]
52 Provide strategies to only retrieve connections with such strategies
53
54 from_ : typing.Optional[str]
55 Optional Id from which to start selection.
56
57 take : typing.Optional[int]
58 Number of results per page. Defaults to 50.
59
60 fields : typing.Optional[str]
61 A comma separated list of fields to include or exclude (depending on include_fields) from the result, empty to retrieve all fields
62
63 include_fields : typing.Optional[bool]
64 <code>true</code> if the fields specified are to be included in the result, <code>false</code> otherwise (defaults to <code>true</code>)
65
66 request_options : typing.Optional[RequestOptions]
67 Request-specific configuration.
68
69 Returns
70 -------
71 SyncPager[ConnectionForList, ListClientConnectionsResponseContent]
72 Success
73
74 Examples
75 --------
76 from auth0 import Auth0
77
78 client = Auth0(
79 token="YOUR_TOKEN",
80 )
81 response = client.clients.connections.get(
82 id="id",
83 strategy=["ad"],
84 from_="from",
85 take=1,
86 fields="fields",
87 include_fields=True,
88 )
89 for item in response:
90 yield item
91 # alternatively, you can paginate page-by-page
92 for page in response.iter_pages():
93 yield page
94 """
95 return self._raw_client.get(
96 id,
97 strategy=strategy,
98 from_=from_,
99 take=take,
100 fields=fields,
101 include_fields=include_fields,
102 request_options=request_options,
103 )
104
105
106 class AsyncConnectionsClient:
107 def __init__(self, *, client_wrapper: AsyncClientWrapper):
108 self._raw_client = AsyncRawConnectionsClient(client_wrapper=client_wrapper)
109
110 @property
111 def with_raw_response(self) -> AsyncRawConnectionsClient:
112 """
113 Retrieves a raw implementation of this client that returns raw responses.
114
115 Returns
116 -------
117 AsyncRawConnectionsClient
118 """
119 return self._raw_client
120
121 async def get(
122 self,
123 id: str,
124 *,
125 strategy: typing.Optional[typing.Union[ConnectionStrategyEnum, typing.Sequence[ConnectionStrategyEnum]]] = None,
126 from_: typing.Optional[str] = None,
127 take: typing.Optional[int] = 50,
128 fields: typing.Optional[str] = None,
129 include_fields: typing.Optional[bool] = None,
130 request_options: typing.Optional[RequestOptions] = None,
131 ) -> AsyncPager[ConnectionForList, ListClientConnectionsResponseContent]:
132 """
133 Retrieve all connections that are enabled for the specified [Application](https://www.auth0.com/docs/get-started/applications), using checkpoint pagination. A list of fields to include or exclude for each connection may also be specified.
134
135 - This endpoint requires the `read:connections` scope and any one of `read:clients` or `read:client_summary`.
136 - **Note**: The first time you call this endpoint, omit the `from` parameter. If there are more results, a `next` value is included in the response. You can use this for subsequent API calls. When `next` is no longer included in the response, no further results are remaining.
137
138 Parameters
139 ----------
140 id : str
141 ID of the client for which to retrieve enabled connections.
142
143 strategy : typing.Optional[typing.Union[ConnectionStrategyEnum, typing.Sequence[ConnectionStrategyEnum]]]
144 Provide strategies to only retrieve connections with such strategies
145
146 from_ : typing.Optional[str]
147 Optional Id from which to start selection.
148
149 take : typing.Optional[int]
150 Number of results per page. Defaults to 50.
151
152 fields : typing.Optional[str]
153 A comma separated list of fields to include or exclude (depending on include_fields) from the result, empty to retrieve all fields
154
155 include_fields : typing.Optional[bool]
156 <code>true</code> if the fields specified are to be included in the result, <code>false</code> otherwise (defaults to <code>true</code>)
157
158 request_options : typing.Optional[RequestOptions]
159 Request-specific configuration.
160
161 Returns
162 -------
163 AsyncPager[ConnectionForList, ListClientConnectionsResponseContent]
164 Success
165
166 Examples
167 --------
168 import asyncio
169
170 from auth0 import AsyncAuth0
171
172 client = AsyncAuth0(
173 token="YOUR_TOKEN",
174 )
175
176
177 async def main() -> None:
178 response = await client.clients.connections.get(
179 id="id",
180 strategy=["ad"],
181 from_="from",
182 take=1,
183 fields="fields",
184 include_fields=True,
185 )
186 async for item in response:
187 yield item
188
189 # alternatively, you can paginate page-by-page
190 async for page in response.iter_pages():
191 yield page
192
193
194 asyncio.run(main())
195 """
196 return await self._raw_client.get(
197 id,
198 strategy=strategy,
199 from_=from_,
200 take=take,
201 fields=fields,
202 include_fields=include_fields,
203 request_options=request_options,
204 )