From 37b2614b62bd937bc143ffa62dda4e4920e4f9af Mon Sep 17 00:00:00 2001 From: Andrew Privalov Date: Mon, 30 Jan 2023 23:05:50 +0300 Subject: [PATCH] Change field Thumb type (#13) * change Thumb fields to InputFile * change Thumb fields to InputFile * fix test --- CHANGELOG.md | 4 ++++ methods_params.go | 10 +++++----- methods_test.go | 4 ++-- 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d6cad50..0c3c394 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Changelog +## v0.4.2 (2023-01-30) + +- [BUGFIX] change field Thumb to InputFile type + ## v0.4.1 (2023-01-19) - add func `EscapeMarkdownUnescaped` for escape only unescaped symbols diff --git a/methods_params.go b/methods_params.go index 3d39b82..800918b 100644 --- a/methods_params.go +++ b/methods_params.go @@ -81,7 +81,7 @@ type SendAudioParams struct { Duration int `json:"duration,omitempty"` Performer string `json:"performer,omitempty"` Title string `json:"title,omitempty"` - Thumb string `json:"thumb,omitempty"` + Thumb models.InputFile `json:"thumb,omitempty"` DisableNotification bool `json:"disable_notification,omitempty"` ProtectContent bool `json:"protect_content,omitempty"` ReplyToMessageID int `json:"reply_to_message_id,omitempty"` @@ -93,7 +93,7 @@ type SendDocumentParams struct { ChatID any `json:"chat_id"` MessageThreadID int `json:"message_thread_id,omitempty"` Document models.InputFile `json:"document"` - Thumb string `json:"thumb,omitempty"` + Thumb models.InputFile `json:"thumb,omitempty"` Caption string `json:"caption,omitempty"` ParseMode models.ParseMode `json:"parse_mode,omitempty"` CaptionEntities []models.MessageEntity `json:"caption_entities,omitempty"` @@ -112,7 +112,7 @@ type SendVideoParams struct { Duration int `json:"duration,omitempty"` Width int `json:"width,omitempty"` Height int `json:"height,omitempty"` - Thumb string `json:"thumb,omitempty"` + Thumb models.InputFile `json:"thumb,omitempty"` Caption string `json:"caption,omitempty"` ParseMode models.ParseMode `json:"parse_mode,omitempty"` CaptionEntities []models.MessageEntity `json:"caption_entities,omitempty"` @@ -132,7 +132,7 @@ type SendAnimationParams struct { Duration int `json:"duration,omitempty"` Width int `json:"width,omitempty"` Height int `json:"height,omitempty"` - Thumb string `json:"thumb,omitempty"` + Thumb models.InputFile `json:"thumb,omitempty"` Caption string `json:"caption,omitempty"` ParseMode models.ParseMode `json:"parse_mode,omitempty"` CaptionEntities []models.MessageEntity `json:"caption_entities,omitempty"` @@ -165,7 +165,7 @@ type SendVideoNoteParams struct { VideoNote models.InputFile `json:"video_note"` Duration int `json:"duration,omitempty"` Length int `json:"length,omitempty"` - Thumb string `json:"thumb,omitempty"` + Thumb models.InputFile `json:"thumb,omitempty"` DisableNotification bool `json:"disable_notification,omitempty"` ProtectContent bool `json:"protect_content,omitempty"` ReplyToMessageID int `json:"reply_to_message_id,omitempty"` diff --git a/methods_test.go b/methods_test.go index 6722d1d..7042bd3 100644 --- a/methods_test.go +++ b/methods_test.go @@ -230,11 +230,11 @@ func TestBot_Methods(t *testing.T) { t.Run("SendVideoNote", func(t *testing.T) { c := &httpClient{t: t, resp: `{"text":"bar"}`, reqFields: map[string]string{ - "thumb": "foo", + "thumb": `{"Data":"foo"}`, }} b := &Bot{client: c} resp, err := b.SendVideoNote(context.Background(), &SendVideoNoteParams{ - Thumb: "foo", + Thumb: models.InputFileString{Data: "foo"}, }) assertNoErr(t, err) assertEqualString(t, "bar", resp.Text)