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 AuthImportAuthorizationRequest struct {
ID int64
Bytes []byte
}
const AuthImportAuthorizationRequestTypeID = 0xa57a7dad
var (
_ bin .Encoder = &AuthImportAuthorizationRequest {}
_ bin .Decoder = &AuthImportAuthorizationRequest {}
_ bin .BareEncoder = &AuthImportAuthorizationRequest {}
_ bin .BareDecoder = &AuthImportAuthorizationRequest {}
)
func (i *AuthImportAuthorizationRequest ) Zero () bool {
if i == nil {
return true
}
if !(i .ID == 0 ) {
return false
}
if !(i .Bytes == nil ) {
return false
}
return true
}
func (i *AuthImportAuthorizationRequest ) String () string {
if i == nil {
return "AuthImportAuthorizationRequest(nil)"
}
type Alias AuthImportAuthorizationRequest
return fmt .Sprintf ("AuthImportAuthorizationRequest%+v" , Alias (*i ))
}
func (i *AuthImportAuthorizationRequest ) FillFrom (from interface {
GetID () (value int64 )
GetBytes () (value []byte )
}) {
i .ID = from .GetID ()
i .Bytes = from .GetBytes ()
}
func (*AuthImportAuthorizationRequest ) TypeID () uint32 {
return AuthImportAuthorizationRequestTypeID
}
func (*AuthImportAuthorizationRequest ) TypeName () string {
return "auth.importAuthorization"
}
func (i *AuthImportAuthorizationRequest ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "auth.importAuthorization" ,
ID : AuthImportAuthorizationRequestTypeID ,
}
if i == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "ID" ,
SchemaName : "id" ,
},
{
Name : "Bytes" ,
SchemaName : "bytes" ,
},
}
return typ
}
func (i *AuthImportAuthorizationRequest ) Encode (b *bin .Buffer ) error {
if i == nil {
return fmt .Errorf ("can't encode auth.importAuthorization#a57a7dad as nil" )
}
b .PutID (AuthImportAuthorizationRequestTypeID )
return i .EncodeBare (b )
}
func (i *AuthImportAuthorizationRequest ) EncodeBare (b *bin .Buffer ) error {
if i == nil {
return fmt .Errorf ("can't encode auth.importAuthorization#a57a7dad as nil" )
}
b .PutLong (i .ID )
b .PutBytes (i .Bytes )
return nil
}
func (i *AuthImportAuthorizationRequest ) Decode (b *bin .Buffer ) error {
if i == nil {
return fmt .Errorf ("can't decode auth.importAuthorization#a57a7dad to nil" )
}
if err := b .ConsumeID (AuthImportAuthorizationRequestTypeID ); err != nil {
return fmt .Errorf ("unable to decode auth.importAuthorization#a57a7dad: %w" , err )
}
return i .DecodeBare (b )
}
func (i *AuthImportAuthorizationRequest ) DecodeBare (b *bin .Buffer ) error {
if i == nil {
return fmt .Errorf ("can't decode auth.importAuthorization#a57a7dad to nil" )
}
{
value , err := b .Long ()
if err != nil {
return fmt .Errorf ("unable to decode auth.importAuthorization#a57a7dad: field id: %w" , err )
}
i .ID = value
}
{
value , err := b .Bytes ()
if err != nil {
return fmt .Errorf ("unable to decode auth.importAuthorization#a57a7dad: field bytes: %w" , err )
}
i .Bytes = value
}
return nil
}
func (i *AuthImportAuthorizationRequest ) GetID () (value int64 ) {
if i == nil {
return
}
return i .ID
}
func (i *AuthImportAuthorizationRequest ) GetBytes () (value []byte ) {
if i == nil {
return
}
return i .Bytes
}
func (c *Client ) AuthImportAuthorization (ctx context .Context , request *AuthImportAuthorizationRequest ) (AuthAuthorizationClass , error ) {
var result AuthAuthorizationBox
if err := c .rpc .Invoke (ctx , request , &result ); err != nil {
return nil , err
}
return result .Authorization , 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 .