Class: SafetyKit::Resources::Async

Inherits:
Object
  • Object
show all
Defined in:
lib/safety_kit/resources/async.rb,
sig/safety_kit/resources/async.rbs

Overview

Beta. Send backend events for account, content, user interaction, report, appeal, and moderation activity.

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ Async

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of Async.

Parameters:



44
45
46
# File 'lib/safety_kit/resources/async.rb', line 44

def initialize(client:)
  @client = client
end

Instance Method Details

#create_async(body:, request_options: {}) ⇒ SafetyKit::Models::AsyncCreateAsyncResponse

Some parameter documentations has been truncated, see Models::AsyncCreateAsyncParams for more details.

Beta. Queue backend events for asynchronous ingestion. This endpoint accepts the same request body as POST /v1/events, writes one SQS message per event, and returns after the events are queued. SafetyKit later processes the queued events through the standard event ingestion path. Event strings support tab (U+0009), line feed (U+000A), carriage return (U+000D), and characters in the ranges U+0020–U+D7FF, U+E000–U+FFFD, and U+10000–U+10FFFF. The endpoint strips all other code points before queueing the event; clients should sanitize them before sending because they are unsupported and can cause errors in other ingestion paths.

Parameters:

Returns:

See Also:



30
31
32
33
34
35
36
37
38
39
# File 'lib/safety_kit/resources/async.rb', line 30

def create_async(params)
  parsed, options = SafetyKit::AsyncCreateAsyncParams.dump_request(params)
  @client.request(
    method: :post,
    path: "v1/async/events",
    body: parsed[:body],
    model: SafetyKit::Models::AsyncCreateAsyncResponse,
    options: options
  )
end