Package org.telegram.telegrambots.client
Class TelegramMultipartBuilder
Object
TelegramMultipartBuilder
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionaddInputFile
(String fileField, InputFile file, boolean addField) addInputStickers
(String stickersField, List<InputSticker> stickers) addJsonPart
(String fieldName, Object value) Add field to the builder if value is not null.addMedia
(InputMedia media) addMedia
(InputPaidMedia media) Add field to the builder if value is not null.Add field to the builder if value is not nullMultipartBody
build()
-
Field Details
-
internalBuilder
public final MultipartBody.Builder internalBuilder
-
-
Constructor Details
-
TelegramMultipartBuilder
public TelegramMultipartBuilder(ObjectMapper mapper)
-
-
Method Details
-
build
public MultipartBody build() -
addPart
Add field to the builder if value is not null- Parameters:
fieldName
- the field name to add to the multipartvalue
- the nullable value to add- Returns:
- the builder
-
addPart
Add field to the builder if value is not null. The value is converted using toString()- Parameters:
fieldName
- the field name to add to the multipartvalue
- the nullable value to add- Returns:
- the builder
-
addJsonPart
public TelegramMultipartBuilder addJsonPart(String fieldName, Object value) throws JsonProcessingException Add field to the builder if value is not null. The value is converted using ObjectMapper.writeValueAsString()- Parameters:
fieldName
- the field name to add to the multipartvalue
- the nullable value to add- Returns:
- the builder
- Throws:
JsonProcessingException
-
addInputFile
public TelegramMultipartBuilder addInputFile(String fileField, InputFile file, boolean addField) throws IOException - Throws:
IOException
-
addMedia
- Throws:
IOException
-
addMedia
- Throws:
IOException
-
addInputStickers
public TelegramMultipartBuilder addInputStickers(String stickersField, List<InputSticker> stickers) throws IOException - Throws:
IOException
-