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 TodoCompletion struct {
ID int
CompletedBy PeerClass
Date int
}
const TodoCompletionTypeID = 0x221bb5e4
var (
_ bin .Encoder = &TodoCompletion {}
_ bin .Decoder = &TodoCompletion {}
_ bin .BareEncoder = &TodoCompletion {}
_ bin .BareDecoder = &TodoCompletion {}
)
func (t *TodoCompletion ) Zero () bool {
if t == nil {
return true
}
if !(t .ID == 0 ) {
return false
}
if !(t .CompletedBy == nil ) {
return false
}
if !(t .Date == 0 ) {
return false
}
return true
}
func (t *TodoCompletion ) String () string {
if t == nil {
return "TodoCompletion(nil)"
}
type Alias TodoCompletion
return fmt .Sprintf ("TodoCompletion%+v" , Alias (*t ))
}
func (t *TodoCompletion ) FillFrom (from interface {
GetID () (value int )
GetCompletedBy () (value PeerClass )
GetDate () (value int )
}) {
t .ID = from .GetID ()
t .CompletedBy = from .GetCompletedBy ()
t .Date = from .GetDate ()
}
func (*TodoCompletion ) TypeID () uint32 {
return TodoCompletionTypeID
}
func (*TodoCompletion ) TypeName () string {
return "todoCompletion"
}
func (t *TodoCompletion ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "todoCompletion" ,
ID : TodoCompletionTypeID ,
}
if t == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "ID" ,
SchemaName : "id" ,
},
{
Name : "CompletedBy" ,
SchemaName : "completed_by" ,
},
{
Name : "Date" ,
SchemaName : "date" ,
},
}
return typ
}
func (t *TodoCompletion ) Encode (b *bin .Buffer ) error {
if t == nil {
return fmt .Errorf ("can't encode todoCompletion#221bb5e4 as nil" )
}
b .PutID (TodoCompletionTypeID )
return t .EncodeBare (b )
}
func (t *TodoCompletion ) EncodeBare (b *bin .Buffer ) error {
if t == nil {
return fmt .Errorf ("can't encode todoCompletion#221bb5e4 as nil" )
}
b .PutInt (t .ID )
if t .CompletedBy == nil {
return fmt .Errorf ("unable to encode todoCompletion#221bb5e4: field completed_by is nil" )
}
if err := t .CompletedBy .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode todoCompletion#221bb5e4: field completed_by: %w" , err )
}
b .PutInt (t .Date )
return nil
}
func (t *TodoCompletion ) Decode (b *bin .Buffer ) error {
if t == nil {
return fmt .Errorf ("can't decode todoCompletion#221bb5e4 to nil" )
}
if err := b .ConsumeID (TodoCompletionTypeID ); err != nil {
return fmt .Errorf ("unable to decode todoCompletion#221bb5e4: %w" , err )
}
return t .DecodeBare (b )
}
func (t *TodoCompletion ) DecodeBare (b *bin .Buffer ) error {
if t == nil {
return fmt .Errorf ("can't decode todoCompletion#221bb5e4 to nil" )
}
{
value , err := b .Int ()
if err != nil {
return fmt .Errorf ("unable to decode todoCompletion#221bb5e4: field id: %w" , err )
}
t .ID = value
}
{
value , err := DecodePeer (b )
if err != nil {
return fmt .Errorf ("unable to decode todoCompletion#221bb5e4: field completed_by: %w" , err )
}
t .CompletedBy = value
}
{
value , err := b .Int ()
if err != nil {
return fmt .Errorf ("unable to decode todoCompletion#221bb5e4: field date: %w" , err )
}
t .Date = value
}
return nil
}
func (t *TodoCompletion ) GetID () (value int ) {
if t == nil {
return
}
return t .ID
}
func (t *TodoCompletion ) GetCompletedBy () (value PeerClass ) {
if t == nil {
return
}
return t .CompletedBy
}
func (t *TodoCompletion ) GetDate () (value int ) {
if t == nil {
return
}
return t .Date
}
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 .