Sha256: 8737af7d5bb29bd4e83310c1c3c70efbae44dc8f5d9acb87f62d24ab254f3bb0

Contents?: true

Size: 1.3 KB

Versions: 13

Compression:

Stored size: 1.3 KB

Contents

# frozen_string_literal: true

require_relative "resource"
require_relative "../handler/api_operations"

module Nylas
  # Nylas Smart Compose API
  class SmartCompose < Resource
    include ApiOperations::Post

    # Compose a message.
    #
    # @param identifier [String] Grant ID or email account to generate a message suggestion for.
    # @param request_body [Hash] The prompt that smart compose will use to generate a message suggestion.
    # @return [Array(Hash, String)] The generated message and API Request ID.
    def compose_message(identifier:, request_body:)
      post(
        path: "#{api_uri}/v3/grants/#{identifier}/messages/smart-compose",
        request_body: request_body
      )
    end

    # Compose a message reply.
    #
    # @param identifier [String] Grant ID or email account to generate a message suggestion for.
    # @param message_id [String] The id of the message to reply to.
    # @param request_body [Hash] The prompt that smart compose will use to generate a message reply.
    # @return [Array(Hash, String)] The generated message reply and API Request ID.
    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
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
nylas-6.2.3 lib/nylas/resources/smart_compose.rb
nylas-6.2.2 lib/nylas/resources/smart_compose.rb
nylas-6.2.1 lib/nylas/resources/smart_compose.rb
nylas-6.2.0 lib/nylas/resources/smart_compose.rb
nylas-6.1.1 lib/nylas/resources/smart_compose.rb
nylas-6.1.0 lib/nylas/resources/smart_compose.rb
nylas-6.0.3 lib/nylas/resources/smart_compose.rb
nylas-6.0.2 lib/nylas/resources/smart_compose.rb
nylas-6.0.1 lib/nylas/resources/smart_compose.rb
nylas-6.0.0 lib/nylas/resources/smart_compose.rb
nylas-6.0.0.beta.4 lib/nylas/resources/smart_compose.rb
nylas-6.0.0.beta.3 lib/nylas/resources/smart_compose.rb
nylas-6.0.0.beta.2 lib/nylas/resources/smart_compose.rb