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 ContactBirthday struct {
ContactID int64
Birthday Birthday
}
const ContactBirthdayTypeID = 0x1d998733
var (
_ bin .Encoder = &ContactBirthday {}
_ bin .Decoder = &ContactBirthday {}
_ bin .BareEncoder = &ContactBirthday {}
_ bin .BareDecoder = &ContactBirthday {}
)
func (c *ContactBirthday ) Zero () bool {
if c == nil {
return true
}
if !(c .ContactID == 0 ) {
return false
}
if !(c .Birthday .Zero ()) {
return false
}
return true
}
func (c *ContactBirthday ) String () string {
if c == nil {
return "ContactBirthday(nil)"
}
type Alias ContactBirthday
return fmt .Sprintf ("ContactBirthday%+v" , Alias (*c ))
}
func (c *ContactBirthday ) FillFrom (from interface {
GetContactID () (value int64 )
GetBirthday () (value Birthday )
}) {
c .ContactID = from .GetContactID ()
c .Birthday = from .GetBirthday ()
}
func (*ContactBirthday ) TypeID () uint32 {
return ContactBirthdayTypeID
}
func (*ContactBirthday ) TypeName () string {
return "contactBirthday"
}
func (c *ContactBirthday ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "contactBirthday" ,
ID : ContactBirthdayTypeID ,
}
if c == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "ContactID" ,
SchemaName : "contact_id" ,
},
{
Name : "Birthday" ,
SchemaName : "birthday" ,
},
}
return typ
}
func (c *ContactBirthday ) Encode (b *bin .Buffer ) error {
if c == nil {
return fmt .Errorf ("can't encode contactBirthday#1d998733 as nil" )
}
b .PutID (ContactBirthdayTypeID )
return c .EncodeBare (b )
}
func (c *ContactBirthday ) EncodeBare (b *bin .Buffer ) error {
if c == nil {
return fmt .Errorf ("can't encode contactBirthday#1d998733 as nil" )
}
b .PutLong (c .ContactID )
if err := c .Birthday .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode contactBirthday#1d998733: field birthday: %w" , err )
}
return nil
}
func (c *ContactBirthday ) Decode (b *bin .Buffer ) error {
if c == nil {
return fmt .Errorf ("can't decode contactBirthday#1d998733 to nil" )
}
if err := b .ConsumeID (ContactBirthdayTypeID ); err != nil {
return fmt .Errorf ("unable to decode contactBirthday#1d998733: %w" , err )
}
return c .DecodeBare (b )
}
func (c *ContactBirthday ) DecodeBare (b *bin .Buffer ) error {
if c == nil {
return fmt .Errorf ("can't decode contactBirthday#1d998733 to nil" )
}
{
value , err := b .Long ()
if err != nil {
return fmt .Errorf ("unable to decode contactBirthday#1d998733: field contact_id: %w" , err )
}
c .ContactID = value
}
{
if err := c .Birthday .Decode (b ); err != nil {
return fmt .Errorf ("unable to decode contactBirthday#1d998733: field birthday: %w" , err )
}
}
return nil
}
func (c *ContactBirthday ) GetContactID () (value int64 ) {
if c == nil {
return
}
return c .ContactID
}
func (c *ContactBirthday ) GetBirthday () (value Birthday ) {
if c == nil {
return
}
return c .Birthday
}
The pages are generated with Golds v0.8.4 . (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 @zigo_101 (reachable from the left QR code) to get the latest news of Golds .