# SPDX-License-Identifier: Apache-2.0
#
# The OpenSearch Contributors require contributions made to
# this file be licensed under the Apache-2.0 license or a
# compatible open source license.

# This file is generated from the OpenSearch REST API spec.
# Do not modify it by hand. Instead, modify the generator or the spec.

# frozen_string_literal: true

module OpenSearch
  module API
    module Ml
      module Actions
        # Get all messages in a memory.
        #
        # @option args [String] :memory_id *Required*
        # @option args [Integer] :max_results
        # @option args [Integer] :next_token
        def get_all_messages(args = {})
          args = Utils.clone_and_normalize_arguments(args)
          raise ArgumentError, "Required argument 'memory_id' missing" if args['memory_id'].nil?

          _memory_id = args.delete('memory_id')

          headers = args.delete('headers') || {}
          body    = args.delete('body')
          method  = 'GET'
          url     = Utils.build_url('_plugins/_ml/memory', _memory_id, 'messages')

          Utils.validate_query_params! args, GET_ALL_MESSAGES_QUERY_PARAMS
          transport.perform_request(method, url, args, body, headers).body
        end

        GET_ALL_MESSAGES_QUERY_PARAMS = Set.new(%w[
          max_results
          next_token
        ]).freeze
      end
    end
  end
end
