moderation_api 3.2.0 → 3.4.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.
Files changed (64) hide show
  1. checksums.yaml +4 -4
  2. data/lib/moderation_api/authors.rb +759 -0
  3. data/lib/moderation_api/content.rb +506 -0
  4. data/lib/moderation_api/items.rb +4 -4
  5. data/lib/moderation_api/models/components/queueitem.rb +2 -2
  6. data/lib/moderation_api/models/operations/allowcontent_request.rb +45 -0
  7. data/lib/moderation_api/models/operations/allowcontent_request.rbi +26 -0
  8. data/lib/moderation_api/models/operations/allowcontent_requestbody.rb +67 -0
  9. data/lib/moderation_api/models/operations/allowcontent_requestbody.rbi +32 -0
  10. data/lib/moderation_api/models/operations/allowcontent_response.rb +51 -0
  11. data/lib/moderation_api/models/operations/allowcontent_response.rbi +32 -0
  12. data/lib/moderation_api/models/operations/allowcontent_responsebody.rb +35 -0
  13. data/lib/moderation_api/models/operations/allowcontent_responsebody.rbi +14 -0
  14. data/lib/moderation_api/models/operations/blockauthor_request.rb +45 -0
  15. data/lib/moderation_api/models/operations/blockauthor_request.rbi +26 -0
  16. data/lib/moderation_api/models/operations/blockauthor_requestbody.rb +35 -0
  17. data/lib/moderation_api/models/operations/blockauthor_requestbody.rbi +14 -0
  18. data/lib/moderation_api/models/operations/blockauthor_response.rb +51 -0
  19. data/lib/moderation_api/models/operations/blockauthor_response.rbi +32 -0
  20. data/lib/moderation_api/models/operations/blockauthor_responsebody.rb +35 -0
  21. data/lib/moderation_api/models/operations/blockauthor_responsebody.rbi +14 -0
  22. data/lib/moderation_api/models/operations/deletewordlist_request.rb +39 -0
  23. data/lib/moderation_api/models/operations/deletewordlist_request.rbi +20 -0
  24. data/lib/moderation_api/models/operations/deletewordlist_response.rb +51 -0
  25. data/lib/moderation_api/models/operations/deletewordlist_response.rbi +32 -0
  26. data/lib/moderation_api/models/operations/deletewordlist_responsebody.rb +47 -0
  27. data/lib/moderation_api/models/operations/deletewordlist_responsebody.rbi +26 -0
  28. data/lib/moderation_api/models/operations/executeaction_requestbody.rb +29 -2
  29. data/lib/moderation_api/models/operations/executeaction_requestbody.rbi +12 -0
  30. data/lib/moderation_api/models/operations/rejectcontent_request.rb +45 -0
  31. data/lib/moderation_api/models/operations/rejectcontent_request.rbi +26 -0
  32. data/lib/moderation_api/models/operations/rejectcontent_requestbody.rb +67 -0
  33. data/lib/moderation_api/models/operations/rejectcontent_requestbody.rbi +32 -0
  34. data/lib/moderation_api/models/operations/rejectcontent_response.rb +51 -0
  35. data/lib/moderation_api/models/operations/rejectcontent_response.rbi +32 -0
  36. data/lib/moderation_api/models/operations/rejectcontent_responsebody.rb +35 -0
  37. data/lib/moderation_api/models/operations/rejectcontent_responsebody.rbi +14 -0
  38. data/lib/moderation_api/models/operations/resolvequeueitem_request.rb +1 -1
  39. data/lib/moderation_api/models/operations/resolvequeueitems_requestbody.rb +1 -1
  40. data/lib/moderation_api/models/operations/resolvequeueitems_responsebody.rb +1 -1
  41. data/lib/moderation_api/models/operations/suspendauthor_request.rb +45 -0
  42. data/lib/moderation_api/models/operations/suspendauthor_request.rbi +26 -0
  43. data/lib/moderation_api/models/operations/suspendauthor_requestbody.rb +43 -0
  44. data/lib/moderation_api/models/operations/suspendauthor_requestbody.rbi +20 -0
  45. data/lib/moderation_api/models/operations/suspendauthor_response.rb +51 -0
  46. data/lib/moderation_api/models/operations/suspendauthor_response.rbi +32 -0
  47. data/lib/moderation_api/models/operations/suspendauthor_responsebody.rb +35 -0
  48. data/lib/moderation_api/models/operations/suspendauthor_responsebody.rbi +14 -0
  49. data/lib/moderation_api/models/operations/unblockauthor_request.rb +45 -0
  50. data/lib/moderation_api/models/operations/unblockauthor_request.rbi +26 -0
  51. data/lib/moderation_api/models/operations/unblockauthor_requestbody.rb +35 -0
  52. data/lib/moderation_api/models/operations/unblockauthor_requestbody.rbi +14 -0
  53. data/lib/moderation_api/models/operations/unblockauthor_response.rb +51 -0
  54. data/lib/moderation_api/models/operations/unblockauthor_response.rbi +32 -0
  55. data/lib/moderation_api/models/operations/unblockauthor_responsebody.rb +35 -0
  56. data/lib/moderation_api/models/operations/unblockauthor_responsebody.rbi +14 -0
  57. data/lib/moderation_api/models/operations/unicode_spoofing.rb +1 -1
  58. data/lib/moderation_api/models/operations/unresolvequeueitem_request.rb +1 -1
  59. data/lib/moderation_api/models/operations.rb +23 -0
  60. data/lib/moderation_api/moderationapi.rb +3 -3
  61. data/lib/moderation_api/sdkconfiguration.rb +2 -2
  62. data/lib/moderation_api/wordlist.rb +216 -0
  63. data/lib/moderation_api.rb +1 -1
  64. metadata +48 -2
@@ -0,0 +1,35 @@
1
+ # Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
2
+
3
+ # typed: true
4
+ # frozen_string_literal: true
5
+
6
+ module ModerationApi
7
+ module Models
8
+ module Operations
9
+ # Execution result
10
+ class SuspendAuthorResponseBody
11
+ extend T::Sig
12
+ include Crystalline::MetadataFields
13
+
14
+ # Whether the action was executed successfully
15
+ field(
16
+ :success,
17
+ Crystalline::Boolean.new,
18
+ {'format_json': {'letter_case': ::ModerationApi::Utils.field_name("success"), required: true}}
19
+ )
20
+
21
+ sig { params(success: T::Boolean).void }
22
+ def initialize(success:)
23
+ @success = success
24
+ end
25
+
26
+ sig { params(other: T.untyped).returns(T::Boolean) }
27
+ def ==(other)
28
+ return false unless other.is_a?(self.class)
29
+ return false unless @success == other.success
30
+ true
31
+ end
32
+ end
33
+ end
34
+ end
35
+ end
@@ -0,0 +1,14 @@
1
+ # typed: true
2
+ # frozen_string_literal: true
3
+
4
+ class ModerationApi::Models::Operations::SuspendAuthorResponseBody
5
+ extend ::Crystalline::MetadataFields::ClassMethods
6
+ end
7
+
8
+ class ModerationApi::Models::Operations::SuspendAuthorResponseBody
9
+ def success
10
+ end
11
+
12
+ def success=(str_)
13
+ end
14
+ end
@@ -0,0 +1,45 @@
1
+ # Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
2
+
3
+ # typed: true
4
+ # frozen_string_literal: true
5
+
6
+ module ModerationApi
7
+ module Models
8
+ module Operations
9
+
10
+ class UnblockAuthorRequest
11
+ extend T::Sig
12
+ include Crystalline::MetadataFields
13
+
14
+ # Either external ID or the ID assigned by moderation API.
15
+ field :id, ::String, {'path_param': {'field_name': "id", 'style': "simple", 'explode': false}}
16
+
17
+ field :body, Models::Operations::UnblockAuthorRequestBody, {'request': {'media_type': "application/json"}}
18
+ # The project to act on, by ID or name. Required with an organization key unless the key reaches only one project; list projects with GET /projects. A project key acts on its own project and needs no value: naming another one is an error.
19
+ field(
20
+ :project_id,
21
+ Crystalline::Nilable.new(::String),
22
+ {'header': {'field_name': "Project-Id", 'style': "simple", 'explode': false}}
23
+ )
24
+
25
+ sig {
26
+ params(id: ::String, body: Models::Operations::UnblockAuthorRequestBody, project_id: T.nilable(::String)).void
27
+ }
28
+ def initialize(id:, body:, project_id: nil)
29
+ @id = id
30
+ @body = body
31
+ @project_id = project_id
32
+ end
33
+
34
+ sig { params(other: T.untyped).returns(T::Boolean) }
35
+ def ==(other)
36
+ return false unless other.is_a?(self.class)
37
+ return false unless @id == other.id
38
+ return false unless @body == other.body
39
+ return false unless @project_id == other.project_id
40
+ true
41
+ end
42
+ end
43
+ end
44
+ end
45
+ end
@@ -0,0 +1,26 @@
1
+ # typed: true
2
+ # frozen_string_literal: true
3
+
4
+ class ModerationApi::Models::Operations::UnblockAuthorRequest
5
+ extend ::Crystalline::MetadataFields::ClassMethods
6
+ end
7
+
8
+ class ModerationApi::Models::Operations::UnblockAuthorRequest
9
+ def id
10
+ end
11
+
12
+ def id=(str_)
13
+ end
14
+
15
+ def body
16
+ end
17
+
18
+ def body=(str_)
19
+ end
20
+
21
+ def project_id
22
+ end
23
+
24
+ def project_id=(str_)
25
+ end
26
+ end
@@ -0,0 +1,35 @@
1
+ # Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
2
+
3
+ # typed: true
4
+ # frozen_string_literal: true
5
+
6
+ module ModerationApi
7
+ module Models
8
+ module Operations
9
+
10
+ class UnblockAuthorRequestBody
11
+ extend T::Sig
12
+ include Crystalline::MetadataFields
13
+
14
+ # Why the action was taken. Saved with the action and sent in the webhook event.
15
+ field(
16
+ :reason,
17
+ Crystalline::Nilable.new(::String),
18
+ {'format_json': {'letter_case': ::ModerationApi::Utils.field_name("reason")}}
19
+ )
20
+
21
+ sig { params(reason: T.nilable(::String)).void }
22
+ def initialize(reason: nil)
23
+ @reason = reason
24
+ end
25
+
26
+ sig { params(other: T.untyped).returns(T::Boolean) }
27
+ def ==(other)
28
+ return false unless other.is_a?(self.class)
29
+ return false unless @reason == other.reason
30
+ true
31
+ end
32
+ end
33
+ end
34
+ end
35
+ end
@@ -0,0 +1,14 @@
1
+ # typed: true
2
+ # frozen_string_literal: true
3
+
4
+ class ModerationApi::Models::Operations::UnblockAuthorRequestBody
5
+ extend ::Crystalline::MetadataFields::ClassMethods
6
+ end
7
+
8
+ class ModerationApi::Models::Operations::UnblockAuthorRequestBody
9
+ def reason
10
+ end
11
+
12
+ def reason=(str_)
13
+ end
14
+ end
@@ -0,0 +1,51 @@
1
+ # Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
2
+
3
+ # typed: true
4
+ # frozen_string_literal: true
5
+
6
+ module ModerationApi
7
+ module Models
8
+ module Operations
9
+
10
+ class UnblockAuthorResponse
11
+ extend T::Sig
12
+ include Crystalline::MetadataFields
13
+
14
+ # HTTP response content type for this operation
15
+ field :content_type, ::String
16
+ # HTTP response status code for this operation
17
+ field :status_code, ::Integer
18
+ # Raw HTTP response; suitable for custom response parsing
19
+ field :raw_response, ::Faraday::Response
20
+ # Action executed successfully
21
+ field :object, Crystalline::Nilable.new(Models::Operations::UnblockAuthorResponseBody)
22
+
23
+ sig {
24
+ params(
25
+ content_type: ::String,
26
+ status_code: ::Integer,
27
+ raw_response: ::Faraday::Response,
28
+ object: T.nilable(Models::Operations::UnblockAuthorResponseBody)
29
+ )
30
+ .void
31
+ }
32
+ def initialize(content_type:, status_code:, raw_response:, object: nil)
33
+ @content_type = content_type
34
+ @status_code = status_code
35
+ @raw_response = raw_response
36
+ @object = object
37
+ end
38
+
39
+ sig { params(other: T.untyped).returns(T::Boolean) }
40
+ def ==(other)
41
+ return false unless other.is_a?(self.class)
42
+ return false unless @content_type == other.content_type
43
+ return false unless @status_code == other.status_code
44
+ return false unless @raw_response == other.raw_response
45
+ return false unless @object == other.object
46
+ true
47
+ end
48
+ end
49
+ end
50
+ end
51
+ end
@@ -0,0 +1,32 @@
1
+ # typed: true
2
+ # frozen_string_literal: true
3
+
4
+ class ModerationApi::Models::Operations::UnblockAuthorResponse
5
+ extend ::Crystalline::MetadataFields::ClassMethods
6
+ end
7
+
8
+ class ModerationApi::Models::Operations::UnblockAuthorResponse
9
+ def content_type
10
+ end
11
+
12
+ def content_type=(str_)
13
+ end
14
+
15
+ def status_code
16
+ end
17
+
18
+ def status_code=(str_)
19
+ end
20
+
21
+ def raw_response
22
+ end
23
+
24
+ def raw_response=(str_)
25
+ end
26
+
27
+ def object
28
+ end
29
+
30
+ def object=(str_)
31
+ end
32
+ end
@@ -0,0 +1,35 @@
1
+ # Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
2
+
3
+ # typed: true
4
+ # frozen_string_literal: true
5
+
6
+ module ModerationApi
7
+ module Models
8
+ module Operations
9
+ # Execution result
10
+ class UnblockAuthorResponseBody
11
+ extend T::Sig
12
+ include Crystalline::MetadataFields
13
+
14
+ # Whether the action was executed successfully
15
+ field(
16
+ :success,
17
+ Crystalline::Boolean.new,
18
+ {'format_json': {'letter_case': ::ModerationApi::Utils.field_name("success"), required: true}}
19
+ )
20
+
21
+ sig { params(success: T::Boolean).void }
22
+ def initialize(success:)
23
+ @success = success
24
+ end
25
+
26
+ sig { params(other: T.untyped).returns(T::Boolean) }
27
+ def ==(other)
28
+ return false unless other.is_a?(self.class)
29
+ return false unless @success == other.success
30
+ true
31
+ end
32
+ end
33
+ end
34
+ end
35
+ end
@@ -0,0 +1,14 @@
1
+ # typed: true
2
+ # frozen_string_literal: true
3
+
4
+ class ModerationApi::Models::Operations::UnblockAuthorResponseBody
5
+ extend ::Crystalline::MetadataFields::ClassMethods
6
+ end
7
+
8
+ class ModerationApi::Models::Operations::UnblockAuthorResponseBody
9
+ def success
10
+ end
11
+
12
+ def success=(str_)
13
+ end
14
+ end
@@ -24,7 +24,7 @@ module ModerationApi
24
24
  )
25
25
 
26
26
  field :id, ::String, {'format_json': {'letter_case': ::ModerationApi::Utils.field_name("id"), required: true}}
27
- # Per-signal flag toggles. Omitted spoofing signals are enabled; encoding_damage defaults to off because decode damage (U+FFFD) marks a broken pipeline, not an attack. A disabled signal is still detected and reported as a label, but does not by itself flag the policy.
27
+ # Per-signal flag toggles. Omitted spoofing signals are enabled; encoding_damage defaults to off because decode damage (U+FFFD) marks a broken pipeline, not an attack, and hidden_lookalike and leetspeak default to off because they are opt-in. A disabled signal is still detected and reported as a label, but does not by itself flag the policy. Lookalike words are only spelled out in the cleaned text when their signal is enabled.
28
28
  field(
29
29
  :signals,
30
30
  Crystalline::Nilable.new(Crystalline::Hash.new(Symbol, Models::Operations::SignalsRequest)),
@@ -13,7 +13,7 @@ module ModerationApi
13
13
 
14
14
  # The queue ID.
15
15
  field :id, ::String, {'path_param': {'field_name': "id", 'style': "simple", 'explode': false}}
16
- # The item ID to unresolve.
16
+ # The item to unresolve: the item `id` from `GET /queue/{id}/items`, or the `contentId` you sent to `POST /moderate` (webhooks send it as `item.id`). For a content ID, the newest submission with that content ID is used, as the queue shows it.
17
17
  field :item_id, ::String, {'path_param': {'field_name': "itemId", 'style': "simple", 'explode': false}}
18
18
  # The project to act on, by ID or name. Required with an organization key unless the key reaches only one project; list projects with GET /projects. A project key acts on its own project and needs no value: naming another one is an error.
19
19
  field(
@@ -71,9 +71,17 @@ module ModerationApi
71
71
  autoload :AddWordlistWordsResponseBody, "moderation_api/models/operations/addwordlistwords_responsebody.rb"
72
72
  autoload :AddWordlistWordsRequest, "moderation_api/models/operations/addwordlistwords_request.rb"
73
73
  autoload :AddWordlistWordsResponse, "moderation_api/models/operations/addwordlistwords_response.rb"
74
+ autoload :AllowContentRequestBody, "moderation_api/models/operations/allowcontent_requestbody.rb"
75
+ autoload :AllowContentResponseBody, "moderation_api/models/operations/allowcontent_responsebody.rb"
76
+ autoload :AllowContentRequest, "moderation_api/models/operations/allowcontent_request.rb"
77
+ autoload :AllowContentResponse, "moderation_api/models/operations/allowcontent_response.rb"
74
78
  autoload :AuthorStatus, "moderation_api/models/operations/author_status.rb"
75
79
  autoload :Behavior, "moderation_api/models/operations/behavior.rb"
76
80
  autoload :Block, "moderation_api/models/operations/block.rb"
81
+ autoload :BlockAuthorRequestBody, "moderation_api/models/operations/blockauthor_requestbody.rb"
82
+ autoload :BlockAuthorResponseBody, "moderation_api/models/operations/blockauthor_responsebody.rb"
83
+ autoload :BlockAuthorRequest, "moderation_api/models/operations/blockauthor_request.rb"
84
+ autoload :BlockAuthorResponse, "moderation_api/models/operations/blockauthor_response.rb"
77
85
  autoload :BrandImpersonation, "moderation_api/models/operations/brand_impersonation.rb"
78
86
  autoload :Bucket, "moderation_api/models/operations/bucket.rb"
79
87
  autoload :Casebook, "moderation_api/models/operations/casebook.rb"
@@ -156,6 +164,9 @@ module ModerationApi
156
164
  autoload :DeleteWebhookResponseBody, "moderation_api/models/operations/deletewebhook_responsebody.rb"
157
165
  autoload :DeleteWebhookRequest, "moderation_api/models/operations/deletewebhook_request.rb"
158
166
  autoload :DeleteWebhookResponse, "moderation_api/models/operations/deletewebhook_response.rb"
167
+ autoload :DeleteWordlistResponseBody, "moderation_api/models/operations/deletewordlist_responsebody.rb"
168
+ autoload :DeleteWordlistRequest, "moderation_api/models/operations/deletewordlist_request.rb"
169
+ autoload :DeleteWordlistResponse, "moderation_api/models/operations/deletewordlist_response.rb"
159
170
  autoload :DuplicateChannelRequestBody, "moderation_api/models/operations/duplicatechannel_requestbody.rb"
160
171
  autoload :DuplicateChannelRequest, "moderation_api/models/operations/duplicatechannel_request.rb"
161
172
  autoload :DuplicateChannelResponse, "moderation_api/models/operations/duplicatechannel_response.rb"
@@ -342,6 +353,10 @@ module ModerationApi
342
353
  autoload :ReasonCode, "moderation_api/models/operations/reason_code.rb"
343
354
  autoload :ReasonCodeEnum, "moderation_api/models/operations/reason_code_enum.rb"
344
355
  autoload :Recommendation, "moderation_api/models/operations/recommendation.rb"
356
+ autoload :RejectContentRequestBody, "moderation_api/models/operations/rejectcontent_requestbody.rb"
357
+ autoload :RejectContentResponseBody, "moderation_api/models/operations/rejectcontent_responsebody.rb"
358
+ autoload :RejectContentRequest, "moderation_api/models/operations/rejectcontent_request.rb"
359
+ autoload :RejectContentResponse, "moderation_api/models/operations/rejectcontent_response.rb"
345
360
  autoload :RemoveWordlistWordsResponseBody, "moderation_api/models/operations/removewordlistwords_responsebody.rb"
346
361
  autoload :RemoveWordlistWordsRequest, "moderation_api/models/operations/removewordlistwords_request.rb"
347
362
  autoload :RemoveWordlistWordsResponse, "moderation_api/models/operations/removewordlistwords_response.rb"
@@ -367,12 +382,20 @@ module ModerationApi
367
382
  autoload :SubmitContentPolicyResponse, "moderation_api/models/operations/submitcontent_policy_response.rb"
368
383
  autoload :SubmitContentRequest, "moderation_api/models/operations/submitcontent_request.rb"
369
384
  autoload :SubmitContentResponse, "moderation_api/models/operations/submitcontent_response.rb"
385
+ autoload :SuspendAuthorRequestBody, "moderation_api/models/operations/suspendauthor_requestbody.rb"
386
+ autoload :SuspendAuthorResponseBody, "moderation_api/models/operations/suspendauthor_responsebody.rb"
387
+ autoload :SuspendAuthorRequest, "moderation_api/models/operations/suspendauthor_request.rb"
388
+ autoload :SuspendAuthorResponse, "moderation_api/models/operations/suspendauthor_response.rb"
370
389
  autoload :TopReviewer, "moderation_api/models/operations/topreviewer.rb"
371
390
  autoload :Topic, "moderation_api/models/operations/topic.rb"
372
391
  autoload :Totals, "moderation_api/models/operations/totals.rb"
373
392
  autoload :TranscriptionQuality, "moderation_api/models/operations/transcriptionquality.rb"
374
393
  autoload :Trends, "moderation_api/models/operations/trends.rb"
375
394
  autoload :TrustLevel, "moderation_api/models/operations/trust_level.rb"
395
+ autoload :UnblockAuthorRequestBody, "moderation_api/models/operations/unblockauthor_requestbody.rb"
396
+ autoload :UnblockAuthorResponseBody, "moderation_api/models/operations/unblockauthor_responsebody.rb"
397
+ autoload :UnblockAuthorRequest, "moderation_api/models/operations/unblockauthor_request.rb"
398
+ autoload :UnblockAuthorResponse, "moderation_api/models/operations/unblockauthor_response.rb"
376
399
  autoload :UnresolveQueueItemResponseBody, "moderation_api/models/operations/unresolvequeueitem_responsebody.rb"
377
400
  autoload :UnresolveQueueItemRequest, "moderation_api/models/operations/unresolvequeueitem_request.rb"
378
401
  autoload :UnresolveQueueItemResponse, "moderation_api/models/operations/unresolvequeueitem_response.rb"
@@ -23,11 +23,11 @@ module ModerationApi
23
23
  :feedback,
24
24
  :queue,
25
25
  :actions,
26
+ :content,
26
27
  :webhooks,
27
28
  :webhook_secret,
28
29
  :account,
29
30
  :wordlist,
30
- :content,
31
31
  :projects,
32
32
  :channels
33
33
  )
@@ -59,7 +59,7 @@ module ModerationApi
59
59
  client: nil,
60
60
  retry_config: nil,
61
61
  timeout_ms: nil,
62
- secret_key: nil,
62
+ secret_key: ENV.fetch("MODAPI_SECRET_KEY", nil),
63
63
  security_source: nil,
64
64
  server_idx: nil,
65
65
  server_url: nil,
@@ -107,11 +107,11 @@ module ModerationApi
107
107
  @feedback = Feedback.new(@sdk_configuration)
108
108
  @queue = Queue.new(@sdk_configuration)
109
109
  @actions = Actions.new(@sdk_configuration)
110
+ @content = Content.new(@sdk_configuration)
110
111
  @webhooks = Webhooks.new(@sdk_configuration)
111
112
  @webhook_secret = WebhookSecret.new(@sdk_configuration)
112
113
  @account = Account.new(@sdk_configuration)
113
114
  @wordlist = Wordlist.new(@sdk_configuration)
114
- @content = Content.new(@sdk_configuration)
115
115
  @projects = Projects.new(@sdk_configuration)
116
116
  @channels = Channels.new(@sdk_configuration)
117
117
  end
@@ -93,9 +93,9 @@ module ModerationApi
93
93
 
94
94
  @language = "ruby"
95
95
  @openapi_doc_version = "1.1.0"
96
- @sdk_version = "3.2.0"
96
+ @sdk_version = "3.4.0"
97
97
  @gen_version = "internal"
98
- @user_agent = "speakeasy-sdk/ruby 3.2.0 internal 1.1.0 moderation_api"
98
+ @user_agent = "speakeasy-sdk/ruby 3.4.0 internal 1.1.0 moderation_api"
99
99
  end
100
100
 
101
101
  sig { returns([String, T::Hash[Symbol, String]]) }
@@ -1120,6 +1120,222 @@ module ModerationApi
1120
1120
  end
1121
1121
  end
1122
1122
 
1123
+ sig {
1124
+ params(
1125
+ id: ::String,
1126
+ project_id: T.nilable(::String),
1127
+ timeout_ms: T.nilable(Integer),
1128
+ http_headers: T.nilable(T::Hash[T.any(String, Symbol), String])
1129
+ )
1130
+ .returns(Models::Operations::DeleteWordlistResponse)
1131
+ }
1132
+ def delete(id:, project_id: nil, timeout_ms: nil, http_headers: nil)
1133
+ # delete - Delete wordlist
1134
+ # Delete a wordlist and its words. Channels that use the wordlist do not block the delete: the wordlist is removed from their policies. `detachedChannelIds` lists those channels. This cannot be undone.
1135
+ request = Models::Operations::DeleteWordlistRequest.new(
1136
+ id: id,
1137
+ project_id: project_id
1138
+ )
1139
+ url, params = @sdk_configuration.get_server_details
1140
+ base_url = Utils.template_url(url, params)
1141
+ url = Utils.generate_url(
1142
+ Models::Operations::DeleteWordlistRequest,
1143
+ base_url,
1144
+ "/wordlist/{id}",
1145
+ request
1146
+ )
1147
+ headers = Utils.get_headers(request)
1148
+ headers = T.cast(headers, T::Hash[String, String])
1149
+ headers["Accept"] = "application/json"
1150
+ headers["user-agent"] = @sdk_configuration.user_agent
1151
+
1152
+ security = @sdk_configuration.security_source&.call
1153
+
1154
+ timeout = (timeout_ms.to_f / 1000) unless timeout_ms.nil?
1155
+ timeout ||= @sdk_configuration.timeout
1156
+
1157
+ connection = @sdk_configuration.client
1158
+
1159
+ hook_ctx = SDKHooks::HookContext.new(
1160
+ config: @sdk_configuration,
1161
+ base_url: base_url,
1162
+ oauth2_scopes: nil,
1163
+ operation_id: "deleteWordlist",
1164
+ security_source: @sdk_configuration.security_source
1165
+ )
1166
+
1167
+ error = T.let(nil, T.nilable(StandardError))
1168
+ http_response = T.let(nil, T.nilable(Faraday::Response))
1169
+
1170
+ begin
1171
+ http_response = T.must(connection).delete(url) do |req|
1172
+ req.headers.merge!(headers)
1173
+ req.options.timeout = timeout unless timeout.nil?
1174
+ Utils.configure_request_security(req, security)
1175
+ http_headers&.each do |key, value|
1176
+ req.headers[key.to_s] = value
1177
+ end
1178
+
1179
+ @sdk_configuration.hooks.before_request(
1180
+ hook_ctx: SDKHooks::BeforeRequestHookContext.new(
1181
+ hook_ctx: hook_ctx
1182
+ ),
1183
+ request: req
1184
+ )
1185
+ end
1186
+
1187
+ rescue StandardError => e
1188
+ error = e
1189
+ ensure
1190
+ if http_response.nil? || Utils.error_status?(http_response.status)
1191
+ http_response = @sdk_configuration.hooks.after_error(
1192
+ error: error,
1193
+ hook_ctx: SDKHooks::AfterErrorHookContext.new(
1194
+ hook_ctx: hook_ctx
1195
+ ),
1196
+ response: http_response
1197
+ )
1198
+ else
1199
+ http_response = @sdk_configuration.hooks.after_success(
1200
+ hook_ctx: SDKHooks::AfterSuccessHookContext.new(
1201
+ hook_ctx: hook_ctx
1202
+ ),
1203
+ response: http_response
1204
+ )
1205
+ end
1206
+
1207
+ if http_response.nil?
1208
+ raise error if !error.nil?
1209
+ raise "no response"
1210
+ end
1211
+ end
1212
+
1213
+ content_type = http_response.headers.fetch("Content-Type", "application/octet-stream")
1214
+ if Utils.match_status_code(http_response.status, ["200"])
1215
+ if Utils.match_content_type(content_type, "application/json")
1216
+ http_response = @sdk_configuration.hooks.after_success(
1217
+ hook_ctx: SDKHooks::AfterSuccessHookContext.new(
1218
+ hook_ctx: hook_ctx
1219
+ ),
1220
+ response: http_response
1221
+ )
1222
+ response_data = http_response.env.response_body
1223
+ obj = Crystalline.unmarshal_json(JSON.parse(response_data), Models::Operations::DeleteWordlistResponseBody)
1224
+ response = Models::Operations::DeleteWordlistResponse.new(
1225
+ status_code: http_response.status,
1226
+ content_type: content_type,
1227
+ raw_response: http_response,
1228
+ object: T.unsafe(obj)
1229
+ )
1230
+
1231
+ return response
1232
+ else
1233
+ raise(
1234
+ ::ModerationApi::Models::Errors::APIError.new(
1235
+ status_code: http_response.status,
1236
+ body: http_response.env.response_body,
1237
+ raw_response: http_response
1238
+ ),
1239
+ "Unknown content type received"
1240
+ )
1241
+ end
1242
+ elsif Utils.match_status_code(http_response.status, ["401"])
1243
+ if Utils.match_content_type(content_type, "application/json")
1244
+ http_response = @sdk_configuration.hooks.after_success(
1245
+ hook_ctx: SDKHooks::AfterSuccessHookContext.new(
1246
+ hook_ctx: hook_ctx
1247
+ ),
1248
+ response: http_response
1249
+ )
1250
+ response_data = http_response.env.response_body
1251
+ obj = Crystalline.unmarshal_json(JSON.parse(response_data), Models::Errors::AuthenticationError)
1252
+ obj.raw_response = http_response
1253
+ raise obj
1254
+ else
1255
+ raise(
1256
+ ::ModerationApi::Models::Errors::APIError.new(
1257
+ status_code: http_response.status,
1258
+ body: http_response.env.response_body,
1259
+ raw_response: http_response
1260
+ ),
1261
+ "Unknown content type received"
1262
+ )
1263
+ end
1264
+ elsif Utils.match_status_code(http_response.status, ["404"])
1265
+ if Utils.match_content_type(content_type, "application/json")
1266
+ http_response = @sdk_configuration.hooks.after_success(
1267
+ hook_ctx: SDKHooks::AfterSuccessHookContext.new(
1268
+ hook_ctx: hook_ctx
1269
+ ),
1270
+ response: http_response
1271
+ )
1272
+ response_data = http_response.env.response_body
1273
+ obj = Crystalline.unmarshal_json(JSON.parse(response_data), Models::Errors::NotFoundError)
1274
+ obj.raw_response = http_response
1275
+ raise obj
1276
+ else
1277
+ raise(
1278
+ ::ModerationApi::Models::Errors::APIError.new(
1279
+ status_code: http_response.status,
1280
+ body: http_response.env.response_body,
1281
+ raw_response: http_response
1282
+ ),
1283
+ "Unknown content type received"
1284
+ )
1285
+ end
1286
+ elsif Utils.match_status_code(http_response.status, ["429"])
1287
+ if Utils.match_content_type(content_type, "application/json")
1288
+ http_response = @sdk_configuration.hooks.after_success(
1289
+ hook_ctx: SDKHooks::AfterSuccessHookContext.new(
1290
+ hook_ctx: hook_ctx
1291
+ ),
1292
+ response: http_response
1293
+ )
1294
+ response_data = http_response.env.response_body
1295
+ obj = Crystalline.unmarshal_json(JSON.parse(response_data), Models::Errors::RateLimitError)
1296
+ obj.raw_response = http_response
1297
+ raise obj
1298
+ else
1299
+ raise(
1300
+ ::ModerationApi::Models::Errors::APIError.new(
1301
+ status_code: http_response.status,
1302
+ body: http_response.env.response_body,
1303
+ raw_response: http_response
1304
+ ),
1305
+ "Unknown content type received"
1306
+ )
1307
+ end
1308
+ elsif Utils.match_status_code(http_response.status, ["4XX"])
1309
+ raise(
1310
+ ::ModerationApi::Models::Errors::APIError.new(
1311
+ status_code: http_response.status,
1312
+ body: http_response.env.response_body,
1313
+ raw_response: http_response
1314
+ ),
1315
+ "API error occurred"
1316
+ )
1317
+ elsif Utils.match_status_code(http_response.status, ["5XX"])
1318
+ raise(
1319
+ ::ModerationApi::Models::Errors::APIError.new(
1320
+ status_code: http_response.status,
1321
+ body: http_response.env.response_body,
1322
+ raw_response: http_response
1323
+ ),
1324
+ "API error occurred"
1325
+ )
1326
+ else
1327
+ raise(
1328
+ ::ModerationApi::Models::Errors::APIError.new(
1329
+ status_code: http_response.status,
1330
+ body: http_response.env.response_body,
1331
+ raw_response: http_response
1332
+ ),
1333
+ "Unknown status code received"
1334
+ )
1335
+
1336
+ end
1337
+ end
1338
+
1123
1339
  sig {
1124
1340
  params(
1125
1341
  id: ::String,