Class InputMedia
- java.lang.Object
-
- org.telegram.telegrambots.meta.api.objects.media.InputMedia
-
- All Implemented Interfaces:
Serializable,BotApiObject,Validable
- Direct Known Subclasses:
InputMediaAnimation,InputMediaAudio,InputMediaDocument,InputMediaPhoto,InputMediaVideo
public abstract class InputMedia extends Object implements Validable, BotApiObject
- Version:
- 3.5
- Author:
- Ruben Bermudez
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static StringCAPTION_FIELDstatic StringCAPTIONENTITIES_FIELDstatic StringMEDIA_FIELDstatic StringPARSEMODE_FIELDstatic StringTYPE_FIELD
-
Constructor Summary
Constructors Constructor Description InputMedia()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract StringgetType()booleanisNewMedia()voidsetMedia(File mediaFile, String fileName)Use this setter to send new file.voidsetMedia(InputStream mediaStream, String fileName)Use this setter to send new file as stream.voidsetMedia(String media)Use this setter to send an existing file (using file_id) or an url.voidvalidate()Validates that mandatory fields are filled and optional objects
-
-
-
Field Detail
-
TYPE_FIELD
public static final String TYPE_FIELD
- See Also:
- Constant Field Values
-
MEDIA_FIELD
public static final String MEDIA_FIELD
- See Also:
- Constant Field Values
-
CAPTION_FIELD
public static final String CAPTION_FIELD
- See Also:
- Constant Field Values
-
PARSEMODE_FIELD
public static final String PARSEMODE_FIELD
- See Also:
- Constant Field Values
-
CAPTIONENTITIES_FIELD
public static final String CAPTIONENTITIES_FIELD
- See Also:
- Constant Field Values
-
-
Method Detail
-
isNewMedia
public boolean isNewMedia()
-
setMedia
public void setMedia(String media)
Use this setter to send an existing file (using file_id) or an url.- Parameters:
media- File_id or URL of the file to send
-
setMedia
public void setMedia(File mediaFile, String fileName)
Use this setter to send new file.- Parameters:
mediaFile- File to send
-
setMedia
public void setMedia(InputStream mediaStream, String fileName)
Use this setter to send new file as stream.- Parameters:
mediaStream- File to send
-
validate
public void validate() throws TelegramApiValidationExceptionDescription copied from interface:ValidableValidates that mandatory fields are filled and optional objects- Specified by:
validatein interfaceValidable- Throws:
TelegramApiValidationException- If any mandatory field is empty
-
getType
public abstract String getType()
-
-