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 ImportedContact struct {
UserID int64
ClientID int64
}
const ImportedContactTypeID = 0xc13e3c50
var (
_ bin .Encoder = &ImportedContact {}
_ bin .Decoder = &ImportedContact {}
_ bin .BareEncoder = &ImportedContact {}
_ bin .BareDecoder = &ImportedContact {}
)
func (i *ImportedContact ) Zero () bool {
if i == nil {
return true
}
if !(i .UserID == 0 ) {
return false
}
if !(i .ClientID == 0 ) {
return false
}
return true
}
func (i *ImportedContact ) String () string {
if i == nil {
return "ImportedContact(nil)"
}
type Alias ImportedContact
return fmt .Sprintf ("ImportedContact%+v" , Alias (*i ))
}
func (i *ImportedContact ) FillFrom (from interface {
GetUserID () (value int64 )
GetClientID () (value int64 )
}) {
i .UserID = from .GetUserID ()
i .ClientID = from .GetClientID ()
}
func (*ImportedContact ) TypeID () uint32 {
return ImportedContactTypeID
}
func (*ImportedContact ) TypeName () string {
return "importedContact"
}
func (i *ImportedContact ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "importedContact" ,
ID : ImportedContactTypeID ,
}
if i == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "UserID" ,
SchemaName : "user_id" ,
},
{
Name : "ClientID" ,
SchemaName : "client_id" ,
},
}
return typ
}
func (i *ImportedContact ) Encode (b *bin .Buffer ) error {
if i == nil {
return fmt .Errorf ("can't encode importedContact#c13e3c50 as nil" )
}
b .PutID (ImportedContactTypeID )
return i .EncodeBare (b )
}
func (i *ImportedContact ) EncodeBare (b *bin .Buffer ) error {
if i == nil {
return fmt .Errorf ("can't encode importedContact#c13e3c50 as nil" )
}
b .PutLong (i .UserID )
b .PutLong (i .ClientID )
return nil
}
func (i *ImportedContact ) Decode (b *bin .Buffer ) error {
if i == nil {
return fmt .Errorf ("can't decode importedContact#c13e3c50 to nil" )
}
if err := b .ConsumeID (ImportedContactTypeID ); err != nil {
return fmt .Errorf ("unable to decode importedContact#c13e3c50: %w" , err )
}
return i .DecodeBare (b )
}
func (i *ImportedContact ) DecodeBare (b *bin .Buffer ) error {
if i == nil {
return fmt .Errorf ("can't decode importedContact#c13e3c50 to nil" )
}
{
value , err := b .Long ()
if err != nil {
return fmt .Errorf ("unable to decode importedContact#c13e3c50: field user_id: %w" , err )
}
i .UserID = value
}
{
value , err := b .Long ()
if err != nil {
return fmt .Errorf ("unable to decode importedContact#c13e3c50: field client_id: %w" , err )
}
i .ClientID = value
}
return nil
}
func (i *ImportedContact ) GetUserID () (value int64 ) {
if i == nil {
return
}
return i .UserID
}
func (i *ImportedContact ) GetClientID () (value int64 ) {
if i == nil {
return
}
return i .ClientID
}
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 .