Class: Nylas::SmartCompose

Inherits:
Resource show all
Includes:
ApiOperations::Post
Defined in:
lib/nylas/resources/smart_compose.rb

Overview

Nylas Smart Compose API

Instance Method Summary collapse

Methods inherited from Resource

#initialize

Constructor Details

This class inherits a constructor from Nylas::Resource

Instance Method Details

#compose_message(identifier:, request_body:) ⇒ Array(Hash, String)

Compose a message.

Parameters:

  • identifier (String)

    Grant ID or email account to generate a message suggestion for.

  • request_body (Hash)

    The prompt that smart compose will use to generate a message suggestion.

Returns:

  • (Array(Hash, String))

    The generated message and API Request ID.



16
17
18
19
20
21
# File 'lib/nylas/resources/smart_compose.rb', line 16

def compose_message(identifier:, request_body:)
  post(
    path: "#{api_uri}/v3/grants/#{identifier}/messages/smart-compose",
    request_body: request_body
  )
end

#compose_message_reply(identifier:, message_id:, request_body:) ⇒ Array(Hash, String)

Compose a message reply.

Parameters:

  • identifier (String)

    Grant ID or email account to generate a message suggestion for.

  • message_id (String)

    The id of the message to reply to.

  • request_body (Hash)

    The prompt that smart compose will use to generate a message reply.

Returns:

  • (Array(Hash, String))

    The generated message reply and API Request ID.



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

def compose_message_reply(identifier:, message_id:, request_body:)
  post(
    path: "#{api_uri}/v3/grants/#{identifier}/messages/#{message_id}/smart-compose",
    request_body: request_body
  )
end