Debian Codegraph @

src/auth0/management/connections/scim_configuration/tokens/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.request_options import RequestOptions
7 from ....types.create_scim_token_response_content import CreateScimTokenResponseContent
8 from ....types.get_scim_tokens_response_content import GetScimTokensResponseContent
9 from .raw_client import AsyncRawTokensClient, RawTokensClient
10
11 # this is used as the default value for optional parameters
12 OMIT = typing.cast(typing.Any, ...)
13
14
15 class TokensClient:
16 def __init__(self, *, client_wrapper: SyncClientWrapper):
17 self._raw_client = RawTokensClient(client_wrapper=client_wrapper)
18
19 @property
20 def with_raw_response(self) -> RawTokensClient:
21 """
22 Retrieves a raw implementation of this client that returns raw responses.
23
24 Returns
25 -------
26 RawTokensClient
27 """
28 return self._raw_client
29
30 def get(self, id: str, *, request_options: typing.Optional[RequestOptions] = None) -> GetScimTokensResponseContent:
31 """
32 Retrieves all scim tokens by its connection `id`.
33
34 Parameters
35 ----------
36 id : str
37 The id of the connection to retrieve its SCIM configuration
38
39 request_options : typing.Optional[RequestOptions]
40 Request-specific configuration.
41
42 Returns
43 -------
44 GetScimTokensResponseContent
45 The connection's SCIM tokens were retrieved. See <strong>Response Schemas</strong> for schema.
46
47 Examples
48 --------
49 from auth0 import Auth0
50
51 client = Auth0(
52 token="YOUR_TOKEN",
53 )
54 client.connections.scim_configuration.tokens.get(
55 id="id",
56 )
57 """
58 _response = self._raw_client.get(id, request_options=request_options)
59 return _response.data
60
61 def create(
62 self,
63 id: str,
64 *,
65 scopes: typing.Optional[typing.Sequence[str]] = OMIT,
66 token_lifetime: typing.Optional[int] = OMIT,
67 request_options: typing.Optional[RequestOptions] = None,
68 ) -> CreateScimTokenResponseContent:
69 """
70 Create a scim token for a scim client.
71
72 Parameters
73 ----------
74 id : str
75 The id of the connection to create its SCIM token
76
77 scopes : typing.Optional[typing.Sequence[str]]
78 The scopes of the scim token
79
80 token_lifetime : typing.Optional[int]
81 Lifetime of the token in seconds. Must be greater than 900
82
83 request_options : typing.Optional[RequestOptions]
84 Request-specific configuration.
85
86 Returns
87 -------
88 CreateScimTokenResponseContent
89 The connection's SCIM token was created. See <strong>Response Schemas</strong> for schema.
90
91 Examples
92 --------
93 from auth0 import Auth0
94
95 client = Auth0(
96 token="YOUR_TOKEN",
97 )
98 client.connections.scim_configuration.tokens.create(
99 id="id",
100 )
101 """
102 _response = self._raw_client.create(
103 id, scopes=scopes, token_lifetime=token_lifetime, request_options=request_options
104 )
105 return _response.data
106
107 def delete(self, id: str, token_id: str, *, request_options: typing.Optional[RequestOptions] = None) -> None:
108 """
109 Deletes a scim token by its connection `id` and `tokenId`.
110
111 Parameters
112 ----------
113 id : str
114 The connection id that owns the SCIM token to delete
115
116 token_id : str
117 The id of the scim token to delete
118
119 request_options : typing.Optional[RequestOptions]
120 Request-specific configuration.
121
122 Returns
123 -------
124 None
125
126 Examples
127 --------
128 from auth0 import Auth0
129
130 client = Auth0(
131 token="YOUR_TOKEN",
132 )
133 client.connections.scim_configuration.tokens.delete(
134 id="id",
135 token_id="tokenId",
136 )
137 """
138 _response = self._raw_client.delete(id, token_id, request_options=request_options)
139 return _response.data
140
141
142 class AsyncTokensClient:
143 def __init__(self, *, client_wrapper: AsyncClientWrapper):
144 self._raw_client = AsyncRawTokensClient(client_wrapper=client_wrapper)
145
146 @property
147 def with_raw_response(self) -> AsyncRawTokensClient:
148 """
149 Retrieves a raw implementation of this client that returns raw responses.
150
151 Returns
152 -------
153 AsyncRawTokensClient
154 """
155 return self._raw_client
156
157 async def get(
158 self, id: str, *, request_options: typing.Optional[RequestOptions] = None
159 ) -> GetScimTokensResponseContent:
160 """
161 Retrieves all scim tokens by its connection `id`.
162
163 Parameters
164 ----------
165 id : str
166 The id of the connection to retrieve its SCIM configuration
167
168 request_options : typing.Optional[RequestOptions]
169 Request-specific configuration.
170
171 Returns
172 -------
173 GetScimTokensResponseContent
174 The connection's SCIM tokens were retrieved. See <strong>Response Schemas</strong> for schema.
175
176 Examples
177 --------
178 import asyncio
179
180 from auth0 import AsyncAuth0
181
182 client = AsyncAuth0(
183 token="YOUR_TOKEN",
184 )
185
186
187 async def main() -> None:
188 await client.connections.scim_configuration.tokens.get(
189 id="id",
190 )
191
192
193 asyncio.run(main())
194 """
195 _response = await self._raw_client.get(id, request_options=request_options)
196 return _response.data
197
198 async def create(
199 self,
200 id: str,
201 *,
202 scopes: typing.Optional[typing.Sequence[str]] = OMIT,
203 token_lifetime: typing.Optional[int] = OMIT,
204 request_options: typing.Optional[RequestOptions] = None,
205 ) -> CreateScimTokenResponseContent:
206 """
207 Create a scim token for a scim client.
208
209 Parameters
210 ----------
211 id : str
212 The id of the connection to create its SCIM token
213
214 scopes : typing.Optional[typing.Sequence[str]]
215 The scopes of the scim token
216
217 token_lifetime : typing.Optional[int]
218 Lifetime of the token in seconds. Must be greater than 900
219
220 request_options : typing.Optional[RequestOptions]
221 Request-specific configuration.
222
223 Returns
224 -------
225 CreateScimTokenResponseContent
226 The connection's SCIM token was created. See <strong>Response Schemas</strong> for schema.
227
228 Examples
229 --------
230 import asyncio
231
232 from auth0 import AsyncAuth0
233
234 client = AsyncAuth0(
235 token="YOUR_TOKEN",
236 )
237
238
239 async def main() -> None:
240 await client.connections.scim_configuration.tokens.create(
241 id="id",
242 )
243
244
245 asyncio.run(main())
246 """
247 _response = await self._raw_client.create(
248 id, scopes=scopes, token_lifetime=token_lifetime, request_options=request_options
249 )
250 return _response.data
251
252 async def delete(self, id: str, token_id: str, *, request_options: typing.Optional[RequestOptions] = None) -> None:
253 """
254 Deletes a scim token by its connection `id` and `tokenId`.
255
256 Parameters
257 ----------
258 id : str
259 The connection id that owns the SCIM token to delete
260
261 token_id : str
262 The id of the scim token to delete
263
264 request_options : typing.Optional[RequestOptions]
265 Request-specific configuration.
266
267 Returns
268 -------
269 None
270
271 Examples
272 --------
273 import asyncio
274
275 from auth0 import AsyncAuth0
276
277 client = AsyncAuth0(
278 token="YOUR_TOKEN",
279 )
280
281
282 async def main() -> None:
283 await client.connections.scim_configuration.tokens.delete(
284 id="id",
285 token_id="tokenId",
286 )
287
288
289 asyncio.run(main())
290 """
291 _response = await self._raw_client.delete(id, token_id, request_options=request_options)
292 return _response.data