Rename tgapi request structs
Add MaybeInaccessibleMessage tests and godoc Update wiki and Bot API docs for the new naming
This commit is contained in:
+35
-35
@@ -2,8 +2,8 @@ package tgapi
|
||||
|
||||
import "context"
|
||||
|
||||
// BaseForumTopicP contains common fields for forum topic operations that require a chat ID and a message thread ID.
|
||||
type BaseForumTopicP struct {
|
||||
// BaseForumTopic contains common fields for forum topic operations that require a chat ID and a message thread ID.
|
||||
type BaseForumTopic struct {
|
||||
ChatID int64 `json:"chat_id"`
|
||||
MessageThreadID int `json:"message_thread_id"`
|
||||
}
|
||||
@@ -23,9 +23,9 @@ func (api *API) GetForumTopicIconStickersWithContext(ctx context.Context) ([]Sti
|
||||
return req.DoWithContext(ctx, api)
|
||||
}
|
||||
|
||||
// CreateForumTopicP holds parameters for the createForumTopic method.
|
||||
// CreateForumTopic holds parameters for the createForumTopic method.
|
||||
// See https://core.telegram.org/bots/api#createforumtopic
|
||||
type CreateForumTopicP struct {
|
||||
type CreateForumTopic struct {
|
||||
ChatID int64 `json:"chat_id"`
|
||||
Name string `json:"name"`
|
||||
IconColor ForumTopicIconColor `json:"icon_color"`
|
||||
@@ -35,7 +35,7 @@ type CreateForumTopicP struct {
|
||||
// CreateForumTopic creates a topic in a forum supergroup.
|
||||
// Returns the created ForumTopic on success.
|
||||
// See https://core.telegram.org/bots/api#createforumtopic
|
||||
func (api *API) CreateForumTopic(params CreateForumTopicP) (ForumTopic, error) {
|
||||
func (api *API) CreateForumTopic(params CreateForumTopic) (ForumTopic, error) {
|
||||
req := NewRequestWithChatID[ForumTopic]("createForumTopic", params, params.ChatID)
|
||||
return req.Do(api)
|
||||
}
|
||||
@@ -43,15 +43,15 @@ func (api *API) CreateForumTopic(params CreateForumTopicP) (ForumTopic, error) {
|
||||
// CreateForumTopicWithContext is the context-aware variant of CreateForumTopic.
|
||||
// It executes the same request but uses ctx for cancellation and deadlines.
|
||||
// See https://core.telegram.org/bots/api#createforumtopic
|
||||
func (api *API) CreateForumTopicWithContext(ctx context.Context, params CreateForumTopicP) (ForumTopic, error) {
|
||||
func (api *API) CreateForumTopicWithContext(ctx context.Context, params CreateForumTopic) (ForumTopic, error) {
|
||||
req := NewRequestWithChatID[ForumTopic]("createForumTopic", params, params.ChatID)
|
||||
return req.DoWithContext(ctx, api)
|
||||
}
|
||||
|
||||
// EditForumTopicP holds parameters for the editForumTopic method.
|
||||
// EditForumTopic holds parameters for the editForumTopic method.
|
||||
// See https://core.telegram.org/bots/api#editforumtopic
|
||||
type EditForumTopicP struct {
|
||||
BaseForumTopicP
|
||||
type EditForumTopic struct {
|
||||
BaseForumTopic
|
||||
Name string `json:"name"`
|
||||
IconCustomEmojiID string `json:"icon_custom_emoji_id"`
|
||||
}
|
||||
@@ -59,7 +59,7 @@ type EditForumTopicP struct {
|
||||
// EditForumTopic edits name and icon of a forum topic.
|
||||
// Returns True on success.
|
||||
// See https://core.telegram.org/bots/api#editforumtopic
|
||||
func (api *API) EditForumTopic(params EditForumTopicP) (bool, error) {
|
||||
func (api *API) EditForumTopic(params EditForumTopic) (bool, error) {
|
||||
req := NewRequestWithChatID[bool]("editForumTopic", params, params.ChatID)
|
||||
return req.Do(api)
|
||||
}
|
||||
@@ -67,7 +67,7 @@ func (api *API) EditForumTopic(params EditForumTopicP) (bool, error) {
|
||||
// EditForumTopicWithContext is the context-aware variant of EditForumTopic.
|
||||
// It executes the same request but uses ctx for cancellation and deadlines.
|
||||
// See https://core.telegram.org/bots/api#editforumtopic
|
||||
func (api *API) EditForumTopicWithContext(ctx context.Context, params EditForumTopicP) (bool, error) {
|
||||
func (api *API) EditForumTopicWithContext(ctx context.Context, params EditForumTopic) (bool, error) {
|
||||
req := NewRequestWithChatID[bool]("editForumTopic", params, params.ChatID)
|
||||
return req.DoWithContext(ctx, api)
|
||||
}
|
||||
@@ -75,7 +75,7 @@ func (api *API) EditForumTopicWithContext(ctx context.Context, params EditForumT
|
||||
// CloseForumTopic closes an open forum topic.
|
||||
// Returns True on success.
|
||||
// See https://core.telegram.org/bots/api#closeforumtopic
|
||||
func (api *API) CloseForumTopic(params BaseForumTopicP) (bool, error) {
|
||||
func (api *API) CloseForumTopic(params BaseForumTopic) (bool, error) {
|
||||
req := NewRequestWithChatID[bool]("closeForumTopic", params, params.ChatID)
|
||||
return req.Do(api)
|
||||
}
|
||||
@@ -83,7 +83,7 @@ func (api *API) CloseForumTopic(params BaseForumTopicP) (bool, error) {
|
||||
// CloseForumTopicWithContext is the context-aware variant of CloseForumTopic.
|
||||
// It executes the same request but uses ctx for cancellation and deadlines.
|
||||
// See https://core.telegram.org/bots/api#closeforumtopic
|
||||
func (api *API) CloseForumTopicWithContext(ctx context.Context, params BaseForumTopicP) (bool, error) {
|
||||
func (api *API) CloseForumTopicWithContext(ctx context.Context, params BaseForumTopic) (bool, error) {
|
||||
req := NewRequestWithChatID[bool]("closeForumTopic", params, params.ChatID)
|
||||
return req.DoWithContext(ctx, api)
|
||||
}
|
||||
@@ -91,7 +91,7 @@ func (api *API) CloseForumTopicWithContext(ctx context.Context, params BaseForum
|
||||
// ReopenForumTopic reopens a closed forum topic.
|
||||
// Returns True on success.
|
||||
// See https://core.telegram.org/bots/api#reopenforumtopic
|
||||
func (api *API) ReopenForumTopic(params BaseForumTopicP) (bool, error) {
|
||||
func (api *API) ReopenForumTopic(params BaseForumTopic) (bool, error) {
|
||||
req := NewRequestWithChatID[bool]("reopenForumTopic", params, params.ChatID)
|
||||
return req.Do(api)
|
||||
}
|
||||
@@ -99,7 +99,7 @@ func (api *API) ReopenForumTopic(params BaseForumTopicP) (bool, error) {
|
||||
// ReopenForumTopicWithContext is the context-aware variant of ReopenForumTopic.
|
||||
// It executes the same request but uses ctx for cancellation and deadlines.
|
||||
// See https://core.telegram.org/bots/api#reopenforumtopic
|
||||
func (api *API) ReopenForumTopicWithContext(ctx context.Context, params BaseForumTopicP) (bool, error) {
|
||||
func (api *API) ReopenForumTopicWithContext(ctx context.Context, params BaseForumTopic) (bool, error) {
|
||||
req := NewRequestWithChatID[bool]("reopenForumTopic", params, params.ChatID)
|
||||
return req.DoWithContext(ctx, api)
|
||||
}
|
||||
@@ -107,7 +107,7 @@ func (api *API) ReopenForumTopicWithContext(ctx context.Context, params BaseForu
|
||||
// DeleteForumTopic deletes a forum topic.
|
||||
// Returns True on success.
|
||||
// See https://core.telegram.org/bots/api#deleteforumtopic
|
||||
func (api *API) DeleteForumTopic(params BaseForumTopicP) (bool, error) {
|
||||
func (api *API) DeleteForumTopic(params BaseForumTopic) (bool, error) {
|
||||
req := NewRequestWithChatID[bool]("deleteForumTopic", params, params.ChatID)
|
||||
return req.Do(api)
|
||||
}
|
||||
@@ -115,7 +115,7 @@ func (api *API) DeleteForumTopic(params BaseForumTopicP) (bool, error) {
|
||||
// DeleteForumTopicWithContext is the context-aware variant of DeleteForumTopic.
|
||||
// It executes the same request but uses ctx for cancellation and deadlines.
|
||||
// See https://core.telegram.org/bots/api#deleteforumtopic
|
||||
func (api *API) DeleteForumTopicWithContext(ctx context.Context, params BaseForumTopicP) (bool, error) {
|
||||
func (api *API) DeleteForumTopicWithContext(ctx context.Context, params BaseForumTopic) (bool, error) {
|
||||
req := NewRequestWithChatID[bool]("deleteForumTopic", params, params.ChatID)
|
||||
return req.DoWithContext(ctx, api)
|
||||
}
|
||||
@@ -123,7 +123,7 @@ func (api *API) DeleteForumTopicWithContext(ctx context.Context, params BaseForu
|
||||
// UnpinAllForumTopicMessages clears the list of pinned messages in a forum topic.
|
||||
// Returns True on success.
|
||||
// See https://core.telegram.org/bots/api#unpinallforumtopicmessages
|
||||
func (api *API) UnpinAllForumTopicMessages(params BaseForumTopicP) (bool, error) {
|
||||
func (api *API) UnpinAllForumTopicMessages(params BaseForumTopic) (bool, error) {
|
||||
req := NewRequestWithChatID[bool]("unpinAllForumTopicMessages", params, params.ChatID)
|
||||
return req.Do(api)
|
||||
}
|
||||
@@ -131,19 +131,19 @@ func (api *API) UnpinAllForumTopicMessages(params BaseForumTopicP) (bool, error)
|
||||
// UnpinAllForumTopicMessagesWithContext is the context-aware variant of UnpinAllForumTopicMessages.
|
||||
// It executes the same request but uses ctx for cancellation and deadlines.
|
||||
// See https://core.telegram.org/bots/api#unpinallforumtopicmessages
|
||||
func (api *API) UnpinAllForumTopicMessagesWithContext(ctx context.Context, params BaseForumTopicP) (bool, error) {
|
||||
func (api *API) UnpinAllForumTopicMessagesWithContext(ctx context.Context, params BaseForumTopic) (bool, error) {
|
||||
req := NewRequestWithChatID[bool]("unpinAllForumTopicMessages", params, params.ChatID)
|
||||
return req.DoWithContext(ctx, api)
|
||||
}
|
||||
|
||||
// BaseGeneralForumTopicP contains common fields for general forum topic operations that require a chat ID.
|
||||
type BaseGeneralForumTopicP struct {
|
||||
// BaseGeneralForumTopic contains common fields for general forum topic operations that require a chat ID.
|
||||
type BaseGeneralForumTopic struct {
|
||||
ChatID int64 `json:"chat_id"`
|
||||
}
|
||||
|
||||
// EditGeneralForumTopicP holds parameters for the editGeneralForumTopic method.
|
||||
// EditGeneralForumTopic holds parameters for the editGeneralForumTopic method.
|
||||
// See https://core.telegram.org/bots/api#editgeneralforumtopic
|
||||
type EditGeneralForumTopicP struct {
|
||||
type EditGeneralForumTopic struct {
|
||||
ChatID int64 `json:"chat_id"`
|
||||
Name string `json:"name"`
|
||||
}
|
||||
@@ -151,7 +151,7 @@ type EditGeneralForumTopicP struct {
|
||||
// EditGeneralForumTopic edits the name of the 'General' topic in a forum supergroup.
|
||||
// Returns True on success.
|
||||
// See https://core.telegram.org/bots/api#editgeneralforumtopic
|
||||
func (api *API) EditGeneralForumTopic(params EditGeneralForumTopicP) (bool, error) {
|
||||
func (api *API) EditGeneralForumTopic(params EditGeneralForumTopic) (bool, error) {
|
||||
req := NewRequestWithChatID[bool]("editGeneralForumTopic", params, params.ChatID)
|
||||
return req.Do(api)
|
||||
}
|
||||
@@ -159,7 +159,7 @@ func (api *API) EditGeneralForumTopic(params EditGeneralForumTopicP) (bool, erro
|
||||
// EditGeneralForumTopicWithContext is the context-aware variant of EditGeneralForumTopic.
|
||||
// It executes the same request but uses ctx for cancellation and deadlines.
|
||||
// See https://core.telegram.org/bots/api#editgeneralforumtopic
|
||||
func (api *API) EditGeneralForumTopicWithContext(ctx context.Context, params EditGeneralForumTopicP) (bool, error) {
|
||||
func (api *API) EditGeneralForumTopicWithContext(ctx context.Context, params EditGeneralForumTopic) (bool, error) {
|
||||
req := NewRequestWithChatID[bool]("editGeneralForumTopic", params, params.ChatID)
|
||||
return req.DoWithContext(ctx, api)
|
||||
}
|
||||
@@ -167,7 +167,7 @@ func (api *API) EditGeneralForumTopicWithContext(ctx context.Context, params Edi
|
||||
// CloseGeneralForumTopic closes the 'General' topic in a forum supergroup.
|
||||
// Returns True on success.
|
||||
// See https://core.telegram.org/bots/api#closegeneralforumtopic
|
||||
func (api *API) CloseGeneralForumTopic(params BaseGeneralForumTopicP) (bool, error) {
|
||||
func (api *API) CloseGeneralForumTopic(params BaseGeneralForumTopic) (bool, error) {
|
||||
req := NewRequestWithChatID[bool]("closeGeneralForumTopic", params, params.ChatID)
|
||||
return req.Do(api)
|
||||
}
|
||||
@@ -175,7 +175,7 @@ func (api *API) CloseGeneralForumTopic(params BaseGeneralForumTopicP) (bool, err
|
||||
// CloseGeneralForumTopicWithContext is the context-aware variant of CloseGeneralForumTopic.
|
||||
// It executes the same request but uses ctx for cancellation and deadlines.
|
||||
// See https://core.telegram.org/bots/api#closegeneralforumtopic
|
||||
func (api *API) CloseGeneralForumTopicWithContext(ctx context.Context, params BaseGeneralForumTopicP) (bool, error) {
|
||||
func (api *API) CloseGeneralForumTopicWithContext(ctx context.Context, params BaseGeneralForumTopic) (bool, error) {
|
||||
req := NewRequestWithChatID[bool]("closeGeneralForumTopic", params, params.ChatID)
|
||||
return req.DoWithContext(ctx, api)
|
||||
}
|
||||
@@ -183,7 +183,7 @@ func (api *API) CloseGeneralForumTopicWithContext(ctx context.Context, params Ba
|
||||
// ReopenGeneralForumTopic reopens the 'General' topic in a forum supergroup.
|
||||
// Returns True on success.
|
||||
// See https://core.telegram.org/bots/api#reopengeneralforumtopic
|
||||
func (api *API) ReopenGeneralForumTopic(params BaseGeneralForumTopicP) (bool, error) {
|
||||
func (api *API) ReopenGeneralForumTopic(params BaseGeneralForumTopic) (bool, error) {
|
||||
req := NewRequestWithChatID[bool]("reopenGeneralForumTopic", params, params.ChatID)
|
||||
return req.Do(api)
|
||||
}
|
||||
@@ -191,7 +191,7 @@ func (api *API) ReopenGeneralForumTopic(params BaseGeneralForumTopicP) (bool, er
|
||||
// ReopenGeneralForumTopicWithContext is the context-aware variant of ReopenGeneralForumTopic.
|
||||
// It executes the same request but uses ctx for cancellation and deadlines.
|
||||
// See https://core.telegram.org/bots/api#reopengeneralforumtopic
|
||||
func (api *API) ReopenGeneralForumTopicWithContext(ctx context.Context, params BaseGeneralForumTopicP) (bool, error) {
|
||||
func (api *API) ReopenGeneralForumTopicWithContext(ctx context.Context, params BaseGeneralForumTopic) (bool, error) {
|
||||
req := NewRequestWithChatID[bool]("reopenGeneralForumTopic", params, params.ChatID)
|
||||
return req.DoWithContext(ctx, api)
|
||||
}
|
||||
@@ -199,7 +199,7 @@ func (api *API) ReopenGeneralForumTopicWithContext(ctx context.Context, params B
|
||||
// HideGeneralForumTopic hides the 'General' topic in a forum supergroup.
|
||||
// Returns True on success.
|
||||
// See https://core.telegram.org/bots/api#hidegeneralforumtopic
|
||||
func (api *API) HideGeneralForumTopic(params BaseGeneralForumTopicP) (bool, error) {
|
||||
func (api *API) HideGeneralForumTopic(params BaseGeneralForumTopic) (bool, error) {
|
||||
req := NewRequestWithChatID[bool]("hideGeneralForumTopic", params, params.ChatID)
|
||||
return req.Do(api)
|
||||
}
|
||||
@@ -207,7 +207,7 @@ func (api *API) HideGeneralForumTopic(params BaseGeneralForumTopicP) (bool, erro
|
||||
// HideGeneralForumTopicWithContext is the context-aware variant of HideGeneralForumTopic.
|
||||
// It executes the same request but uses ctx for cancellation and deadlines.
|
||||
// See https://core.telegram.org/bots/api#hidegeneralforumtopic
|
||||
func (api *API) HideGeneralForumTopicWithContext(ctx context.Context, params BaseGeneralForumTopicP) (bool, error) {
|
||||
func (api *API) HideGeneralForumTopicWithContext(ctx context.Context, params BaseGeneralForumTopic) (bool, error) {
|
||||
req := NewRequestWithChatID[bool]("hideGeneralForumTopic", params, params.ChatID)
|
||||
return req.DoWithContext(ctx, api)
|
||||
}
|
||||
@@ -215,7 +215,7 @@ func (api *API) HideGeneralForumTopicWithContext(ctx context.Context, params Bas
|
||||
// UnhideGeneralForumTopic unhides the 'General' topic in a forum supergroup.
|
||||
// Returns True on success.
|
||||
// See https://core.telegram.org/bots/api#unhidegeneralforumtopic
|
||||
func (api *API) UnhideGeneralForumTopic(params BaseGeneralForumTopicP) (bool, error) {
|
||||
func (api *API) UnhideGeneralForumTopic(params BaseGeneralForumTopic) (bool, error) {
|
||||
req := NewRequestWithChatID[bool]("unhideGeneralForumTopic", params, params.ChatID)
|
||||
return req.Do(api)
|
||||
}
|
||||
@@ -223,7 +223,7 @@ func (api *API) UnhideGeneralForumTopic(params BaseGeneralForumTopicP) (bool, er
|
||||
// UnhideGeneralForumTopicWithContext is the context-aware variant of UnhideGeneralForumTopic.
|
||||
// It executes the same request but uses ctx for cancellation and deadlines.
|
||||
// See https://core.telegram.org/bots/api#unhidegeneralforumtopic
|
||||
func (api *API) UnhideGeneralForumTopicWithContext(ctx context.Context, params BaseGeneralForumTopicP) (bool, error) {
|
||||
func (api *API) UnhideGeneralForumTopicWithContext(ctx context.Context, params BaseGeneralForumTopic) (bool, error) {
|
||||
req := NewRequestWithChatID[bool]("unhideGeneralForumTopic", params, params.ChatID)
|
||||
return req.DoWithContext(ctx, api)
|
||||
}
|
||||
@@ -231,7 +231,7 @@ func (api *API) UnhideGeneralForumTopicWithContext(ctx context.Context, params B
|
||||
// UnpinAllGeneralForumTopicMessages clears the list of pinned messages in the 'General' topic.
|
||||
// Returns True on success.
|
||||
// See https://core.telegram.org/bots/api#unpinallgeneralforumtopicmessages
|
||||
func (api *API) UnpinAllGeneralForumTopicMessages(params BaseGeneralForumTopicP) (bool, error) {
|
||||
func (api *API) UnpinAllGeneralForumTopicMessages(params BaseGeneralForumTopic) (bool, error) {
|
||||
req := NewRequestWithChatID[bool]("unpinAllGeneralForumTopicMessages", params, params.ChatID)
|
||||
return req.Do(api)
|
||||
}
|
||||
@@ -239,7 +239,7 @@ func (api *API) UnpinAllGeneralForumTopicMessages(params BaseGeneralForumTopicP)
|
||||
// UnpinAllGeneralForumTopicMessagesWithContext is the context-aware variant of UnpinAllGeneralForumTopicMessages.
|
||||
// It executes the same request but uses ctx for cancellation and deadlines.
|
||||
// See https://core.telegram.org/bots/api#unpinallgeneralforumtopicmessages
|
||||
func (api *API) UnpinAllGeneralForumTopicMessagesWithContext(ctx context.Context, params BaseGeneralForumTopicP) (bool, error) {
|
||||
func (api *API) UnpinAllGeneralForumTopicMessagesWithContext(ctx context.Context, params BaseGeneralForumTopic) (bool, error) {
|
||||
req := NewRequestWithChatID[bool]("unpinAllGeneralForumTopicMessages", params, params.ChatID)
|
||||
return req.DoWithContext(ctx, api)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user