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 AccountGetAuthorizationFormRequest struct {
BotID int64
Scope string
PublicKey string
}
const AccountGetAuthorizationFormRequestTypeID = 0xa929597a
var (
_ bin .Encoder = &AccountGetAuthorizationFormRequest {}
_ bin .Decoder = &AccountGetAuthorizationFormRequest {}
_ bin .BareEncoder = &AccountGetAuthorizationFormRequest {}
_ bin .BareDecoder = &AccountGetAuthorizationFormRequest {}
)
func (g *AccountGetAuthorizationFormRequest ) Zero () bool {
if g == nil {
return true
}
if !(g .BotID == 0 ) {
return false
}
if !(g .Scope == "" ) {
return false
}
if !(g .PublicKey == "" ) {
return false
}
return true
}
func (g *AccountGetAuthorizationFormRequest ) String () string {
if g == nil {
return "AccountGetAuthorizationFormRequest(nil)"
}
type Alias AccountGetAuthorizationFormRequest
return fmt .Sprintf ("AccountGetAuthorizationFormRequest%+v" , Alias (*g ))
}
func (g *AccountGetAuthorizationFormRequest ) FillFrom (from interface {
GetBotID () (value int64 )
GetScope () (value string )
GetPublicKey () (value string )
}) {
g .BotID = from .GetBotID ()
g .Scope = from .GetScope ()
g .PublicKey = from .GetPublicKey ()
}
func (*AccountGetAuthorizationFormRequest ) TypeID () uint32 {
return AccountGetAuthorizationFormRequestTypeID
}
func (*AccountGetAuthorizationFormRequest ) TypeName () string {
return "account.getAuthorizationForm"
}
func (g *AccountGetAuthorizationFormRequest ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "account.getAuthorizationForm" ,
ID : AccountGetAuthorizationFormRequestTypeID ,
}
if g == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "BotID" ,
SchemaName : "bot_id" ,
},
{
Name : "Scope" ,
SchemaName : "scope" ,
},
{
Name : "PublicKey" ,
SchemaName : "public_key" ,
},
}
return typ
}
func (g *AccountGetAuthorizationFormRequest ) Encode (b *bin .Buffer ) error {
if g == nil {
return fmt .Errorf ("can't encode account.getAuthorizationForm#a929597a as nil" )
}
b .PutID (AccountGetAuthorizationFormRequestTypeID )
return g .EncodeBare (b )
}
func (g *AccountGetAuthorizationFormRequest ) EncodeBare (b *bin .Buffer ) error {
if g == nil {
return fmt .Errorf ("can't encode account.getAuthorizationForm#a929597a as nil" )
}
b .PutLong (g .BotID )
b .PutString (g .Scope )
b .PutString (g .PublicKey )
return nil
}
func (g *AccountGetAuthorizationFormRequest ) Decode (b *bin .Buffer ) error {
if g == nil {
return fmt .Errorf ("can't decode account.getAuthorizationForm#a929597a to nil" )
}
if err := b .ConsumeID (AccountGetAuthorizationFormRequestTypeID ); err != nil {
return fmt .Errorf ("unable to decode account.getAuthorizationForm#a929597a: %w" , err )
}
return g .DecodeBare (b )
}
func (g *AccountGetAuthorizationFormRequest ) DecodeBare (b *bin .Buffer ) error {
if g == nil {
return fmt .Errorf ("can't decode account.getAuthorizationForm#a929597a to nil" )
}
{
value , err := b .Long ()
if err != nil {
return fmt .Errorf ("unable to decode account.getAuthorizationForm#a929597a: field bot_id: %w" , err )
}
g .BotID = value
}
{
value , err := b .String ()
if err != nil {
return fmt .Errorf ("unable to decode account.getAuthorizationForm#a929597a: field scope: %w" , err )
}
g .Scope = value
}
{
value , err := b .String ()
if err != nil {
return fmt .Errorf ("unable to decode account.getAuthorizationForm#a929597a: field public_key: %w" , err )
}
g .PublicKey = value
}
return nil
}
func (g *AccountGetAuthorizationFormRequest ) GetBotID () (value int64 ) {
if g == nil {
return
}
return g .BotID
}
func (g *AccountGetAuthorizationFormRequest ) GetScope () (value string ) {
if g == nil {
return
}
return g .Scope
}
func (g *AccountGetAuthorizationFormRequest ) GetPublicKey () (value string ) {
if g == nil {
return
}
return g .PublicKey
}
func (c *Client ) AccountGetAuthorizationForm (ctx context .Context , request *AccountGetAuthorizationFormRequest ) (*AccountAuthorizationForm , error ) {
var result AccountAuthorizationForm
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 .