=begin
#Molecule API Documentation

#The Hydrogen Molecule API

OpenAPI spec version: 1.3.0
Contact: info@hydrogenplatform.com
Generated by: https://github.com/swagger-api/swagger-codegen.git
Swagger Codegen version: 2.4.14

=end

require 'uri'

module MoleculeApi
  class EscrowApi
    attr_accessor :api_client

    def initialize(api_client = ApiClient.default)
      @api_client = api_client
    end
    # Create a new Escrow
    # @param escrow_params It enables a user to create a escrow
    # @param [Hash] opts the optional parameters
    # @return [EscrowResponse]
    def create_escrow_using_post(escrow_params, opts = {})
      data, _status_code, _headers = create_escrow_using_post_with_http_info(escrow_params, opts)
      data
    end

    # Create a new Escrow
    # @param escrow_params It enables a user to create a escrow
    # @param [Hash] opts the optional parameters
    # @return [Array<(EscrowResponse, Fixnum, Hash)>] EscrowResponse data, response status code and response headers
    def create_escrow_using_post_with_http_info(escrow_params, opts = {})
      if @api_client.config.debugging
        @api_client.config.logger.debug 'Calling API: EscrowApi.create_escrow_using_post ...'
      end
      # verify the required parameter 'escrow_params' is set
      if @api_client.config.client_side_validation && escrow_params.nil?
        fail ArgumentError, "Missing the required parameter 'escrow_params' when calling EscrowApi.create_escrow_using_post"
      end
      # resource path
      local_var_path = '/escrow'

      # query parameters
      query_params = {}

      # header parameters
      header_params = {}
      # HTTP header 'Accept' (if needed)
      header_params['Accept'] = @api_client.select_header_accept(['application/json'])

      # form parameters
      form_params = {}

      # http body (model)
      post_body = @api_client.object_to_http_body(escrow_params)
      auth_names = ['oauth2']
      data, status_code, headers = @api_client.call_api(:POST, local_var_path,
        :header_params => header_params,
        :query_params => query_params,
        :form_params => form_params,
        :body => post_body,
        :auth_names => auth_names,
        :return_type => 'EscrowResponse')
      if @api_client.config.debugging
        @api_client.config.logger.debug "API called: EscrowApi#create_escrow_using_post\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
      end
      return data, status_code, headers
    end
    # List all Escrow
    # @param [Hash] opts the optional parameters
    # @option opts [Integer] :page To filter response Escrow list by page number
    # @option opts [Integer] :size Number of records per page
    # @option opts [String] :order_by Field to sort record list
    # @option opts [BOOLEAN] :ascending Sorting order
    # @option opts [BOOLEAN] :get_latest To fetch latest (one) record
    # @return [PageEscrowResponse]
    def get_escrow_all_using_get(opts = {})
      data, _status_code, _headers = get_escrow_all_using_get_with_http_info(opts)
      data
    end

    # List all Escrow
    # @param [Hash] opts the optional parameters
    # @option opts [Integer] :page To filter response Escrow list by page number
    # @option opts [Integer] :size Number of records per page
    # @option opts [String] :order_by Field to sort record list
    # @option opts [BOOLEAN] :ascending Sorting order
    # @option opts [BOOLEAN] :get_latest To fetch latest (one) record
    # @return [Array<(PageEscrowResponse, Fixnum, Hash)>] PageEscrowResponse data, response status code and response headers
    def get_escrow_all_using_get_with_http_info(opts = {})
      if @api_client.config.debugging
        @api_client.config.logger.debug 'Calling API: EscrowApi.get_escrow_all_using_get ...'
      end
      # resource path
      local_var_path = '/escrow'

      # query parameters
      query_params = {}
      query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?
      query_params[:'size'] = opts[:'size'] if !opts[:'size'].nil?
      query_params[:'order_by'] = opts[:'order_by'] if !opts[:'order_by'].nil?
      query_params[:'ascending'] = opts[:'ascending'] if !opts[:'ascending'].nil?
      query_params[:'get_latest'] = opts[:'get_latest'] if !opts[:'get_latest'].nil?

      # header parameters
      header_params = {}
      # HTTP header 'Accept' (if needed)
      header_params['Accept'] = @api_client.select_header_accept(['application/json'])

      # form parameters
      form_params = {}

      # http body (model)
      post_body = nil
      auth_names = ['oauth2']
      data, status_code, headers = @api_client.call_api(:GET, local_var_path,
        :header_params => header_params,
        :query_params => query_params,
        :form_params => form_params,
        :body => post_body,
        :auth_names => auth_names,
        :return_type => 'PageEscrowResponse')
      if @api_client.config.debugging
        @api_client.config.logger.debug "API called: EscrowApi#get_escrow_all_using_get\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
      end
      return data, status_code, headers
    end
    # Fetch Escrow
    # @param escrow_id Escrow ID
    # @param [Hash] opts the optional parameters
    # @return [EscrowResponse]
    def get_escrow_using_get(escrow_id, opts = {})
      data, _status_code, _headers = get_escrow_using_get_with_http_info(escrow_id, opts)
      data
    end

    # Fetch Escrow
    # @param escrow_id Escrow ID
    # @param [Hash] opts the optional parameters
    # @return [Array<(EscrowResponse, Fixnum, Hash)>] EscrowResponse data, response status code and response headers
    def get_escrow_using_get_with_http_info(escrow_id, opts = {})
      if @api_client.config.debugging
        @api_client.config.logger.debug 'Calling API: EscrowApi.get_escrow_using_get ...'
      end
      # verify the required parameter 'escrow_id' is set
      if @api_client.config.client_side_validation && escrow_id.nil?
        fail ArgumentError, "Missing the required parameter 'escrow_id' when calling EscrowApi.get_escrow_using_get"
      end
      # resource path
      local_var_path = '/escrow/{escrow_id}'.sub('{' + 'escrow_id' + '}', escrow_id.to_s)

      # query parameters
      query_params = {}

      # header parameters
      header_params = {}
      # HTTP header 'Accept' (if needed)
      header_params['Accept'] = @api_client.select_header_accept(['application/json'])

      # form parameters
      form_params = {}

      # http body (model)
      post_body = nil
      auth_names = ['oauth2']
      data, status_code, headers = @api_client.call_api(:GET, local_var_path,
        :header_params => header_params,
        :query_params => query_params,
        :form_params => form_params,
        :body => post_body,
        :auth_names => auth_names,
        :return_type => 'EscrowResponse')
      if @api_client.config.debugging
        @api_client.config.logger.debug "API called: EscrowApi#get_escrow_using_get\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
      end
      return data, status_code, headers
    end
  end
end
