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 InvokeWithLayerRequest struct {
Layer int
Query bin .Object
}
const InvokeWithLayerRequestTypeID = 0xda9b0d0d
var (
_ bin .Encoder = &InvokeWithLayerRequest {}
_ bin .Decoder = &InvokeWithLayerRequest {}
_ bin .BareEncoder = &InvokeWithLayerRequest {}
_ bin .BareDecoder = &InvokeWithLayerRequest {}
)
func (i *InvokeWithLayerRequest ) Zero () bool {
if i == nil {
return true
}
if !(i .Layer == 0 ) {
return false
}
if !(i .Query == nil ) {
return false
}
return true
}
func (i *InvokeWithLayerRequest ) String () string {
if i == nil {
return "InvokeWithLayerRequest(nil)"
}
type Alias InvokeWithLayerRequest
return fmt .Sprintf ("InvokeWithLayerRequest%+v" , Alias (*i ))
}
func (i *InvokeWithLayerRequest ) FillFrom (from interface {
GetLayer () (value int )
GetQuery () (value bin .Object )
}) {
i .Layer = from .GetLayer ()
i .Query = from .GetQuery ()
}
func (*InvokeWithLayerRequest ) TypeID () uint32 {
return InvokeWithLayerRequestTypeID
}
func (*InvokeWithLayerRequest ) TypeName () string {
return "invokeWithLayer"
}
func (i *InvokeWithLayerRequest ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "invokeWithLayer" ,
ID : InvokeWithLayerRequestTypeID ,
}
if i == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "Layer" ,
SchemaName : "layer" ,
},
{
Name : "Query" ,
SchemaName : "query" ,
},
}
return typ
}
func (i *InvokeWithLayerRequest ) Encode (b *bin .Buffer ) error {
if i == nil {
return fmt .Errorf ("can't encode invokeWithLayer#da9b0d0d as nil" )
}
b .PutID (InvokeWithLayerRequestTypeID )
return i .EncodeBare (b )
}
func (i *InvokeWithLayerRequest ) EncodeBare (b *bin .Buffer ) error {
if i == nil {
return fmt .Errorf ("can't encode invokeWithLayer#da9b0d0d as nil" )
}
b .PutInt (i .Layer )
if err := i .Query .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode invokeWithLayer#da9b0d0d: field query: %w" , err )
}
return nil
}
func (i *InvokeWithLayerRequest ) Decode (b *bin .Buffer ) error {
if i == nil {
return fmt .Errorf ("can't decode invokeWithLayer#da9b0d0d to nil" )
}
if err := b .ConsumeID (InvokeWithLayerRequestTypeID ); err != nil {
return fmt .Errorf ("unable to decode invokeWithLayer#da9b0d0d: %w" , err )
}
return i .DecodeBare (b )
}
func (i *InvokeWithLayerRequest ) DecodeBare (b *bin .Buffer ) error {
if i == nil {
return fmt .Errorf ("can't decode invokeWithLayer#da9b0d0d to nil" )
}
{
value , err := b .Int ()
if err != nil {
return fmt .Errorf ("unable to decode invokeWithLayer#da9b0d0d: field layer: %w" , err )
}
i .Layer = value
}
{
if err := i .Query .Decode (b ); err != nil {
return fmt .Errorf ("unable to decode invokeWithLayer#da9b0d0d: field query: %w" , err )
}
}
return nil
}
func (i *InvokeWithLayerRequest ) GetLayer () (value int ) {
if i == nil {
return
}
return i .Layer
}
func (i *InvokeWithLayerRequest ) GetQuery () (value bin .Object ) {
if i == nil {
return
}
return i .Query
}
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 .