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