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.
Files changed (93) hide show
  1. moderation_api/__init__.py +102 -0
  2. moderation_api/_base_client.py +1995 -0
  3. moderation_api/_client.py +454 -0
  4. moderation_api/_compat.py +219 -0
  5. moderation_api/_constants.py +14 -0
  6. moderation_api/_exceptions.py +108 -0
  7. moderation_api/_files.py +123 -0
  8. moderation_api/_models.py +857 -0
  9. moderation_api/_qs.py +150 -0
  10. moderation_api/_resource.py +43 -0
  11. moderation_api/_response.py +832 -0
  12. moderation_api/_streaming.py +333 -0
  13. moderation_api/_types.py +260 -0
  14. moderation_api/_utils/__init__.py +64 -0
  15. moderation_api/_utils/_compat.py +45 -0
  16. moderation_api/_utils/_datetime_parse.py +136 -0
  17. moderation_api/_utils/_logs.py +25 -0
  18. moderation_api/_utils/_proxy.py +65 -0
  19. moderation_api/_utils/_reflection.py +42 -0
  20. moderation_api/_utils/_resources_proxy.py +24 -0
  21. moderation_api/_utils/_streams.py +12 -0
  22. moderation_api/_utils/_sync.py +58 -0
  23. moderation_api/_utils/_transform.py +457 -0
  24. moderation_api/_utils/_typing.py +156 -0
  25. moderation_api/_utils/_utils.py +421 -0
  26. moderation_api/_version.py +4 -0
  27. moderation_api/lib/.keep +4 -0
  28. moderation_api/py.typed +0 -0
  29. moderation_api/resources/__init__.py +103 -0
  30. moderation_api/resources/account.py +135 -0
  31. moderation_api/resources/actions/__init__.py +33 -0
  32. moderation_api/resources/actions/actions.py +810 -0
  33. moderation_api/resources/actions/execute.py +354 -0
  34. moderation_api/resources/auth.py +204 -0
  35. moderation_api/resources/authors.py +714 -0
  36. moderation_api/resources/content.py +244 -0
  37. moderation_api/resources/queue/__init__.py +33 -0
  38. moderation_api/resources/queue/items.py +445 -0
  39. moderation_api/resources/queue/queue.py +302 -0
  40. moderation_api/resources/wordlist/__init__.py +33 -0
  41. moderation_api/resources/wordlist/wordlist.py +470 -0
  42. moderation_api/resources/wordlist/words.py +274 -0
  43. moderation_api/types/__init__.py +35 -0
  44. moderation_api/types/account_list_response.py +31 -0
  45. moderation_api/types/action_create_params.py +94 -0
  46. moderation_api/types/action_create_response.py +82 -0
  47. moderation_api/types/action_delete_response.py +13 -0
  48. moderation_api/types/action_list_params.py +13 -0
  49. moderation_api/types/action_list_response.py +113 -0
  50. moderation_api/types/action_retrieve_response.py +105 -0
  51. moderation_api/types/action_update_params.py +94 -0
  52. moderation_api/types/action_update_response.py +82 -0
  53. moderation_api/types/actions/__init__.py +8 -0
  54. moderation_api/types/actions/execute_execute_by_id_params.py +24 -0
  55. moderation_api/types/actions/execute_execute_by_id_response.py +20 -0
  56. moderation_api/types/actions/execute_execute_params.py +30 -0
  57. moderation_api/types/actions/execute_execute_response.py +10 -0
  58. moderation_api/types/auth_create_response.py +16 -0
  59. moderation_api/types/auth_retrieve_response.py +13 -0
  60. moderation_api/types/author_create_params.py +57 -0
  61. moderation_api/types/author_create_response.py +120 -0
  62. moderation_api/types/author_delete_response.py +9 -0
  63. moderation_api/types/author_list_params.py +40 -0
  64. moderation_api/types/author_list_response.py +147 -0
  65. moderation_api/types/author_retrieve_response.py +120 -0
  66. moderation_api/types/author_update_params.py +54 -0
  67. moderation_api/types/author_update_response.py +120 -0
  68. moderation_api/types/content_submit_params.py +352 -0
  69. moderation_api/types/content_submit_response.py +269 -0
  70. moderation_api/types/queue/__init__.py +10 -0
  71. moderation_api/types/queue/item_list_params.py +36 -0
  72. moderation_api/types/queue/item_list_response.py +90 -0
  73. moderation_api/types/queue/item_resolve_params.py +15 -0
  74. moderation_api/types/queue/item_resolve_response.py +19 -0
  75. moderation_api/types/queue/item_unresolve_params.py +15 -0
  76. moderation_api/types/queue/item_unresolve_response.py +17 -0
  77. moderation_api/types/queue_get_stats_params.py +14 -0
  78. moderation_api/types/queue_get_stats_response.py +110 -0
  79. moderation_api/types/queue_retrieve_response.py +64 -0
  80. moderation_api/types/wordlist/__init__.py +8 -0
  81. moderation_api/types/wordlist/word_add_params.py +14 -0
  82. moderation_api/types/wordlist/word_add_response.py +20 -0
  83. moderation_api/types/wordlist/word_remove_params.py +14 -0
  84. moderation_api/types/wordlist/word_remove_response.py +20 -0
  85. moderation_api/types/wordlist_get_embedding_status_response.py +18 -0
  86. moderation_api/types/wordlist_list_response.py +30 -0
  87. moderation_api/types/wordlist_retrieve_response.py +32 -0
  88. moderation_api/types/wordlist_update_params.py +29 -0
  89. moderation_api/types/wordlist_update_response.py +32 -0
  90. moderation_api-1.0.0.dist-info/METADATA +458 -0
  91. moderation_api-1.0.0.dist-info/RECORD +93 -0
  92. moderation_api-1.0.0.dist-info/WHEEL +4 -0
  93. moderation_api-1.0.0.dist-info/licenses/LICENSE +201 -0
@@ -0,0 +1,147 @@
1
+ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ from typing import TYPE_CHECKING, Dict, List, Optional
4
+ from typing_extensions import Literal
5
+
6
+ from pydantic import Field as FieldInfo
7
+
8
+ from .._models import BaseModel
9
+
10
+ __all__ = [
11
+ "AuthorListResponse",
12
+ "Author",
13
+ "AuthorBlock",
14
+ "AuthorMetadata",
15
+ "AuthorMetrics",
16
+ "AuthorRiskEvaluation",
17
+ "AuthorTrustLevel",
18
+ "Pagination",
19
+ ]
20
+
21
+
22
+ class AuthorBlock(BaseModel):
23
+ reason: Optional[str] = None
24
+ """The moderators reason why the author was blocked or suspended."""
25
+
26
+ until: Optional[float] = None
27
+ """The timestamp until which they are blocked if the author is suspended."""
28
+
29
+
30
+ class AuthorMetadata(BaseModel):
31
+ email_verified: Optional[bool] = None
32
+ """Whether the author's email is verified"""
33
+
34
+ identity_verified: Optional[bool] = None
35
+ """Whether the author's identity is verified"""
36
+
37
+ is_paying_customer: Optional[bool] = None
38
+ """Whether the author is a paying customer"""
39
+
40
+ phone_verified: Optional[bool] = None
41
+ """Whether the author's phone number is verified"""
42
+
43
+ if TYPE_CHECKING:
44
+ # Some versions of Pydantic <2.8.0 have a bug and don’t allow assigning a
45
+ # value to this field, so for compatibility we avoid doing it at runtime.
46
+ __pydantic_extra__: Dict[str, object] = FieldInfo(init=False) # pyright: ignore[reportIncompatibleVariableOverride]
47
+
48
+ # Stub to indicate that arbitrary properties are accepted.
49
+ # To access properties that are not valid identifiers you can use `getattr`, e.g.
50
+ # `getattr(obj, '$type')`
51
+ def __getattr__(self, attr: str) -> object: ...
52
+ else:
53
+ __pydantic_extra__: Dict[str, object]
54
+
55
+
56
+ class AuthorMetrics(BaseModel):
57
+ flagged_content: float
58
+ """Number of flagged content pieces"""
59
+
60
+ total_content: float
61
+ """Total pieces of content"""
62
+
63
+ average_sentiment: Optional[float] = None
64
+ """Average sentiment score of content (-1 to 1).
65
+
66
+ Requires a sentiment model in your project.
67
+ """
68
+
69
+
70
+ class AuthorRiskEvaluation(BaseModel):
71
+ risk_level: Optional[float] = None
72
+ """Calculated risk level based on more than 10 behavioral signals."""
73
+
74
+
75
+ class AuthorTrustLevel(BaseModel):
76
+ level: float
77
+ """Author trust level (-1, 0, 1, 2, 3, or 4)"""
78
+
79
+ manual: bool
80
+ """True if the trust level was set manually by a moderator"""
81
+
82
+
83
+ class Author(BaseModel):
84
+ id: str
85
+ """Author ID in Moderation API"""
86
+
87
+ block: Optional[AuthorBlock] = None
88
+ """Block or suspension details, if applicable. Null if the author is enabled."""
89
+
90
+ first_seen: float
91
+ """Timestamp when author first appeared"""
92
+
93
+ last_seen: float
94
+ """Timestamp of last activity"""
95
+
96
+ metadata: AuthorMetadata
97
+ """Additional metadata provided by your system.
98
+
99
+ We recommend including any relevant information that may assist in the
100
+ moderation process.
101
+ """
102
+
103
+ metrics: AuthorMetrics
104
+
105
+ risk_evaluation: Optional[AuthorRiskEvaluation] = None
106
+ """Risk assessment details, if available."""
107
+
108
+ status: Literal["enabled", "suspended", "blocked"]
109
+ """Current author status"""
110
+
111
+ trust_level: AuthorTrustLevel
112
+
113
+ email: Optional[str] = None
114
+ """Author email address"""
115
+
116
+ external_id: Optional[str] = None
117
+ """The author's ID from your system"""
118
+
119
+ external_link: Optional[str] = None
120
+ """URL of the author's external profile"""
121
+
122
+ last_incident: Optional[float] = None
123
+ """Timestamp of last incident"""
124
+
125
+ name: Optional[str] = None
126
+ """Author name or identifier"""
127
+
128
+ profile_picture: Optional[str] = None
129
+ """URL of the author's profile picture"""
130
+
131
+
132
+ class Pagination(BaseModel):
133
+ has_next_page: bool = FieldInfo(alias="hasNextPage")
134
+
135
+ has_previous_page: bool = FieldInfo(alias="hasPreviousPage")
136
+
137
+ page_number: float = FieldInfo(alias="pageNumber")
138
+
139
+ page_size: float = FieldInfo(alias="pageSize")
140
+
141
+ total: float
142
+
143
+
144
+ class AuthorListResponse(BaseModel):
145
+ authors: List[Author]
146
+
147
+ pagination: Pagination
@@ -0,0 +1,120 @@
1
+ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ from typing import TYPE_CHECKING, Dict, Optional
4
+ from typing_extensions import Literal
5
+
6
+ from pydantic import Field as FieldInfo
7
+
8
+ from .._models import BaseModel
9
+
10
+ __all__ = ["AuthorRetrieveResponse", "Block", "Metadata", "Metrics", "RiskEvaluation", "TrustLevel"]
11
+
12
+
13
+ class Block(BaseModel):
14
+ reason: Optional[str] = None
15
+ """The moderators reason why the author was blocked or suspended."""
16
+
17
+ until: Optional[float] = None
18
+ """The timestamp until which they are blocked if the author is suspended."""
19
+
20
+
21
+ class Metadata(BaseModel):
22
+ email_verified: Optional[bool] = None
23
+ """Whether the author's email is verified"""
24
+
25
+ identity_verified: Optional[bool] = None
26
+ """Whether the author's identity is verified"""
27
+
28
+ is_paying_customer: Optional[bool] = None
29
+ """Whether the author is a paying customer"""
30
+
31
+ phone_verified: Optional[bool] = None
32
+ """Whether the author's phone number is verified"""
33
+
34
+ if TYPE_CHECKING:
35
+ # Some versions of Pydantic <2.8.0 have a bug and don’t allow assigning a
36
+ # value to this field, so for compatibility we avoid doing it at runtime.
37
+ __pydantic_extra__: Dict[str, object] = FieldInfo(init=False) # pyright: ignore[reportIncompatibleVariableOverride]
38
+
39
+ # Stub to indicate that arbitrary properties are accepted.
40
+ # To access properties that are not valid identifiers you can use `getattr`, e.g.
41
+ # `getattr(obj, '$type')`
42
+ def __getattr__(self, attr: str) -> object: ...
43
+ else:
44
+ __pydantic_extra__: Dict[str, object]
45
+
46
+
47
+ class Metrics(BaseModel):
48
+ flagged_content: float
49
+ """Number of flagged content pieces"""
50
+
51
+ total_content: float
52
+ """Total pieces of content"""
53
+
54
+ average_sentiment: Optional[float] = None
55
+ """Average sentiment score of content (-1 to 1).
56
+
57
+ Requires a sentiment model in your project.
58
+ """
59
+
60
+
61
+ class RiskEvaluation(BaseModel):
62
+ risk_level: Optional[float] = None
63
+ """Calculated risk level based on more than 10 behavioral signals."""
64
+
65
+
66
+ class TrustLevel(BaseModel):
67
+ level: float
68
+ """Author trust level (-1, 0, 1, 2, 3, or 4)"""
69
+
70
+ manual: bool
71
+ """True if the trust level was set manually by a moderator"""
72
+
73
+
74
+ class AuthorRetrieveResponse(BaseModel):
75
+ id: str
76
+ """Author ID in Moderation API"""
77
+
78
+ block: Optional[Block] = None
79
+ """Block or suspension details, if applicable. Null if the author is enabled."""
80
+
81
+ first_seen: float
82
+ """Timestamp when author first appeared"""
83
+
84
+ last_seen: float
85
+ """Timestamp of last activity"""
86
+
87
+ metadata: Metadata
88
+ """Additional metadata provided by your system.
89
+
90
+ We recommend including any relevant information that may assist in the
91
+ moderation process.
92
+ """
93
+
94
+ metrics: Metrics
95
+
96
+ risk_evaluation: Optional[RiskEvaluation] = None
97
+ """Risk assessment details, if available."""
98
+
99
+ status: Literal["enabled", "suspended", "blocked"]
100
+ """Current author status"""
101
+
102
+ trust_level: TrustLevel
103
+
104
+ email: Optional[str] = None
105
+ """Author email address"""
106
+
107
+ external_id: Optional[str] = None
108
+ """The author's ID from your system"""
109
+
110
+ external_link: Optional[str] = None
111
+ """URL of the author's external profile"""
112
+
113
+ last_incident: Optional[float] = None
114
+ """Timestamp of last incident"""
115
+
116
+ name: Optional[str] = None
117
+ """Author name or identifier"""
118
+
119
+ profile_picture: Optional[str] = None
120
+ """URL of the author's profile picture"""
@@ -0,0 +1,54 @@
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, Optional
6
+ from typing_extensions import TypeAlias, TypedDict
7
+
8
+ __all__ = ["AuthorUpdateParams", "Metadata"]
9
+
10
+
11
+ class AuthorUpdateParams(TypedDict, total=False):
12
+ email: Optional[str]
13
+ """Author email address"""
14
+
15
+ external_link: Optional[str]
16
+ """URL of the author's external profile"""
17
+
18
+ first_seen: float
19
+ """Timestamp when author first appeared"""
20
+
21
+ last_seen: float
22
+ """Timestamp of last activity"""
23
+
24
+ manual_trust_level: Optional[float]
25
+
26
+ metadata: Metadata
27
+ """Additional metadata provided by your system.
28
+
29
+ We recommend including any relevant information that may assist in the
30
+ moderation process.
31
+ """
32
+
33
+ name: Optional[str]
34
+ """Author name or identifier"""
35
+
36
+ profile_picture: Optional[str]
37
+ """URL of the author's profile picture"""
38
+
39
+
40
+ class MetadataTyped(TypedDict, total=False):
41
+ email_verified: Optional[bool]
42
+ """Whether the author's email is verified"""
43
+
44
+ identity_verified: Optional[bool]
45
+ """Whether the author's identity is verified"""
46
+
47
+ is_paying_customer: Optional[bool]
48
+ """Whether the author is a paying customer"""
49
+
50
+ phone_verified: Optional[bool]
51
+ """Whether the author's phone number is verified"""
52
+
53
+
54
+ Metadata: TypeAlias = Union[MetadataTyped, Dict[str, object]]
@@ -0,0 +1,120 @@
1
+ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ from typing import TYPE_CHECKING, Dict, Optional
4
+ from typing_extensions import Literal
5
+
6
+ from pydantic import Field as FieldInfo
7
+
8
+ from .._models import BaseModel
9
+
10
+ __all__ = ["AuthorUpdateResponse", "Block", "Metadata", "Metrics", "RiskEvaluation", "TrustLevel"]
11
+
12
+
13
+ class Block(BaseModel):
14
+ reason: Optional[str] = None
15
+ """The moderators reason why the author was blocked or suspended."""
16
+
17
+ until: Optional[float] = None
18
+ """The timestamp until which they are blocked if the author is suspended."""
19
+
20
+
21
+ class Metadata(BaseModel):
22
+ email_verified: Optional[bool] = None
23
+ """Whether the author's email is verified"""
24
+
25
+ identity_verified: Optional[bool] = None
26
+ """Whether the author's identity is verified"""
27
+
28
+ is_paying_customer: Optional[bool] = None
29
+ """Whether the author is a paying customer"""
30
+
31
+ phone_verified: Optional[bool] = None
32
+ """Whether the author's phone number is verified"""
33
+
34
+ if TYPE_CHECKING:
35
+ # Some versions of Pydantic <2.8.0 have a bug and don’t allow assigning a
36
+ # value to this field, so for compatibility we avoid doing it at runtime.
37
+ __pydantic_extra__: Dict[str, object] = FieldInfo(init=False) # pyright: ignore[reportIncompatibleVariableOverride]
38
+
39
+ # Stub to indicate that arbitrary properties are accepted.
40
+ # To access properties that are not valid identifiers you can use `getattr`, e.g.
41
+ # `getattr(obj, '$type')`
42
+ def __getattr__(self, attr: str) -> object: ...
43
+ else:
44
+ __pydantic_extra__: Dict[str, object]
45
+
46
+
47
+ class Metrics(BaseModel):
48
+ flagged_content: float
49
+ """Number of flagged content pieces"""
50
+
51
+ total_content: float
52
+ """Total pieces of content"""
53
+
54
+ average_sentiment: Optional[float] = None
55
+ """Average sentiment score of content (-1 to 1).
56
+
57
+ Requires a sentiment model in your project.
58
+ """
59
+
60
+
61
+ class RiskEvaluation(BaseModel):
62
+ risk_level: Optional[float] = None
63
+ """Calculated risk level based on more than 10 behavioral signals."""
64
+
65
+
66
+ class TrustLevel(BaseModel):
67
+ level: float
68
+ """Author trust level (-1, 0, 1, 2, 3, or 4)"""
69
+
70
+ manual: bool
71
+ """True if the trust level was set manually by a moderator"""
72
+
73
+
74
+ class AuthorUpdateResponse(BaseModel):
75
+ id: str
76
+ """Author ID in Moderation API"""
77
+
78
+ block: Optional[Block] = None
79
+ """Block or suspension details, if applicable. Null if the author is enabled."""
80
+
81
+ first_seen: float
82
+ """Timestamp when author first appeared"""
83
+
84
+ last_seen: float
85
+ """Timestamp of last activity"""
86
+
87
+ metadata: Metadata
88
+ """Additional metadata provided by your system.
89
+
90
+ We recommend including any relevant information that may assist in the
91
+ moderation process.
92
+ """
93
+
94
+ metrics: Metrics
95
+
96
+ risk_evaluation: Optional[RiskEvaluation] = None
97
+ """Risk assessment details, if available."""
98
+
99
+ status: Literal["enabled", "suspended", "blocked"]
100
+ """Current author status"""
101
+
102
+ trust_level: TrustLevel
103
+
104
+ email: Optional[str] = None
105
+ """Author email address"""
106
+
107
+ external_id: Optional[str] = None
108
+ """The author's ID from your system"""
109
+
110
+ external_link: Optional[str] = None
111
+ """URL of the author's external profile"""
112
+
113
+ last_incident: Optional[float] = None
114
+ """Timestamp of last incident"""
115
+
116
+ name: Optional[str] = None
117
+ """Author name or identifier"""
118
+
119
+ profile_picture: Optional[str] = None
120
+ """URL of the author's profile picture"""