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