Debian Codegraph @

src/auth0/management/actions/modules/versions/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_module_version import ActionModuleVersion
9 from ....types.create_action_module_version_response_content import CreateActionModuleVersionResponseContent
10 from ....types.get_action_module_version_response_content import GetActionModuleVersionResponseContent
11 from ....types.get_action_module_versions_response_content import GetActionModuleVersionsResponseContent
12 from .raw_client import AsyncRawVersionsClient, RawVersionsClient
13
14
15 class VersionsClient:
16 def __init__(self, *, client_wrapper: SyncClientWrapper):
17 self._raw_client = RawVersionsClient(client_wrapper=client_wrapper)
18
19 @property
20 def with_raw_response(self) -> RawVersionsClient:
21 """
22 Retrieves a raw implementation of this client that returns raw responses.
23
24 Returns
25 -------
26 RawVersionsClient
27 """
28 return self._raw_client
29
30 def list(
31 self,
32 id: str,
33 *,
34 page: typing.Optional[int] = 0,
35 per_page: typing.Optional[int] = 50,
36 request_options: typing.Optional[RequestOptions] = None,
37 ) -> SyncPager[ActionModuleVersion, GetActionModuleVersionsResponseContent]:
38 """
39 List all published versions of a specific Actions Module.
40
41 Parameters
42 ----------
43 id : str
44 The unique ID of the module.
45
46 page : typing.Optional[int]
47 Use this field to request a specific page of the list results.
48
49 per_page : typing.Optional[int]
50 The maximum number of results to be returned by the server in a single response. 20 by default.
51
52 request_options : typing.Optional[RequestOptions]
53 Request-specific configuration.
54
55 Returns
56 -------
57 SyncPager[ActionModuleVersion, GetActionModuleVersionsResponseContent]
58 The module versions were retrieved.
59
60 Examples
61 --------
62 from auth0 import Auth0
63
64 client = Auth0(
65 token="YOUR_TOKEN",
66 )
67 response = client.actions.modules.versions.list(
68 id="id",
69 page=1,
70 per_page=1,
71 )
72 for item in response:
73 yield item
74 # alternatively, you can paginate page-by-page
75 for page in response.iter_pages():
76 yield page
77 """
78 return self._raw_client.list(id, page=page, per_page=per_page, request_options=request_options)
79
80 def create(
81 self, id: str, *, request_options: typing.Optional[RequestOptions] = None
82 ) -> CreateActionModuleVersionResponseContent:
83 """
84 Creates a new immutable version of an Actions Module from the current draft version. This publishes the draft as a new version that can be referenced by actions, while maintaining the existing draft for continued development.
85
86 Parameters
87 ----------
88 id : str
89 The ID of the action module to create a version for.
90
91 request_options : typing.Optional[RequestOptions]
92 Request-specific configuration.
93
94 Returns
95 -------
96 CreateActionModuleVersionResponseContent
97 The action module version was created.
98
99 Examples
100 --------
101 from auth0 import Auth0
102
103 client = Auth0(
104 token="YOUR_TOKEN",
105 )
106 client.actions.modules.versions.create(
107 id="id",
108 )
109 """
110 _response = self._raw_client.create(id, request_options=request_options)
111 return _response.data
112
113 def get(
114 self, id: str, version_id: str, *, request_options: typing.Optional[RequestOptions] = None
115 ) -> GetActionModuleVersionResponseContent:
116 """
117 Retrieve the details of a specific, immutable version of an Actions Module.
118
119 Parameters
120 ----------
121 id : str
122 The unique ID of the module.
123
124 version_id : str
125 The unique ID of the module version to retrieve.
126
127 request_options : typing.Optional[RequestOptions]
128 Request-specific configuration.
129
130 Returns
131 -------
132 GetActionModuleVersionResponseContent
133 The module version was retrieved.
134
135 Examples
136 --------
137 from auth0 import Auth0
138
139 client = Auth0(
140 token="YOUR_TOKEN",
141 )
142 client.actions.modules.versions.get(
143 id="id",
144 version_id="versionId",
145 )
146 """
147 _response = self._raw_client.get(id, version_id, request_options=request_options)
148 return _response.data
149
150
151 class AsyncVersionsClient:
152 def __init__(self, *, client_wrapper: AsyncClientWrapper):
153 self._raw_client = AsyncRawVersionsClient(client_wrapper=client_wrapper)
154
155 @property
156 def with_raw_response(self) -> AsyncRawVersionsClient:
157 """
158 Retrieves a raw implementation of this client that returns raw responses.
159
160 Returns
161 -------
162 AsyncRawVersionsClient
163 """
164 return self._raw_client
165
166 async def list(
167 self,
168 id: str,
169 *,
170 page: typing.Optional[int] = 0,
171 per_page: typing.Optional[int] = 50,
172 request_options: typing.Optional[RequestOptions] = None,
173 ) -> AsyncPager[ActionModuleVersion, GetActionModuleVersionsResponseContent]:
174 """
175 List all published versions of a specific Actions Module.
176
177 Parameters
178 ----------
179 id : str
180 The unique ID of the module.
181
182 page : typing.Optional[int]
183 Use this field to request a specific page of the list results.
184
185 per_page : typing.Optional[int]
186 The maximum number of results to be returned by the server in a single response. 20 by default.
187
188 request_options : typing.Optional[RequestOptions]
189 Request-specific configuration.
190
191 Returns
192 -------
193 AsyncPager[ActionModuleVersion, GetActionModuleVersionsResponseContent]
194 The module versions were retrieved.
195
196 Examples
197 --------
198 import asyncio
199
200 from auth0 import AsyncAuth0
201
202 client = AsyncAuth0(
203 token="YOUR_TOKEN",
204 )
205
206
207 async def main() -> None:
208 response = await client.actions.modules.versions.list(
209 id="id",
210 page=1,
211 per_page=1,
212 )
213 async for item in response:
214 yield item
215
216 # alternatively, you can paginate page-by-page
217 async for page in response.iter_pages():
218 yield page
219
220
221 asyncio.run(main())
222 """
223 return await self._raw_client.list(id, page=page, per_page=per_page, request_options=request_options)
224
225 async def create(
226 self, id: str, *, request_options: typing.Optional[RequestOptions] = None
227 ) -> CreateActionModuleVersionResponseContent:
228 """
229 Creates a new immutable version of an Actions Module from the current draft version. This publishes the draft as a new version that can be referenced by actions, while maintaining the existing draft for continued development.
230
231 Parameters
232 ----------
233 id : str
234 The ID of the action module to create a version for.
235
236 request_options : typing.Optional[RequestOptions]
237 Request-specific configuration.
238
239 Returns
240 -------
241 CreateActionModuleVersionResponseContent
242 The action module version was created.
243
244 Examples
245 --------
246 import asyncio
247
248 from auth0 import AsyncAuth0
249
250 client = AsyncAuth0(
251 token="YOUR_TOKEN",
252 )
253
254
255 async def main() -> None:
256 await client.actions.modules.versions.create(
257 id="id",
258 )
259
260
261 asyncio.run(main())
262 """
263 _response = await self._raw_client.create(id, request_options=request_options)
264 return _response.data
265
266 async def get(
267 self, id: str, version_id: str, *, request_options: typing.Optional[RequestOptions] = None
268 ) -> GetActionModuleVersionResponseContent:
269 """
270 Retrieve the details of a specific, immutable version of an Actions Module.
271
272 Parameters
273 ----------
274 id : str
275 The unique ID of the module.
276
277 version_id : str
278 The unique ID of the module version to retrieve.
279
280 request_options : typing.Optional[RequestOptions]
281 Request-specific configuration.
282
283 Returns
284 -------
285 GetActionModuleVersionResponseContent
286 The module version was retrieved.
287
288 Examples
289 --------
290 import asyncio
291
292 from auth0 import AsyncAuth0
293
294 client = AsyncAuth0(
295 token="YOUR_TOKEN",
296 )
297
298
299 async def main() -> None:
300 await client.actions.modules.versions.get(
301 id="id",
302 version_id="versionId",
303 )
304
305
306 asyncio.run(main())
307 """
308 _response = await self._raw_client.get(id, version_id, request_options=request_options)
309 return _response.data