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"
)
var (
_ = bin .Buffer {}
_ = context .Background ()
_ = fmt .Stringer (nil )
_ = strings .Builder {}
_ = errors .Is
_ = multierr .AppendInto
_ = sort .Ints
_ = tdp .Format
_ = tgerr .Error {}
_ = tdjson .Encoder {}
)
type RecentMeURLUnknown struct {
URL string
}
const RecentMeURLUnknownTypeID = 0x46e1d13d
func (r RecentMeURLUnknown ) construct () RecentMeURLClass { return &r }
var (
_ bin .Encoder = &RecentMeURLUnknown {}
_ bin .Decoder = &RecentMeURLUnknown {}
_ bin .BareEncoder = &RecentMeURLUnknown {}
_ bin .BareDecoder = &RecentMeURLUnknown {}
_ RecentMeURLClass = &RecentMeURLUnknown {}
)
func (r *RecentMeURLUnknown ) Zero () bool {
if r == nil {
return true
}
if !(r .URL == "" ) {
return false
}
return true
}
func (r *RecentMeURLUnknown ) String () string {
if r == nil {
return "RecentMeURLUnknown(nil)"
}
type Alias RecentMeURLUnknown
return fmt .Sprintf ("RecentMeURLUnknown%+v" , Alias (*r ))
}
func (r *RecentMeURLUnknown ) FillFrom (from interface {
GetURL () (value string )
}) {
r .URL = from .GetURL ()
}
func (*RecentMeURLUnknown ) TypeID () uint32 {
return RecentMeURLUnknownTypeID
}
func (*RecentMeURLUnknown ) TypeName () string {
return "recentMeUrlUnknown"
}
func (r *RecentMeURLUnknown ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "recentMeUrlUnknown" ,
ID : RecentMeURLUnknownTypeID ,
}
if r == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "URL" ,
SchemaName : "url" ,
},
}
return typ
}
func (r *RecentMeURLUnknown ) Encode (b *bin .Buffer ) error {
if r == nil {
return fmt .Errorf ("can't encode recentMeUrlUnknown#46e1d13d as nil" )
}
b .PutID (RecentMeURLUnknownTypeID )
return r .EncodeBare (b )
}
func (r *RecentMeURLUnknown ) EncodeBare (b *bin .Buffer ) error {
if r == nil {
return fmt .Errorf ("can't encode recentMeUrlUnknown#46e1d13d as nil" )
}
b .PutString (r .URL )
return nil
}
func (r *RecentMeURLUnknown ) Decode (b *bin .Buffer ) error {
if r == nil {
return fmt .Errorf ("can't decode recentMeUrlUnknown#46e1d13d to nil" )
}
if err := b .ConsumeID (RecentMeURLUnknownTypeID ); err != nil {
return fmt .Errorf ("unable to decode recentMeUrlUnknown#46e1d13d: %w" , err )
}
return r .DecodeBare (b )
}
func (r *RecentMeURLUnknown ) DecodeBare (b *bin .Buffer ) error {
if r == nil {
return fmt .Errorf ("can't decode recentMeUrlUnknown#46e1d13d to nil" )
}
{
value , err := b .String ()
if err != nil {
return fmt .Errorf ("unable to decode recentMeUrlUnknown#46e1d13d: field url: %w" , err )
}
r .URL = value
}
return nil
}
func (r *RecentMeURLUnknown ) GetURL () (value string ) {
if r == nil {
return
}
return r .URL
}
type RecentMeURLUser struct {
URL string
UserID int64
}
const RecentMeURLUserTypeID = 0xb92c09e2
func (r RecentMeURLUser ) construct () RecentMeURLClass { return &r }
var (
_ bin .Encoder = &RecentMeURLUser {}
_ bin .Decoder = &RecentMeURLUser {}
_ bin .BareEncoder = &RecentMeURLUser {}
_ bin .BareDecoder = &RecentMeURLUser {}
_ RecentMeURLClass = &RecentMeURLUser {}
)
func (r *RecentMeURLUser ) Zero () bool {
if r == nil {
return true
}
if !(r .URL == "" ) {
return false
}
if !(r .UserID == 0 ) {
return false
}
return true
}
func (r *RecentMeURLUser ) String () string {
if r == nil {
return "RecentMeURLUser(nil)"
}
type Alias RecentMeURLUser
return fmt .Sprintf ("RecentMeURLUser%+v" , Alias (*r ))
}
func (r *RecentMeURLUser ) FillFrom (from interface {
GetURL () (value string )
GetUserID () (value int64 )
}) {
r .URL = from .GetURL ()
r .UserID = from .GetUserID ()
}
func (*RecentMeURLUser ) TypeID () uint32 {
return RecentMeURLUserTypeID
}
func (*RecentMeURLUser ) TypeName () string {
return "recentMeUrlUser"
}
func (r *RecentMeURLUser ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "recentMeUrlUser" ,
ID : RecentMeURLUserTypeID ,
}
if r == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "URL" ,
SchemaName : "url" ,
},
{
Name : "UserID" ,
SchemaName : "user_id" ,
},
}
return typ
}
func (r *RecentMeURLUser ) Encode (b *bin .Buffer ) error {
if r == nil {
return fmt .Errorf ("can't encode recentMeUrlUser#b92c09e2 as nil" )
}
b .PutID (RecentMeURLUserTypeID )
return r .EncodeBare (b )
}
func (r *RecentMeURLUser ) EncodeBare (b *bin .Buffer ) error {
if r == nil {
return fmt .Errorf ("can't encode recentMeUrlUser#b92c09e2 as nil" )
}
b .PutString (r .URL )
b .PutLong (r .UserID )
return nil
}
func (r *RecentMeURLUser ) Decode (b *bin .Buffer ) error {
if r == nil {
return fmt .Errorf ("can't decode recentMeUrlUser#b92c09e2 to nil" )
}
if err := b .ConsumeID (RecentMeURLUserTypeID ); err != nil {
return fmt .Errorf ("unable to decode recentMeUrlUser#b92c09e2: %w" , err )
}
return r .DecodeBare (b )
}
func (r *RecentMeURLUser ) DecodeBare (b *bin .Buffer ) error {
if r == nil {
return fmt .Errorf ("can't decode recentMeUrlUser#b92c09e2 to nil" )
}
{
value , err := b .String ()
if err != nil {
return fmt .Errorf ("unable to decode recentMeUrlUser#b92c09e2: field url: %w" , err )
}
r .URL = value
}
{
value , err := b .Long ()
if err != nil {
return fmt .Errorf ("unable to decode recentMeUrlUser#b92c09e2: field user_id: %w" , err )
}
r .UserID = value
}
return nil
}
func (r *RecentMeURLUser ) GetURL () (value string ) {
if r == nil {
return
}
return r .URL
}
func (r *RecentMeURLUser ) GetUserID () (value int64 ) {
if r == nil {
return
}
return r .UserID
}
type RecentMeURLChat struct {
URL string
ChatID int64
}
const RecentMeURLChatTypeID = 0xb2da71d2
func (r RecentMeURLChat ) construct () RecentMeURLClass { return &r }
var (
_ bin .Encoder = &RecentMeURLChat {}
_ bin .Decoder = &RecentMeURLChat {}
_ bin .BareEncoder = &RecentMeURLChat {}
_ bin .BareDecoder = &RecentMeURLChat {}
_ RecentMeURLClass = &RecentMeURLChat {}
)
func (r *RecentMeURLChat ) Zero () bool {
if r == nil {
return true
}
if !(r .URL == "" ) {
return false
}
if !(r .ChatID == 0 ) {
return false
}
return true
}
func (r *RecentMeURLChat ) String () string {
if r == nil {
return "RecentMeURLChat(nil)"
}
type Alias RecentMeURLChat
return fmt .Sprintf ("RecentMeURLChat%+v" , Alias (*r ))
}
func (r *RecentMeURLChat ) FillFrom (from interface {
GetURL () (value string )
GetChatID () (value int64 )
}) {
r .URL = from .GetURL ()
r .ChatID = from .GetChatID ()
}
func (*RecentMeURLChat ) TypeID () uint32 {
return RecentMeURLChatTypeID
}
func (*RecentMeURLChat ) TypeName () string {
return "recentMeUrlChat"
}
func (r *RecentMeURLChat ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "recentMeUrlChat" ,
ID : RecentMeURLChatTypeID ,
}
if r == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "URL" ,
SchemaName : "url" ,
},
{
Name : "ChatID" ,
SchemaName : "chat_id" ,
},
}
return typ
}
func (r *RecentMeURLChat ) Encode (b *bin .Buffer ) error {
if r == nil {
return fmt .Errorf ("can't encode recentMeUrlChat#b2da71d2 as nil" )
}
b .PutID (RecentMeURLChatTypeID )
return r .EncodeBare (b )
}
func (r *RecentMeURLChat ) EncodeBare (b *bin .Buffer ) error {
if r == nil {
return fmt .Errorf ("can't encode recentMeUrlChat#b2da71d2 as nil" )
}
b .PutString (r .URL )
b .PutLong (r .ChatID )
return nil
}
func (r *RecentMeURLChat ) Decode (b *bin .Buffer ) error {
if r == nil {
return fmt .Errorf ("can't decode recentMeUrlChat#b2da71d2 to nil" )
}
if err := b .ConsumeID (RecentMeURLChatTypeID ); err != nil {
return fmt .Errorf ("unable to decode recentMeUrlChat#b2da71d2: %w" , err )
}
return r .DecodeBare (b )
}
func (r *RecentMeURLChat ) DecodeBare (b *bin .Buffer ) error {
if r == nil {
return fmt .Errorf ("can't decode recentMeUrlChat#b2da71d2 to nil" )
}
{
value , err := b .String ()
if err != nil {
return fmt .Errorf ("unable to decode recentMeUrlChat#b2da71d2: field url: %w" , err )
}
r .URL = value
}
{
value , err := b .Long ()
if err != nil {
return fmt .Errorf ("unable to decode recentMeUrlChat#b2da71d2: field chat_id: %w" , err )
}
r .ChatID = value
}
return nil
}
func (r *RecentMeURLChat ) GetURL () (value string ) {
if r == nil {
return
}
return r .URL
}
func (r *RecentMeURLChat ) GetChatID () (value int64 ) {
if r == nil {
return
}
return r .ChatID
}
type RecentMeURLChatInvite struct {
URL string
ChatInvite ChatInviteClass
}
const RecentMeURLChatInviteTypeID = 0xeb49081d
func (r RecentMeURLChatInvite ) construct () RecentMeURLClass { return &r }
var (
_ bin .Encoder = &RecentMeURLChatInvite {}
_ bin .Decoder = &RecentMeURLChatInvite {}
_ bin .BareEncoder = &RecentMeURLChatInvite {}
_ bin .BareDecoder = &RecentMeURLChatInvite {}
_ RecentMeURLClass = &RecentMeURLChatInvite {}
)
func (r *RecentMeURLChatInvite ) Zero () bool {
if r == nil {
return true
}
if !(r .URL == "" ) {
return false
}
if !(r .ChatInvite == nil ) {
return false
}
return true
}
func (r *RecentMeURLChatInvite ) String () string {
if r == nil {
return "RecentMeURLChatInvite(nil)"
}
type Alias RecentMeURLChatInvite
return fmt .Sprintf ("RecentMeURLChatInvite%+v" , Alias (*r ))
}
func (r *RecentMeURLChatInvite ) FillFrom (from interface {
GetURL () (value string )
GetChatInvite () (value ChatInviteClass )
}) {
r .URL = from .GetURL ()
r .ChatInvite = from .GetChatInvite ()
}
func (*RecentMeURLChatInvite ) TypeID () uint32 {
return RecentMeURLChatInviteTypeID
}
func (*RecentMeURLChatInvite ) TypeName () string {
return "recentMeUrlChatInvite"
}
func (r *RecentMeURLChatInvite ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "recentMeUrlChatInvite" ,
ID : RecentMeURLChatInviteTypeID ,
}
if r == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "URL" ,
SchemaName : "url" ,
},
{
Name : "ChatInvite" ,
SchemaName : "chat_invite" ,
},
}
return typ
}
func (r *RecentMeURLChatInvite ) Encode (b *bin .Buffer ) error {
if r == nil {
return fmt .Errorf ("can't encode recentMeUrlChatInvite#eb49081d as nil" )
}
b .PutID (RecentMeURLChatInviteTypeID )
return r .EncodeBare (b )
}
func (r *RecentMeURLChatInvite ) EncodeBare (b *bin .Buffer ) error {
if r == nil {
return fmt .Errorf ("can't encode recentMeUrlChatInvite#eb49081d as nil" )
}
b .PutString (r .URL )
if r .ChatInvite == nil {
return fmt .Errorf ("unable to encode recentMeUrlChatInvite#eb49081d: field chat_invite is nil" )
}
if err := r .ChatInvite .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode recentMeUrlChatInvite#eb49081d: field chat_invite: %w" , err )
}
return nil
}
func (r *RecentMeURLChatInvite ) Decode (b *bin .Buffer ) error {
if r == nil {
return fmt .Errorf ("can't decode recentMeUrlChatInvite#eb49081d to nil" )
}
if err := b .ConsumeID (RecentMeURLChatInviteTypeID ); err != nil {
return fmt .Errorf ("unable to decode recentMeUrlChatInvite#eb49081d: %w" , err )
}
return r .DecodeBare (b )
}
func (r *RecentMeURLChatInvite ) DecodeBare (b *bin .Buffer ) error {
if r == nil {
return fmt .Errorf ("can't decode recentMeUrlChatInvite#eb49081d to nil" )
}
{
value , err := b .String ()
if err != nil {
return fmt .Errorf ("unable to decode recentMeUrlChatInvite#eb49081d: field url: %w" , err )
}
r .URL = value
}
{
value , err := DecodeChatInvite (b )
if err != nil {
return fmt .Errorf ("unable to decode recentMeUrlChatInvite#eb49081d: field chat_invite: %w" , err )
}
r .ChatInvite = value
}
return nil
}
func (r *RecentMeURLChatInvite ) GetURL () (value string ) {
if r == nil {
return
}
return r .URL
}
func (r *RecentMeURLChatInvite ) GetChatInvite () (value ChatInviteClass ) {
if r == nil {
return
}
return r .ChatInvite
}
type RecentMeURLStickerSet struct {
URL string
Set StickerSetCoveredClass
}
const RecentMeURLStickerSetTypeID = 0xbc0a57dc
func (r RecentMeURLStickerSet ) construct () RecentMeURLClass { return &r }
var (
_ bin .Encoder = &RecentMeURLStickerSet {}
_ bin .Decoder = &RecentMeURLStickerSet {}
_ bin .BareEncoder = &RecentMeURLStickerSet {}
_ bin .BareDecoder = &RecentMeURLStickerSet {}
_ RecentMeURLClass = &RecentMeURLStickerSet {}
)
func (r *RecentMeURLStickerSet ) Zero () bool {
if r == nil {
return true
}
if !(r .URL == "" ) {
return false
}
if !(r .Set == nil ) {
return false
}
return true
}
func (r *RecentMeURLStickerSet ) String () string {
if r == nil {
return "RecentMeURLStickerSet(nil)"
}
type Alias RecentMeURLStickerSet
return fmt .Sprintf ("RecentMeURLStickerSet%+v" , Alias (*r ))
}
func (r *RecentMeURLStickerSet ) FillFrom (from interface {
GetURL () (value string )
GetSet () (value StickerSetCoveredClass )
}) {
r .URL = from .GetURL ()
r .Set = from .GetSet ()
}
func (*RecentMeURLStickerSet ) TypeID () uint32 {
return RecentMeURLStickerSetTypeID
}
func (*RecentMeURLStickerSet ) TypeName () string {
return "recentMeUrlStickerSet"
}
func (r *RecentMeURLStickerSet ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "recentMeUrlStickerSet" ,
ID : RecentMeURLStickerSetTypeID ,
}
if r == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "URL" ,
SchemaName : "url" ,
},
{
Name : "Set" ,
SchemaName : "set" ,
},
}
return typ
}
func (r *RecentMeURLStickerSet ) Encode (b *bin .Buffer ) error {
if r == nil {
return fmt .Errorf ("can't encode recentMeUrlStickerSet#bc0a57dc as nil" )
}
b .PutID (RecentMeURLStickerSetTypeID )
return r .EncodeBare (b )
}
func (r *RecentMeURLStickerSet ) EncodeBare (b *bin .Buffer ) error {
if r == nil {
return fmt .Errorf ("can't encode recentMeUrlStickerSet#bc0a57dc as nil" )
}
b .PutString (r .URL )
if r .Set == nil {
return fmt .Errorf ("unable to encode recentMeUrlStickerSet#bc0a57dc: field set is nil" )
}
if err := r .Set .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode recentMeUrlStickerSet#bc0a57dc: field set: %w" , err )
}
return nil
}
func (r *RecentMeURLStickerSet ) Decode (b *bin .Buffer ) error {
if r == nil {
return fmt .Errorf ("can't decode recentMeUrlStickerSet#bc0a57dc to nil" )
}
if err := b .ConsumeID (RecentMeURLStickerSetTypeID ); err != nil {
return fmt .Errorf ("unable to decode recentMeUrlStickerSet#bc0a57dc: %w" , err )
}
return r .DecodeBare (b )
}
func (r *RecentMeURLStickerSet ) DecodeBare (b *bin .Buffer ) error {
if r == nil {
return fmt .Errorf ("can't decode recentMeUrlStickerSet#bc0a57dc to nil" )
}
{
value , err := b .String ()
if err != nil {
return fmt .Errorf ("unable to decode recentMeUrlStickerSet#bc0a57dc: field url: %w" , err )
}
r .URL = value
}
{
value , err := DecodeStickerSetCovered (b )
if err != nil {
return fmt .Errorf ("unable to decode recentMeUrlStickerSet#bc0a57dc: field set: %w" , err )
}
r .Set = value
}
return nil
}
func (r *RecentMeURLStickerSet ) GetURL () (value string ) {
if r == nil {
return
}
return r .URL
}
func (r *RecentMeURLStickerSet ) GetSet () (value StickerSetCoveredClass ) {
if r == nil {
return
}
return r .Set
}
const RecentMeURLClassName = "RecentMeUrl"
type RecentMeURLClass interface {
bin .Encoder
bin .Decoder
bin .BareEncoder
bin .BareDecoder
construct () RecentMeURLClass
TypeID () uint32
TypeName () string
String () string
Zero () bool
GetURL () (value string )
}
func DecodeRecentMeURL (buf *bin .Buffer ) (RecentMeURLClass , error ) {
id , err := buf .PeekID ()
if err != nil {
return nil , err
}
switch id {
case RecentMeURLUnknownTypeID :
v := RecentMeURLUnknown {}
if err := v .Decode (buf ); err != nil {
return nil , fmt .Errorf ("unable to decode RecentMeURLClass: %w" , err )
}
return &v , nil
case RecentMeURLUserTypeID :
v := RecentMeURLUser {}
if err := v .Decode (buf ); err != nil {
return nil , fmt .Errorf ("unable to decode RecentMeURLClass: %w" , err )
}
return &v , nil
case RecentMeURLChatTypeID :
v := RecentMeURLChat {}
if err := v .Decode (buf ); err != nil {
return nil , fmt .Errorf ("unable to decode RecentMeURLClass: %w" , err )
}
return &v , nil
case RecentMeURLChatInviteTypeID :
v := RecentMeURLChatInvite {}
if err := v .Decode (buf ); err != nil {
return nil , fmt .Errorf ("unable to decode RecentMeURLClass: %w" , err )
}
return &v , nil
case RecentMeURLStickerSetTypeID :
v := RecentMeURLStickerSet {}
if err := v .Decode (buf ); err != nil {
return nil , fmt .Errorf ("unable to decode RecentMeURLClass: %w" , err )
}
return &v , nil
default :
return nil , fmt .Errorf ("unable to decode RecentMeURLClass: %w" , bin .NewUnexpectedID (id ))
}
}
type RecentMeURLBox struct {
RecentMeUrl RecentMeURLClass
}
func (b *RecentMeURLBox ) Decode (buf *bin .Buffer ) error {
if b == nil {
return fmt .Errorf ("unable to decode RecentMeURLBox to nil" )
}
v , err := DecodeRecentMeURL (buf )
if err != nil {
return fmt .Errorf ("unable to decode boxed value: %w" , err )
}
b .RecentMeUrl = v
return nil
}
func (b *RecentMeURLBox ) Encode (buf *bin .Buffer ) error {
if b == nil || b .RecentMeUrl == nil {
return fmt .Errorf ("unable to encode RecentMeURLClass as nil" )
}
return b .RecentMeUrl .Encode (buf )
}
The pages are generated with Golds v0.6.7 . (GOOS=linux GOARCH=amd64)
Golds is a Go 101 project developed by Tapir Liu .
PR and bug reports are welcome and can be submitted to the issue list .
Please follow @Go100and1 (reachable from the left QR code) to get the latest news of Golds .