Class: Telnyx::Resources::EmailInboxes::Threads

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

Overview

Create and manage agent inboxes, retrieve inbound messages and threads, and reply to or forward messages.

Defined Under Namespace

Classes: Labels

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ Threads

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

Parameters:



90
91
92
93
# File 'lib/telnyx/resources/email_inboxes/threads.rb', line 90

def initialize(client:)
  @client = client
  @labels = Telnyx::Resources::EmailInboxes::Threads::Labels.new(client: client)
end

Instance Attribute Details

#labelsTelnyx::Resources::EmailInboxes::Threads::Labels (readonly)

Create and manage agent inboxes, retrieve inbound messages and threads, and reply to or forward messages.



12
13
14
# File 'lib/telnyx/resources/email_inboxes/threads.rb', line 12

def labels
  @labels
end

Instance Method Details

#list(inbox_id, filter_label: nil, page_after: nil, page_size: nil, request_options: {}) ⇒ Telnyx::Models::EmailInboxes::InboundThreadListResponse

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

Lists thread summaries newest first using stable cursor pagination.

Parameters:

  • inbox_id (String)

    Email inbox UUID.

  • filter_label (String)

    Returns only threads carrying this label. Thread labels are independent of the l

  • page_after (String)

    Opaque cursor returned by the previous page.

  • page_size (Integer)

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

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

Returns:

See Also:



71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
# File 'lib/telnyx/resources/email_inboxes/threads.rb', line 71

def list(inbox_id, params = {})
  parsed, options = Telnyx::EmailInboxes::ThreadListParams.dump_request(params)
  query = Telnyx::Internal::Util.encode_query_params(parsed)
  @client.request(
    method: :get,
    path: ["email_inboxes/%1$s/threads", inbox_id],
    query: query.transform_keys(
      filter_label: "filter[label]",
      page_after: "page[after]",
      page_size: "page[size]"
    ),
    model: Telnyx::EmailInboxes::InboundThreadListResponse,
    options: options
  )
end

#retrieve(thread_id, inbox_id:, page_after: nil, page_size: nil, request_options: {}) ⇒ Telnyx::Models::EmailInboxes::ThreadRetrieveResponse

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

Returns a bounded page of inbound and outbound thread messages interleaved in chronological order using stable cursor pagination.

Parameters:

  • thread_id (String)

    Path param: Email thread UUID.

  • inbox_id (String)

    Path param: Email inbox UUID.

  • page_after (String)

    Query param: Opaque message cursor returned by the previous thread-detail page.

  • page_size (Integer)

    Query param: Number of thread messages to return. Defaults to 25; maximum is 100

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

Returns:

See Also:



35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# File 'lib/telnyx/resources/email_inboxes/threads.rb', line 35

def retrieve(thread_id, params)
  parsed, options = Telnyx::EmailInboxes::ThreadRetrieveParams.dump_request(params)
  query = Telnyx::Internal::Util.encode_query_params(parsed)
  inbox_id =
    parsed.delete(:inbox_id) do
      raise ArgumentError.new("missing required path argument #{_1}")
    end
  @client.request(
    method: :get,
    path: ["email_inboxes/%1$s/threads/%2$s", inbox_id, thread_id],
    query: query.transform_keys(page_after: "page[after]", page_size: "page[size]"),
    model: Telnyx::Models::EmailInboxes::ThreadRetrieveResponse,
    options: options
  )
end