Class: GetStream::Generated::ModerationClient

Inherits:
Object
  • Object
show all
Defined in:
lib/getstream_ruby/generated/moderation_client.rb

Overview

Moderation API client with generated methods

Instance Method Summary collapse

Constructor Details

#initialize(client) ⇒ ModerationClient



12
13
14
# File 'lib/getstream_ruby/generated/moderation_client.rb', line 12

def initialize(client)
  @client = client
end

Instance Method Details

#ban(ban_request) ⇒ Models::BanResponse

Ban a user from a channel or the entire app



19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/getstream_ruby/generated/moderation_client.rb', line 19

def ban(ban_request)
  path = '/api/v2/moderation/ban'
  # Build request body
  body = ban_request

  # Make the API request
  @client.make_request(
    :post,
    path,
    body: body
  )
end

#bulk_image_moderation(bulk_image_moderation_request) ⇒ Models::BulkImageModerationResponse

Moderate multiple images in bulk using a CSV file



36
37
38
39
40
41
42
43
44
45
46
47
# File 'lib/getstream_ruby/generated/moderation_client.rb', line 36

def bulk_image_moderation(bulk_image_moderation_request)
  path = '/api/v2/moderation/bulk_image_moderation'
  # Build request body
  body = bulk_image_moderation_request

  # Make the API request
  @client.make_request(
    :post,
    path,
    body: body
  )
end

#check(check_request) ⇒ Models::CheckResponse

Run moderation checks on the provided content



53
54
55
56
57
58
59
60
61
62
63
64
# File 'lib/getstream_ruby/generated/moderation_client.rb', line 53

def check(check_request)
  path = '/api/v2/moderation/check'
  # Build request body
  body = check_request

  # Make the API request
  @client.make_request(
    :post,
    path,
    body: body
  )
end

#custom_check(custom_check_request) ⇒ Models::CustomCheckResponse

Custom check, add your own AI model reports to the review queue



146
147
148
149
150
151
152
153
154
155
156
157
# File 'lib/getstream_ruby/generated/moderation_client.rb', line 146

def custom_check(custom_check_request)
  path = '/api/v2/moderation/custom_check'
  # Build request body
  body = custom_check_request

  # Make the API request
  @client.make_request(
    :post,
    path,
    body: body
  )
end

#delete_config(key, team = nil) ⇒ Models::DeleteModerationConfigResponse

Delete a specific moderation policy by its name



88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
# File 'lib/getstream_ruby/generated/moderation_client.rb', line 88

def delete_config(key, team = nil)
  path = '/api/v2/moderation/config/{key}'
  # Replace path parameters
  path = path.gsub('{key}', key.to_s)
  # Build query parameters
  query_params = {}
  query_params['team'] = team unless team.nil?

  # Make the API request
  @client.make_request(
    :delete,
    path,
    query_params: query_params
  )
end

#delete_moderation_ruleModels::DeleteModerationRuleResponse

Delete an existing moderation rule



273
274
275
276
277
278
279
280
281
# File 'lib/getstream_ruby/generated/moderation_client.rb', line 273

def delete_moderation_rule()
  path = '/api/v2/moderation/moderation_rule/{id}'

  # Make the API request
  @client.make_request(
    :delete,
    path
  )
end

#flag(flag_request) ⇒ Models::FlagResponse

Flag any type of content (messages, users, channels, activities) for moderation review. Supports custom content types and additional metadata for flagged content.



206
207
208
209
210
211
212
213
214
215
216
217
# File 'lib/getstream_ruby/generated/moderation_client.rb', line 206

def flag(flag_request)
  path = '/api/v2/moderation/flag'
  # Build request body
  body = flag_request

  # Make the API request
  @client.make_request(
    :post,
    path,
    body: body
  )
end

#get_config(key, team = nil) ⇒ Models::GetConfigResponse

Retrieve a specific moderation configuration by its key and team. This configuration contains settings for various moderation features like toxicity detection, AI analysis, and filtering rules.



109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
# File 'lib/getstream_ruby/generated/moderation_client.rb', line 109

def get_config(key, team = nil)
  path = '/api/v2/moderation/config/{key}'
  # Replace path parameters
  path = path.gsub('{key}', key.to_s)
  # Build query parameters
  query_params = {}
  query_params['team'] = team unless team.nil?

  # Make the API request
  @client.make_request(
    :get,
    path,
    query_params: query_params
  )
end

#get_moderation_ruleModels::GetModerationRuleResponse

Get a specific moderation rule by ID



286
287
288
289
290
291
292
293
294
# File 'lib/getstream_ruby/generated/moderation_client.rb', line 286

def get_moderation_rule()
  path = '/api/v2/moderation/moderation_rule/{id}'

  # Make the API request
  @client.make_request(
    :get,
    path
  )
end

#get_review_queue_item(_id) ⇒ Models::GetReviewQueueItemResponse

Retrieve a specific review queue item by its ID



351
352
353
354
355
356
357
358
359
360
361
# File 'lib/getstream_ruby/generated/moderation_client.rb', line 351

def get_review_queue_item(_id)
  path = '/api/v2/moderation/review_queue/{id}'
  # Replace path parameters
  path = path.gsub('{id}', _id.to_s)

  # Make the API request
  @client.make_request(
    :get,
    path
  )
end

#mute(mute_request) ⇒ Models::MuteResponse

Mute a user. Mutes are generally not visible to the user you mute, while block is something you notice.



317
318
319
320
321
322
323
324
325
326
327
328
# File 'lib/getstream_ruby/generated/moderation_client.rb', line 317

def mute(mute_request)
  path = '/api/v2/moderation/mute'
  # Build request body
  body = mute_request

  # Make the API request
  @client.make_request(
    :post,
    path,
    body: body
  )
end

#query_moderation_configs(query_moderation_configs_request) ⇒ Models::QueryModerationConfigsResponse

Search and filter moderation configurations across your application. This endpoint is designed for building moderation dashboards and managing multiple configuration sets.



129
130
131
132
133
134
135
136
137
138
139
140
# File 'lib/getstream_ruby/generated/moderation_client.rb', line 129

def query_moderation_configs(query_moderation_configs_request)
  path = '/api/v2/moderation/configs'
  # Build request body
  body = query_moderation_configs_request

  # Make the API request
  @client.make_request(
    :post,
    path,
    body: body
  )
end

#query_moderation_flags(query_moderation_flags_request) ⇒ Models::QueryModerationFlagsResponse

Query flags associated with moderation items. This is used for building a moderation dashboard.



223
224
225
226
227
228
229
230
231
232
233
234
# File 'lib/getstream_ruby/generated/moderation_client.rb', line 223

def query_moderation_flags(query_moderation_flags_request)
  path = '/api/v2/moderation/flags'
  # Build request body
  body = query_moderation_flags_request

  # Make the API request
  @client.make_request(
    :post,
    path,
    body: body
  )
end

#query_moderation_logs(query_moderation_logs_request) ⇒ Models::QueryModerationLogsResponse

Search and filter moderation action logs with support for pagination. View the history of moderation actions taken, including who performed them and when.



240
241
242
243
244
245
246
247
248
249
250
251
# File 'lib/getstream_ruby/generated/moderation_client.rb', line 240

def query_moderation_logs(query_moderation_logs_request)
  path = '/api/v2/moderation/logs'
  # Build request body
  body = query_moderation_logs_request

  # Make the API request
  @client.make_request(
    :post,
    path,
    body: body
  )
end

#query_moderation_rules(query_moderation_rules_request) ⇒ Models::QueryModerationRulesResponse

Search and filter moderation rules across your application. This endpoint is designed for building moderation dashboards and managing multiple rule sets.



300
301
302
303
304
305
306
307
308
309
310
311
# File 'lib/getstream_ruby/generated/moderation_client.rb', line 300

def query_moderation_rules(query_moderation_rules_request)
  path = '/api/v2/moderation/moderation_rules'
  # Build request body
  body = query_moderation_rules_request

  # Make the API request
  @client.make_request(
    :post,
    path,
    body: body
  )
end

#query_review_queue(query_review_queue_request) ⇒ Models::QueryReviewQueueResponse

Query review queue items allows you to filter the review queue items. This is used for building a moderation dashboard.



334
335
336
337
338
339
340
341
342
343
344
345
# File 'lib/getstream_ruby/generated/moderation_client.rb', line 334

def query_review_queue(query_review_queue_request)
  path = '/api/v2/moderation/review_queue'
  # Build request body
  body = query_review_queue_request

  # Make the API request
  @client.make_request(
    :post,
    path,
    body: body
  )
end

#submit_action(submit_action_request) ⇒ Models::SubmitActionResponse

Take action on flagged content, such as marking content as safe, deleting content, banning users, or executing custom moderation actions. Supports various action types with configurable parameters.



367
368
369
370
371
372
373
374
375
376
377
378
# File 'lib/getstream_ruby/generated/moderation_client.rb', line 367

def submit_action(submit_action_request)
  path = '/api/v2/moderation/submit_action'
  # Build request body
  body = submit_action_request

  # Make the API request
  @client.make_request(
    :post,
    path,
    body: body
  )
end

#unban(unban_request, target_user_id, channel_cid = nil, created_by = nil) ⇒ Models::UnbanResponse

Unban a user from a channel or globally.



387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
# File 'lib/getstream_ruby/generated/moderation_client.rb', line 387

def unban(unban_request, target_user_id, channel_cid = nil, created_by = nil)
  path = '/api/v2/moderation/unban'
  # Build query parameters
  query_params = {}
  query_params['target_user_id'] = target_user_id unless target_user_id.nil?
  query_params['channel_cid'] = channel_cid unless channel_cid.nil?
  query_params['created_by'] = created_by unless created_by.nil?
  # Build request body
  body = unban_request

  # Make the API request
  @client.make_request(
    :post,
    path,
    query_params: query_params,
    body: body
  )
end

#unmute(unmute_request) ⇒ Models::UnmuteResponse

Unmute a user



410
411
412
413
414
415
416
417
418
419
420
421
# File 'lib/getstream_ruby/generated/moderation_client.rb', line 410

def unmute(unmute_request)
  path = '/api/v2/moderation/unmute'
  # Build request body
  body = unmute_request

  # Make the API request
  @client.make_request(
    :post,
    path,
    body: body
  )
end

#upsert_config(upsert_config_request) ⇒ Models::UpsertConfigResponse

Create a new moderation configuration or update an existing one. Configure settings for content filtering, AI analysis, toxicity detection, and other moderation features.



70
71
72
73
74
75
76
77
78
79
80
81
# File 'lib/getstream_ruby/generated/moderation_client.rb', line 70

def upsert_config(upsert_config_request)
  path = '/api/v2/moderation/config'
  # Build request body
  body = upsert_config_request

  # Make the API request
  @client.make_request(
    :post,
    path,
    body: body
  )
end

#upsert_moderation_rule(upsert_moderation_rule_request) ⇒ Models::UpsertModerationRuleResponse

Create or update a moderation rule that can apply app-wide or to specific moderation configs



257
258
259
260
261
262
263
264
265
266
267
268
# File 'lib/getstream_ruby/generated/moderation_client.rb', line 257

def upsert_moderation_rule(upsert_moderation_rule_request)
  path = '/api/v2/moderation/moderation_rule'
  # Build request body
  body = upsert_moderation_rule_request

  # Make the API request
  @client.make_request(
    :post,
    path,
    body: body
  )
end

#v2_delete_templateModels::DeleteModerationTemplateResponse

Delete a specific moderation template by its name



162
163
164
165
166
167
168
169
170
# File 'lib/getstream_ruby/generated/moderation_client.rb', line 162

def v2_delete_template()
  path = '/api/v2/moderation/feeds_moderation_template'

  # Make the API request
  @client.make_request(
    :delete,
    path
  )
end

#v2_query_templatesModels::QueryFeedModerationTemplatesResponse

Retrieve a list of feed moderation templates that define preset moderation rules and configurations. Limited to 100 templates per request.



175
176
177
178
179
180
181
182
183
# File 'lib/getstream_ruby/generated/moderation_client.rb', line 175

def v2_query_templates()
  path = '/api/v2/moderation/feeds_moderation_template'

  # Make the API request
  @client.make_request(
    :get,
    path
  )
end

#v2_upsert_template(upsert_moderation_template_request) ⇒ Models::UpsertModerationTemplateResponse

Upsert feeds template for moderation



189
190
191
192
193
194
195
196
197
198
199
200
# File 'lib/getstream_ruby/generated/moderation_client.rb', line 189

def v2_upsert_template(upsert_moderation_template_request)
  path = '/api/v2/moderation/feeds_moderation_template'
  # Build request body
  body = upsert_moderation_template_request

  # Make the API request
  @client.make_request(
    :post,
    path,
    body: body
  )
end