Debian Codegraph @

src/auth0/management/prompts/partials/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.get_partials_response_content import GetPartialsResponseContent
8 from ...types.partial_groups_enum import PartialGroupsEnum
9 from ...types.set_partials_request_content import SetPartialsRequestContent
10 from .raw_client import AsyncRawPartialsClient, RawPartialsClient
11
12 # this is used as the default value for optional parameters
13 OMIT = typing.cast(typing.Any, ...)
14
15
16 class PartialsClient:
17 def __init__(self, *, client_wrapper: SyncClientWrapper):
18 self._raw_client = RawPartialsClient(client_wrapper=client_wrapper)
19
20 @property
21 def with_raw_response(self) -> RawPartialsClient:
22 """
23 Retrieves a raw implementation of this client that returns raw responses.
24
25 Returns
26 -------
27 RawPartialsClient
28 """
29 return self._raw_client
30
31 def get(
32 self, prompt: PartialGroupsEnum, *, request_options: typing.Optional[RequestOptions] = None
33 ) -> GetPartialsResponseContent:
34 """
35 Get template partials for a prompt
36
37 Parameters
38 ----------
39 prompt : PartialGroupsEnum
40 Name of the prompt.
41
42 request_options : typing.Optional[RequestOptions]
43 Request-specific configuration.
44
45 Returns
46 -------
47 GetPartialsResponseContent
48 Prompt partials successfully retrieved.
49
50 Examples
51 --------
52 from auth0 import Auth0
53
54 client = Auth0(
55 token="YOUR_TOKEN",
56 )
57 client.prompts.partials.get(
58 prompt="login",
59 )
60 """
61 _response = self._raw_client.get(prompt, request_options=request_options)
62 return _response.data
63
64 def set(
65 self,
66 prompt: PartialGroupsEnum,
67 *,
68 request: SetPartialsRequestContent,
69 request_options: typing.Optional[RequestOptions] = None,
70 ) -> None:
71 """
72 Set template partials for a prompt
73
74 Parameters
75 ----------
76 prompt : PartialGroupsEnum
77 Name of the prompt.
78
79 request : SetPartialsRequestContent
80
81 request_options : typing.Optional[RequestOptions]
82 Request-specific configuration.
83
84 Returns
85 -------
86 None
87
88 Examples
89 --------
90 from auth0 import Auth0
91
92 client = Auth0(
93 token="YOUR_TOKEN",
94 )
95 client.prompts.partials.set(
96 prompt="login",
97 request={"key": "value"},
98 )
99 """
100 _response = self._raw_client.set(prompt, request=request, request_options=request_options)
101 return _response.data
102
103
104 class AsyncPartialsClient:
105 def __init__(self, *, client_wrapper: AsyncClientWrapper):
106 self._raw_client = AsyncRawPartialsClient(client_wrapper=client_wrapper)
107
108 @property
109 def with_raw_response(self) -> AsyncRawPartialsClient:
110 """
111 Retrieves a raw implementation of this client that returns raw responses.
112
113 Returns
114 -------
115 AsyncRawPartialsClient
116 """
117 return self._raw_client
118
119 async def get(
120 self, prompt: PartialGroupsEnum, *, request_options: typing.Optional[RequestOptions] = None
121 ) -> GetPartialsResponseContent:
122 """
123 Get template partials for a prompt
124
125 Parameters
126 ----------
127 prompt : PartialGroupsEnum
128 Name of the prompt.
129
130 request_options : typing.Optional[RequestOptions]
131 Request-specific configuration.
132
133 Returns
134 -------
135 GetPartialsResponseContent
136 Prompt partials successfully retrieved.
137
138 Examples
139 --------
140 import asyncio
141
142 from auth0 import AsyncAuth0
143
144 client = AsyncAuth0(
145 token="YOUR_TOKEN",
146 )
147
148
149 async def main() -> None:
150 await client.prompts.partials.get(
151 prompt="login",
152 )
153
154
155 asyncio.run(main())
156 """
157 _response = await self._raw_client.get(prompt, request_options=request_options)
158 return _response.data
159
160 async def set(
161 self,
162 prompt: PartialGroupsEnum,
163 *,
164 request: SetPartialsRequestContent,
165 request_options: typing.Optional[RequestOptions] = None,
166 ) -> None:
167 """
168 Set template partials for a prompt
169
170 Parameters
171 ----------
172 prompt : PartialGroupsEnum
173 Name of the prompt.
174
175 request : SetPartialsRequestContent
176
177 request_options : typing.Optional[RequestOptions]
178 Request-specific configuration.
179
180 Returns
181 -------
182 None
183
184 Examples
185 --------
186 import asyncio
187
188 from auth0 import AsyncAuth0
189
190 client = AsyncAuth0(
191 token="YOUR_TOKEN",
192 )
193
194
195 async def main() -> None:
196 await client.prompts.partials.set(
197 prompt="login",
198 request={"key": "value"},
199 )
200
201
202 asyncio.run(main())
203 """
204 _response = await self._raw_client.set(prompt, request=request, request_options=request_options)
205 return _response.data