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 ExportedContactToken struct {
URL string
Expires int
}
const ExportedContactTokenTypeID = 0x41bf109b
var (
_ bin .Encoder = &ExportedContactToken {}
_ bin .Decoder = &ExportedContactToken {}
_ bin .BareEncoder = &ExportedContactToken {}
_ bin .BareDecoder = &ExportedContactToken {}
)
func (e *ExportedContactToken ) Zero () bool {
if e == nil {
return true
}
if !(e .URL == "" ) {
return false
}
if !(e .Expires == 0 ) {
return false
}
return true
}
func (e *ExportedContactToken ) String () string {
if e == nil {
return "ExportedContactToken(nil)"
}
type Alias ExportedContactToken
return fmt .Sprintf ("ExportedContactToken%+v" , Alias (*e ))
}
func (e *ExportedContactToken ) FillFrom (from interface {
GetURL () (value string )
GetExpires () (value int )
}) {
e .URL = from .GetURL ()
e .Expires = from .GetExpires ()
}
func (*ExportedContactToken ) TypeID () uint32 {
return ExportedContactTokenTypeID
}
func (*ExportedContactToken ) TypeName () string {
return "exportedContactToken"
}
func (e *ExportedContactToken ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "exportedContactToken" ,
ID : ExportedContactTokenTypeID ,
}
if e == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "URL" ,
SchemaName : "url" ,
},
{
Name : "Expires" ,
SchemaName : "expires" ,
},
}
return typ
}
func (e *ExportedContactToken ) Encode (b *bin .Buffer ) error {
if e == nil {
return fmt .Errorf ("can't encode exportedContactToken#41bf109b as nil" )
}
b .PutID (ExportedContactTokenTypeID )
return e .EncodeBare (b )
}
func (e *ExportedContactToken ) EncodeBare (b *bin .Buffer ) error {
if e == nil {
return fmt .Errorf ("can't encode exportedContactToken#41bf109b as nil" )
}
b .PutString (e .URL )
b .PutInt (e .Expires )
return nil
}
func (e *ExportedContactToken ) Decode (b *bin .Buffer ) error {
if e == nil {
return fmt .Errorf ("can't decode exportedContactToken#41bf109b to nil" )
}
if err := b .ConsumeID (ExportedContactTokenTypeID ); err != nil {
return fmt .Errorf ("unable to decode exportedContactToken#41bf109b: %w" , err )
}
return e .DecodeBare (b )
}
func (e *ExportedContactToken ) DecodeBare (b *bin .Buffer ) error {
if e == nil {
return fmt .Errorf ("can't decode exportedContactToken#41bf109b to nil" )
}
{
value , err := b .String ()
if err != nil {
return fmt .Errorf ("unable to decode exportedContactToken#41bf109b: field url: %w" , err )
}
e .URL = value
}
{
value , err := b .Int ()
if err != nil {
return fmt .Errorf ("unable to decode exportedContactToken#41bf109b: field expires: %w" , err )
}
e .Expires = value
}
return nil
}
func (e *ExportedContactToken ) GetURL () (value string ) {
if e == nil {
return
}
return e .URL
}
func (e *ExportedContactToken ) GetExpires () (value int ) {
if e == nil {
return
}
return e .Expires
}
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 .