moderation_api 2.33.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 +8 -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/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/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/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: b6c81ee2a9da518fa7c2d46dd6de06482739a80d3c7bc72e415c459e049b5118
|
|
4
|
+
data.tar.gz: 30591937048d8e2662f1b4106fa0a1e1478220759995543efd8305a24e31fbc0
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: f22f683cf8f5a19e6f672ea2823869a529aae0a159ad30a7eda1e47fb1ca5f2714d1bab28b21b05af334ad8fa645797cf9efbcddf709bfa5f18fb86e13f5140e
|
|
7
|
+
data.tar.gz: 0e6cd98b619b02bbdcfa571fcae9f9903c8062f95554f1673649c5c8341190c3d321a15fcaffcde5eeb7b1c5fbd87f35f7cfe00e8dd4df04d0db1b4df6786c93
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 2.34.0 (2026-08-20)
|
|
4
|
+
|
|
5
|
+
Full Changelog: [v2.33.0...v2.34.0](https://github.com/moderation-api/sdk-ruby/compare/v2.33.0...v2.34.0)
|
|
6
|
+
|
|
7
|
+
### Features
|
|
8
|
+
|
|
9
|
+
* **api:** webhooks and stream ([ff603e8](https://github.com/moderation-api/sdk-ruby/commit/ff603e825cf163e821282148124e784545618518))
|
|
10
|
+
|
|
3
11
|
## 2.33.0 (2026-08-14)
|
|
4
12
|
|
|
5
13
|
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
|
|
@@ -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
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module ModerationAPI
|
|
4
|
+
module Models
|
|
5
|
+
# @see ModerationAPI::Resources::Webhooks#retrieve
|
|
6
|
+
class WebhookRetrieveResponse < 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::WebhookRetrieveResponse::EventType>]
|
|
24
|
+
required :event_types,
|
|
25
|
+
-> { ModerationAPI::Internal::Type::ArrayOf[enum: ModerationAPI::Models::WebhookRetrieveResponse::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::WebhookRetrieveResponse::PayloadVersion]
|
|
39
|
+
required :payload_version,
|
|
40
|
+
enum: -> { ModerationAPI::Models::WebhookRetrieveResponse::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::WebhookRetrieveResponse} 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::WebhookRetrieveResponse::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::WebhookRetrieveResponse::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::WebhookRetrieveResponse#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,14 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module ModerationAPI
|
|
4
|
+
module Models
|
|
5
|
+
# @see ModerationAPI::Resources::WebhookSecret#retrieve
|
|
6
|
+
class WebhookSecretRetrieveParams < 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,22 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module ModerationAPI
|
|
4
|
+
module Models
|
|
5
|
+
# @see ModerationAPI::Resources::WebhookSecret#retrieve
|
|
6
|
+
class WebhookSecretRetrieveResponse < ModerationAPI::Internal::Type::BaseModel
|
|
7
|
+
# @!attribute secret
|
|
8
|
+
# The signing secret for this project. Every webhook delivery is signed with
|
|
9
|
+
# HMAC-SHA256 over the raw JSON body, hex-encoded in the `modapi-signature`
|
|
10
|
+
# header.
|
|
11
|
+
#
|
|
12
|
+
# @return [String]
|
|
13
|
+
required :secret, String
|
|
14
|
+
|
|
15
|
+
# @!method initialize(secret:)
|
|
16
|
+
# Some parameter documentations has been truncated, see
|
|
17
|
+
# {ModerationAPI::Models::WebhookSecretRetrieveResponse} for more details.
|
|
18
|
+
#
|
|
19
|
+
# @param secret [String] The signing secret for this project. Every webhook delivery is signed with HMAC-
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
end
|