diff --git a/lib/src/telegram/model.g.dart b/lib/src/telegram/model.g.dart index f29105e..3b2937d 100644 --- a/lib/src/telegram/model.g.dart +++ b/lib/src/telegram/model.g.dart @@ -12,9 +12,9 @@ Animation _$AnimationFromJson(Map json) => Animation( width: json['width'] as int, height: json['height'] as int, duration: json['duration'] as int, - thumb: json['thumb'] == null + thumbnail: json['thumbnail'] == null ? null - : PhotoSize.fromJson(json['thumb'] as Map), + : PhotoSize.fromJson(json['thumbnail'] as Map), fileName: json['file_name'] as String?, mimeType: json['mime_type'] as String?, fileSize: json['file_size'] as int?, @@ -35,7 +35,7 @@ Map _$AnimationToJson(Animation instance) { } } - writeNotNull('thumb', instance.thumb?.toJson()); + writeNotNull('thumbnail', instance.thumbnail?.toJson()); writeNotNull('file_name', instance.fileName); writeNotNull('mime_type', instance.mimeType); writeNotNull('file_size', instance.fileSize); @@ -51,9 +51,9 @@ Audio _$AudioFromJson(Map json) => Audio( fileName: json['file_name'] as String?, mimeType: json['mime_type'] as String?, fileSize: json['file_size'] as int?, - thumb: json['thumb'] == null + thumbnail: json['thumbnail'] == null ? null - : PhotoSize.fromJson(json['thumb'] as Map), + : PhotoSize.fromJson(json['thumbnail'] as Map), ); Map _$AudioToJson(Audio instance) { @@ -74,7 +74,7 @@ Map _$AudioToJson(Audio instance) { writeNotNull('file_name', instance.fileName); writeNotNull('mime_type', instance.mimeType); writeNotNull('file_size', instance.fileSize); - writeNotNull('thumb', instance.thumb?.toJson()); + writeNotNull('thumbnail', instance.thumbnail?.toJson()); return val; } @@ -851,9 +851,9 @@ Map _$DiceToJson(Dice instance) => { Document _$DocumentFromJson(Map json) => Document( fileId: json['file_id'] as String, fileUniqueId: json['file_unique_id'] as String, - thumb: json['thumb'] == null + thumbnail: json['thumbnail'] == null ? null - : PhotoSize.fromJson(json['thumb'] as Map), + : PhotoSize.fromJson(json['thumbnail'] as Map), fileName: json['file_name'] as String?, mimeType: json['mime_type'] as String?, fileSize: json['file_size'] as int?, @@ -871,7 +871,7 @@ Map _$DocumentToJson(Document instance) { } } - writeNotNull('thumb', instance.thumb?.toJson()); + writeNotNull('thumbnail', instance.thumbnail?.toJson()); writeNotNull('file_name', instance.fileName); writeNotNull('mime_type', instance.mimeType); writeNotNull('file_size', instance.fileSize); @@ -2349,7 +2349,7 @@ InputMediaAnimation _$InputMediaAnimationFromJson(Map json) => InputMediaAnimation( type: json['type'] as String? ?? InputMedia.typeAnimation, media: json['media'] as String, - thumb: json['thumb'], + thumbnail: json['thumbnail'], caption: json['caption'] as String?, parseMode: json['parse_mode'] as String?, captionEntities: (json['caption_entities'] as List?) @@ -2377,7 +2377,7 @@ Map _$InputMediaAnimationToJson(InputMediaAnimation instance) { writeNotNull('parse_mode', instance.parseMode); writeNotNull('caption_entities', instance.captionEntities?.map((e) => e.toJson()).toList()); - writeNotNull('thumb', instance.thumb); + writeNotNull('thumbnail', instance.thumbnail); writeNotNull('width', instance.width); writeNotNull('height', instance.height); writeNotNull('duration', instance.duration); @@ -2389,7 +2389,7 @@ InputMediaAudio _$InputMediaAudioFromJson(Map json) => InputMediaAudio( type: json['type'] as String? ?? InputMedia.typeAudio, media: json['media'] as String, - thumb: json['thumb'], + thumbnail: json['thumbnail'], caption: json['caption'] as String?, parseMode: json['parse_mode'] as String?, captionEntities: (json['caption_entities'] as List?) @@ -2416,7 +2416,7 @@ Map _$InputMediaAudioToJson(InputMediaAudio instance) { writeNotNull('parse_mode', instance.parseMode); writeNotNull('caption_entities', instance.captionEntities?.map((e) => e.toJson()).toList()); - writeNotNull('thumb', instance.thumb); + writeNotNull('thumbnail', instance.thumbnail); writeNotNull('duration', instance.duration); writeNotNull('performer', instance.performer); writeNotNull('title', instance.title); @@ -2427,7 +2427,7 @@ InputMediaDocument _$InputMediaDocumentFromJson(Map json) => InputMediaDocument( type: json['type'] as String? ?? InputMedia.typeDocument, media: json['media'] as String, - thumb: json['thumb'], + thumbnail: json['thumbnail'], caption: json['caption'] as String?, parseMode: json['parse_mode'] as String?, captionEntities: (json['caption_entities'] as List?) @@ -2453,7 +2453,7 @@ Map _$InputMediaDocumentToJson(InputMediaDocument instance) { writeNotNull('parse_mode', instance.parseMode); writeNotNull('caption_entities', instance.captionEntities?.map((e) => e.toJson()).toList()); - writeNotNull('thumb', instance.thumb); + writeNotNull('thumbnail', instance.thumbnail); writeNotNull( 'disable_content_type_detection', instance.disableContentTypeDetection); return val; @@ -2500,7 +2500,7 @@ InputMediaVideo _$InputMediaVideoFromJson(Map json) => captionEntities: (json['caption_entities'] as List?) ?.map((e) => MessageEntity.fromJson(e as Map)) .toList(), - thumb: json['thumb'], + thumbnail: json['thumbnail'], width: json['width'] as int?, height: json['height'] as int?, duration: json['duration'] as int?, @@ -2524,7 +2524,7 @@ Map _$InputMediaVideoToJson(InputMediaVideo instance) { writeNotNull('parse_mode', instance.parseMode); writeNotNull('caption_entities', instance.captionEntities?.map((e) => e.toJson()).toList()); - writeNotNull('thumb', instance.thumb); + writeNotNull('thumbnail', instance.thumbnail); writeNotNull('width', instance.width); writeNotNull('height', instance.height); writeNotNull('duration', instance.duration); @@ -3863,9 +3863,9 @@ StickerSet _$StickerSetFromJson(Map json) => StickerSet( stickers: (json['stickers'] as List) .map((e) => Sticker.fromJson(e as Map)) .toList(), - thumb: json['thumb'] == null + thumbnail: json['thumbnail'] == null ? null - : PhotoSize.fromJson(json['thumb'] as Map), + : PhotoSize.fromJson(json['thumbnail'] as Map), ); Map _$StickerSetToJson(StickerSet instance) { @@ -3884,7 +3884,7 @@ Map _$StickerSetToJson(StickerSet instance) { } } - writeNotNull('thumb', instance.thumb?.toJson()); + writeNotNull('thumbnail', instance.thumbnail?.toJson()); return val; } @@ -3895,9 +3895,9 @@ Sticker _$StickerFromJson(Map json) => Sticker( height: json['height'] as int, isAnimated: json['is_animated'] as bool, isVideo: json['is_video'] as bool, - thumb: json['thumb'] == null + thumbnail: json['thumbnail'] == null ? null - : PhotoSize.fromJson(json['thumb'] as Map), + : PhotoSize.fromJson(json['thumbnail'] as Map), emoji: json['emoji'] as String?, setName: json['set_name'] as String?, premiumAnimation: json['premium_animation'] == null @@ -3928,7 +3928,7 @@ Map _$StickerToJson(Sticker instance) { } } - writeNotNull('thumb', instance.thumb?.toJson()); + writeNotNull('thumbnail', instance.thumbnail?.toJson()); writeNotNull('emoji', instance.emoji); writeNotNull('set_name', instance.setName); writeNotNull('premium_animation', instance.premiumAnimation?.toJson()); @@ -4156,9 +4156,9 @@ VideoNote _$VideoNoteFromJson(Map json) => VideoNote( fileUniqueId: json['file_unique_id'] as String, length: json['length'] as int, duration: json['duration'] as int, - thumb: json['thumb'] == null + thumbnail: json['thumbnail'] == null ? null - : PhotoSize.fromJson(json['thumb'] as Map), + : PhotoSize.fromJson(json['thumbnail'] as Map), fileSize: json['file_size'] as int?, ); @@ -4176,7 +4176,7 @@ Map _$VideoNoteToJson(VideoNote instance) { } } - writeNotNull('thumb', instance.thumb?.toJson()); + writeNotNull('thumbnail', instance.thumbnail?.toJson()); writeNotNull('file_size', instance.fileSize); return val; } @@ -4187,9 +4187,9 @@ Video _$VideoFromJson(Map json) => Video( width: json['width'] as int, height: json['height'] as int, duration: json['duration'] as int, - thumb: json['thumb'] == null + thumbnail: json['thumbnail'] == null ? null - : PhotoSize.fromJson(json['thumb'] as Map), + : PhotoSize.fromJson(json['thumbnail'] as Map), fileName: json['file_name'] as String?, mimeType: json['mime_type'] as String?, fileSize: json['file_size'] as int?, @@ -4210,7 +4210,7 @@ Map _$VideoToJson(Video instance) { } } - writeNotNull('thumb', instance.thumb?.toJson()); + writeNotNull('thumbnail', instance.thumbnail?.toJson()); writeNotNull('file_name', instance.fileName); writeNotNull('mime_type', instance.mimeType); writeNotNull('file_size', instance.fileSize); diff --git a/lib/src/telegram/models/animation.dart b/lib/src/telegram/models/animation.dart index d8704be..567207a 100644 --- a/lib/src/telegram/models/animation.dart +++ b/lib/src/telegram/models/animation.dart @@ -28,7 +28,7 @@ class Animation { int width; int height; int duration; - PhotoSize? thumb; + PhotoSize? thumbnail; String? fileName; String? mimeType; int? fileSize; @@ -39,7 +39,7 @@ class Animation { required this.width, required this.height, required this.duration, - this.thumb, + this.thumbnail, this.fileName, this.mimeType, this.fileSize, diff --git a/lib/src/telegram/models/audio.dart b/lib/src/telegram/models/audio.dart index cca2058..bc1c3a5 100644 --- a/lib/src/telegram/models/audio.dart +++ b/lib/src/telegram/models/audio.dart @@ -31,7 +31,7 @@ class Audio { String? fileName; String? mimeType; int? fileSize; - PhotoSize? thumb; + PhotoSize? thumbnail; Audio({ required this.fileId, @@ -42,7 +42,7 @@ class Audio { this.fileName, this.mimeType, this.fileSize, - this.thumb, + this.thumbnail, }); @JsonKey(includeFromJson: false, includeToJson: false) diff --git a/lib/src/telegram/models/document.dart b/lib/src/telegram/models/document.dart index 5992fdc..f31d55d 100644 --- a/lib/src/telegram/models/document.dart +++ b/lib/src/telegram/models/document.dart @@ -29,14 +29,14 @@ part of '../model.dart'; class Document { String fileId; String fileUniqueId; - PhotoSize? thumb; + PhotoSize? thumbnail; String? fileName; String? mimeType; int? fileSize; Document({ required this.fileId, required this.fileUniqueId, - this.thumb, + this.thumbnail, this.fileName, this.mimeType, this.fileSize, diff --git a/lib/src/telegram/models/input_media_animation.dart b/lib/src/telegram/models/input_media_animation.dart index b5ef95b..2a845ea 100644 --- a/lib/src/telegram/models/input_media_animation.dart +++ b/lib/src/telegram/models/input_media_animation.dart @@ -33,7 +33,7 @@ class InputMediaAnimation implements InputMedia { String? parseMode; @override List? captionEntities; - dynamic thumb; // InputFile or String + dynamic thumbnail; // InputFile or String int? width; int? height; int? duration; @@ -42,7 +42,7 @@ class InputMediaAnimation implements InputMedia { InputMediaAnimation( {this.type = InputMedia.typeAnimation, required this.media, - this.thumb, + this.thumbnail, this.caption, this.parseMode, this.captionEntities, diff --git a/lib/src/telegram/models/input_media_audio.dart b/lib/src/telegram/models/input_media_audio.dart index be8d6d7..aca58d0 100644 --- a/lib/src/telegram/models/input_media_audio.dart +++ b/lib/src/telegram/models/input_media_audio.dart @@ -33,7 +33,7 @@ class InputMediaAudio implements InputMedia { String? parseMode; @override List? captionEntities; - dynamic thumb; // InputFile or String + dynamic thumbnail; // InputFile or String int? duration; String? performer; String? title; @@ -41,7 +41,7 @@ class InputMediaAudio implements InputMedia { InputMediaAudio({ this.type = InputMedia.typeAudio, required this.media, - this.thumb, + this.thumbnail, this.caption, this.parseMode, this.captionEntities, diff --git a/lib/src/telegram/models/input_media_document.dart b/lib/src/telegram/models/input_media_document.dart index 4e50262..277096e 100644 --- a/lib/src/telegram/models/input_media_document.dart +++ b/lib/src/telegram/models/input_media_document.dart @@ -33,12 +33,12 @@ class InputMediaDocument implements InputMedia { String? parseMode; @override List? captionEntities; - dynamic thumb; // InputFile or String + dynamic thumbnail; // InputFile or String bool? disableContentTypeDetection; InputMediaDocument({ this.type = InputMedia.typeDocument, required this.media, - this.thumb, + this.thumbnail, this.caption, this.parseMode, this.captionEntities, diff --git a/lib/src/telegram/models/input_media_video.dart b/lib/src/telegram/models/input_media_video.dart index 018aee4..ec3678d 100644 --- a/lib/src/telegram/models/input_media_video.dart +++ b/lib/src/telegram/models/input_media_video.dart @@ -33,7 +33,7 @@ class InputMediaVideo implements InputMedia { String? parseMode; @override List? captionEntities; - dynamic thumb; // InputFile or String + dynamic thumbnail; // InputFile or String int? width; int? height; int? duration; @@ -46,7 +46,7 @@ class InputMediaVideo implements InputMedia { this.caption, this.parseMode, this.captionEntities, - this.thumb, + this.thumbnail, this.width, this.height, this.duration, diff --git a/lib/src/telegram/models/sticker.dart b/lib/src/telegram/models/sticker.dart index 3a7db3a..30d4a96 100644 --- a/lib/src/telegram/models/sticker.dart +++ b/lib/src/telegram/models/sticker.dart @@ -29,7 +29,7 @@ class Sticker { int height; bool isAnimated; bool isVideo; - PhotoSize? thumb; + PhotoSize? thumbnail; String? emoji; String? setName; File? premiumAnimation; @@ -44,7 +44,7 @@ class Sticker { required this.height, required this.isAnimated, required this.isVideo, - this.thumb, + this.thumbnail, this.emoji, this.setName, this.premiumAnimation, diff --git a/lib/src/telegram/models/sticker_set.dart b/lib/src/telegram/models/sticker_set.dart index 5184753..5fcf6ab 100644 --- a/lib/src/telegram/models/sticker_set.dart +++ b/lib/src/telegram/models/sticker_set.dart @@ -29,7 +29,7 @@ class StickerSet { bool isAnimated; bool isVideo; List stickers; - PhotoSize? thumb; + PhotoSize? thumbnail; StickerSet({ required this.name, required this.title, @@ -37,7 +37,7 @@ class StickerSet { required this.isAnimated, required this.isVideo, required this.stickers, - this.thumb, + this.thumbnail, }); factory StickerSet.fromJson(Map json) => _$StickerSetFromJson(json); diff --git a/lib/src/telegram/models/video.dart b/lib/src/telegram/models/video.dart index 650f1eb..25a15d4 100644 --- a/lib/src/telegram/models/video.dart +++ b/lib/src/telegram/models/video.dart @@ -28,7 +28,7 @@ class Video { int width; int height; int duration; - PhotoSize? thumb; + PhotoSize? thumbnail; String? fileName; String? mimeType; int? fileSize; @@ -39,7 +39,7 @@ class Video { required this.width, required this.height, required this.duration, - this.thumb, + this.thumbnail, this.fileName, this.mimeType, this.fileSize, diff --git a/lib/src/telegram/models/video_note.dart b/lib/src/telegram/models/video_note.dart index d453626..c031086 100644 --- a/lib/src/telegram/models/video_note.dart +++ b/lib/src/telegram/models/video_note.dart @@ -30,7 +30,7 @@ class VideoNote { String fileUniqueId; int length; int duration; - PhotoSize? thumb; + PhotoSize? thumbnail; int? fileSize; VideoNote({ @@ -38,7 +38,7 @@ class VideoNote { required this.fileUniqueId, required this.length, required this.duration, - this.thumb, + this.thumbnail, this.fileSize, }); diff --git a/lib/src/telegram/telegram.dart b/lib/src/telegram/telegram.dart index 633a395..5107eb9 100644 --- a/lib/src/telegram/telegram.dart +++ b/lib/src/telegram/telegram.dart @@ -340,7 +340,7 @@ class Telegram { int? duration, String? performer, String? title, - dynamic thumb, + dynamic thumbnail, bool? disableNotification, bool? protectContent, int? replyToMessageId, @@ -379,14 +379,14 @@ class Telegram { 'Attribute \'audio\' can only be either io.File or String (Telegram fileId or image url)')); } - if (thumb != null) { - if (thumb is io.File) { - multiPartFiles.add(HttpClient.toMultiPartFile(thumb, 'thumb')); - } else if (thumb is String) { - body.addAll({'thumb': thumb}); + if (thumbnail != null) { + if (thumbnail is io.File) { + multiPartFiles.add(HttpClient.toMultiPartFile(thumbnail, 'thumbnail')); + } else if (thumbnail is String) { + body.addAll({'thumbnail': thumbnail}); } else { return Future.error(TelegramException( - 'Attribute \'thumb\' can only be either io.File or String (Telegram fileId or image url)')); + 'Attribute \'thumbnail\' can only be either io.File or String (Telegram fileId or image url)')); } } @@ -407,7 +407,7 @@ class Telegram { /// https://core.telegram.org/bots/api#senddocument Future sendDocument(dynamic chatId, dynamic document, {int? messageThreadId, - dynamic thumb, + dynamic thumbnail, String? caption, String? parseMode, List? captionEntities, @@ -448,14 +448,14 @@ class Telegram { 'Attribute \'document\' can only be either io.File or String (Telegram fileId or image url)')); } - if (thumb != null) { - if (thumb is io.File) { - multiPartFiles.add(HttpClient.toMultiPartFile(thumb, 'thumb')); - } else if (thumb is String) { - body.addAll({'thumb': thumb}); + if (thumbnail != null) { + if (thumbnail is io.File) { + multiPartFiles.add(HttpClient.toMultiPartFile(thumbnail, 'thumbnail')); + } else if (thumbnail is String) { + body.addAll({'thumbnail': thumbnail}); } else { return Future.error(TelegramException( - 'Attribute \'thumb\' can only be either io.File or String (Telegram fileId or image url)')); + 'Attribute \'thumbnail\' can only be either io.File or String (Telegram fileId or image url)')); } } @@ -481,7 +481,7 @@ class Telegram { int? duration, int? width, int? height, - dynamic thumb, + dynamic thumbnail, String? caption, String? parseMode, List? captionEntities, @@ -527,14 +527,14 @@ class Telegram { 'Attribute \'video\' can only be either io.File or String (Telegram fileId or image url)')); } - if (thumb != null) { - if (thumb is io.File) { - multiPartFiles.add(HttpClient.toMultiPartFile(thumb, 'thumb')); - } else if (thumb is String) { - body.addAll({'thumb': thumb}); + if (thumbnail != null) { + if (thumbnail is io.File) { + multiPartFiles.add(HttpClient.toMultiPartFile(thumbnail, 'thumbnail')); + } else if (thumbnail is String) { + body.addAll({'thumbnail': thumbnail}); } else { return Future.error(TelegramException( - 'Attribute \'thumb\' can only be either io.File or String (Telegram fileId or image url)')); + 'Attribute \'thumbnail\' can only be either io.File or String (Telegram fileId or image url)')); } } @@ -557,7 +557,7 @@ class Telegram { int? duration, int? width, int? height, - dynamic thumb, + dynamic thumbnail, String? caption, String? parseMode, List? captionEntities, @@ -601,14 +601,14 @@ class Telegram { 'Attribute \'animation\' can only be either io.File or String (Telegram fileId or image url)')); } - if (thumb != null) { - if (thumb is io.File) { - multiPartFiles.add(HttpClient.toMultiPartFile(thumb, 'thumb')); - } else if (thumb is String) { - body.addAll({'thumb': thumb}); + if (thumbnail != null) { + if (thumbnail is io.File) { + multiPartFiles.add(HttpClient.toMultiPartFile(thumbnail, 'thumbnail')); + } else if (thumbnail is String) { + body.addAll({'thumbnail': thumbnail}); } else { return Future.error(TelegramException( - 'Attribute \'thumb\' can only be either io.File or String (Telegram fileId or image url)')); + 'Attribute \'thumbnail\' can only be either io.File or String (Telegram fileId or image url)')); } } @@ -694,7 +694,7 @@ class Telegram { {int? messageThreadId, int? duration, int? length, - dynamic thumb, + dynamic thumbnail, bool? disableNotification, bool? protectContent, int? replyToMessageId, @@ -728,14 +728,14 @@ class Telegram { 'Attribute \'videoNote\' can only be either io.File or String (Telegram fileId or image url)')); } - if (thumb != null) { - if (thumb is io.File) { - multiPartFiles.add(HttpClient.toMultiPartFile(thumb, 'thumb')); - } else if (thumb is String) { - body.addAll({'thumb': thumb}); + if (thumbnail != null) { + if (thumbnail is io.File) { + multiPartFiles.add(HttpClient.toMultiPartFile(thumbnail, 'thumbnail')); + } else if (thumbnail is String) { + body.addAll({'thumbnail': thumbnail}); } else { return Future.error(TelegramException( - 'Attribute \'thumb\' can only be either io.File or String (Telegram fileId or image url)')); + 'Attribute \'thumbnail\' can only be either io.File or String (Telegram fileId or image url)')); } } @@ -2629,13 +2629,12 @@ class Telegram { return await HttpClient.httpPost(requestUrl, body: body); } - /// Use this method to change the [mask position] of a mask sticker. + /// Use this method to change the [MaskPosition] of a mask sticker. /// The sticker must belong to a sticker set that was created by the bot. /// /// Returns *True* on success. /// /// https://core.telegram.org/bots/api#setstickermaskposition - /// [mask position](https://core.telegram.org/bots/api#maskposition) Future setStickerMaskPosition(String sticker, MaskPosition? maskPosition) async { var requestUrl = _apiUri('setStickerMaskPosition'); var body = { @@ -2667,27 +2666,27 @@ class Telegram { /// /// https://core.telegram.org/bots/api#setstickersetthumbnail Future setStickerSetThumbnail(String name, int userId, - {dynamic thumb}) async { + {dynamic thumbnail}) async { var requestUrl = _apiUri('setStickerSetThumbnail'); var body = { 'name': name, 'user_id': userId, }; - if (thumb == null) { + if (thumbnail == null) { return await HttpClient.httpPost(requestUrl, body: body); - } else if (thumb is io.File) { + } else if (thumbnail is io.File) { // filename cannot be empty to post to Telegram server var files = List.filled( 1, - MultipartFile('thumb', thumb.openRead(), thumb.lengthSync(), - filename: '${thumb.lengthSync()}')); + MultipartFile('thumbnail', thumbnail.openRead(), thumbnail.lengthSync(), + filename: '${thumbnail.lengthSync()}')); return await HttpClient.httpMultipartPost(requestUrl, files, body: body); - } else if (thumb is String) { - body.addAll({'thumb': thumb}); + } else if (thumbnail is String) { + body.addAll({'thumbnail': thumbnail}); return await HttpClient.httpPost(requestUrl, body: body); } else { return Future.error(TelegramException( - 'Attribute \'thumb\' can only be either io.File or String (Telegram fileId or image url)')); + 'Attribute \'thumbnail\' can only be either io.File or String (Telegram fileId or image url)')); } }