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

#appeal(appeal_request) ⇒ Models::AppealResponse

Appeal against the moderation decision



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

def appeal(appeal_request)
  path = '/api/v2/moderation/appeal'
  # Build request body
  body = appeal_request

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

#ban(ban_request) ⇒ Models::BanResponse

Ban a user from a channel or the entire app



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

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



86
87
88
89
90
91
92
93
94
95
96
97
# File 'lib/getstream_ruby/generated/moderation_client.rb', line 86

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



103
104
105
106
107
108
109
110
111
112
113
114
# File 'lib/getstream_ruby/generated/moderation_client.rb', line 103

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



196
197
198
199
200
201
202
203
204
205
206
207
# File 'lib/getstream_ruby/generated/moderation_client.rb', line 196

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



138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
# File 'lib/getstream_ruby/generated/moderation_client.rb', line 138

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



323
324
325
326
327
328
329
330
331
# File 'lib/getstream_ruby/generated/moderation_client.rb', line 323

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.



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

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_appeal(_id) ⇒ Models::GetAppealResponse

Retrieve a specific appeal item by its ID



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

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

  # Make the API request
  @client.make_request(
    :get,
    path
  )
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.



159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
# File 'lib/getstream_ruby/generated/moderation_client.rb', line 159

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



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

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



401
402
403
404
405
406
407
408
409
410
411
# File 'lib/getstream_ruby/generated/moderation_client.rb', line 401

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.



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

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_appeals(query_appeals_request) ⇒ Models::QueryAppealsResponse

Query Appeals



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

def query_appeals(query_appeals_request)
  path = '/api/v2/moderation/appeals'
  # Build request body
  body = query_appeals_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.



179
180
181
182
183
184
185
186
187
188
189
190
# File 'lib/getstream_ruby/generated/moderation_client.rb', line 179

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.



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

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.



290
291
292
293
294
295
296
297
298
299
300
301
# File 'lib/getstream_ruby/generated/moderation_client.rb', line 290

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.



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

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.



384
385
386
387
388
389
390
391
392
393
394
395
# File 'lib/getstream_ruby/generated/moderation_client.rb', line 384

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.



417
418
419
420
421
422
423
424
425
426
427
428
# File 'lib/getstream_ruby/generated/moderation_client.rb', line 417

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.



437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
# File 'lib/getstream_ruby/generated/moderation_client.rb', line 437

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



460
461
462
463
464
465
466
467
468
469
470
471
# File 'lib/getstream_ruby/generated/moderation_client.rb', line 460

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.



120
121
122
123
124
125
126
127
128
129
130
131
# File 'lib/getstream_ruby/generated/moderation_client.rb', line 120

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



307
308
309
310
311
312
313
314
315
316
317
318
# File 'lib/getstream_ruby/generated/moderation_client.rb', line 307

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



212
213
214
215
216
217
218
219
220
# File 'lib/getstream_ruby/generated/moderation_client.rb', line 212

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.



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

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



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

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