Class: Sentdm::Resources::Conversations

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

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ Conversations

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

Parameters:



77
78
79
# File 'lib/sentdm/resources/conversations.rb', line 77

def initialize(client:)
  @client = client
end

Instance Method Details

#list(page:, page_size:, x_profile_id: nil, request_options: {}) ⇒ Sentdm::Models::APIResponseOfConversationMessagesList

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

Retrieves a paginated list of the authenticated customer's messages across all conversations, ordered by created date (most recent first).

Parameters:

  • page (Integer)

    Query param

  • page_size (Integer)

    Query param

  • x_profile_id (String)

    Header param: Profile UUID to scope the request to a child profile. Only organiz

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

Returns:

See Also:



25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/sentdm/resources/conversations.rb', line 25

def list(params)
  query_params = [:page, :page_size]
  parsed, options = Sentdm::ConversationListParams.dump_request(params)
  query = Sentdm::Internal::Util.encode_query_params(parsed.slice(*query_params))
  @client.request(
    method: :get,
    path: "v3/conversations",
    query: query,
    headers: parsed.except(*query_params).transform_keys(x_profile_id: "x-profile-id"),
    model: Sentdm::APIResponseOfConversationMessagesList,
    options: options
  )
end

#list_messages(id, page:, page_size:, x_profile_id: nil, request_options: {}) ⇒ Sentdm::Models::APIResponseOfConversationMessagesList

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

Retrieves a paginated list of the messages in a single conversation (scoped to the authenticated customer), ordered by created date (most recent first).

Parameters:

  • id (String)

    Path param: Conversation id from the route.

  • page (Integer)

    Query param

  • page_size (Integer)

    Query param

  • x_profile_id (String)

    Header param: Profile UUID to scope the request to a child profile. Only organiz

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

Returns:

See Also:



60
61
62
63
64
65
66
67
68
69
70
71
72
# File 'lib/sentdm/resources/conversations.rb', line 60

def list_messages(id, params)
  query_params = [:page, :page_size]
  parsed, options = Sentdm::ConversationListMessagesParams.dump_request(params)
  query = Sentdm::Internal::Util.encode_query_params(parsed.slice(*query_params))
  @client.request(
    method: :get,
    path: ["v3/conversations/%1$s", id],
    query: query,
    headers: parsed.except(*query_params).transform_keys(x_profile_id: "x-profile-id"),
    model: Sentdm::APIResponseOfConversationMessagesList,
    options: options
  )
end