(new): Bot API 10.0
(doc): Since: Bot API X.Y annotations across all tgapi types and methods
This commit is contained in:
+71
-17
@@ -3,6 +3,7 @@ package tgapi
|
||||
import "context"
|
||||
|
||||
// UploadPhoto holds parameters for uploading a photo using the Uploader.
|
||||
// Since: Bot API 1.0
|
||||
// See https://core.telegram.org/bots/api#sendphoto
|
||||
type UploadPhoto struct {
|
||||
BusinessConnectionID string `json:"business_connection_id,omitempty"`
|
||||
@@ -27,6 +28,7 @@ type UploadPhoto struct {
|
||||
}
|
||||
|
||||
// SendPhoto uploads a photo via multipart and sends it as a message.
|
||||
// Since: Bot API 1.0
|
||||
// file is the photo file to upload.
|
||||
// See https://core.telegram.org/bots/api#sendphoto
|
||||
func (u *Uploader) SendPhoto(params UploadPhoto, file UploaderFile) (Message, error) {
|
||||
@@ -35,8 +37,7 @@ func (u *Uploader) SendPhoto(params UploadPhoto, file UploaderFile) (Message, er
|
||||
}
|
||||
|
||||
// SendPhotoWithContext is the context-aware variant of SendPhoto.
|
||||
// It executes the same request but uses ctx for cancellation and deadlines.
|
||||
// SendPhotoWithContext is the context-aware variant of SendPhoto.
|
||||
// Since: Bot API 1.0
|
||||
// It executes the same request but uses ctx for cancellation and deadlines.
|
||||
// See https://core.telegram.org/bots/api#sendphoto
|
||||
func (u *Uploader) SendPhotoWithContext(ctx context.Context, params UploadPhoto, file UploaderFile) (Message, error) {
|
||||
@@ -45,6 +46,7 @@ func (u *Uploader) SendPhotoWithContext(ctx context.Context, params UploadPhoto,
|
||||
}
|
||||
|
||||
// UploadAudio holds parameters for uploading an audio file using the Uploader.
|
||||
// Since: Bot API 1.2
|
||||
// See https://core.telegram.org/bots/api#sendaudio
|
||||
type UploadAudio struct {
|
||||
BusinessConnectionID string `json:"business_connection_id,omitempty"`
|
||||
@@ -71,6 +73,7 @@ type UploadAudio struct {
|
||||
}
|
||||
|
||||
// SendAudio uploads an audio file via multipart and sends it as a message.
|
||||
// Since: Bot API 1.2
|
||||
// files are the audio file(s) to upload (typically one file).
|
||||
// See https://core.telegram.org/bots/api#sendaudio
|
||||
func (u *Uploader) SendAudio(params UploadAudio, files ...UploaderFile) (Message, error) {
|
||||
@@ -79,8 +82,7 @@ func (u *Uploader) SendAudio(params UploadAudio, files ...UploaderFile) (Message
|
||||
}
|
||||
|
||||
// SendAudioWithContext is the context-aware variant of SendAudio.
|
||||
// It executes the same request but uses ctx for cancellation and deadlines.
|
||||
// SendAudioWithContext is the context-aware variant of SendAudio.
|
||||
// Since: Bot API 1.2
|
||||
// It executes the same request but uses ctx for cancellation and deadlines.
|
||||
// See https://core.telegram.org/bots/api#sendaudio
|
||||
func (u *Uploader) SendAudioWithContext(ctx context.Context, params UploadAudio, files ...UploaderFile) (Message, error) {
|
||||
@@ -89,6 +91,7 @@ func (u *Uploader) SendAudioWithContext(ctx context.Context, params UploadAudio,
|
||||
}
|
||||
|
||||
// UploadDocument holds parameters for uploading a document using the Uploader.
|
||||
// Since: Bot API 1.0
|
||||
// See https://core.telegram.org/bots/api#senddocument
|
||||
type UploadDocument struct {
|
||||
BusinessConnectionID string `json:"business_connection_id,omitempty"`
|
||||
@@ -112,6 +115,7 @@ type UploadDocument struct {
|
||||
}
|
||||
|
||||
// SendDocument uploads a document via multipart and sends it as a message.
|
||||
// Since: Bot API 1.0
|
||||
// files are the document file(s) to upload (typically one file).
|
||||
// See https://core.telegram.org/bots/api#senddocument
|
||||
func (u *Uploader) SendDocument(params UploadDocument, files ...UploaderFile) (Message, error) {
|
||||
@@ -120,8 +124,7 @@ func (u *Uploader) SendDocument(params UploadDocument, files ...UploaderFile) (M
|
||||
}
|
||||
|
||||
// SendDocumentWithContext is the context-aware variant of SendDocument.
|
||||
// It executes the same request but uses ctx for cancellation and deadlines.
|
||||
// SendDocumentWithContext is the context-aware variant of SendDocument.
|
||||
// Since: Bot API 1.0
|
||||
// It executes the same request but uses ctx for cancellation and deadlines.
|
||||
// See https://core.telegram.org/bots/api#senddocument
|
||||
func (u *Uploader) SendDocumentWithContext(ctx context.Context, params UploadDocument, files ...UploaderFile) (Message, error) {
|
||||
@@ -130,6 +133,7 @@ func (u *Uploader) SendDocumentWithContext(ctx context.Context, params UploadDoc
|
||||
}
|
||||
|
||||
// UploadVideo holds parameters for uploading a video using the Uploader.
|
||||
// Since: Bot API 1.0
|
||||
// See https://core.telegram.org/bots/api#sendvideo
|
||||
type UploadVideo struct {
|
||||
BusinessConnectionID string `json:"business_connection_id,omitempty"`
|
||||
@@ -160,6 +164,7 @@ type UploadVideo struct {
|
||||
}
|
||||
|
||||
// SendVideo uploads a video via multipart and sends it as a message.
|
||||
// Since: Bot API 1.0
|
||||
// files are the video file(s) to upload (typically one file).
|
||||
// See https://core.telegram.org/bots/api#sendvideo
|
||||
func (u *Uploader) SendVideo(params UploadVideo, files ...UploaderFile) (Message, error) {
|
||||
@@ -168,8 +173,7 @@ func (u *Uploader) SendVideo(params UploadVideo, files ...UploaderFile) (Message
|
||||
}
|
||||
|
||||
// SendVideoWithContext is the context-aware variant of SendVideo.
|
||||
// It executes the same request but uses ctx for cancellation and deadlines.
|
||||
// SendVideoWithContext is the context-aware variant of SendVideo.
|
||||
// Since: Bot API 1.0
|
||||
// It executes the same request but uses ctx for cancellation and deadlines.
|
||||
// See https://core.telegram.org/bots/api#sendvideo
|
||||
func (u *Uploader) SendVideoWithContext(ctx context.Context, params UploadVideo, files ...UploaderFile) (Message, error) {
|
||||
@@ -178,6 +182,7 @@ func (u *Uploader) SendVideoWithContext(ctx context.Context, params UploadVideo,
|
||||
}
|
||||
|
||||
// UploadAnimation holds parameters for uploading an animation using the Uploader.
|
||||
// Since: Bot API 4.0
|
||||
// See https://core.telegram.org/bots/api#sendanimation
|
||||
type UploadAnimation struct {
|
||||
BusinessConnectionID string `json:"business_connection_id,omitempty"`
|
||||
@@ -206,6 +211,7 @@ type UploadAnimation struct {
|
||||
}
|
||||
|
||||
// SendAnimation uploads an animation via multipart and sends it as a message.
|
||||
// Since: Bot API 4.0
|
||||
// files are the animation file(s) to upload (typically one file).
|
||||
// See https://core.telegram.org/bots/api#sendanimation
|
||||
func (u *Uploader) SendAnimation(params UploadAnimation, files ...UploaderFile) (Message, error) {
|
||||
@@ -214,8 +220,7 @@ func (u *Uploader) SendAnimation(params UploadAnimation, files ...UploaderFile)
|
||||
}
|
||||
|
||||
// SendAnimationWithContext is the context-aware variant of SendAnimation.
|
||||
// It executes the same request but uses ctx for cancellation and deadlines.
|
||||
// SendAnimationWithContext is the context-aware variant of SendAnimation.
|
||||
// Since: Bot API 4.0
|
||||
// It executes the same request but uses ctx for cancellation and deadlines.
|
||||
// See https://core.telegram.org/bots/api#sendanimation
|
||||
func (u *Uploader) SendAnimationWithContext(ctx context.Context, params UploadAnimation, files ...UploaderFile) (Message, error) {
|
||||
@@ -224,6 +229,7 @@ func (u *Uploader) SendAnimationWithContext(ctx context.Context, params UploadAn
|
||||
}
|
||||
|
||||
// UploadVoice holds parameters for uploading a voice note using the Uploader.
|
||||
// Since: Bot API 1.2
|
||||
// See https://core.telegram.org/bots/api#sendvoice
|
||||
type UploadVoice struct {
|
||||
BusinessConnectionID string `json:"business_connection_id,omitempty"`
|
||||
@@ -247,6 +253,7 @@ type UploadVoice struct {
|
||||
}
|
||||
|
||||
// SendVoice uploads a voice note via multipart and sends it as a message.
|
||||
// Since: Bot API 1.2
|
||||
// files are the voice file(s) to upload (typically one file).
|
||||
// See https://core.telegram.org/bots/api#sendvoice
|
||||
func (u *Uploader) SendVoice(params UploadVoice, files ...UploaderFile) (Message, error) {
|
||||
@@ -255,8 +262,7 @@ func (u *Uploader) SendVoice(params UploadVoice, files ...UploaderFile) (Message
|
||||
}
|
||||
|
||||
// SendVoiceWithContext is the context-aware variant of SendVoice.
|
||||
// It executes the same request but uses ctx for cancellation and deadlines.
|
||||
// SendVoiceWithContext is the context-aware variant of SendVoice.
|
||||
// Since: Bot API 1.2
|
||||
// It executes the same request but uses ctx for cancellation and deadlines.
|
||||
// See https://core.telegram.org/bots/api#sendvoice
|
||||
func (u *Uploader) SendVoiceWithContext(ctx context.Context, params UploadVoice, files ...UploaderFile) (Message, error) {
|
||||
@@ -265,6 +271,7 @@ func (u *Uploader) SendVoiceWithContext(ctx context.Context, params UploadVoice,
|
||||
}
|
||||
|
||||
// UploadVideoNote holds parameters for uploading a video note (rounded video) using the Uploader.
|
||||
// Since: Bot API 3.0
|
||||
// See https://core.telegram.org/bots/api#sendvideonote
|
||||
type UploadVideoNote struct {
|
||||
BusinessConnectionID string `json:"business_connection_id,omitempty"`
|
||||
@@ -286,6 +293,7 @@ type UploadVideoNote struct {
|
||||
}
|
||||
|
||||
// SendVideoNote uploads a video note via multipart and sends it as a message.
|
||||
// Since: Bot API 3.0
|
||||
// files are the video note file(s) to upload (typically one file).
|
||||
// See https://core.telegram.org/bots/api#sendvideonote
|
||||
func (u *Uploader) SendVideoNote(params UploadVideoNote, files ...UploaderFile) (Message, error) {
|
||||
@@ -294,8 +302,7 @@ func (u *Uploader) SendVideoNote(params UploadVideoNote, files ...UploaderFile)
|
||||
}
|
||||
|
||||
// SendVideoNoteWithContext is the context-aware variant of SendVideoNote.
|
||||
// It executes the same request but uses ctx for cancellation and deadlines.
|
||||
// SendVideoNoteWithContext is the context-aware variant of SendVideoNote.
|
||||
// Since: Bot API 3.0
|
||||
// It executes the same request but uses ctx for cancellation and deadlines.
|
||||
// See https://core.telegram.org/bots/api#sendvideonote
|
||||
func (u *Uploader) SendVideoNoteWithContext(ctx context.Context, params UploadVideoNote, files ...UploaderFile) (Message, error) {
|
||||
@@ -304,12 +311,14 @@ func (u *Uploader) SendVideoNoteWithContext(ctx context.Context, params UploadVi
|
||||
}
|
||||
|
||||
// UploadChatPhoto holds parameters for uploading a chat photo using the Uploader.
|
||||
// Since: Bot API 3.1
|
||||
// See https://core.telegram.org/bots/api#setchatphoto
|
||||
type UploadChatPhoto struct {
|
||||
ChatID int64 `json:"chat_id"`
|
||||
}
|
||||
|
||||
// SetChatPhoto uploads a new chat photo.
|
||||
// Since: Bot API 3.1
|
||||
// photo is the photo file to upload.
|
||||
// See https://core.telegram.org/bots/api#setchatphoto
|
||||
func (u *Uploader) SetChatPhoto(params UploadChatPhoto, photo UploaderFile) (bool, error) {
|
||||
@@ -318,8 +327,7 @@ func (u *Uploader) SetChatPhoto(params UploadChatPhoto, photo UploaderFile) (boo
|
||||
}
|
||||
|
||||
// SetChatPhotoWithContext is the context-aware variant of SetChatPhoto.
|
||||
// It executes the same request but uses ctx for cancellation and deadlines.
|
||||
// SetChatPhotoWithContext is the context-aware variant of SetChatPhoto.
|
||||
// Since: Bot API 3.1
|
||||
// It executes the same request but uses ctx for cancellation and deadlines.
|
||||
// See https://core.telegram.org/bots/api#setchatphoto
|
||||
func (u *Uploader) SetChatPhotoWithContext(ctx context.Context, params UploadChatPhoto, photo UploaderFile) (bool, error) {
|
||||
@@ -328,6 +336,7 @@ func (u *Uploader) SetChatPhotoWithContext(ctx context.Context, params UploadCha
|
||||
}
|
||||
|
||||
// UploadSetWebhook holds multipart parameters for the setWebhook method.
|
||||
// Since: Bot API 1.0
|
||||
// Use this type when uploading a self-signed certificate file.
|
||||
// See https://core.telegram.org/bots/api#setwebhook
|
||||
type UploadSetWebhook struct {
|
||||
@@ -340,7 +349,8 @@ type UploadSetWebhook struct {
|
||||
}
|
||||
|
||||
// SetWebhook uploads a certificate and sets a webhook URL.
|
||||
// certificate maps to the multipart field \"certificate\".
|
||||
// Since: Bot API 1.0
|
||||
// certificate maps to the multipart field "certificate".
|
||||
// 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))
|
||||
@@ -348,9 +358,53 @@ func (u *Uploader) SetWebhook(params UploadSetWebhook, certificate UploaderFile)
|
||||
}
|
||||
|
||||
// SetWebhookWithContext is the context-aware variant of SetWebhook.
|
||||
// Since: Bot API 1.0
|
||||
// It executes the same request but uses ctx for cancellation and deadlines.
|
||||
// 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)
|
||||
}
|
||||
|
||||
// UploadLivePhoto holds parameters for uploading a live photo using the Uploader.
|
||||
// Since: Bot API 10.0
|
||||
// See https://core.telegram.org/bots/api#sendlivephoto
|
||||
type UploadLivePhoto struct {
|
||||
BusinessConnectionID string `json:"business_connection_id,omitempty"`
|
||||
ChatID int64 `json:"chat_id"`
|
||||
MessageThreadID int `json:"message_thread_id,omitempty"`
|
||||
DirectMessagesTopicID int `json:"direct_messages_topic_id,omitempty"`
|
||||
|
||||
Caption string `json:"caption,omitempty"`
|
||||
ParseMode ParseMode `json:"parse_mode,omitempty"`
|
||||
CaptionEntities []MessageEntity `json:"caption_entities,omitempty"`
|
||||
|
||||
ShowCaptionAboveMedia bool `json:"show_caption_above_media,omitempty"`
|
||||
HasSpoiler bool `json:"has_spoiler,omitempty"`
|
||||
DisableNotification bool `json:"disable_notification,omitempty"`
|
||||
ProtectContent bool `json:"protect_content,omitempty"`
|
||||
AllowPaidBroadcast bool `json:"allow_paid_broadcast,omitempty"`
|
||||
MessageEffectID string `json:"message_effect_id,omitempty"`
|
||||
|
||||
SuggestedPostParameters *SuggestedPostParameters `json:"suggested_post_parameters,omitempty"`
|
||||
ReplyParameters *ReplyParameters `json:"reply_parameters,omitempty"`
|
||||
ReplyMarkup *ReplyMarkup `json:"reply_markup,omitempty"`
|
||||
}
|
||||
|
||||
// SendLivePhoto uploads a live photo via multipart and sends it as a message.
|
||||
// Since: Bot API 10.0
|
||||
// file is the live photo file to upload.
|
||||
// See https://core.telegram.org/bots/api#sendlivephoto
|
||||
func (u *Uploader) SendLivePhoto(params UploadLivePhoto, file UploaderFile) (Message, error) {
|
||||
req := NewUploaderRequestWithChatID[Message]("sendLivePhoto", params, params.ChatID, file.SetType(UploaderLivePhotoType))
|
||||
return req.Do(u)
|
||||
}
|
||||
|
||||
// SendLivePhotoWithContext is the context-aware variant of SendLivePhoto.
|
||||
// Since: Bot API 10.0
|
||||
// It executes the same request but uses ctx for cancellation and deadlines.
|
||||
// See https://core.telegram.org/bots/api#sendlivephoto
|
||||
func (u *Uploader) SendLivePhotoWithContext(ctx context.Context, params UploadLivePhoto, file UploaderFile) (Message, error) {
|
||||
req := NewUploaderRequestWithChatID[Message]("sendLivePhoto", params, params.ChatID, file.SetType(UploaderLivePhotoType))
|
||||
return req.DoWithContext(ctx, u)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user