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 CDNPublicKey struct {
DCID int
PublicKey string
}
const CDNPublicKeyTypeID = 0xc982eaba
var (
_ bin .Encoder = &CDNPublicKey {}
_ bin .Decoder = &CDNPublicKey {}
_ bin .BareEncoder = &CDNPublicKey {}
_ bin .BareDecoder = &CDNPublicKey {}
)
func (c *CDNPublicKey ) Zero () bool {
if c == nil {
return true
}
if !(c .DCID == 0 ) {
return false
}
if !(c .PublicKey == "" ) {
return false
}
return true
}
func (c *CDNPublicKey ) String () string {
if c == nil {
return "CDNPublicKey(nil)"
}
type Alias CDNPublicKey
return fmt .Sprintf ("CDNPublicKey%+v" , Alias (*c ))
}
func (c *CDNPublicKey ) FillFrom (from interface {
GetDCID () (value int )
GetPublicKey () (value string )
}) {
c .DCID = from .GetDCID ()
c .PublicKey = from .GetPublicKey ()
}
func (*CDNPublicKey ) TypeID () uint32 {
return CDNPublicKeyTypeID
}
func (*CDNPublicKey ) TypeName () string {
return "cdnPublicKey"
}
func (c *CDNPublicKey ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "cdnPublicKey" ,
ID : CDNPublicKeyTypeID ,
}
if c == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "DCID" ,
SchemaName : "dc_id" ,
},
{
Name : "PublicKey" ,
SchemaName : "public_key" ,
},
}
return typ
}
func (c *CDNPublicKey ) Encode (b *bin .Buffer ) error {
if c == nil {
return fmt .Errorf ("can't encode cdnPublicKey#c982eaba as nil" )
}
b .PutID (CDNPublicKeyTypeID )
return c .EncodeBare (b )
}
func (c *CDNPublicKey ) EncodeBare (b *bin .Buffer ) error {
if c == nil {
return fmt .Errorf ("can't encode cdnPublicKey#c982eaba as nil" )
}
b .PutInt (c .DCID )
b .PutString (c .PublicKey )
return nil
}
func (c *CDNPublicKey ) Decode (b *bin .Buffer ) error {
if c == nil {
return fmt .Errorf ("can't decode cdnPublicKey#c982eaba to nil" )
}
if err := b .ConsumeID (CDNPublicKeyTypeID ); err != nil {
return fmt .Errorf ("unable to decode cdnPublicKey#c982eaba: %w" , err )
}
return c .DecodeBare (b )
}
func (c *CDNPublicKey ) DecodeBare (b *bin .Buffer ) error {
if c == nil {
return fmt .Errorf ("can't decode cdnPublicKey#c982eaba to nil" )
}
{
value , err := b .Int ()
if err != nil {
return fmt .Errorf ("unable to decode cdnPublicKey#c982eaba: field dc_id: %w" , err )
}
c .DCID = value
}
{
value , err := b .String ()
if err != nil {
return fmt .Errorf ("unable to decode cdnPublicKey#c982eaba: field public_key: %w" , err )
}
c .PublicKey = value
}
return nil
}
func (c *CDNPublicKey ) GetDCID () (value int ) {
if c == nil {
return
}
return c .DCID
}
func (c *CDNPublicKey ) GetPublicKey () (value string ) {
if c == nil {
return
}
return c .PublicKey
}
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 .