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 AuthImportLoginTokenRequest struct {
Token []byte
}
const AuthImportLoginTokenRequestTypeID = 0x95ac5ce4
var (
_ bin .Encoder = &AuthImportLoginTokenRequest {}
_ bin .Decoder = &AuthImportLoginTokenRequest {}
_ bin .BareEncoder = &AuthImportLoginTokenRequest {}
_ bin .BareDecoder = &AuthImportLoginTokenRequest {}
)
func (i *AuthImportLoginTokenRequest ) Zero () bool {
if i == nil {
return true
}
if !(i .Token == nil ) {
return false
}
return true
}
func (i *AuthImportLoginTokenRequest ) String () string {
if i == nil {
return "AuthImportLoginTokenRequest(nil)"
}
type Alias AuthImportLoginTokenRequest
return fmt .Sprintf ("AuthImportLoginTokenRequest%+v" , Alias (*i ))
}
func (i *AuthImportLoginTokenRequest ) FillFrom (from interface {
GetToken () (value []byte )
}) {
i .Token = from .GetToken ()
}
func (*AuthImportLoginTokenRequest ) TypeID () uint32 {
return AuthImportLoginTokenRequestTypeID
}
func (*AuthImportLoginTokenRequest ) TypeName () string {
return "auth.importLoginToken"
}
func (i *AuthImportLoginTokenRequest ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "auth.importLoginToken" ,
ID : AuthImportLoginTokenRequestTypeID ,
}
if i == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "Token" ,
SchemaName : "token" ,
},
}
return typ
}
func (i *AuthImportLoginTokenRequest ) Encode (b *bin .Buffer ) error {
if i == nil {
return fmt .Errorf ("can't encode auth.importLoginToken#95ac5ce4 as nil" )
}
b .PutID (AuthImportLoginTokenRequestTypeID )
return i .EncodeBare (b )
}
func (i *AuthImportLoginTokenRequest ) EncodeBare (b *bin .Buffer ) error {
if i == nil {
return fmt .Errorf ("can't encode auth.importLoginToken#95ac5ce4 as nil" )
}
b .PutBytes (i .Token )
return nil
}
func (i *AuthImportLoginTokenRequest ) Decode (b *bin .Buffer ) error {
if i == nil {
return fmt .Errorf ("can't decode auth.importLoginToken#95ac5ce4 to nil" )
}
if err := b .ConsumeID (AuthImportLoginTokenRequestTypeID ); err != nil {
return fmt .Errorf ("unable to decode auth.importLoginToken#95ac5ce4: %w" , err )
}
return i .DecodeBare (b )
}
func (i *AuthImportLoginTokenRequest ) DecodeBare (b *bin .Buffer ) error {
if i == nil {
return fmt .Errorf ("can't decode auth.importLoginToken#95ac5ce4 to nil" )
}
{
value , err := b .Bytes ()
if err != nil {
return fmt .Errorf ("unable to decode auth.importLoginToken#95ac5ce4: field token: %w" , err )
}
i .Token = value
}
return nil
}
func (i *AuthImportLoginTokenRequest ) GetToken () (value []byte ) {
if i == nil {
return
}
return i .Token
}
func (c *Client ) AuthImportLoginToken (ctx context .Context , token []byte ) (AuthLoginTokenClass , error ) {
var result AuthLoginTokenBox
request := &AuthImportLoginTokenRequest {
Token : token ,
}
if err := c .rpc .Invoke (ctx , request , &result ); err != nil {
return nil , err
}
return result .LoginToken , 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 .