Class: Blueticks::Resources::ContactsResource

Inherits:
BaseResource
  • Object
show all
Defined in:
lib/blueticks/resources/contacts.rb

Instance Attribute Summary

Attributes inherited from BaseResource

#client

Instance Method Summary collapse

Methods inherited from BaseResource

#initialize

Constructor Details

This class inherits a constructor from Blueticks::BaseResource

Instance Method Details

#common_groups(contact_id) ⇒ Object

List groups in common.

List the groups the authenticated user shares with the given contact. Offset-paginated (GroupListItem rows).



28
29
30
31
# File 'lib/blueticks/resources/contacts.rb', line 28

def common_groups(contact_id)
  env = client.request("GET", "/v1/contacts/#{contact_id}/common_groups")
  Types::PaginatedPage.from_hash(env, item_type: Types::GroupListItem)
end

#list(search_token: nil, include_archive: nil, skip: nil, limit: nil) ⇒ Object

List contacts.

List WhatsApp contacts known to the connected engine. Offset-paginated.



14
15
16
17
18
19
20
21
22
# File 'lib/blueticks/resources/contacts.rb', line 14

def list(search_token: nil, include_archive: nil, skip: nil, limit: nil)
  params = {}
  params["searchToken"] = search_token unless search_token.nil?
  params["includeArchive"] = include_archive unless include_archive.nil?
  params["skip"] = skip unless skip.nil?
  params["limit"] = limit unless limit.nil?
  env = client.request("GET", "/v1/contacts", params: params.empty? ? nil : params)
  Types::PaginatedPage.from_hash(env, item_type: Types::WhatsAppContact)
end