Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
".": "2.13.0"
".": "2.14.0"
}
4 changes: 2 additions & 2 deletions .stats.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
configured_endpoints: 27
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/moderation-api%2Fmoderation-api-c8e66e827fc2b1465b740a29e87da71c3b1ddca1a4bdb1023aa96c569b80e9be.yml
openapi_spec_hash: 35fdc3e34feb56cafaf4de2834201978
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/moderation-api%2Fmoderation-api-5cee858ce17e48e25e7503767dd979c6570a485511274e48129a1922eae67098.yml
openapi_spec_hash: 54c716ac4e888bfddc2c6402192bb33a
config_hash: 13d10207114afb65f7ac4e21f4c0e358
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# Changelog

## 2.14.0 (2026-04-29)

Full Changelog: [v2.13.0...v2.14.0](https://github.com/moderation-api/sdk-ruby/compare/v2.13.0...v2.14.0)

### Features

* **api:** api update ([ac53fee](https://github.com/moderation-api/sdk-ruby/commit/ac53feeb7fe66fde8f0eac2462e36f5c8aa5da6a))

## 2.13.0 (2026-04-28)

Full Changelog: [v2.12.0...v2.13.0](https://github.com/moderation-api/sdk-ruby/compare/v2.12.0...v2.13.0)
Expand Down
2 changes: 1 addition & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ GIT
PATH
remote: .
specs:
moderation_api (2.13.0)
moderation_api (2.14.0)
cgi
connection_pool

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ To use this gem, install via Bundler by adding the following to your application
<!-- x-release-please-start-version -->

```ruby
gem "moderation_api", "~> 2.13.0"
gem "moderation_api", "~> 2.14.0"
```

<!-- x-release-please-end -->
Expand Down
30 changes: 29 additions & 1 deletion lib/moderation_api/models/content_submit_response.rb
Original file line number Diff line number Diff line change
Expand Up @@ -849,7 +849,14 @@ class Recommendation < ModerationAPI::Internal::Type::BaseModel
required :reason_codes,
-> { ModerationAPI::Internal::Type::ArrayOf[enum: ModerationAPI::Models::ContentSubmitResponse::Recommendation::ReasonCode] }

# @!method initialize(action:, reason_codes:)
# @!attribute matched_rules
# Rules that matched during evaluation, if rules engine is active.
#
# @return [Array<ModerationAPI::Models::ContentSubmitResponse::Recommendation::MatchedRule>, nil]
optional :matched_rules,
-> { ModerationAPI::Internal::Type::ArrayOf[ModerationAPI::Models::ContentSubmitResponse::Recommendation::MatchedRule] }

# @!method initialize(action:, reason_codes:, matched_rules: nil)
# Some parameter documentations has been truncated, see
# {ModerationAPI::Models::ContentSubmitResponse::Recommendation} for more details.
#
Expand All @@ -858,6 +865,8 @@ class Recommendation < ModerationAPI::Internal::Type::BaseModel
# @param action [Symbol, ModerationAPI::Models::ContentSubmitResponse::Recommendation::Action] The action to take based on the recommendation
#
# @param reason_codes [Array<Symbol, ModerationAPI::Models::ContentSubmitResponse::Recommendation::ReasonCode>] The reason code for the recommendation. Can be used to display a reason to the u
#
# @param matched_rules [Array<ModerationAPI::Models::ContentSubmitResponse::Recommendation::MatchedRule>] Rules that matched during evaluation, if rules engine is active.

# The action to take based on the recommendation
#
Expand All @@ -882,10 +891,29 @@ module ReasonCode
DRY_RUN = :dry_run
TRUSTED_ALLOW = :trusted_allow
UNTRUSTED_SEVERITY = :untrusted_severity
RULE_MATCH = :rule_match
RULE_DEFAULT = :rule_default
RULE_FALLBACK = :rule_fallback

# @!method self.values
# @return [Array<Symbol>]
end

class MatchedRule < ModerationAPI::Internal::Type::BaseModel
# @!attribute key
#
# @return [String]
required :key, String

# @!attribute name
#
# @return [String]
required :name, String

# @!method initialize(key:, name:)
# @param key [String]
# @param name [String]
end
end

class Error < ModerationAPI::Internal::Type::BaseModel
Expand Down
2 changes: 1 addition & 1 deletion lib/moderation_api/version.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# frozen_string_literal: true

module ModerationAPI
VERSION = "2.13.0"
VERSION = "2.14.0"
end
73 changes: 72 additions & 1 deletion rbi/moderation_api/models/content_submit_response.rbi
Original file line number Diff line number Diff line change
Expand Up @@ -1599,6 +1599,28 @@ module ModerationAPI
end
attr_accessor :reason_codes

# Rules that matched during evaluation, if rules engine is active.
sig do
returns(
T.nilable(
T::Array[
ModerationAPI::Models::ContentSubmitResponse::Recommendation::MatchedRule
]
)
)
end
attr_reader :matched_rules

sig do
params(
matched_rules:
T::Array[
ModerationAPI::Models::ContentSubmitResponse::Recommendation::MatchedRule::OrHash
]
).void
end
attr_writer :matched_rules

# The recommendation for the content based on the evaluation.
sig do
params(
Expand All @@ -1607,6 +1629,10 @@ module ModerationAPI
reason_codes:
T::Array[
ModerationAPI::Models::ContentSubmitResponse::Recommendation::ReasonCode::OrSymbol
],
matched_rules:
T::Array[
ModerationAPI::Models::ContentSubmitResponse::Recommendation::MatchedRule::OrHash
]
).returns(T.attached_class)
end
Expand All @@ -1615,7 +1641,9 @@ module ModerationAPI
action:,
# The reason code for the recommendation. Can be used to display a reason to the
# user.
reason_codes:
reason_codes:,
# Rules that matched during evaluation, if rules engine is active.
matched_rules: nil
)
end

Expand All @@ -1627,6 +1655,10 @@ module ModerationAPI
reason_codes:
T::Array[
ModerationAPI::Models::ContentSubmitResponse::Recommendation::ReasonCode::TaggedSymbol
],
matched_rules:
T::Array[
ModerationAPI::Models::ContentSubmitResponse::Recommendation::MatchedRule
]
}
)
Expand Down Expand Up @@ -1716,6 +1748,21 @@ module ModerationAPI
:untrusted_severity,
ModerationAPI::Models::ContentSubmitResponse::Recommendation::ReasonCode::TaggedSymbol
)
RULE_MATCH =
T.let(
:rule_match,
ModerationAPI::Models::ContentSubmitResponse::Recommendation::ReasonCode::TaggedSymbol
)
RULE_DEFAULT =
T.let(
:rule_default,
ModerationAPI::Models::ContentSubmitResponse::Recommendation::ReasonCode::TaggedSymbol
)
RULE_FALLBACK =
T.let(
:rule_fallback,
ModerationAPI::Models::ContentSubmitResponse::Recommendation::ReasonCode::TaggedSymbol
)

sig do
override.returns(
Expand All @@ -1727,6 +1774,30 @@ module ModerationAPI
def self.values
end
end

class MatchedRule < ModerationAPI::Internal::Type::BaseModel
OrHash =
T.type_alias do
T.any(
ModerationAPI::Models::ContentSubmitResponse::Recommendation::MatchedRule,
ModerationAPI::Internal::AnyHash
)
end

sig { returns(String) }
attr_accessor :key

sig { returns(String) }
attr_accessor :name

sig { params(key: String, name: String).returns(T.attached_class) }
def self.new(key:, name:)
end

sig { override.returns({ key: String, name: String }) }
def to_hash
end
end
end

class Error < ModerationAPI::Internal::Type::BaseModel
Expand Down
33 changes: 30 additions & 3 deletions sig/moderation_api/models/content_submit_response.rbs
Original file line number Diff line number Diff line change
Expand Up @@ -680,22 +680,31 @@ module ModerationAPI
type recommendation =
{
action: ModerationAPI::Models::ContentSubmitResponse::Recommendation::action,
reason_codes: ::Array[ModerationAPI::Models::ContentSubmitResponse::Recommendation::reason_code]
reason_codes: ::Array[ModerationAPI::Models::ContentSubmitResponse::Recommendation::reason_code],
matched_rules: ::Array[ModerationAPI::Models::ContentSubmitResponse::Recommendation::MatchedRule]
}

class Recommendation < ModerationAPI::Internal::Type::BaseModel
attr_accessor action: ModerationAPI::Models::ContentSubmitResponse::Recommendation::action

attr_accessor reason_codes: ::Array[ModerationAPI::Models::ContentSubmitResponse::Recommendation::reason_code]

attr_reader matched_rules: ::Array[ModerationAPI::Models::ContentSubmitResponse::Recommendation::MatchedRule]?

def matched_rules=: (
::Array[ModerationAPI::Models::ContentSubmitResponse::Recommendation::MatchedRule]
) -> ::Array[ModerationAPI::Models::ContentSubmitResponse::Recommendation::MatchedRule]

def initialize: (
action: ModerationAPI::Models::ContentSubmitResponse::Recommendation::action,
reason_codes: ::Array[ModerationAPI::Models::ContentSubmitResponse::Recommendation::reason_code]
reason_codes: ::Array[ModerationAPI::Models::ContentSubmitResponse::Recommendation::reason_code],
?matched_rules: ::Array[ModerationAPI::Models::ContentSubmitResponse::Recommendation::MatchedRule]
) -> void

def to_hash: -> {
action: ModerationAPI::Models::ContentSubmitResponse::Recommendation::action,
reason_codes: ::Array[ModerationAPI::Models::ContentSubmitResponse::Recommendation::reason_code]
reason_codes: ::Array[ModerationAPI::Models::ContentSubmitResponse::Recommendation::reason_code],
matched_rules: ::Array[ModerationAPI::Models::ContentSubmitResponse::Recommendation::MatchedRule]
}

type action = :review | :allow | :reject
Expand All @@ -717,6 +726,9 @@ module ModerationAPI
| :dry_run
| :trusted_allow
| :untrusted_severity
| :rule_match
| :rule_default
| :rule_fallback

module ReasonCode
extend ModerationAPI::Internal::Type::Enum
Expand All @@ -727,9 +739,24 @@ module ModerationAPI
DRY_RUN: :dry_run
TRUSTED_ALLOW: :trusted_allow
UNTRUSTED_SEVERITY: :untrusted_severity
RULE_MATCH: :rule_match
RULE_DEFAULT: :rule_default
RULE_FALLBACK: :rule_fallback

def self?.values: -> ::Array[ModerationAPI::Models::ContentSubmitResponse::Recommendation::reason_code]
end

type matched_rule = { key: String, name: String }

class MatchedRule < ModerationAPI::Internal::Type::BaseModel
attr_accessor key: String

attr_accessor name: String

def initialize: (key: String, name: String) -> void

def to_hash: -> { key: String, name: String }
end
end

type error = { id: String, message: String }
Expand Down