(new): support Bot API 10.3
Golang lint / lint (push) Failing after 1m37s

(fix): finalize v2 contracts
(tests): cover v2 migration
(doc): prepare release guidance
This commit is contained in:
2026-09-08 23:21:38 +03:00
parent 24040fe164
commit d78526242b
88 changed files with 2321 additions and 918 deletions
+40 -40
View File
@@ -23,7 +23,7 @@ type SetMyCommands struct {
// See https://core.telegram.org/bots/api#setmycommands
func (api *API) SetMyCommands(params SetMyCommands) (bool, error) {
req := NewRequest[bool]("setMyCommands", params)
return req.Do(api)
return api.Do(req)
}
// SetMyCommandsWithContext is the context-aware variant of SetMyCommands.
@@ -32,7 +32,7 @@ func (api *API) SetMyCommands(params SetMyCommands) (bool, error) {
// See https://core.telegram.org/bots/api#setmycommands
func (api *API) SetMyCommandsWithContext(ctx context.Context, params SetMyCommands) (bool, error) {
req := NewRequest[bool]("setMyCommands", params)
return req.DoWithContext(ctx, api)
return api.DoWithContext(ctx, req)
}
// DeleteMyCommands holds parameters for the deleteMyCommands method.
@@ -53,7 +53,7 @@ type DeleteMyCommands struct {
// See https://core.telegram.org/bots/api#deletemycommands
func (api *API) DeleteMyCommands(params DeleteMyCommands) (bool, error) {
req := NewRequest[bool]("deleteMyCommands", params)
return req.Do(api)
return api.Do(req)
}
// DeleteMyCommandsWithContext is the context-aware variant of DeleteMyCommands.
@@ -62,7 +62,7 @@ func (api *API) DeleteMyCommands(params DeleteMyCommands) (bool, error) {
// See https://core.telegram.org/bots/api#deletemycommands
func (api *API) DeleteMyCommandsWithContext(ctx context.Context, params DeleteMyCommands) (bool, error) {
req := NewRequest[bool]("deleteMyCommands", params)
return req.DoWithContext(ctx, api)
return api.DoWithContext(ctx, req)
}
// GetMyCommands holds parameters for the getMyCommands method.
@@ -80,7 +80,7 @@ type GetMyCommands struct {
// See https://core.telegram.org/bots/api#getmycommands
func (api *API) GetMyCommands(params GetMyCommands) ([]BotCommand, error) {
req := NewRequest[[]BotCommand]("getMyCommands", params)
return req.Do(api)
return api.Do(req)
}
// GetMyCommandsWithContext is the context-aware variant of GetMyCommands.
@@ -89,7 +89,7 @@ func (api *API) GetMyCommands(params GetMyCommands) ([]BotCommand, error) {
// See https://core.telegram.org/bots/api#getmycommands
func (api *API) GetMyCommandsWithContext(ctx context.Context, params GetMyCommands) ([]BotCommand, error) {
req := NewRequest[[]BotCommand]("getMyCommands", params)
return req.DoWithContext(ctx, api)
return api.DoWithContext(ctx, req)
}
// SetMyName holds parameters for the setMyName method.
@@ -110,7 +110,7 @@ type SetMyName struct {
// See https://core.telegram.org/bots/api#setmyname
func (api *API) SetMyName(params SetMyName) (bool, error) {
req := NewRequest[bool]("setMyName", params)
return req.Do(api)
return api.Do(req)
}
// SetMyNameWithContext is the context-aware variant of SetMyName.
@@ -119,7 +119,7 @@ func (api *API) SetMyName(params SetMyName) (bool, error) {
// See https://core.telegram.org/bots/api#setmyname
func (api *API) SetMyNameWithContext(ctx context.Context, params SetMyName) (bool, error) {
req := NewRequest[bool]("setMyName", params)
return req.DoWithContext(ctx, api)
return api.DoWithContext(ctx, req)
}
// GetMyName holds parameters for the getMyName method.
@@ -135,7 +135,7 @@ type GetMyName struct {
// See https://core.telegram.org/bots/api#getmyname
func (api *API) GetMyName(params GetMyName) (BotName, error) {
req := NewRequest[BotName]("getMyName", params)
return req.Do(api)
return api.Do(req)
}
// GetMyNameWithContext is the context-aware variant of GetMyName.
@@ -144,7 +144,7 @@ func (api *API) GetMyName(params GetMyName) (BotName, error) {
// See https://core.telegram.org/bots/api#getmyname
func (api *API) GetMyNameWithContext(ctx context.Context, params GetMyName) (BotName, error) {
req := NewRequest[BotName]("getMyName", params)
return req.DoWithContext(ctx, api)
return api.DoWithContext(ctx, req)
}
// SetMyDescription holds parameters for the setMyDescription method.
@@ -165,7 +165,7 @@ type SetMyDescription struct {
// See https://core.telegram.org/bots/api#setmydescription
func (api *API) SetMyDescription(params SetMyDescription) (bool, error) {
req := NewRequest[bool]("setMyDescription", params)
return req.Do(api)
return api.Do(req)
}
// SetMyDescriptionWithContext is the context-aware variant of SetMyDescription.
@@ -174,7 +174,7 @@ func (api *API) SetMyDescription(params SetMyDescription) (bool, error) {
// See https://core.telegram.org/bots/api#setmydescription
func (api *API) SetMyDescriptionWithContext(ctx context.Context, params SetMyDescription) (bool, error) {
req := NewRequest[bool]("setMyDescription", params)
return req.DoWithContext(ctx, api)
return api.DoWithContext(ctx, req)
}
// GetMyDescription holds parameters for the getMyDescription method.
@@ -190,7 +190,7 @@ type GetMyDescription struct {
// See https://core.telegram.org/bots/api#getmydescription
func (api *API) GetMyDescription(params GetMyDescription) (BotDescription, error) {
req := NewRequest[BotDescription]("getMyDescription", params)
return req.Do(api)
return api.Do(req)
}
// GetMyDescriptionWithContext is the context-aware variant of GetMyDescription.
@@ -199,7 +199,7 @@ func (api *API) GetMyDescription(params GetMyDescription) (BotDescription, error
// See https://core.telegram.org/bots/api#getmydescription
func (api *API) GetMyDescriptionWithContext(ctx context.Context, params GetMyDescription) (BotDescription, error) {
req := NewRequest[BotDescription]("getMyDescription", params)
return req.DoWithContext(ctx, api)
return api.DoWithContext(ctx, req)
}
// SetMyShortDescription holds parameters for the setMyShortDescription method.
@@ -220,7 +220,7 @@ type SetMyShortDescription struct {
// See https://core.telegram.org/bots/api#setmyshortdescription
func (api *API) SetMyShortDescription(params SetMyShortDescription) (bool, error) {
req := NewRequest[bool]("setMyShortDescription", params)
return req.Do(api)
return api.Do(req)
}
// SetMyShortDescriptionWithContext is the context-aware variant of SetMyShortDescription.
@@ -229,7 +229,7 @@ func (api *API) SetMyShortDescription(params SetMyShortDescription) (bool, error
// See https://core.telegram.org/bots/api#setmyshortdescription
func (api *API) SetMyShortDescriptionWithContext(ctx context.Context, params SetMyShortDescription) (bool, error) {
req := NewRequest[bool]("setMyShortDescription", params)
return req.DoWithContext(ctx, api)
return api.DoWithContext(ctx, req)
}
// GetMyShortDescription holds parameters for the getMyShortDescription method.
@@ -245,7 +245,7 @@ type GetMyShortDescription struct {
// See https://core.telegram.org/bots/api#getmyshortdescription
func (api *API) GetMyShortDescription(params GetMyShortDescription) (BotShortDescription, error) {
req := NewRequest[BotShortDescription]("getMyShortDescription", params)
return req.Do(api)
return api.Do(req)
}
// GetMyShortDescriptionWithContext is the context-aware variant of GetMyShortDescription.
@@ -254,7 +254,7 @@ func (api *API) GetMyShortDescription(params GetMyShortDescription) (BotShortDes
// See https://core.telegram.org/bots/api#getmyshortdescription
func (api *API) GetMyShortDescriptionWithContext(ctx context.Context, params GetMyShortDescription) (BotShortDescription, error) {
req := NewRequest[BotShortDescription]("getMyShortDescription", params)
return req.DoWithContext(ctx, api)
return api.DoWithContext(ctx, req)
}
// SetMyProfilePhoto holds parameters for the setMyProfilePhoto method.
@@ -271,7 +271,7 @@ type SetMyProfilePhoto struct {
// See https://core.telegram.org/bots/api#setmyprofilephoto
func (api *API) SetMyProfilePhoto(params SetMyProfilePhoto) (bool, error) {
req := NewRequest[bool]("setMyProfilePhoto", params)
return req.Do(api)
return api.Do(req)
}
// SetMyProfilePhotoWithContext is the context-aware variant of SetMyProfilePhoto.
@@ -280,7 +280,7 @@ func (api *API) SetMyProfilePhoto(params SetMyProfilePhoto) (bool, error) {
// See https://core.telegram.org/bots/api#setmyprofilephoto
func (api *API) SetMyProfilePhotoWithContext(ctx context.Context, params SetMyProfilePhoto) (bool, error) {
req := NewRequest[bool]("setMyProfilePhoto", params)
return req.DoWithContext(ctx, api)
return api.DoWithContext(ctx, req)
}
// RemoveMyProfilePhoto removes the bot's profile photo.
@@ -289,7 +289,7 @@ func (api *API) SetMyProfilePhotoWithContext(ctx context.Context, params SetMyPr
// See https://core.telegram.org/bots/api#removemyprofilephoto
func (api *API) RemoveMyProfilePhoto() (bool, error) {
req := NewRequest[bool]("removeMyProfilePhoto", NoParams)
return req.Do(api)
return api.Do(req)
}
// RemoveMyProfilePhotoWithContext is the context-aware variant of RemoveMyProfilePhoto.
@@ -298,7 +298,7 @@ func (api *API) RemoveMyProfilePhoto() (bool, error) {
// See https://core.telegram.org/bots/api#removemyprofilephoto
func (api *API) RemoveMyProfilePhotoWithContext(ctx context.Context) (bool, error) {
req := NewRequest[bool]("removeMyProfilePhoto", NoParams)
return req.DoWithContext(ctx, api)
return api.DoWithContext(ctx, req)
}
// SetChatMenuButton holds parameters for the setChatMenuButton method.
@@ -319,7 +319,7 @@ type SetChatMenuButton struct {
// See https://core.telegram.org/bots/api#setchatmenubutton
func (api *API) SetChatMenuButton(params SetChatMenuButton) (bool, error) {
req := NewRequest[bool]("setChatMenuButton", params)
return req.Do(api)
return api.Do(req)
}
// SetChatMenuButtonWithContext is the context-aware variant of SetChatMenuButton.
@@ -328,7 +328,7 @@ func (api *API) SetChatMenuButton(params SetChatMenuButton) (bool, error) {
// See https://core.telegram.org/bots/api#setchatmenubutton
func (api *API) SetChatMenuButtonWithContext(ctx context.Context, params SetChatMenuButton) (bool, error) {
req := NewRequest[bool]("setChatMenuButton", params)
return req.DoWithContext(ctx, api)
return api.DoWithContext(ctx, req)
}
// GetChatMenuButton holds parameters for the getChatMenuButton method.
@@ -345,7 +345,7 @@ type GetChatMenuButton struct {
// See https://core.telegram.org/bots/api#getchatmenubutton
func (api *API) GetChatMenuButton(params GetChatMenuButton) (MenuButton, error) {
req := NewRequest[MenuButton]("getChatMenuButton", params)
return req.Do(api)
return api.Do(req)
}
// GetChatMenuButtonWithContext is the context-aware variant of GetChatMenuButton.
@@ -354,7 +354,7 @@ func (api *API) GetChatMenuButton(params GetChatMenuButton) (MenuButton, error)
// See https://core.telegram.org/bots/api#getchatmenubutton
func (api *API) GetChatMenuButtonWithContext(ctx context.Context, params GetChatMenuButton) (MenuButton, error) {
req := NewRequest[MenuButton]("getChatMenuButton", params)
return req.DoWithContext(ctx, api)
return api.DoWithContext(ctx, req)
}
// SetMyDefaultAdministratorRights holds parameters for the setMyDefaultAdministratorRights method.
@@ -375,7 +375,7 @@ type SetMyDefaultAdministratorRights struct {
// See https://core.telegram.org/bots/api#setmydefaultadministratorrights
func (api *API) SetMyDefaultAdministratorRights(params SetMyDefaultAdministratorRights) (bool, error) {
req := NewRequest[bool]("setMyDefaultAdministratorRights", params)
return req.Do(api)
return api.Do(req)
}
// SetMyDefaultAdministratorRightsWithContext is the context-aware variant of SetMyDefaultAdministratorRights.
@@ -384,7 +384,7 @@ func (api *API) SetMyDefaultAdministratorRights(params SetMyDefaultAdministrator
// See https://core.telegram.org/bots/api#setmydefaultadministratorrights
func (api *API) SetMyDefaultAdministratorRightsWithContext(ctx context.Context, params SetMyDefaultAdministratorRights) (bool, error) {
req := NewRequest[bool]("setMyDefaultAdministratorRights", params)
return req.DoWithContext(ctx, api)
return api.DoWithContext(ctx, req)
}
// GetMyDefaultAdministratorRights holds parameters for the getMyDefaultAdministratorRights method.
@@ -401,7 +401,7 @@ type GetMyDefaultAdministratorRights struct {
// See https://core.telegram.org/bots/api#getmydefaultadministratorrights
func (api *API) GetMyDefaultAdministratorRights(params GetMyDefaultAdministratorRights) (ChatAdministratorRights, error) {
req := NewRequest[ChatAdministratorRights]("getMyDefaultAdministratorRights", params)
return req.Do(api)
return api.Do(req)
}
// GetMyDefaultAdministratorRightsWithContext is the context-aware variant of GetMyDefaultAdministratorRights.
@@ -410,7 +410,7 @@ func (api *API) GetMyDefaultAdministratorRights(params GetMyDefaultAdministrator
// See https://core.telegram.org/bots/api#getmydefaultadministratorrights
func (api *API) GetMyDefaultAdministratorRightsWithContext(ctx context.Context, params GetMyDefaultAdministratorRights) (ChatAdministratorRights, error) {
req := NewRequest[ChatAdministratorRights]("getMyDefaultAdministratorRights", params)
return req.DoWithContext(ctx, api)
return api.DoWithContext(ctx, req)
}
// GetAvailableGifts returns the list of gifts that can be sent by the bot.
@@ -418,7 +418,7 @@ func (api *API) GetMyDefaultAdministratorRightsWithContext(ctx context.Context,
// See https://core.telegram.org/bots/api#getavailablegifts
func (api *API) GetAvailableGifts() (Gifts, error) {
req := NewRequest[Gifts]("getAvailableGifts", NoParams)
return req.Do(api)
return api.Do(req)
}
// GetAvailableGiftsWithContext is the context-aware variant of GetAvailableGifts.
@@ -427,7 +427,7 @@ func (api *API) GetAvailableGifts() (Gifts, error) {
// See https://core.telegram.org/bots/api#getavailablegifts
func (api *API) GetAvailableGiftsWithContext(ctx context.Context) (Gifts, error) {
req := NewRequest[Gifts]("getAvailableGifts", NoParams)
return req.DoWithContext(ctx, api)
return api.DoWithContext(ctx, req)
}
// SendGift holds parameters for the sendGift method.
@@ -463,7 +463,7 @@ type SendGift struct {
// See https://core.telegram.org/bots/api#sendgift
func (api *API) SendGift(params SendGift) (bool, error) {
req := NewRequest[bool]("sendGift", params)
return req.Do(api)
return api.Do(req)
}
// SendGiftWithContext is the context-aware variant of SendGift.
@@ -472,7 +472,7 @@ func (api *API) SendGift(params SendGift) (bool, error) {
// See https://core.telegram.org/bots/api#sendgift
func (api *API) SendGiftWithContext(ctx context.Context, params SendGift) (bool, error) {
req := NewRequest[bool]("sendGift", params)
return req.DoWithContext(ctx, api)
return api.DoWithContext(ctx, req)
}
// GiftPremiumSubscription holds parameters for the giftPremiumSubscription method.
@@ -506,7 +506,7 @@ type GiftPremiumSubscription struct {
// See https://core.telegram.org/bots/api#giftpremiumsubscription
func (api *API) GiftPremiumSubscription(params GiftPremiumSubscription) (bool, error) {
req := NewRequest[bool]("giftPremiumSubscription", params)
return req.Do(api)
return api.Do(req)
}
// GiftPremiumSubscriptionWithContext is the context-aware variant of GiftPremiumSubscription.
@@ -515,7 +515,7 @@ func (api *API) GiftPremiumSubscription(params GiftPremiumSubscription) (bool, e
// See https://core.telegram.org/bots/api#giftpremiumsubscription
func (api *API) GiftPremiumSubscriptionWithContext(ctx context.Context, params GiftPremiumSubscription) (bool, error) {
req := NewRequest[bool]("giftPremiumSubscription", params)
return req.DoWithContext(ctx, api)
return api.DoWithContext(ctx, req)
}
// GetManagedBotAccessSettings holds parameters for the getManagedBotAccessSettings method.
@@ -531,7 +531,7 @@ type GetManagedBotAccessSettings struct {
// See https://core.telegram.org/bots/api#getmanagedbotaccesssettings
func (api *API) GetManagedBotAccessSettings(params GetManagedBotAccessSettings) (BotAccessSettings, error) {
req := NewRequest[BotAccessSettings]("getManagedBotAccessSettings", params)
return req.Do(api)
return api.Do(req)
}
// GetManagedBotAccessSettingsWithContext is the context-aware variant of GetManagedBotAccessSettings.
@@ -540,7 +540,7 @@ func (api *API) GetManagedBotAccessSettings(params GetManagedBotAccessSettings)
// See https://core.telegram.org/bots/api#getmanagedbotaccesssettings
func (api *API) GetManagedBotAccessSettingsWithContext(ctx context.Context, params GetManagedBotAccessSettings) (BotAccessSettings, error) {
req := NewRequest[BotAccessSettings]("getManagedBotAccessSettings", params)
return req.DoWithContext(ctx, api)
return api.DoWithContext(ctx, req)
}
// SetManagedBotAccessSettings holds parameters for the setManagedBotAccessSettings method.
@@ -559,7 +559,7 @@ type SetManagedBotAccessSettings struct {
// See https://core.telegram.org/bots/api#setmanagedbotaccesssettings
func (api *API) SetManagedBotAccessSettings(params SetManagedBotAccessSettings) (bool, error) {
req := NewRequest[bool]("setManagedBotAccessSettings", params)
return req.Do(api)
return api.Do(req)
}
// SetManagedBotAccessSettingsWithContext is the context-aware variant of SetManagedBotAccessSettings.
@@ -568,5 +568,5 @@ func (api *API) SetManagedBotAccessSettings(params SetManagedBotAccessSettings)
// See https://core.telegram.org/bots/api#setmanagedbotaccesssettings
func (api *API) SetManagedBotAccessSettingsWithContext(ctx context.Context, params SetManagedBotAccessSettings) (bool, error) {
req := NewRequest[bool]("setManagedBotAccessSettings", params)
return req.DoWithContext(ctx, api)
return api.DoWithContext(ctx, req)
}