From c929a4ee07b9cac249f5c5d20f71376c2078a322 Mon Sep 17 00:00:00 2001 From: GitHub Date: Fri, 29 Sep 2023 07:45:56 +0000 Subject: [PATCH] feat(schema): update Telegram to the latest layer --- _schema/layer.tl | 6 +- _schema/tdesktop.tl | 8 +- _schema/telegram.tl | 12 +- tg/tl_messages_get_web_page_gen.go | 26 +-- tg/tl_messages_web_page_gen.go | 271 ++++++++++++++++++++++++++ tg/tl_messages_web_page_slices_gen.go | 35 ++++ tg/tl_registry_gen.go | 9 +- tg/tl_server_gen.go | 4 +- tg/tl_stories_boosts_status_gen.go | 57 ++++-- 9 files changed, 384 insertions(+), 44 deletions(-) create mode 100644 tg/tl_messages_web_page_gen.go create mode 100644 tg/tl_messages_web_page_slices_gen.go diff --git a/_schema/layer.tl b/_schema/layer.tl index 8945abf234..020ade4d99 100644 --- a/_schema/layer.tl +++ b/_schema/layer.tl @@ -1,7 +1,7 @@ // Code generated by ./cmd/dltl, DO NOT EDIT. // // Source: https://raw.githubusercontent.com/telegramdesktop/tdesktop/dev/Telegram/SourceFiles/mtproto/scheme/layer.tl -// Layer: 164 -// SHA256: afad7b84b167df8c1ae10baceb4c995a05669ddc2f3b0faaef09b434192da87e +// Layer: 165 +// SHA256: 36b1cc02020b7961dbbce32a3b05ecc9409c447b0b202854a07c47676c665fa9 -// LAYER 164 +// LAYER 165 diff --git a/_schema/tdesktop.tl b/_schema/tdesktop.tl index b74f824fec..03fee6297c 100644 --- a/_schema/tdesktop.tl +++ b/_schema/tdesktop.tl @@ -1,7 +1,7 @@ // Code generated by ./cmd/dltl, DO NOT EDIT. // // Source: https://raw.githubusercontent.com/telegramdesktop/tdesktop/dev/Telegram/SourceFiles/mtproto/scheme/api.tl -// SHA256: 6e8d27f2272e93ffe7a7890e57b6a5aef7b36687850bc4e3a1388582fc22e633 +// SHA256: 7bbf14403a05d0a385f4338ebfb196a278521b7f7e90881be20091de11ccd8ab boolFalse#bc799737 = Bool; @@ -2301,7 +2301,7 @@ peerStories#9a35e999 flags:# peer:Peer max_read_id:flags.0?int stories:Vector users:Vector = stories.PeerStories; -stories.boostsStatus#66ea1fef flags:# my_boost:flags.2?true level:int current_level_boosts:int boosts:int next_level_boosts:flags.0?int premium_audience:flags.1?StatsPercentValue = stories.BoostsStatus; +stories.boostsStatus#e5c1aa5c flags:# my_boost:flags.2?true level:int current_level_boosts:int boosts:int next_level_boosts:flags.0?int premium_audience:flags.1?StatsPercentValue boost_url:string = stories.BoostsStatus; stories.canApplyBoostOk#c3173587 = stories.CanApplyBoostResult; @@ -2311,6 +2311,8 @@ booster#e9e6380 user_id:long expires:int = Booster; stories.boostersList#f3dd3d1d flags:# count:int boosters:Vector next_offset:flags.0?string users:Vector = stories.BoostersList; +messages.webPage#fd5e12bd webpage:WebPage chats:Vector users:Vector = messages.WebPage; + ---functions--- @@ -2756,7 +2758,7 @@ messages.getInlineGameHighScores#f635e1b id:InputBotInlineMessageID user_id:Inpu messages.getCommonChats#e40ca104 user_id:InputUser max_id:long limit:int = messages.Chats; -messages.getWebPage#32ca8f91 url:string hash:int = WebPage; +messages.getWebPage#8d9692a3 url:string hash:int = messages.WebPage; messages.toggleDialogPin#a731e257 flags:# pinned:flags.0?true peer:InputDialogPeer = Bool; diff --git a/_schema/telegram.tl b/_schema/telegram.tl index 5eb1e79f74..5c33435721 100644 --- a/_schema/telegram.tl +++ b/_schema/telegram.tl @@ -2,8 +2,8 @@ // // Source: https://raw.githubusercontent.com/telegramdesktop/tdesktop/dev/Telegram/SourceFiles/mtproto/scheme/api.tl // Merge: _schema/legacy.tl,_schema/layer.tl -// Layer: 164 -// SHA256: 6e8d27f2272e93ffe7a7890e57b6a5aef7b36687850bc4e3a1388582fc22e633 +// Layer: 165 +// SHA256: 7bbf14403a05d0a385f4338ebfb196a278521b7f7e90881be20091de11ccd8ab boolFalse#bc799737 = Bool; @@ -2303,7 +2303,7 @@ peerStories#9a35e999 flags:# peer:Peer max_read_id:flags.0?int stories:Vector users:Vector = stories.PeerStories; -stories.boostsStatus#66ea1fef flags:# my_boost:flags.2?true level:int current_level_boosts:int boosts:int next_level_boosts:flags.0?int premium_audience:flags.1?StatsPercentValue = stories.BoostsStatus; +stories.boostsStatus#e5c1aa5c flags:# my_boost:flags.2?true level:int current_level_boosts:int boosts:int next_level_boosts:flags.0?int premium_audience:flags.1?StatsPercentValue boost_url:string = stories.BoostsStatus; stories.canApplyBoostOk#c3173587 = stories.CanApplyBoostResult; @@ -2313,6 +2313,8 @@ booster#e9e6380 user_id:long expires:int = Booster; stories.boostersList#f3dd3d1d flags:# count:int boosters:Vector next_offset:flags.0?string users:Vector = stories.BoostersList; +messages.webPage#fd5e12bd webpage:WebPage chats:Vector users:Vector = messages.WebPage; + ---functions--- @@ -2758,7 +2760,7 @@ messages.getInlineGameHighScores#f635e1b id:InputBotInlineMessageID user_id:Inpu messages.getCommonChats#e40ca104 user_id:InputUser max_id:long limit:int = messages.Chats; -messages.getWebPage#32ca8f91 url:string hash:int = WebPage; +messages.getWebPage#8d9692a3 url:string hash:int = messages.WebPage; messages.toggleDialogPin#a731e257 flags:# pinned:flags.0?true peer:InputDialogPeer = Bool; @@ -3436,4 +3438,4 @@ test.useError#ee75af01 = Error; test.useConfigSimple#f9b7b23d = help.ConfigSimple; -// LAYER 164 +// LAYER 165 diff --git a/tg/tl_messages_get_web_page_gen.go b/tg/tl_messages_get_web_page_gen.go index 9acc5ecf03..fe59f1a173 100644 --- a/tg/tl_messages_get_web_page_gen.go +++ b/tg/tl_messages_get_web_page_gen.go @@ -31,7 +31,7 @@ var ( _ = tdjson.Encoder{} ) -// MessagesGetWebPageRequest represents TL type `messages.getWebPage#32ca8f91`. +// MessagesGetWebPageRequest represents TL type `messages.getWebPage#8d9692a3`. // Get instant view¹ page // // Links: @@ -49,7 +49,7 @@ type MessagesGetWebPageRequest struct { } // MessagesGetWebPageRequestTypeID is TL type id of MessagesGetWebPageRequest. -const MessagesGetWebPageRequestTypeID = 0x32ca8f91 +const MessagesGetWebPageRequestTypeID = 0x8d9692a3 // Ensuring interfaces in compile-time for MessagesGetWebPageRequest. var ( @@ -129,7 +129,7 @@ func (g *MessagesGetWebPageRequest) TypeInfo() tdp.Type { // Encode implements bin.Encoder. func (g *MessagesGetWebPageRequest) Encode(b *bin.Buffer) error { if g == nil { - return fmt.Errorf("can't encode messages.getWebPage#32ca8f91 as nil") + return fmt.Errorf("can't encode messages.getWebPage#8d9692a3 as nil") } b.PutID(MessagesGetWebPageRequestTypeID) return g.EncodeBare(b) @@ -138,7 +138,7 @@ func (g *MessagesGetWebPageRequest) Encode(b *bin.Buffer) error { // EncodeBare implements bin.BareEncoder. func (g *MessagesGetWebPageRequest) EncodeBare(b *bin.Buffer) error { if g == nil { - return fmt.Errorf("can't encode messages.getWebPage#32ca8f91 as nil") + return fmt.Errorf("can't encode messages.getWebPage#8d9692a3 as nil") } b.PutString(g.URL) b.PutInt(g.Hash) @@ -148,10 +148,10 @@ func (g *MessagesGetWebPageRequest) EncodeBare(b *bin.Buffer) error { // Decode implements bin.Decoder. func (g *MessagesGetWebPageRequest) Decode(b *bin.Buffer) error { if g == nil { - return fmt.Errorf("can't decode messages.getWebPage#32ca8f91 to nil") + return fmt.Errorf("can't decode messages.getWebPage#8d9692a3 to nil") } if err := b.ConsumeID(MessagesGetWebPageRequestTypeID); err != nil { - return fmt.Errorf("unable to decode messages.getWebPage#32ca8f91: %w", err) + return fmt.Errorf("unable to decode messages.getWebPage#8d9692a3: %w", err) } return g.DecodeBare(b) } @@ -159,19 +159,19 @@ func (g *MessagesGetWebPageRequest) Decode(b *bin.Buffer) error { // DecodeBare implements bin.BareDecoder. func (g *MessagesGetWebPageRequest) DecodeBare(b *bin.Buffer) error { if g == nil { - return fmt.Errorf("can't decode messages.getWebPage#32ca8f91 to nil") + return fmt.Errorf("can't decode messages.getWebPage#8d9692a3 to nil") } { value, err := b.String() if err != nil { - return fmt.Errorf("unable to decode messages.getWebPage#32ca8f91: field url: %w", err) + return fmt.Errorf("unable to decode messages.getWebPage#8d9692a3: field url: %w", err) } g.URL = value } { value, err := b.Int() if err != nil { - return fmt.Errorf("unable to decode messages.getWebPage#32ca8f91: field hash: %w", err) + return fmt.Errorf("unable to decode messages.getWebPage#8d9692a3: field hash: %w", err) } g.Hash = value } @@ -194,7 +194,7 @@ func (g *MessagesGetWebPageRequest) GetHash() (value int) { return g.Hash } -// MessagesGetWebPage invokes method messages.getWebPage#32ca8f91 returning error if any. +// MessagesGetWebPage invokes method messages.getWebPage#8d9692a3 returning error if any. // Get instant view¹ page // // Links: @@ -205,11 +205,11 @@ func (g *MessagesGetWebPageRequest) GetHash() (value int) { // 400 WC_CONVERT_URL_INVALID: WC convert URL invalid. // // See https://core.telegram.org/method/messages.getWebPage for reference. -func (c *Client) MessagesGetWebPage(ctx context.Context, request *MessagesGetWebPageRequest) (WebPageClass, error) { - var result WebPageBox +func (c *Client) MessagesGetWebPage(ctx context.Context, request *MessagesGetWebPageRequest) (*MessagesWebPage, error) { + var result MessagesWebPage if err := c.rpc.Invoke(ctx, request, &result); err != nil { return nil, err } - return result.WebPage, nil + return &result, nil } diff --git a/tg/tl_messages_web_page_gen.go b/tg/tl_messages_web_page_gen.go new file mode 100644 index 0000000000..2849bc7bec --- /dev/null +++ b/tg/tl_messages_web_page_gen.go @@ -0,0 +1,271 @@ +// Code generated by gotdgen, DO NOT EDIT. + +package tg + +import ( + "context" + "errors" + "fmt" + "sort" + "strings" + + "go.uber.org/multierr" + + "github.com/gotd/td/bin" + "github.com/gotd/td/tdjson" + "github.com/gotd/td/tdp" + "github.com/gotd/td/tgerr" +) + +// No-op definition for keeping imports. +var ( + _ = bin.Buffer{} + _ = context.Background() + _ = fmt.Stringer(nil) + _ = strings.Builder{} + _ = errors.Is + _ = multierr.AppendInto + _ = sort.Ints + _ = tdp.Format + _ = tgerr.Error{} + _ = tdjson.Encoder{} +) + +// MessagesWebPage represents TL type `messages.webPage#fd5e12bd`. +// +// See https://core.telegram.org/constructor/messages.webPage for reference. +type MessagesWebPage struct { + // Webpage field of MessagesWebPage. + Webpage WebPageClass + // Chats field of MessagesWebPage. + Chats []ChatClass + // Users field of MessagesWebPage. + Users []UserClass +} + +// MessagesWebPageTypeID is TL type id of MessagesWebPage. +const MessagesWebPageTypeID = 0xfd5e12bd + +// Ensuring interfaces in compile-time for MessagesWebPage. +var ( + _ bin.Encoder = &MessagesWebPage{} + _ bin.Decoder = &MessagesWebPage{} + _ bin.BareEncoder = &MessagesWebPage{} + _ bin.BareDecoder = &MessagesWebPage{} +) + +func (w *MessagesWebPage) Zero() bool { + if w == nil { + return true + } + if !(w.Webpage == nil) { + return false + } + if !(w.Chats == nil) { + return false + } + if !(w.Users == nil) { + return false + } + + return true +} + +// String implements fmt.Stringer. +func (w *MessagesWebPage) String() string { + if w == nil { + return "MessagesWebPage(nil)" + } + type Alias MessagesWebPage + return fmt.Sprintf("MessagesWebPage%+v", Alias(*w)) +} + +// FillFrom fills MessagesWebPage from given interface. +func (w *MessagesWebPage) FillFrom(from interface { + GetWebpage() (value WebPageClass) + GetChats() (value []ChatClass) + GetUsers() (value []UserClass) +}) { + w.Webpage = from.GetWebpage() + w.Chats = from.GetChats() + w.Users = from.GetUsers() +} + +// TypeID returns type id in TL schema. +// +// See https://core.telegram.org/mtproto/TL-tl#remarks. +func (*MessagesWebPage) TypeID() uint32 { + return MessagesWebPageTypeID +} + +// TypeName returns name of type in TL schema. +func (*MessagesWebPage) TypeName() string { + return "messages.webPage" +} + +// TypeInfo returns info about TL type. +func (w *MessagesWebPage) TypeInfo() tdp.Type { + typ := tdp.Type{ + Name: "messages.webPage", + ID: MessagesWebPageTypeID, + } + if w == nil { + typ.Null = true + return typ + } + typ.Fields = []tdp.Field{ + { + Name: "Webpage", + SchemaName: "webpage", + }, + { + Name: "Chats", + SchemaName: "chats", + }, + { + Name: "Users", + SchemaName: "users", + }, + } + return typ +} + +// Encode implements bin.Encoder. +func (w *MessagesWebPage) Encode(b *bin.Buffer) error { + if w == nil { + return fmt.Errorf("can't encode messages.webPage#fd5e12bd as nil") + } + b.PutID(MessagesWebPageTypeID) + return w.EncodeBare(b) +} + +// EncodeBare implements bin.BareEncoder. +func (w *MessagesWebPage) EncodeBare(b *bin.Buffer) error { + if w == nil { + return fmt.Errorf("can't encode messages.webPage#fd5e12bd as nil") + } + if w.Webpage == nil { + return fmt.Errorf("unable to encode messages.webPage#fd5e12bd: field webpage is nil") + } + if err := w.Webpage.Encode(b); err != nil { + return fmt.Errorf("unable to encode messages.webPage#fd5e12bd: field webpage: %w", err) + } + b.PutVectorHeader(len(w.Chats)) + for idx, v := range w.Chats { + if v == nil { + return fmt.Errorf("unable to encode messages.webPage#fd5e12bd: field chats element with index %d is nil", idx) + } + if err := v.Encode(b); err != nil { + return fmt.Errorf("unable to encode messages.webPage#fd5e12bd: field chats element with index %d: %w", idx, err) + } + } + b.PutVectorHeader(len(w.Users)) + for idx, v := range w.Users { + if v == nil { + return fmt.Errorf("unable to encode messages.webPage#fd5e12bd: field users element with index %d is nil", idx) + } + if err := v.Encode(b); err != nil { + return fmt.Errorf("unable to encode messages.webPage#fd5e12bd: field users element with index %d: %w", idx, err) + } + } + return nil +} + +// Decode implements bin.Decoder. +func (w *MessagesWebPage) Decode(b *bin.Buffer) error { + if w == nil { + return fmt.Errorf("can't decode messages.webPage#fd5e12bd to nil") + } + if err := b.ConsumeID(MessagesWebPageTypeID); err != nil { + return fmt.Errorf("unable to decode messages.webPage#fd5e12bd: %w", err) + } + return w.DecodeBare(b) +} + +// DecodeBare implements bin.BareDecoder. +func (w *MessagesWebPage) DecodeBare(b *bin.Buffer) error { + if w == nil { + return fmt.Errorf("can't decode messages.webPage#fd5e12bd to nil") + } + { + value, err := DecodeWebPage(b) + if err != nil { + return fmt.Errorf("unable to decode messages.webPage#fd5e12bd: field webpage: %w", err) + } + w.Webpage = value + } + { + headerLen, err := b.VectorHeader() + if err != nil { + return fmt.Errorf("unable to decode messages.webPage#fd5e12bd: field chats: %w", err) + } + + if headerLen > 0 { + w.Chats = make([]ChatClass, 0, headerLen%bin.PreallocateLimit) + } + for idx := 0; idx < headerLen; idx++ { + value, err := DecodeChat(b) + if err != nil { + return fmt.Errorf("unable to decode messages.webPage#fd5e12bd: field chats: %w", err) + } + w.Chats = append(w.Chats, value) + } + } + { + headerLen, err := b.VectorHeader() + if err != nil { + return fmt.Errorf("unable to decode messages.webPage#fd5e12bd: field users: %w", err) + } + + if headerLen > 0 { + w.Users = make([]UserClass, 0, headerLen%bin.PreallocateLimit) + } + for idx := 0; idx < headerLen; idx++ { + value, err := DecodeUser(b) + if err != nil { + return fmt.Errorf("unable to decode messages.webPage#fd5e12bd: field users: %w", err) + } + w.Users = append(w.Users, value) + } + } + return nil +} + +// GetWebpage returns value of Webpage field. +func (w *MessagesWebPage) GetWebpage() (value WebPageClass) { + if w == nil { + return + } + return w.Webpage +} + +// GetChats returns value of Chats field. +func (w *MessagesWebPage) GetChats() (value []ChatClass) { + if w == nil { + return + } + return w.Chats +} + +// GetUsers returns value of Users field. +func (w *MessagesWebPage) GetUsers() (value []UserClass) { + if w == nil { + return + } + return w.Users +} + +// GetWebpageAsModified returns mapped value of Webpage field. +func (w *MessagesWebPage) GetWebpageAsModified() (ModifiedWebPage, bool) { + return w.Webpage.AsModified() +} + +// MapChats returns field Chats wrapped in ChatClassArray helper. +func (w *MessagesWebPage) MapChats() (value ChatClassArray) { + return ChatClassArray(w.Chats) +} + +// MapUsers returns field Users wrapped in UserClassArray helper. +func (w *MessagesWebPage) MapUsers() (value UserClassArray) { + return UserClassArray(w.Users) +} diff --git a/tg/tl_messages_web_page_slices_gen.go b/tg/tl_messages_web_page_slices_gen.go new file mode 100644 index 0000000000..fe21471a4c --- /dev/null +++ b/tg/tl_messages_web_page_slices_gen.go @@ -0,0 +1,35 @@ +//go:build !no_gotd_slices +// +build !no_gotd_slices + +// Code generated by gotdgen, DO NOT EDIT. + +package tg + +import ( + "context" + "errors" + "fmt" + "sort" + "strings" + + "go.uber.org/multierr" + + "github.com/gotd/td/bin" + "github.com/gotd/td/tdjson" + "github.com/gotd/td/tdp" + "github.com/gotd/td/tgerr" +) + +// No-op definition for keeping imports. +var ( + _ = bin.Buffer{} + _ = context.Background() + _ = fmt.Stringer(nil) + _ = strings.Builder{} + _ = errors.Is + _ = multierr.AppendInto + _ = sort.Ints + _ = tdp.Format + _ = tgerr.Error{} + _ = tdjson.Encoder{} +) diff --git a/tg/tl_registry_gen.go b/tg/tl_registry_gen.go index 8b618bae4f..a0feb02472 100644 --- a/tg/tl_registry_gen.go +++ b/tg/tl_registry_gen.go @@ -32,7 +32,7 @@ var ( ) // Layer version of schema. -const Layer = 164 +const Layer = 165 // TypesMap returns mapping from type ids to TL type names. func TypesMap() map[uint32]string { @@ -1186,11 +1186,12 @@ func TypesMap() map[uint32]string { MediaAreaSuggestedReactionTypeID: "mediaAreaSuggestedReaction#14455871", PeerStoriesTypeID: "peerStories#9a35e999", StoriesPeerStoriesTypeID: "stories.peerStories#cae68768", - StoriesBoostsStatusTypeID: "stories.boostsStatus#66ea1fef", + StoriesBoostsStatusTypeID: "stories.boostsStatus#e5c1aa5c", StoriesCanApplyBoostOkTypeID: "stories.canApplyBoostOk#c3173587", StoriesCanApplyBoostReplaceTypeID: "stories.canApplyBoostReplace#712c4655", BoosterTypeID: "booster#e9e6380", StoriesBoostersListTypeID: "stories.boostersList#f3dd3d1d", + MessagesWebPageTypeID: "messages.webPage#fd5e12bd", InvokeAfterMsgRequestTypeID: "invokeAfterMsg#cb9f372d", InvokeAfterMsgsRequestTypeID: "invokeAfterMsgs#3dc4b4f0", InitConnectionRequestTypeID: "initConnection#c1cd5ea9", @@ -1412,7 +1413,7 @@ func TypesMap() map[uint32]string { MessagesGetGameHighScoresRequestTypeID: "messages.getGameHighScores#e822649d", MessagesGetInlineGameHighScoresRequestTypeID: "messages.getInlineGameHighScores#f635e1b", MessagesGetCommonChatsRequestTypeID: "messages.getCommonChats#e40ca104", - MessagesGetWebPageRequestTypeID: "messages.getWebPage#32ca8f91", + MessagesGetWebPageRequestTypeID: "messages.getWebPage#8d9692a3", MessagesToggleDialogPinRequestTypeID: "messages.toggleDialogPin#a731e257", MessagesReorderPinnedDialogsRequestTypeID: "messages.reorderPinnedDialogs#3b1adf37", MessagesGetPinnedDialogsRequestTypeID: "messages.getPinnedDialogs#d6b94df2", @@ -2908,6 +2909,7 @@ func NamesMap() map[string]uint32 { "stories.canApplyBoostReplace": StoriesCanApplyBoostReplaceTypeID, "booster": BoosterTypeID, "stories.boostersList": StoriesBoostersListTypeID, + "messages.webPage": MessagesWebPageTypeID, "invokeAfterMsg": InvokeAfterMsgRequestTypeID, "invokeAfterMsgs": InvokeAfterMsgsRequestTypeID, "initConnection": InitConnectionRequestTypeID, @@ -4625,6 +4627,7 @@ func TypesConstructorMap() map[uint32]func() bin.Object { StoriesCanApplyBoostReplaceTypeID: func() bin.Object { return &StoriesCanApplyBoostReplace{} }, BoosterTypeID: func() bin.Object { return &Booster{} }, StoriesBoostersListTypeID: func() bin.Object { return &StoriesBoostersList{} }, + MessagesWebPageTypeID: func() bin.Object { return &MessagesWebPage{} }, InvokeAfterMsgRequestTypeID: func() bin.Object { return &InvokeAfterMsgRequest{} }, InvokeAfterMsgsRequestTypeID: func() bin.Object { return &InvokeAfterMsgsRequest{} }, InitConnectionRequestTypeID: func() bin.Object { return &InitConnectionRequest{} }, diff --git a/tg/tl_server_gen.go b/tg/tl_server_gen.go index 81db10f5da..48b816845a 100644 --- a/tg/tl_server_gen.go +++ b/tg/tl_server_gen.go @@ -3999,7 +3999,7 @@ func (s *ServerDispatcher) OnMessagesGetCommonChats(f func(ctx context.Context, s.handlers[MessagesGetCommonChatsRequestTypeID] = handler } -func (s *ServerDispatcher) OnMessagesGetWebPage(f func(ctx context.Context, request *MessagesGetWebPageRequest) (WebPageClass, error)) { +func (s *ServerDispatcher) OnMessagesGetWebPage(f func(ctx context.Context, request *MessagesGetWebPageRequest) (*MessagesWebPage, error)) { handler := func(ctx context.Context, b *bin.Buffer) (bin.Encoder, error) { var request MessagesGetWebPageRequest if err := request.Decode(b); err != nil { @@ -4010,7 +4010,7 @@ func (s *ServerDispatcher) OnMessagesGetWebPage(f func(ctx context.Context, requ if err != nil { return nil, err } - return &WebPageBox{WebPage: response}, nil + return response, nil } s.handlers[MessagesGetWebPageRequestTypeID] = handler diff --git a/tg/tl_stories_boosts_status_gen.go b/tg/tl_stories_boosts_status_gen.go index 05788ba097..0f884e8d57 100644 --- a/tg/tl_stories_boosts_status_gen.go +++ b/tg/tl_stories_boosts_status_gen.go @@ -31,7 +31,7 @@ var ( _ = tdjson.Encoder{} ) -// StoriesBoostsStatus represents TL type `stories.boostsStatus#66ea1fef`. +// StoriesBoostsStatus represents TL type `stories.boostsStatus#e5c1aa5c`. // // See https://core.telegram.org/constructor/stories.boostsStatus for reference. type StoriesBoostsStatus struct { @@ -53,10 +53,12 @@ type StoriesBoostsStatus struct { // // Use SetPremiumAudience and GetPremiumAudience helpers. PremiumAudience StatsPercentValue + // BoostURL field of StoriesBoostsStatus. + BoostURL string } // StoriesBoostsStatusTypeID is TL type id of StoriesBoostsStatus. -const StoriesBoostsStatusTypeID = 0x66ea1fef +const StoriesBoostsStatusTypeID = 0xe5c1aa5c // Ensuring interfaces in compile-time for StoriesBoostsStatus. var ( @@ -91,6 +93,9 @@ func (b *StoriesBoostsStatus) Zero() bool { if !(b.PremiumAudience.Zero()) { return false } + if !(b.BoostURL == "") { + return false + } return true } @@ -112,6 +117,7 @@ func (b *StoriesBoostsStatus) FillFrom(from interface { GetBoosts() (value int) GetNextLevelBoosts() (value int, ok bool) GetPremiumAudience() (value StatsPercentValue, ok bool) + GetBoostURL() (value string) }) { b.MyBoost = from.GetMyBoost() b.Level = from.GetLevel() @@ -125,6 +131,7 @@ func (b *StoriesBoostsStatus) FillFrom(from interface { b.PremiumAudience = val } + b.BoostURL = from.GetBoostURL() } // TypeID returns type id in TL schema. @@ -177,6 +184,10 @@ func (b *StoriesBoostsStatus) TypeInfo() tdp.Type { SchemaName: "premium_audience", Null: !b.Flags.Has(1), }, + { + Name: "BoostURL", + SchemaName: "boost_url", + }, } return typ } @@ -197,7 +208,7 @@ func (b *StoriesBoostsStatus) SetFlags() { // Encode implements bin.Encoder. func (b *StoriesBoostsStatus) Encode(buf *bin.Buffer) error { if b == nil { - return fmt.Errorf("can't encode stories.boostsStatus#66ea1fef as nil") + return fmt.Errorf("can't encode stories.boostsStatus#e5c1aa5c as nil") } buf.PutID(StoriesBoostsStatusTypeID) return b.EncodeBare(buf) @@ -206,11 +217,11 @@ func (b *StoriesBoostsStatus) Encode(buf *bin.Buffer) error { // EncodeBare implements bin.BareEncoder. func (b *StoriesBoostsStatus) EncodeBare(buf *bin.Buffer) error { if b == nil { - return fmt.Errorf("can't encode stories.boostsStatus#66ea1fef as nil") + return fmt.Errorf("can't encode stories.boostsStatus#e5c1aa5c as nil") } b.SetFlags() if err := b.Flags.Encode(buf); err != nil { - return fmt.Errorf("unable to encode stories.boostsStatus#66ea1fef: field flags: %w", err) + return fmt.Errorf("unable to encode stories.boostsStatus#e5c1aa5c: field flags: %w", err) } buf.PutInt(b.Level) buf.PutInt(b.CurrentLevelBoosts) @@ -220,19 +231,20 @@ func (b *StoriesBoostsStatus) EncodeBare(buf *bin.Buffer) error { } if b.Flags.Has(1) { if err := b.PremiumAudience.Encode(buf); err != nil { - return fmt.Errorf("unable to encode stories.boostsStatus#66ea1fef: field premium_audience: %w", err) + return fmt.Errorf("unable to encode stories.boostsStatus#e5c1aa5c: field premium_audience: %w", err) } } + buf.PutString(b.BoostURL) return nil } // Decode implements bin.Decoder. func (b *StoriesBoostsStatus) Decode(buf *bin.Buffer) error { if b == nil { - return fmt.Errorf("can't decode stories.boostsStatus#66ea1fef to nil") + return fmt.Errorf("can't decode stories.boostsStatus#e5c1aa5c to nil") } if err := buf.ConsumeID(StoriesBoostsStatusTypeID); err != nil { - return fmt.Errorf("unable to decode stories.boostsStatus#66ea1fef: %w", err) + return fmt.Errorf("unable to decode stories.boostsStatus#e5c1aa5c: %w", err) } return b.DecodeBare(buf) } @@ -240,47 +252,54 @@ func (b *StoriesBoostsStatus) Decode(buf *bin.Buffer) error { // DecodeBare implements bin.BareDecoder. func (b *StoriesBoostsStatus) DecodeBare(buf *bin.Buffer) error { if b == nil { - return fmt.Errorf("can't decode stories.boostsStatus#66ea1fef to nil") + return fmt.Errorf("can't decode stories.boostsStatus#e5c1aa5c to nil") } { if err := b.Flags.Decode(buf); err != nil { - return fmt.Errorf("unable to decode stories.boostsStatus#66ea1fef: field flags: %w", err) + return fmt.Errorf("unable to decode stories.boostsStatus#e5c1aa5c: field flags: %w", err) } } b.MyBoost = b.Flags.Has(2) { value, err := buf.Int() if err != nil { - return fmt.Errorf("unable to decode stories.boostsStatus#66ea1fef: field level: %w", err) + return fmt.Errorf("unable to decode stories.boostsStatus#e5c1aa5c: field level: %w", err) } b.Level = value } { value, err := buf.Int() if err != nil { - return fmt.Errorf("unable to decode stories.boostsStatus#66ea1fef: field current_level_boosts: %w", err) + return fmt.Errorf("unable to decode stories.boostsStatus#e5c1aa5c: field current_level_boosts: %w", err) } b.CurrentLevelBoosts = value } { value, err := buf.Int() if err != nil { - return fmt.Errorf("unable to decode stories.boostsStatus#66ea1fef: field boosts: %w", err) + return fmt.Errorf("unable to decode stories.boostsStatus#e5c1aa5c: field boosts: %w", err) } b.Boosts = value } if b.Flags.Has(0) { value, err := buf.Int() if err != nil { - return fmt.Errorf("unable to decode stories.boostsStatus#66ea1fef: field next_level_boosts: %w", err) + return fmt.Errorf("unable to decode stories.boostsStatus#e5c1aa5c: field next_level_boosts: %w", err) } b.NextLevelBoosts = value } if b.Flags.Has(1) { if err := b.PremiumAudience.Decode(buf); err != nil { - return fmt.Errorf("unable to decode stories.boostsStatus#66ea1fef: field premium_audience: %w", err) + return fmt.Errorf("unable to decode stories.boostsStatus#e5c1aa5c: field premium_audience: %w", err) } } + { + value, err := buf.String() + if err != nil { + return fmt.Errorf("unable to decode stories.boostsStatus#e5c1aa5c: field boost_url: %w", err) + } + b.BoostURL = value + } return nil } @@ -362,3 +381,11 @@ func (b *StoriesBoostsStatus) GetPremiumAudience() (value StatsPercentValue, ok } return b.PremiumAudience, true } + +// GetBoostURL returns value of BoostURL field. +func (b *StoriesBoostsStatus) GetBoostURL() (value string) { + if b == nil { + return + } + return b.BoostURL +}