moderation_api 2.20.0 → 2.21.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.
@@ -43,6 +43,22 @@ module ModerationAPI
43
43
  sig { params(channel: String).void }
44
44
  attr_writer :channel
45
45
 
46
+ # A recommendation from your own client-side flagging (e.g. a banned-IP list or a
47
+ # third-party tool). Feeds the rules engine and can escalate or override the
48
+ # recommended action. Does not change whether our analysis flagged the content.
49
+ sig do
50
+ returns(T.nilable(ModerationAPI::ContentSubmitParams::ClientAction))
51
+ end
52
+ attr_reader :client_action
53
+
54
+ sig do
55
+ params(
56
+ client_action:
57
+ ModerationAPI::ContentSubmitParams::ClientAction::OrHash
58
+ ).void
59
+ end
60
+ attr_writer :client_action
61
+
46
62
  # The unique ID of the content in your database.
47
63
  sig { returns(T.nilable(String)) }
48
64
  attr_reader :content_id
@@ -188,6 +204,8 @@ module ModerationAPI
188
204
  ),
189
205
  author_id: String,
190
206
  channel: String,
207
+ client_action:
208
+ ModerationAPI::ContentSubmitParams::ClientAction::OrHash,
191
209
  content_id: String,
192
210
  conversation_id: String,
193
211
  do_not_store: T::Boolean,
@@ -239,6 +257,10 @@ module ModerationAPI
239
257
  # Provide a channel ID or key. Will use the project's default channel if not
240
258
  # provided.
241
259
  channel: nil,
260
+ # A recommendation from your own client-side flagging (e.g. a banned-IP list or a
261
+ # third-party tool). Feeds the rules engine and can escalate or override the
262
+ # recommended action. Does not change whether our analysis flagged the content.
263
+ client_action: nil,
242
264
  # The unique ID of the content in your database.
243
265
  content_id: nil,
244
266
  # For example the ID of a chat room or a post
@@ -271,6 +293,7 @@ module ModerationAPI
271
293
  ),
272
294
  author_id: String,
273
295
  channel: String,
296
+ client_action: ModerationAPI::ContentSubmitParams::ClientAction,
274
297
  content_id: String,
275
298
  conversation_id: String,
276
299
  do_not_store: T::Boolean,
@@ -723,6 +746,174 @@ module ModerationAPI
723
746
  end
724
747
  end
725
748
 
749
+ class ClientAction < ModerationAPI::Internal::Type::BaseModel
750
+ OrHash =
751
+ T.type_alias do
752
+ T.any(
753
+ ModerationAPI::ContentSubmitParams::ClientAction,
754
+ ModerationAPI::Internal::AnyHash
755
+ )
756
+ end
757
+
758
+ # Your recommendation for the content: allow, review, or reject.
759
+ sig do
760
+ returns(
761
+ ModerationAPI::ContentSubmitParams::ClientAction::Action::OrSymbol
762
+ )
763
+ end
764
+ attr_accessor :action
765
+
766
+ # How your recommendation combines with ours. Defaults to 'escalate', which only
767
+ # applies it when stricter than ours; 'override' replaces ours outright.
768
+ sig do
769
+ returns(
770
+ T.nilable(
771
+ ModerationAPI::ContentSubmitParams::ClientAction::Behavior::OrSymbol
772
+ )
773
+ )
774
+ end
775
+ attr_reader :behavior
776
+
777
+ sig do
778
+ params(
779
+ behavior:
780
+ ModerationAPI::ContentSubmitParams::ClientAction::Behavior::OrSymbol
781
+ ).void
782
+ end
783
+ attr_writer :behavior
784
+
785
+ # A human-readable explanation for your recommendation.
786
+ sig { returns(T.nilable(String)) }
787
+ attr_reader :reason
788
+
789
+ sig { params(reason: String).void }
790
+ attr_writer :reason
791
+
792
+ # Where your recommendation came from, e.g. "banned-ip".
793
+ sig { returns(T.nilable(String)) }
794
+ attr_reader :source
795
+
796
+ sig { params(source: String).void }
797
+ attr_writer :source
798
+
799
+ # A recommendation from your own client-side flagging (e.g. a banned-IP list or a
800
+ # third-party tool). Feeds the rules engine and can escalate or override the
801
+ # recommended action. Does not change whether our analysis flagged the content.
802
+ sig do
803
+ params(
804
+ action:
805
+ ModerationAPI::ContentSubmitParams::ClientAction::Action::OrSymbol,
806
+ behavior:
807
+ ModerationAPI::ContentSubmitParams::ClientAction::Behavior::OrSymbol,
808
+ reason: String,
809
+ source: String
810
+ ).returns(T.attached_class)
811
+ end
812
+ def self.new(
813
+ # Your recommendation for the content: allow, review, or reject.
814
+ action:,
815
+ # How your recommendation combines with ours. Defaults to 'escalate', which only
816
+ # applies it when stricter than ours; 'override' replaces ours outright.
817
+ behavior: nil,
818
+ # A human-readable explanation for your recommendation.
819
+ reason: nil,
820
+ # Where your recommendation came from, e.g. "banned-ip".
821
+ source: nil
822
+ )
823
+ end
824
+
825
+ sig do
826
+ override.returns(
827
+ {
828
+ action:
829
+ ModerationAPI::ContentSubmitParams::ClientAction::Action::OrSymbol,
830
+ behavior:
831
+ ModerationAPI::ContentSubmitParams::ClientAction::Behavior::OrSymbol,
832
+ reason: String,
833
+ source: String
834
+ }
835
+ )
836
+ end
837
+ def to_hash
838
+ end
839
+
840
+ # Your recommendation for the content: allow, review, or reject.
841
+ module Action
842
+ extend ModerationAPI::Internal::Type::Enum
843
+
844
+ TaggedSymbol =
845
+ T.type_alias do
846
+ T.all(
847
+ Symbol,
848
+ ModerationAPI::ContentSubmitParams::ClientAction::Action
849
+ )
850
+ end
851
+ OrSymbol = T.type_alias { T.any(Symbol, String) }
852
+
853
+ REVIEW =
854
+ T.let(
855
+ :review,
856
+ ModerationAPI::ContentSubmitParams::ClientAction::Action::TaggedSymbol
857
+ )
858
+ ALLOW =
859
+ T.let(
860
+ :allow,
861
+ ModerationAPI::ContentSubmitParams::ClientAction::Action::TaggedSymbol
862
+ )
863
+ REJECT =
864
+ T.let(
865
+ :reject,
866
+ ModerationAPI::ContentSubmitParams::ClientAction::Action::TaggedSymbol
867
+ )
868
+
869
+ sig do
870
+ override.returns(
871
+ T::Array[
872
+ ModerationAPI::ContentSubmitParams::ClientAction::Action::TaggedSymbol
873
+ ]
874
+ )
875
+ end
876
+ def self.values
877
+ end
878
+ end
879
+
880
+ # How your recommendation combines with ours. Defaults to 'escalate', which only
881
+ # applies it when stricter than ours; 'override' replaces ours outright.
882
+ module Behavior
883
+ extend ModerationAPI::Internal::Type::Enum
884
+
885
+ TaggedSymbol =
886
+ T.type_alias do
887
+ T.all(
888
+ Symbol,
889
+ ModerationAPI::ContentSubmitParams::ClientAction::Behavior
890
+ )
891
+ end
892
+ OrSymbol = T.type_alias { T.any(Symbol, String) }
893
+
894
+ OVERRIDE =
895
+ T.let(
896
+ :override,
897
+ ModerationAPI::ContentSubmitParams::ClientAction::Behavior::TaggedSymbol
898
+ )
899
+ ESCALATE =
900
+ T.let(
901
+ :escalate,
902
+ ModerationAPI::ContentSubmitParams::ClientAction::Behavior::TaggedSymbol
903
+ )
904
+
905
+ sig do
906
+ override.returns(
907
+ T::Array[
908
+ ModerationAPI::ContentSubmitParams::ClientAction::Behavior::TaggedSymbol
909
+ ]
910
+ )
911
+ end
912
+ def self.values
913
+ end
914
+ end
915
+ end
916
+
726
917
  # The meta type of content being moderated
727
918
  module MetaType
728
919
  extend ModerationAPI::Internal::Type::Enum
@@ -1776,6 +1776,11 @@ module ModerationAPI
1776
1776
  :rule_fallback,
1777
1777
  ModerationAPI::Models::ContentSubmitResponse::Recommendation::ReasonCode::TaggedSymbol
1778
1778
  )
1779
+ CLIENT_OVERRIDE =
1780
+ T.let(
1781
+ :client_override,
1782
+ ModerationAPI::Models::ContentSubmitResponse::Recommendation::ReasonCode::TaggedSymbol
1783
+ )
1779
1784
 
1780
1785
  sig do
1781
1786
  override.returns(