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,302 @@
|
|
|
1
|
+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
import httpx
|
|
6
|
+
|
|
7
|
+
from .items import (
|
|
8
|
+
ItemsResource,
|
|
9
|
+
AsyncItemsResource,
|
|
10
|
+
ItemsResourceWithRawResponse,
|
|
11
|
+
AsyncItemsResourceWithRawResponse,
|
|
12
|
+
ItemsResourceWithStreamingResponse,
|
|
13
|
+
AsyncItemsResourceWithStreamingResponse,
|
|
14
|
+
)
|
|
15
|
+
from ...types import queue_get_stats_params
|
|
16
|
+
from ..._types import Body, Omit, Query, Headers, NotGiven, omit, not_given
|
|
17
|
+
from ..._utils import maybe_transform, async_maybe_transform
|
|
18
|
+
from ..._compat import cached_property
|
|
19
|
+
from ..._resource import SyncAPIResource, AsyncAPIResource
|
|
20
|
+
from ..._response import (
|
|
21
|
+
to_raw_response_wrapper,
|
|
22
|
+
to_streamed_response_wrapper,
|
|
23
|
+
async_to_raw_response_wrapper,
|
|
24
|
+
async_to_streamed_response_wrapper,
|
|
25
|
+
)
|
|
26
|
+
from ..._base_client import make_request_options
|
|
27
|
+
from ...types.queue_retrieve_response import QueueRetrieveResponse
|
|
28
|
+
from ...types.queue_get_stats_response import QueueGetStatsResponse
|
|
29
|
+
|
|
30
|
+
__all__ = ["QueueResource", "AsyncQueueResource"]
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
class QueueResource(SyncAPIResource):
|
|
34
|
+
@cached_property
|
|
35
|
+
def items(self) -> ItemsResource:
|
|
36
|
+
return ItemsResource(self._client)
|
|
37
|
+
|
|
38
|
+
@cached_property
|
|
39
|
+
def with_raw_response(self) -> QueueResourceWithRawResponse:
|
|
40
|
+
"""
|
|
41
|
+
This property can be used as a prefix for any HTTP method call to return
|
|
42
|
+
the raw response object instead of the parsed content.
|
|
43
|
+
|
|
44
|
+
For more information, see https://www.github.com/moderation-api/sdk-python#accessing-raw-response-data-eg-headers
|
|
45
|
+
"""
|
|
46
|
+
return QueueResourceWithRawResponse(self)
|
|
47
|
+
|
|
48
|
+
@cached_property
|
|
49
|
+
def with_streaming_response(self) -> QueueResourceWithStreamingResponse:
|
|
50
|
+
"""
|
|
51
|
+
An alternative to `.with_raw_response` that doesn't eagerly read the response body.
|
|
52
|
+
|
|
53
|
+
For more information, see https://www.github.com/moderation-api/sdk-python#with_streaming_response
|
|
54
|
+
"""
|
|
55
|
+
return QueueResourceWithStreamingResponse(self)
|
|
56
|
+
|
|
57
|
+
def retrieve(
|
|
58
|
+
self,
|
|
59
|
+
id: str,
|
|
60
|
+
*,
|
|
61
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
62
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
63
|
+
extra_headers: Headers | None = None,
|
|
64
|
+
extra_query: Query | None = None,
|
|
65
|
+
extra_body: Body | None = None,
|
|
66
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
67
|
+
) -> QueueRetrieveResponse:
|
|
68
|
+
"""
|
|
69
|
+
Get a queue
|
|
70
|
+
|
|
71
|
+
Args:
|
|
72
|
+
id: The queue ID
|
|
73
|
+
|
|
74
|
+
extra_headers: Send extra headers
|
|
75
|
+
|
|
76
|
+
extra_query: Add additional query parameters to the request
|
|
77
|
+
|
|
78
|
+
extra_body: Add additional JSON properties to the request
|
|
79
|
+
|
|
80
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
81
|
+
"""
|
|
82
|
+
if not id:
|
|
83
|
+
raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
|
|
84
|
+
return self._get(
|
|
85
|
+
f"/queue/{id}",
|
|
86
|
+
options=make_request_options(
|
|
87
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
88
|
+
),
|
|
89
|
+
cast_to=QueueRetrieveResponse,
|
|
90
|
+
)
|
|
91
|
+
|
|
92
|
+
def get_stats(
|
|
93
|
+
self,
|
|
94
|
+
id: str,
|
|
95
|
+
*,
|
|
96
|
+
within_days: str | Omit = omit,
|
|
97
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
98
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
99
|
+
extra_headers: Headers | None = None,
|
|
100
|
+
extra_query: Query | None = None,
|
|
101
|
+
extra_body: Body | None = None,
|
|
102
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
103
|
+
) -> QueueGetStatsResponse:
|
|
104
|
+
"""
|
|
105
|
+
Get detailed statistics about a moderation queue including review times, action
|
|
106
|
+
counts, and trends
|
|
107
|
+
|
|
108
|
+
Args:
|
|
109
|
+
id: The queue ID
|
|
110
|
+
|
|
111
|
+
within_days: Number of days to analyze statistics for
|
|
112
|
+
|
|
113
|
+
extra_headers: Send extra headers
|
|
114
|
+
|
|
115
|
+
extra_query: Add additional query parameters to the request
|
|
116
|
+
|
|
117
|
+
extra_body: Add additional JSON properties to the request
|
|
118
|
+
|
|
119
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
120
|
+
"""
|
|
121
|
+
if not id:
|
|
122
|
+
raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
|
|
123
|
+
return self._get(
|
|
124
|
+
f"/queue/{id}/stats",
|
|
125
|
+
options=make_request_options(
|
|
126
|
+
extra_headers=extra_headers,
|
|
127
|
+
extra_query=extra_query,
|
|
128
|
+
extra_body=extra_body,
|
|
129
|
+
timeout=timeout,
|
|
130
|
+
query=maybe_transform({"within_days": within_days}, queue_get_stats_params.QueueGetStatsParams),
|
|
131
|
+
),
|
|
132
|
+
cast_to=QueueGetStatsResponse,
|
|
133
|
+
)
|
|
134
|
+
|
|
135
|
+
|
|
136
|
+
class AsyncQueueResource(AsyncAPIResource):
|
|
137
|
+
@cached_property
|
|
138
|
+
def items(self) -> AsyncItemsResource:
|
|
139
|
+
return AsyncItemsResource(self._client)
|
|
140
|
+
|
|
141
|
+
@cached_property
|
|
142
|
+
def with_raw_response(self) -> AsyncQueueResourceWithRawResponse:
|
|
143
|
+
"""
|
|
144
|
+
This property can be used as a prefix for any HTTP method call to return
|
|
145
|
+
the raw response object instead of the parsed content.
|
|
146
|
+
|
|
147
|
+
For more information, see https://www.github.com/moderation-api/sdk-python#accessing-raw-response-data-eg-headers
|
|
148
|
+
"""
|
|
149
|
+
return AsyncQueueResourceWithRawResponse(self)
|
|
150
|
+
|
|
151
|
+
@cached_property
|
|
152
|
+
def with_streaming_response(self) -> AsyncQueueResourceWithStreamingResponse:
|
|
153
|
+
"""
|
|
154
|
+
An alternative to `.with_raw_response` that doesn't eagerly read the response body.
|
|
155
|
+
|
|
156
|
+
For more information, see https://www.github.com/moderation-api/sdk-python#with_streaming_response
|
|
157
|
+
"""
|
|
158
|
+
return AsyncQueueResourceWithStreamingResponse(self)
|
|
159
|
+
|
|
160
|
+
async def retrieve(
|
|
161
|
+
self,
|
|
162
|
+
id: str,
|
|
163
|
+
*,
|
|
164
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
165
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
166
|
+
extra_headers: Headers | None = None,
|
|
167
|
+
extra_query: Query | None = None,
|
|
168
|
+
extra_body: Body | None = None,
|
|
169
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
170
|
+
) -> QueueRetrieveResponse:
|
|
171
|
+
"""
|
|
172
|
+
Get a queue
|
|
173
|
+
|
|
174
|
+
Args:
|
|
175
|
+
id: The queue ID
|
|
176
|
+
|
|
177
|
+
extra_headers: Send extra headers
|
|
178
|
+
|
|
179
|
+
extra_query: Add additional query parameters to the request
|
|
180
|
+
|
|
181
|
+
extra_body: Add additional JSON properties to the request
|
|
182
|
+
|
|
183
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
184
|
+
"""
|
|
185
|
+
if not id:
|
|
186
|
+
raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
|
|
187
|
+
return await self._get(
|
|
188
|
+
f"/queue/{id}",
|
|
189
|
+
options=make_request_options(
|
|
190
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
191
|
+
),
|
|
192
|
+
cast_to=QueueRetrieveResponse,
|
|
193
|
+
)
|
|
194
|
+
|
|
195
|
+
async def get_stats(
|
|
196
|
+
self,
|
|
197
|
+
id: str,
|
|
198
|
+
*,
|
|
199
|
+
within_days: str | Omit = omit,
|
|
200
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
201
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
202
|
+
extra_headers: Headers | None = None,
|
|
203
|
+
extra_query: Query | None = None,
|
|
204
|
+
extra_body: Body | None = None,
|
|
205
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
206
|
+
) -> QueueGetStatsResponse:
|
|
207
|
+
"""
|
|
208
|
+
Get detailed statistics about a moderation queue including review times, action
|
|
209
|
+
counts, and trends
|
|
210
|
+
|
|
211
|
+
Args:
|
|
212
|
+
id: The queue ID
|
|
213
|
+
|
|
214
|
+
within_days: Number of days to analyze statistics for
|
|
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
|
+
if not id:
|
|
225
|
+
raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
|
|
226
|
+
return await self._get(
|
|
227
|
+
f"/queue/{id}/stats",
|
|
228
|
+
options=make_request_options(
|
|
229
|
+
extra_headers=extra_headers,
|
|
230
|
+
extra_query=extra_query,
|
|
231
|
+
extra_body=extra_body,
|
|
232
|
+
timeout=timeout,
|
|
233
|
+
query=await async_maybe_transform(
|
|
234
|
+
{"within_days": within_days}, queue_get_stats_params.QueueGetStatsParams
|
|
235
|
+
),
|
|
236
|
+
),
|
|
237
|
+
cast_to=QueueGetStatsResponse,
|
|
238
|
+
)
|
|
239
|
+
|
|
240
|
+
|
|
241
|
+
class QueueResourceWithRawResponse:
|
|
242
|
+
def __init__(self, queue: QueueResource) -> None:
|
|
243
|
+
self._queue = queue
|
|
244
|
+
|
|
245
|
+
self.retrieve = to_raw_response_wrapper(
|
|
246
|
+
queue.retrieve,
|
|
247
|
+
)
|
|
248
|
+
self.get_stats = to_raw_response_wrapper(
|
|
249
|
+
queue.get_stats,
|
|
250
|
+
)
|
|
251
|
+
|
|
252
|
+
@cached_property
|
|
253
|
+
def items(self) -> ItemsResourceWithRawResponse:
|
|
254
|
+
return ItemsResourceWithRawResponse(self._queue.items)
|
|
255
|
+
|
|
256
|
+
|
|
257
|
+
class AsyncQueueResourceWithRawResponse:
|
|
258
|
+
def __init__(self, queue: AsyncQueueResource) -> None:
|
|
259
|
+
self._queue = queue
|
|
260
|
+
|
|
261
|
+
self.retrieve = async_to_raw_response_wrapper(
|
|
262
|
+
queue.retrieve,
|
|
263
|
+
)
|
|
264
|
+
self.get_stats = async_to_raw_response_wrapper(
|
|
265
|
+
queue.get_stats,
|
|
266
|
+
)
|
|
267
|
+
|
|
268
|
+
@cached_property
|
|
269
|
+
def items(self) -> AsyncItemsResourceWithRawResponse:
|
|
270
|
+
return AsyncItemsResourceWithRawResponse(self._queue.items)
|
|
271
|
+
|
|
272
|
+
|
|
273
|
+
class QueueResourceWithStreamingResponse:
|
|
274
|
+
def __init__(self, queue: QueueResource) -> None:
|
|
275
|
+
self._queue = queue
|
|
276
|
+
|
|
277
|
+
self.retrieve = to_streamed_response_wrapper(
|
|
278
|
+
queue.retrieve,
|
|
279
|
+
)
|
|
280
|
+
self.get_stats = to_streamed_response_wrapper(
|
|
281
|
+
queue.get_stats,
|
|
282
|
+
)
|
|
283
|
+
|
|
284
|
+
@cached_property
|
|
285
|
+
def items(self) -> ItemsResourceWithStreamingResponse:
|
|
286
|
+
return ItemsResourceWithStreamingResponse(self._queue.items)
|
|
287
|
+
|
|
288
|
+
|
|
289
|
+
class AsyncQueueResourceWithStreamingResponse:
|
|
290
|
+
def __init__(self, queue: AsyncQueueResource) -> None:
|
|
291
|
+
self._queue = queue
|
|
292
|
+
|
|
293
|
+
self.retrieve = async_to_streamed_response_wrapper(
|
|
294
|
+
queue.retrieve,
|
|
295
|
+
)
|
|
296
|
+
self.get_stats = async_to_streamed_response_wrapper(
|
|
297
|
+
queue.get_stats,
|
|
298
|
+
)
|
|
299
|
+
|
|
300
|
+
@cached_property
|
|
301
|
+
def items(self) -> AsyncItemsResourceWithStreamingResponse:
|
|
302
|
+
return AsyncItemsResourceWithStreamingResponse(self._queue.items)
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
|
|
3
|
+
from .words import (
|
|
4
|
+
WordsResource,
|
|
5
|
+
AsyncWordsResource,
|
|
6
|
+
WordsResourceWithRawResponse,
|
|
7
|
+
AsyncWordsResourceWithRawResponse,
|
|
8
|
+
WordsResourceWithStreamingResponse,
|
|
9
|
+
AsyncWordsResourceWithStreamingResponse,
|
|
10
|
+
)
|
|
11
|
+
from .wordlist import (
|
|
12
|
+
WordlistResource,
|
|
13
|
+
AsyncWordlistResource,
|
|
14
|
+
WordlistResourceWithRawResponse,
|
|
15
|
+
AsyncWordlistResourceWithRawResponse,
|
|
16
|
+
WordlistResourceWithStreamingResponse,
|
|
17
|
+
AsyncWordlistResourceWithStreamingResponse,
|
|
18
|
+
)
|
|
19
|
+
|
|
20
|
+
__all__ = [
|
|
21
|
+
"WordsResource",
|
|
22
|
+
"AsyncWordsResource",
|
|
23
|
+
"WordsResourceWithRawResponse",
|
|
24
|
+
"AsyncWordsResourceWithRawResponse",
|
|
25
|
+
"WordsResourceWithStreamingResponse",
|
|
26
|
+
"AsyncWordsResourceWithStreamingResponse",
|
|
27
|
+
"WordlistResource",
|
|
28
|
+
"AsyncWordlistResource",
|
|
29
|
+
"WordlistResourceWithRawResponse",
|
|
30
|
+
"AsyncWordlistResourceWithRawResponse",
|
|
31
|
+
"WordlistResourceWithStreamingResponse",
|
|
32
|
+
"AsyncWordlistResourceWithStreamingResponse",
|
|
33
|
+
]
|