Debian Codegraph @

src/auth0/management/hooks/secrets/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_hook_secret_request_content import CreateHookSecretRequestContent
8 from ...types.delete_hook_secret_request_content import DeleteHookSecretRequestContent
9 from ...types.get_hook_secret_response_content import GetHookSecretResponseContent
10 from ...types.update_hook_secret_request_content import UpdateHookSecretRequestContent
11 from .raw_client import AsyncRawSecretsClient, RawSecretsClient
12
13 # this is used as the default value for optional parameters
14 OMIT = typing.cast(typing.Any, ...)
15
16
17 class SecretsClient:
18 def __init__(self, *, client_wrapper: SyncClientWrapper):
19 self._raw_client = RawSecretsClient(client_wrapper=client_wrapper)
20
21 @property
22 def with_raw_response(self) -> RawSecretsClient:
23 """
24 Retrieves a raw implementation of this client that returns raw responses.
25
26 Returns
27 -------
28 RawSecretsClient
29 """
30 return self._raw_client
31
32 def get(self, id: str, *, request_options: typing.Optional[RequestOptions] = None) -> GetHookSecretResponseContent:
33 """
34 Retrieve a hook's secrets by the ID of the hook.
35
36 Parameters
37 ----------
38 id : str
39 ID of the hook to retrieve secrets from.
40
41 request_options : typing.Optional[RequestOptions]
42 Request-specific configuration.
43
44 Returns
45 -------
46 GetHookSecretResponseContent
47 Hook secrets successfully retrieved.
48
49 Examples
50 --------
51 from auth0 import Auth0
52
53 client = Auth0(
54 token="YOUR_TOKEN",
55 )
56 client.hooks.secrets.get(
57 id="id",
58 )
59 """
60 _response = self._raw_client.get(id, request_options=request_options)
61 return _response.data
62
63 def create(
64 self,
65 id: str,
66 *,
67 request: CreateHookSecretRequestContent,
68 request_options: typing.Optional[RequestOptions] = None,
69 ) -> None:
70 """
71 Add one or more secrets to an existing hook. Accepts an object of key-value pairs, where the key is the name of the secret. A hook can have a maximum of 20 secrets.
72
73 Parameters
74 ----------
75 id : str
76 The id of the hook to retrieve
77
78 request : CreateHookSecretRequestContent
79
80 request_options : typing.Optional[RequestOptions]
81 Request-specific configuration.
82
83 Returns
84 -------
85 None
86
87 Examples
88 --------
89 from auth0 import Auth0
90
91 client = Auth0(
92 token="YOUR_TOKEN",
93 )
94 client.hooks.secrets.create(
95 id="id",
96 request={"key": "value"},
97 )
98 """
99 _response = self._raw_client.create(id, request=request, request_options=request_options)
100 return _response.data
101
102 def delete(
103 self,
104 id: str,
105 *,
106 request: DeleteHookSecretRequestContent,
107 request_options: typing.Optional[RequestOptions] = None,
108 ) -> None:
109 """
110 Delete one or more existing secrets for a given hook. Accepts an array of secret names to delete.
111
112 Parameters
113 ----------
114 id : str
115 ID of the hook whose secrets to delete.
116
117 request : DeleteHookSecretRequestContent
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.hooks.secrets.delete(
134 id="id",
135 request=["string"],
136 )
137 """
138 _response = self._raw_client.delete(id, request=request, request_options=request_options)
139 return _response.data
140
141 def update(
142 self,
143 id: str,
144 *,
145 request: UpdateHookSecretRequestContent,
146 request_options: typing.Optional[RequestOptions] = None,
147 ) -> None:
148 """
149 Update one or more existing secrets for an existing hook. Accepts an object of key-value pairs, where the key is the name of the existing secret.
150
151 Parameters
152 ----------
153 id : str
154 ID of the hook whose secrets to update.
155
156 request : UpdateHookSecretRequestContent
157
158 request_options : typing.Optional[RequestOptions]
159 Request-specific configuration.
160
161 Returns
162 -------
163 None
164
165 Examples
166 --------
167 from auth0 import Auth0
168
169 client = Auth0(
170 token="YOUR_TOKEN",
171 )
172 client.hooks.secrets.update(
173 id="id",
174 request={"key": "value"},
175 )
176 """
177 _response = self._raw_client.update(id, request=request, request_options=request_options)
178 return _response.data
179
180
181 class AsyncSecretsClient:
182 def __init__(self, *, client_wrapper: AsyncClientWrapper):
183 self._raw_client = AsyncRawSecretsClient(client_wrapper=client_wrapper)
184
185 @property
186 def with_raw_response(self) -> AsyncRawSecretsClient:
187 """
188 Retrieves a raw implementation of this client that returns raw responses.
189
190 Returns
191 -------
192 AsyncRawSecretsClient
193 """
194 return self._raw_client
195
196 async def get(
197 self, id: str, *, request_options: typing.Optional[RequestOptions] = None
198 ) -> GetHookSecretResponseContent:
199 """
200 Retrieve a hook's secrets by the ID of the hook.
201
202 Parameters
203 ----------
204 id : str
205 ID of the hook to retrieve secrets from.
206
207 request_options : typing.Optional[RequestOptions]
208 Request-specific configuration.
209
210 Returns
211 -------
212 GetHookSecretResponseContent
213 Hook secrets successfully retrieved.
214
215 Examples
216 --------
217 import asyncio
218
219 from auth0 import AsyncAuth0
220
221 client = AsyncAuth0(
222 token="YOUR_TOKEN",
223 )
224
225
226 async def main() -> None:
227 await client.hooks.secrets.get(
228 id="id",
229 )
230
231
232 asyncio.run(main())
233 """
234 _response = await self._raw_client.get(id, request_options=request_options)
235 return _response.data
236
237 async def create(
238 self,
239 id: str,
240 *,
241 request: CreateHookSecretRequestContent,
242 request_options: typing.Optional[RequestOptions] = None,
243 ) -> None:
244 """
245 Add one or more secrets to an existing hook. Accepts an object of key-value pairs, where the key is the name of the secret. A hook can have a maximum of 20 secrets.
246
247 Parameters
248 ----------
249 id : str
250 The id of the hook to retrieve
251
252 request : CreateHookSecretRequestContent
253
254 request_options : typing.Optional[RequestOptions]
255 Request-specific configuration.
256
257 Returns
258 -------
259 None
260
261 Examples
262 --------
263 import asyncio
264
265 from auth0 import AsyncAuth0
266
267 client = AsyncAuth0(
268 token="YOUR_TOKEN",
269 )
270
271
272 async def main() -> None:
273 await client.hooks.secrets.create(
274 id="id",
275 request={"key": "value"},
276 )
277
278
279 asyncio.run(main())
280 """
281 _response = await self._raw_client.create(id, request=request, request_options=request_options)
282 return _response.data
283
284 async def delete(
285 self,
286 id: str,
287 *,
288 request: DeleteHookSecretRequestContent,
289 request_options: typing.Optional[RequestOptions] = None,
290 ) -> None:
291 """
292 Delete one or more existing secrets for a given hook. Accepts an array of secret names to delete.
293
294 Parameters
295 ----------
296 id : str
297 ID of the hook whose secrets to delete.
298
299 request : DeleteHookSecretRequestContent
300
301 request_options : typing.Optional[RequestOptions]
302 Request-specific configuration.
303
304 Returns
305 -------
306 None
307
308 Examples
309 --------
310 import asyncio
311
312 from auth0 import AsyncAuth0
313
314 client = AsyncAuth0(
315 token="YOUR_TOKEN",
316 )
317
318
319 async def main() -> None:
320 await client.hooks.secrets.delete(
321 id="id",
322 request=["string"],
323 )
324
325
326 asyncio.run(main())
327 """
328 _response = await self._raw_client.delete(id, request=request, request_options=request_options)
329 return _response.data
330
331 async def update(
332 self,
333 id: str,
334 *,
335 request: UpdateHookSecretRequestContent,
336 request_options: typing.Optional[RequestOptions] = None,
337 ) -> None:
338 """
339 Update one or more existing secrets for an existing hook. Accepts an object of key-value pairs, where the key is the name of the existing secret.
340
341 Parameters
342 ----------
343 id : str
344 ID of the hook whose secrets to update.
345
346 request : UpdateHookSecretRequestContent
347
348 request_options : typing.Optional[RequestOptions]
349 Request-specific configuration.
350
351 Returns
352 -------
353 None
354
355 Examples
356 --------
357 import asyncio
358
359 from auth0 import AsyncAuth0
360
361 client = AsyncAuth0(
362 token="YOUR_TOKEN",
363 )
364
365
366 async def main() -> None:
367 await client.hooks.secrets.update(
368 id="id",
369 request={"key": "value"},
370 )
371
372
373 asyncio.run(main())
374 """
375 _response = await self._raw_client.update(id, request=request, request_options=request_options)
376 return _response.data