(fix): finalize v2 contracts (tests): cover v2 migration (doc): prepare release guidance
This commit is contained in:
+56
-54
@@ -8,7 +8,7 @@ import "context"
|
||||
// Since: Bot API 10.2
|
||||
func (u *Uploader) SendRichMessage(params SendRichMessage, files ...UploaderFile) (Message, error) {
|
||||
req := NewUploaderRequestWithChatID[Message]("sendRichMessage", params, params.ChatID, files...)
|
||||
return req.Do(u)
|
||||
return u.Do(req)
|
||||
}
|
||||
|
||||
// SendRichMessageWithContext uploads files referenced by attach:// names in params.RichMessage
|
||||
@@ -17,7 +17,25 @@ func (u *Uploader) SendRichMessage(params SendRichMessage, files ...UploaderFile
|
||||
// Since: Bot API 10.2
|
||||
func (u *Uploader) SendRichMessageWithContext(ctx context.Context, params SendRichMessage, files ...UploaderFile) (Message, error) {
|
||||
req := NewUploaderRequestWithChatID[Message]("sendRichMessage", params, params.ChatID, files...)
|
||||
return req.DoWithContext(ctx, u)
|
||||
return u.DoWithContext(ctx, req)
|
||||
}
|
||||
|
||||
// EditEphemeralMessageMedia edits ephemeral media and uploads files referenced through attach:// names.
|
||||
//
|
||||
// Since: Bot API 10.3
|
||||
func (u *Uploader) EditEphemeralMessageMedia(params EditEphemeralMessageMedia, files ...UploaderFile) (bool, error) {
|
||||
req := NewUploaderRequestWithChatID[bool]("editEphemeralMessageMedia", params, params.ChatID, files...)
|
||||
return u.Do(req)
|
||||
}
|
||||
|
||||
// EditEphemeralMessageMediaWithContext is the context-aware variant of EditEphemeralMessageMedia.
|
||||
//
|
||||
// Since: Bot API 10.3
|
||||
func (u *Uploader) EditEphemeralMessageMediaWithContext(
|
||||
ctx context.Context, params EditEphemeralMessageMedia, files ...UploaderFile,
|
||||
) (bool, error) {
|
||||
req := NewUploaderRequestWithChatID[bool]("editEphemeralMessageMedia", params, params.ChatID, files...)
|
||||
return u.DoWithContext(ctx, req)
|
||||
}
|
||||
|
||||
// SendRichMessageDraft streams a rich-message draft without direct file uploads.
|
||||
@@ -57,10 +75,8 @@ type UploadPhoto struct {
|
||||
// DirectMessagesTopicID Optional. Identifier of the direct messages topic to which the message will be
|
||||
// sent; required if the message is sent to a direct messages chat
|
||||
DirectMessagesTopicID int `json:"direct_messages_topic_id,omitempty"`
|
||||
// ReceiverUserID identifies the user who can see the ephemeral message.
|
||||
ReceiverUserID int64 `json:"receiver_user_id,omitempty"` // Since: Bot API 10.2
|
||||
// CallbackQueryID identifies the callback query that triggered an ephemeral response.
|
||||
CallbackQueryID string `json:"callback_query_id,omitempty"` // Since: Bot API 10.2
|
||||
// EphemeralMessageParameters configures an ephemeral response.
|
||||
EphemeralMessageParameters *EphemeralMessageParameters `json:"ephemeral_message_parameters,omitempty"` // Since: Bot API 10.3
|
||||
|
||||
// Caption Optional. Photo caption (may also be used when resending photos by file_id), 0-1024 characters
|
||||
// after entities parsing
|
||||
@@ -106,7 +122,7 @@ type UploadPhoto struct {
|
||||
// See https://core.telegram.org/bots/api#sendphoto
|
||||
func (u *Uploader) SendPhoto(params UploadPhoto, file UploaderFile) (Message, error) {
|
||||
req := NewUploaderRequestWithChatID[Message]("sendPhoto", params, params.ChatID, file)
|
||||
return req.Do(u)
|
||||
return u.Do(req)
|
||||
}
|
||||
|
||||
// SendPhotoWithContext is the context-aware variant of SendPhoto.
|
||||
@@ -115,7 +131,7 @@ func (u *Uploader) SendPhoto(params UploadPhoto, file UploaderFile) (Message, er
|
||||
// See https://core.telegram.org/bots/api#sendphoto
|
||||
func (u *Uploader) SendPhotoWithContext(ctx context.Context, params UploadPhoto, file UploaderFile) (Message, error) {
|
||||
req := NewUploaderRequestWithChatID[Message]("sendPhoto", params, params.ChatID, file)
|
||||
return req.DoWithContext(ctx, u)
|
||||
return u.DoWithContext(ctx, req)
|
||||
}
|
||||
|
||||
// UploadAudio holds parameters for uploading an audio file using the Uploader.
|
||||
@@ -134,10 +150,8 @@ type UploadAudio struct {
|
||||
// DirectMessagesTopicID Optional. Identifier of the direct messages topic to which the message will be
|
||||
// sent; required if the message is sent to a direct messages chat
|
||||
DirectMessagesTopicID int `json:"direct_messages_topic_id,omitempty"`
|
||||
// ReceiverUserID identifies the user who can see the ephemeral message.
|
||||
ReceiverUserID int64 `json:"receiver_user_id,omitempty"` // Since: Bot API 10.2
|
||||
// CallbackQueryID identifies the callback query that triggered an ephemeral response.
|
||||
CallbackQueryID string `json:"callback_query_id,omitempty"` // Since: Bot API 10.2
|
||||
// EphemeralMessageParameters configures an ephemeral response.
|
||||
EphemeralMessageParameters *EphemeralMessageParameters `json:"ephemeral_message_parameters,omitempty"` // Since: Bot API 10.3
|
||||
|
||||
// Caption Optional. Audio caption, 0-1024 characters after entities parsing
|
||||
Caption string `json:"caption,omitempty"`
|
||||
@@ -185,7 +199,7 @@ type UploadAudio struct {
|
||||
// See https://core.telegram.org/bots/api#sendaudio
|
||||
func (u *Uploader) SendAudio(params UploadAudio, files ...UploaderFile) (Message, error) {
|
||||
req := NewUploaderRequestWithChatID[Message]("sendAudio", params, params.ChatID, files...)
|
||||
return req.Do(u)
|
||||
return u.Do(req)
|
||||
}
|
||||
|
||||
// SendAudioWithContext is the context-aware variant of SendAudio.
|
||||
@@ -194,7 +208,7 @@ func (u *Uploader) SendAudio(params UploadAudio, files ...UploaderFile) (Message
|
||||
// See https://core.telegram.org/bots/api#sendaudio
|
||||
func (u *Uploader) SendAudioWithContext(ctx context.Context, params UploadAudio, files ...UploaderFile) (Message, error) {
|
||||
req := NewUploaderRequestWithChatID[Message]("sendAudio", params, params.ChatID, files...)
|
||||
return req.DoWithContext(ctx, u)
|
||||
return u.DoWithContext(ctx, req)
|
||||
}
|
||||
|
||||
// UploadDocument holds parameters for uploading a document using the Uploader.
|
||||
@@ -213,10 +227,8 @@ type UploadDocument struct {
|
||||
// DirectMessagesTopicID Optional. Identifier of the direct messages topic to which the message will be
|
||||
// sent; required if the message is sent to a direct messages chat
|
||||
DirectMessagesTopicID int `json:"direct_messages_topic_id,omitempty"`
|
||||
// ReceiverUserID identifies the user who can see the ephemeral message.
|
||||
ReceiverUserID int64 `json:"receiver_user_id,omitempty"` // Since: Bot API 10.2
|
||||
// CallbackQueryID identifies the callback query that triggered an ephemeral response.
|
||||
CallbackQueryID string `json:"callback_query_id,omitempty"` // Since: Bot API 10.2
|
||||
// EphemeralMessageParameters configures an ephemeral response.
|
||||
EphemeralMessageParameters *EphemeralMessageParameters `json:"ephemeral_message_parameters,omitempty"` // Since: Bot API 10.3
|
||||
|
||||
// Caption Optional. Document caption (may also be used when resending documents by file_id), 0-1024
|
||||
// characters after entities parsing
|
||||
@@ -261,7 +273,7 @@ type UploadDocument struct {
|
||||
// See https://core.telegram.org/bots/api#senddocument
|
||||
func (u *Uploader) SendDocument(params UploadDocument, files ...UploaderFile) (Message, error) {
|
||||
req := NewUploaderRequestWithChatID[Message]("sendDocument", params, params.ChatID, files...)
|
||||
return req.Do(u)
|
||||
return u.Do(req)
|
||||
}
|
||||
|
||||
// SendDocumentWithContext is the context-aware variant of SendDocument.
|
||||
@@ -270,7 +282,7 @@ func (u *Uploader) SendDocument(params UploadDocument, files ...UploaderFile) (M
|
||||
// See https://core.telegram.org/bots/api#senddocument
|
||||
func (u *Uploader) SendDocumentWithContext(ctx context.Context, params UploadDocument, files ...UploaderFile) (Message, error) {
|
||||
req := NewUploaderRequestWithChatID[Message]("sendDocument", params, params.ChatID, files...)
|
||||
return req.DoWithContext(ctx, u)
|
||||
return u.DoWithContext(ctx, req)
|
||||
}
|
||||
|
||||
// UploadVideo holds parameters for uploading a video using the Uploader.
|
||||
@@ -289,10 +301,8 @@ type UploadVideo struct {
|
||||
// DirectMessagesTopicID Optional. Identifier of the direct messages topic to which the message will be
|
||||
// sent; required if the message is sent to a direct messages chat
|
||||
DirectMessagesTopicID int `json:"direct_messages_topic_id,omitempty"`
|
||||
// ReceiverUserID identifies the user who can see the ephemeral message.
|
||||
ReceiverUserID int64 `json:"receiver_user_id,omitempty"` // Since: Bot API 10.2
|
||||
// CallbackQueryID identifies the callback query that triggered an ephemeral response.
|
||||
CallbackQueryID string `json:"callback_query_id,omitempty"` // Since: Bot API 10.2
|
||||
// EphemeralMessageParameters configures an ephemeral response.
|
||||
EphemeralMessageParameters *EphemeralMessageParameters `json:"ephemeral_message_parameters,omitempty"` // Since: Bot API 10.3
|
||||
|
||||
// Duration Optional. Duration of sent video in seconds
|
||||
Duration int `json:"duration,omitempty"`
|
||||
@@ -349,7 +359,7 @@ type UploadVideo struct {
|
||||
// See https://core.telegram.org/bots/api#sendvideo
|
||||
func (u *Uploader) SendVideo(params UploadVideo, files ...UploaderFile) (Message, error) {
|
||||
req := NewUploaderRequestWithChatID[Message]("sendVideo", params, params.ChatID, files...)
|
||||
return req.Do(u)
|
||||
return u.Do(req)
|
||||
}
|
||||
|
||||
// SendVideoWithContext is the context-aware variant of SendVideo.
|
||||
@@ -358,7 +368,7 @@ func (u *Uploader) SendVideo(params UploadVideo, files ...UploaderFile) (Message
|
||||
// See https://core.telegram.org/bots/api#sendvideo
|
||||
func (u *Uploader) SendVideoWithContext(ctx context.Context, params UploadVideo, files ...UploaderFile) (Message, error) {
|
||||
req := NewUploaderRequestWithChatID[Message]("sendVideo", params, params.ChatID, files...)
|
||||
return req.DoWithContext(ctx, u)
|
||||
return u.DoWithContext(ctx, req)
|
||||
}
|
||||
|
||||
// UploadAnimation holds parameters for uploading an animation using the Uploader.
|
||||
@@ -377,10 +387,8 @@ type UploadAnimation struct {
|
||||
// DirectMessagesTopicID Optional. Identifier of the direct messages topic to which the message will be
|
||||
// sent; required if the message is sent to a direct messages chat
|
||||
DirectMessagesTopicID int `json:"direct_messages_topic_id,omitempty"`
|
||||
// ReceiverUserID identifies the user who can see the ephemeral message.
|
||||
ReceiverUserID int64 `json:"receiver_user_id,omitempty"` // Since: Bot API 10.2
|
||||
// CallbackQueryID identifies the callback query that triggered an ephemeral response.
|
||||
CallbackQueryID string `json:"callback_query_id,omitempty"` // Since: Bot API 10.2
|
||||
// EphemeralMessageParameters configures an ephemeral response.
|
||||
EphemeralMessageParameters *EphemeralMessageParameters `json:"ephemeral_message_parameters,omitempty"` // Since: Bot API 10.3
|
||||
|
||||
// Duration Optional. Duration of sent animation in seconds
|
||||
Duration int `json:"duration,omitempty"`
|
||||
@@ -433,7 +441,7 @@ type UploadAnimation struct {
|
||||
// See https://core.telegram.org/bots/api#sendanimation
|
||||
func (u *Uploader) SendAnimation(params UploadAnimation, files ...UploaderFile) (Message, error) {
|
||||
req := NewUploaderRequestWithChatID[Message]("sendAnimation", params, params.ChatID, files...)
|
||||
return req.Do(u)
|
||||
return u.Do(req)
|
||||
}
|
||||
|
||||
// SendAnimationWithContext is the context-aware variant of SendAnimation.
|
||||
@@ -442,7 +450,7 @@ func (u *Uploader) SendAnimation(params UploadAnimation, files ...UploaderFile)
|
||||
// See https://core.telegram.org/bots/api#sendanimation
|
||||
func (u *Uploader) SendAnimationWithContext(ctx context.Context, params UploadAnimation, files ...UploaderFile) (Message, error) {
|
||||
req := NewUploaderRequestWithChatID[Message]("sendAnimation", params, params.ChatID, files...)
|
||||
return req.DoWithContext(ctx, u)
|
||||
return u.DoWithContext(ctx, req)
|
||||
}
|
||||
|
||||
// UploadVoice holds parameters for uploading a voice note using the Uploader.
|
||||
@@ -461,10 +469,8 @@ type UploadVoice struct {
|
||||
// DirectMessagesTopicID Optional. Identifier of the direct messages topic to which the message will be
|
||||
// sent; required if the message is sent to a direct messages chat
|
||||
DirectMessagesTopicID int `json:"direct_messages_topic_id,omitempty"`
|
||||
// ReceiverUserID identifies the user who can see the ephemeral message.
|
||||
ReceiverUserID int64 `json:"receiver_user_id,omitempty"` // Since: Bot API 10.2
|
||||
// CallbackQueryID identifies the callback query that triggered an ephemeral response.
|
||||
CallbackQueryID string `json:"callback_query_id,omitempty"` // Since: Bot API 10.2
|
||||
// EphemeralMessageParameters configures an ephemeral response.
|
||||
EphemeralMessageParameters *EphemeralMessageParameters `json:"ephemeral_message_parameters,omitempty"` // Since: Bot API 10.3
|
||||
|
||||
// Caption Optional. Voice message caption, 0-1024 characters after entities parsing
|
||||
Caption string `json:"caption,omitempty"`
|
||||
@@ -507,7 +513,7 @@ type UploadVoice struct {
|
||||
// See https://core.telegram.org/bots/api#sendvoice
|
||||
func (u *Uploader) SendVoice(params UploadVoice, files ...UploaderFile) (Message, error) {
|
||||
req := NewUploaderRequestWithChatID[Message]("sendVoice", params, params.ChatID, files...)
|
||||
return req.Do(u)
|
||||
return u.Do(req)
|
||||
}
|
||||
|
||||
// SendVoiceWithContext is the context-aware variant of SendVoice.
|
||||
@@ -516,7 +522,7 @@ func (u *Uploader) SendVoice(params UploadVoice, files ...UploaderFile) (Message
|
||||
// See https://core.telegram.org/bots/api#sendvoice
|
||||
func (u *Uploader) SendVoiceWithContext(ctx context.Context, params UploadVoice, files ...UploaderFile) (Message, error) {
|
||||
req := NewUploaderRequestWithChatID[Message]("sendVoice", params, params.ChatID, files...)
|
||||
return req.DoWithContext(ctx, u)
|
||||
return u.DoWithContext(ctx, req)
|
||||
}
|
||||
|
||||
// UploadVideoNote holds parameters for uploading a video note (rounded video) using the Uploader.
|
||||
@@ -535,10 +541,8 @@ type UploadVideoNote struct {
|
||||
// DirectMessagesTopicID Optional. Identifier of the direct messages topic to which the message will be
|
||||
// sent; required if the message is sent to a direct messages chat
|
||||
DirectMessagesTopicID int `json:"direct_messages_topic_id,omitempty"`
|
||||
// ReceiverUserID identifies the user who can see the ephemeral message.
|
||||
ReceiverUserID int64 `json:"receiver_user_id,omitempty"` // Since: Bot API 10.2
|
||||
// CallbackQueryID identifies the callback query that triggered an ephemeral response.
|
||||
CallbackQueryID string `json:"callback_query_id,omitempty"` // Since: Bot API 10.2
|
||||
// EphemeralMessageParameters configures an ephemeral response.
|
||||
EphemeralMessageParameters *EphemeralMessageParameters `json:"ephemeral_message_parameters,omitempty"` // Since: Bot API 10.3
|
||||
|
||||
// Duration Optional. Duration of sent video in seconds
|
||||
Duration int `json:"duration,omitempty"`
|
||||
@@ -575,7 +579,7 @@ type UploadVideoNote struct {
|
||||
// See https://core.telegram.org/bots/api#sendvideonote
|
||||
func (u *Uploader) SendVideoNote(params UploadVideoNote, files ...UploaderFile) (Message, error) {
|
||||
req := NewUploaderRequestWithChatID[Message]("sendVideoNote", params, params.ChatID, files...)
|
||||
return req.Do(u)
|
||||
return u.Do(req)
|
||||
}
|
||||
|
||||
// SendVideoNoteWithContext is the context-aware variant of SendVideoNote.
|
||||
@@ -584,7 +588,7 @@ func (u *Uploader) SendVideoNote(params UploadVideoNote, files ...UploaderFile)
|
||||
// See https://core.telegram.org/bots/api#sendvideonote
|
||||
func (u *Uploader) SendVideoNoteWithContext(ctx context.Context, params UploadVideoNote, files ...UploaderFile) (Message, error) {
|
||||
req := NewUploaderRequestWithChatID[Message]("sendVideoNote", params, params.ChatID, files...)
|
||||
return req.DoWithContext(ctx, u)
|
||||
return u.DoWithContext(ctx, req)
|
||||
}
|
||||
|
||||
// UploadChatPhoto holds parameters for uploading a chat photo using the Uploader.
|
||||
@@ -602,7 +606,7 @@ type UploadChatPhoto struct {
|
||||
// See https://core.telegram.org/bots/api#setchatphoto
|
||||
func (u *Uploader) SetChatPhoto(params UploadChatPhoto, photo UploaderFile) (bool, error) {
|
||||
req := NewUploaderRequestWithChatID[bool]("setChatPhoto", params, params.ChatID, photo)
|
||||
return req.Do(u)
|
||||
return u.Do(req)
|
||||
}
|
||||
|
||||
// SetChatPhotoWithContext is the context-aware variant of SetChatPhoto.
|
||||
@@ -611,7 +615,7 @@ func (u *Uploader) SetChatPhoto(params UploadChatPhoto, photo UploaderFile) (boo
|
||||
// See https://core.telegram.org/bots/api#setchatphoto
|
||||
func (u *Uploader) SetChatPhotoWithContext(ctx context.Context, params UploadChatPhoto, photo UploaderFile) (bool, error) {
|
||||
req := NewUploaderRequestWithChatID[bool]("setChatPhoto", params, params.ChatID, photo)
|
||||
return req.DoWithContext(ctx, u)
|
||||
return u.DoWithContext(ctx, req)
|
||||
}
|
||||
|
||||
// UploadSetWebhook holds multipart parameters for the setWebhook method.
|
||||
@@ -650,7 +654,7 @@ type UploadSetWebhook struct {
|
||||
// See https://core.telegram.org/bots/api#setwebhook
|
||||
func (u *Uploader) SetWebhook(params UploadSetWebhook, certificate UploaderFile) (bool, error) {
|
||||
req := NewUploaderRequest[bool]("setWebhook", params, certificate.SetType(UploaderCertificateType))
|
||||
return req.Do(u)
|
||||
return u.Do(req)
|
||||
}
|
||||
|
||||
// SetWebhookWithContext is the context-aware variant of SetWebhook.
|
||||
@@ -659,7 +663,7 @@ func (u *Uploader) SetWebhook(params UploadSetWebhook, certificate UploaderFile)
|
||||
// See https://core.telegram.org/bots/api#setwebhook
|
||||
func (u *Uploader) SetWebhookWithContext(ctx context.Context, params UploadSetWebhook, certificate UploaderFile) (bool, error) {
|
||||
req := NewUploaderRequest[bool]("setWebhook", params, certificate.SetType(UploaderCertificateType))
|
||||
return req.DoWithContext(ctx, u)
|
||||
return u.DoWithContext(ctx, req)
|
||||
}
|
||||
|
||||
// UploadLivePhoto holds parameters for uploading a live photo using the Uploader.
|
||||
@@ -679,10 +683,8 @@ type UploadLivePhoto struct {
|
||||
// sent; required if the message is sent to a direct messages chat
|
||||
DirectMessagesTopicID int `json:"direct_messages_topic_id,omitempty"`
|
||||
|
||||
// ReceiverUserID identifies the user who can see the ephemeral message.
|
||||
ReceiverUserID int64 `json:"receiver_user_id,omitempty"` // Since: Bot API 10.2
|
||||
// CallbackQueryID identifies the callback query that triggered an ephemeral response.
|
||||
CallbackQueryID string `json:"callback_query_id,omitempty"` // Since: Bot API 10.2
|
||||
// EphemeralMessageParameters configures an ephemeral response.
|
||||
EphemeralMessageParameters *EphemeralMessageParameters `json:"ephemeral_message_parameters,omitempty"` // Since: Bot API 10.3
|
||||
// Caption Optional. Video caption (may also be used when resending videos by file_id), 0-1024 characters
|
||||
// after entities parsing
|
||||
Caption string `json:"caption,omitempty"`
|
||||
@@ -731,7 +733,7 @@ func (u *Uploader) SendLivePhoto(params UploadLivePhoto, livePhoto, photo Upload
|
||||
livePhoto.SetType(UploaderLivePhotoType),
|
||||
photo.SetType(UploaderPhotoType),
|
||||
)
|
||||
return req.Do(u)
|
||||
return u.Do(req)
|
||||
}
|
||||
|
||||
// SendLivePhotoWithContext uploads a live-photo video and its static image via
|
||||
@@ -746,5 +748,5 @@ func (u *Uploader) SendLivePhotoWithContext(
|
||||
livePhoto.SetType(UploaderLivePhotoType),
|
||||
photo.SetType(UploaderPhotoType),
|
||||
)
|
||||
return req.DoWithContext(ctx, u)
|
||||
return u.DoWithContext(ctx, req)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user