(new): Bot API 10.0
Golang lint / lint (push) Successful in 2m53s
Golang lint / lint (pull_request) Successful in 2m54s

(doc): Since: Bot API X.Y annotations across all tgapi types and methods
This commit is contained in:
2026-05-19 13:42:10 +03:00
parent affb802a7b
commit 1e26d871b5
29 changed files with 1347 additions and 242 deletions
+38
View File
@@ -3,6 +3,7 @@ package tgapi
import "context"
// GetUserProfilePhotos holds parameters for the GetUserProfilePhotos method.
// Since: Bot API 1.4
// See https://core.telegram.org/bots/api#getuserprofilephotos
type GetUserProfilePhotos struct {
UserID int64 `json:"user_id"`
@@ -11,6 +12,7 @@ type GetUserProfilePhotos struct {
}
// GetUserProfilePhotos returns a list of profile pictures for a user.
// Since: Bot API 1.4
// See https://core.telegram.org/bots/api#getuserprofilephotos
func (api *API) GetUserProfilePhotos(params GetUserProfilePhotos) (UserProfilePhotos, error) {
req := NewRequest[UserProfilePhotos]("getUserProfilePhotos", params)
@@ -18,6 +20,7 @@ func (api *API) GetUserProfilePhotos(params GetUserProfilePhotos) (UserProfilePh
}
// GetUserProfilePhotosWithContext is the context-aware variant of GetUserProfilePhotos.
// Since: Bot API 1.4
// It executes the same request but uses ctx for cancellation and deadlines.
// See https://core.telegram.org/bots/api#getuserprofilephotos
func (api *API) GetUserProfilePhotosWithContext(ctx context.Context, params GetUserProfilePhotos) (UserProfilePhotos, error) {
@@ -26,6 +29,7 @@ func (api *API) GetUserProfilePhotosWithContext(ctx context.Context, params GetU
}
// GetUserProfileAudios holds parameters for the GetUserProfileAudios method.
// Since: Bot API 9.3
// See https://core.telegram.org/bots/api#getuserprofileaudios
type GetUserProfileAudios struct {
UserID int64 `json:"user_id"`
@@ -34,6 +38,7 @@ type GetUserProfileAudios struct {
}
// GetUserProfileAudios returns a list of profile audios for a user.
// Since: Bot API 9.3
// See https://core.telegram.org/bots/api#getuserprofileaudios
func (api *API) GetUserProfileAudios(params GetUserProfileAudios) (UserProfileAudios, error) {
req := NewRequest[UserProfileAudios]("getUserProfileAudios", params)
@@ -41,6 +46,7 @@ func (api *API) GetUserProfileAudios(params GetUserProfileAudios) (UserProfileAu
}
// GetUserProfileAudiosWithContext is the context-aware variant of GetUserProfileAudios.
// Since: Bot API 9.3
// It executes the same request but uses ctx for cancellation and deadlines.
// See https://core.telegram.org/bots/api#getuserprofileaudios
func (api *API) GetUserProfileAudiosWithContext(ctx context.Context, params GetUserProfileAudios) (UserProfileAudios, error) {
@@ -49,6 +55,7 @@ func (api *API) GetUserProfileAudiosWithContext(ctx context.Context, params GetU
}
// SetUserEmojiStatus holds parameters for the SetUserEmojiStatus method.
// Since: Bot API 8.0
// See https://core.telegram.org/bots/api#setuseremojistatus
type SetUserEmojiStatus struct {
UserID int64 `json:"user_id"`
@@ -57,6 +64,7 @@ type SetUserEmojiStatus struct {
}
// SetUserEmojiStatus sets a custom emoji status for a user.
// Since: Bot API 8.0
// Returns true on success.
// See https://core.telegram.org/bots/api#setuseremojistatus
func (api *API) SetUserEmojiStatus(params SetUserEmojiStatus) (bool, error) {
@@ -65,6 +73,7 @@ func (api *API) SetUserEmojiStatus(params SetUserEmojiStatus) (bool, error) {
}
// SetUserEmojiStatusWithContext is the context-aware variant of SetUserEmojiStatus.
// Since: Bot API 8.0
// It executes the same request but uses ctx for cancellation and deadlines.
// See https://core.telegram.org/bots/api#setuseremojistatus
func (api *API) SetUserEmojiStatusWithContext(ctx context.Context, params SetUserEmojiStatus) (bool, error) {
@@ -73,6 +82,7 @@ func (api *API) SetUserEmojiStatusWithContext(ctx context.Context, params SetUse
}
// GetUserGifts holds parameters for the GetUserGifts method.
// Since: Bot API 9.3
// See https://core.telegram.org/bots/api#getusergifts
type GetUserGifts struct {
UserID int64 `json:"user_id"`
@@ -87,6 +97,7 @@ type GetUserGifts struct {
}
// GetUserGifts returns gifts owned by a user.
// Since: Bot API 9.3
// See https://core.telegram.org/bots/api#getusergifts
func (api *API) GetUserGifts(params GetUserGifts) (OwnedGifts, error) {
req := NewRequest[OwnedGifts]("getUserGifts", params)
@@ -94,9 +105,36 @@ func (api *API) GetUserGifts(params GetUserGifts) (OwnedGifts, error) {
}
// GetUserGiftsWithContext is the context-aware variant of GetUserGifts.
// Since: Bot API 9.3
// It executes the same request but uses ctx for cancellation and deadlines.
// See https://core.telegram.org/bots/api#getusergifts
func (api *API) GetUserGiftsWithContext(ctx context.Context, params GetUserGifts) (OwnedGifts, error) {
req := NewRequest[OwnedGifts]("getUserGifts", params)
return req.DoWithContext(ctx, api)
}
// GetUserPersonalChatMessages holds parameters for the getUserPersonalChatMessages method.
// Since: Bot API 10.0
// See https://core.telegram.org/bots/api#getuserpersonalchatmessages
type GetUserPersonalChatMessages struct {
UserID int64 `json:"user_id"`
Offset int `json:"offset,omitempty"`
Limit int `json:"limit,omitempty"`
}
// GetUserPersonalChatMessages returns messages from the personal chat of the user with the bot.
// Since: Bot API 10.0
// See https://core.telegram.org/bots/api#getuserpersonalchatmessages
func (api *API) GetUserPersonalChatMessages(params GetUserPersonalChatMessages) ([]Message, error) {
req := NewRequest[[]Message]("getUserPersonalChatMessages", params)
return req.Do(api)
}
// GetUserPersonalChatMessagesWithContext is the context-aware variant of GetUserPersonalChatMessages.
// Since: Bot API 10.0
// It executes the same request but uses ctx for cancellation and deadlines.
// See https://core.telegram.org/bots/api#getuserpersonalchatmessages
func (api *API) GetUserPersonalChatMessagesWithContext(ctx context.Context, params GetUserPersonalChatMessages) ([]Message, error) {
req := NewRequest[[]Message]("getUserPersonalChatMessages", params)
return req.DoWithContext(ctx, api)
}