Class GetFile
- java.lang.Object
-
- org.telegram.telegrambots.meta.api.methods.PartialBotApiMethod<T>
-
- org.telegram.telegrambots.meta.api.methods.BotApiMethod<File>
-
- org.telegram.telegrambots.meta.api.methods.GetFile
-
- All Implemented Interfaces:
Validable
public class GetFile extends BotApiMethod<File>
- Version:
- 1.0
Use this method to get basic info about a file and prepare it for downloading.
For the moment, bots can download files of up to 20MB in size.
On success, a File object is returned.
The file can then be downloaded via the link https://api.telegram.org/file/bot
/ , where is taken from the response. It is guaranteed that the link will be valid for at least 1 hour. When the link expires, a new one can be requested by calling getFile again. - Author:
- Ruben Bermudez
-
-
Field Summary
Fields Modifier and Type Field Description static String
PATH
-
Fields inherited from class org.telegram.telegrambots.meta.api.methods.BotApiMethod
METHOD_FIELD
-
Fields inherited from class org.telegram.telegrambots.meta.api.methods.PartialBotApiMethod
OBJECT_MAPPER
-
-
Constructor Summary
Constructors Constructor Description GetFile()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description File
deserializeResponse(String answer)
Deserialize a json answer to the response type to a methodString
getMethod()
Getter for method path (that is the same as method name)void
validate()
Validates that mandatory fields are filled and optional objects
-
-
-
Field Detail
-
PATH
public static final String PATH
- See Also:
- Constant Field Values
-
-
Method Detail
-
validate
public void validate() throws TelegramApiValidationException
Description copied from interface:Validable
Validates that mandatory fields are filled and optional objects- Throws:
TelegramApiValidationException
- If any mandatory field is empty
-
getMethod
public String getMethod()
Description copied from class:BotApiMethod
Getter for method path (that is the same as method name)- Specified by:
getMethod
in classBotApiMethod<File>
- Returns:
- Method path
-
deserializeResponse
public File deserializeResponse(String answer) throws TelegramApiRequestException
Description copied from class:PartialBotApiMethod
Deserialize a json answer to the response type to a method- Specified by:
deserializeResponse
in classPartialBotApiMethod<File>
- Parameters:
answer
- Json answer received- Returns:
- Answer for the method
- Throws:
TelegramApiRequestException
-
-