Class: SafetyKit::Resources::Async

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

Overview

Beta. Send backend events for account, content, user interaction, report, 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:



39
40
41
# File 'lib/safety_kit/resources/async.rb', line 39

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.



25
26
27
28
29
30
31
32
33
34
# File 'lib/safety_kit/resources/async.rb', line 25

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