Class: Telnyx::Resources::EmailEvents

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

Overview

Retrieve account-level email events and event statistics.

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ EmailEvents

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

Parameters:



76
77
78
# File 'lib/telnyx/resources/email_events.rb', line 76

def initialize(client:)
  @client = client
end

Instance Method Details

#list(email_id: nil, event_type: nil, from: nil, page_cursor: nil, page_size: nil, to: nil, request_options: {}) ⇒ Telnyx::Models::EmailEventListResponse

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

Lists account-level email events sorted oldest first by occurred_at asc, id asc.

Parameters:

  • email_id (String)

    Filter events for a specific email message UUID. Invalid UUID values are silentl

  • event_type (String, Array<String>)

    Comma-separated list of event types to include. Also accepts repeated query para

  • from (Time)

    Inclusive ISO 8601 start timestamp. Defaults to 30 days ago when omitted.

  • page_cursor (String)

    Opaque URL-safe Base64 cursor returned by a previous list response.

  • page_size (Integer)

    Number of results to return. Defaults to 25; maximum is 100. Invalid values are

  • to (Time)

    Inclusive ISO 8601 end timestamp. When from is provided without to, defaults

  • request_options (Telnyx::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



32
33
34
35
36
37
38
39
40
41
42
# File 'lib/telnyx/resources/email_events.rb', line 32

def list(params = {})
  parsed, options = Telnyx::EmailEventListParams.dump_request(params)
  query = Telnyx::Internal::Util.encode_query_params(parsed)
  @client.request(
    method: :get,
    path: "email_events",
    query: query,
    model: Telnyx::Models::EmailEventListResponse,
    options: options
  )
end

#retrieve_stats(from: nil, to: nil, request_options: {}) ⇒ Telnyx::Models::EmailEventRetrieveStatsResponse

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

Returns counts and rates for email events over a time range. The default start time is 30 days ago.

Parameters:

  • from (Time)

    Inclusive ISO 8601 start timestamp. Defaults to 30 days ago when omitted.

  • to (Time)

    Inclusive ISO 8601 end timestamp. When from is provided without to, defaults

  • request_options (Telnyx::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



61
62
63
64
65
66
67
68
69
70
71
# File 'lib/telnyx/resources/email_events.rb', line 61

def retrieve_stats(params = {})
  parsed, options = Telnyx::EmailEventRetrieveStatsParams.dump_request(params)
  query = Telnyx::Internal::Util.encode_query_params(parsed)
  @client.request(
    method: :get,
    path: "email_events/stats",
    query: query,
    model: Telnyx::Models::EmailEventRetrieveStatsResponse,
    options: options
  )
end