moderation_api 1.0.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- moderation_api/__init__.py +102 -0
- moderation_api/_base_client.py +1995 -0
- moderation_api/_client.py +454 -0
- moderation_api/_compat.py +219 -0
- moderation_api/_constants.py +14 -0
- moderation_api/_exceptions.py +108 -0
- moderation_api/_files.py +123 -0
- moderation_api/_models.py +857 -0
- moderation_api/_qs.py +150 -0
- moderation_api/_resource.py +43 -0
- moderation_api/_response.py +832 -0
- moderation_api/_streaming.py +333 -0
- moderation_api/_types.py +260 -0
- moderation_api/_utils/__init__.py +64 -0
- moderation_api/_utils/_compat.py +45 -0
- moderation_api/_utils/_datetime_parse.py +136 -0
- moderation_api/_utils/_logs.py +25 -0
- moderation_api/_utils/_proxy.py +65 -0
- moderation_api/_utils/_reflection.py +42 -0
- moderation_api/_utils/_resources_proxy.py +24 -0
- moderation_api/_utils/_streams.py +12 -0
- moderation_api/_utils/_sync.py +58 -0
- moderation_api/_utils/_transform.py +457 -0
- moderation_api/_utils/_typing.py +156 -0
- moderation_api/_utils/_utils.py +421 -0
- moderation_api/_version.py +4 -0
- moderation_api/lib/.keep +4 -0
- moderation_api/py.typed +0 -0
- moderation_api/resources/__init__.py +103 -0
- moderation_api/resources/account.py +135 -0
- moderation_api/resources/actions/__init__.py +33 -0
- moderation_api/resources/actions/actions.py +810 -0
- moderation_api/resources/actions/execute.py +354 -0
- moderation_api/resources/auth.py +204 -0
- moderation_api/resources/authors.py +714 -0
- moderation_api/resources/content.py +244 -0
- moderation_api/resources/queue/__init__.py +33 -0
- moderation_api/resources/queue/items.py +445 -0
- moderation_api/resources/queue/queue.py +302 -0
- moderation_api/resources/wordlist/__init__.py +33 -0
- moderation_api/resources/wordlist/wordlist.py +470 -0
- moderation_api/resources/wordlist/words.py +274 -0
- moderation_api/types/__init__.py +35 -0
- moderation_api/types/account_list_response.py +31 -0
- moderation_api/types/action_create_params.py +94 -0
- moderation_api/types/action_create_response.py +82 -0
- moderation_api/types/action_delete_response.py +13 -0
- moderation_api/types/action_list_params.py +13 -0
- moderation_api/types/action_list_response.py +113 -0
- moderation_api/types/action_retrieve_response.py +105 -0
- moderation_api/types/action_update_params.py +94 -0
- moderation_api/types/action_update_response.py +82 -0
- moderation_api/types/actions/__init__.py +8 -0
- moderation_api/types/actions/execute_execute_by_id_params.py +24 -0
- moderation_api/types/actions/execute_execute_by_id_response.py +20 -0
- moderation_api/types/actions/execute_execute_params.py +30 -0
- moderation_api/types/actions/execute_execute_response.py +10 -0
- moderation_api/types/auth_create_response.py +16 -0
- moderation_api/types/auth_retrieve_response.py +13 -0
- moderation_api/types/author_create_params.py +57 -0
- moderation_api/types/author_create_response.py +120 -0
- moderation_api/types/author_delete_response.py +9 -0
- moderation_api/types/author_list_params.py +40 -0
- moderation_api/types/author_list_response.py +147 -0
- moderation_api/types/author_retrieve_response.py +120 -0
- moderation_api/types/author_update_params.py +54 -0
- moderation_api/types/author_update_response.py +120 -0
- moderation_api/types/content_submit_params.py +352 -0
- moderation_api/types/content_submit_response.py +269 -0
- moderation_api/types/queue/__init__.py +10 -0
- moderation_api/types/queue/item_list_params.py +36 -0
- moderation_api/types/queue/item_list_response.py +90 -0
- moderation_api/types/queue/item_resolve_params.py +15 -0
- moderation_api/types/queue/item_resolve_response.py +19 -0
- moderation_api/types/queue/item_unresolve_params.py +15 -0
- moderation_api/types/queue/item_unresolve_response.py +17 -0
- moderation_api/types/queue_get_stats_params.py +14 -0
- moderation_api/types/queue_get_stats_response.py +110 -0
- moderation_api/types/queue_retrieve_response.py +64 -0
- moderation_api/types/wordlist/__init__.py +8 -0
- moderation_api/types/wordlist/word_add_params.py +14 -0
- moderation_api/types/wordlist/word_add_response.py +20 -0
- moderation_api/types/wordlist/word_remove_params.py +14 -0
- moderation_api/types/wordlist/word_remove_response.py +20 -0
- moderation_api/types/wordlist_get_embedding_status_response.py +18 -0
- moderation_api/types/wordlist_list_response.py +30 -0
- moderation_api/types/wordlist_retrieve_response.py +32 -0
- moderation_api/types/wordlist_update_params.py +29 -0
- moderation_api/types/wordlist_update_response.py +32 -0
- moderation_api-1.0.0.dist-info/METADATA +458 -0
- moderation_api-1.0.0.dist-info/RECORD +93 -0
- moderation_api-1.0.0.dist-info/WHEEL +4 -0
- moderation_api-1.0.0.dist-info/licenses/LICENSE +201 -0
|
@@ -0,0 +1,354 @@
|
|
|
1
|
+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
import typing_extensions
|
|
6
|
+
|
|
7
|
+
import httpx
|
|
8
|
+
|
|
9
|
+
from ..._types import Body, Omit, Query, Headers, NotGiven, SequenceNotStr, omit, not_given
|
|
10
|
+
from ..._utils import maybe_transform, async_maybe_transform
|
|
11
|
+
from ..._compat import cached_property
|
|
12
|
+
from ..._resource import SyncAPIResource, AsyncAPIResource
|
|
13
|
+
from ..._response import (
|
|
14
|
+
to_raw_response_wrapper,
|
|
15
|
+
to_streamed_response_wrapper,
|
|
16
|
+
async_to_raw_response_wrapper,
|
|
17
|
+
async_to_streamed_response_wrapper,
|
|
18
|
+
)
|
|
19
|
+
from ..._base_client import make_request_options
|
|
20
|
+
from ...types.actions import execute_execute_params, execute_execute_by_id_params
|
|
21
|
+
from ...types.actions.execute_execute_response import ExecuteExecuteResponse
|
|
22
|
+
from ...types.actions.execute_execute_by_id_response import ExecuteExecuteByIDResponse
|
|
23
|
+
|
|
24
|
+
__all__ = ["ExecuteResource", "AsyncExecuteResource"]
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
class ExecuteResource(SyncAPIResource):
|
|
28
|
+
@cached_property
|
|
29
|
+
def with_raw_response(self) -> ExecuteResourceWithRawResponse:
|
|
30
|
+
"""
|
|
31
|
+
This property can be used as a prefix for any HTTP method call to return
|
|
32
|
+
the raw response object instead of the parsed content.
|
|
33
|
+
|
|
34
|
+
For more information, see https://www.github.com/moderation-api/sdk-python#accessing-raw-response-data-eg-headers
|
|
35
|
+
"""
|
|
36
|
+
return ExecuteResourceWithRawResponse(self)
|
|
37
|
+
|
|
38
|
+
@cached_property
|
|
39
|
+
def with_streaming_response(self) -> ExecuteResourceWithStreamingResponse:
|
|
40
|
+
"""
|
|
41
|
+
An alternative to `.with_raw_response` that doesn't eagerly read the response body.
|
|
42
|
+
|
|
43
|
+
For more information, see https://www.github.com/moderation-api/sdk-python#with_streaming_response
|
|
44
|
+
"""
|
|
45
|
+
return ExecuteResourceWithStreamingResponse(self)
|
|
46
|
+
|
|
47
|
+
def execute(
|
|
48
|
+
self,
|
|
49
|
+
*,
|
|
50
|
+
action_key: str,
|
|
51
|
+
author_ids: SequenceNotStr[str] | Omit = omit,
|
|
52
|
+
content_ids: SequenceNotStr[str] | Omit = omit,
|
|
53
|
+
duration: float | Omit = omit,
|
|
54
|
+
queue_id: str | Omit = omit,
|
|
55
|
+
value: str | Omit = omit,
|
|
56
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
57
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
58
|
+
extra_headers: Headers | None = None,
|
|
59
|
+
extra_query: Query | None = None,
|
|
60
|
+
extra_body: Body | None = None,
|
|
61
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
62
|
+
) -> ExecuteExecuteResponse:
|
|
63
|
+
"""
|
|
64
|
+
Execute a moderation action on one or more content items.
|
|
65
|
+
|
|
66
|
+
Args:
|
|
67
|
+
action_key: ID or key of the action to execute
|
|
68
|
+
|
|
69
|
+
author_ids: IDs of the authors to apply the action to. Provide this or contentIds.
|
|
70
|
+
|
|
71
|
+
content_ids: IDs of the content items to apply the action to. Provide this or authorIds.
|
|
72
|
+
|
|
73
|
+
duration: Optional duration in milliseconds for actions with timeouts
|
|
74
|
+
|
|
75
|
+
queue_id: Optional queue ID if the action is queue-specific
|
|
76
|
+
|
|
77
|
+
value: Optional value to provide with the action
|
|
78
|
+
|
|
79
|
+
extra_headers: Send extra headers
|
|
80
|
+
|
|
81
|
+
extra_query: Add additional query parameters to the request
|
|
82
|
+
|
|
83
|
+
extra_body: Add additional JSON properties to the request
|
|
84
|
+
|
|
85
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
86
|
+
"""
|
|
87
|
+
return self._post(
|
|
88
|
+
"/actions/execute",
|
|
89
|
+
body=maybe_transform(
|
|
90
|
+
{
|
|
91
|
+
"action_key": action_key,
|
|
92
|
+
"author_ids": author_ids,
|
|
93
|
+
"content_ids": content_ids,
|
|
94
|
+
"duration": duration,
|
|
95
|
+
"queue_id": queue_id,
|
|
96
|
+
"value": value,
|
|
97
|
+
},
|
|
98
|
+
execute_execute_params.ExecuteExecuteParams,
|
|
99
|
+
),
|
|
100
|
+
options=make_request_options(
|
|
101
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
102
|
+
),
|
|
103
|
+
cast_to=ExecuteExecuteResponse,
|
|
104
|
+
)
|
|
105
|
+
|
|
106
|
+
@typing_extensions.deprecated("deprecated")
|
|
107
|
+
def execute_by_id(
|
|
108
|
+
self,
|
|
109
|
+
action_id: str,
|
|
110
|
+
*,
|
|
111
|
+
author_ids: SequenceNotStr[str] | Omit = omit,
|
|
112
|
+
content_ids: SequenceNotStr[str] | Omit = omit,
|
|
113
|
+
queue_id: str | Omit = omit,
|
|
114
|
+
value: str | Omit = omit,
|
|
115
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
116
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
117
|
+
extra_headers: Headers | None = None,
|
|
118
|
+
extra_query: Query | None = None,
|
|
119
|
+
extra_body: Body | None = None,
|
|
120
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
121
|
+
) -> ExecuteExecuteByIDResponse:
|
|
122
|
+
"""
|
|
123
|
+
Execute an action on a set of content items in a queue.
|
|
124
|
+
|
|
125
|
+
Args:
|
|
126
|
+
action_id: The ID or key of the action to execute.
|
|
127
|
+
|
|
128
|
+
author_ids: IDs of the authors to apply the action to
|
|
129
|
+
|
|
130
|
+
content_ids: The IDs of the content items to perform the action on.
|
|
131
|
+
|
|
132
|
+
queue_id: The ID of the queue the action was performed from if any.
|
|
133
|
+
|
|
134
|
+
value: The value of the action. Useful to set a reason for the action etc.
|
|
135
|
+
|
|
136
|
+
extra_headers: Send extra headers
|
|
137
|
+
|
|
138
|
+
extra_query: Add additional query parameters to the request
|
|
139
|
+
|
|
140
|
+
extra_body: Add additional JSON properties to the request
|
|
141
|
+
|
|
142
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
143
|
+
"""
|
|
144
|
+
if not action_id:
|
|
145
|
+
raise ValueError(f"Expected a non-empty value for `action_id` but received {action_id!r}")
|
|
146
|
+
return self._post(
|
|
147
|
+
f"/actions/{action_id}/execute",
|
|
148
|
+
body=maybe_transform(
|
|
149
|
+
{
|
|
150
|
+
"author_ids": author_ids,
|
|
151
|
+
"content_ids": content_ids,
|
|
152
|
+
"queue_id": queue_id,
|
|
153
|
+
"value": value,
|
|
154
|
+
},
|
|
155
|
+
execute_execute_by_id_params.ExecuteExecuteByIDParams,
|
|
156
|
+
),
|
|
157
|
+
options=make_request_options(
|
|
158
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
159
|
+
),
|
|
160
|
+
cast_to=ExecuteExecuteByIDResponse,
|
|
161
|
+
)
|
|
162
|
+
|
|
163
|
+
|
|
164
|
+
class AsyncExecuteResource(AsyncAPIResource):
|
|
165
|
+
@cached_property
|
|
166
|
+
def with_raw_response(self) -> AsyncExecuteResourceWithRawResponse:
|
|
167
|
+
"""
|
|
168
|
+
This property can be used as a prefix for any HTTP method call to return
|
|
169
|
+
the raw response object instead of the parsed content.
|
|
170
|
+
|
|
171
|
+
For more information, see https://www.github.com/moderation-api/sdk-python#accessing-raw-response-data-eg-headers
|
|
172
|
+
"""
|
|
173
|
+
return AsyncExecuteResourceWithRawResponse(self)
|
|
174
|
+
|
|
175
|
+
@cached_property
|
|
176
|
+
def with_streaming_response(self) -> AsyncExecuteResourceWithStreamingResponse:
|
|
177
|
+
"""
|
|
178
|
+
An alternative to `.with_raw_response` that doesn't eagerly read the response body.
|
|
179
|
+
|
|
180
|
+
For more information, see https://www.github.com/moderation-api/sdk-python#with_streaming_response
|
|
181
|
+
"""
|
|
182
|
+
return AsyncExecuteResourceWithStreamingResponse(self)
|
|
183
|
+
|
|
184
|
+
async def execute(
|
|
185
|
+
self,
|
|
186
|
+
*,
|
|
187
|
+
action_key: str,
|
|
188
|
+
author_ids: SequenceNotStr[str] | Omit = omit,
|
|
189
|
+
content_ids: SequenceNotStr[str] | Omit = omit,
|
|
190
|
+
duration: float | Omit = omit,
|
|
191
|
+
queue_id: str | Omit = omit,
|
|
192
|
+
value: str | Omit = omit,
|
|
193
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
194
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
195
|
+
extra_headers: Headers | None = None,
|
|
196
|
+
extra_query: Query | None = None,
|
|
197
|
+
extra_body: Body | None = None,
|
|
198
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
199
|
+
) -> ExecuteExecuteResponse:
|
|
200
|
+
"""
|
|
201
|
+
Execute a moderation action on one or more content items.
|
|
202
|
+
|
|
203
|
+
Args:
|
|
204
|
+
action_key: ID or key of the action to execute
|
|
205
|
+
|
|
206
|
+
author_ids: IDs of the authors to apply the action to. Provide this or contentIds.
|
|
207
|
+
|
|
208
|
+
content_ids: IDs of the content items to apply the action to. Provide this or authorIds.
|
|
209
|
+
|
|
210
|
+
duration: Optional duration in milliseconds for actions with timeouts
|
|
211
|
+
|
|
212
|
+
queue_id: Optional queue ID if the action is queue-specific
|
|
213
|
+
|
|
214
|
+
value: Optional value to provide with the action
|
|
215
|
+
|
|
216
|
+
extra_headers: Send extra headers
|
|
217
|
+
|
|
218
|
+
extra_query: Add additional query parameters to the request
|
|
219
|
+
|
|
220
|
+
extra_body: Add additional JSON properties to the request
|
|
221
|
+
|
|
222
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
223
|
+
"""
|
|
224
|
+
return await self._post(
|
|
225
|
+
"/actions/execute",
|
|
226
|
+
body=await async_maybe_transform(
|
|
227
|
+
{
|
|
228
|
+
"action_key": action_key,
|
|
229
|
+
"author_ids": author_ids,
|
|
230
|
+
"content_ids": content_ids,
|
|
231
|
+
"duration": duration,
|
|
232
|
+
"queue_id": queue_id,
|
|
233
|
+
"value": value,
|
|
234
|
+
},
|
|
235
|
+
execute_execute_params.ExecuteExecuteParams,
|
|
236
|
+
),
|
|
237
|
+
options=make_request_options(
|
|
238
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
239
|
+
),
|
|
240
|
+
cast_to=ExecuteExecuteResponse,
|
|
241
|
+
)
|
|
242
|
+
|
|
243
|
+
@typing_extensions.deprecated("deprecated")
|
|
244
|
+
async def execute_by_id(
|
|
245
|
+
self,
|
|
246
|
+
action_id: str,
|
|
247
|
+
*,
|
|
248
|
+
author_ids: SequenceNotStr[str] | Omit = omit,
|
|
249
|
+
content_ids: SequenceNotStr[str] | Omit = omit,
|
|
250
|
+
queue_id: str | Omit = omit,
|
|
251
|
+
value: str | Omit = omit,
|
|
252
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
253
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
254
|
+
extra_headers: Headers | None = None,
|
|
255
|
+
extra_query: Query | None = None,
|
|
256
|
+
extra_body: Body | None = None,
|
|
257
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
258
|
+
) -> ExecuteExecuteByIDResponse:
|
|
259
|
+
"""
|
|
260
|
+
Execute an action on a set of content items in a queue.
|
|
261
|
+
|
|
262
|
+
Args:
|
|
263
|
+
action_id: The ID or key of the action to execute.
|
|
264
|
+
|
|
265
|
+
author_ids: IDs of the authors to apply the action to
|
|
266
|
+
|
|
267
|
+
content_ids: The IDs of the content items to perform the action on.
|
|
268
|
+
|
|
269
|
+
queue_id: The ID of the queue the action was performed from if any.
|
|
270
|
+
|
|
271
|
+
value: The value of the action. Useful to set a reason for the action etc.
|
|
272
|
+
|
|
273
|
+
extra_headers: Send extra headers
|
|
274
|
+
|
|
275
|
+
extra_query: Add additional query parameters to the request
|
|
276
|
+
|
|
277
|
+
extra_body: Add additional JSON properties to the request
|
|
278
|
+
|
|
279
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
280
|
+
"""
|
|
281
|
+
if not action_id:
|
|
282
|
+
raise ValueError(f"Expected a non-empty value for `action_id` but received {action_id!r}")
|
|
283
|
+
return await self._post(
|
|
284
|
+
f"/actions/{action_id}/execute",
|
|
285
|
+
body=await async_maybe_transform(
|
|
286
|
+
{
|
|
287
|
+
"author_ids": author_ids,
|
|
288
|
+
"content_ids": content_ids,
|
|
289
|
+
"queue_id": queue_id,
|
|
290
|
+
"value": value,
|
|
291
|
+
},
|
|
292
|
+
execute_execute_by_id_params.ExecuteExecuteByIDParams,
|
|
293
|
+
),
|
|
294
|
+
options=make_request_options(
|
|
295
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
296
|
+
),
|
|
297
|
+
cast_to=ExecuteExecuteByIDResponse,
|
|
298
|
+
)
|
|
299
|
+
|
|
300
|
+
|
|
301
|
+
class ExecuteResourceWithRawResponse:
|
|
302
|
+
def __init__(self, execute: ExecuteResource) -> None:
|
|
303
|
+
self._execute = execute
|
|
304
|
+
|
|
305
|
+
self.execute = to_raw_response_wrapper(
|
|
306
|
+
execute.execute,
|
|
307
|
+
)
|
|
308
|
+
self.execute_by_id = ( # pyright: ignore[reportDeprecated]
|
|
309
|
+
to_raw_response_wrapper(
|
|
310
|
+
execute.execute_by_id, # pyright: ignore[reportDeprecated],
|
|
311
|
+
)
|
|
312
|
+
)
|
|
313
|
+
|
|
314
|
+
|
|
315
|
+
class AsyncExecuteResourceWithRawResponse:
|
|
316
|
+
def __init__(self, execute: AsyncExecuteResource) -> None:
|
|
317
|
+
self._execute = execute
|
|
318
|
+
|
|
319
|
+
self.execute = async_to_raw_response_wrapper(
|
|
320
|
+
execute.execute,
|
|
321
|
+
)
|
|
322
|
+
self.execute_by_id = ( # pyright: ignore[reportDeprecated]
|
|
323
|
+
async_to_raw_response_wrapper(
|
|
324
|
+
execute.execute_by_id, # pyright: ignore[reportDeprecated],
|
|
325
|
+
)
|
|
326
|
+
)
|
|
327
|
+
|
|
328
|
+
|
|
329
|
+
class ExecuteResourceWithStreamingResponse:
|
|
330
|
+
def __init__(self, execute: ExecuteResource) -> None:
|
|
331
|
+
self._execute = execute
|
|
332
|
+
|
|
333
|
+
self.execute = to_streamed_response_wrapper(
|
|
334
|
+
execute.execute,
|
|
335
|
+
)
|
|
336
|
+
self.execute_by_id = ( # pyright: ignore[reportDeprecated]
|
|
337
|
+
to_streamed_response_wrapper(
|
|
338
|
+
execute.execute_by_id, # pyright: ignore[reportDeprecated],
|
|
339
|
+
)
|
|
340
|
+
)
|
|
341
|
+
|
|
342
|
+
|
|
343
|
+
class AsyncExecuteResourceWithStreamingResponse:
|
|
344
|
+
def __init__(self, execute: AsyncExecuteResource) -> None:
|
|
345
|
+
self._execute = execute
|
|
346
|
+
|
|
347
|
+
self.execute = async_to_streamed_response_wrapper(
|
|
348
|
+
execute.execute,
|
|
349
|
+
)
|
|
350
|
+
self.execute_by_id = ( # pyright: ignore[reportDeprecated]
|
|
351
|
+
async_to_streamed_response_wrapper(
|
|
352
|
+
execute.execute_by_id, # pyright: ignore[reportDeprecated],
|
|
353
|
+
)
|
|
354
|
+
)
|
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
import typing_extensions
|
|
6
|
+
|
|
7
|
+
import httpx
|
|
8
|
+
|
|
9
|
+
from .._types import Body, Query, Headers, NotGiven, not_given
|
|
10
|
+
from .._compat import cached_property
|
|
11
|
+
from .._resource import SyncAPIResource, AsyncAPIResource
|
|
12
|
+
from .._response import (
|
|
13
|
+
to_raw_response_wrapper,
|
|
14
|
+
to_streamed_response_wrapper,
|
|
15
|
+
async_to_raw_response_wrapper,
|
|
16
|
+
async_to_streamed_response_wrapper,
|
|
17
|
+
)
|
|
18
|
+
from .._base_client import make_request_options
|
|
19
|
+
from ..types.auth_create_response import AuthCreateResponse
|
|
20
|
+
from ..types.auth_retrieve_response import AuthRetrieveResponse
|
|
21
|
+
|
|
22
|
+
__all__ = ["AuthResource", "AsyncAuthResource"]
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
class AuthResource(SyncAPIResource):
|
|
26
|
+
@cached_property
|
|
27
|
+
def with_raw_response(self) -> AuthResourceWithRawResponse:
|
|
28
|
+
"""
|
|
29
|
+
This property can be used as a prefix for any HTTP method call to return
|
|
30
|
+
the raw response object instead of the parsed content.
|
|
31
|
+
|
|
32
|
+
For more information, see https://www.github.com/moderation-api/sdk-python#accessing-raw-response-data-eg-headers
|
|
33
|
+
"""
|
|
34
|
+
return AuthResourceWithRawResponse(self)
|
|
35
|
+
|
|
36
|
+
@cached_property
|
|
37
|
+
def with_streaming_response(self) -> AuthResourceWithStreamingResponse:
|
|
38
|
+
"""
|
|
39
|
+
An alternative to `.with_raw_response` that doesn't eagerly read the response body.
|
|
40
|
+
|
|
41
|
+
For more information, see https://www.github.com/moderation-api/sdk-python#with_streaming_response
|
|
42
|
+
"""
|
|
43
|
+
return AuthResourceWithStreamingResponse(self)
|
|
44
|
+
|
|
45
|
+
@typing_extensions.deprecated("deprecated")
|
|
46
|
+
def create(
|
|
47
|
+
self,
|
|
48
|
+
*,
|
|
49
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
50
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
51
|
+
extra_headers: Headers | None = None,
|
|
52
|
+
extra_query: Query | None = None,
|
|
53
|
+
extra_body: Body | None = None,
|
|
54
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
55
|
+
) -> AuthCreateResponse:
|
|
56
|
+
return self._post(
|
|
57
|
+
"/auth",
|
|
58
|
+
options=make_request_options(
|
|
59
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
60
|
+
),
|
|
61
|
+
cast_to=AuthCreateResponse,
|
|
62
|
+
)
|
|
63
|
+
|
|
64
|
+
@typing_extensions.deprecated("deprecated")
|
|
65
|
+
def retrieve(
|
|
66
|
+
self,
|
|
67
|
+
*,
|
|
68
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
69
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
70
|
+
extra_headers: Headers | None = None,
|
|
71
|
+
extra_query: Query | None = None,
|
|
72
|
+
extra_body: Body | None = None,
|
|
73
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
74
|
+
) -> AuthRetrieveResponse:
|
|
75
|
+
return self._get(
|
|
76
|
+
"/auth",
|
|
77
|
+
options=make_request_options(
|
|
78
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
79
|
+
),
|
|
80
|
+
cast_to=AuthRetrieveResponse,
|
|
81
|
+
)
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
class AsyncAuthResource(AsyncAPIResource):
|
|
85
|
+
@cached_property
|
|
86
|
+
def with_raw_response(self) -> AsyncAuthResourceWithRawResponse:
|
|
87
|
+
"""
|
|
88
|
+
This property can be used as a prefix for any HTTP method call to return
|
|
89
|
+
the raw response object instead of the parsed content.
|
|
90
|
+
|
|
91
|
+
For more information, see https://www.github.com/moderation-api/sdk-python#accessing-raw-response-data-eg-headers
|
|
92
|
+
"""
|
|
93
|
+
return AsyncAuthResourceWithRawResponse(self)
|
|
94
|
+
|
|
95
|
+
@cached_property
|
|
96
|
+
def with_streaming_response(self) -> AsyncAuthResourceWithStreamingResponse:
|
|
97
|
+
"""
|
|
98
|
+
An alternative to `.with_raw_response` that doesn't eagerly read the response body.
|
|
99
|
+
|
|
100
|
+
For more information, see https://www.github.com/moderation-api/sdk-python#with_streaming_response
|
|
101
|
+
"""
|
|
102
|
+
return AsyncAuthResourceWithStreamingResponse(self)
|
|
103
|
+
|
|
104
|
+
@typing_extensions.deprecated("deprecated")
|
|
105
|
+
async def create(
|
|
106
|
+
self,
|
|
107
|
+
*,
|
|
108
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
109
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
110
|
+
extra_headers: Headers | None = None,
|
|
111
|
+
extra_query: Query | None = None,
|
|
112
|
+
extra_body: Body | None = None,
|
|
113
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
114
|
+
) -> AuthCreateResponse:
|
|
115
|
+
return await self._post(
|
|
116
|
+
"/auth",
|
|
117
|
+
options=make_request_options(
|
|
118
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
119
|
+
),
|
|
120
|
+
cast_to=AuthCreateResponse,
|
|
121
|
+
)
|
|
122
|
+
|
|
123
|
+
@typing_extensions.deprecated("deprecated")
|
|
124
|
+
async def retrieve(
|
|
125
|
+
self,
|
|
126
|
+
*,
|
|
127
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
128
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
129
|
+
extra_headers: Headers | None = None,
|
|
130
|
+
extra_query: Query | None = None,
|
|
131
|
+
extra_body: Body | None = None,
|
|
132
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
133
|
+
) -> AuthRetrieveResponse:
|
|
134
|
+
return await self._get(
|
|
135
|
+
"/auth",
|
|
136
|
+
options=make_request_options(
|
|
137
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
138
|
+
),
|
|
139
|
+
cast_to=AuthRetrieveResponse,
|
|
140
|
+
)
|
|
141
|
+
|
|
142
|
+
|
|
143
|
+
class AuthResourceWithRawResponse:
|
|
144
|
+
def __init__(self, auth: AuthResource) -> None:
|
|
145
|
+
self._auth = auth
|
|
146
|
+
|
|
147
|
+
self.create = ( # pyright: ignore[reportDeprecated]
|
|
148
|
+
to_raw_response_wrapper(
|
|
149
|
+
auth.create, # pyright: ignore[reportDeprecated],
|
|
150
|
+
)
|
|
151
|
+
)
|
|
152
|
+
self.retrieve = ( # pyright: ignore[reportDeprecated]
|
|
153
|
+
to_raw_response_wrapper(
|
|
154
|
+
auth.retrieve, # pyright: ignore[reportDeprecated],
|
|
155
|
+
)
|
|
156
|
+
)
|
|
157
|
+
|
|
158
|
+
|
|
159
|
+
class AsyncAuthResourceWithRawResponse:
|
|
160
|
+
def __init__(self, auth: AsyncAuthResource) -> None:
|
|
161
|
+
self._auth = auth
|
|
162
|
+
|
|
163
|
+
self.create = ( # pyright: ignore[reportDeprecated]
|
|
164
|
+
async_to_raw_response_wrapper(
|
|
165
|
+
auth.create, # pyright: ignore[reportDeprecated],
|
|
166
|
+
)
|
|
167
|
+
)
|
|
168
|
+
self.retrieve = ( # pyright: ignore[reportDeprecated]
|
|
169
|
+
async_to_raw_response_wrapper(
|
|
170
|
+
auth.retrieve, # pyright: ignore[reportDeprecated],
|
|
171
|
+
)
|
|
172
|
+
)
|
|
173
|
+
|
|
174
|
+
|
|
175
|
+
class AuthResourceWithStreamingResponse:
|
|
176
|
+
def __init__(self, auth: AuthResource) -> None:
|
|
177
|
+
self._auth = auth
|
|
178
|
+
|
|
179
|
+
self.create = ( # pyright: ignore[reportDeprecated]
|
|
180
|
+
to_streamed_response_wrapper(
|
|
181
|
+
auth.create, # pyright: ignore[reportDeprecated],
|
|
182
|
+
)
|
|
183
|
+
)
|
|
184
|
+
self.retrieve = ( # pyright: ignore[reportDeprecated]
|
|
185
|
+
to_streamed_response_wrapper(
|
|
186
|
+
auth.retrieve, # pyright: ignore[reportDeprecated],
|
|
187
|
+
)
|
|
188
|
+
)
|
|
189
|
+
|
|
190
|
+
|
|
191
|
+
class AsyncAuthResourceWithStreamingResponse:
|
|
192
|
+
def __init__(self, auth: AsyncAuthResource) -> None:
|
|
193
|
+
self._auth = auth
|
|
194
|
+
|
|
195
|
+
self.create = ( # pyright: ignore[reportDeprecated]
|
|
196
|
+
async_to_streamed_response_wrapper(
|
|
197
|
+
auth.create, # pyright: ignore[reportDeprecated],
|
|
198
|
+
)
|
|
199
|
+
)
|
|
200
|
+
self.retrieve = ( # pyright: ignore[reportDeprecated]
|
|
201
|
+
async_to_streamed_response_wrapper(
|
|
202
|
+
auth.retrieve, # pyright: ignore[reportDeprecated],
|
|
203
|
+
)
|
|
204
|
+
)
|