=begin
#BitMEX API

### REST API for the BitMEX Trading Platform  _If you are building automated tools, please subscribe to the_ _[BitMEX API RSS Feed](https://blog.bitmex.com/api_announcement/feed/) for changes. The feed will be updated_ _regularly and is the most reliable way to get downtime and update announcements._  [View Changelog](/app/apiChangelog)  -  #### Getting Started  Base URI: [https://www.bitmex.com/api/v1](/api/v1)  ##### Fetching Data  All REST endpoints are documented below. You can try out any query right from this interface.  Most table queries accept `count`, `start`, and `reverse` params. Set `reverse=true` to get rows newest-first.  Additional documentation regarding filters, timestamps, and authentication is available in [the main API documentation](/app/restAPI).  _All_ table data is available via the [Websocket](/app/wsAPI). We highly recommend using the socket if you want to have the quickest possible data without being subject to ratelimits.  ##### Return Types  By default, all data is returned as JSON. Send `?_format=csv` to get CSV data or `?_format=xml` to get XML data.  ##### Trade Data Queries  _This is only a small subset of what is available, to get you started._  Fill in the parameters and click the `Try it out!` button to try any of these queries.  - [Pricing Data](#!/Quote/Quote_get)  - [Trade Data](#!/Trade/Trade_get)  - [OrderBook Data](#!/OrderBook/OrderBook_getL2)  - [Settlement Data](#!/Settlement/Settlement_get)  - [Exchange Statistics](#!/Stats/Stats_history)  Every function of the BitMEX.com platform is exposed here and documented. Many more functions are available.  ##### Swagger Specification  [⇩ Download Swagger JSON](swagger.json)  -  ## All API Endpoints  Click to expand a section. 

OpenAPI spec version: 1.2.0
Contact: support@bitmex.com
Generated by: https://github.com/swagger-api/swagger-codegen.git
Swagger Codegen version: 2.4.42-SNAPSHOT

=end

require 'uri'

module SwaggerClient
  class GuildApi
    attr_accessor :api_client

    def initialize(api_client = ApiClient.default)
      @api_client = api_client
    end
    # Archive a guild
    # @param [Hash] opts the optional parameters
    # @return [Object]
    def guild_archive(opts = {})
      data, _status_code, _headers = guild_archive_with_http_info(opts)
      data
    end

    # Archive a guild
    # @param [Hash] opts the optional parameters
    # @return [Array<(Object, Fixnum, Hash)>] Object data, response status code and response headers
    def guild_archive_with_http_info(opts = {})
      if @api_client.config.debugging
        @api_client.config.logger.debug 'Calling API: GuildApi.guild_archive ...'
      end
      # resource path
      local_var_path = '/guild/archive'

      # query parameters
      query_params = {}

      # header parameters
      header_params = {}
      # HTTP header 'Accept' (if needed)
      header_params['Accept'] = @api_client.select_header_accept(['application/json', 'application/xml', 'text/xml', 'application/javascript', 'text/javascript'])
      # HTTP header 'Content-Type'
      header_params['Content-Type'] = @api_client.select_header_content_type(['application/json', 'application/x-www-form-urlencoded'])

      # form parameters
      form_params = {}

      # http body (model)
      post_body = nil
      auth_names = ['apiExpires', 'apiKey', 'apiSignature']
      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 => 'Object')
      if @api_client.config.debugging
        @api_client.config.logger.debug "API called: GuildApi#guild_archive\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
      end
      return data, status_code, headers
    end
    # Edit guild new guild
    # @param name Name of the guild, must be unique, must be at least 5 characters
    # @param emoji Emoji name.
    # @param pot_distribution_percent How much of the pot should be distributed to the guild members, must be between 0 and 100
    # @param pot_distribution_type How the pot should be distributed to the guild members, must be one of the following: ROLL_OVER, TOP_3, TOP_5, TOP_10, VOLUME_PERCENTAGE, TOP_3_BY_ADV, TOP_5_BY_ADV, TOP_10_BY_ADV, TOP_3_BY_ROI, TOP_5_BY_ROI, TOP_10_BY_ROI, RANDOM
    # @param [Hash] opts the optional parameters
    # @option opts [Float] :pot_trader_id User ID of the guild member with order write permission for the pot
    # @option opts [String] :description Guild description, can be used to explain the guild to other users.
    # @option opts [String] :twitter Guild twitter handle.
    # @option opts [String] :discord Guild discord link.
    # @option opts [String] :telegram Guild telegram link.
    # @option opts [String] :img_url URL for the profile image of the guild, is used by clients to add some color to the guild, if no image is provided, a default image is used
    # @option opts [BOOLEAN] :is_private Guild privacy status
    # @return [Guild]
    def guild_edit(name, emoji, pot_distribution_percent, pot_distribution_type, opts = {})
      data, _status_code, _headers = guild_edit_with_http_info(name, emoji, pot_distribution_percent, pot_distribution_type, opts)
      data
    end

    # Edit guild new guild
    # @param name Name of the guild, must be unique, must be at least 5 characters
    # @param emoji Emoji name.
    # @param pot_distribution_percent How much of the pot should be distributed to the guild members, must be between 0 and 100
    # @param pot_distribution_type How the pot should be distributed to the guild members, must be one of the following: ROLL_OVER, TOP_3, TOP_5, TOP_10, VOLUME_PERCENTAGE, TOP_3_BY_ADV, TOP_5_BY_ADV, TOP_10_BY_ADV, TOP_3_BY_ROI, TOP_5_BY_ROI, TOP_10_BY_ROI, RANDOM
    # @param [Hash] opts the optional parameters
    # @option opts [Float] :pot_trader_id User ID of the guild member with order write permission for the pot
    # @option opts [String] :description Guild description, can be used to explain the guild to other users.
    # @option opts [String] :twitter Guild twitter handle.
    # @option opts [String] :discord Guild discord link.
    # @option opts [String] :telegram Guild telegram link.
    # @option opts [String] :img_url URL for the profile image of the guild, is used by clients to add some color to the guild, if no image is provided, a default image is used
    # @option opts [BOOLEAN] :is_private Guild privacy status
    # @return [Array<(Guild, Fixnum, Hash)>] Guild data, response status code and response headers
    def guild_edit_with_http_info(name, emoji, pot_distribution_percent, pot_distribution_type, opts = {})
      if @api_client.config.debugging
        @api_client.config.logger.debug 'Calling API: GuildApi.guild_edit ...'
      end
      # verify the required parameter 'name' is set
      if @api_client.config.client_side_validation && name.nil?
        fail ArgumentError, "Missing the required parameter 'name' when calling GuildApi.guild_edit"
      end
      # verify the required parameter 'emoji' is set
      if @api_client.config.client_side_validation && emoji.nil?
        fail ArgumentError, "Missing the required parameter 'emoji' when calling GuildApi.guild_edit"
      end
      # verify the required parameter 'pot_distribution_percent' is set
      if @api_client.config.client_side_validation && pot_distribution_percent.nil?
        fail ArgumentError, "Missing the required parameter 'pot_distribution_percent' when calling GuildApi.guild_edit"
      end
      # verify the required parameter 'pot_distribution_type' is set
      if @api_client.config.client_side_validation && pot_distribution_type.nil?
        fail ArgumentError, "Missing the required parameter 'pot_distribution_type' when calling GuildApi.guild_edit"
      end
      # resource path
      local_var_path = '/guild'

      # query parameters
      query_params = {}

      # header parameters
      header_params = {}
      # HTTP header 'Accept' (if needed)
      header_params['Accept'] = @api_client.select_header_accept(['application/json', 'application/xml', 'text/xml', 'application/javascript', 'text/javascript'])
      # HTTP header 'Content-Type'
      header_params['Content-Type'] = @api_client.select_header_content_type(['application/json', 'application/x-www-form-urlencoded'])

      # form parameters
      form_params = {}
      form_params['name'] = name
      form_params['emoji'] = emoji
      form_params['potDistributionPercent'] = pot_distribution_percent
      form_params['potDistributionType'] = pot_distribution_type
      form_params['potTraderId'] = opts[:'pot_trader_id'] if !opts[:'pot_trader_id'].nil?
      form_params['description'] = opts[:'description'] if !opts[:'description'].nil?
      form_params['twitter'] = opts[:'twitter'] if !opts[:'twitter'].nil?
      form_params['discord'] = opts[:'discord'] if !opts[:'discord'].nil?
      form_params['telegram'] = opts[:'telegram'] if !opts[:'telegram'].nil?
      form_params['imgUrl'] = opts[:'img_url'] if !opts[:'img_url'].nil?
      form_params['isPrivate'] = opts[:'is_private'] if !opts[:'is_private'].nil?

      # http body (model)
      post_body = nil
      auth_names = ['apiExpires', 'apiKey', 'apiSignature']
      data, status_code, headers = @api_client.call_api(:PUT, local_var_path,
        :header_params => header_params,
        :query_params => query_params,
        :form_params => form_params,
        :body => post_body,
        :auth_names => auth_names,
        :return_type => 'Guild')
      if @api_client.config.debugging
        @api_client.config.logger.debug "API called: GuildApi#guild_edit\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
      end
      return data, status_code, headers
    end
    # Get all guilds
    # @param [Hash] opts the optional parameters
    # @return [Array<XAny>]
    def guild_get(opts = {})
      data, _status_code, _headers = guild_get_with_http_info(opts)
      data
    end

    # Get all guilds
    # @param [Hash] opts the optional parameters
    # @return [Array<(Array<XAny>, Fixnum, Hash)>] Array<XAny> data, response status code and response headers
    def guild_get_with_http_info(opts = {})
      if @api_client.config.debugging
        @api_client.config.logger.debug 'Calling API: GuildApi.guild_get ...'
      end
      # resource path
      local_var_path = '/guild'

      # query parameters
      query_params = {}

      # header parameters
      header_params = {}
      # HTTP header 'Accept' (if needed)
      header_params['Accept'] = @api_client.select_header_accept(['application/json', 'application/xml', 'text/xml', 'application/javascript', 'text/javascript'])
      # HTTP header 'Content-Type'
      header_params['Content-Type'] = @api_client.select_header_content_type(['application/json', 'application/x-www-form-urlencoded'])

      # form parameters
      form_params = {}

      # http body (model)
      post_body = nil
      auth_names = []
      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 => 'Array<XAny>')
      if @api_client.config.debugging
        @api_client.config.logger.debug "API called: GuildApi#guild_get\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
      end
      return data, status_code, headers
    end
    # Request to Join a private guild or join a public guild
    # @param code 
    # @param [Hash] opts the optional parameters
    # @return [Object]
    def guild_join(code, opts = {})
      data, _status_code, _headers = guild_join_with_http_info(code, opts)
      data
    end

    # Request to Join a private guild or join a public guild
    # @param code 
    # @param [Hash] opts the optional parameters
    # @return [Array<(Object, Fixnum, Hash)>] Object data, response status code and response headers
    def guild_join_with_http_info(code, opts = {})
      if @api_client.config.debugging
        @api_client.config.logger.debug 'Calling API: GuildApi.guild_join ...'
      end
      # verify the required parameter 'code' is set
      if @api_client.config.client_side_validation && code.nil?
        fail ArgumentError, "Missing the required parameter 'code' when calling GuildApi.guild_join"
      end
      # resource path
      local_var_path = '/guild/join'

      # query parameters
      query_params = {}

      # header parameters
      header_params = {}
      # HTTP header 'Accept' (if needed)
      header_params['Accept'] = @api_client.select_header_accept(['application/json', 'application/xml', 'text/xml', 'application/javascript', 'text/javascript'])
      # HTTP header 'Content-Type'
      header_params['Content-Type'] = @api_client.select_header_content_type(['application/json', 'application/x-www-form-urlencoded'])

      # form parameters
      form_params = {}
      form_params['code'] = code

      # http body (model)
      post_body = nil
      auth_names = ['apiExpires', 'apiKey', 'apiSignature']
      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 => 'Object')
      if @api_client.config.debugging
        @api_client.config.logger.debug "API called: GuildApi#guild_join\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
      end
      return data, status_code, headers
    end
    # Kick member from guild
    # @param member_user_id 
    # @param [Hash] opts the optional parameters
    # @return [Object]
    def guild_kick(member_user_id, opts = {})
      data, _status_code, _headers = guild_kick_with_http_info(member_user_id, opts)
      data
    end

    # Kick member from guild
    # @param member_user_id 
    # @param [Hash] opts the optional parameters
    # @return [Array<(Object, Fixnum, Hash)>] Object data, response status code and response headers
    def guild_kick_with_http_info(member_user_id, opts = {})
      if @api_client.config.debugging
        @api_client.config.logger.debug 'Calling API: GuildApi.guild_kick ...'
      end
      # verify the required parameter 'member_user_id' is set
      if @api_client.config.client_side_validation && member_user_id.nil?
        fail ArgumentError, "Missing the required parameter 'member_user_id' when calling GuildApi.guild_kick"
      end
      # resource path
      local_var_path = '/guild/kick'

      # query parameters
      query_params = {}

      # header parameters
      header_params = {}
      # HTTP header 'Accept' (if needed)
      header_params['Accept'] = @api_client.select_header_accept(['application/json', 'application/xml', 'text/xml', 'application/javascript', 'text/javascript'])
      # HTTP header 'Content-Type'
      header_params['Content-Type'] = @api_client.select_header_content_type(['application/json', 'application/x-www-form-urlencoded'])

      # form parameters
      form_params = {}
      form_params['memberUserId'] = member_user_id

      # http body (model)
      post_body = nil
      auth_names = ['apiExpires', 'apiKey', 'apiSignature']
      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 => 'Object')
      if @api_client.config.debugging
        @api_client.config.logger.debug "API called: GuildApi#guild_kick\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
      end
      return data, status_code, headers
    end
    # Leave guild or cancel guild join request
    # @param [Hash] opts the optional parameters
    # @return [Object]
    def guild_leave(opts = {})
      data, _status_code, _headers = guild_leave_with_http_info(opts)
      data
    end

    # Leave guild or cancel guild join request
    # @param [Hash] opts the optional parameters
    # @return [Array<(Object, Fixnum, Hash)>] Object data, response status code and response headers
    def guild_leave_with_http_info(opts = {})
      if @api_client.config.debugging
        @api_client.config.logger.debug 'Calling API: GuildApi.guild_leave ...'
      end
      # resource path
      local_var_path = '/guild/leave'

      # query parameters
      query_params = {}

      # header parameters
      header_params = {}
      # HTTP header 'Accept' (if needed)
      header_params['Accept'] = @api_client.select_header_accept(['application/json', 'application/xml', 'text/xml', 'application/javascript', 'text/javascript'])
      # HTTP header 'Content-Type'
      header_params['Content-Type'] = @api_client.select_header_content_type(['application/json', 'application/x-www-form-urlencoded'])

      # form parameters
      form_params = {}

      # http body (model)
      post_body = nil
      auth_names = ['apiExpires', 'apiKey', 'apiSignature']
      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 => 'Object')
      if @api_client.config.debugging
        @api_client.config.logger.debug "API called: GuildApi#guild_leave\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
      end
      return data, status_code, headers
    end
    # Creates a new guild
    # @param name Name of the guild, must be unique, must be at least 5 characters
    # @param emoji Emoji name.
    # @param pot_distribution_percent How much of the pot should be distributed to the guild members, must be between 0 and 100
    # @param pot_distribution_type How the pot should be distributed to the guild members, must be one of the following: ROLL_OVER, TOP_3, TOP_5, TOP_10, VOLUME_PERCENTAGE, TOP_3_BY_ADV, TOP_5_BY_ADV, TOP_10_BY_ADV, TOP_3_BY_ROI, TOP_5_BY_ROI, TOP_10_BY_ROI, RANDOM
    # @param [Hash] opts the optional parameters
    # @option opts [String] :description Guild description, can be used to explain the guild to other users.
    # @option opts [String] :twitter Guild twitter handle.
    # @option opts [String] :discord Guild discord link.
    # @option opts [String] :telegram Guild telegram link.
    # @option opts [String] :img_url URL for the profile image of the guild, is used by clients to add some color to the guild, if no image is provided, a default image is used
    # @option opts [BOOLEAN] :is_private Guild privacy status
    # @return [Guild]
    def guild_new(name, emoji, pot_distribution_percent, pot_distribution_type, opts = {})
      data, _status_code, _headers = guild_new_with_http_info(name, emoji, pot_distribution_percent, pot_distribution_type, opts)
      data
    end

    # Creates a new guild
    # @param name Name of the guild, must be unique, must be at least 5 characters
    # @param emoji Emoji name.
    # @param pot_distribution_percent How much of the pot should be distributed to the guild members, must be between 0 and 100
    # @param pot_distribution_type How the pot should be distributed to the guild members, must be one of the following: ROLL_OVER, TOP_3, TOP_5, TOP_10, VOLUME_PERCENTAGE, TOP_3_BY_ADV, TOP_5_BY_ADV, TOP_10_BY_ADV, TOP_3_BY_ROI, TOP_5_BY_ROI, TOP_10_BY_ROI, RANDOM
    # @param [Hash] opts the optional parameters
    # @option opts [String] :description Guild description, can be used to explain the guild to other users.
    # @option opts [String] :twitter Guild twitter handle.
    # @option opts [String] :discord Guild discord link.
    # @option opts [String] :telegram Guild telegram link.
    # @option opts [String] :img_url URL for the profile image of the guild, is used by clients to add some color to the guild, if no image is provided, a default image is used
    # @option opts [BOOLEAN] :is_private Guild privacy status
    # @return [Array<(Guild, Fixnum, Hash)>] Guild data, response status code and response headers
    def guild_new_with_http_info(name, emoji, pot_distribution_percent, pot_distribution_type, opts = {})
      if @api_client.config.debugging
        @api_client.config.logger.debug 'Calling API: GuildApi.guild_new ...'
      end
      # verify the required parameter 'name' is set
      if @api_client.config.client_side_validation && name.nil?
        fail ArgumentError, "Missing the required parameter 'name' when calling GuildApi.guild_new"
      end
      # verify the required parameter 'emoji' is set
      if @api_client.config.client_side_validation && emoji.nil?
        fail ArgumentError, "Missing the required parameter 'emoji' when calling GuildApi.guild_new"
      end
      # verify the required parameter 'pot_distribution_percent' is set
      if @api_client.config.client_side_validation && pot_distribution_percent.nil?
        fail ArgumentError, "Missing the required parameter 'pot_distribution_percent' when calling GuildApi.guild_new"
      end
      # verify the required parameter 'pot_distribution_type' is set
      if @api_client.config.client_side_validation && pot_distribution_type.nil?
        fail ArgumentError, "Missing the required parameter 'pot_distribution_type' when calling GuildApi.guild_new"
      end
      # resource path
      local_var_path = '/guild'

      # query parameters
      query_params = {}

      # header parameters
      header_params = {}
      # HTTP header 'Accept' (if needed)
      header_params['Accept'] = @api_client.select_header_accept(['application/json', 'application/xml', 'text/xml', 'application/javascript', 'text/javascript'])
      # HTTP header 'Content-Type'
      header_params['Content-Type'] = @api_client.select_header_content_type(['application/json', 'application/x-www-form-urlencoded'])

      # form parameters
      form_params = {}
      form_params['name'] = name
      form_params['emoji'] = emoji
      form_params['potDistributionPercent'] = pot_distribution_percent
      form_params['potDistributionType'] = pot_distribution_type
      form_params['description'] = opts[:'description'] if !opts[:'description'].nil?
      form_params['twitter'] = opts[:'twitter'] if !opts[:'twitter'].nil?
      form_params['discord'] = opts[:'discord'] if !opts[:'discord'].nil?
      form_params['telegram'] = opts[:'telegram'] if !opts[:'telegram'].nil?
      form_params['imgUrl'] = opts[:'img_url'] if !opts[:'img_url'].nil?
      form_params['isPrivate'] = opts[:'is_private'] if !opts[:'is_private'].nil?

      # http body (model)
      post_body = nil
      auth_names = ['apiExpires', 'apiKey', 'apiSignature']
      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 => 'Guild')
      if @api_client.config.debugging
        @api_client.config.logger.debug "API called: GuildApi#guild_new\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
      end
      return data, status_code, headers
    end
    # Toggle share trades for your account, which controls whether your guild members can see your orders and positions in their UI
    # @param share_trades 
    # @param [Hash] opts the optional parameters
    # @return [Object]
    def guild_share_trades(share_trades, opts = {})
      data, _status_code, _headers = guild_share_trades_with_http_info(share_trades, opts)
      data
    end

    # Toggle share trades for your account, which controls whether your guild members can see your orders and positions in their UI
    # @param share_trades 
    # @param [Hash] opts the optional parameters
    # @return [Array<(Object, Fixnum, Hash)>] Object data, response status code and response headers
    def guild_share_trades_with_http_info(share_trades, opts = {})
      if @api_client.config.debugging
        @api_client.config.logger.debug 'Calling API: GuildApi.guild_share_trades ...'
      end
      # verify the required parameter 'share_trades' is set
      if @api_client.config.client_side_validation && share_trades.nil?
        fail ArgumentError, "Missing the required parameter 'share_trades' when calling GuildApi.guild_share_trades"
      end
      # resource path
      local_var_path = '/guild/shareTrades'

      # query parameters
      query_params = {}

      # header parameters
      header_params = {}
      # HTTP header 'Accept' (if needed)
      header_params['Accept'] = @api_client.select_header_accept(['application/json', 'application/xml', 'text/xml', 'application/javascript', 'text/javascript'])
      # HTTP header 'Content-Type'
      header_params['Content-Type'] = @api_client.select_header_content_type(['application/json', 'application/x-www-form-urlencoded'])

      # form parameters
      form_params = {}
      form_params['shareTrades'] = share_trades

      # http body (model)
      post_body = nil
      auth_names = ['apiExpires', 'apiKey', 'apiSignature']
      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 => 'Object')
      if @api_client.config.debugging
        @api_client.config.logger.debug "API called: GuildApi#guild_share_trades\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
      end
      return data, status_code, headers
    end
  end
end
