From 37d5a3d6185eaddfce7a79d9b4799568d694782a Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 18 Dec 2025 15:32:10 +0000 Subject: [PATCH 1/2] feat(api): api update --- .stats.yml | 4 +- .../models/content_submit_params.rb | 168 +++++++- .../models/content_submit_params.rbi | 378 +++++++++++++++--- .../models/content_submit_params.rbs | 295 +++++++++++--- 4 files changed, 698 insertions(+), 147 deletions(-) diff --git a/.stats.yml b/.stats.yml index 8fac9df..65327ac 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-df0281b1aec24ed19b928d7e5912db35455378fa59390c6c3bf8d6700425d922.yml -openapi_spec_hash: 03107bb438d4b42d77fbabae3cfd3d79 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/moderation-api%2Fmoderation-api-00324cd69f885e08708180c380317fd48101cb81c36f0bfaf7f8248d951d92f7.yml +openapi_spec_hash: 47c828ded2fac0ded969760340b6b6fa config_hash: 6a52f6ae7d55cf3b4e91538cc7752aeb diff --git a/lib/moderation_api/models/content_submit_params.rb b/lib/moderation_api/models/content_submit_params.rb index 2a8ec99..bfe0784 100644 --- a/lib/moderation_api/models/content_submit_params.rb +++ b/lib/moderation_api/models/content_submit_params.rb @@ -388,8 +388,14 @@ class Toxicity < ModerationAPI::Internal::Type::BaseModel # @return [Boolean] required :flag, ModerationAPI::Internal::Type::Boolean - # @!method initialize(flag:, id: :toxicity) + # @!attribute threshold + # + # @return [Float, nil] + optional :threshold, Float + + # @!method initialize(flag:, threshold: nil, id: :toxicity) # @param flag [Boolean] + # @param threshold [Float] # @param id [Symbol, :toxicity] end @@ -404,8 +410,14 @@ class PersonalInformation < ModerationAPI::Internal::Type::BaseModel # @return [Boolean] required :flag, ModerationAPI::Internal::Type::Boolean - # @!method initialize(flag:, id: :personal_information) + # @!attribute threshold + # + # @return [Float, nil] + optional :threshold, Float + + # @!method initialize(flag:, threshold: nil, id: :personal_information) # @param flag [Boolean] + # @param threshold [Float] # @param id [Symbol, :personal_information] end @@ -420,8 +432,14 @@ class ToxicitySevere < ModerationAPI::Internal::Type::BaseModel # @return [Boolean] required :flag, ModerationAPI::Internal::Type::Boolean - # @!method initialize(flag:, id: :toxicity_severe) + # @!attribute threshold + # + # @return [Float, nil] + optional :threshold, Float + + # @!method initialize(flag:, threshold: nil, id: :toxicity_severe) # @param flag [Boolean] + # @param threshold [Float] # @param id [Symbol, :toxicity_severe] end @@ -436,8 +454,14 @@ class Hate < ModerationAPI::Internal::Type::BaseModel # @return [Boolean] required :flag, ModerationAPI::Internal::Type::Boolean - # @!method initialize(flag:, id: :hate) + # @!attribute threshold + # + # @return [Float, nil] + optional :threshold, Float + + # @!method initialize(flag:, threshold: nil, id: :hate) # @param flag [Boolean] + # @param threshold [Float] # @param id [Symbol, :hate] end @@ -452,8 +476,14 @@ class Illicit < ModerationAPI::Internal::Type::BaseModel # @return [Boolean] required :flag, ModerationAPI::Internal::Type::Boolean - # @!method initialize(flag:, id: :illicit) + # @!attribute threshold + # + # @return [Float, nil] + optional :threshold, Float + + # @!method initialize(flag:, threshold: nil, id: :illicit) # @param flag [Boolean] + # @param threshold [Float] # @param id [Symbol, :illicit] end @@ -468,8 +498,14 @@ class IllicitDrugs < ModerationAPI::Internal::Type::BaseModel # @return [Boolean] required :flag, ModerationAPI::Internal::Type::Boolean - # @!method initialize(flag:, id: :illicit_drugs) + # @!attribute threshold + # + # @return [Float, nil] + optional :threshold, Float + + # @!method initialize(flag:, threshold: nil, id: :illicit_drugs) # @param flag [Boolean] + # @param threshold [Float] # @param id [Symbol, :illicit_drugs] end @@ -484,8 +520,14 @@ class IllicitAlcohol < ModerationAPI::Internal::Type::BaseModel # @return [Boolean] required :flag, ModerationAPI::Internal::Type::Boolean - # @!method initialize(flag:, id: :illicit_alcohol) + # @!attribute threshold + # + # @return [Float, nil] + optional :threshold, Float + + # @!method initialize(flag:, threshold: nil, id: :illicit_alcohol) # @param flag [Boolean] + # @param threshold [Float] # @param id [Symbol, :illicit_alcohol] end @@ -500,8 +542,14 @@ class IllicitFirearms < ModerationAPI::Internal::Type::BaseModel # @return [Boolean] required :flag, ModerationAPI::Internal::Type::Boolean - # @!method initialize(flag:, id: :illicit_firearms) + # @!attribute threshold + # + # @return [Float, nil] + optional :threshold, Float + + # @!method initialize(flag:, threshold: nil, id: :illicit_firearms) # @param flag [Boolean] + # @param threshold [Float] # @param id [Symbol, :illicit_firearms] end @@ -516,8 +564,14 @@ class IllicitTobacco < ModerationAPI::Internal::Type::BaseModel # @return [Boolean] required :flag, ModerationAPI::Internal::Type::Boolean - # @!method initialize(flag:, id: :illicit_tobacco) + # @!attribute threshold + # + # @return [Float, nil] + optional :threshold, Float + + # @!method initialize(flag:, threshold: nil, id: :illicit_tobacco) # @param flag [Boolean] + # @param threshold [Float] # @param id [Symbol, :illicit_tobacco] end @@ -532,8 +586,14 @@ class IllicitGambling < ModerationAPI::Internal::Type::BaseModel # @return [Boolean] required :flag, ModerationAPI::Internal::Type::Boolean - # @!method initialize(flag:, id: :illicit_gambling) + # @!attribute threshold + # + # @return [Float, nil] + optional :threshold, Float + + # @!method initialize(flag:, threshold: nil, id: :illicit_gambling) # @param flag [Boolean] + # @param threshold [Float] # @param id [Symbol, :illicit_gambling] end @@ -548,8 +608,14 @@ class Sexual < ModerationAPI::Internal::Type::BaseModel # @return [Boolean] required :flag, ModerationAPI::Internal::Type::Boolean - # @!method initialize(flag:, id: :sexual) + # @!attribute threshold + # + # @return [Float, nil] + optional :threshold, Float + + # @!method initialize(flag:, threshold: nil, id: :sexual) # @param flag [Boolean] + # @param threshold [Float] # @param id [Symbol, :sexual] end @@ -564,8 +630,14 @@ class Flirtation < ModerationAPI::Internal::Type::BaseModel # @return [Boolean] required :flag, ModerationAPI::Internal::Type::Boolean - # @!method initialize(flag:, id: :flirtation) + # @!attribute threshold + # + # @return [Float, nil] + optional :threshold, Float + + # @!method initialize(flag:, threshold: nil, id: :flirtation) # @param flag [Boolean] + # @param threshold [Float] # @param id [Symbol, :flirtation] end @@ -580,8 +652,14 @@ class Profanity < ModerationAPI::Internal::Type::BaseModel # @return [Boolean] required :flag, ModerationAPI::Internal::Type::Boolean - # @!method initialize(flag:, id: :profanity) + # @!attribute threshold + # + # @return [Float, nil] + optional :threshold, Float + + # @!method initialize(flag:, threshold: nil, id: :profanity) # @param flag [Boolean] + # @param threshold [Float] # @param id [Symbol, :profanity] end @@ -596,8 +674,14 @@ class Violence < ModerationAPI::Internal::Type::BaseModel # @return [Boolean] required :flag, ModerationAPI::Internal::Type::Boolean - # @!method initialize(flag:, id: :violence) + # @!attribute threshold + # + # @return [Float, nil] + optional :threshold, Float + + # @!method initialize(flag:, threshold: nil, id: :violence) # @param flag [Boolean] + # @param threshold [Float] # @param id [Symbol, :violence] end @@ -612,8 +696,14 @@ class SelfHarm < ModerationAPI::Internal::Type::BaseModel # @return [Boolean] required :flag, ModerationAPI::Internal::Type::Boolean - # @!method initialize(flag:, id: :self_harm) + # @!attribute threshold + # + # @return [Float, nil] + optional :threshold, Float + + # @!method initialize(flag:, threshold: nil, id: :self_harm) # @param flag [Boolean] + # @param threshold [Float] # @param id [Symbol, :self_harm] end @@ -628,8 +718,14 @@ class Spam < ModerationAPI::Internal::Type::BaseModel # @return [Boolean] required :flag, ModerationAPI::Internal::Type::Boolean - # @!method initialize(flag:, id: :spam) + # @!attribute threshold + # + # @return [Float, nil] + optional :threshold, Float + + # @!method initialize(flag:, threshold: nil, id: :spam) # @param flag [Boolean] + # @param threshold [Float] # @param id [Symbol, :spam] end @@ -644,8 +740,14 @@ class SelfPromotion < ModerationAPI::Internal::Type::BaseModel # @return [Boolean] required :flag, ModerationAPI::Internal::Type::Boolean - # @!method initialize(flag:, id: :self_promotion) + # @!attribute threshold + # + # @return [Float, nil] + optional :threshold, Float + + # @!method initialize(flag:, threshold: nil, id: :self_promotion) # @param flag [Boolean] + # @param threshold [Float] # @param id [Symbol, :self_promotion] end @@ -660,8 +762,14 @@ class Political < ModerationAPI::Internal::Type::BaseModel # @return [Boolean] required :flag, ModerationAPI::Internal::Type::Boolean - # @!method initialize(flag:, id: :political) + # @!attribute threshold + # + # @return [Float, nil] + optional :threshold, Float + + # @!method initialize(flag:, threshold: nil, id: :political) # @param flag [Boolean] + # @param threshold [Float] # @param id [Symbol, :political] end @@ -676,8 +784,14 @@ class Religion < ModerationAPI::Internal::Type::BaseModel # @return [Boolean] required :flag, ModerationAPI::Internal::Type::Boolean - # @!method initialize(flag:, id: :religion) + # @!attribute threshold + # + # @return [Float, nil] + optional :threshold, Float + + # @!method initialize(flag:, threshold: nil, id: :religion) # @param flag [Boolean] + # @param threshold [Float] # @param id [Symbol, :religion] end @@ -692,8 +806,14 @@ class CodeAbuse < ModerationAPI::Internal::Type::BaseModel # @return [Boolean] required :flag, ModerationAPI::Internal::Type::Boolean - # @!method initialize(flag:, id: :code_abuse) + # @!attribute threshold + # + # @return [Float, nil] + optional :threshold, Float + + # @!method initialize(flag:, threshold: nil, id: :code_abuse) # @param flag [Boolean] + # @param threshold [Float] # @param id [Symbol, :code_abuse] end @@ -856,10 +976,16 @@ class Guideline < ModerationAPI::Internal::Type::BaseModel # @return [String] required :instructions, String - # @!method initialize(flag:, guideline_key:, instructions:, id: :guideline) + # @!attribute threshold + # + # @return [Float, nil] + optional :threshold, Float + + # @!method initialize(flag:, guideline_key:, instructions:, threshold: nil, id: :guideline) # @param flag [Boolean] # @param guideline_key [String] # @param instructions [String] + # @param threshold [Float] # @param id [Symbol, :guideline] end diff --git a/rbi/moderation_api/models/content_submit_params.rbi b/rbi/moderation_api/models/content_submit_params.rbi index 2b8e773..8db9a0f 100644 --- a/rbi/moderation_api/models/content_submit_params.rbi +++ b/rbi/moderation_api/models/content_submit_params.rbi @@ -757,11 +757,23 @@ module ModerationAPI sig { returns(T::Boolean) } attr_accessor :flag - sig { params(flag: T::Boolean, id: Symbol).returns(T.attached_class) } - def self.new(flag:, id: :toxicity) + sig { returns(T.nilable(Float)) } + attr_reader :threshold + + sig { params(threshold: Float).void } + attr_writer :threshold + + sig do + params(flag: T::Boolean, threshold: Float, id: Symbol).returns( + T.attached_class + ) + end + def self.new(flag:, threshold: nil, id: :toxicity) end - sig { override.returns({ id: Symbol, flag: T::Boolean }) } + sig do + override.returns({ id: Symbol, flag: T::Boolean, threshold: Float }) + end def to_hash end end @@ -781,11 +793,23 @@ module ModerationAPI sig { returns(T::Boolean) } attr_accessor :flag - sig { params(flag: T::Boolean, id: Symbol).returns(T.attached_class) } - def self.new(flag:, id: :personal_information) + sig { returns(T.nilable(Float)) } + attr_reader :threshold + + sig { params(threshold: Float).void } + attr_writer :threshold + + sig do + params(flag: T::Boolean, threshold: Float, id: Symbol).returns( + T.attached_class + ) + end + def self.new(flag:, threshold: nil, id: :personal_information) end - sig { override.returns({ id: Symbol, flag: T::Boolean }) } + sig do + override.returns({ id: Symbol, flag: T::Boolean, threshold: Float }) + end def to_hash end end @@ -805,11 +829,23 @@ module ModerationAPI sig { returns(T::Boolean) } attr_accessor :flag - sig { params(flag: T::Boolean, id: Symbol).returns(T.attached_class) } - def self.new(flag:, id: :toxicity_severe) + sig { returns(T.nilable(Float)) } + attr_reader :threshold + + sig { params(threshold: Float).void } + attr_writer :threshold + + sig do + params(flag: T::Boolean, threshold: Float, id: Symbol).returns( + T.attached_class + ) + end + def self.new(flag:, threshold: nil, id: :toxicity_severe) end - sig { override.returns({ id: Symbol, flag: T::Boolean }) } + sig do + override.returns({ id: Symbol, flag: T::Boolean, threshold: Float }) + end def to_hash end end @@ -829,11 +865,23 @@ module ModerationAPI sig { returns(T::Boolean) } attr_accessor :flag - sig { params(flag: T::Boolean, id: Symbol).returns(T.attached_class) } - def self.new(flag:, id: :hate) + sig { returns(T.nilable(Float)) } + attr_reader :threshold + + sig { params(threshold: Float).void } + attr_writer :threshold + + sig do + params(flag: T::Boolean, threshold: Float, id: Symbol).returns( + T.attached_class + ) + end + def self.new(flag:, threshold: nil, id: :hate) end - sig { override.returns({ id: Symbol, flag: T::Boolean }) } + sig do + override.returns({ id: Symbol, flag: T::Boolean, threshold: Float }) + end def to_hash end end @@ -853,11 +901,23 @@ module ModerationAPI sig { returns(T::Boolean) } attr_accessor :flag - sig { params(flag: T::Boolean, id: Symbol).returns(T.attached_class) } - def self.new(flag:, id: :illicit) + sig { returns(T.nilable(Float)) } + attr_reader :threshold + + sig { params(threshold: Float).void } + attr_writer :threshold + + sig do + params(flag: T::Boolean, threshold: Float, id: Symbol).returns( + T.attached_class + ) + end + def self.new(flag:, threshold: nil, id: :illicit) end - sig { override.returns({ id: Symbol, flag: T::Boolean }) } + sig do + override.returns({ id: Symbol, flag: T::Boolean, threshold: Float }) + end def to_hash end end @@ -877,11 +937,23 @@ module ModerationAPI sig { returns(T::Boolean) } attr_accessor :flag - sig { params(flag: T::Boolean, id: Symbol).returns(T.attached_class) } - def self.new(flag:, id: :illicit_drugs) + sig { returns(T.nilable(Float)) } + attr_reader :threshold + + sig { params(threshold: Float).void } + attr_writer :threshold + + sig do + params(flag: T::Boolean, threshold: Float, id: Symbol).returns( + T.attached_class + ) + end + def self.new(flag:, threshold: nil, id: :illicit_drugs) end - sig { override.returns({ id: Symbol, flag: T::Boolean }) } + sig do + override.returns({ id: Symbol, flag: T::Boolean, threshold: Float }) + end def to_hash end end @@ -901,11 +973,23 @@ module ModerationAPI sig { returns(T::Boolean) } attr_accessor :flag - sig { params(flag: T::Boolean, id: Symbol).returns(T.attached_class) } - def self.new(flag:, id: :illicit_alcohol) + sig { returns(T.nilable(Float)) } + attr_reader :threshold + + sig { params(threshold: Float).void } + attr_writer :threshold + + sig do + params(flag: T::Boolean, threshold: Float, id: Symbol).returns( + T.attached_class + ) + end + def self.new(flag:, threshold: nil, id: :illicit_alcohol) end - sig { override.returns({ id: Symbol, flag: T::Boolean }) } + sig do + override.returns({ id: Symbol, flag: T::Boolean, threshold: Float }) + end def to_hash end end @@ -925,11 +1009,23 @@ module ModerationAPI sig { returns(T::Boolean) } attr_accessor :flag - sig { params(flag: T::Boolean, id: Symbol).returns(T.attached_class) } - def self.new(flag:, id: :illicit_firearms) + sig { returns(T.nilable(Float)) } + attr_reader :threshold + + sig { params(threshold: Float).void } + attr_writer :threshold + + sig do + params(flag: T::Boolean, threshold: Float, id: Symbol).returns( + T.attached_class + ) + end + def self.new(flag:, threshold: nil, id: :illicit_firearms) end - sig { override.returns({ id: Symbol, flag: T::Boolean }) } + sig do + override.returns({ id: Symbol, flag: T::Boolean, threshold: Float }) + end def to_hash end end @@ -949,11 +1045,23 @@ module ModerationAPI sig { returns(T::Boolean) } attr_accessor :flag - sig { params(flag: T::Boolean, id: Symbol).returns(T.attached_class) } - def self.new(flag:, id: :illicit_tobacco) + sig { returns(T.nilable(Float)) } + attr_reader :threshold + + sig { params(threshold: Float).void } + attr_writer :threshold + + sig do + params(flag: T::Boolean, threshold: Float, id: Symbol).returns( + T.attached_class + ) + end + def self.new(flag:, threshold: nil, id: :illicit_tobacco) end - sig { override.returns({ id: Symbol, flag: T::Boolean }) } + sig do + override.returns({ id: Symbol, flag: T::Boolean, threshold: Float }) + end def to_hash end end @@ -973,11 +1081,23 @@ module ModerationAPI sig { returns(T::Boolean) } attr_accessor :flag - sig { params(flag: T::Boolean, id: Symbol).returns(T.attached_class) } - def self.new(flag:, id: :illicit_gambling) + sig { returns(T.nilable(Float)) } + attr_reader :threshold + + sig { params(threshold: Float).void } + attr_writer :threshold + + sig do + params(flag: T::Boolean, threshold: Float, id: Symbol).returns( + T.attached_class + ) + end + def self.new(flag:, threshold: nil, id: :illicit_gambling) end - sig { override.returns({ id: Symbol, flag: T::Boolean }) } + sig do + override.returns({ id: Symbol, flag: T::Boolean, threshold: Float }) + end def to_hash end end @@ -997,11 +1117,23 @@ module ModerationAPI sig { returns(T::Boolean) } attr_accessor :flag - sig { params(flag: T::Boolean, id: Symbol).returns(T.attached_class) } - def self.new(flag:, id: :sexual) + sig { returns(T.nilable(Float)) } + attr_reader :threshold + + sig { params(threshold: Float).void } + attr_writer :threshold + + sig do + params(flag: T::Boolean, threshold: Float, id: Symbol).returns( + T.attached_class + ) + end + def self.new(flag:, threshold: nil, id: :sexual) end - sig { override.returns({ id: Symbol, flag: T::Boolean }) } + sig do + override.returns({ id: Symbol, flag: T::Boolean, threshold: Float }) + end def to_hash end end @@ -1021,11 +1153,23 @@ module ModerationAPI sig { returns(T::Boolean) } attr_accessor :flag - sig { params(flag: T::Boolean, id: Symbol).returns(T.attached_class) } - def self.new(flag:, id: :flirtation) + sig { returns(T.nilable(Float)) } + attr_reader :threshold + + sig { params(threshold: Float).void } + attr_writer :threshold + + sig do + params(flag: T::Boolean, threshold: Float, id: Symbol).returns( + T.attached_class + ) + end + def self.new(flag:, threshold: nil, id: :flirtation) end - sig { override.returns({ id: Symbol, flag: T::Boolean }) } + sig do + override.returns({ id: Symbol, flag: T::Boolean, threshold: Float }) + end def to_hash end end @@ -1045,11 +1189,23 @@ module ModerationAPI sig { returns(T::Boolean) } attr_accessor :flag - sig { params(flag: T::Boolean, id: Symbol).returns(T.attached_class) } - def self.new(flag:, id: :profanity) + sig { returns(T.nilable(Float)) } + attr_reader :threshold + + sig { params(threshold: Float).void } + attr_writer :threshold + + sig do + params(flag: T::Boolean, threshold: Float, id: Symbol).returns( + T.attached_class + ) + end + def self.new(flag:, threshold: nil, id: :profanity) end - sig { override.returns({ id: Symbol, flag: T::Boolean }) } + sig do + override.returns({ id: Symbol, flag: T::Boolean, threshold: Float }) + end def to_hash end end @@ -1069,11 +1225,23 @@ module ModerationAPI sig { returns(T::Boolean) } attr_accessor :flag - sig { params(flag: T::Boolean, id: Symbol).returns(T.attached_class) } - def self.new(flag:, id: :violence) + sig { returns(T.nilable(Float)) } + attr_reader :threshold + + sig { params(threshold: Float).void } + attr_writer :threshold + + sig do + params(flag: T::Boolean, threshold: Float, id: Symbol).returns( + T.attached_class + ) + end + def self.new(flag:, threshold: nil, id: :violence) end - sig { override.returns({ id: Symbol, flag: T::Boolean }) } + sig do + override.returns({ id: Symbol, flag: T::Boolean, threshold: Float }) + end def to_hash end end @@ -1093,11 +1261,23 @@ module ModerationAPI sig { returns(T::Boolean) } attr_accessor :flag - sig { params(flag: T::Boolean, id: Symbol).returns(T.attached_class) } - def self.new(flag:, id: :self_harm) + sig { returns(T.nilable(Float)) } + attr_reader :threshold + + sig { params(threshold: Float).void } + attr_writer :threshold + + sig do + params(flag: T::Boolean, threshold: Float, id: Symbol).returns( + T.attached_class + ) + end + def self.new(flag:, threshold: nil, id: :self_harm) end - sig { override.returns({ id: Symbol, flag: T::Boolean }) } + sig do + override.returns({ id: Symbol, flag: T::Boolean, threshold: Float }) + end def to_hash end end @@ -1117,11 +1297,23 @@ module ModerationAPI sig { returns(T::Boolean) } attr_accessor :flag - sig { params(flag: T::Boolean, id: Symbol).returns(T.attached_class) } - def self.new(flag:, id: :spam) + sig { returns(T.nilable(Float)) } + attr_reader :threshold + + sig { params(threshold: Float).void } + attr_writer :threshold + + sig do + params(flag: T::Boolean, threshold: Float, id: Symbol).returns( + T.attached_class + ) + end + def self.new(flag:, threshold: nil, id: :spam) end - sig { override.returns({ id: Symbol, flag: T::Boolean }) } + sig do + override.returns({ id: Symbol, flag: T::Boolean, threshold: Float }) + end def to_hash end end @@ -1141,11 +1333,23 @@ module ModerationAPI sig { returns(T::Boolean) } attr_accessor :flag - sig { params(flag: T::Boolean, id: Symbol).returns(T.attached_class) } - def self.new(flag:, id: :self_promotion) + sig { returns(T.nilable(Float)) } + attr_reader :threshold + + sig { params(threshold: Float).void } + attr_writer :threshold + + sig do + params(flag: T::Boolean, threshold: Float, id: Symbol).returns( + T.attached_class + ) + end + def self.new(flag:, threshold: nil, id: :self_promotion) end - sig { override.returns({ id: Symbol, flag: T::Boolean }) } + sig do + override.returns({ id: Symbol, flag: T::Boolean, threshold: Float }) + end def to_hash end end @@ -1165,11 +1369,23 @@ module ModerationAPI sig { returns(T::Boolean) } attr_accessor :flag - sig { params(flag: T::Boolean, id: Symbol).returns(T.attached_class) } - def self.new(flag:, id: :political) + sig { returns(T.nilable(Float)) } + attr_reader :threshold + + sig { params(threshold: Float).void } + attr_writer :threshold + + sig do + params(flag: T::Boolean, threshold: Float, id: Symbol).returns( + T.attached_class + ) + end + def self.new(flag:, threshold: nil, id: :political) end - sig { override.returns({ id: Symbol, flag: T::Boolean }) } + sig do + override.returns({ id: Symbol, flag: T::Boolean, threshold: Float }) + end def to_hash end end @@ -1189,11 +1405,23 @@ module ModerationAPI sig { returns(T::Boolean) } attr_accessor :flag - sig { params(flag: T::Boolean, id: Symbol).returns(T.attached_class) } - def self.new(flag:, id: :religion) + sig { returns(T.nilable(Float)) } + attr_reader :threshold + + sig { params(threshold: Float).void } + attr_writer :threshold + + sig do + params(flag: T::Boolean, threshold: Float, id: Symbol).returns( + T.attached_class + ) + end + def self.new(flag:, threshold: nil, id: :religion) end - sig { override.returns({ id: Symbol, flag: T::Boolean }) } + sig do + override.returns({ id: Symbol, flag: T::Boolean, threshold: Float }) + end def to_hash end end @@ -1213,11 +1441,23 @@ module ModerationAPI sig { returns(T::Boolean) } attr_accessor :flag - sig { params(flag: T::Boolean, id: Symbol).returns(T.attached_class) } - def self.new(flag:, id: :code_abuse) + sig { returns(T.nilable(Float)) } + attr_reader :threshold + + sig { params(threshold: Float).void } + attr_writer :threshold + + sig do + params(flag: T::Boolean, threshold: Float, id: Symbol).returns( + T.attached_class + ) + end + def self.new(flag:, threshold: nil, id: :code_abuse) end - sig { override.returns({ id: Symbol, flag: T::Boolean }) } + sig do + override.returns({ id: Symbol, flag: T::Boolean, threshold: Float }) + end def to_hash end end @@ -1603,15 +1843,28 @@ module ModerationAPI sig { returns(String) } attr_accessor :instructions + sig { returns(T.nilable(Float)) } + attr_reader :threshold + + sig { params(threshold: Float).void } + attr_writer :threshold + sig do params( flag: T::Boolean, guideline_key: String, instructions: String, + threshold: Float, id: Symbol ).returns(T.attached_class) end - def self.new(flag:, guideline_key:, instructions:, id: :guideline) + def self.new( + flag:, + guideline_key:, + instructions:, + threshold: nil, + id: :guideline + ) end sig do @@ -1620,7 +1873,8 @@ module ModerationAPI id: Symbol, flag: T::Boolean, guideline_key: String, - instructions: String + instructions: String, + threshold: Float } ) end diff --git a/sig/moderation_api/models/content_submit_params.rbs b/sig/moderation_api/models/content_submit_params.rbs index ce91819..88eec43 100644 --- a/sig/moderation_api/models/content_submit_params.rbs +++ b/sig/moderation_api/models/content_submit_params.rbs @@ -278,244 +278,408 @@ module ModerationAPI module Policy extend ModerationAPI::Internal::Type::Union - type toxicity = { id: :toxicity, flag: bool } + type toxicity = { id: :toxicity, flag: bool, threshold: Float } class Toxicity < ModerationAPI::Internal::Type::BaseModel attr_accessor id: :toxicity attr_accessor flag: bool - def initialize: (flag: bool, ?id: :toxicity) -> void + attr_reader threshold: Float? - def to_hash: -> { id: :toxicity, flag: bool } + def threshold=: (Float) -> Float + + def initialize: ( + flag: bool, + ?threshold: Float, + ?id: :toxicity + ) -> void + + def to_hash: -> { id: :toxicity, flag: bool, threshold: Float } end - type personal_information = { id: :personal_information, flag: bool } + type personal_information = + { id: :personal_information, flag: bool, threshold: Float } class PersonalInformation < ModerationAPI::Internal::Type::BaseModel attr_accessor id: :personal_information attr_accessor flag: bool - def initialize: (flag: bool, ?id: :personal_information) -> void + attr_reader threshold: Float? + + def threshold=: (Float) -> Float - def to_hash: -> { id: :personal_information, flag: bool } + def initialize: ( + flag: bool, + ?threshold: Float, + ?id: :personal_information + ) -> void + + def to_hash: -> { + id: :personal_information, + flag: bool, + threshold: Float + } end - type toxicity_severe = { id: :toxicity_severe, flag: bool } + type toxicity_severe = + { id: :toxicity_severe, flag: bool, threshold: Float } class ToxicitySevere < ModerationAPI::Internal::Type::BaseModel attr_accessor id: :toxicity_severe attr_accessor flag: bool - def initialize: (flag: bool, ?id: :toxicity_severe) -> void + attr_reader threshold: Float? - def to_hash: -> { id: :toxicity_severe, flag: bool } + def threshold=: (Float) -> Float + + def initialize: ( + flag: bool, + ?threshold: Float, + ?id: :toxicity_severe + ) -> void + + def to_hash: -> { id: :toxicity_severe, flag: bool, threshold: Float } end - type hate = { id: :hate, flag: bool } + type hate = { id: :hate, flag: bool, threshold: Float } class Hate < ModerationAPI::Internal::Type::BaseModel attr_accessor id: :hate attr_accessor flag: bool - def initialize: (flag: bool, ?id: :hate) -> void + attr_reader threshold: Float? + + def threshold=: (Float) -> Float + + def initialize: (flag: bool, ?threshold: Float, ?id: :hate) -> void - def to_hash: -> { id: :hate, flag: bool } + def to_hash: -> { id: :hate, flag: bool, threshold: Float } end - type illicit = { id: :illicit, flag: bool } + type illicit = { id: :illicit, flag: bool, threshold: Float } class Illicit < ModerationAPI::Internal::Type::BaseModel attr_accessor id: :illicit attr_accessor flag: bool - def initialize: (flag: bool, ?id: :illicit) -> void + attr_reader threshold: Float? - def to_hash: -> { id: :illicit, flag: bool } + def threshold=: (Float) -> Float + + def initialize: (flag: bool, ?threshold: Float, ?id: :illicit) -> void + + def to_hash: -> { id: :illicit, flag: bool, threshold: Float } end - type illicit_drugs = { id: :illicit_drugs, flag: bool } + type illicit_drugs = + { id: :illicit_drugs, flag: bool, threshold: Float } class IllicitDrugs < ModerationAPI::Internal::Type::BaseModel attr_accessor id: :illicit_drugs attr_accessor flag: bool - def initialize: (flag: bool, ?id: :illicit_drugs) -> void + attr_reader threshold: Float? + + def threshold=: (Float) -> Float - def to_hash: -> { id: :illicit_drugs, flag: bool } + def initialize: ( + flag: bool, + ?threshold: Float, + ?id: :illicit_drugs + ) -> void + + def to_hash: -> { id: :illicit_drugs, flag: bool, threshold: Float } end - type illicit_alcohol = { id: :illicit_alcohol, flag: bool } + type illicit_alcohol = + { id: :illicit_alcohol, flag: bool, threshold: Float } class IllicitAlcohol < ModerationAPI::Internal::Type::BaseModel attr_accessor id: :illicit_alcohol attr_accessor flag: bool - def initialize: (flag: bool, ?id: :illicit_alcohol) -> void + attr_reader threshold: Float? + + def threshold=: (Float) -> Float - def to_hash: -> { id: :illicit_alcohol, flag: bool } + def initialize: ( + flag: bool, + ?threshold: Float, + ?id: :illicit_alcohol + ) -> void + + def to_hash: -> { id: :illicit_alcohol, flag: bool, threshold: Float } end - type illicit_firearms = { id: :illicit_firearms, flag: bool } + type illicit_firearms = + { id: :illicit_firearms, flag: bool, threshold: Float } class IllicitFirearms < ModerationAPI::Internal::Type::BaseModel attr_accessor id: :illicit_firearms attr_accessor flag: bool - def initialize: (flag: bool, ?id: :illicit_firearms) -> void + attr_reader threshold: Float? + + def threshold=: (Float) -> Float - def to_hash: -> { id: :illicit_firearms, flag: bool } + def initialize: ( + flag: bool, + ?threshold: Float, + ?id: :illicit_firearms + ) -> void + + def to_hash: -> { + id: :illicit_firearms, + flag: bool, + threshold: Float + } end - type illicit_tobacco = { id: :illicit_tobacco, flag: bool } + type illicit_tobacco = + { id: :illicit_tobacco, flag: bool, threshold: Float } class IllicitTobacco < ModerationAPI::Internal::Type::BaseModel attr_accessor id: :illicit_tobacco attr_accessor flag: bool - def initialize: (flag: bool, ?id: :illicit_tobacco) -> void + attr_reader threshold: Float? + + def threshold=: (Float) -> Float + + def initialize: ( + flag: bool, + ?threshold: Float, + ?id: :illicit_tobacco + ) -> void - def to_hash: -> { id: :illicit_tobacco, flag: bool } + def to_hash: -> { id: :illicit_tobacco, flag: bool, threshold: Float } end - type illicit_gambling = { id: :illicit_gambling, flag: bool } + type illicit_gambling = + { id: :illicit_gambling, flag: bool, threshold: Float } class IllicitGambling < ModerationAPI::Internal::Type::BaseModel attr_accessor id: :illicit_gambling attr_accessor flag: bool - def initialize: (flag: bool, ?id: :illicit_gambling) -> void + attr_reader threshold: Float? - def to_hash: -> { id: :illicit_gambling, flag: bool } + def threshold=: (Float) -> Float + + def initialize: ( + flag: bool, + ?threshold: Float, + ?id: :illicit_gambling + ) -> void + + def to_hash: -> { + id: :illicit_gambling, + flag: bool, + threshold: Float + } end - type sexual = { id: :sexual, flag: bool } + type sexual = { id: :sexual, flag: bool, threshold: Float } class Sexual < ModerationAPI::Internal::Type::BaseModel attr_accessor id: :sexual attr_accessor flag: bool - def initialize: (flag: bool, ?id: :sexual) -> void + attr_reader threshold: Float? + + def threshold=: (Float) -> Float + + def initialize: (flag: bool, ?threshold: Float, ?id: :sexual) -> void - def to_hash: -> { id: :sexual, flag: bool } + def to_hash: -> { id: :sexual, flag: bool, threshold: Float } end - type flirtation = { id: :flirtation, flag: bool } + type flirtation = { id: :flirtation, flag: bool, threshold: Float } class Flirtation < ModerationAPI::Internal::Type::BaseModel attr_accessor id: :flirtation attr_accessor flag: bool - def initialize: (flag: bool, ?id: :flirtation) -> void + attr_reader threshold: Float? - def to_hash: -> { id: :flirtation, flag: bool } + def threshold=: (Float) -> Float + + def initialize: ( + flag: bool, + ?threshold: Float, + ?id: :flirtation + ) -> void + + def to_hash: -> { id: :flirtation, flag: bool, threshold: Float } end - type profanity = { id: :profanity, flag: bool } + type profanity = { id: :profanity, flag: bool, threshold: Float } class Profanity < ModerationAPI::Internal::Type::BaseModel attr_accessor id: :profanity attr_accessor flag: bool - def initialize: (flag: bool, ?id: :profanity) -> void + attr_reader threshold: Float? + + def threshold=: (Float) -> Float - def to_hash: -> { id: :profanity, flag: bool } + def initialize: ( + flag: bool, + ?threshold: Float, + ?id: :profanity + ) -> void + + def to_hash: -> { id: :profanity, flag: bool, threshold: Float } end - type violence = { id: :violence, flag: bool } + type violence = { id: :violence, flag: bool, threshold: Float } class Violence < ModerationAPI::Internal::Type::BaseModel attr_accessor id: :violence attr_accessor flag: bool - def initialize: (flag: bool, ?id: :violence) -> void + attr_reader threshold: Float? + + def threshold=: (Float) -> Float + + def initialize: ( + flag: bool, + ?threshold: Float, + ?id: :violence + ) -> void - def to_hash: -> { id: :violence, flag: bool } + def to_hash: -> { id: :violence, flag: bool, threshold: Float } end - type self_harm = { id: :self_harm, flag: bool } + type self_harm = { id: :self_harm, flag: bool, threshold: Float } class SelfHarm < ModerationAPI::Internal::Type::BaseModel attr_accessor id: :self_harm attr_accessor flag: bool - def initialize: (flag: bool, ?id: :self_harm) -> void + attr_reader threshold: Float? - def to_hash: -> { id: :self_harm, flag: bool } + def threshold=: (Float) -> Float + + def initialize: ( + flag: bool, + ?threshold: Float, + ?id: :self_harm + ) -> void + + def to_hash: -> { id: :self_harm, flag: bool, threshold: Float } end - type spam = { id: :spam, flag: bool } + type spam = { id: :spam, flag: bool, threshold: Float } class Spam < ModerationAPI::Internal::Type::BaseModel attr_accessor id: :spam attr_accessor flag: bool - def initialize: (flag: bool, ?id: :spam) -> void + attr_reader threshold: Float? + + def threshold=: (Float) -> Float - def to_hash: -> { id: :spam, flag: bool } + def initialize: (flag: bool, ?threshold: Float, ?id: :spam) -> void + + def to_hash: -> { id: :spam, flag: bool, threshold: Float } end - type self_promotion = { id: :self_promotion, flag: bool } + type self_promotion = + { id: :self_promotion, flag: bool, threshold: Float } class SelfPromotion < ModerationAPI::Internal::Type::BaseModel attr_accessor id: :self_promotion attr_accessor flag: bool - def initialize: (flag: bool, ?id: :self_promotion) -> void + attr_reader threshold: Float? + + def threshold=: (Float) -> Float - def to_hash: -> { id: :self_promotion, flag: bool } + def initialize: ( + flag: bool, + ?threshold: Float, + ?id: :self_promotion + ) -> void + + def to_hash: -> { id: :self_promotion, flag: bool, threshold: Float } end - type political = { id: :political, flag: bool } + type political = { id: :political, flag: bool, threshold: Float } class Political < ModerationAPI::Internal::Type::BaseModel attr_accessor id: :political attr_accessor flag: bool - def initialize: (flag: bool, ?id: :political) -> void + attr_reader threshold: Float? + + def threshold=: (Float) -> Float - def to_hash: -> { id: :political, flag: bool } + def initialize: ( + flag: bool, + ?threshold: Float, + ?id: :political + ) -> void + + def to_hash: -> { id: :political, flag: bool, threshold: Float } end - type religion = { id: :religion, flag: bool } + type religion = { id: :religion, flag: bool, threshold: Float } class Religion < ModerationAPI::Internal::Type::BaseModel attr_accessor id: :religion attr_accessor flag: bool - def initialize: (flag: bool, ?id: :religion) -> void + attr_reader threshold: Float? + + def threshold=: (Float) -> Float - def to_hash: -> { id: :religion, flag: bool } + def initialize: ( + flag: bool, + ?threshold: Float, + ?id: :religion + ) -> void + + def to_hash: -> { id: :religion, flag: bool, threshold: Float } end - type code_abuse = { id: :code_abuse, flag: bool } + type code_abuse = { id: :code_abuse, flag: bool, threshold: Float } class CodeAbuse < ModerationAPI::Internal::Type::BaseModel attr_accessor id: :code_abuse attr_accessor flag: bool - def initialize: (flag: bool, ?id: :code_abuse) -> void + attr_reader threshold: Float? + + def threshold=: (Float) -> Float + + def initialize: ( + flag: bool, + ?threshold: Float, + ?id: :code_abuse + ) -> void - def to_hash: -> { id: :code_abuse, flag: bool } + def to_hash: -> { id: :code_abuse, flag: bool, threshold: Float } end type pii_masking = @@ -699,7 +863,8 @@ module ModerationAPI id: :guideline, flag: bool, guideline_key: String, - instructions: String + instructions: String, + threshold: Float } class Guideline < ModerationAPI::Internal::Type::BaseModel @@ -711,10 +876,15 @@ module ModerationAPI attr_accessor instructions: String + attr_reader threshold: Float? + + def threshold=: (Float) -> Float + def initialize: ( flag: bool, guideline_key: String, instructions: String, + ?threshold: Float, ?id: :guideline ) -> void @@ -722,7 +892,8 @@ module ModerationAPI id: :guideline, flag: bool, guideline_key: String, - instructions: String + instructions: String, + threshold: Float } end From 3774c1baa7b633a780488e006bd9590f7417ae26 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 18 Dec 2025 15:32:28 +0000 Subject: [PATCH 2/2] release: 2.2.0 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 8 ++++++++ Gemfile.lock | 2 +- README.md | 2 +- lib/moderation_api/version.rb | 2 +- 5 files changed, 12 insertions(+), 4 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 19588bd..bfc26f9 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "2.1.1" + ".": "2.2.0" } \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index ab59334..9c166de 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # Changelog +## 2.2.0 (2025-12-18) + +Full Changelog: [v2.1.1...v2.2.0](https://github.com/moderation-api/sdk-ruby/compare/v2.1.1...v2.2.0) + +### Features + +* **api:** api update ([37d5a3d](https://github.com/moderation-api/sdk-ruby/commit/37d5a3d6185eaddfce7a79d9b4799568d694782a)) + ## 2.1.1 (2025-12-17) Full Changelog: [v2.1.0...v2.1.1](https://github.com/moderation-api/sdk-ruby/compare/v2.1.0...v2.1.1) diff --git a/Gemfile.lock b/Gemfile.lock index 301b868..481266b 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -11,7 +11,7 @@ GIT PATH remote: . specs: - moderation_api (2.1.1) + moderation_api (2.2.0) connection_pool GEM diff --git a/README.md b/README.md index b123534..6041e83 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.1.1" +gem "moderation_api", "~> 2.2.0" ``` diff --git a/lib/moderation_api/version.rb b/lib/moderation_api/version.rb index 395aeac..e2a02bd 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.1.1" + VERSION = "2.2.0" end