Class InputMedia<T>
- java.lang.Object
-
- org.telegram.telegrambots.meta.api.objects.media.InputMedia<T>
-
- All Implemented Interfaces:
Serializable,BotApiObject,InputBotApiObject,Validable
- Direct Known Subclasses:
InputMediaAnimation,InputMediaAudio,InputMediaDocument,InputMediaPhoto,InputMediaVideo
public abstract class InputMedia<T> extends Object implements InputBotApiObject, Validable
- Version:
- 3.5
- Author:
- Ruben Bermudez
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static StringCAPTION_FIELDstatic StringMEDIA_FIELDstatic StringPARSEMODE_FIELDstatic StringTYPE_FIELD
-
Constructor Summary
Constructors Constructor Description InputMedia()InputMedia(String media, String caption)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description StringgetCaption()StringgetMedia()FilegetMediaFile()StringgetMediaName()InputStreamgetNewMediaStream()StringgetParseMode()abstract StringgetType()booleanisNewMedia()InputMediasetCaption(String caption)TsetMedia(File mediaFile, String fileName)Use this setter to send new file.TsetMedia(InputStream mediaStream, String fileName)Use this setter to send new file as stream.TsetMedia(String media)Use this setter to send an existing file (using file_id) or an url.InputMedia<T>setParseMode(String parseMode)StringtoString()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
-
-
Method Detail
-
getMedia
public String getMedia()
-
getMediaFile
public File getMediaFile()
-
getNewMediaStream
public InputStream getNewMediaStream()
-
getMediaName
public String getMediaName()
-
isNewMedia
public boolean isNewMedia()
-
setMedia
public T 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- Returns:
- This object
-
setMedia
public T setMedia(File mediaFile, String fileName)
Use this setter to send new file.- Parameters:
mediaFile- File to send- Returns:
- This object
-
setMedia
public T setMedia(InputStream mediaStream, String fileName)
Use this setter to send new file as stream.- Parameters:
mediaStream- File to send- Returns:
- This object
-
getCaption
public String getCaption()
-
setCaption
public InputMedia setCaption(String caption)
-
getParseMode
public String getParseMode()
-
setParseMode
public InputMedia<T> setParseMode(String parseMode)
-
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()
-
-