class Teleswagger::MessagesApi

Attributes

api_client[RW]

Public Class Methods

new(api_client = ApiClient.default) click to toggle source
# File lib/teleswagger/api/messages_api.rb, line 30
def initialize(api_client = ApiClient.default)
  @api_client = api_client
end

Public Instance Methods

delete_message(token, chat_id, message_id, opts = {}) click to toggle source

@param token bot's token to authorize the request @param chat_id @param message_id @param [Hash] opts the optional parameters @return [ResponseBool]

# File lib/teleswagger/api/messages_api.rb, line 41
def delete_message(token, chat_id, message_id, opts = {})
  data, _status_code, _headers = delete_message_with_http_info(token, chat_id, message_id, opts)
  return data
end
delete_message_with_http_info(token, chat_id, message_id, opts = {}) click to toggle source

@param token bot&#39;s token to authorize the request @param chat_id @param message_id @param [Hash] opts the optional parameters @return [Array<(ResponseBool, Fixnum, Hash)>] ResponseBool data, response status code and response headers

# File lib/teleswagger/api/messages_api.rb, line 53
def delete_message_with_http_info(token, chat_id, message_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug "Calling API: MessagesApi.delete_message ..."
  end
  # verify the required parameter 'token' is set
  fail ArgumentError, "Missing the required parameter 'token' when calling MessagesApi.delete_message" if token.nil?
  # verify the required parameter 'chat_id' is set
  fail ArgumentError, "Missing the required parameter 'chat_id' when calling MessagesApi.delete_message" if chat_id.nil?
  # verify the required parameter 'message_id' is set
  fail ArgumentError, "Missing the required parameter 'message_id' when calling MessagesApi.delete_message" if message_id.nil?
  # resource path
  local_var_path = "/bot{token}/deleteMessage".sub('{format}','json').sub('{' + 'token' + '}', token.to_s)

  # query parameters
  query_params = {}
  query_params[:'chat_id'] = chat_id
  query_params[:'message_id'] = message_id

  # header parameters
  header_params = {}

  # HTTP header 'Accept' (if needed)
  local_header_accept = ['application/json']
  local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result

  # HTTP header 'Content-Type'
  local_header_content_type = ['application/json']
  header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type)

  # 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 => 'ResponseBool')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: MessagesApi#delete_message\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
edit_message_caption(token, opts = {}) click to toggle source

@param token bot&#39;s token to authorize the request @param [Hash] opts the optional parameters @option opts [EditMessageCaptionBody] :body @return [InlineResponse200]

# File lib/teleswagger/api/messages_api.rb, line 107
def edit_message_caption(token, opts = {})
  data, _status_code, _headers = edit_message_caption_with_http_info(token, opts)
  return data
end
edit_message_caption_with_http_info(token, opts = {}) click to toggle source

@param token bot&#39;s token to authorize the request @param [Hash] opts the optional parameters @option opts [EditMessageCaptionBody] :body @return [Array<(InlineResponse200, Fixnum, Hash)>] InlineResponse200 data, response status code and response headers

# File lib/teleswagger/api/messages_api.rb, line 118
def edit_message_caption_with_http_info(token, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug "Calling API: MessagesApi.edit_message_caption ..."
  end
  # verify the required parameter 'token' is set
  fail ArgumentError, "Missing the required parameter 'token' when calling MessagesApi.edit_message_caption" if token.nil?
  # resource path
  local_var_path = "/bot{token}/editMessageCaption".sub('{format}','json').sub('{' + 'token' + '}', token.to_s)

  # query parameters
  query_params = {}

  # header parameters
  header_params = {}

  # HTTP header 'Accept' (if needed)
  local_header_accept = ['application/json']
  local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result

  # HTTP header 'Content-Type'
  local_header_content_type = ['application/json']
  header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type)

  # form parameters
  form_params = {}

  # http body (model)
  post_body = @api_client.object_to_http_body(opts[:'body'])
  auth_names = []
  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 => 'InlineResponse200')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: MessagesApi#edit_message_caption\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
edit_message_reply_markup(token, opts = {}) click to toggle source

@param token bot&#39;s token to authorize the request @param [Hash] opts the optional parameters @option opts [EditMessageReplyMarkupBody] :body @return [InlineResponse200]

# File lib/teleswagger/api/messages_api.rb, line 166
def edit_message_reply_markup(token, opts = {})
  data, _status_code, _headers = edit_message_reply_markup_with_http_info(token, opts)
  return data
end
edit_message_reply_markup_with_http_info(token, opts = {}) click to toggle source

@param token bot&#39;s token to authorize the request @param [Hash] opts the optional parameters @option opts [EditMessageReplyMarkupBody] :body @return [Array<(InlineResponse200, Fixnum, Hash)>] InlineResponse200 data, response status code and response headers

# File lib/teleswagger/api/messages_api.rb, line 177
def edit_message_reply_markup_with_http_info(token, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug "Calling API: MessagesApi.edit_message_reply_markup ..."
  end
  # verify the required parameter 'token' is set
  fail ArgumentError, "Missing the required parameter 'token' when calling MessagesApi.edit_message_reply_markup" if token.nil?
  # resource path
  local_var_path = "/bot{token}/editMessageReplyMarkup".sub('{format}','json').sub('{' + 'token' + '}', token.to_s)

  # query parameters
  query_params = {}

  # header parameters
  header_params = {}

  # HTTP header 'Accept' (if needed)
  local_header_accept = ['application/json']
  local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result

  # HTTP header 'Content-Type'
  local_header_content_type = ['application/json']
  header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type)

  # form parameters
  form_params = {}

  # http body (model)
  post_body = @api_client.object_to_http_body(opts[:'body'])
  auth_names = []
  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 => 'InlineResponse200')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: MessagesApi#edit_message_reply_markup\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
edit_message_text(token, opts = {}) click to toggle source

@param token bot&#39;s token to authorize the request @param [Hash] opts the optional parameters @option opts [EditMessageTextBody] :body @return [InlineResponse200]

# File lib/teleswagger/api/messages_api.rb, line 225
def edit_message_text(token, opts = {})
  data, _status_code, _headers = edit_message_text_with_http_info(token, opts)
  return data
end
edit_message_text_with_http_info(token, opts = {}) click to toggle source

@param token bot&#39;s token to authorize the request @param [Hash] opts the optional parameters @option opts [EditMessageTextBody] :body @return [Array<(InlineResponse200, Fixnum, Hash)>] InlineResponse200 data, response status code and response headers

# File lib/teleswagger/api/messages_api.rb, line 236
def edit_message_text_with_http_info(token, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug "Calling API: MessagesApi.edit_message_text ..."
  end
  # verify the required parameter 'token' is set
  fail ArgumentError, "Missing the required parameter 'token' when calling MessagesApi.edit_message_text" if token.nil?
  # resource path
  local_var_path = "/bot{token}/editMessageText".sub('{format}','json').sub('{' + 'token' + '}', token.to_s)

  # query parameters
  query_params = {}

  # header parameters
  header_params = {}

  # HTTP header 'Accept' (if needed)
  local_header_accept = ['application/json']
  local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result

  # HTTP header 'Content-Type'
  local_header_content_type = ['application/json']
  header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type)

  # form parameters
  form_params = {}

  # http body (model)
  post_body = @api_client.object_to_http_body(opts[:'body'])
  auth_names = []
  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 => 'InlineResponse200')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: MessagesApi#edit_message_text\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
forward_message(token, chat_id, from_chat_id, message_id, opts = {}) click to toggle source

@param token bot&#39;s token to authorize the request @param chat_id @param from_chat_id @param message_id @param [Hash] opts the optional parameters @option opts [BOOLEAN] :disable_notification @return [ResponseMessage]

# File lib/teleswagger/api/messages_api.rb, line 287
def forward_message(token, chat_id, from_chat_id, message_id, opts = {})
  data, _status_code, _headers = forward_message_with_http_info(token, chat_id, from_chat_id, message_id, opts)
  return data
end
forward_message_with_http_info(token, chat_id, from_chat_id, message_id, opts = {}) click to toggle source

@param token bot&#39;s token to authorize the request @param chat_id @param from_chat_id @param message_id @param [Hash] opts the optional parameters @option opts [BOOLEAN] :disable_notification @return [Array<(ResponseMessage, Fixnum, Hash)>] ResponseMessage data, response status code and response headers

# File lib/teleswagger/api/messages_api.rb, line 301
def forward_message_with_http_info(token, chat_id, from_chat_id, message_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug "Calling API: MessagesApi.forward_message ..."
  end
  # verify the required parameter 'token' is set
  fail ArgumentError, "Missing the required parameter 'token' when calling MessagesApi.forward_message" if token.nil?
  # verify the required parameter 'chat_id' is set
  fail ArgumentError, "Missing the required parameter 'chat_id' when calling MessagesApi.forward_message" if chat_id.nil?
  # verify the required parameter 'from_chat_id' is set
  fail ArgumentError, "Missing the required parameter 'from_chat_id' when calling MessagesApi.forward_message" if from_chat_id.nil?
  # verify the required parameter 'message_id' is set
  fail ArgumentError, "Missing the required parameter 'message_id' when calling MessagesApi.forward_message" if message_id.nil?
  # resource path
  local_var_path = "/bot{token}/forwardMessage".sub('{format}','json').sub('{' + 'token' + '}', token.to_s)

  # query parameters
  query_params = {}

  # header parameters
  header_params = {}

  # HTTP header 'Accept' (if needed)
  local_header_accept = ['application/json']
  local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result

  # HTTP header 'Content-Type'
  local_header_content_type = ['application/x-www-form-urlencoded']
  header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type)

  # form parameters
  form_params = {}
  form_params["chat_id"] = chat_id
  form_params["from_chat_id"] = from_chat_id
  form_params["message_id"] = message_id
  form_params["disable_notification"] = opts[:'disable_notification'] if !opts[:'disable_notification'].nil?

  # http body (model)
  post_body = nil
  auth_names = []
  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 => 'ResponseMessage')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: MessagesApi#forward_message\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
send_message(token, opts = {}) click to toggle source

@param token bot&#39;s token to authorize the request @param [Hash] opts the optional parameters @option opts [SendMessageBody] :body @return [ResponseMessage]

# File lib/teleswagger/api/messages_api.rb, line 359
def send_message(token, opts = {})
  data, _status_code, _headers = send_message_with_http_info(token, opts)
  return data
end
send_message_bytes(token, body, opts = {}) click to toggle source

@param token bot&#39;s token to authorize the request @param body @param [Hash] opts the optional parameters @return [ResponseMessage]

# File lib/teleswagger/api/messages_api.rb, line 418
def send_message_bytes(token, body, opts = {})
  data, _status_code, _headers = send_message_bytes_with_http_info(token, body, opts)
  return data
end
send_message_bytes_with_http_info(token, body, opts = {}) click to toggle source

@param token bot&#39;s token to authorize the request @param body @param [Hash] opts the optional parameters @return [Array<(ResponseMessage, Fixnum, Hash)>] ResponseMessage data, response status code and response headers

# File lib/teleswagger/api/messages_api.rb, line 429
def send_message_bytes_with_http_info(token, body, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug "Calling API: MessagesApi.send_message_bytes ..."
  end
  # verify the required parameter 'token' is set
  fail ArgumentError, "Missing the required parameter 'token' when calling MessagesApi.send_message_bytes" if token.nil?
  # verify the required parameter 'body' is set
  fail ArgumentError, "Missing the required parameter 'body' when calling MessagesApi.send_message_bytes" if body.nil?
  # resource path
  local_var_path = "/bot{token}/sendMessage#bytes".sub('{format}','json').sub('{' + 'token' + '}', token.to_s)

  # query parameters
  query_params = {}

  # header parameters
  header_params = {}

  # HTTP header 'Accept' (if needed)
  local_header_accept = ['application/json']
  local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result

  # HTTP header 'Content-Type'
  local_header_content_type = ['application/json']
  header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type)

  # form parameters
  form_params = {}

  # http body (model)
  post_body = @api_client.object_to_http_body(body)
  auth_names = []
  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 => 'ResponseMessage')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: MessagesApi#send_message_bytes\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
send_message_with_http_info(token, opts = {}) click to toggle source

@param token bot&#39;s token to authorize the request @param [Hash] opts the optional parameters @option opts [SendMessageBody] :body @return [Array<(ResponseMessage, Fixnum, Hash)>] ResponseMessage data, response status code and response headers

# File lib/teleswagger/api/messages_api.rb, line 370
def send_message_with_http_info(token, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug "Calling API: MessagesApi.send_message ..."
  end
  # verify the required parameter 'token' is set
  fail ArgumentError, "Missing the required parameter 'token' when calling MessagesApi.send_message" if token.nil?
  # resource path
  local_var_path = "/bot{token}/sendMessage".sub('{format}','json').sub('{' + 'token' + '}', token.to_s)

  # query parameters
  query_params = {}

  # header parameters
  header_params = {}

  # HTTP header 'Accept' (if needed)
  local_header_accept = ['application/json']
  local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result

  # HTTP header 'Content-Type'
  local_header_content_type = ['application/json']
  header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type)

  # form parameters
  form_params = {}

  # http body (model)
  post_body = @api_client.object_to_http_body(opts[:'body'])
  auth_names = []
  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 => 'ResponseMessage')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: MessagesApi#send_message\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end