Rename tgapi request structs
Add MaybeInaccessibleMessage tests and godoc Update wiki and Bot API docs for the new naming
This commit is contained in:
+34
-12
@@ -2,9 +2,9 @@ package tgapi
|
||||
|
||||
import "context"
|
||||
|
||||
// AnswerInlineQueryP holds parameters for the answerInlineQuery method.
|
||||
// AnswerInlineQuery holds parameters for the answerInlineQuery method.
|
||||
// See https://core.telegram.org/bots/api#answerinlinequery
|
||||
type AnswerInlineQueryP struct {
|
||||
type AnswerInlineQuery struct {
|
||||
InlineQueryID string `json:"inline_query_id"`
|
||||
Results []InlineQueryResult `json:"results"`
|
||||
CacheTime int `json:"cache_time,omitempty"`
|
||||
@@ -16,7 +16,7 @@ type AnswerInlineQueryP struct {
|
||||
// AnswerInlineQuery sends answers to an inline query.
|
||||
// Returns true on success.
|
||||
// See https://core.telegram.org/bots/api#answerinlinequery
|
||||
func (api *API) AnswerInlineQuery(params AnswerInlineQueryP) (bool, error) {
|
||||
func (api *API) AnswerInlineQuery(params AnswerInlineQuery) (bool, error) {
|
||||
req := NewRequest[bool]("answerInlineQuery", params)
|
||||
return req.Do(api)
|
||||
}
|
||||
@@ -24,21 +24,21 @@ func (api *API) AnswerInlineQuery(params AnswerInlineQueryP) (bool, error) {
|
||||
// AnswerInlineQueryWithContext is the context-aware variant of AnswerInlineQuery.
|
||||
// It executes the same request but uses ctx for cancellation and deadlines.
|
||||
// See https://core.telegram.org/bots/api#answerinlinequery
|
||||
func (api *API) AnswerInlineQueryWithContext(ctx context.Context, params AnswerInlineQueryP) (bool, error) {
|
||||
func (api *API) AnswerInlineQueryWithContext(ctx context.Context, params AnswerInlineQuery) (bool, error) {
|
||||
req := NewRequest[bool]("answerInlineQuery", params)
|
||||
return req.DoWithContext(ctx, api)
|
||||
}
|
||||
|
||||
// AnswerWebAppQueryP holds parameters for the answerWebAppQuery method.
|
||||
// AnswerWebAppQuery holds parameters for the answerWebAppQuery method.
|
||||
// See https://core.telegram.org/bots/api#answerwebappquery
|
||||
type AnswerWebAppQueryP struct {
|
||||
type AnswerWebAppQuery struct {
|
||||
WebAppQueryID string `json:"web_app_query_id"`
|
||||
Result InlineQueryResult `json:"result"`
|
||||
}
|
||||
|
||||
// AnswerWebAppQuery sets the result of a Web App interaction.
|
||||
// See https://core.telegram.org/bots/api#answerwebappquery
|
||||
func (api *API) AnswerWebAppQuery(params AnswerWebAppQueryP) (SentWebAppMessage, error) {
|
||||
func (api *API) AnswerWebAppQuery(params AnswerWebAppQuery) (SentWebAppMessage, error) {
|
||||
req := NewRequest[SentWebAppMessage]("answerWebAppQuery", params)
|
||||
return req.Do(api)
|
||||
}
|
||||
@@ -46,14 +46,14 @@ func (api *API) AnswerWebAppQuery(params AnswerWebAppQueryP) (SentWebAppMessage,
|
||||
// AnswerWebAppQueryWithContext is the context-aware variant of AnswerWebAppQuery.
|
||||
// It executes the same request but uses ctx for cancellation and deadlines.
|
||||
// See https://core.telegram.org/bots/api#answerwebappquery
|
||||
func (api *API) AnswerWebAppQueryWithContext(ctx context.Context, params AnswerWebAppQueryP) (SentWebAppMessage, error) {
|
||||
func (api *API) AnswerWebAppQueryWithContext(ctx context.Context, params AnswerWebAppQuery) (SentWebAppMessage, error) {
|
||||
req := NewRequest[SentWebAppMessage]("answerWebAppQuery", params)
|
||||
return req.DoWithContext(ctx, api)
|
||||
}
|
||||
|
||||
// SavePreparedInlineMessageP holds parameters for the savePreparedInlineMessage method.
|
||||
// SavePreparedInlineMessage holds parameters for the savePreparedInlineMessage method.
|
||||
// See https://core.telegram.org/bots/api#savepreparedinlinemessage
|
||||
type SavePreparedInlineMessageP struct {
|
||||
type SavePreparedInlineMessage struct {
|
||||
UserID int64 `json:"user_id"`
|
||||
Result InlineQueryResult `json:"result"`
|
||||
AllowUserChats bool `json:"allow_user_chats,omitempty"`
|
||||
@@ -64,7 +64,7 @@ type SavePreparedInlineMessageP struct {
|
||||
|
||||
// SavePreparedInlineMessage stores a prepared message for Mini App users.
|
||||
// See https://core.telegram.org/bots/api#savepreparedinlinemessage
|
||||
func (api *API) SavePreparedInlineMessage(params SavePreparedInlineMessageP) (PreparedInlineMessage, error) {
|
||||
func (api *API) SavePreparedInlineMessage(params SavePreparedInlineMessage) (PreparedInlineMessage, error) {
|
||||
req := NewRequest[PreparedInlineMessage]("savePreparedInlineMessage", params)
|
||||
return req.Do(api)
|
||||
}
|
||||
@@ -72,7 +72,29 @@ func (api *API) SavePreparedInlineMessage(params SavePreparedInlineMessageP) (Pr
|
||||
// SavePreparedInlineMessageWithContext is the context-aware variant of SavePreparedInlineMessage.
|
||||
// It executes the same request but uses ctx for cancellation and deadlines.
|
||||
// See https://core.telegram.org/bots/api#savepreparedinlinemessage
|
||||
func (api *API) SavePreparedInlineMessageWithContext(ctx context.Context, params SavePreparedInlineMessageP) (PreparedInlineMessage, error) {
|
||||
func (api *API) SavePreparedInlineMessageWithContext(ctx context.Context, params SavePreparedInlineMessage) (PreparedInlineMessage, error) {
|
||||
req := NewRequest[PreparedInlineMessage]("savePreparedInlineMessage", params)
|
||||
return req.DoWithContext(ctx, api)
|
||||
}
|
||||
|
||||
// SavePreparedKeyboardButton holds parameters for the savePreparedKeyboardButton method.
|
||||
// See https://core.telegram.org/bots/api#savepreparedkeyboardbutton
|
||||
type SavePreparedKeyboardButton struct {
|
||||
UserID int64 `json:"user_id"`
|
||||
Button KeyboardButton `json:"button"`
|
||||
}
|
||||
|
||||
// SavePreparedKeyboardButton stores a prepared keyboard button for Mini App users.
|
||||
// See https://core.telegram.org/bots/api#savepreparedkeyboardbutton
|
||||
func (api *API) SavePreparedKeyboardButton(params SavePreparedKeyboardButton) (PreparedKeyboardButton, error) {
|
||||
req := NewRequest[PreparedKeyboardButton]("savePreparedKeyboardButton", params)
|
||||
return req.Do(api)
|
||||
}
|
||||
|
||||
// SavePreparedKeyboardButtonWithContext is the context-aware variant of SavePreparedKeyboardButton.
|
||||
// It executes the same request but uses ctx for cancellation and deadlines.
|
||||
// See https://core.telegram.org/bots/api#savepreparedkeyboardbutton
|
||||
func (api *API) SavePreparedKeyboardButtonWithContext(ctx context.Context, params SavePreparedKeyboardButton) (PreparedKeyboardButton, error) {
|
||||
req := NewRequest[PreparedKeyboardButton]("savePreparedKeyboardButton", params)
|
||||
return req.DoWithContext(ctx, api)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user