Class: Nylas::Threads

Inherits:
Resource show all
Includes:
ApiOperations::Delete, ApiOperations::Get, ApiOperations::Put
Defined in:
lib/nylas/resources/threads.rb

Overview

Nylas Threads API

Instance Method Summary collapse

Methods inherited from Resource

#initialize

Constructor Details

This class inherits a constructor from Nylas::Resource

Instance Method Details

#destroy(identifier:, thread_id:) ⇒ Array(TrueClass, String)

Delete an thread.



56
57
58
59
60
61
62
# File 'lib/nylas/resources/threads.rb', line 56

def destroy(identifier:, thread_id:)
  _, request_id = delete(
    path: "#{api_uri}/v3/grants/#{identifier}/threads/#{thread_id}"
  )

  [true, request_id]
end

#find(identifier:, thread_id:, query_params: nil) ⇒ Array(Hash, String)

Return an thread.



31
32
33
34
35
36
# File 'lib/nylas/resources/threads.rb', line 31

def find(identifier:, thread_id:, query_params: nil)
  get(
    path: "#{api_uri}/v3/grants/#{identifier}/threads/#{thread_id}",
    query_params: query_params
  )
end

#list(identifier:, query_params: nil) ⇒ Array(Array(Hash), String, String)

Return all threads.



18
19
20
21
22
23
# File 'lib/nylas/resources/threads.rb', line 18

def list(identifier:, query_params: nil)
  get_list(
    path: "#{api_uri}/v3/grants/#{identifier}/threads",
    query_params: query_params
  )
end

#update(identifier:, thread_id:, request_body:) ⇒ Array(Hash, String)

Update an thread.



44
45
46
47
48
49
# File 'lib/nylas/resources/threads.rb', line 44

def update(identifier:, thread_id:, request_body:)
  put(
    path: "#{api_uri}/v3/grants/#{identifier}/threads/#{thread_id}",
    request_body: request_body
  )
end