Class: SafetyKit::Resources::Beta::Events

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

Overview

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

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ Events

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 Events.

Parameters:



69
70
71
# File 'lib/safety_kit/resources/beta/events.rb', line 69

def initialize(client:)
  @client = client
end

Instance Method Details

#create(body:, request_options: {}) ⇒ SafetyKit::Models::Beta::EventCreateResponse::UnionMember0, SafetyKit::Models::Beta::EventCreateResponse::UnionMember1

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

Beta. Send a backend event after a meaningful product action happens in your system. Use events for durable server-side context such as account creation, account updates, user-to-user contact, content uploads, user reports, and moderation decisions. Do not send browser pageviews, button clicks, or other client-only telemetry through this endpoint.



27
28
29
30
31
32
33
34
35
36
# File 'lib/safety_kit/resources/beta/events.rb', line 27

def create(params)
  parsed, options = SafetyKit::Beta::EventCreateParams.dump_request(params)
  @client.request(
    method: :post,
    path: "v1/events",
    body: parsed[:body],
    model: SafetyKit::Models::Beta::EventCreateResponse,
    options: options
  )
end

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

Some parameter documentations has been truncated, see Models::Beta::EventCreateAsyncParams 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.



55
56
57
58
59
60
61
62
63
64
# File 'lib/safety_kit/resources/beta/events.rb', line 55

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