diff --git a/.release-please-manifest.json b/.release-please-manifest.json index e6eadb4..5868289 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "2.13.0" + ".": "2.14.0" } \ No newline at end of file diff --git a/.stats.yml b/.stats.yml index ccd7c79..5019f81 100644 --- a/.stats.yml +++ b/.stats.yml @@ -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 diff --git a/CHANGELOG.md b/CHANGELOG.md index 0e26d08..0c7ed3f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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) diff --git a/Gemfile.lock b/Gemfile.lock index 0385c95..9afa770 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -11,7 +11,7 @@ GIT PATH remote: . specs: - moderation_api (2.13.0) + moderation_api (2.14.0) cgi connection_pool diff --git a/README.md b/README.md index baeb35d..d4d797d 100644 --- a/README.md +++ b/README.md @@ -15,7 +15,7 @@ To use this gem, install via Bundler by adding the following to your application ```ruby -gem "moderation_api", "~> 2.13.0" +gem "moderation_api", "~> 2.14.0" ``` diff --git a/lib/moderation_api/models/content_submit_response.rb b/lib/moderation_api/models/content_submit_response.rb index 62e7941..ad92144 100644 --- a/lib/moderation_api/models/content_submit_response.rb +++ b/lib/moderation_api/models/content_submit_response.rb @@ -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, 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. # @@ -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] The reason code for the recommendation. Can be used to display a reason to the u + # + # @param matched_rules [Array] Rules that matched during evaluation, if rules engine is active. # The action to take based on the recommendation # @@ -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] 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 diff --git a/lib/moderation_api/version.rb b/lib/moderation_api/version.rb index cfd406e..d3f5d7c 100644 --- a/lib/moderation_api/version.rb +++ b/lib/moderation_api/version.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true module ModerationAPI - VERSION = "2.13.0" + VERSION = "2.14.0" end diff --git a/rbi/moderation_api/models/content_submit_response.rbi b/rbi/moderation_api/models/content_submit_response.rbi index 16c9fc9..1cb675a 100644 --- a/rbi/moderation_api/models/content_submit_response.rbi +++ b/rbi/moderation_api/models/content_submit_response.rbi @@ -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( @@ -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 @@ -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 @@ -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 ] } ) @@ -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( @@ -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 diff --git a/sig/moderation_api/models/content_submit_response.rbs b/sig/moderation_api/models/content_submit_response.rbs index ab0740b..62a4ef8 100644 --- a/sig/moderation_api/models/content_submit_response.rbs +++ b/sig/moderation_api/models/content_submit_response.rbs @@ -680,7 +680,8 @@ 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 @@ -688,14 +689,22 @@ module ModerationAPI 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 @@ -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 @@ -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 }