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,352 @@
|
|
|
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, Union, Iterable
|
|
6
|
+
from typing_extensions import Literal, Required, Annotated, TypeAlias, TypedDict
|
|
7
|
+
|
|
8
|
+
from .._utils import PropertyInfo
|
|
9
|
+
|
|
10
|
+
__all__ = [
|
|
11
|
+
"ContentSubmitParams",
|
|
12
|
+
"Content",
|
|
13
|
+
"ContentText",
|
|
14
|
+
"ContentImage",
|
|
15
|
+
"ContentVideo",
|
|
16
|
+
"ContentAudio",
|
|
17
|
+
"ContentObject",
|
|
18
|
+
"ContentObjectData",
|
|
19
|
+
"ContentObjectDataText",
|
|
20
|
+
"ContentObjectDataImage",
|
|
21
|
+
"ContentObjectDataVideo",
|
|
22
|
+
"ContentObjectDataAudio",
|
|
23
|
+
"Policy",
|
|
24
|
+
"PolicyToxicity",
|
|
25
|
+
"PolicyPersonalInformation",
|
|
26
|
+
"PolicyToxicitySevere",
|
|
27
|
+
"PolicyHate",
|
|
28
|
+
"PolicyIllicit",
|
|
29
|
+
"PolicyIllicitDrugs",
|
|
30
|
+
"PolicyIllicitAlcohol",
|
|
31
|
+
"PolicyIllicitFirearms",
|
|
32
|
+
"PolicyIllicitTobacco",
|
|
33
|
+
"PolicyIllicitGambling",
|
|
34
|
+
"PolicySexual",
|
|
35
|
+
"PolicyFlirtation",
|
|
36
|
+
"PolicyProfanity",
|
|
37
|
+
"PolicyViolence",
|
|
38
|
+
"PolicySelfHarm",
|
|
39
|
+
"PolicySpam",
|
|
40
|
+
"PolicySelfPromotion",
|
|
41
|
+
"PolicyPolitical",
|
|
42
|
+
"PolicyReligion",
|
|
43
|
+
"PolicyCodeAbuse",
|
|
44
|
+
"PolicyPiiMasking",
|
|
45
|
+
"PolicyPiiMaskingEntities",
|
|
46
|
+
"PolicyURLMasking",
|
|
47
|
+
"PolicyURLMaskingEntities",
|
|
48
|
+
"PolicyGuideline",
|
|
49
|
+
]
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
class ContentSubmitParams(TypedDict, total=False):
|
|
53
|
+
content: Required[Content]
|
|
54
|
+
"""The content sent for moderation"""
|
|
55
|
+
|
|
56
|
+
author_id: Annotated[str, PropertyInfo(alias="authorId")]
|
|
57
|
+
"""The author of the content."""
|
|
58
|
+
|
|
59
|
+
channel: str
|
|
60
|
+
"""Provide a channel ID or key.
|
|
61
|
+
|
|
62
|
+
Will use the project's default channel if not provided.
|
|
63
|
+
"""
|
|
64
|
+
|
|
65
|
+
content_id: Annotated[str, PropertyInfo(alias="contentId")]
|
|
66
|
+
"""The unique ID of the content in your database."""
|
|
67
|
+
|
|
68
|
+
conversation_id: Annotated[str, PropertyInfo(alias="conversationId")]
|
|
69
|
+
"""For example the ID of a chat room or a post"""
|
|
70
|
+
|
|
71
|
+
do_not_store: Annotated[bool, PropertyInfo(alias="doNotStore")]
|
|
72
|
+
"""Do not store the content. The content won't enter the review queue"""
|
|
73
|
+
|
|
74
|
+
metadata: Dict[str, object]
|
|
75
|
+
"""Any metadata you want to store with the content"""
|
|
76
|
+
|
|
77
|
+
meta_type: Annotated[
|
|
78
|
+
Literal["profile", "message", "post", "comment", "event", "product", "review", "other"],
|
|
79
|
+
PropertyInfo(alias="metaType"),
|
|
80
|
+
]
|
|
81
|
+
"""The meta type of content being moderated"""
|
|
82
|
+
|
|
83
|
+
policies: Iterable[Policy]
|
|
84
|
+
"""(Enterprise) override the channel policies for this moderation request only."""
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
class ContentText(TypedDict, total=False):
|
|
88
|
+
text: Required[str]
|
|
89
|
+
"""The content text"""
|
|
90
|
+
|
|
91
|
+
type: Required[Literal["text"]]
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
class ContentImage(TypedDict, total=False):
|
|
95
|
+
type: Required[Literal["image"]]
|
|
96
|
+
|
|
97
|
+
url: Required[str]
|
|
98
|
+
"""A public URL of the image content"""
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
class ContentVideo(TypedDict, total=False):
|
|
102
|
+
type: Required[Literal["video"]]
|
|
103
|
+
|
|
104
|
+
url: Required[str]
|
|
105
|
+
"""A public URL of the video content"""
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
class ContentAudio(TypedDict, total=False):
|
|
109
|
+
type: Required[Literal["audio"]]
|
|
110
|
+
|
|
111
|
+
url: Required[str]
|
|
112
|
+
"""The URL of the audio content"""
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
class ContentObjectDataText(TypedDict, total=False):
|
|
116
|
+
text: Required[str]
|
|
117
|
+
"""The content text"""
|
|
118
|
+
|
|
119
|
+
type: Required[Literal["text"]]
|
|
120
|
+
|
|
121
|
+
|
|
122
|
+
class ContentObjectDataImage(TypedDict, total=False):
|
|
123
|
+
type: Required[Literal["image"]]
|
|
124
|
+
|
|
125
|
+
url: Required[str]
|
|
126
|
+
"""A public URL of the image content"""
|
|
127
|
+
|
|
128
|
+
|
|
129
|
+
class ContentObjectDataVideo(TypedDict, total=False):
|
|
130
|
+
type: Required[Literal["video"]]
|
|
131
|
+
|
|
132
|
+
url: Required[str]
|
|
133
|
+
"""A public URL of the video content"""
|
|
134
|
+
|
|
135
|
+
|
|
136
|
+
class ContentObjectDataAudio(TypedDict, total=False):
|
|
137
|
+
type: Required[Literal["audio"]]
|
|
138
|
+
|
|
139
|
+
url: Required[str]
|
|
140
|
+
"""The URL of the audio content"""
|
|
141
|
+
|
|
142
|
+
|
|
143
|
+
ContentObjectData: TypeAlias = Union[
|
|
144
|
+
ContentObjectDataText, ContentObjectDataImage, ContentObjectDataVideo, ContentObjectDataAudio
|
|
145
|
+
]
|
|
146
|
+
|
|
147
|
+
|
|
148
|
+
class ContentObject(TypedDict, total=False):
|
|
149
|
+
data: Required[Dict[str, ContentObjectData]]
|
|
150
|
+
"""Values in the object. Can be mixed content types."""
|
|
151
|
+
|
|
152
|
+
type: Required[Literal["object"]]
|
|
153
|
+
|
|
154
|
+
|
|
155
|
+
Content: TypeAlias = Union[ContentText, ContentImage, ContentVideo, ContentAudio, ContentObject]
|
|
156
|
+
|
|
157
|
+
|
|
158
|
+
class PolicyToxicity(TypedDict, total=False):
|
|
159
|
+
id: Required[Literal["toxicity"]]
|
|
160
|
+
|
|
161
|
+
flag: Required[bool]
|
|
162
|
+
|
|
163
|
+
|
|
164
|
+
class PolicyPersonalInformation(TypedDict, total=False):
|
|
165
|
+
id: Required[Literal["personal_information"]]
|
|
166
|
+
|
|
167
|
+
flag: Required[bool]
|
|
168
|
+
|
|
169
|
+
|
|
170
|
+
class PolicyToxicitySevere(TypedDict, total=False):
|
|
171
|
+
id: Required[Literal["toxicity_severe"]]
|
|
172
|
+
|
|
173
|
+
flag: Required[bool]
|
|
174
|
+
|
|
175
|
+
|
|
176
|
+
class PolicyHate(TypedDict, total=False):
|
|
177
|
+
id: Required[Literal["hate"]]
|
|
178
|
+
|
|
179
|
+
flag: Required[bool]
|
|
180
|
+
|
|
181
|
+
|
|
182
|
+
class PolicyIllicit(TypedDict, total=False):
|
|
183
|
+
id: Required[Literal["illicit"]]
|
|
184
|
+
|
|
185
|
+
flag: Required[bool]
|
|
186
|
+
|
|
187
|
+
|
|
188
|
+
class PolicyIllicitDrugs(TypedDict, total=False):
|
|
189
|
+
id: Required[Literal["illicit_drugs"]]
|
|
190
|
+
|
|
191
|
+
flag: Required[bool]
|
|
192
|
+
|
|
193
|
+
|
|
194
|
+
class PolicyIllicitAlcohol(TypedDict, total=False):
|
|
195
|
+
id: Required[Literal["illicit_alcohol"]]
|
|
196
|
+
|
|
197
|
+
flag: Required[bool]
|
|
198
|
+
|
|
199
|
+
|
|
200
|
+
class PolicyIllicitFirearms(TypedDict, total=False):
|
|
201
|
+
id: Required[Literal["illicit_firearms"]]
|
|
202
|
+
|
|
203
|
+
flag: Required[bool]
|
|
204
|
+
|
|
205
|
+
|
|
206
|
+
class PolicyIllicitTobacco(TypedDict, total=False):
|
|
207
|
+
id: Required[Literal["illicit_tobacco"]]
|
|
208
|
+
|
|
209
|
+
flag: Required[bool]
|
|
210
|
+
|
|
211
|
+
|
|
212
|
+
class PolicyIllicitGambling(TypedDict, total=False):
|
|
213
|
+
id: Required[Literal["illicit_gambling"]]
|
|
214
|
+
|
|
215
|
+
flag: Required[bool]
|
|
216
|
+
|
|
217
|
+
|
|
218
|
+
class PolicySexual(TypedDict, total=False):
|
|
219
|
+
id: Required[Literal["sexual"]]
|
|
220
|
+
|
|
221
|
+
flag: Required[bool]
|
|
222
|
+
|
|
223
|
+
|
|
224
|
+
class PolicyFlirtation(TypedDict, total=False):
|
|
225
|
+
id: Required[Literal["flirtation"]]
|
|
226
|
+
|
|
227
|
+
flag: Required[bool]
|
|
228
|
+
|
|
229
|
+
|
|
230
|
+
class PolicyProfanity(TypedDict, total=False):
|
|
231
|
+
id: Required[Literal["profanity"]]
|
|
232
|
+
|
|
233
|
+
flag: Required[bool]
|
|
234
|
+
|
|
235
|
+
|
|
236
|
+
class PolicyViolence(TypedDict, total=False):
|
|
237
|
+
id: Required[Literal["violence"]]
|
|
238
|
+
|
|
239
|
+
flag: Required[bool]
|
|
240
|
+
|
|
241
|
+
|
|
242
|
+
class PolicySelfHarm(TypedDict, total=False):
|
|
243
|
+
id: Required[Literal["self_harm"]]
|
|
244
|
+
|
|
245
|
+
flag: Required[bool]
|
|
246
|
+
|
|
247
|
+
|
|
248
|
+
class PolicySpam(TypedDict, total=False):
|
|
249
|
+
id: Required[Literal["spam"]]
|
|
250
|
+
|
|
251
|
+
flag: Required[bool]
|
|
252
|
+
|
|
253
|
+
|
|
254
|
+
class PolicySelfPromotion(TypedDict, total=False):
|
|
255
|
+
id: Required[Literal["self_promotion"]]
|
|
256
|
+
|
|
257
|
+
flag: Required[bool]
|
|
258
|
+
|
|
259
|
+
|
|
260
|
+
class PolicyPolitical(TypedDict, total=False):
|
|
261
|
+
id: Required[Literal["political"]]
|
|
262
|
+
|
|
263
|
+
flag: Required[bool]
|
|
264
|
+
|
|
265
|
+
|
|
266
|
+
class PolicyReligion(TypedDict, total=False):
|
|
267
|
+
id: Required[Literal["religion"]]
|
|
268
|
+
|
|
269
|
+
flag: Required[bool]
|
|
270
|
+
|
|
271
|
+
|
|
272
|
+
class PolicyCodeAbuse(TypedDict, total=False):
|
|
273
|
+
id: Required[Literal["code_abuse"]]
|
|
274
|
+
|
|
275
|
+
flag: Required[bool]
|
|
276
|
+
|
|
277
|
+
|
|
278
|
+
class PolicyPiiMaskingEntities(TypedDict, total=False):
|
|
279
|
+
id: Required[
|
|
280
|
+
Literal["email", "phone", "url", "address", "name", "username", "ip_address", "credit_card", "sensitive_other"]
|
|
281
|
+
]
|
|
282
|
+
|
|
283
|
+
enable: Required[bool]
|
|
284
|
+
|
|
285
|
+
flag: Required[bool]
|
|
286
|
+
|
|
287
|
+
should_mask: Required[Annotated[bool, PropertyInfo(alias="shouldMask")]]
|
|
288
|
+
|
|
289
|
+
mask: str
|
|
290
|
+
|
|
291
|
+
|
|
292
|
+
class PolicyPiiMasking(TypedDict, total=False):
|
|
293
|
+
id: Required[Literal["pii"]]
|
|
294
|
+
|
|
295
|
+
entities: Required[Dict[str, PolicyPiiMaskingEntities]]
|
|
296
|
+
|
|
297
|
+
|
|
298
|
+
class PolicyURLMaskingEntities(TypedDict, total=False):
|
|
299
|
+
id: Required[
|
|
300
|
+
Literal["email", "phone", "url", "address", "name", "username", "ip_address", "credit_card", "sensitive_other"]
|
|
301
|
+
]
|
|
302
|
+
|
|
303
|
+
enable: Required[bool]
|
|
304
|
+
|
|
305
|
+
flag: Required[bool]
|
|
306
|
+
|
|
307
|
+
should_mask: Required[Annotated[bool, PropertyInfo(alias="shouldMask")]]
|
|
308
|
+
|
|
309
|
+
mask: str
|
|
310
|
+
|
|
311
|
+
|
|
312
|
+
class PolicyURLMasking(TypedDict, total=False):
|
|
313
|
+
id: Required[Literal["url"]]
|
|
314
|
+
|
|
315
|
+
entities: Required[Dict[str, PolicyURLMaskingEntities]]
|
|
316
|
+
|
|
317
|
+
|
|
318
|
+
class PolicyGuideline(TypedDict, total=False):
|
|
319
|
+
id: Required[Literal["guideline"]]
|
|
320
|
+
|
|
321
|
+
flag: Required[bool]
|
|
322
|
+
|
|
323
|
+
guideline_key: Required[Annotated[str, PropertyInfo(alias="guidelineKey")]]
|
|
324
|
+
|
|
325
|
+
instructions: Required[str]
|
|
326
|
+
|
|
327
|
+
|
|
328
|
+
Policy: TypeAlias = Union[
|
|
329
|
+
PolicyToxicity,
|
|
330
|
+
PolicyPersonalInformation,
|
|
331
|
+
PolicyToxicitySevere,
|
|
332
|
+
PolicyHate,
|
|
333
|
+
PolicyIllicit,
|
|
334
|
+
PolicyIllicitDrugs,
|
|
335
|
+
PolicyIllicitAlcohol,
|
|
336
|
+
PolicyIllicitFirearms,
|
|
337
|
+
PolicyIllicitTobacco,
|
|
338
|
+
PolicyIllicitGambling,
|
|
339
|
+
PolicySexual,
|
|
340
|
+
PolicyFlirtation,
|
|
341
|
+
PolicyProfanity,
|
|
342
|
+
PolicyViolence,
|
|
343
|
+
PolicySelfHarm,
|
|
344
|
+
PolicySpam,
|
|
345
|
+
PolicySelfPromotion,
|
|
346
|
+
PolicyPolitical,
|
|
347
|
+
PolicyReligion,
|
|
348
|
+
PolicyCodeAbuse,
|
|
349
|
+
PolicyPiiMasking,
|
|
350
|
+
PolicyURLMasking,
|
|
351
|
+
PolicyGuideline,
|
|
352
|
+
]
|
|
@@ -0,0 +1,269 @@
|
|
|
1
|
+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
|
|
3
|
+
from typing import Dict, List, Union, Optional
|
|
4
|
+
from typing_extensions import Literal, TypeAlias
|
|
5
|
+
|
|
6
|
+
from .._models import BaseModel
|
|
7
|
+
|
|
8
|
+
__all__ = [
|
|
9
|
+
"ContentSubmitResponse",
|
|
10
|
+
"Author",
|
|
11
|
+
"AuthorBlock",
|
|
12
|
+
"AuthorTrustLevel",
|
|
13
|
+
"Content",
|
|
14
|
+
"ContentModifiedModifiedNestedObjectContentContentModifiedModifiedNestedObjectContentItem",
|
|
15
|
+
"ContentModifiedModifiedNestedObjectContentContentModifiedModifiedNestedObjectContentItemText",
|
|
16
|
+
"ContentModifiedModifiedNestedObjectContentContentModifiedModifiedNestedObjectContentItemImage",
|
|
17
|
+
"ContentModifiedModifiedNestedObjectContentContentModifiedModifiedNestedObjectContentItemVideo",
|
|
18
|
+
"ContentModifiedModifiedNestedObjectContentContentModifiedModifiedNestedObjectContentItemAudio",
|
|
19
|
+
"Evaluation",
|
|
20
|
+
"Insight",
|
|
21
|
+
"InsightSentimentInsight",
|
|
22
|
+
"InsightLanguageInsight",
|
|
23
|
+
"Meta",
|
|
24
|
+
"Policy",
|
|
25
|
+
"PolicyClassifierOutput",
|
|
26
|
+
"PolicyClassifierOutputLabel",
|
|
27
|
+
"PolicyEntityMatcherOutput",
|
|
28
|
+
"PolicyEntityMatcherOutputMatch",
|
|
29
|
+
"Recommendation",
|
|
30
|
+
"Error",
|
|
31
|
+
]
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
class AuthorBlock(BaseModel):
|
|
35
|
+
reason: Optional[str] = None
|
|
36
|
+
"""The moderators reason why the author was blocked or suspended."""
|
|
37
|
+
|
|
38
|
+
until: Optional[float] = None
|
|
39
|
+
"""The timestamp until which they are blocked if the author is suspended."""
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
class AuthorTrustLevel(BaseModel):
|
|
43
|
+
level: float
|
|
44
|
+
"""Author trust level (-1, 0, 1, 2, 3, or 4)"""
|
|
45
|
+
|
|
46
|
+
manual: bool
|
|
47
|
+
"""True if the trust level was set manually by a moderator"""
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
class Author(BaseModel):
|
|
51
|
+
id: str
|
|
52
|
+
"""Author ID in Moderation API"""
|
|
53
|
+
|
|
54
|
+
block: Optional[AuthorBlock] = None
|
|
55
|
+
"""Block or suspension details, if applicable. Null if the author is enabled."""
|
|
56
|
+
|
|
57
|
+
status: Literal["enabled", "suspended", "blocked"]
|
|
58
|
+
"""Current author status"""
|
|
59
|
+
|
|
60
|
+
trust_level: AuthorTrustLevel
|
|
61
|
+
|
|
62
|
+
external_id: Optional[str] = None
|
|
63
|
+
"""The author's ID from your system"""
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
class ContentModifiedModifiedNestedObjectContentContentModifiedModifiedNestedObjectContentItemText(BaseModel):
|
|
67
|
+
text: str
|
|
68
|
+
"""The content text"""
|
|
69
|
+
|
|
70
|
+
type: Literal["text"]
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
class ContentModifiedModifiedNestedObjectContentContentModifiedModifiedNestedObjectContentItemImage(BaseModel):
|
|
74
|
+
type: Literal["image"]
|
|
75
|
+
|
|
76
|
+
url: str
|
|
77
|
+
"""A public URL of the image content"""
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
class ContentModifiedModifiedNestedObjectContentContentModifiedModifiedNestedObjectContentItemVideo(BaseModel):
|
|
81
|
+
type: Literal["video"]
|
|
82
|
+
|
|
83
|
+
url: str
|
|
84
|
+
"""A public URL of the video content"""
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
class ContentModifiedModifiedNestedObjectContentContentModifiedModifiedNestedObjectContentItemAudio(BaseModel):
|
|
88
|
+
type: Literal["audio"]
|
|
89
|
+
|
|
90
|
+
url: str
|
|
91
|
+
"""The URL of the audio content"""
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
ContentModifiedModifiedNestedObjectContentContentModifiedModifiedNestedObjectContentItem: TypeAlias = Union[
|
|
95
|
+
ContentModifiedModifiedNestedObjectContentContentModifiedModifiedNestedObjectContentItemText,
|
|
96
|
+
ContentModifiedModifiedNestedObjectContentContentModifiedModifiedNestedObjectContentItemImage,
|
|
97
|
+
ContentModifiedModifiedNestedObjectContentContentModifiedModifiedNestedObjectContentItemVideo,
|
|
98
|
+
ContentModifiedModifiedNestedObjectContentContentModifiedModifiedNestedObjectContentItemAudio,
|
|
99
|
+
]
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
class Content(BaseModel):
|
|
103
|
+
id: str
|
|
104
|
+
"""The unique identifier for the content.
|
|
105
|
+
|
|
106
|
+
Either the contentId provided by you or an autogenerated ID.
|
|
107
|
+
"""
|
|
108
|
+
|
|
109
|
+
masked: bool
|
|
110
|
+
"""Whether any values have been masked."""
|
|
111
|
+
|
|
112
|
+
modified: Union[
|
|
113
|
+
str,
|
|
114
|
+
Dict[str, object],
|
|
115
|
+
Dict[str, ContentModifiedModifiedNestedObjectContentContentModifiedModifiedNestedObjectContentItem],
|
|
116
|
+
None,
|
|
117
|
+
] = None
|
|
118
|
+
"""The modified content, if any."""
|
|
119
|
+
|
|
120
|
+
|
|
121
|
+
class Evaluation(BaseModel):
|
|
122
|
+
flag_probability: float
|
|
123
|
+
"""The probability that the content should be flagged."""
|
|
124
|
+
|
|
125
|
+
flagged: bool
|
|
126
|
+
"""Whether the content was flagged by any policy."""
|
|
127
|
+
|
|
128
|
+
severity_score: float
|
|
129
|
+
"""The severity score of the content.
|
|
130
|
+
|
|
131
|
+
A higher score indicates more severe content.
|
|
132
|
+
"""
|
|
133
|
+
|
|
134
|
+
unicode_spoofed: Optional[bool] = None
|
|
135
|
+
"""Whether the content was flagged for Unicode spoofing."""
|
|
136
|
+
|
|
137
|
+
|
|
138
|
+
class InsightSentimentInsight(BaseModel):
|
|
139
|
+
id: Literal["sentiment"]
|
|
140
|
+
|
|
141
|
+
probability: float
|
|
142
|
+
|
|
143
|
+
type: Literal["insight"]
|
|
144
|
+
|
|
145
|
+
value: Optional[Literal["positive", "neutral", "negative"]] = None
|
|
146
|
+
|
|
147
|
+
|
|
148
|
+
class InsightLanguageInsight(BaseModel):
|
|
149
|
+
id: Literal["language"]
|
|
150
|
+
|
|
151
|
+
probability: float
|
|
152
|
+
|
|
153
|
+
type: Literal["insight"]
|
|
154
|
+
|
|
155
|
+
value: Optional[str] = None
|
|
156
|
+
|
|
157
|
+
|
|
158
|
+
Insight: TypeAlias = Union[InsightSentimentInsight, InsightLanguageInsight]
|
|
159
|
+
|
|
160
|
+
|
|
161
|
+
class Meta(BaseModel):
|
|
162
|
+
channel_key: str
|
|
163
|
+
"""The unique key of the channel where the content was handled.
|
|
164
|
+
|
|
165
|
+
Either the channel provided by you or automatically routed.
|
|
166
|
+
"""
|
|
167
|
+
|
|
168
|
+
status: Literal["success", "partial_success"]
|
|
169
|
+
|
|
170
|
+
timestamp: float
|
|
171
|
+
|
|
172
|
+
usage: float
|
|
173
|
+
|
|
174
|
+
processing_time: Optional[str] = None
|
|
175
|
+
|
|
176
|
+
|
|
177
|
+
class PolicyClassifierOutputLabel(BaseModel):
|
|
178
|
+
id: str
|
|
179
|
+
|
|
180
|
+
flagged: bool
|
|
181
|
+
|
|
182
|
+
probability: float
|
|
183
|
+
|
|
184
|
+
|
|
185
|
+
class PolicyClassifierOutput(BaseModel):
|
|
186
|
+
id: str
|
|
187
|
+
"""The unique identifier for the classifier output."""
|
|
188
|
+
|
|
189
|
+
flagged: bool
|
|
190
|
+
|
|
191
|
+
probability: float
|
|
192
|
+
|
|
193
|
+
type: Literal["classifier"]
|
|
194
|
+
|
|
195
|
+
flagged_fields: Optional[List[str]] = None
|
|
196
|
+
"""The keys of the flagged fields if submitting an object."""
|
|
197
|
+
|
|
198
|
+
labels: Optional[List[PolicyClassifierOutputLabel]] = None
|
|
199
|
+
|
|
200
|
+
|
|
201
|
+
class PolicyEntityMatcherOutputMatch(BaseModel):
|
|
202
|
+
match: str
|
|
203
|
+
|
|
204
|
+
probability: float
|
|
205
|
+
|
|
206
|
+
span: List[int]
|
|
207
|
+
|
|
208
|
+
|
|
209
|
+
class PolicyEntityMatcherOutput(BaseModel):
|
|
210
|
+
id: str
|
|
211
|
+
|
|
212
|
+
flagged: bool
|
|
213
|
+
|
|
214
|
+
matches: List[PolicyEntityMatcherOutputMatch]
|
|
215
|
+
|
|
216
|
+
probability: float
|
|
217
|
+
|
|
218
|
+
type: Literal["entity_matcher"]
|
|
219
|
+
|
|
220
|
+
flagged_fields: Optional[List[str]] = None
|
|
221
|
+
|
|
222
|
+
|
|
223
|
+
Policy: TypeAlias = Union[PolicyClassifierOutput, PolicyEntityMatcherOutput]
|
|
224
|
+
|
|
225
|
+
|
|
226
|
+
class Recommendation(BaseModel):
|
|
227
|
+
action: Literal["review", "allow", "reject"]
|
|
228
|
+
"""The action to take based on the recommendation"""
|
|
229
|
+
|
|
230
|
+
reason_codes: List[Literal["severity_reject", "severity_review", "author_block", "dry_run"]]
|
|
231
|
+
"""The reason code for the recommendation.
|
|
232
|
+
|
|
233
|
+
Can be used to display a reason to the user.
|
|
234
|
+
"""
|
|
235
|
+
|
|
236
|
+
|
|
237
|
+
class Error(BaseModel):
|
|
238
|
+
id: str
|
|
239
|
+
|
|
240
|
+
message: str
|
|
241
|
+
|
|
242
|
+
|
|
243
|
+
class ContentSubmitResponse(BaseModel):
|
|
244
|
+
author: Optional[Author] = None
|
|
245
|
+
"""The author of the content if your account has authors enabled.
|
|
246
|
+
|
|
247
|
+
Requires you to send authorId when submitting content.
|
|
248
|
+
"""
|
|
249
|
+
|
|
250
|
+
content: Content
|
|
251
|
+
"""Potentially modified content."""
|
|
252
|
+
|
|
253
|
+
evaluation: Evaluation
|
|
254
|
+
"""The evaluation of the content after running the channel policies."""
|
|
255
|
+
|
|
256
|
+
insights: List[Insight]
|
|
257
|
+
"""Results of all insights enabled in the channel."""
|
|
258
|
+
|
|
259
|
+
meta: Meta
|
|
260
|
+
"""Metadata about the moderation request"""
|
|
261
|
+
|
|
262
|
+
policies: List[Policy]
|
|
263
|
+
"""Results of all policies in the channel. Sorted by highest probability."""
|
|
264
|
+
|
|
265
|
+
recommendation: Recommendation
|
|
266
|
+
"""The recommendation for the content based on the evaluation."""
|
|
267
|
+
|
|
268
|
+
errors: Optional[List[Error]] = None
|
|
269
|
+
"""Policies that had errors"""
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from .item_list_params import ItemListParams as ItemListParams
|
|
6
|
+
from .item_list_response import ItemListResponse as ItemListResponse
|
|
7
|
+
from .item_resolve_params import ItemResolveParams as ItemResolveParams
|
|
8
|
+
from .item_resolve_response import ItemResolveResponse as ItemResolveResponse
|
|
9
|
+
from .item_unresolve_params import ItemUnresolveParams as ItemUnresolveParams
|
|
10
|
+
from .item_unresolve_response import ItemUnresolveResponse as ItemUnresolveResponse
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from typing_extensions import Literal, Annotated, TypedDict
|
|
6
|
+
|
|
7
|
+
from ..._utils import PropertyInfo
|
|
8
|
+
|
|
9
|
+
__all__ = ["ItemListParams"]
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
class ItemListParams(TypedDict, total=False):
|
|
13
|
+
after_date: Annotated[str, PropertyInfo(alias="afterDate")]
|
|
14
|
+
|
|
15
|
+
author_id: Annotated[str, PropertyInfo(alias="authorId")]
|
|
16
|
+
|
|
17
|
+
before_date: Annotated[str, PropertyInfo(alias="beforeDate")]
|
|
18
|
+
|
|
19
|
+
conversation_ids: Annotated[str, PropertyInfo(alias="conversationIds")]
|
|
20
|
+
|
|
21
|
+
filtered_action_ids: Annotated[str, PropertyInfo(alias="filteredActionIds")]
|
|
22
|
+
|
|
23
|
+
include_resolved: Annotated[str, PropertyInfo(alias="includeResolved")]
|
|
24
|
+
|
|
25
|
+
labels: str
|
|
26
|
+
|
|
27
|
+
page_number: Annotated[float, PropertyInfo(alias="pageNumber")]
|
|
28
|
+
"""Page number to fetch"""
|
|
29
|
+
|
|
30
|
+
page_size: Annotated[float, PropertyInfo(alias="pageSize")]
|
|
31
|
+
"""Number of items per page"""
|
|
32
|
+
|
|
33
|
+
sort_direction: Annotated[Literal["asc", "desc"], PropertyInfo(alias="sortDirection")]
|
|
34
|
+
"""Sort direction"""
|
|
35
|
+
|
|
36
|
+
sort_field: Annotated[Literal["createdAt", "severity", "reviewedAt"], PropertyInfo(alias="sortField")]
|