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 AuthExportAuthorizationRequest struct {
DCID int
}
const AuthExportAuthorizationRequestTypeID = 0xe5bfffcd
var (
_ bin .Encoder = &AuthExportAuthorizationRequest {}
_ bin .Decoder = &AuthExportAuthorizationRequest {}
_ bin .BareEncoder = &AuthExportAuthorizationRequest {}
_ bin .BareDecoder = &AuthExportAuthorizationRequest {}
)
func (e *AuthExportAuthorizationRequest ) Zero () bool {
if e == nil {
return true
}
if !(e .DCID == 0 ) {
return false
}
return true
}
func (e *AuthExportAuthorizationRequest ) String () string {
if e == nil {
return "AuthExportAuthorizationRequest(nil)"
}
type Alias AuthExportAuthorizationRequest
return fmt .Sprintf ("AuthExportAuthorizationRequest%+v" , Alias (*e ))
}
func (e *AuthExportAuthorizationRequest ) FillFrom (from interface {
GetDCID () (value int )
}) {
e .DCID = from .GetDCID ()
}
func (*AuthExportAuthorizationRequest ) TypeID () uint32 {
return AuthExportAuthorizationRequestTypeID
}
func (*AuthExportAuthorizationRequest ) TypeName () string {
return "auth.exportAuthorization"
}
func (e *AuthExportAuthorizationRequest ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "auth.exportAuthorization" ,
ID : AuthExportAuthorizationRequestTypeID ,
}
if e == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "DCID" ,
SchemaName : "dc_id" ,
},
}
return typ
}
func (e *AuthExportAuthorizationRequest ) Encode (b *bin .Buffer ) error {
if e == nil {
return fmt .Errorf ("can't encode auth.exportAuthorization#e5bfffcd as nil" )
}
b .PutID (AuthExportAuthorizationRequestTypeID )
return e .EncodeBare (b )
}
func (e *AuthExportAuthorizationRequest ) EncodeBare (b *bin .Buffer ) error {
if e == nil {
return fmt .Errorf ("can't encode auth.exportAuthorization#e5bfffcd as nil" )
}
b .PutInt (e .DCID )
return nil
}
func (e *AuthExportAuthorizationRequest ) Decode (b *bin .Buffer ) error {
if e == nil {
return fmt .Errorf ("can't decode auth.exportAuthorization#e5bfffcd to nil" )
}
if err := b .ConsumeID (AuthExportAuthorizationRequestTypeID ); err != nil {
return fmt .Errorf ("unable to decode auth.exportAuthorization#e5bfffcd: %w" , err )
}
return e .DecodeBare (b )
}
func (e *AuthExportAuthorizationRequest ) DecodeBare (b *bin .Buffer ) error {
if e == nil {
return fmt .Errorf ("can't decode auth.exportAuthorization#e5bfffcd to nil" )
}
{
value , err := b .Int ()
if err != nil {
return fmt .Errorf ("unable to decode auth.exportAuthorization#e5bfffcd: field dc_id: %w" , err )
}
e .DCID = value
}
return nil
}
func (e *AuthExportAuthorizationRequest ) GetDCID () (value int ) {
if e == nil {
return
}
return e .DCID
}
func (c *Client ) AuthExportAuthorization (ctx context .Context , dcid int ) (*AuthExportedAuthorization , error ) {
var result AuthExportedAuthorization
request := &AuthExportAuthorizationRequest {
DCID : dcid ,
}
if err := c .rpc .Invoke (ctx , request , &result ); err != nil {
return nil , err
}
return &result , nil
}
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 .