moderation_api 2.32.0 → 2.34.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/queue_retrieve_response.rb +13 -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/queue_retrieve_response.rbi +18 -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/queue_retrieve_response.rbs +14 -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
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
# typed: strong
|
|
2
|
+
|
|
3
|
+
module ModerationAPI
|
|
4
|
+
module Models
|
|
5
|
+
class WebhookUpdateParams < ModerationAPI::Internal::Type::BaseModel
|
|
6
|
+
extend ModerationAPI::Internal::Type::RequestParameters::Converter
|
|
7
|
+
include ModerationAPI::Internal::Type::RequestParameters
|
|
8
|
+
|
|
9
|
+
OrHash =
|
|
10
|
+
T.type_alias do
|
|
11
|
+
T.any(
|
|
12
|
+
ModerationAPI::WebhookUpdateParams,
|
|
13
|
+
ModerationAPI::Internal::AnyHash
|
|
14
|
+
)
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
# The ID of the webhook to update.
|
|
18
|
+
sig { returns(String) }
|
|
19
|
+
attr_accessor :id
|
|
20
|
+
|
|
21
|
+
# The webhook's description
|
|
22
|
+
sig { returns(T.nilable(String)) }
|
|
23
|
+
attr_accessor :description
|
|
24
|
+
|
|
25
|
+
# Event types this webhook subscribes to. One webhook URL receives all events you
|
|
26
|
+
# list here.
|
|
27
|
+
sig do
|
|
28
|
+
returns(
|
|
29
|
+
T.nilable(
|
|
30
|
+
T::Array[ModerationAPI::WebhookUpdateParams::EventType::OrSymbol]
|
|
31
|
+
)
|
|
32
|
+
)
|
|
33
|
+
end
|
|
34
|
+
attr_reader :event_types
|
|
35
|
+
|
|
36
|
+
sig do
|
|
37
|
+
params(
|
|
38
|
+
event_types:
|
|
39
|
+
T::Array[ModerationAPI::WebhookUpdateParams::EventType::OrSymbol]
|
|
40
|
+
).void
|
|
41
|
+
end
|
|
42
|
+
attr_writer :event_types
|
|
43
|
+
|
|
44
|
+
# The webhook's name, used to identify it in the dashboard
|
|
45
|
+
sig { returns(T.nilable(String)) }
|
|
46
|
+
attr_reader :name
|
|
47
|
+
|
|
48
|
+
sig { params(name: String).void }
|
|
49
|
+
attr_writer :name
|
|
50
|
+
|
|
51
|
+
# The webhook's URL. We'll call this URL when an event occurs.
|
|
52
|
+
sig { returns(T.nilable(String)) }
|
|
53
|
+
attr_reader :url
|
|
54
|
+
|
|
55
|
+
sig { params(url: String).void }
|
|
56
|
+
attr_writer :url
|
|
57
|
+
|
|
58
|
+
sig do
|
|
59
|
+
params(
|
|
60
|
+
id: String,
|
|
61
|
+
description: T.nilable(String),
|
|
62
|
+
event_types:
|
|
63
|
+
T::Array[ModerationAPI::WebhookUpdateParams::EventType::OrSymbol],
|
|
64
|
+
name: String,
|
|
65
|
+
url: String,
|
|
66
|
+
request_options: ModerationAPI::RequestOptions::OrHash
|
|
67
|
+
).returns(T.attached_class)
|
|
68
|
+
end
|
|
69
|
+
def self.new(
|
|
70
|
+
# The ID of the webhook to update.
|
|
71
|
+
id:,
|
|
72
|
+
# The webhook's description
|
|
73
|
+
description: nil,
|
|
74
|
+
# Event types this webhook subscribes to. One webhook URL receives all events you
|
|
75
|
+
# list here.
|
|
76
|
+
event_types: nil,
|
|
77
|
+
# The webhook's name, used to identify it in the dashboard
|
|
78
|
+
name: nil,
|
|
79
|
+
# The webhook's URL. We'll call this URL when an event occurs.
|
|
80
|
+
url: nil,
|
|
81
|
+
request_options: {}
|
|
82
|
+
)
|
|
83
|
+
end
|
|
84
|
+
|
|
85
|
+
sig do
|
|
86
|
+
override.returns(
|
|
87
|
+
{
|
|
88
|
+
id: String,
|
|
89
|
+
description: T.nilable(String),
|
|
90
|
+
event_types:
|
|
91
|
+
T::Array[ModerationAPI::WebhookUpdateParams::EventType::OrSymbol],
|
|
92
|
+
name: String,
|
|
93
|
+
url: String,
|
|
94
|
+
request_options: ModerationAPI::RequestOptions
|
|
95
|
+
}
|
|
96
|
+
)
|
|
97
|
+
end
|
|
98
|
+
def to_hash
|
|
99
|
+
end
|
|
100
|
+
|
|
101
|
+
module EventType
|
|
102
|
+
extend ModerationAPI::Internal::Type::Enum
|
|
103
|
+
|
|
104
|
+
TaggedSymbol =
|
|
105
|
+
T.type_alias do
|
|
106
|
+
T.all(Symbol, ModerationAPI::WebhookUpdateParams::EventType)
|
|
107
|
+
end
|
|
108
|
+
OrSymbol = T.type_alias { T.any(Symbol, String) }
|
|
109
|
+
|
|
110
|
+
QUEUE_ITEM_NEW =
|
|
111
|
+
T.let(
|
|
112
|
+
:QUEUE_ITEM_NEW,
|
|
113
|
+
ModerationAPI::WebhookUpdateParams::EventType::TaggedSymbol
|
|
114
|
+
)
|
|
115
|
+
QUEUE_ITEM_COMPLETED =
|
|
116
|
+
T.let(
|
|
117
|
+
:QUEUE_ITEM_COMPLETED,
|
|
118
|
+
ModerationAPI::WebhookUpdateParams::EventType::TaggedSymbol
|
|
119
|
+
)
|
|
120
|
+
QUEUE_ITEM_ACTION =
|
|
121
|
+
T.let(
|
|
122
|
+
:QUEUE_ITEM_ACTION,
|
|
123
|
+
ModerationAPI::WebhookUpdateParams::EventType::TaggedSymbol
|
|
124
|
+
)
|
|
125
|
+
QUEUE_ITEM_REJECTED =
|
|
126
|
+
T.let(
|
|
127
|
+
:QUEUE_ITEM_REJECTED,
|
|
128
|
+
ModerationAPI::WebhookUpdateParams::EventType::TaggedSymbol
|
|
129
|
+
)
|
|
130
|
+
QUEUE_ITEM_ALLOWED =
|
|
131
|
+
T.let(
|
|
132
|
+
:QUEUE_ITEM_ALLOWED,
|
|
133
|
+
ModerationAPI::WebhookUpdateParams::EventType::TaggedSymbol
|
|
134
|
+
)
|
|
135
|
+
AUTHOR_BLOCKED =
|
|
136
|
+
T.let(
|
|
137
|
+
:AUTHOR_BLOCKED,
|
|
138
|
+
ModerationAPI::WebhookUpdateParams::EventType::TaggedSymbol
|
|
139
|
+
)
|
|
140
|
+
AUTHOR_UNBLOCKED =
|
|
141
|
+
T.let(
|
|
142
|
+
:AUTHOR_UNBLOCKED,
|
|
143
|
+
ModerationAPI::WebhookUpdateParams::EventType::TaggedSymbol
|
|
144
|
+
)
|
|
145
|
+
AUTHOR_SUSPENDED =
|
|
146
|
+
T.let(
|
|
147
|
+
:AUTHOR_SUSPENDED,
|
|
148
|
+
ModerationAPI::WebhookUpdateParams::EventType::TaggedSymbol
|
|
149
|
+
)
|
|
150
|
+
AUTHOR_UPDATED =
|
|
151
|
+
T.let(
|
|
152
|
+
:AUTHOR_UPDATED,
|
|
153
|
+
ModerationAPI::WebhookUpdateParams::EventType::TaggedSymbol
|
|
154
|
+
)
|
|
155
|
+
AUTHOR_TRUST_LEVEL_CHANGED =
|
|
156
|
+
T.let(
|
|
157
|
+
:AUTHOR_TRUST_LEVEL_CHANGED,
|
|
158
|
+
ModerationAPI::WebhookUpdateParams::EventType::TaggedSymbol
|
|
159
|
+
)
|
|
160
|
+
AUTHOR_ACTION =
|
|
161
|
+
T.let(
|
|
162
|
+
:AUTHOR_ACTION,
|
|
163
|
+
ModerationAPI::WebhookUpdateParams::EventType::TaggedSymbol
|
|
164
|
+
)
|
|
165
|
+
|
|
166
|
+
sig do
|
|
167
|
+
override.returns(
|
|
168
|
+
T::Array[
|
|
169
|
+
ModerationAPI::WebhookUpdateParams::EventType::TaggedSymbol
|
|
170
|
+
]
|
|
171
|
+
)
|
|
172
|
+
end
|
|
173
|
+
def self.values
|
|
174
|
+
end
|
|
175
|
+
end
|
|
176
|
+
end
|
|
177
|
+
end
|
|
178
|
+
end
|
|
@@ -0,0 +1,225 @@
|
|
|
1
|
+
# typed: strong
|
|
2
|
+
|
|
3
|
+
module ModerationAPI
|
|
4
|
+
module Models
|
|
5
|
+
class WebhookUpdateResponse < ModerationAPI::Internal::Type::BaseModel
|
|
6
|
+
OrHash =
|
|
7
|
+
T.type_alias do
|
|
8
|
+
T.any(
|
|
9
|
+
ModerationAPI::Models::WebhookUpdateResponse,
|
|
10
|
+
ModerationAPI::Internal::AnyHash
|
|
11
|
+
)
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
# The ID of the webhook.
|
|
15
|
+
sig { returns(String) }
|
|
16
|
+
attr_accessor :id
|
|
17
|
+
|
|
18
|
+
# The date the webhook was created.
|
|
19
|
+
sig { returns(String) }
|
|
20
|
+
attr_accessor :created_at
|
|
21
|
+
|
|
22
|
+
# Event types this webhook subscribes to. Empty for legacy v1 webhooks, which
|
|
23
|
+
# subscribe via their single deprecated `type` instead.
|
|
24
|
+
sig do
|
|
25
|
+
returns(
|
|
26
|
+
T::Array[
|
|
27
|
+
ModerationAPI::Models::WebhookUpdateResponse::EventType::TaggedSymbol
|
|
28
|
+
]
|
|
29
|
+
)
|
|
30
|
+
end
|
|
31
|
+
attr_accessor :event_types
|
|
32
|
+
|
|
33
|
+
# The webhook's name.
|
|
34
|
+
sig { returns(String) }
|
|
35
|
+
attr_accessor :name
|
|
36
|
+
|
|
37
|
+
# Payload envelope version. V2 is the Stripe-style envelope; V1 is the legacy flat
|
|
38
|
+
# shape and is read-only via this API.
|
|
39
|
+
sig do
|
|
40
|
+
returns(
|
|
41
|
+
ModerationAPI::Models::WebhookUpdateResponse::PayloadVersion::TaggedSymbol
|
|
42
|
+
)
|
|
43
|
+
end
|
|
44
|
+
attr_accessor :payload_version
|
|
45
|
+
|
|
46
|
+
# The URL we call when a subscribed event occurs.
|
|
47
|
+
sig { returns(String) }
|
|
48
|
+
attr_accessor :url
|
|
49
|
+
|
|
50
|
+
# The webhook's description.
|
|
51
|
+
sig { returns(T.nilable(String)) }
|
|
52
|
+
attr_accessor :description
|
|
53
|
+
|
|
54
|
+
sig do
|
|
55
|
+
params(
|
|
56
|
+
id: String,
|
|
57
|
+
created_at: String,
|
|
58
|
+
event_types:
|
|
59
|
+
T::Array[
|
|
60
|
+
ModerationAPI::Models::WebhookUpdateResponse::EventType::OrSymbol
|
|
61
|
+
],
|
|
62
|
+
name: String,
|
|
63
|
+
payload_version:
|
|
64
|
+
ModerationAPI::Models::WebhookUpdateResponse::PayloadVersion::OrSymbol,
|
|
65
|
+
url: String,
|
|
66
|
+
description: T.nilable(String)
|
|
67
|
+
).returns(T.attached_class)
|
|
68
|
+
end
|
|
69
|
+
def self.new(
|
|
70
|
+
# The ID of the webhook.
|
|
71
|
+
id:,
|
|
72
|
+
# The date the webhook was created.
|
|
73
|
+
created_at:,
|
|
74
|
+
# Event types this webhook subscribes to. Empty for legacy v1 webhooks, which
|
|
75
|
+
# subscribe via their single deprecated `type` instead.
|
|
76
|
+
event_types:,
|
|
77
|
+
# The webhook's name.
|
|
78
|
+
name:,
|
|
79
|
+
# Payload envelope version. V2 is the Stripe-style envelope; V1 is the legacy flat
|
|
80
|
+
# shape and is read-only via this API.
|
|
81
|
+
payload_version:,
|
|
82
|
+
# The URL we call when a subscribed event occurs.
|
|
83
|
+
url:,
|
|
84
|
+
# The webhook's description.
|
|
85
|
+
description: nil
|
|
86
|
+
)
|
|
87
|
+
end
|
|
88
|
+
|
|
89
|
+
sig do
|
|
90
|
+
override.returns(
|
|
91
|
+
{
|
|
92
|
+
id: String,
|
|
93
|
+
created_at: String,
|
|
94
|
+
event_types:
|
|
95
|
+
T::Array[
|
|
96
|
+
ModerationAPI::Models::WebhookUpdateResponse::EventType::TaggedSymbol
|
|
97
|
+
],
|
|
98
|
+
name: String,
|
|
99
|
+
payload_version:
|
|
100
|
+
ModerationAPI::Models::WebhookUpdateResponse::PayloadVersion::TaggedSymbol,
|
|
101
|
+
url: String,
|
|
102
|
+
description: T.nilable(String)
|
|
103
|
+
}
|
|
104
|
+
)
|
|
105
|
+
end
|
|
106
|
+
def to_hash
|
|
107
|
+
end
|
|
108
|
+
|
|
109
|
+
module EventType
|
|
110
|
+
extend ModerationAPI::Internal::Type::Enum
|
|
111
|
+
|
|
112
|
+
TaggedSymbol =
|
|
113
|
+
T.type_alias do
|
|
114
|
+
T.all(
|
|
115
|
+
Symbol,
|
|
116
|
+
ModerationAPI::Models::WebhookUpdateResponse::EventType
|
|
117
|
+
)
|
|
118
|
+
end
|
|
119
|
+
OrSymbol = T.type_alias { T.any(Symbol, String) }
|
|
120
|
+
|
|
121
|
+
QUEUE_ITEM_NEW =
|
|
122
|
+
T.let(
|
|
123
|
+
:QUEUE_ITEM_NEW,
|
|
124
|
+
ModerationAPI::Models::WebhookUpdateResponse::EventType::TaggedSymbol
|
|
125
|
+
)
|
|
126
|
+
QUEUE_ITEM_COMPLETED =
|
|
127
|
+
T.let(
|
|
128
|
+
:QUEUE_ITEM_COMPLETED,
|
|
129
|
+
ModerationAPI::Models::WebhookUpdateResponse::EventType::TaggedSymbol
|
|
130
|
+
)
|
|
131
|
+
QUEUE_ITEM_ACTION =
|
|
132
|
+
T.let(
|
|
133
|
+
:QUEUE_ITEM_ACTION,
|
|
134
|
+
ModerationAPI::Models::WebhookUpdateResponse::EventType::TaggedSymbol
|
|
135
|
+
)
|
|
136
|
+
QUEUE_ITEM_REJECTED =
|
|
137
|
+
T.let(
|
|
138
|
+
:QUEUE_ITEM_REJECTED,
|
|
139
|
+
ModerationAPI::Models::WebhookUpdateResponse::EventType::TaggedSymbol
|
|
140
|
+
)
|
|
141
|
+
QUEUE_ITEM_ALLOWED =
|
|
142
|
+
T.let(
|
|
143
|
+
:QUEUE_ITEM_ALLOWED,
|
|
144
|
+
ModerationAPI::Models::WebhookUpdateResponse::EventType::TaggedSymbol
|
|
145
|
+
)
|
|
146
|
+
AUTHOR_BLOCKED =
|
|
147
|
+
T.let(
|
|
148
|
+
:AUTHOR_BLOCKED,
|
|
149
|
+
ModerationAPI::Models::WebhookUpdateResponse::EventType::TaggedSymbol
|
|
150
|
+
)
|
|
151
|
+
AUTHOR_UNBLOCKED =
|
|
152
|
+
T.let(
|
|
153
|
+
:AUTHOR_UNBLOCKED,
|
|
154
|
+
ModerationAPI::Models::WebhookUpdateResponse::EventType::TaggedSymbol
|
|
155
|
+
)
|
|
156
|
+
AUTHOR_SUSPENDED =
|
|
157
|
+
T.let(
|
|
158
|
+
:AUTHOR_SUSPENDED,
|
|
159
|
+
ModerationAPI::Models::WebhookUpdateResponse::EventType::TaggedSymbol
|
|
160
|
+
)
|
|
161
|
+
AUTHOR_UPDATED =
|
|
162
|
+
T.let(
|
|
163
|
+
:AUTHOR_UPDATED,
|
|
164
|
+
ModerationAPI::Models::WebhookUpdateResponse::EventType::TaggedSymbol
|
|
165
|
+
)
|
|
166
|
+
AUTHOR_TRUST_LEVEL_CHANGED =
|
|
167
|
+
T.let(
|
|
168
|
+
:AUTHOR_TRUST_LEVEL_CHANGED,
|
|
169
|
+
ModerationAPI::Models::WebhookUpdateResponse::EventType::TaggedSymbol
|
|
170
|
+
)
|
|
171
|
+
AUTHOR_ACTION =
|
|
172
|
+
T.let(
|
|
173
|
+
:AUTHOR_ACTION,
|
|
174
|
+
ModerationAPI::Models::WebhookUpdateResponse::EventType::TaggedSymbol
|
|
175
|
+
)
|
|
176
|
+
|
|
177
|
+
sig do
|
|
178
|
+
override.returns(
|
|
179
|
+
T::Array[
|
|
180
|
+
ModerationAPI::Models::WebhookUpdateResponse::EventType::TaggedSymbol
|
|
181
|
+
]
|
|
182
|
+
)
|
|
183
|
+
end
|
|
184
|
+
def self.values
|
|
185
|
+
end
|
|
186
|
+
end
|
|
187
|
+
|
|
188
|
+
# Payload envelope version. V2 is the Stripe-style envelope; V1 is the legacy flat
|
|
189
|
+
# shape and is read-only via this API.
|
|
190
|
+
module PayloadVersion
|
|
191
|
+
extend ModerationAPI::Internal::Type::Enum
|
|
192
|
+
|
|
193
|
+
TaggedSymbol =
|
|
194
|
+
T.type_alias do
|
|
195
|
+
T.all(
|
|
196
|
+
Symbol,
|
|
197
|
+
ModerationAPI::Models::WebhookUpdateResponse::PayloadVersion
|
|
198
|
+
)
|
|
199
|
+
end
|
|
200
|
+
OrSymbol = T.type_alias { T.any(Symbol, String) }
|
|
201
|
+
|
|
202
|
+
V1 =
|
|
203
|
+
T.let(
|
|
204
|
+
:V1,
|
|
205
|
+
ModerationAPI::Models::WebhookUpdateResponse::PayloadVersion::TaggedSymbol
|
|
206
|
+
)
|
|
207
|
+
V2 =
|
|
208
|
+
T.let(
|
|
209
|
+
:V2,
|
|
210
|
+
ModerationAPI::Models::WebhookUpdateResponse::PayloadVersion::TaggedSymbol
|
|
211
|
+
)
|
|
212
|
+
|
|
213
|
+
sig do
|
|
214
|
+
override.returns(
|
|
215
|
+
T::Array[
|
|
216
|
+
ModerationAPI::Models::WebhookUpdateResponse::PayloadVersion::TaggedSymbol
|
|
217
|
+
]
|
|
218
|
+
)
|
|
219
|
+
end
|
|
220
|
+
def self.values
|
|
221
|
+
end
|
|
222
|
+
end
|
|
223
|
+
end
|
|
224
|
+
end
|
|
225
|
+
end
|
|
@@ -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
|
|
@@ -77,7 +77,9 @@ module ModerationAPI
|
|
|
77
77
|
is_flagged: ModerationAPI::Models::QueueRetrieveResponse::Queue::Filter::is_flagged,
|
|
78
78
|
labels: ::Array[String],
|
|
79
79
|
languages: ::Array[String],
|
|
80
|
+
max_severity: Integer,
|
|
80
81
|
media_types: ::Array[ModerationAPI::Models::QueueRetrieveResponse::Queue::Filter::media_type],
|
|
82
|
+
min_severity: Integer,
|
|
81
83
|
recommendation_actions: ::Array[ModerationAPI::Models::QueueRetrieveResponse::Queue::Filter::recommendation_action],
|
|
82
84
|
search: ::Array[String],
|
|
83
85
|
within: Float,
|
|
@@ -149,12 +151,20 @@ module ModerationAPI
|
|
|
149
151
|
|
|
150
152
|
def languages=: (::Array[String]) -> ::Array[String]
|
|
151
153
|
|
|
154
|
+
attr_reader max_severity: Integer?
|
|
155
|
+
|
|
156
|
+
def max_severity=: (Integer) -> Integer
|
|
157
|
+
|
|
152
158
|
attr_reader media_types: ::Array[ModerationAPI::Models::QueueRetrieveResponse::Queue::Filter::media_type]?
|
|
153
159
|
|
|
154
160
|
def media_types=: (
|
|
155
161
|
::Array[ModerationAPI::Models::QueueRetrieveResponse::Queue::Filter::media_type]
|
|
156
162
|
) -> ::Array[ModerationAPI::Models::QueueRetrieveResponse::Queue::Filter::media_type]
|
|
157
163
|
|
|
164
|
+
attr_reader min_severity: Integer?
|
|
165
|
+
|
|
166
|
+
def min_severity=: (Integer) -> Integer
|
|
167
|
+
|
|
158
168
|
attr_reader recommendation_actions: ::Array[ModerationAPI::Models::QueueRetrieveResponse::Queue::Filter::recommendation_action]?
|
|
159
169
|
|
|
160
170
|
def recommendation_actions=: (
|
|
@@ -191,7 +201,9 @@ module ModerationAPI
|
|
|
191
201
|
?is_flagged: ModerationAPI::Models::QueueRetrieveResponse::Queue::Filter::is_flagged,
|
|
192
202
|
?labels: ::Array[String],
|
|
193
203
|
?languages: ::Array[String],
|
|
204
|
+
?max_severity: Integer,
|
|
194
205
|
?media_types: ::Array[ModerationAPI::Models::QueueRetrieveResponse::Queue::Filter::media_type],
|
|
206
|
+
?min_severity: Integer,
|
|
195
207
|
?recommendation_actions: ::Array[ModerationAPI::Models::QueueRetrieveResponse::Queue::Filter::recommendation_action],
|
|
196
208
|
?search: ::Array[String],
|
|
197
209
|
?within: Float,
|
|
@@ -214,7 +226,9 @@ module ModerationAPI
|
|
|
214
226
|
is_flagged: ModerationAPI::Models::QueueRetrieveResponse::Queue::Filter::is_flagged,
|
|
215
227
|
labels: ::Array[String],
|
|
216
228
|
languages: ::Array[String],
|
|
229
|
+
max_severity: Integer,
|
|
217
230
|
media_types: ::Array[ModerationAPI::Models::QueueRetrieveResponse::Queue::Filter::media_type],
|
|
231
|
+
min_severity: Integer,
|
|
218
232
|
recommendation_actions: ::Array[ModerationAPI::Models::QueueRetrieveResponse::Queue::Filter::recommendation_action],
|
|
219
233
|
search: ::Array[String],
|
|
220
234
|
within: Float,
|