Debian Codegraph @

src/auth0/management/jobs/client.py

raw symbols SCIP
1 # This file was auto-generated by Fern from our API Definition.
2
3 from __future__ import annotations
4
5 import typing
6
7 from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
8 from ..core.request_options import RequestOptions
9 from ..types.get_job_response_content import GetJobResponseContent
10 from .raw_client import AsyncRawJobsClient, RawJobsClient
11
12 if typing.TYPE_CHECKING:
13 from .errors.client import AsyncErrorsClient, ErrorsClient
14 from .users_exports.client import AsyncUsersExportsClient, UsersExportsClient
15 from .users_imports.client import AsyncUsersImportsClient, UsersImportsClient
16 from .verification_email.client import AsyncVerificationEmailClient, VerificationEmailClient
17
18
19 class JobsClient:
20 def __init__(self, *, client_wrapper: SyncClientWrapper):
21 self._raw_client = RawJobsClient(client_wrapper=client_wrapper)
22 self._client_wrapper = client_wrapper
23 self._users_exports: typing.Optional[UsersExportsClient] = None
24 self._users_imports: typing.Optional[UsersImportsClient] = None
25 self._verification_email: typing.Optional[VerificationEmailClient] = None
26 self._errors: typing.Optional[ErrorsClient] = None
27
28 @property
29 def with_raw_response(self) -> RawJobsClient:
30 """
31 Retrieves a raw implementation of this client that returns raw responses.
32
33 Returns
34 -------
35 RawJobsClient
36 """
37 return self._raw_client
38
39 def get(self, id: str, *, request_options: typing.Optional[RequestOptions] = None) -> GetJobResponseContent:
40 """
41 Retrieves a job. Useful to check its status.
42
43 Parameters
44 ----------
45 id : str
46 ID of the job.
47
48 request_options : typing.Optional[RequestOptions]
49 Request-specific configuration.
50
51 Returns
52 -------
53 GetJobResponseContent
54 Job retrieved successfully.
55
56 Examples
57 --------
58 from auth0 import Auth0
59
60 client = Auth0(
61 token="YOUR_TOKEN",
62 )
63 client.jobs.get(
64 id="id",
65 )
66 """
67 _response = self._raw_client.get(id, request_options=request_options)
68 return _response.data
69
70 @property
71 def users_exports(self):
72 if self._users_exports is None:
73 from .users_exports.client import UsersExportsClient # noqa: E402
74
75 self._users_exports = UsersExportsClient(client_wrapper=self._client_wrapper)
76 return self._users_exports
77
78 @property
79 def users_imports(self):
80 if self._users_imports is None:
81 from .users_imports.client import UsersImportsClient # noqa: E402
82
83 self._users_imports = UsersImportsClient(client_wrapper=self._client_wrapper)
84 return self._users_imports
85
86 @property
87 def verification_email(self):
88 if self._verification_email is None:
89 from .verification_email.client import VerificationEmailClient # noqa: E402
90
91 self._verification_email = VerificationEmailClient(client_wrapper=self._client_wrapper)
92 return self._verification_email
93
94 @property
95 def errors(self):
96 if self._errors is None:
97 from .errors.client import ErrorsClient # noqa: E402
98
99 self._errors = ErrorsClient(client_wrapper=self._client_wrapper)
100 return self._errors
101
102
103 class AsyncJobsClient:
104 def __init__(self, *, client_wrapper: AsyncClientWrapper):
105 self._raw_client = AsyncRawJobsClient(client_wrapper=client_wrapper)
106 self._client_wrapper = client_wrapper
107 self._users_exports: typing.Optional[AsyncUsersExportsClient] = None
108 self._users_imports: typing.Optional[AsyncUsersImportsClient] = None
109 self._verification_email: typing.Optional[AsyncVerificationEmailClient] = None
110 self._errors: typing.Optional[AsyncErrorsClient] = None
111
112 @property
113 def with_raw_response(self) -> AsyncRawJobsClient:
114 """
115 Retrieves a raw implementation of this client that returns raw responses.
116
117 Returns
118 -------
119 AsyncRawJobsClient
120 """
121 return self._raw_client
122
123 async def get(self, id: str, *, request_options: typing.Optional[RequestOptions] = None) -> GetJobResponseContent:
124 """
125 Retrieves a job. Useful to check its status.
126
127 Parameters
128 ----------
129 id : str
130 ID of the job.
131
132 request_options : typing.Optional[RequestOptions]
133 Request-specific configuration.
134
135 Returns
136 -------
137 GetJobResponseContent
138 Job retrieved successfully.
139
140 Examples
141 --------
142 import asyncio
143
144 from auth0 import AsyncAuth0
145
146 client = AsyncAuth0(
147 token="YOUR_TOKEN",
148 )
149
150
151 async def main() -> None:
152 await client.jobs.get(
153 id="id",
154 )
155
156
157 asyncio.run(main())
158 """
159 _response = await self._raw_client.get(id, request_options=request_options)
160 return _response.data
161
162 @property
163 def users_exports(self):
164 if self._users_exports is None:
165 from .users_exports.client import AsyncUsersExportsClient # noqa: E402
166
167 self._users_exports = AsyncUsersExportsClient(client_wrapper=self._client_wrapper)
168 return self._users_exports
169
170 @property
171 def users_imports(self):
172 if self._users_imports is None:
173 from .users_imports.client import AsyncUsersImportsClient # noqa: E402
174
175 self._users_imports = AsyncUsersImportsClient(client_wrapper=self._client_wrapper)
176 return self._users_imports
177
178 @property
179 def verification_email(self):
180 if self._verification_email is None:
181 from .verification_email.client import AsyncVerificationEmailClient # noqa: E402
182
183 self._verification_email = AsyncVerificationEmailClient(client_wrapper=self._client_wrapper)
184 return self._verification_email
185
186 @property
187 def errors(self):
188 if self._errors is None:
189 from .errors.client import AsyncErrorsClient # noqa: E402
190
191 self._errors = AsyncErrorsClient(client_wrapper=self._client_wrapper)
192 return self._errors