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.

Parameters:

  • identifier (String)

    Grant ID or email account from which to delete the thread.

  • thread_id (String)

    The id of the thread to delete.

Returns:

  • (Array(TrueClass, String))

    True and the API Request ID for the delete operation.



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

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:) ⇒ Array(Hash, String)

Return an thread.

Parameters:

  • identifier (String)

    Grant ID or email account to query.

  • thread_id (String)

    The id of the thread to return.

Returns:

  • (Array(Hash, String))

    The thread and API request ID.



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

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

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

Return all threads.

Parameters:

  • identifier (String)

    Grant ID or email account to query.

  • query_params (Hash) (defaults to: nil)

    Query params to pass to the request.

Returns:

  • (Array(Array(Hash), String))

    The list of threads and API Request ID.



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

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

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

Update an thread.

Parameters:

  • identifier (String)

    Grant ID or email account in which to update the thread.

  • thread_id (String)

    The id of the thread to update.

  • request_body (Hash)

    The values to update the thread with

Returns:

  • (Array(Hash, String))

    The updated thread and API Request ID.



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

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