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,244 @@
|
|
|
1
|
+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from typing import Dict, Iterable
|
|
6
|
+
from typing_extensions import Literal
|
|
7
|
+
|
|
8
|
+
import httpx
|
|
9
|
+
|
|
10
|
+
from ..types import content_submit_params
|
|
11
|
+
from .._types import Body, Omit, Query, Headers, NotGiven, omit, not_given
|
|
12
|
+
from .._utils import maybe_transform, async_maybe_transform
|
|
13
|
+
from .._compat import cached_property
|
|
14
|
+
from .._resource import SyncAPIResource, AsyncAPIResource
|
|
15
|
+
from .._response import (
|
|
16
|
+
to_raw_response_wrapper,
|
|
17
|
+
to_streamed_response_wrapper,
|
|
18
|
+
async_to_raw_response_wrapper,
|
|
19
|
+
async_to_streamed_response_wrapper,
|
|
20
|
+
)
|
|
21
|
+
from .._base_client import make_request_options
|
|
22
|
+
from ..types.content_submit_response import ContentSubmitResponse
|
|
23
|
+
|
|
24
|
+
__all__ = ["ContentResource", "AsyncContentResource"]
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
class ContentResource(SyncAPIResource):
|
|
28
|
+
@cached_property
|
|
29
|
+
def with_raw_response(self) -> ContentResourceWithRawResponse:
|
|
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 ContentResourceWithRawResponse(self)
|
|
37
|
+
|
|
38
|
+
@cached_property
|
|
39
|
+
def with_streaming_response(self) -> ContentResourceWithStreamingResponse:
|
|
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 ContentResourceWithStreamingResponse(self)
|
|
46
|
+
|
|
47
|
+
def submit(
|
|
48
|
+
self,
|
|
49
|
+
*,
|
|
50
|
+
content: content_submit_params.Content,
|
|
51
|
+
author_id: str | Omit = omit,
|
|
52
|
+
channel: str | Omit = omit,
|
|
53
|
+
content_id: str | Omit = omit,
|
|
54
|
+
conversation_id: str | Omit = omit,
|
|
55
|
+
do_not_store: bool | Omit = omit,
|
|
56
|
+
metadata: Dict[str, object] | Omit = omit,
|
|
57
|
+
meta_type: Literal["profile", "message", "post", "comment", "event", "product", "review", "other"]
|
|
58
|
+
| Omit = omit,
|
|
59
|
+
policies: Iterable[content_submit_params.Policy] | Omit = omit,
|
|
60
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
61
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
62
|
+
extra_headers: Headers | None = None,
|
|
63
|
+
extra_query: Query | None = None,
|
|
64
|
+
extra_body: Body | None = None,
|
|
65
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
66
|
+
) -> ContentSubmitResponse:
|
|
67
|
+
"""
|
|
68
|
+
Args:
|
|
69
|
+
content: The content sent for moderation
|
|
70
|
+
|
|
71
|
+
author_id: The author of the content.
|
|
72
|
+
|
|
73
|
+
channel: Provide a channel ID or key. Will use the project's default channel if not
|
|
74
|
+
provided.
|
|
75
|
+
|
|
76
|
+
content_id: The unique ID of the content in your database.
|
|
77
|
+
|
|
78
|
+
conversation_id: For example the ID of a chat room or a post
|
|
79
|
+
|
|
80
|
+
do_not_store: Do not store the content. The content won't enter the review queue
|
|
81
|
+
|
|
82
|
+
metadata: Any metadata you want to store with the content
|
|
83
|
+
|
|
84
|
+
meta_type: The meta type of content being moderated
|
|
85
|
+
|
|
86
|
+
policies: (Enterprise) override the channel policies for this moderation request only.
|
|
87
|
+
|
|
88
|
+
extra_headers: Send extra headers
|
|
89
|
+
|
|
90
|
+
extra_query: Add additional query parameters to the request
|
|
91
|
+
|
|
92
|
+
extra_body: Add additional JSON properties to the request
|
|
93
|
+
|
|
94
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
95
|
+
"""
|
|
96
|
+
return self._post(
|
|
97
|
+
"/moderate",
|
|
98
|
+
body=maybe_transform(
|
|
99
|
+
{
|
|
100
|
+
"content": content,
|
|
101
|
+
"author_id": author_id,
|
|
102
|
+
"channel": channel,
|
|
103
|
+
"content_id": content_id,
|
|
104
|
+
"conversation_id": conversation_id,
|
|
105
|
+
"do_not_store": do_not_store,
|
|
106
|
+
"metadata": metadata,
|
|
107
|
+
"meta_type": meta_type,
|
|
108
|
+
"policies": policies,
|
|
109
|
+
},
|
|
110
|
+
content_submit_params.ContentSubmitParams,
|
|
111
|
+
),
|
|
112
|
+
options=make_request_options(
|
|
113
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
114
|
+
),
|
|
115
|
+
cast_to=ContentSubmitResponse,
|
|
116
|
+
)
|
|
117
|
+
|
|
118
|
+
|
|
119
|
+
class AsyncContentResource(AsyncAPIResource):
|
|
120
|
+
@cached_property
|
|
121
|
+
def with_raw_response(self) -> AsyncContentResourceWithRawResponse:
|
|
122
|
+
"""
|
|
123
|
+
This property can be used as a prefix for any HTTP method call to return
|
|
124
|
+
the raw response object instead of the parsed content.
|
|
125
|
+
|
|
126
|
+
For more information, see https://www.github.com/moderation-api/sdk-python#accessing-raw-response-data-eg-headers
|
|
127
|
+
"""
|
|
128
|
+
return AsyncContentResourceWithRawResponse(self)
|
|
129
|
+
|
|
130
|
+
@cached_property
|
|
131
|
+
def with_streaming_response(self) -> AsyncContentResourceWithStreamingResponse:
|
|
132
|
+
"""
|
|
133
|
+
An alternative to `.with_raw_response` that doesn't eagerly read the response body.
|
|
134
|
+
|
|
135
|
+
For more information, see https://www.github.com/moderation-api/sdk-python#with_streaming_response
|
|
136
|
+
"""
|
|
137
|
+
return AsyncContentResourceWithStreamingResponse(self)
|
|
138
|
+
|
|
139
|
+
async def submit(
|
|
140
|
+
self,
|
|
141
|
+
*,
|
|
142
|
+
content: content_submit_params.Content,
|
|
143
|
+
author_id: str | Omit = omit,
|
|
144
|
+
channel: str | Omit = omit,
|
|
145
|
+
content_id: str | Omit = omit,
|
|
146
|
+
conversation_id: str | Omit = omit,
|
|
147
|
+
do_not_store: bool | Omit = omit,
|
|
148
|
+
metadata: Dict[str, object] | Omit = omit,
|
|
149
|
+
meta_type: Literal["profile", "message", "post", "comment", "event", "product", "review", "other"]
|
|
150
|
+
| Omit = omit,
|
|
151
|
+
policies: Iterable[content_submit_params.Policy] | Omit = omit,
|
|
152
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
153
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
154
|
+
extra_headers: Headers | None = None,
|
|
155
|
+
extra_query: Query | None = None,
|
|
156
|
+
extra_body: Body | None = None,
|
|
157
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
158
|
+
) -> ContentSubmitResponse:
|
|
159
|
+
"""
|
|
160
|
+
Args:
|
|
161
|
+
content: The content sent for moderation
|
|
162
|
+
|
|
163
|
+
author_id: The author of the content.
|
|
164
|
+
|
|
165
|
+
channel: Provide a channel ID or key. Will use the project's default channel if not
|
|
166
|
+
provided.
|
|
167
|
+
|
|
168
|
+
content_id: The unique ID of the content in your database.
|
|
169
|
+
|
|
170
|
+
conversation_id: For example the ID of a chat room or a post
|
|
171
|
+
|
|
172
|
+
do_not_store: Do not store the content. The content won't enter the review queue
|
|
173
|
+
|
|
174
|
+
metadata: Any metadata you want to store with the content
|
|
175
|
+
|
|
176
|
+
meta_type: The meta type of content being moderated
|
|
177
|
+
|
|
178
|
+
policies: (Enterprise) override the channel policies for this moderation request only.
|
|
179
|
+
|
|
180
|
+
extra_headers: Send extra headers
|
|
181
|
+
|
|
182
|
+
extra_query: Add additional query parameters to the request
|
|
183
|
+
|
|
184
|
+
extra_body: Add additional JSON properties to the request
|
|
185
|
+
|
|
186
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
187
|
+
"""
|
|
188
|
+
return await self._post(
|
|
189
|
+
"/moderate",
|
|
190
|
+
body=await async_maybe_transform(
|
|
191
|
+
{
|
|
192
|
+
"content": content,
|
|
193
|
+
"author_id": author_id,
|
|
194
|
+
"channel": channel,
|
|
195
|
+
"content_id": content_id,
|
|
196
|
+
"conversation_id": conversation_id,
|
|
197
|
+
"do_not_store": do_not_store,
|
|
198
|
+
"metadata": metadata,
|
|
199
|
+
"meta_type": meta_type,
|
|
200
|
+
"policies": policies,
|
|
201
|
+
},
|
|
202
|
+
content_submit_params.ContentSubmitParams,
|
|
203
|
+
),
|
|
204
|
+
options=make_request_options(
|
|
205
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
206
|
+
),
|
|
207
|
+
cast_to=ContentSubmitResponse,
|
|
208
|
+
)
|
|
209
|
+
|
|
210
|
+
|
|
211
|
+
class ContentResourceWithRawResponse:
|
|
212
|
+
def __init__(self, content: ContentResource) -> None:
|
|
213
|
+
self._content = content
|
|
214
|
+
|
|
215
|
+
self.submit = to_raw_response_wrapper(
|
|
216
|
+
content.submit,
|
|
217
|
+
)
|
|
218
|
+
|
|
219
|
+
|
|
220
|
+
class AsyncContentResourceWithRawResponse:
|
|
221
|
+
def __init__(self, content: AsyncContentResource) -> None:
|
|
222
|
+
self._content = content
|
|
223
|
+
|
|
224
|
+
self.submit = async_to_raw_response_wrapper(
|
|
225
|
+
content.submit,
|
|
226
|
+
)
|
|
227
|
+
|
|
228
|
+
|
|
229
|
+
class ContentResourceWithStreamingResponse:
|
|
230
|
+
def __init__(self, content: ContentResource) -> None:
|
|
231
|
+
self._content = content
|
|
232
|
+
|
|
233
|
+
self.submit = to_streamed_response_wrapper(
|
|
234
|
+
content.submit,
|
|
235
|
+
)
|
|
236
|
+
|
|
237
|
+
|
|
238
|
+
class AsyncContentResourceWithStreamingResponse:
|
|
239
|
+
def __init__(self, content: AsyncContentResource) -> None:
|
|
240
|
+
self._content = content
|
|
241
|
+
|
|
242
|
+
self.submit = async_to_streamed_response_wrapper(
|
|
243
|
+
content.submit,
|
|
244
|
+
)
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
|
|
3
|
+
from .items import (
|
|
4
|
+
ItemsResource,
|
|
5
|
+
AsyncItemsResource,
|
|
6
|
+
ItemsResourceWithRawResponse,
|
|
7
|
+
AsyncItemsResourceWithRawResponse,
|
|
8
|
+
ItemsResourceWithStreamingResponse,
|
|
9
|
+
AsyncItemsResourceWithStreamingResponse,
|
|
10
|
+
)
|
|
11
|
+
from .queue import (
|
|
12
|
+
QueueResource,
|
|
13
|
+
AsyncQueueResource,
|
|
14
|
+
QueueResourceWithRawResponse,
|
|
15
|
+
AsyncQueueResourceWithRawResponse,
|
|
16
|
+
QueueResourceWithStreamingResponse,
|
|
17
|
+
AsyncQueueResourceWithStreamingResponse,
|
|
18
|
+
)
|
|
19
|
+
|
|
20
|
+
__all__ = [
|
|
21
|
+
"ItemsResource",
|
|
22
|
+
"AsyncItemsResource",
|
|
23
|
+
"ItemsResourceWithRawResponse",
|
|
24
|
+
"AsyncItemsResourceWithRawResponse",
|
|
25
|
+
"ItemsResourceWithStreamingResponse",
|
|
26
|
+
"AsyncItemsResourceWithStreamingResponse",
|
|
27
|
+
"QueueResource",
|
|
28
|
+
"AsyncQueueResource",
|
|
29
|
+
"QueueResourceWithRawResponse",
|
|
30
|
+
"AsyncQueueResourceWithRawResponse",
|
|
31
|
+
"QueueResourceWithStreamingResponse",
|
|
32
|
+
"AsyncQueueResourceWithStreamingResponse",
|
|
33
|
+
]
|