moderation_api 2.33.0 → 2.35.0
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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +16 -0
- data/README.md +1 -1
- data/lib/moderation_api/client.rb +15 -0
- data/lib/moderation_api/models/content_stream_params.rb +29 -0
- data/lib/moderation_api/models/content_submit_response.rb +119 -1
- data/lib/moderation_api/models/webhook_create_params.rb +73 -0
- data/lib/moderation_api/models/webhook_create_response.rb +107 -0
- data/lib/moderation_api/models/webhook_delete_params.rb +22 -0
- data/lib/moderation_api/models/webhook_delete_response.rb +25 -0
- data/lib/moderation_api/models/webhook_list_params.rb +14 -0
- data/lib/moderation_api/models/webhook_list_response.rb +110 -0
- data/lib/moderation_api/models/webhook_retrieve_params.rb +22 -0
- data/lib/moderation_api/models/webhook_retrieve_response.rb +107 -0
- data/lib/moderation_api/models/webhook_secret_retrieve_params.rb +14 -0
- data/lib/moderation_api/models/webhook_secret_retrieve_response.rb +22 -0
- data/lib/moderation_api/models/webhook_update_params.rb +81 -0
- data/lib/moderation_api/models/webhook_update_response.rb +107 -0
- data/lib/moderation_api/models.rb +14 -0
- data/lib/moderation_api/resources/content.rb +42 -0
- data/lib/moderation_api/resources/webhook_secret.rb +34 -0
- data/lib/moderation_api/resources/webhooks.rb +139 -0
- data/lib/moderation_api/version.rb +1 -1
- data/lib/moderation_api.rb +15 -0
- data/rbi/moderation_api/client.rbi +11 -0
- data/rbi/moderation_api/models/content_stream_params.rbi +76 -0
- data/rbi/moderation_api/models/content_submit_response.rbi +226 -0
- data/rbi/moderation_api/models/webhook_create_params.rbi +154 -0
- data/rbi/moderation_api/models/webhook_create_response.rbi +225 -0
- data/rbi/moderation_api/models/webhook_delete_params.rbi +43 -0
- data/rbi/moderation_api/models/webhook_delete_response.rbi +36 -0
- data/rbi/moderation_api/models/webhook_list_params.rbi +32 -0
- data/rbi/moderation_api/models/webhook_list_response.rbi +233 -0
- data/rbi/moderation_api/models/webhook_retrieve_params.rbi +43 -0
- data/rbi/moderation_api/models/webhook_retrieve_response.rbi +225 -0
- data/rbi/moderation_api/models/webhook_secret_retrieve_params.rbi +32 -0
- data/rbi/moderation_api/models/webhook_secret_retrieve_response.rbi +34 -0
- data/rbi/moderation_api/models/webhook_update_params.rbi +178 -0
- data/rbi/moderation_api/models/webhook_update_response.rbi +225 -0
- data/rbi/moderation_api/models.rbi +15 -0
- data/rbi/moderation_api/resources/content.rbi +34 -0
- data/rbi/moderation_api/resources/webhook_secret.rbi +23 -0
- data/rbi/moderation_api/resources/webhooks.rbi +105 -0
- data/sig/moderation_api/client.rbs +6 -0
- data/sig/moderation_api/models/content_stream_params.rbs +36 -0
- data/sig/moderation_api/models/content_submit_response.rbs +72 -0
- data/sig/moderation_api/models/webhook_create_params.rbs +72 -0
- data/sig/moderation_api/models/webhook_create_response.rbs +92 -0
- data/sig/moderation_api/models/webhook_delete_params.rbs +23 -0
- data/sig/moderation_api/models/webhook_delete_response.rbs +15 -0
- data/sig/moderation_api/models/webhook_list_params.rbs +15 -0
- data/sig/moderation_api/models/webhook_list_response.rbs +97 -0
- data/sig/moderation_api/models/webhook_retrieve_params.rbs +23 -0
- data/sig/moderation_api/models/webhook_retrieve_response.rbs +92 -0
- data/sig/moderation_api/models/webhook_secret_retrieve_params.rbs +15 -0
- data/sig/moderation_api/models/webhook_secret_retrieve_response.rbs +13 -0
- data/sig/moderation_api/models/webhook_update_params.rbs +85 -0
- data/sig/moderation_api/models/webhook_update_response.rbs +92 -0
- data/sig/moderation_api/models.rbs +14 -0
- data/sig/moderation_api/resources/content.rbs +5 -0
- data/sig/moderation_api/resources/webhook_secret.rbs +11 -0
- data/sig/moderation_api/resources/webhooks.rbs +38 -0
- metadata +47 -2
|
@@ -29,6 +29,8 @@ module ModerationAPI
|
|
|
29
29
|
|
|
30
30
|
AuthRetrieveParams = ModerationAPI::Models::AuthRetrieveParams
|
|
31
31
|
|
|
32
|
+
ContentStreamParams = ModerationAPI::Models::ContentStreamParams
|
|
33
|
+
|
|
32
34
|
ContentSubmitParams = ModerationAPI::Models::ContentSubmitParams
|
|
33
35
|
|
|
34
36
|
Queue = ModerationAPI::Models::Queue
|
|
@@ -37,8 +39,21 @@ module ModerationAPI
|
|
|
37
39
|
|
|
38
40
|
QueueRetrieveParams = ModerationAPI::Models::QueueRetrieveParams
|
|
39
41
|
|
|
42
|
+
WebhookCreateParams = ModerationAPI::Models::WebhookCreateParams
|
|
43
|
+
|
|
44
|
+
WebhookDeleteParams = ModerationAPI::Models::WebhookDeleteParams
|
|
45
|
+
|
|
40
46
|
WebhookEvent = ModerationAPI::Models::WebhookEvent
|
|
41
47
|
|
|
48
|
+
WebhookListParams = ModerationAPI::Models::WebhookListParams
|
|
49
|
+
|
|
50
|
+
WebhookRetrieveParams = ModerationAPI::Models::WebhookRetrieveParams
|
|
51
|
+
|
|
52
|
+
WebhookSecretRetrieveParams =
|
|
53
|
+
ModerationAPI::Models::WebhookSecretRetrieveParams
|
|
54
|
+
|
|
55
|
+
WebhookUpdateParams = ModerationAPI::Models::WebhookUpdateParams
|
|
56
|
+
|
|
42
57
|
Wordlist = ModerationAPI::Models::Wordlist
|
|
43
58
|
|
|
44
59
|
WordlistGetEmbeddingStatusParams =
|
|
@@ -3,6 +3,40 @@
|
|
|
3
3
|
module ModerationAPI
|
|
4
4
|
module Resources
|
|
5
5
|
class Content
|
|
6
|
+
# Open a WebSocket to moderate live voice/call audio in real time. Speech is
|
|
7
|
+
# transcribed and each finalized utterance is moderated by your enabled text
|
|
8
|
+
# policies; you receive a verdict per utterance as it's spoken.
|
|
9
|
+
#
|
|
10
|
+
# **This is a WebSocket upgrade, not a regular HTTP call.** The request body below
|
|
11
|
+
# documents the frames you _send_ over the socket; the `101` response documents
|
|
12
|
+
# the events you _receive_.
|
|
13
|
+
#
|
|
14
|
+
# - **Auth:** `Authorization: Bearer <api_key>` on the upgrade. A missing/invalid
|
|
15
|
+
# key closes `4401`; voice not enabled on the plan/channel closes `4403`.
|
|
16
|
+
# - **Subprotocol:** request `moderationapi.v1`.
|
|
17
|
+
# - **Flow:** send one `start` frame, then `media` frames as audio arrives, then
|
|
18
|
+
# `stop` (or disconnect). You receive `session.started`, `utterance.final` per
|
|
19
|
+
# utterance, optional `utterance.partial`/`warning`, and `session.ended`.
|
|
20
|
+
# - **Close codes:** `1000` normal · `1011` server error · `4400` bad request ·
|
|
21
|
+
# `4401` auth failed · `4403` voice not enabled · `4429` concurrency limit.
|
|
22
|
+
#
|
|
23
|
+
# See the
|
|
24
|
+
# [Real-time voice guide](https://docs.moderationapi.com/content-moderation/real-time-voice)
|
|
25
|
+
# for the full walkthrough and code examples.
|
|
26
|
+
sig do
|
|
27
|
+
params(
|
|
28
|
+
sec_web_socket_protocol:
|
|
29
|
+
ModerationAPI::ContentStreamParams::SecWebSocketProtocol::OrSymbol,
|
|
30
|
+
request_options: ModerationAPI::RequestOptions::OrHash
|
|
31
|
+
).void
|
|
32
|
+
end
|
|
33
|
+
def stream(
|
|
34
|
+
# Requested subprotocol.
|
|
35
|
+
sec_web_socket_protocol:,
|
|
36
|
+
request_options: {}
|
|
37
|
+
)
|
|
38
|
+
end
|
|
39
|
+
|
|
6
40
|
sig do
|
|
7
41
|
params(
|
|
8
42
|
content:
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# typed: strong
|
|
2
|
+
|
|
3
|
+
module ModerationAPI
|
|
4
|
+
module Resources
|
|
5
|
+
class WebhookSecret
|
|
6
|
+
# Get the signing secret used to sign webhook deliveries for this project,
|
|
7
|
+
# creating one if none exists yet. Verify deliveries by comparing the
|
|
8
|
+
# `modapi-signature` header to HMAC-SHA256(raw request body, secret) hex-encoded.
|
|
9
|
+
sig do
|
|
10
|
+
params(request_options: ModerationAPI::RequestOptions::OrHash).returns(
|
|
11
|
+
ModerationAPI::Models::WebhookSecretRetrieveResponse
|
|
12
|
+
)
|
|
13
|
+
end
|
|
14
|
+
def retrieve(request_options: {})
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
# @api private
|
|
18
|
+
sig { params(client: ModerationAPI::Client).returns(T.attached_class) }
|
|
19
|
+
def self.new(client:)
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
end
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
# typed: strong
|
|
2
|
+
|
|
3
|
+
module ModerationAPI
|
|
4
|
+
module Resources
|
|
5
|
+
class Webhooks
|
|
6
|
+
# Create a webhook subscribed to one or more event types. Deliveries use the v2
|
|
7
|
+
# envelope and are signed with the project signing secret (see the signing secret
|
|
8
|
+
# endpoint).
|
|
9
|
+
sig do
|
|
10
|
+
params(
|
|
11
|
+
event_types:
|
|
12
|
+
T::Array[ModerationAPI::WebhookCreateParams::EventType::OrSymbol],
|
|
13
|
+
name: String,
|
|
14
|
+
url: String,
|
|
15
|
+
description: T.nilable(String),
|
|
16
|
+
request_options: ModerationAPI::RequestOptions::OrHash
|
|
17
|
+
).returns(ModerationAPI::Models::WebhookCreateResponse)
|
|
18
|
+
end
|
|
19
|
+
def create(
|
|
20
|
+
# Event types this webhook subscribes to. One webhook URL receives all events you
|
|
21
|
+
# list here.
|
|
22
|
+
event_types:,
|
|
23
|
+
# The webhook's name, used to identify it in the dashboard
|
|
24
|
+
name:,
|
|
25
|
+
# The webhook's URL. We'll call this URL when an event occurs.
|
|
26
|
+
url:,
|
|
27
|
+
# The webhook's description
|
|
28
|
+
description: nil,
|
|
29
|
+
request_options: {}
|
|
30
|
+
)
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
# Get a webhook by ID.
|
|
34
|
+
sig do
|
|
35
|
+
params(
|
|
36
|
+
id: String,
|
|
37
|
+
request_options: ModerationAPI::RequestOptions::OrHash
|
|
38
|
+
).returns(ModerationAPI::Models::WebhookRetrieveResponse)
|
|
39
|
+
end
|
|
40
|
+
def retrieve(
|
|
41
|
+
# The ID of the webhook to get.
|
|
42
|
+
id,
|
|
43
|
+
request_options: {}
|
|
44
|
+
)
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
# Update a webhook. Legacy v1 webhooks are read-only: delete them and create a new
|
|
48
|
+
# webhook instead.
|
|
49
|
+
sig do
|
|
50
|
+
params(
|
|
51
|
+
id: String,
|
|
52
|
+
description: T.nilable(String),
|
|
53
|
+
event_types:
|
|
54
|
+
T::Array[ModerationAPI::WebhookUpdateParams::EventType::OrSymbol],
|
|
55
|
+
name: String,
|
|
56
|
+
url: String,
|
|
57
|
+
request_options: ModerationAPI::RequestOptions::OrHash
|
|
58
|
+
).returns(ModerationAPI::Models::WebhookUpdateResponse)
|
|
59
|
+
end
|
|
60
|
+
def update(
|
|
61
|
+
# The ID of the webhook to update.
|
|
62
|
+
id,
|
|
63
|
+
# The webhook's description
|
|
64
|
+
description: nil,
|
|
65
|
+
# Event types this webhook subscribes to. One webhook URL receives all events you
|
|
66
|
+
# list here.
|
|
67
|
+
event_types: nil,
|
|
68
|
+
# The webhook's name, used to identify it in the dashboard
|
|
69
|
+
name: nil,
|
|
70
|
+
# The webhook's URL. We'll call this URL when an event occurs.
|
|
71
|
+
url: nil,
|
|
72
|
+
request_options: {}
|
|
73
|
+
)
|
|
74
|
+
end
|
|
75
|
+
|
|
76
|
+
# List all webhooks for the authenticated project.
|
|
77
|
+
sig do
|
|
78
|
+
params(request_options: ModerationAPI::RequestOptions::OrHash).returns(
|
|
79
|
+
T::Array[ModerationAPI::Models::WebhookListResponseItem]
|
|
80
|
+
)
|
|
81
|
+
end
|
|
82
|
+
def list(request_options: {})
|
|
83
|
+
end
|
|
84
|
+
|
|
85
|
+
# Delete a webhook.
|
|
86
|
+
sig do
|
|
87
|
+
params(
|
|
88
|
+
id: String,
|
|
89
|
+
request_options: ModerationAPI::RequestOptions::OrHash
|
|
90
|
+
).returns(ModerationAPI::Models::WebhookDeleteResponse)
|
|
91
|
+
end
|
|
92
|
+
def delete(
|
|
93
|
+
# The ID of the webhook to delete.
|
|
94
|
+
id,
|
|
95
|
+
request_options: {}
|
|
96
|
+
)
|
|
97
|
+
end
|
|
98
|
+
|
|
99
|
+
# @api private
|
|
100
|
+
sig { params(client: ModerationAPI::Client).returns(T.attached_class) }
|
|
101
|
+
def self.new(client:)
|
|
102
|
+
end
|
|
103
|
+
end
|
|
104
|
+
end
|
|
105
|
+
end
|
|
@@ -24,8 +24,14 @@ module ModerationAPI
|
|
|
24
24
|
|
|
25
25
|
attr_reader wordlist: ModerationAPI::Resources::Wordlist
|
|
26
26
|
|
|
27
|
+
attr_reader webhooks: ModerationAPI::Resources::Webhooks
|
|
28
|
+
|
|
29
|
+
attr_reader webhook_secret: ModerationAPI::Resources::WebhookSecret
|
|
30
|
+
|
|
27
31
|
private def auth_headers: -> ::Hash[String, String]
|
|
28
32
|
|
|
33
|
+
def base_url_overridden?: -> bool
|
|
34
|
+
|
|
29
35
|
def initialize: (
|
|
30
36
|
?secret_key: String?,
|
|
31
37
|
?base_url: String?,
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
module ModerationAPI
|
|
2
|
+
module Models
|
|
3
|
+
type content_stream_params =
|
|
4
|
+
{
|
|
5
|
+
sec_web_socket_protocol: ModerationAPI::Models::ContentStreamParams::sec_web_socket_protocol
|
|
6
|
+
}
|
|
7
|
+
& ModerationAPI::Internal::Type::request_parameters
|
|
8
|
+
|
|
9
|
+
class ContentStreamParams < ModerationAPI::Internal::Type::BaseModel
|
|
10
|
+
extend ModerationAPI::Internal::Type::RequestParameters::Converter
|
|
11
|
+
include ModerationAPI::Internal::Type::RequestParameters
|
|
12
|
+
|
|
13
|
+
attr_accessor sec_web_socket_protocol: ModerationAPI::Models::ContentStreamParams::sec_web_socket_protocol
|
|
14
|
+
|
|
15
|
+
def initialize: (
|
|
16
|
+
sec_web_socket_protocol: ModerationAPI::Models::ContentStreamParams::sec_web_socket_protocol,
|
|
17
|
+
?request_options: ModerationAPI::request_opts
|
|
18
|
+
) -> void
|
|
19
|
+
|
|
20
|
+
def to_hash: -> {
|
|
21
|
+
sec_web_socket_protocol: ModerationAPI::Models::ContentStreamParams::sec_web_socket_protocol,
|
|
22
|
+
request_options: ModerationAPI::RequestOptions
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
type sec_web_socket_protocol = :"moderationapi.v1"
|
|
26
|
+
|
|
27
|
+
module SecWebSocketProtocol
|
|
28
|
+
extend ModerationAPI::Internal::Type::Enum
|
|
29
|
+
|
|
30
|
+
MODERATIONAPI_V1: :"moderationapi.v1"
|
|
31
|
+
|
|
32
|
+
def self?.values: -> ::Array[ModerationAPI::Models::ContentStreamParams::sec_web_socket_protocol]
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
end
|
|
36
|
+
end
|
|
@@ -3,6 +3,7 @@ module ModerationAPI
|
|
|
3
3
|
type content_submit_response =
|
|
4
4
|
{
|
|
5
5
|
author: ModerationAPI::Models::ContentSubmitResponse::Author?,
|
|
6
|
+
casebook: ModerationAPI::Models::ContentSubmitResponse::Casebook?,
|
|
6
7
|
content: ModerationAPI::Models::ContentSubmitResponse::Content,
|
|
7
8
|
evaluation: ModerationAPI::Models::ContentSubmitResponse::Evaluation,
|
|
8
9
|
insights: ::Array[ModerationAPI::Models::ContentSubmitResponse::insight],
|
|
@@ -15,6 +16,8 @@ module ModerationAPI
|
|
|
15
16
|
class ContentSubmitResponse < ModerationAPI::Internal::Type::BaseModel
|
|
16
17
|
attr_accessor author: ModerationAPI::Models::ContentSubmitResponse::Author?
|
|
17
18
|
|
|
19
|
+
attr_accessor casebook: ModerationAPI::Models::ContentSubmitResponse::Casebook?
|
|
20
|
+
|
|
18
21
|
attr_accessor content: ModerationAPI::Models::ContentSubmitResponse::Content
|
|
19
22
|
|
|
20
23
|
attr_accessor evaluation: ModerationAPI::Models::ContentSubmitResponse::Evaluation
|
|
@@ -35,6 +38,7 @@ module ModerationAPI
|
|
|
35
38
|
|
|
36
39
|
def initialize: (
|
|
37
40
|
author: ModerationAPI::Models::ContentSubmitResponse::Author?,
|
|
41
|
+
casebook: ModerationAPI::Models::ContentSubmitResponse::Casebook?,
|
|
38
42
|
content: ModerationAPI::Models::ContentSubmitResponse::Content,
|
|
39
43
|
evaluation: ModerationAPI::Models::ContentSubmitResponse::Evaluation,
|
|
40
44
|
insights: ::Array[ModerationAPI::Models::ContentSubmitResponse::insight],
|
|
@@ -46,6 +50,7 @@ module ModerationAPI
|
|
|
46
50
|
|
|
47
51
|
def to_hash: -> {
|
|
48
52
|
author: ModerationAPI::Models::ContentSubmitResponse::Author?,
|
|
53
|
+
casebook: ModerationAPI::Models::ContentSubmitResponse::Casebook?,
|
|
49
54
|
content: ModerationAPI::Models::ContentSubmitResponse::Content,
|
|
50
55
|
evaluation: ModerationAPI::Models::ContentSubmitResponse::Evaluation,
|
|
51
56
|
insights: ::Array[ModerationAPI::Models::ContentSubmitResponse::insight],
|
|
@@ -128,6 +133,71 @@ module ModerationAPI
|
|
|
128
133
|
end
|
|
129
134
|
end
|
|
130
135
|
|
|
136
|
+
type casebook =
|
|
137
|
+
{
|
|
138
|
+
agreement: Float,
|
|
139
|
+
case_count: Float,
|
|
140
|
+
confidence: Float,
|
|
141
|
+
similarity: Float,
|
|
142
|
+
topic: ModerationAPI::Models::ContentSubmitResponse::Casebook::Topic?,
|
|
143
|
+
verdict: ModerationAPI::Models::ContentSubmitResponse::Casebook::verdict
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
class Casebook < ModerationAPI::Internal::Type::BaseModel
|
|
147
|
+
attr_accessor agreement: Float
|
|
148
|
+
|
|
149
|
+
attr_accessor case_count: Float
|
|
150
|
+
|
|
151
|
+
attr_accessor confidence: Float
|
|
152
|
+
|
|
153
|
+
attr_accessor similarity: Float
|
|
154
|
+
|
|
155
|
+
attr_accessor topic: ModerationAPI::Models::ContentSubmitResponse::Casebook::Topic?
|
|
156
|
+
|
|
157
|
+
attr_accessor verdict: ModerationAPI::Models::ContentSubmitResponse::Casebook::verdict
|
|
158
|
+
|
|
159
|
+
def initialize: (
|
|
160
|
+
agreement: Float,
|
|
161
|
+
case_count: Float,
|
|
162
|
+
confidence: Float,
|
|
163
|
+
similarity: Float,
|
|
164
|
+
topic: ModerationAPI::Models::ContentSubmitResponse::Casebook::Topic?,
|
|
165
|
+
verdict: ModerationAPI::Models::ContentSubmitResponse::Casebook::verdict
|
|
166
|
+
) -> void
|
|
167
|
+
|
|
168
|
+
def to_hash: -> {
|
|
169
|
+
agreement: Float,
|
|
170
|
+
case_count: Float,
|
|
171
|
+
confidence: Float,
|
|
172
|
+
similarity: Float,
|
|
173
|
+
topic: ModerationAPI::Models::ContentSubmitResponse::Casebook::Topic?,
|
|
174
|
+
verdict: ModerationAPI::Models::ContentSubmitResponse::Casebook::verdict
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
type topic = { id: String, label: String }
|
|
178
|
+
|
|
179
|
+
class Topic < ModerationAPI::Internal::Type::BaseModel
|
|
180
|
+
attr_accessor id: String
|
|
181
|
+
|
|
182
|
+
attr_accessor label: String
|
|
183
|
+
|
|
184
|
+
def initialize: (id: String, label: String) -> void
|
|
185
|
+
|
|
186
|
+
def to_hash: -> { id: String, label: String }
|
|
187
|
+
end
|
|
188
|
+
|
|
189
|
+
type verdict = :allow | :reject
|
|
190
|
+
|
|
191
|
+
module Verdict
|
|
192
|
+
extend ModerationAPI::Internal::Type::Enum
|
|
193
|
+
|
|
194
|
+
ALLOW: :allow
|
|
195
|
+
REJECT: :reject
|
|
196
|
+
|
|
197
|
+
def self?.values: -> ::Array[ModerationAPI::Models::ContentSubmitResponse::Casebook::verdict]
|
|
198
|
+
end
|
|
199
|
+
end
|
|
200
|
+
|
|
131
201
|
type content =
|
|
132
202
|
{
|
|
133
203
|
id: String,
|
|
@@ -758,6 +828,7 @@ module ModerationAPI
|
|
|
758
828
|
| :rule_default
|
|
759
829
|
| :rule_fallback
|
|
760
830
|
| :client_override
|
|
831
|
+
| :casebook_match
|
|
761
832
|
| String
|
|
762
833
|
|
|
763
834
|
module ReasonCode
|
|
@@ -775,6 +846,7 @@ module ModerationAPI
|
|
|
775
846
|
RULE_DEFAULT: :rule_default
|
|
776
847
|
RULE_FALLBACK: :rule_fallback
|
|
777
848
|
CLIENT_OVERRIDE: :client_override
|
|
849
|
+
CASEBOOK_MATCH: :casebook_match
|
|
778
850
|
end
|
|
779
851
|
|
|
780
852
|
type matched_rule = { key: String, name: String }
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
module ModerationAPI
|
|
2
|
+
module Models
|
|
3
|
+
type webhook_create_params =
|
|
4
|
+
{
|
|
5
|
+
event_types: ::Array[ModerationAPI::Models::WebhookCreateParams::event_type],
|
|
6
|
+
name: String,
|
|
7
|
+
url: String,
|
|
8
|
+
description: String?
|
|
9
|
+
}
|
|
10
|
+
& ModerationAPI::Internal::Type::request_parameters
|
|
11
|
+
|
|
12
|
+
class WebhookCreateParams < ModerationAPI::Internal::Type::BaseModel
|
|
13
|
+
extend ModerationAPI::Internal::Type::RequestParameters::Converter
|
|
14
|
+
include ModerationAPI::Internal::Type::RequestParameters
|
|
15
|
+
|
|
16
|
+
attr_accessor event_types: ::Array[ModerationAPI::Models::WebhookCreateParams::event_type]
|
|
17
|
+
|
|
18
|
+
attr_accessor name: String
|
|
19
|
+
|
|
20
|
+
attr_accessor url: String
|
|
21
|
+
|
|
22
|
+
attr_accessor description: String?
|
|
23
|
+
|
|
24
|
+
def initialize: (
|
|
25
|
+
event_types: ::Array[ModerationAPI::Models::WebhookCreateParams::event_type],
|
|
26
|
+
name: String,
|
|
27
|
+
url: String,
|
|
28
|
+
?description: String?,
|
|
29
|
+
?request_options: ModerationAPI::request_opts
|
|
30
|
+
) -> void
|
|
31
|
+
|
|
32
|
+
def to_hash: -> {
|
|
33
|
+
event_types: ::Array[ModerationAPI::Models::WebhookCreateParams::event_type],
|
|
34
|
+
name: String,
|
|
35
|
+
url: String,
|
|
36
|
+
description: String?,
|
|
37
|
+
request_options: ModerationAPI::RequestOptions
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
type event_type =
|
|
41
|
+
:QUEUE_ITEM_NEW
|
|
42
|
+
| :QUEUE_ITEM_COMPLETED
|
|
43
|
+
| :QUEUE_ITEM_ACTION
|
|
44
|
+
| :QUEUE_ITEM_REJECTED
|
|
45
|
+
| :QUEUE_ITEM_ALLOWED
|
|
46
|
+
| :AUTHOR_BLOCKED
|
|
47
|
+
| :AUTHOR_UNBLOCKED
|
|
48
|
+
| :AUTHOR_SUSPENDED
|
|
49
|
+
| :AUTHOR_UPDATED
|
|
50
|
+
| :AUTHOR_TRUST_LEVEL_CHANGED
|
|
51
|
+
| :AUTHOR_ACTION
|
|
52
|
+
|
|
53
|
+
module EventType
|
|
54
|
+
extend ModerationAPI::Internal::Type::Enum
|
|
55
|
+
|
|
56
|
+
QUEUE_ITEM_NEW: :QUEUE_ITEM_NEW
|
|
57
|
+
QUEUE_ITEM_COMPLETED: :QUEUE_ITEM_COMPLETED
|
|
58
|
+
QUEUE_ITEM_ACTION: :QUEUE_ITEM_ACTION
|
|
59
|
+
QUEUE_ITEM_REJECTED: :QUEUE_ITEM_REJECTED
|
|
60
|
+
QUEUE_ITEM_ALLOWED: :QUEUE_ITEM_ALLOWED
|
|
61
|
+
AUTHOR_BLOCKED: :AUTHOR_BLOCKED
|
|
62
|
+
AUTHOR_UNBLOCKED: :AUTHOR_UNBLOCKED
|
|
63
|
+
AUTHOR_SUSPENDED: :AUTHOR_SUSPENDED
|
|
64
|
+
AUTHOR_UPDATED: :AUTHOR_UPDATED
|
|
65
|
+
AUTHOR_TRUST_LEVEL_CHANGED: :AUTHOR_TRUST_LEVEL_CHANGED
|
|
66
|
+
AUTHOR_ACTION: :AUTHOR_ACTION
|
|
67
|
+
|
|
68
|
+
def self?.values: -> ::Array[ModerationAPI::Models::WebhookCreateParams::event_type]
|
|
69
|
+
end
|
|
70
|
+
end
|
|
71
|
+
end
|
|
72
|
+
end
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
module ModerationAPI
|
|
2
|
+
module Models
|
|
3
|
+
type webhook_create_response =
|
|
4
|
+
{
|
|
5
|
+
id: String,
|
|
6
|
+
created_at: String,
|
|
7
|
+
event_types: ::Array[ModerationAPI::Models::WebhookCreateResponse::event_type],
|
|
8
|
+
name: String,
|
|
9
|
+
payload_version: ModerationAPI::Models::WebhookCreateResponse::payload_version,
|
|
10
|
+
url: String,
|
|
11
|
+
description: String?
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
class WebhookCreateResponse < ModerationAPI::Internal::Type::BaseModel
|
|
15
|
+
attr_accessor id: String
|
|
16
|
+
|
|
17
|
+
attr_accessor created_at: String
|
|
18
|
+
|
|
19
|
+
attr_accessor event_types: ::Array[ModerationAPI::Models::WebhookCreateResponse::event_type]
|
|
20
|
+
|
|
21
|
+
attr_accessor name: String
|
|
22
|
+
|
|
23
|
+
attr_accessor payload_version: ModerationAPI::Models::WebhookCreateResponse::payload_version
|
|
24
|
+
|
|
25
|
+
attr_accessor url: String
|
|
26
|
+
|
|
27
|
+
attr_accessor description: String?
|
|
28
|
+
|
|
29
|
+
def initialize: (
|
|
30
|
+
id: String,
|
|
31
|
+
created_at: String,
|
|
32
|
+
event_types: ::Array[ModerationAPI::Models::WebhookCreateResponse::event_type],
|
|
33
|
+
name: String,
|
|
34
|
+
payload_version: ModerationAPI::Models::WebhookCreateResponse::payload_version,
|
|
35
|
+
url: String,
|
|
36
|
+
?description: String?
|
|
37
|
+
) -> void
|
|
38
|
+
|
|
39
|
+
def to_hash: -> {
|
|
40
|
+
id: String,
|
|
41
|
+
created_at: String,
|
|
42
|
+
event_types: ::Array[ModerationAPI::Models::WebhookCreateResponse::event_type],
|
|
43
|
+
name: String,
|
|
44
|
+
payload_version: ModerationAPI::Models::WebhookCreateResponse::payload_version,
|
|
45
|
+
url: String,
|
|
46
|
+
description: String?
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
type event_type =
|
|
50
|
+
:QUEUE_ITEM_NEW
|
|
51
|
+
| :QUEUE_ITEM_COMPLETED
|
|
52
|
+
| :QUEUE_ITEM_ACTION
|
|
53
|
+
| :QUEUE_ITEM_REJECTED
|
|
54
|
+
| :QUEUE_ITEM_ALLOWED
|
|
55
|
+
| :AUTHOR_BLOCKED
|
|
56
|
+
| :AUTHOR_UNBLOCKED
|
|
57
|
+
| :AUTHOR_SUSPENDED
|
|
58
|
+
| :AUTHOR_UPDATED
|
|
59
|
+
| :AUTHOR_TRUST_LEVEL_CHANGED
|
|
60
|
+
| :AUTHOR_ACTION
|
|
61
|
+
|
|
62
|
+
module EventType
|
|
63
|
+
extend ModerationAPI::Internal::Type::Enum
|
|
64
|
+
|
|
65
|
+
QUEUE_ITEM_NEW: :QUEUE_ITEM_NEW
|
|
66
|
+
QUEUE_ITEM_COMPLETED: :QUEUE_ITEM_COMPLETED
|
|
67
|
+
QUEUE_ITEM_ACTION: :QUEUE_ITEM_ACTION
|
|
68
|
+
QUEUE_ITEM_REJECTED: :QUEUE_ITEM_REJECTED
|
|
69
|
+
QUEUE_ITEM_ALLOWED: :QUEUE_ITEM_ALLOWED
|
|
70
|
+
AUTHOR_BLOCKED: :AUTHOR_BLOCKED
|
|
71
|
+
AUTHOR_UNBLOCKED: :AUTHOR_UNBLOCKED
|
|
72
|
+
AUTHOR_SUSPENDED: :AUTHOR_SUSPENDED
|
|
73
|
+
AUTHOR_UPDATED: :AUTHOR_UPDATED
|
|
74
|
+
AUTHOR_TRUST_LEVEL_CHANGED: :AUTHOR_TRUST_LEVEL_CHANGED
|
|
75
|
+
AUTHOR_ACTION: :AUTHOR_ACTION
|
|
76
|
+
|
|
77
|
+
def self?.values: -> ::Array[ModerationAPI::Models::WebhookCreateResponse::event_type]
|
|
78
|
+
end
|
|
79
|
+
|
|
80
|
+
type payload_version = :V1 | :V2
|
|
81
|
+
|
|
82
|
+
module PayloadVersion
|
|
83
|
+
extend ModerationAPI::Internal::Type::Enum
|
|
84
|
+
|
|
85
|
+
V1: :V1
|
|
86
|
+
V2: :V2
|
|
87
|
+
|
|
88
|
+
def self?.values: -> ::Array[ModerationAPI::Models::WebhookCreateResponse::payload_version]
|
|
89
|
+
end
|
|
90
|
+
end
|
|
91
|
+
end
|
|
92
|
+
end
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
module ModerationAPI
|
|
2
|
+
module Models
|
|
3
|
+
type webhook_delete_params =
|
|
4
|
+
{ id: String } & ModerationAPI::Internal::Type::request_parameters
|
|
5
|
+
|
|
6
|
+
class WebhookDeleteParams < ModerationAPI::Internal::Type::BaseModel
|
|
7
|
+
extend ModerationAPI::Internal::Type::RequestParameters::Converter
|
|
8
|
+
include ModerationAPI::Internal::Type::RequestParameters
|
|
9
|
+
|
|
10
|
+
attr_accessor id: String
|
|
11
|
+
|
|
12
|
+
def initialize: (
|
|
13
|
+
id: String,
|
|
14
|
+
?request_options: ModerationAPI::request_opts
|
|
15
|
+
) -> void
|
|
16
|
+
|
|
17
|
+
def to_hash: -> {
|
|
18
|
+
id: String,
|
|
19
|
+
request_options: ModerationAPI::RequestOptions
|
|
20
|
+
}
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
end
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
module ModerationAPI
|
|
2
|
+
module Models
|
|
3
|
+
type webhook_delete_response = { id: String, deleted: bool }
|
|
4
|
+
|
|
5
|
+
class WebhookDeleteResponse < ModerationAPI::Internal::Type::BaseModel
|
|
6
|
+
attr_accessor id: String
|
|
7
|
+
|
|
8
|
+
attr_accessor deleted: bool
|
|
9
|
+
|
|
10
|
+
def initialize: (id: String, deleted: bool) -> void
|
|
11
|
+
|
|
12
|
+
def to_hash: -> { id: String, deleted: bool }
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
end
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
module ModerationAPI
|
|
2
|
+
module Models
|
|
3
|
+
type webhook_list_params =
|
|
4
|
+
{ } & ModerationAPI::Internal::Type::request_parameters
|
|
5
|
+
|
|
6
|
+
class WebhookListParams < ModerationAPI::Internal::Type::BaseModel
|
|
7
|
+
extend ModerationAPI::Internal::Type::RequestParameters::Converter
|
|
8
|
+
include ModerationAPI::Internal::Type::RequestParameters
|
|
9
|
+
|
|
10
|
+
def initialize: (?request_options: ModerationAPI::request_opts) -> void
|
|
11
|
+
|
|
12
|
+
def to_hash: -> { request_options: ModerationAPI::RequestOptions }
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
end
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
module ModerationAPI
|
|
2
|
+
module Models
|
|
3
|
+
type webhook_list_response_item =
|
|
4
|
+
{
|
|
5
|
+
id: String,
|
|
6
|
+
created_at: String,
|
|
7
|
+
event_types: ::Array[ModerationAPI::Models::WebhookListResponseItem::event_type],
|
|
8
|
+
name: String,
|
|
9
|
+
payload_version: ModerationAPI::Models::WebhookListResponseItem::payload_version,
|
|
10
|
+
url: String,
|
|
11
|
+
description: String?
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
class WebhookListResponseItem < ModerationAPI::Internal::Type::BaseModel
|
|
15
|
+
attr_accessor id: String
|
|
16
|
+
|
|
17
|
+
attr_accessor created_at: String
|
|
18
|
+
|
|
19
|
+
attr_accessor event_types: ::Array[ModerationAPI::Models::WebhookListResponseItem::event_type]
|
|
20
|
+
|
|
21
|
+
attr_accessor name: String
|
|
22
|
+
|
|
23
|
+
attr_accessor payload_version: ModerationAPI::Models::WebhookListResponseItem::payload_version
|
|
24
|
+
|
|
25
|
+
attr_accessor url: String
|
|
26
|
+
|
|
27
|
+
attr_accessor description: String?
|
|
28
|
+
|
|
29
|
+
def initialize: (
|
|
30
|
+
id: String,
|
|
31
|
+
created_at: String,
|
|
32
|
+
event_types: ::Array[ModerationAPI::Models::WebhookListResponseItem::event_type],
|
|
33
|
+
name: String,
|
|
34
|
+
payload_version: ModerationAPI::Models::WebhookListResponseItem::payload_version,
|
|
35
|
+
url: String,
|
|
36
|
+
?description: String?
|
|
37
|
+
) -> void
|
|
38
|
+
|
|
39
|
+
def to_hash: -> {
|
|
40
|
+
id: String,
|
|
41
|
+
created_at: String,
|
|
42
|
+
event_types: ::Array[ModerationAPI::Models::WebhookListResponseItem::event_type],
|
|
43
|
+
name: String,
|
|
44
|
+
payload_version: ModerationAPI::Models::WebhookListResponseItem::payload_version,
|
|
45
|
+
url: String,
|
|
46
|
+
description: String?
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
type event_type =
|
|
50
|
+
:QUEUE_ITEM_NEW
|
|
51
|
+
| :QUEUE_ITEM_COMPLETED
|
|
52
|
+
| :QUEUE_ITEM_ACTION
|
|
53
|
+
| :QUEUE_ITEM_REJECTED
|
|
54
|
+
| :QUEUE_ITEM_ALLOWED
|
|
55
|
+
| :AUTHOR_BLOCKED
|
|
56
|
+
| :AUTHOR_UNBLOCKED
|
|
57
|
+
| :AUTHOR_SUSPENDED
|
|
58
|
+
| :AUTHOR_UPDATED
|
|
59
|
+
| :AUTHOR_TRUST_LEVEL_CHANGED
|
|
60
|
+
| :AUTHOR_ACTION
|
|
61
|
+
|
|
62
|
+
module EventType
|
|
63
|
+
extend ModerationAPI::Internal::Type::Enum
|
|
64
|
+
|
|
65
|
+
QUEUE_ITEM_NEW: :QUEUE_ITEM_NEW
|
|
66
|
+
QUEUE_ITEM_COMPLETED: :QUEUE_ITEM_COMPLETED
|
|
67
|
+
QUEUE_ITEM_ACTION: :QUEUE_ITEM_ACTION
|
|
68
|
+
QUEUE_ITEM_REJECTED: :QUEUE_ITEM_REJECTED
|
|
69
|
+
QUEUE_ITEM_ALLOWED: :QUEUE_ITEM_ALLOWED
|
|
70
|
+
AUTHOR_BLOCKED: :AUTHOR_BLOCKED
|
|
71
|
+
AUTHOR_UNBLOCKED: :AUTHOR_UNBLOCKED
|
|
72
|
+
AUTHOR_SUSPENDED: :AUTHOR_SUSPENDED
|
|
73
|
+
AUTHOR_UPDATED: :AUTHOR_UPDATED
|
|
74
|
+
AUTHOR_TRUST_LEVEL_CHANGED: :AUTHOR_TRUST_LEVEL_CHANGED
|
|
75
|
+
AUTHOR_ACTION: :AUTHOR_ACTION
|
|
76
|
+
|
|
77
|
+
def self?.values: -> ::Array[ModerationAPI::Models::WebhookListResponseItem::event_type]
|
|
78
|
+
end
|
|
79
|
+
|
|
80
|
+
type payload_version = :V1 | :V2
|
|
81
|
+
|
|
82
|
+
module PayloadVersion
|
|
83
|
+
extend ModerationAPI::Internal::Type::Enum
|
|
84
|
+
|
|
85
|
+
V1: :V1
|
|
86
|
+
V2: :V2
|
|
87
|
+
|
|
88
|
+
def self?.values: -> ::Array[ModerationAPI::Models::WebhookListResponseItem::payload_version]
|
|
89
|
+
end
|
|
90
|
+
end
|
|
91
|
+
|
|
92
|
+
type webhook_list_response =
|
|
93
|
+
::Array[ModerationAPI::Models::WebhookListResponseItem]
|
|
94
|
+
|
|
95
|
+
WebhookListResponse: ModerationAPI::Internal::Type::Converter
|
|
96
|
+
end
|
|
97
|
+
end
|