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 String
CAPTION_FIELD
static String
CAPTIONENTITIES_FIELD
static String
MEDIA_FIELD
static String
PARSEMODE_FIELD
static String
TYPE_FIELD
-
Constructor Summary
Constructors Constructor Description InputMedia()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract String
getType()
boolean
isNewMedia()
void
setMedia(File mediaFile, String fileName)
Use this setter to send new file.void
setMedia(InputStream mediaStream, String fileName)
Use this setter to send new file as stream.void
setMedia(String media)
Use this setter to send an existing file (using file_id) or an url.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
-
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 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()
-
-