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 String
CAPTION_FIELD
static String
MEDIA_FIELD
static String
PARSEMODE_FIELD
static String
TYPE_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 String
getCaption()
String
getMedia()
File
getMediaFile()
String
getMediaName()
InputStream
getNewMediaStream()
String
getParseMode()
abstract String
getType()
boolean
isNewMedia()
InputMedia
setCaption(String caption)
T
setMedia(File mediaFile, String fileName)
Use this setter to send new file.T
setMedia(InputStream mediaStream, String fileName)
Use this setter to send new file as stream.T
setMedia(String media)
Use this setter to send an existing file (using file_id) or an url.InputMedia<T>
setParseMode(String parseMode)
String
toString()
void
validate()
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 TelegramApiValidationException
Description copied from interface:Validable
Validates that mandatory fields are filled and optional objects- Specified by:
validate
in interfaceValidable
- Throws:
TelegramApiValidationException
- If any mandatory field is empty
-
getType
public abstract String getType()
-
-