All Downloads are FREE. Search and download functionalities are using the official Maven repository.

de.raysha.lib.telegram.bot.api.RequestExecutor Maven / Gradle / Ivy

Go to download

This is an java library for the Telegram-Bot-API. The Bot-API is an HTTP-based interface created for developers keen on building bots for Telegram.

There is a newer version: 2.1
Show newest version
package de.raysha.lib.telegram.bot.api;

import de.raysha.lib.telegram.bot.api.exception.BotException;

import java.io.File;
import java.util.Map;

/**
 * Executes requests to Telegram Bot API
 */
public interface RequestExecutor {

    /**
     * Make GET request to the API
     *
     * @param action API method name (/bot%TOKEN%/%ACTION%)
     * @param parameters query parameters
     * @return value of 'result' field
     * @throws BotException on internal exception (IO, invalid response, etc
     */
    String get(String action, Map parameters) throws BotException;

    /**
     * Make POST request to the API
     *
     * @param action API method name (/bot%TOKEN%/%ACTION%)
     * @param parameters query parameters
     * @return value of 'result' field
     * @throws BotException on internal exception (IO, invalid response, etc
     */
    String post(String action, Map parameters) throws BotException;

    /**
     * Make POST request to the API, with a file
     *
     * @param action API method name (/bot%TOKEN%/%ACTION%)
     * @param parameters query parameters
     * @param fileName a parameter name for the file ('photo', 'sticker', etc)
     * @param file file to upload
     * @return value of 'result' field
     * @throws BotException on internal exception (IO, invalid response, etc
     */
    String post(String action, Map parameters, String fileName, File file) throws BotException;

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy