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
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 58efdd27a36bd37a1e9b27e916fe3591f4ad21e43f3dac943a48cdee701f84e5
|
|
4
|
+
data.tar.gz: cb32bc627ec56cc42a6c0831ef68a25da57a591695662f30c6177799d34e252e
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: ef3456ebe2958f141802fd4d6e46dc1ce03ad95805d5158658b0c1a6cd3aca172a659c4d8758f0737ca1f3a65d9727c84d138f403af835618f6e817a712162b8
|
|
7
|
+
data.tar.gz: 703455e6b65df299a0b01e4ee53bb51ab68e25e7d4188025d467d6200c529261bd49171ed5eecdaa1c9dedac41f4a012f16809c4a5f5daf45268ce20b57c2cfd
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 2.35.0 (2026-08-21)
|
|
4
|
+
|
|
5
|
+
Full Changelog: [v2.34.0...v2.35.0](https://github.com/moderation-api/sdk-ruby/compare/v2.34.0...v2.35.0)
|
|
6
|
+
|
|
7
|
+
### Features
|
|
8
|
+
|
|
9
|
+
* **api:** api update ([ce30b48](https://github.com/moderation-api/sdk-ruby/commit/ce30b48c33ec082b8143b3af082d07de83c44a3d))
|
|
10
|
+
|
|
11
|
+
## 2.34.0 (2026-08-20)
|
|
12
|
+
|
|
13
|
+
Full Changelog: [v2.33.0...v2.34.0](https://github.com/moderation-api/sdk-ruby/compare/v2.33.0...v2.34.0)
|
|
14
|
+
|
|
15
|
+
### Features
|
|
16
|
+
|
|
17
|
+
* **api:** webhooks and stream ([ff603e8](https://github.com/moderation-api/sdk-ruby/commit/ff603e825cf163e821282148124e784545618518))
|
|
18
|
+
|
|
3
19
|
## 2.33.0 (2026-08-14)
|
|
4
20
|
|
|
5
21
|
Full Changelog: [v2.32.0...v2.33.0](https://github.com/moderation-api/sdk-ruby/compare/v2.32.0...v2.33.0)
|
data/README.md
CHANGED
|
@@ -39,6 +39,12 @@ module ModerationAPI
|
|
|
39
39
|
# @return [ModerationAPI::Resources::Wordlist]
|
|
40
40
|
attr_reader :wordlist
|
|
41
41
|
|
|
42
|
+
# @return [ModerationAPI::Resources::Webhooks]
|
|
43
|
+
attr_reader :webhooks
|
|
44
|
+
|
|
45
|
+
# @return [ModerationAPI::Resources::WebhookSecret]
|
|
46
|
+
attr_reader :webhook_secret
|
|
47
|
+
|
|
42
48
|
# @api private
|
|
43
49
|
#
|
|
44
50
|
# @return [Hash{String=>String}]
|
|
@@ -48,6 +54,11 @@ module ModerationAPI
|
|
|
48
54
|
{"authorization" => "Bearer #{@secret_key}"}
|
|
49
55
|
end
|
|
50
56
|
|
|
57
|
+
# @api private
|
|
58
|
+
#
|
|
59
|
+
# @return [Boolean]
|
|
60
|
+
def base_url_overridden? = @base_url_overridden
|
|
61
|
+
|
|
51
62
|
# Creates and returns a new client for interacting with the API.
|
|
52
63
|
#
|
|
53
64
|
# @param secret_key [String, nil] Defaults to `ENV["MODAPI_SECRET_KEY"]`
|
|
@@ -70,6 +81,8 @@ module ModerationAPI
|
|
|
70
81
|
initial_retry_delay: self.class::DEFAULT_INITIAL_RETRY_DELAY,
|
|
71
82
|
max_retry_delay: self.class::DEFAULT_MAX_RETRY_DELAY
|
|
72
83
|
)
|
|
84
|
+
@base_url_overridden = !base_url.nil?
|
|
85
|
+
|
|
73
86
|
base_url ||= "https://api.moderationapi.com/v1"
|
|
74
87
|
|
|
75
88
|
if secret_key.nil?
|
|
@@ -107,6 +120,8 @@ module ModerationAPI
|
|
|
107
120
|
@account = ModerationAPI::Resources::Account.new(client: self)
|
|
108
121
|
@auth = ModerationAPI::Resources::Auth.new(client: self)
|
|
109
122
|
@wordlist = ModerationAPI::Resources::Wordlist.new(client: self)
|
|
123
|
+
@webhooks = ModerationAPI::Resources::Webhooks.new(client: self)
|
|
124
|
+
@webhook_secret = ModerationAPI::Resources::WebhookSecret.new(client: self)
|
|
110
125
|
end
|
|
111
126
|
end
|
|
112
127
|
end
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module ModerationAPI
|
|
4
|
+
module Models
|
|
5
|
+
# @see ModerationAPI::Resources::Content#stream
|
|
6
|
+
class ContentStreamParams < ModerationAPI::Internal::Type::BaseModel
|
|
7
|
+
extend ModerationAPI::Internal::Type::RequestParameters::Converter
|
|
8
|
+
include ModerationAPI::Internal::Type::RequestParameters
|
|
9
|
+
|
|
10
|
+
# @!attribute sec_web_socket_protocol
|
|
11
|
+
#
|
|
12
|
+
# @return [Symbol, ModerationAPI::Models::ContentStreamParams::SecWebSocketProtocol]
|
|
13
|
+
required :sec_web_socket_protocol, enum: -> { ModerationAPI::ContentStreamParams::SecWebSocketProtocol }
|
|
14
|
+
|
|
15
|
+
# @!method initialize(sec_web_socket_protocol:, request_options: {})
|
|
16
|
+
# @param sec_web_socket_protocol [Symbol, ModerationAPI::Models::ContentStreamParams::SecWebSocketProtocol]
|
|
17
|
+
# @param request_options [ModerationAPI::RequestOptions, Hash{Symbol=>Object}]
|
|
18
|
+
|
|
19
|
+
module SecWebSocketProtocol
|
|
20
|
+
extend ModerationAPI::Internal::Type::Enum
|
|
21
|
+
|
|
22
|
+
MODERATIONAPI_V1 = :"moderationapi.v1"
|
|
23
|
+
|
|
24
|
+
# @!method self.values
|
|
25
|
+
# @return [Array<Symbol>]
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
end
|
|
@@ -11,6 +11,16 @@ module ModerationAPI
|
|
|
11
11
|
# @return [ModerationAPI::Models::ContentSubmitResponse::Author, nil]
|
|
12
12
|
required :author, -> { ModerationAPI::Models::ContentSubmitResponse::Author }, nil?: true
|
|
13
13
|
|
|
14
|
+
# @!attribute casebook
|
|
15
|
+
# What your casebook — the record of your past moderation decisions — found for
|
|
16
|
+
# this content, or null when it had nothing close enough to say, when the matching
|
|
17
|
+
# cases disagreed, or when casebook lookups are not switched on for this channel.
|
|
18
|
+
# Reports what the casebook found; whether it decided the outcome is shown in
|
|
19
|
+
# `recommendation`, where a higher-priority rule may have settled the item first.
|
|
20
|
+
#
|
|
21
|
+
# @return [ModerationAPI::Models::ContentSubmitResponse::Casebook, nil]
|
|
22
|
+
required :casebook, -> { ModerationAPI::Models::ContentSubmitResponse::Casebook }, nil?: true
|
|
23
|
+
|
|
14
24
|
# @!attribute content
|
|
15
25
|
# Potentially modified content.
|
|
16
26
|
#
|
|
@@ -56,12 +66,14 @@ module ModerationAPI
|
|
|
56
66
|
optional :errors,
|
|
57
67
|
-> { ModerationAPI::Internal::Type::ArrayOf[ModerationAPI::Models::ContentSubmitResponse::Error] }
|
|
58
68
|
|
|
59
|
-
# @!method initialize(author:, content:, evaluation:, insights:, meta:, policies:, recommendation:, errors: nil)
|
|
69
|
+
# @!method initialize(author:, casebook:, content:, evaluation:, insights:, meta:, policies:, recommendation:, errors: nil)
|
|
60
70
|
# Some parameter documentations has been truncated, see
|
|
61
71
|
# {ModerationAPI::Models::ContentSubmitResponse} for more details.
|
|
62
72
|
#
|
|
63
73
|
# @param author [ModerationAPI::Models::ContentSubmitResponse::Author, nil] The author of the content if your account has authors enabled. Requires you to s
|
|
64
74
|
#
|
|
75
|
+
# @param casebook [ModerationAPI::Models::ContentSubmitResponse::Casebook, nil] What your casebook — the record of your past moderation decisions — found for th
|
|
76
|
+
#
|
|
65
77
|
# @param content [ModerationAPI::Models::ContentSubmitResponse::Content] Potentially modified content.
|
|
66
78
|
#
|
|
67
79
|
# @param evaluation [ModerationAPI::Models::ContentSubmitResponse::Evaluation] The evaluation of the content after running the channel policies.
|
|
@@ -178,6 +190,109 @@ module ModerationAPI
|
|
|
178
190
|
end
|
|
179
191
|
end
|
|
180
192
|
|
|
193
|
+
# @see ModerationAPI::Models::ContentSubmitResponse#casebook
|
|
194
|
+
class Casebook < ModerationAPI::Internal::Type::BaseModel
|
|
195
|
+
# @!attribute agreement
|
|
196
|
+
# How unanimous the matching cases are, from 0 to 1: the share of them that
|
|
197
|
+
# decided this way, ignoring how many there are. Always at least 0.8 when a ruling
|
|
198
|
+
# is returned — below that the casebook reports a disagreement instead of picking
|
|
199
|
+
# a side — so it tells you how clean the consensus was, and is not a threshold to
|
|
200
|
+
# re-apply yourself.
|
|
201
|
+
#
|
|
202
|
+
# @return [Float]
|
|
203
|
+
required :agreement, Float
|
|
204
|
+
|
|
205
|
+
# @!attribute case_count
|
|
206
|
+
# How many of your past cases backed this ruling.
|
|
207
|
+
#
|
|
208
|
+
# @return [Float]
|
|
209
|
+
required :case_count, Float
|
|
210
|
+
|
|
211
|
+
# @!attribute confidence
|
|
212
|
+
# How strongly the casebook holds this ruling, from 0 to 1: the agreement scaled
|
|
213
|
+
# by how much evidence backs it, so a handful of close, recent cases outweighs one
|
|
214
|
+
# distant one. Older cases count for less, halving in weight roughly every 180
|
|
215
|
+
# days. This is the number to use in rules when you want a strength condition.
|
|
216
|
+
#
|
|
217
|
+
# @return [Float]
|
|
218
|
+
required :confidence, Float
|
|
219
|
+
|
|
220
|
+
# @!attribute similarity
|
|
221
|
+
# How close the nearest matching case is, from 0 to 1. 1 means the content is
|
|
222
|
+
# identical to something you have already decided.
|
|
223
|
+
#
|
|
224
|
+
# @return [Float]
|
|
225
|
+
required :similarity, Float
|
|
226
|
+
|
|
227
|
+
# @!attribute topic
|
|
228
|
+
# The topic the closest matching case is filed under, or null when it has not been
|
|
229
|
+
# grouped into one yet.
|
|
230
|
+
#
|
|
231
|
+
# @return [ModerationAPI::Models::ContentSubmitResponse::Casebook::Topic, nil]
|
|
232
|
+
required :topic, -> { ModerationAPI::Models::ContentSubmitResponse::Casebook::Topic }, nil?: true
|
|
233
|
+
|
|
234
|
+
# @!attribute verdict
|
|
235
|
+
# The ruling your past decisions point to for this content.
|
|
236
|
+
#
|
|
237
|
+
# @return [Symbol, ModerationAPI::Models::ContentSubmitResponse::Casebook::Verdict]
|
|
238
|
+
required :verdict, enum: -> { ModerationAPI::Models::ContentSubmitResponse::Casebook::Verdict }
|
|
239
|
+
|
|
240
|
+
# @!method initialize(agreement:, case_count:, confidence:, similarity:, topic:, verdict:)
|
|
241
|
+
# Some parameter documentations has been truncated, see
|
|
242
|
+
# {ModerationAPI::Models::ContentSubmitResponse::Casebook} for more details.
|
|
243
|
+
#
|
|
244
|
+
# What your casebook — the record of your past moderation decisions — found for
|
|
245
|
+
# this content, or null when it had nothing close enough to say, when the matching
|
|
246
|
+
# cases disagreed, or when casebook lookups are not switched on for this channel.
|
|
247
|
+
# Reports what the casebook found; whether it decided the outcome is shown in
|
|
248
|
+
# `recommendation`, where a higher-priority rule may have settled the item first.
|
|
249
|
+
#
|
|
250
|
+
# @param agreement [Float] How unanimous the matching cases are, from 0 to 1: the share of them that decide
|
|
251
|
+
#
|
|
252
|
+
# @param case_count [Float] How many of your past cases backed this ruling.
|
|
253
|
+
#
|
|
254
|
+
# @param confidence [Float] How strongly the casebook holds this ruling, from 0 to 1: the agreement scaled b
|
|
255
|
+
#
|
|
256
|
+
# @param similarity [Float] How close the nearest matching case is, from 0 to 1. 1 means the content is iden
|
|
257
|
+
#
|
|
258
|
+
# @param topic [ModerationAPI::Models::ContentSubmitResponse::Casebook::Topic, nil] The topic the closest matching case is filed under, or null when it has not been
|
|
259
|
+
#
|
|
260
|
+
# @param verdict [Symbol, ModerationAPI::Models::ContentSubmitResponse::Casebook::Verdict] The ruling your past decisions point to for this content.
|
|
261
|
+
|
|
262
|
+
# @see ModerationAPI::Models::ContentSubmitResponse::Casebook#topic
|
|
263
|
+
class Topic < ModerationAPI::Internal::Type::BaseModel
|
|
264
|
+
# @!attribute id
|
|
265
|
+
#
|
|
266
|
+
# @return [String]
|
|
267
|
+
required :id, String
|
|
268
|
+
|
|
269
|
+
# @!attribute label
|
|
270
|
+
#
|
|
271
|
+
# @return [String]
|
|
272
|
+
required :label, String
|
|
273
|
+
|
|
274
|
+
# @!method initialize(id:, label:)
|
|
275
|
+
# The topic the closest matching case is filed under, or null when it has not been
|
|
276
|
+
# grouped into one yet.
|
|
277
|
+
#
|
|
278
|
+
# @param id [String]
|
|
279
|
+
# @param label [String]
|
|
280
|
+
end
|
|
281
|
+
|
|
282
|
+
# The ruling your past decisions point to for this content.
|
|
283
|
+
#
|
|
284
|
+
# @see ModerationAPI::Models::ContentSubmitResponse::Casebook#verdict
|
|
285
|
+
module Verdict
|
|
286
|
+
extend ModerationAPI::Internal::Type::Enum
|
|
287
|
+
|
|
288
|
+
ALLOW = :allow
|
|
289
|
+
REJECT = :reject
|
|
290
|
+
|
|
291
|
+
# @!method self.values
|
|
292
|
+
# @return [Array<Symbol>]
|
|
293
|
+
end
|
|
294
|
+
end
|
|
295
|
+
|
|
181
296
|
# @see ModerationAPI::Models::ContentSubmitResponse#content
|
|
182
297
|
class Content < ModerationAPI::Internal::Type::BaseModel
|
|
183
298
|
# @!attribute id
|
|
@@ -935,6 +1050,8 @@ module ModerationAPI
|
|
|
935
1050
|
|
|
936
1051
|
variant const: -> { ModerationAPI::Models::ContentSubmitResponse::Recommendation::ReasonCode::CLIENT_OVERRIDE }
|
|
937
1052
|
|
|
1053
|
+
variant const: -> { ModerationAPI::Models::ContentSubmitResponse::Recommendation::ReasonCode::CASEBOOK_MATCH }
|
|
1054
|
+
|
|
938
1055
|
variant String
|
|
939
1056
|
|
|
940
1057
|
# @!method self.variants
|
|
@@ -956,6 +1073,7 @@ module ModerationAPI
|
|
|
956
1073
|
RULE_DEFAULT = :rule_default
|
|
957
1074
|
RULE_FALLBACK = :rule_fallback
|
|
958
1075
|
CLIENT_OVERRIDE = :client_override
|
|
1076
|
+
CASEBOOK_MATCH = :casebook_match
|
|
959
1077
|
|
|
960
1078
|
# @!endgroup
|
|
961
1079
|
end
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module ModerationAPI
|
|
4
|
+
module Models
|
|
5
|
+
# @see ModerationAPI::Resources::Webhooks#create
|
|
6
|
+
class WebhookCreateParams < ModerationAPI::Internal::Type::BaseModel
|
|
7
|
+
extend ModerationAPI::Internal::Type::RequestParameters::Converter
|
|
8
|
+
include ModerationAPI::Internal::Type::RequestParameters
|
|
9
|
+
|
|
10
|
+
# @!attribute event_types
|
|
11
|
+
# Event types this webhook subscribes to. One webhook URL receives all events you
|
|
12
|
+
# list here.
|
|
13
|
+
#
|
|
14
|
+
# @return [Array<Symbol, ModerationAPI::Models::WebhookCreateParams::EventType>]
|
|
15
|
+
required :event_types,
|
|
16
|
+
-> {
|
|
17
|
+
ModerationAPI::Internal::Type::ArrayOf[enum: ModerationAPI::WebhookCreateParams::EventType]
|
|
18
|
+
},
|
|
19
|
+
api_name: :eventTypes
|
|
20
|
+
|
|
21
|
+
# @!attribute name
|
|
22
|
+
# The webhook's name, used to identify it in the dashboard
|
|
23
|
+
#
|
|
24
|
+
# @return [String]
|
|
25
|
+
required :name, String
|
|
26
|
+
|
|
27
|
+
# @!attribute url
|
|
28
|
+
# The webhook's URL. We'll call this URL when an event occurs.
|
|
29
|
+
#
|
|
30
|
+
# @return [String]
|
|
31
|
+
required :url, String
|
|
32
|
+
|
|
33
|
+
# @!attribute description
|
|
34
|
+
# The webhook's description
|
|
35
|
+
#
|
|
36
|
+
# @return [String, nil]
|
|
37
|
+
optional :description, String, nil?: true
|
|
38
|
+
|
|
39
|
+
# @!method initialize(event_types:, name:, url:, description: nil, request_options: {})
|
|
40
|
+
# Some parameter documentations has been truncated, see
|
|
41
|
+
# {ModerationAPI::Models::WebhookCreateParams} for more details.
|
|
42
|
+
#
|
|
43
|
+
# @param event_types [Array<Symbol, ModerationAPI::Models::WebhookCreateParams::EventType>] Event types this webhook subscribes to. One webhook URL receives all events you
|
|
44
|
+
#
|
|
45
|
+
# @param name [String] The webhook's name, used to identify it in the dashboard
|
|
46
|
+
#
|
|
47
|
+
# @param url [String] The webhook's URL. We'll call this URL when an event occurs.
|
|
48
|
+
#
|
|
49
|
+
# @param description [String, nil] The webhook's description
|
|
50
|
+
#
|
|
51
|
+
# @param request_options [ModerationAPI::RequestOptions, Hash{Symbol=>Object}]
|
|
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
|
+
# @!method self.values
|
|
69
|
+
# @return [Array<Symbol>]
|
|
70
|
+
end
|
|
71
|
+
end
|
|
72
|
+
end
|
|
73
|
+
end
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module ModerationAPI
|
|
4
|
+
module Models
|
|
5
|
+
# @see ModerationAPI::Resources::Webhooks#create
|
|
6
|
+
class WebhookCreateResponse < ModerationAPI::Internal::Type::BaseModel
|
|
7
|
+
# @!attribute id
|
|
8
|
+
# The ID of the webhook.
|
|
9
|
+
#
|
|
10
|
+
# @return [String]
|
|
11
|
+
required :id, String
|
|
12
|
+
|
|
13
|
+
# @!attribute created_at
|
|
14
|
+
# The date the webhook was created.
|
|
15
|
+
#
|
|
16
|
+
# @return [String]
|
|
17
|
+
required :created_at, String, api_name: :createdAt
|
|
18
|
+
|
|
19
|
+
# @!attribute event_types
|
|
20
|
+
# Event types this webhook subscribes to. Empty for legacy v1 webhooks, which
|
|
21
|
+
# subscribe via their single deprecated `type` instead.
|
|
22
|
+
#
|
|
23
|
+
# @return [Array<Symbol, ModerationAPI::Models::WebhookCreateResponse::EventType>]
|
|
24
|
+
required :event_types,
|
|
25
|
+
-> { ModerationAPI::Internal::Type::ArrayOf[enum: ModerationAPI::Models::WebhookCreateResponse::EventType] },
|
|
26
|
+
api_name: :eventTypes
|
|
27
|
+
|
|
28
|
+
# @!attribute name
|
|
29
|
+
# The webhook's name.
|
|
30
|
+
#
|
|
31
|
+
# @return [String]
|
|
32
|
+
required :name, String
|
|
33
|
+
|
|
34
|
+
# @!attribute payload_version
|
|
35
|
+
# Payload envelope version. V2 is the Stripe-style envelope; V1 is the legacy flat
|
|
36
|
+
# shape and is read-only via this API.
|
|
37
|
+
#
|
|
38
|
+
# @return [Symbol, ModerationAPI::Models::WebhookCreateResponse::PayloadVersion]
|
|
39
|
+
required :payload_version,
|
|
40
|
+
enum: -> { ModerationAPI::Models::WebhookCreateResponse::PayloadVersion },
|
|
41
|
+
api_name: :payloadVersion
|
|
42
|
+
|
|
43
|
+
# @!attribute url
|
|
44
|
+
# The URL we call when a subscribed event occurs.
|
|
45
|
+
#
|
|
46
|
+
# @return [String]
|
|
47
|
+
required :url, String
|
|
48
|
+
|
|
49
|
+
# @!attribute description
|
|
50
|
+
# The webhook's description.
|
|
51
|
+
#
|
|
52
|
+
# @return [String, nil]
|
|
53
|
+
optional :description, String, nil?: true
|
|
54
|
+
|
|
55
|
+
# @!method initialize(id:, created_at:, event_types:, name:, payload_version:, url:, description: nil)
|
|
56
|
+
# Some parameter documentations has been truncated, see
|
|
57
|
+
# {ModerationAPI::Models::WebhookCreateResponse} for more details.
|
|
58
|
+
#
|
|
59
|
+
# @param id [String] The ID of the webhook.
|
|
60
|
+
#
|
|
61
|
+
# @param created_at [String] The date the webhook was created.
|
|
62
|
+
#
|
|
63
|
+
# @param event_types [Array<Symbol, ModerationAPI::Models::WebhookCreateResponse::EventType>] Event types this webhook subscribes to. Empty for legacy v1 webhooks, which subs
|
|
64
|
+
#
|
|
65
|
+
# @param name [String] The webhook's name.
|
|
66
|
+
#
|
|
67
|
+
# @param payload_version [Symbol, ModerationAPI::Models::WebhookCreateResponse::PayloadVersion] Payload envelope version. V2 is the Stripe-style envelope; V1 is the legacy flat
|
|
68
|
+
#
|
|
69
|
+
# @param url [String] The URL we call when a subscribed event occurs.
|
|
70
|
+
#
|
|
71
|
+
# @param description [String, nil] The webhook's description.
|
|
72
|
+
|
|
73
|
+
module EventType
|
|
74
|
+
extend ModerationAPI::Internal::Type::Enum
|
|
75
|
+
|
|
76
|
+
QUEUE_ITEM_NEW = :QUEUE_ITEM_NEW
|
|
77
|
+
QUEUE_ITEM_COMPLETED = :QUEUE_ITEM_COMPLETED
|
|
78
|
+
QUEUE_ITEM_ACTION = :QUEUE_ITEM_ACTION
|
|
79
|
+
QUEUE_ITEM_REJECTED = :QUEUE_ITEM_REJECTED
|
|
80
|
+
QUEUE_ITEM_ALLOWED = :QUEUE_ITEM_ALLOWED
|
|
81
|
+
AUTHOR_BLOCKED = :AUTHOR_BLOCKED
|
|
82
|
+
AUTHOR_UNBLOCKED = :AUTHOR_UNBLOCKED
|
|
83
|
+
AUTHOR_SUSPENDED = :AUTHOR_SUSPENDED
|
|
84
|
+
AUTHOR_UPDATED = :AUTHOR_UPDATED
|
|
85
|
+
AUTHOR_TRUST_LEVEL_CHANGED = :AUTHOR_TRUST_LEVEL_CHANGED
|
|
86
|
+
AUTHOR_ACTION = :AUTHOR_ACTION
|
|
87
|
+
|
|
88
|
+
# @!method self.values
|
|
89
|
+
# @return [Array<Symbol>]
|
|
90
|
+
end
|
|
91
|
+
|
|
92
|
+
# Payload envelope version. V2 is the Stripe-style envelope; V1 is the legacy flat
|
|
93
|
+
# shape and is read-only via this API.
|
|
94
|
+
#
|
|
95
|
+
# @see ModerationAPI::Models::WebhookCreateResponse#payload_version
|
|
96
|
+
module PayloadVersion
|
|
97
|
+
extend ModerationAPI::Internal::Type::Enum
|
|
98
|
+
|
|
99
|
+
V1 = :V1
|
|
100
|
+
V2 = :V2
|
|
101
|
+
|
|
102
|
+
# @!method self.values
|
|
103
|
+
# @return [Array<Symbol>]
|
|
104
|
+
end
|
|
105
|
+
end
|
|
106
|
+
end
|
|
107
|
+
end
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module ModerationAPI
|
|
4
|
+
module Models
|
|
5
|
+
# @see ModerationAPI::Resources::Webhooks#delete
|
|
6
|
+
class WebhookDeleteParams < ModerationAPI::Internal::Type::BaseModel
|
|
7
|
+
extend ModerationAPI::Internal::Type::RequestParameters::Converter
|
|
8
|
+
include ModerationAPI::Internal::Type::RequestParameters
|
|
9
|
+
|
|
10
|
+
# @!attribute id
|
|
11
|
+
# The ID of the webhook to delete.
|
|
12
|
+
#
|
|
13
|
+
# @return [String]
|
|
14
|
+
required :id, String
|
|
15
|
+
|
|
16
|
+
# @!method initialize(id:, request_options: {})
|
|
17
|
+
# @param id [String] The ID of the webhook to delete.
|
|
18
|
+
#
|
|
19
|
+
# @param request_options [ModerationAPI::RequestOptions, Hash{Symbol=>Object}]
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
end
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module ModerationAPI
|
|
4
|
+
module Models
|
|
5
|
+
# @see ModerationAPI::Resources::Webhooks#delete
|
|
6
|
+
class WebhookDeleteResponse < ModerationAPI::Internal::Type::BaseModel
|
|
7
|
+
# @!attribute id
|
|
8
|
+
# The ID of the webhook.
|
|
9
|
+
#
|
|
10
|
+
# @return [String]
|
|
11
|
+
required :id, String
|
|
12
|
+
|
|
13
|
+
# @!attribute deleted
|
|
14
|
+
# Whether the webhook was deleted.
|
|
15
|
+
#
|
|
16
|
+
# @return [Boolean]
|
|
17
|
+
required :deleted, ModerationAPI::Internal::Type::Boolean
|
|
18
|
+
|
|
19
|
+
# @!method initialize(id:, deleted:)
|
|
20
|
+
# @param id [String] The ID of the webhook.
|
|
21
|
+
#
|
|
22
|
+
# @param deleted [Boolean] Whether the webhook was deleted.
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
end
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module ModerationAPI
|
|
4
|
+
module Models
|
|
5
|
+
# @see ModerationAPI::Resources::Webhooks#list
|
|
6
|
+
class WebhookListParams < ModerationAPI::Internal::Type::BaseModel
|
|
7
|
+
extend ModerationAPI::Internal::Type::RequestParameters::Converter
|
|
8
|
+
include ModerationAPI::Internal::Type::RequestParameters
|
|
9
|
+
|
|
10
|
+
# @!method initialize(request_options: {})
|
|
11
|
+
# @param request_options [ModerationAPI::RequestOptions, Hash{Symbol=>Object}]
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
end
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module ModerationAPI
|
|
4
|
+
module Models
|
|
5
|
+
class WebhookListResponseItem < ModerationAPI::Internal::Type::BaseModel
|
|
6
|
+
# @!attribute id
|
|
7
|
+
# The ID of the webhook.
|
|
8
|
+
#
|
|
9
|
+
# @return [String]
|
|
10
|
+
required :id, String
|
|
11
|
+
|
|
12
|
+
# @!attribute created_at
|
|
13
|
+
# The date the webhook was created.
|
|
14
|
+
#
|
|
15
|
+
# @return [String]
|
|
16
|
+
required :created_at, String, api_name: :createdAt
|
|
17
|
+
|
|
18
|
+
# @!attribute event_types
|
|
19
|
+
# Event types this webhook subscribes to. Empty for legacy v1 webhooks, which
|
|
20
|
+
# subscribe via their single deprecated `type` instead.
|
|
21
|
+
#
|
|
22
|
+
# @return [Array<Symbol, ModerationAPI::Models::WebhookListResponseItem::EventType>]
|
|
23
|
+
required :event_types,
|
|
24
|
+
-> { ModerationAPI::Internal::Type::ArrayOf[enum: ModerationAPI::Models::WebhookListResponseItem::EventType] },
|
|
25
|
+
api_name: :eventTypes
|
|
26
|
+
|
|
27
|
+
# @!attribute name
|
|
28
|
+
# The webhook's name.
|
|
29
|
+
#
|
|
30
|
+
# @return [String]
|
|
31
|
+
required :name, String
|
|
32
|
+
|
|
33
|
+
# @!attribute payload_version
|
|
34
|
+
# Payload envelope version. V2 is the Stripe-style envelope; V1 is the legacy flat
|
|
35
|
+
# shape and is read-only via this API.
|
|
36
|
+
#
|
|
37
|
+
# @return [Symbol, ModerationAPI::Models::WebhookListResponseItem::PayloadVersion]
|
|
38
|
+
required :payload_version,
|
|
39
|
+
enum: -> { ModerationAPI::Models::WebhookListResponseItem::PayloadVersion },
|
|
40
|
+
api_name: :payloadVersion
|
|
41
|
+
|
|
42
|
+
# @!attribute url
|
|
43
|
+
# The URL we call when a subscribed event occurs.
|
|
44
|
+
#
|
|
45
|
+
# @return [String]
|
|
46
|
+
required :url, String
|
|
47
|
+
|
|
48
|
+
# @!attribute description
|
|
49
|
+
# The webhook's description.
|
|
50
|
+
#
|
|
51
|
+
# @return [String, nil]
|
|
52
|
+
optional :description, String, nil?: true
|
|
53
|
+
|
|
54
|
+
# @!method initialize(id:, created_at:, event_types:, name:, payload_version:, url:, description: nil)
|
|
55
|
+
# Some parameter documentations has been truncated, see
|
|
56
|
+
# {ModerationAPI::Models::WebhookListResponseItem} for more details.
|
|
57
|
+
#
|
|
58
|
+
# @param id [String] The ID of the webhook.
|
|
59
|
+
#
|
|
60
|
+
# @param created_at [String] The date the webhook was created.
|
|
61
|
+
#
|
|
62
|
+
# @param event_types [Array<Symbol, ModerationAPI::Models::WebhookListResponseItem::EventType>] Event types this webhook subscribes to. Empty for legacy v1 webhooks, which subs
|
|
63
|
+
#
|
|
64
|
+
# @param name [String] The webhook's name.
|
|
65
|
+
#
|
|
66
|
+
# @param payload_version [Symbol, ModerationAPI::Models::WebhookListResponseItem::PayloadVersion] Payload envelope version. V2 is the Stripe-style envelope; V1 is the legacy flat
|
|
67
|
+
#
|
|
68
|
+
# @param url [String] The URL we call when a subscribed event occurs.
|
|
69
|
+
#
|
|
70
|
+
# @param description [String, nil] The webhook's description.
|
|
71
|
+
|
|
72
|
+
module EventType
|
|
73
|
+
extend ModerationAPI::Internal::Type::Enum
|
|
74
|
+
|
|
75
|
+
QUEUE_ITEM_NEW = :QUEUE_ITEM_NEW
|
|
76
|
+
QUEUE_ITEM_COMPLETED = :QUEUE_ITEM_COMPLETED
|
|
77
|
+
QUEUE_ITEM_ACTION = :QUEUE_ITEM_ACTION
|
|
78
|
+
QUEUE_ITEM_REJECTED = :QUEUE_ITEM_REJECTED
|
|
79
|
+
QUEUE_ITEM_ALLOWED = :QUEUE_ITEM_ALLOWED
|
|
80
|
+
AUTHOR_BLOCKED = :AUTHOR_BLOCKED
|
|
81
|
+
AUTHOR_UNBLOCKED = :AUTHOR_UNBLOCKED
|
|
82
|
+
AUTHOR_SUSPENDED = :AUTHOR_SUSPENDED
|
|
83
|
+
AUTHOR_UPDATED = :AUTHOR_UPDATED
|
|
84
|
+
AUTHOR_TRUST_LEVEL_CHANGED = :AUTHOR_TRUST_LEVEL_CHANGED
|
|
85
|
+
AUTHOR_ACTION = :AUTHOR_ACTION
|
|
86
|
+
|
|
87
|
+
# @!method self.values
|
|
88
|
+
# @return [Array<Symbol>]
|
|
89
|
+
end
|
|
90
|
+
|
|
91
|
+
# Payload envelope version. V2 is the Stripe-style envelope; V1 is the legacy flat
|
|
92
|
+
# shape and is read-only via this API.
|
|
93
|
+
#
|
|
94
|
+
# @see ModerationAPI::Models::WebhookListResponseItem#payload_version
|
|
95
|
+
module PayloadVersion
|
|
96
|
+
extend ModerationAPI::Internal::Type::Enum
|
|
97
|
+
|
|
98
|
+
V1 = :V1
|
|
99
|
+
V2 = :V2
|
|
100
|
+
|
|
101
|
+
# @!method self.values
|
|
102
|
+
# @return [Array<Symbol>]
|
|
103
|
+
end
|
|
104
|
+
end
|
|
105
|
+
|
|
106
|
+
# @type [ModerationAPI::Internal::Type::Converter]
|
|
107
|
+
WebhookListResponse =
|
|
108
|
+
ModerationAPI::Internal::Type::ArrayOf[-> { ModerationAPI::Models::WebhookListResponseItem }]
|
|
109
|
+
end
|
|
110
|
+
end
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module ModerationAPI
|
|
4
|
+
module Models
|
|
5
|
+
# @see ModerationAPI::Resources::Webhooks#retrieve
|
|
6
|
+
class WebhookRetrieveParams < ModerationAPI::Internal::Type::BaseModel
|
|
7
|
+
extend ModerationAPI::Internal::Type::RequestParameters::Converter
|
|
8
|
+
include ModerationAPI::Internal::Type::RequestParameters
|
|
9
|
+
|
|
10
|
+
# @!attribute id
|
|
11
|
+
# The ID of the webhook to get.
|
|
12
|
+
#
|
|
13
|
+
# @return [String]
|
|
14
|
+
required :id, String
|
|
15
|
+
|
|
16
|
+
# @!method initialize(id:, request_options: {})
|
|
17
|
+
# @param id [String] The ID of the webhook to get.
|
|
18
|
+
#
|
|
19
|
+
# @param request_options [ModerationAPI::RequestOptions, Hash{Symbol=>Object}]
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
end
|