Debian Codegraph @

src/auth0/management/actions/triggers/bindings/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.action_binding import ActionBinding
9 from ....types.action_binding_with_ref import ActionBindingWithRef
10 from ....types.action_trigger_type_enum import ActionTriggerTypeEnum
11 from ....types.list_action_bindings_paginated_response_content import ListActionBindingsPaginatedResponseContent
12 from ....types.update_action_bindings_response_content import UpdateActionBindingsResponseContent
13 from .raw_client import AsyncRawBindingsClient, RawBindingsClient
14
15 # this is used as the default value for optional parameters
16 OMIT = typing.cast(typing.Any, ...)
17
18
19 class BindingsClient:
20 def __init__(self, *, client_wrapper: SyncClientWrapper):
21 self._raw_client = RawBindingsClient(client_wrapper=client_wrapper)
22
23 @property
24 def with_raw_response(self) -> RawBindingsClient:
25 """
26 Retrieves a raw implementation of this client that returns raw responses.
27
28 Returns
29 -------
30 RawBindingsClient
31 """
32 return self._raw_client
33
34 def list(
35 self,
36 trigger_id: ActionTriggerTypeEnum,
37 *,
38 page: typing.Optional[int] = 0,
39 per_page: typing.Optional[int] = 50,
40 request_options: typing.Optional[RequestOptions] = None,
41 ) -> SyncPager[ActionBinding, ListActionBindingsPaginatedResponseContent]:
42 """
43 Retrieve the actions that are bound to a trigger. Once an action is created and deployed, it must be attached (i.e. bound) to a trigger so that it will be executed as part of a flow. The list of actions returned reflects the order in which they will be executed during the appropriate flow.
44
45 Parameters
46 ----------
47 trigger_id : ActionTriggerTypeEnum
48 An actions extensibility point.
49
50 page : typing.Optional[int]
51 Use this field to request a specific page of the list results.
52
53 per_page : typing.Optional[int]
54 The maximum number of results to be returned in a single request. 20 by default
55
56 request_options : typing.Optional[RequestOptions]
57 Request-specific configuration.
58
59 Returns
60 -------
61 SyncPager[ActionBinding, ListActionBindingsPaginatedResponseContent]
62 The bindings were retrieved.
63
64 Examples
65 --------
66 from auth0 import Auth0
67
68 client = Auth0(
69 token="YOUR_TOKEN",
70 )
71 response = client.actions.triggers.bindings.list(
72 trigger_id="post-login",
73 page=1,
74 per_page=1,
75 )
76 for item in response:
77 yield item
78 # alternatively, you can paginate page-by-page
79 for page in response.iter_pages():
80 yield page
81 """
82 return self._raw_client.list(trigger_id, page=page, per_page=per_page, request_options=request_options)
83
84 def update_many(
85 self,
86 trigger_id: ActionTriggerTypeEnum,
87 *,
88 bindings: typing.Optional[typing.Sequence[ActionBindingWithRef]] = OMIT,
89 request_options: typing.Optional[RequestOptions] = None,
90 ) -> UpdateActionBindingsResponseContent:
91 """
92 Update the actions that are bound (i.e. attached) to a trigger. Once an action is created and deployed, it must be attached (i.e. bound) to a trigger so that it will be executed as part of a flow. The order in which the actions are provided will determine the order in which they are executed.
93
94 Parameters
95 ----------
96 trigger_id : ActionTriggerTypeEnum
97 An actions extensibility point.
98
99 bindings : typing.Optional[typing.Sequence[ActionBindingWithRef]]
100 The actions that will be bound to this trigger. The order in which they are included will be the order in which they are executed.
101
102 request_options : typing.Optional[RequestOptions]
103 Request-specific configuration.
104
105 Returns
106 -------
107 UpdateActionBindingsResponseContent
108 The bindings were updated.
109
110 Examples
111 --------
112 from auth0 import Auth0
113
114 client = Auth0(
115 token="YOUR_TOKEN",
116 )
117 client.actions.triggers.bindings.update_many(
118 trigger_id="post-login",
119 )
120 """
121 _response = self._raw_client.update_many(trigger_id, bindings=bindings, request_options=request_options)
122 return _response.data
123
124
125 class AsyncBindingsClient:
126 def __init__(self, *, client_wrapper: AsyncClientWrapper):
127 self._raw_client = AsyncRawBindingsClient(client_wrapper=client_wrapper)
128
129 @property
130 def with_raw_response(self) -> AsyncRawBindingsClient:
131 """
132 Retrieves a raw implementation of this client that returns raw responses.
133
134 Returns
135 -------
136 AsyncRawBindingsClient
137 """
138 return self._raw_client
139
140 async def list(
141 self,
142 trigger_id: ActionTriggerTypeEnum,
143 *,
144 page: typing.Optional[int] = 0,
145 per_page: typing.Optional[int] = 50,
146 request_options: typing.Optional[RequestOptions] = None,
147 ) -> AsyncPager[ActionBinding, ListActionBindingsPaginatedResponseContent]:
148 """
149 Retrieve the actions that are bound to a trigger. Once an action is created and deployed, it must be attached (i.e. bound) to a trigger so that it will be executed as part of a flow. The list of actions returned reflects the order in which they will be executed during the appropriate flow.
150
151 Parameters
152 ----------
153 trigger_id : ActionTriggerTypeEnum
154 An actions extensibility point.
155
156 page : typing.Optional[int]
157 Use this field to request a specific page of the list results.
158
159 per_page : typing.Optional[int]
160 The maximum number of results to be returned in a single request. 20 by default
161
162 request_options : typing.Optional[RequestOptions]
163 Request-specific configuration.
164
165 Returns
166 -------
167 AsyncPager[ActionBinding, ListActionBindingsPaginatedResponseContent]
168 The bindings were retrieved.
169
170 Examples
171 --------
172 import asyncio
173
174 from auth0 import AsyncAuth0
175
176 client = AsyncAuth0(
177 token="YOUR_TOKEN",
178 )
179
180
181 async def main() -> None:
182 response = await client.actions.triggers.bindings.list(
183 trigger_id="post-login",
184 page=1,
185 per_page=1,
186 )
187 async for item in response:
188 yield item
189
190 # alternatively, you can paginate page-by-page
191 async for page in response.iter_pages():
192 yield page
193
194
195 asyncio.run(main())
196 """
197 return await self._raw_client.list(trigger_id, page=page, per_page=per_page, request_options=request_options)
198
199 async def update_many(
200 self,
201 trigger_id: ActionTriggerTypeEnum,
202 *,
203 bindings: typing.Optional[typing.Sequence[ActionBindingWithRef]] = OMIT,
204 request_options: typing.Optional[RequestOptions] = None,
205 ) -> UpdateActionBindingsResponseContent:
206 """
207 Update the actions that are bound (i.e. attached) to a trigger. Once an action is created and deployed, it must be attached (i.e. bound) to a trigger so that it will be executed as part of a flow. The order in which the actions are provided will determine the order in which they are executed.
208
209 Parameters
210 ----------
211 trigger_id : ActionTriggerTypeEnum
212 An actions extensibility point.
213
214 bindings : typing.Optional[typing.Sequence[ActionBindingWithRef]]
215 The actions that will be bound to this trigger. The order in which they are included will be the order in which they are executed.
216
217 request_options : typing.Optional[RequestOptions]
218 Request-specific configuration.
219
220 Returns
221 -------
222 UpdateActionBindingsResponseContent
223 The bindings were updated.
224
225 Examples
226 --------
227 import asyncio
228
229 from auth0 import AsyncAuth0
230
231 client = AsyncAuth0(
232 token="YOUR_TOKEN",
233 )
234
235
236 async def main() -> None:
237 await client.actions.triggers.bindings.update_many(
238 trigger_id="post-login",
239 )
240
241
242 asyncio.run(main())
243 """
244 _response = await self._raw_client.update_many(trigger_id, bindings=bindings, request_options=request_options)
245 return _response.data