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,714 @@
|
|
|
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 Optional
|
|
6
|
+
from typing_extensions import Literal
|
|
7
|
+
|
|
8
|
+
import httpx
|
|
9
|
+
|
|
10
|
+
from ..types import author_list_params, author_create_params, author_update_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.author_list_response import AuthorListResponse
|
|
23
|
+
from ..types.author_create_response import AuthorCreateResponse
|
|
24
|
+
from ..types.author_delete_response import AuthorDeleteResponse
|
|
25
|
+
from ..types.author_update_response import AuthorUpdateResponse
|
|
26
|
+
from ..types.author_retrieve_response import AuthorRetrieveResponse
|
|
27
|
+
|
|
28
|
+
__all__ = ["AuthorsResource", "AsyncAuthorsResource"]
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
class AuthorsResource(SyncAPIResource):
|
|
32
|
+
@cached_property
|
|
33
|
+
def with_raw_response(self) -> AuthorsResourceWithRawResponse:
|
|
34
|
+
"""
|
|
35
|
+
This property can be used as a prefix for any HTTP method call to return
|
|
36
|
+
the raw response object instead of the parsed content.
|
|
37
|
+
|
|
38
|
+
For more information, see https://www.github.com/moderation-api/sdk-python#accessing-raw-response-data-eg-headers
|
|
39
|
+
"""
|
|
40
|
+
return AuthorsResourceWithRawResponse(self)
|
|
41
|
+
|
|
42
|
+
@cached_property
|
|
43
|
+
def with_streaming_response(self) -> AuthorsResourceWithStreamingResponse:
|
|
44
|
+
"""
|
|
45
|
+
An alternative to `.with_raw_response` that doesn't eagerly read the response body.
|
|
46
|
+
|
|
47
|
+
For more information, see https://www.github.com/moderation-api/sdk-python#with_streaming_response
|
|
48
|
+
"""
|
|
49
|
+
return AuthorsResourceWithStreamingResponse(self)
|
|
50
|
+
|
|
51
|
+
def create(
|
|
52
|
+
self,
|
|
53
|
+
*,
|
|
54
|
+
external_id: str,
|
|
55
|
+
email: Optional[str] | Omit = omit,
|
|
56
|
+
external_link: Optional[str] | Omit = omit,
|
|
57
|
+
first_seen: float | Omit = omit,
|
|
58
|
+
last_seen: float | Omit = omit,
|
|
59
|
+
manual_trust_level: Optional[float] | Omit = omit,
|
|
60
|
+
metadata: author_create_params.Metadata | Omit = omit,
|
|
61
|
+
name: Optional[str] | Omit = omit,
|
|
62
|
+
profile_picture: Optional[str] | Omit = omit,
|
|
63
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
64
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
65
|
+
extra_headers: Headers | None = None,
|
|
66
|
+
extra_query: Query | None = None,
|
|
67
|
+
extra_body: Body | None = None,
|
|
68
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
69
|
+
) -> AuthorCreateResponse:
|
|
70
|
+
"""Create a new author.
|
|
71
|
+
|
|
72
|
+
Typically not needed as authors are created automatically
|
|
73
|
+
when content is moderated.
|
|
74
|
+
|
|
75
|
+
Args:
|
|
76
|
+
external_id: External ID of the user, typically the ID of the author in your database.
|
|
77
|
+
|
|
78
|
+
email: Author email address
|
|
79
|
+
|
|
80
|
+
external_link: URL of the author's external profile
|
|
81
|
+
|
|
82
|
+
first_seen: Timestamp when author first appeared
|
|
83
|
+
|
|
84
|
+
last_seen: Timestamp of last activity
|
|
85
|
+
|
|
86
|
+
metadata: Additional metadata provided by your system. We recommend including any relevant
|
|
87
|
+
information that may assist in the moderation process.
|
|
88
|
+
|
|
89
|
+
name: Author name or identifier
|
|
90
|
+
|
|
91
|
+
profile_picture: URL of the author's profile picture
|
|
92
|
+
|
|
93
|
+
extra_headers: Send extra headers
|
|
94
|
+
|
|
95
|
+
extra_query: Add additional query parameters to the request
|
|
96
|
+
|
|
97
|
+
extra_body: Add additional JSON properties to the request
|
|
98
|
+
|
|
99
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
100
|
+
"""
|
|
101
|
+
return self._post(
|
|
102
|
+
"/authors",
|
|
103
|
+
body=maybe_transform(
|
|
104
|
+
{
|
|
105
|
+
"external_id": external_id,
|
|
106
|
+
"email": email,
|
|
107
|
+
"external_link": external_link,
|
|
108
|
+
"first_seen": first_seen,
|
|
109
|
+
"last_seen": last_seen,
|
|
110
|
+
"manual_trust_level": manual_trust_level,
|
|
111
|
+
"metadata": metadata,
|
|
112
|
+
"name": name,
|
|
113
|
+
"profile_picture": profile_picture,
|
|
114
|
+
},
|
|
115
|
+
author_create_params.AuthorCreateParams,
|
|
116
|
+
),
|
|
117
|
+
options=make_request_options(
|
|
118
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
119
|
+
),
|
|
120
|
+
cast_to=AuthorCreateResponse,
|
|
121
|
+
)
|
|
122
|
+
|
|
123
|
+
def retrieve(
|
|
124
|
+
self,
|
|
125
|
+
id: str,
|
|
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
|
+
) -> AuthorRetrieveResponse:
|
|
134
|
+
"""
|
|
135
|
+
Get detailed information about a specific author including historical data and
|
|
136
|
+
analysis
|
|
137
|
+
|
|
138
|
+
Args:
|
|
139
|
+
id: Either external ID or the ID assigned by moderation API.
|
|
140
|
+
|
|
141
|
+
extra_headers: Send extra headers
|
|
142
|
+
|
|
143
|
+
extra_query: Add additional query parameters to the request
|
|
144
|
+
|
|
145
|
+
extra_body: Add additional JSON properties to the request
|
|
146
|
+
|
|
147
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
148
|
+
"""
|
|
149
|
+
if not id:
|
|
150
|
+
raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
|
|
151
|
+
return self._get(
|
|
152
|
+
f"/authors/{id}",
|
|
153
|
+
options=make_request_options(
|
|
154
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
155
|
+
),
|
|
156
|
+
cast_to=AuthorRetrieveResponse,
|
|
157
|
+
)
|
|
158
|
+
|
|
159
|
+
def update(
|
|
160
|
+
self,
|
|
161
|
+
id: str,
|
|
162
|
+
*,
|
|
163
|
+
email: Optional[str] | Omit = omit,
|
|
164
|
+
external_link: Optional[str] | Omit = omit,
|
|
165
|
+
first_seen: float | Omit = omit,
|
|
166
|
+
last_seen: float | Omit = omit,
|
|
167
|
+
manual_trust_level: Optional[float] | Omit = omit,
|
|
168
|
+
metadata: author_update_params.Metadata | Omit = omit,
|
|
169
|
+
name: Optional[str] | Omit = omit,
|
|
170
|
+
profile_picture: Optional[str] | Omit = omit,
|
|
171
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
172
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
173
|
+
extra_headers: Headers | None = None,
|
|
174
|
+
extra_query: Query | None = None,
|
|
175
|
+
extra_body: Body | None = None,
|
|
176
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
177
|
+
) -> AuthorUpdateResponse:
|
|
178
|
+
"""
|
|
179
|
+
Update the details of a specific author
|
|
180
|
+
|
|
181
|
+
Args:
|
|
182
|
+
id: Either external ID or the ID assigned by moderation API.
|
|
183
|
+
|
|
184
|
+
email: Author email address
|
|
185
|
+
|
|
186
|
+
external_link: URL of the author's external profile
|
|
187
|
+
|
|
188
|
+
first_seen: Timestamp when author first appeared
|
|
189
|
+
|
|
190
|
+
last_seen: Timestamp of last activity
|
|
191
|
+
|
|
192
|
+
metadata: Additional metadata provided by your system. We recommend including any relevant
|
|
193
|
+
information that may assist in the moderation process.
|
|
194
|
+
|
|
195
|
+
name: Author name or identifier
|
|
196
|
+
|
|
197
|
+
profile_picture: URL of the author's profile picture
|
|
198
|
+
|
|
199
|
+
extra_headers: Send extra headers
|
|
200
|
+
|
|
201
|
+
extra_query: Add additional query parameters to the request
|
|
202
|
+
|
|
203
|
+
extra_body: Add additional JSON properties to the request
|
|
204
|
+
|
|
205
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
206
|
+
"""
|
|
207
|
+
if not id:
|
|
208
|
+
raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
|
|
209
|
+
return self._put(
|
|
210
|
+
f"/authors/{id}",
|
|
211
|
+
body=maybe_transform(
|
|
212
|
+
{
|
|
213
|
+
"email": email,
|
|
214
|
+
"external_link": external_link,
|
|
215
|
+
"first_seen": first_seen,
|
|
216
|
+
"last_seen": last_seen,
|
|
217
|
+
"manual_trust_level": manual_trust_level,
|
|
218
|
+
"metadata": metadata,
|
|
219
|
+
"name": name,
|
|
220
|
+
"profile_picture": profile_picture,
|
|
221
|
+
},
|
|
222
|
+
author_update_params.AuthorUpdateParams,
|
|
223
|
+
),
|
|
224
|
+
options=make_request_options(
|
|
225
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
226
|
+
),
|
|
227
|
+
cast_to=AuthorUpdateResponse,
|
|
228
|
+
)
|
|
229
|
+
|
|
230
|
+
def list(
|
|
231
|
+
self,
|
|
232
|
+
*,
|
|
233
|
+
content_types: str | Omit = omit,
|
|
234
|
+
last_active_date: str | Omit = omit,
|
|
235
|
+
member_since_date: str | Omit = omit,
|
|
236
|
+
page_number: float | Omit = omit,
|
|
237
|
+
page_size: float | Omit = omit,
|
|
238
|
+
sort_by: Literal[
|
|
239
|
+
"trustLevel",
|
|
240
|
+
"violationCount",
|
|
241
|
+
"reportCount",
|
|
242
|
+
"memberSince",
|
|
243
|
+
"lastActive",
|
|
244
|
+
"contentCount",
|
|
245
|
+
"flaggedContentRatio",
|
|
246
|
+
"averageSentiment",
|
|
247
|
+
]
|
|
248
|
+
| Omit = omit,
|
|
249
|
+
sort_direction: Literal["asc", "desc"] | Omit = omit,
|
|
250
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
251
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
252
|
+
extra_headers: Headers | None = None,
|
|
253
|
+
extra_query: Query | None = None,
|
|
254
|
+
extra_body: Body | None = None,
|
|
255
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
256
|
+
) -> AuthorListResponse:
|
|
257
|
+
"""
|
|
258
|
+
Get a paginated list of authors with their activity metrics and reputation
|
|
259
|
+
|
|
260
|
+
Args:
|
|
261
|
+
page_number: Page number to fetch
|
|
262
|
+
|
|
263
|
+
page_size: Number of authors per page
|
|
264
|
+
|
|
265
|
+
sort_direction: Sort direction
|
|
266
|
+
|
|
267
|
+
extra_headers: Send extra headers
|
|
268
|
+
|
|
269
|
+
extra_query: Add additional query parameters to the request
|
|
270
|
+
|
|
271
|
+
extra_body: Add additional JSON properties to the request
|
|
272
|
+
|
|
273
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
274
|
+
"""
|
|
275
|
+
return self._get(
|
|
276
|
+
"/authors",
|
|
277
|
+
options=make_request_options(
|
|
278
|
+
extra_headers=extra_headers,
|
|
279
|
+
extra_query=extra_query,
|
|
280
|
+
extra_body=extra_body,
|
|
281
|
+
timeout=timeout,
|
|
282
|
+
query=maybe_transform(
|
|
283
|
+
{
|
|
284
|
+
"content_types": content_types,
|
|
285
|
+
"last_active_date": last_active_date,
|
|
286
|
+
"member_since_date": member_since_date,
|
|
287
|
+
"page_number": page_number,
|
|
288
|
+
"page_size": page_size,
|
|
289
|
+
"sort_by": sort_by,
|
|
290
|
+
"sort_direction": sort_direction,
|
|
291
|
+
},
|
|
292
|
+
author_list_params.AuthorListParams,
|
|
293
|
+
),
|
|
294
|
+
),
|
|
295
|
+
cast_to=AuthorListResponse,
|
|
296
|
+
)
|
|
297
|
+
|
|
298
|
+
def delete(
|
|
299
|
+
self,
|
|
300
|
+
id: str,
|
|
301
|
+
*,
|
|
302
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
303
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
304
|
+
extra_headers: Headers | None = None,
|
|
305
|
+
extra_query: Query | None = None,
|
|
306
|
+
extra_body: Body | None = None,
|
|
307
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
308
|
+
) -> AuthorDeleteResponse:
|
|
309
|
+
"""
|
|
310
|
+
Delete a specific author
|
|
311
|
+
|
|
312
|
+
Args:
|
|
313
|
+
extra_headers: Send extra headers
|
|
314
|
+
|
|
315
|
+
extra_query: Add additional query parameters to the request
|
|
316
|
+
|
|
317
|
+
extra_body: Add additional JSON properties to the request
|
|
318
|
+
|
|
319
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
320
|
+
"""
|
|
321
|
+
if not id:
|
|
322
|
+
raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
|
|
323
|
+
return self._delete(
|
|
324
|
+
f"/authors/{id}",
|
|
325
|
+
options=make_request_options(
|
|
326
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
327
|
+
),
|
|
328
|
+
cast_to=AuthorDeleteResponse,
|
|
329
|
+
)
|
|
330
|
+
|
|
331
|
+
|
|
332
|
+
class AsyncAuthorsResource(AsyncAPIResource):
|
|
333
|
+
@cached_property
|
|
334
|
+
def with_raw_response(self) -> AsyncAuthorsResourceWithRawResponse:
|
|
335
|
+
"""
|
|
336
|
+
This property can be used as a prefix for any HTTP method call to return
|
|
337
|
+
the raw response object instead of the parsed content.
|
|
338
|
+
|
|
339
|
+
For more information, see https://www.github.com/moderation-api/sdk-python#accessing-raw-response-data-eg-headers
|
|
340
|
+
"""
|
|
341
|
+
return AsyncAuthorsResourceWithRawResponse(self)
|
|
342
|
+
|
|
343
|
+
@cached_property
|
|
344
|
+
def with_streaming_response(self) -> AsyncAuthorsResourceWithStreamingResponse:
|
|
345
|
+
"""
|
|
346
|
+
An alternative to `.with_raw_response` that doesn't eagerly read the response body.
|
|
347
|
+
|
|
348
|
+
For more information, see https://www.github.com/moderation-api/sdk-python#with_streaming_response
|
|
349
|
+
"""
|
|
350
|
+
return AsyncAuthorsResourceWithStreamingResponse(self)
|
|
351
|
+
|
|
352
|
+
async def create(
|
|
353
|
+
self,
|
|
354
|
+
*,
|
|
355
|
+
external_id: str,
|
|
356
|
+
email: Optional[str] | Omit = omit,
|
|
357
|
+
external_link: Optional[str] | Omit = omit,
|
|
358
|
+
first_seen: float | Omit = omit,
|
|
359
|
+
last_seen: float | Omit = omit,
|
|
360
|
+
manual_trust_level: Optional[float] | Omit = omit,
|
|
361
|
+
metadata: author_create_params.Metadata | Omit = omit,
|
|
362
|
+
name: Optional[str] | Omit = omit,
|
|
363
|
+
profile_picture: Optional[str] | Omit = omit,
|
|
364
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
365
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
366
|
+
extra_headers: Headers | None = None,
|
|
367
|
+
extra_query: Query | None = None,
|
|
368
|
+
extra_body: Body | None = None,
|
|
369
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
370
|
+
) -> AuthorCreateResponse:
|
|
371
|
+
"""Create a new author.
|
|
372
|
+
|
|
373
|
+
Typically not needed as authors are created automatically
|
|
374
|
+
when content is moderated.
|
|
375
|
+
|
|
376
|
+
Args:
|
|
377
|
+
external_id: External ID of the user, typically the ID of the author in your database.
|
|
378
|
+
|
|
379
|
+
email: Author email address
|
|
380
|
+
|
|
381
|
+
external_link: URL of the author's external profile
|
|
382
|
+
|
|
383
|
+
first_seen: Timestamp when author first appeared
|
|
384
|
+
|
|
385
|
+
last_seen: Timestamp of last activity
|
|
386
|
+
|
|
387
|
+
metadata: Additional metadata provided by your system. We recommend including any relevant
|
|
388
|
+
information that may assist in the moderation process.
|
|
389
|
+
|
|
390
|
+
name: Author name or identifier
|
|
391
|
+
|
|
392
|
+
profile_picture: URL of the author's profile picture
|
|
393
|
+
|
|
394
|
+
extra_headers: Send extra headers
|
|
395
|
+
|
|
396
|
+
extra_query: Add additional query parameters to the request
|
|
397
|
+
|
|
398
|
+
extra_body: Add additional JSON properties to the request
|
|
399
|
+
|
|
400
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
401
|
+
"""
|
|
402
|
+
return await self._post(
|
|
403
|
+
"/authors",
|
|
404
|
+
body=await async_maybe_transform(
|
|
405
|
+
{
|
|
406
|
+
"external_id": external_id,
|
|
407
|
+
"email": email,
|
|
408
|
+
"external_link": external_link,
|
|
409
|
+
"first_seen": first_seen,
|
|
410
|
+
"last_seen": last_seen,
|
|
411
|
+
"manual_trust_level": manual_trust_level,
|
|
412
|
+
"metadata": metadata,
|
|
413
|
+
"name": name,
|
|
414
|
+
"profile_picture": profile_picture,
|
|
415
|
+
},
|
|
416
|
+
author_create_params.AuthorCreateParams,
|
|
417
|
+
),
|
|
418
|
+
options=make_request_options(
|
|
419
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
420
|
+
),
|
|
421
|
+
cast_to=AuthorCreateResponse,
|
|
422
|
+
)
|
|
423
|
+
|
|
424
|
+
async def retrieve(
|
|
425
|
+
self,
|
|
426
|
+
id: str,
|
|
427
|
+
*,
|
|
428
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
429
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
430
|
+
extra_headers: Headers | None = None,
|
|
431
|
+
extra_query: Query | None = None,
|
|
432
|
+
extra_body: Body | None = None,
|
|
433
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
434
|
+
) -> AuthorRetrieveResponse:
|
|
435
|
+
"""
|
|
436
|
+
Get detailed information about a specific author including historical data and
|
|
437
|
+
analysis
|
|
438
|
+
|
|
439
|
+
Args:
|
|
440
|
+
id: Either external ID or the ID assigned by moderation API.
|
|
441
|
+
|
|
442
|
+
extra_headers: Send extra headers
|
|
443
|
+
|
|
444
|
+
extra_query: Add additional query parameters to the request
|
|
445
|
+
|
|
446
|
+
extra_body: Add additional JSON properties to the request
|
|
447
|
+
|
|
448
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
449
|
+
"""
|
|
450
|
+
if not id:
|
|
451
|
+
raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
|
|
452
|
+
return await self._get(
|
|
453
|
+
f"/authors/{id}",
|
|
454
|
+
options=make_request_options(
|
|
455
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
456
|
+
),
|
|
457
|
+
cast_to=AuthorRetrieveResponse,
|
|
458
|
+
)
|
|
459
|
+
|
|
460
|
+
async def update(
|
|
461
|
+
self,
|
|
462
|
+
id: str,
|
|
463
|
+
*,
|
|
464
|
+
email: Optional[str] | Omit = omit,
|
|
465
|
+
external_link: Optional[str] | Omit = omit,
|
|
466
|
+
first_seen: float | Omit = omit,
|
|
467
|
+
last_seen: float | Omit = omit,
|
|
468
|
+
manual_trust_level: Optional[float] | Omit = omit,
|
|
469
|
+
metadata: author_update_params.Metadata | Omit = omit,
|
|
470
|
+
name: Optional[str] | Omit = omit,
|
|
471
|
+
profile_picture: Optional[str] | Omit = omit,
|
|
472
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
473
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
474
|
+
extra_headers: Headers | None = None,
|
|
475
|
+
extra_query: Query | None = None,
|
|
476
|
+
extra_body: Body | None = None,
|
|
477
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
478
|
+
) -> AuthorUpdateResponse:
|
|
479
|
+
"""
|
|
480
|
+
Update the details of a specific author
|
|
481
|
+
|
|
482
|
+
Args:
|
|
483
|
+
id: Either external ID or the ID assigned by moderation API.
|
|
484
|
+
|
|
485
|
+
email: Author email address
|
|
486
|
+
|
|
487
|
+
external_link: URL of the author's external profile
|
|
488
|
+
|
|
489
|
+
first_seen: Timestamp when author first appeared
|
|
490
|
+
|
|
491
|
+
last_seen: Timestamp of last activity
|
|
492
|
+
|
|
493
|
+
metadata: Additional metadata provided by your system. We recommend including any relevant
|
|
494
|
+
information that may assist in the moderation process.
|
|
495
|
+
|
|
496
|
+
name: Author name or identifier
|
|
497
|
+
|
|
498
|
+
profile_picture: URL of the author's profile picture
|
|
499
|
+
|
|
500
|
+
extra_headers: Send extra headers
|
|
501
|
+
|
|
502
|
+
extra_query: Add additional query parameters to the request
|
|
503
|
+
|
|
504
|
+
extra_body: Add additional JSON properties to the request
|
|
505
|
+
|
|
506
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
507
|
+
"""
|
|
508
|
+
if not id:
|
|
509
|
+
raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
|
|
510
|
+
return await self._put(
|
|
511
|
+
f"/authors/{id}",
|
|
512
|
+
body=await async_maybe_transform(
|
|
513
|
+
{
|
|
514
|
+
"email": email,
|
|
515
|
+
"external_link": external_link,
|
|
516
|
+
"first_seen": first_seen,
|
|
517
|
+
"last_seen": last_seen,
|
|
518
|
+
"manual_trust_level": manual_trust_level,
|
|
519
|
+
"metadata": metadata,
|
|
520
|
+
"name": name,
|
|
521
|
+
"profile_picture": profile_picture,
|
|
522
|
+
},
|
|
523
|
+
author_update_params.AuthorUpdateParams,
|
|
524
|
+
),
|
|
525
|
+
options=make_request_options(
|
|
526
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
527
|
+
),
|
|
528
|
+
cast_to=AuthorUpdateResponse,
|
|
529
|
+
)
|
|
530
|
+
|
|
531
|
+
async def list(
|
|
532
|
+
self,
|
|
533
|
+
*,
|
|
534
|
+
content_types: str | Omit = omit,
|
|
535
|
+
last_active_date: str | Omit = omit,
|
|
536
|
+
member_since_date: str | Omit = omit,
|
|
537
|
+
page_number: float | Omit = omit,
|
|
538
|
+
page_size: float | Omit = omit,
|
|
539
|
+
sort_by: Literal[
|
|
540
|
+
"trustLevel",
|
|
541
|
+
"violationCount",
|
|
542
|
+
"reportCount",
|
|
543
|
+
"memberSince",
|
|
544
|
+
"lastActive",
|
|
545
|
+
"contentCount",
|
|
546
|
+
"flaggedContentRatio",
|
|
547
|
+
"averageSentiment",
|
|
548
|
+
]
|
|
549
|
+
| Omit = omit,
|
|
550
|
+
sort_direction: Literal["asc", "desc"] | Omit = omit,
|
|
551
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
552
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
553
|
+
extra_headers: Headers | None = None,
|
|
554
|
+
extra_query: Query | None = None,
|
|
555
|
+
extra_body: Body | None = None,
|
|
556
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
557
|
+
) -> AuthorListResponse:
|
|
558
|
+
"""
|
|
559
|
+
Get a paginated list of authors with their activity metrics and reputation
|
|
560
|
+
|
|
561
|
+
Args:
|
|
562
|
+
page_number: Page number to fetch
|
|
563
|
+
|
|
564
|
+
page_size: Number of authors per page
|
|
565
|
+
|
|
566
|
+
sort_direction: Sort direction
|
|
567
|
+
|
|
568
|
+
extra_headers: Send extra headers
|
|
569
|
+
|
|
570
|
+
extra_query: Add additional query parameters to the request
|
|
571
|
+
|
|
572
|
+
extra_body: Add additional JSON properties to the request
|
|
573
|
+
|
|
574
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
575
|
+
"""
|
|
576
|
+
return await self._get(
|
|
577
|
+
"/authors",
|
|
578
|
+
options=make_request_options(
|
|
579
|
+
extra_headers=extra_headers,
|
|
580
|
+
extra_query=extra_query,
|
|
581
|
+
extra_body=extra_body,
|
|
582
|
+
timeout=timeout,
|
|
583
|
+
query=await async_maybe_transform(
|
|
584
|
+
{
|
|
585
|
+
"content_types": content_types,
|
|
586
|
+
"last_active_date": last_active_date,
|
|
587
|
+
"member_since_date": member_since_date,
|
|
588
|
+
"page_number": page_number,
|
|
589
|
+
"page_size": page_size,
|
|
590
|
+
"sort_by": sort_by,
|
|
591
|
+
"sort_direction": sort_direction,
|
|
592
|
+
},
|
|
593
|
+
author_list_params.AuthorListParams,
|
|
594
|
+
),
|
|
595
|
+
),
|
|
596
|
+
cast_to=AuthorListResponse,
|
|
597
|
+
)
|
|
598
|
+
|
|
599
|
+
async def delete(
|
|
600
|
+
self,
|
|
601
|
+
id: str,
|
|
602
|
+
*,
|
|
603
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
604
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
605
|
+
extra_headers: Headers | None = None,
|
|
606
|
+
extra_query: Query | None = None,
|
|
607
|
+
extra_body: Body | None = None,
|
|
608
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
609
|
+
) -> AuthorDeleteResponse:
|
|
610
|
+
"""
|
|
611
|
+
Delete a specific author
|
|
612
|
+
|
|
613
|
+
Args:
|
|
614
|
+
extra_headers: Send extra headers
|
|
615
|
+
|
|
616
|
+
extra_query: Add additional query parameters to the request
|
|
617
|
+
|
|
618
|
+
extra_body: Add additional JSON properties to the request
|
|
619
|
+
|
|
620
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
621
|
+
"""
|
|
622
|
+
if not id:
|
|
623
|
+
raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
|
|
624
|
+
return await self._delete(
|
|
625
|
+
f"/authors/{id}",
|
|
626
|
+
options=make_request_options(
|
|
627
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
628
|
+
),
|
|
629
|
+
cast_to=AuthorDeleteResponse,
|
|
630
|
+
)
|
|
631
|
+
|
|
632
|
+
|
|
633
|
+
class AuthorsResourceWithRawResponse:
|
|
634
|
+
def __init__(self, authors: AuthorsResource) -> None:
|
|
635
|
+
self._authors = authors
|
|
636
|
+
|
|
637
|
+
self.create = to_raw_response_wrapper(
|
|
638
|
+
authors.create,
|
|
639
|
+
)
|
|
640
|
+
self.retrieve = to_raw_response_wrapper(
|
|
641
|
+
authors.retrieve,
|
|
642
|
+
)
|
|
643
|
+
self.update = to_raw_response_wrapper(
|
|
644
|
+
authors.update,
|
|
645
|
+
)
|
|
646
|
+
self.list = to_raw_response_wrapper(
|
|
647
|
+
authors.list,
|
|
648
|
+
)
|
|
649
|
+
self.delete = to_raw_response_wrapper(
|
|
650
|
+
authors.delete,
|
|
651
|
+
)
|
|
652
|
+
|
|
653
|
+
|
|
654
|
+
class AsyncAuthorsResourceWithRawResponse:
|
|
655
|
+
def __init__(self, authors: AsyncAuthorsResource) -> None:
|
|
656
|
+
self._authors = authors
|
|
657
|
+
|
|
658
|
+
self.create = async_to_raw_response_wrapper(
|
|
659
|
+
authors.create,
|
|
660
|
+
)
|
|
661
|
+
self.retrieve = async_to_raw_response_wrapper(
|
|
662
|
+
authors.retrieve,
|
|
663
|
+
)
|
|
664
|
+
self.update = async_to_raw_response_wrapper(
|
|
665
|
+
authors.update,
|
|
666
|
+
)
|
|
667
|
+
self.list = async_to_raw_response_wrapper(
|
|
668
|
+
authors.list,
|
|
669
|
+
)
|
|
670
|
+
self.delete = async_to_raw_response_wrapper(
|
|
671
|
+
authors.delete,
|
|
672
|
+
)
|
|
673
|
+
|
|
674
|
+
|
|
675
|
+
class AuthorsResourceWithStreamingResponse:
|
|
676
|
+
def __init__(self, authors: AuthorsResource) -> None:
|
|
677
|
+
self._authors = authors
|
|
678
|
+
|
|
679
|
+
self.create = to_streamed_response_wrapper(
|
|
680
|
+
authors.create,
|
|
681
|
+
)
|
|
682
|
+
self.retrieve = to_streamed_response_wrapper(
|
|
683
|
+
authors.retrieve,
|
|
684
|
+
)
|
|
685
|
+
self.update = to_streamed_response_wrapper(
|
|
686
|
+
authors.update,
|
|
687
|
+
)
|
|
688
|
+
self.list = to_streamed_response_wrapper(
|
|
689
|
+
authors.list,
|
|
690
|
+
)
|
|
691
|
+
self.delete = to_streamed_response_wrapper(
|
|
692
|
+
authors.delete,
|
|
693
|
+
)
|
|
694
|
+
|
|
695
|
+
|
|
696
|
+
class AsyncAuthorsResourceWithStreamingResponse:
|
|
697
|
+
def __init__(self, authors: AsyncAuthorsResource) -> None:
|
|
698
|
+
self._authors = authors
|
|
699
|
+
|
|
700
|
+
self.create = async_to_streamed_response_wrapper(
|
|
701
|
+
authors.create,
|
|
702
|
+
)
|
|
703
|
+
self.retrieve = async_to_streamed_response_wrapper(
|
|
704
|
+
authors.retrieve,
|
|
705
|
+
)
|
|
706
|
+
self.update = async_to_streamed_response_wrapper(
|
|
707
|
+
authors.update,
|
|
708
|
+
)
|
|
709
|
+
self.list = async_to_streamed_response_wrapper(
|
|
710
|
+
authors.list,
|
|
711
|
+
)
|
|
712
|
+
self.delete = async_to_streamed_response_wrapper(
|
|
713
|
+
authors.delete,
|
|
714
|
+
)
|