Method: MatrixSdk::Protocols::CS#report_event

Defined in:
lib/matrix_sdk/protocols/cs.rb

#report_event(room_id, event_id, score:, reason:, **params) ⇒ Object

Report an event in a room

Parameters:

  • room_id (MXID, String)

    The room ID in which the event occurred

  • room_id (MXID, String)

    The event ID to report

  • score (Integer)

    The severity of the report, range between -100 - 0

  • reason (String)

    The reason for the report

See Also:



678
679
680
681
682
683
684
685
686
687
688
689
690
691
# File 'lib/matrix_sdk/protocols/cs.rb', line 678

def report_event(room_id, event_id, score:, reason:, **params)
  query = {}
  query[:user_id] = params.delete(:user_id) if protocol?(:AS) && params.key?(:user_id)

  body = {
    score: score,
    reason: reason
  }

  room_id = ERB::Util.url_encode room_id.to_s
  event_id = ERB::Util.url_encode event_id.to_s

  request(:post, :client_r0, "/rooms/#{room_id}/report/#{event_id}", body: body, query: query)
end