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 AccountFinishTakeoutSessionRequest struct {
Flags bin .Fields
Success bool
}
const AccountFinishTakeoutSessionRequestTypeID = 0x1d2652ee
var (
_ bin .Encoder = &AccountFinishTakeoutSessionRequest {}
_ bin .Decoder = &AccountFinishTakeoutSessionRequest {}
_ bin .BareEncoder = &AccountFinishTakeoutSessionRequest {}
_ bin .BareDecoder = &AccountFinishTakeoutSessionRequest {}
)
func (f *AccountFinishTakeoutSessionRequest ) Zero () bool {
if f == nil {
return true
}
if !(f .Flags .Zero ()) {
return false
}
if !(f .Success == false ) {
return false
}
return true
}
func (f *AccountFinishTakeoutSessionRequest ) String () string {
if f == nil {
return "AccountFinishTakeoutSessionRequest(nil)"
}
type Alias AccountFinishTakeoutSessionRequest
return fmt .Sprintf ("AccountFinishTakeoutSessionRequest%+v" , Alias (*f ))
}
func (f *AccountFinishTakeoutSessionRequest ) FillFrom (from interface {
GetSuccess () (value bool )
}) {
f .Success = from .GetSuccess ()
}
func (*AccountFinishTakeoutSessionRequest ) TypeID () uint32 {
return AccountFinishTakeoutSessionRequestTypeID
}
func (*AccountFinishTakeoutSessionRequest ) TypeName () string {
return "account.finishTakeoutSession"
}
func (f *AccountFinishTakeoutSessionRequest ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "account.finishTakeoutSession" ,
ID : AccountFinishTakeoutSessionRequestTypeID ,
}
if f == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "Success" ,
SchemaName : "success" ,
Null : !f .Flags .Has (0 ),
},
}
return typ
}
func (f *AccountFinishTakeoutSessionRequest ) SetFlags () {
if !(f .Success == false ) {
f .Flags .Set (0 )
}
}
func (f *AccountFinishTakeoutSessionRequest ) Encode (b *bin .Buffer ) error {
if f == nil {
return fmt .Errorf ("can't encode account.finishTakeoutSession#1d2652ee as nil" )
}
b .PutID (AccountFinishTakeoutSessionRequestTypeID )
return f .EncodeBare (b )
}
func (f *AccountFinishTakeoutSessionRequest ) EncodeBare (b *bin .Buffer ) error {
if f == nil {
return fmt .Errorf ("can't encode account.finishTakeoutSession#1d2652ee as nil" )
}
f .SetFlags ()
if err := f .Flags .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode account.finishTakeoutSession#1d2652ee: field flags: %w" , err )
}
return nil
}
func (f *AccountFinishTakeoutSessionRequest ) Decode (b *bin .Buffer ) error {
if f == nil {
return fmt .Errorf ("can't decode account.finishTakeoutSession#1d2652ee to nil" )
}
if err := b .ConsumeID (AccountFinishTakeoutSessionRequestTypeID ); err != nil {
return fmt .Errorf ("unable to decode account.finishTakeoutSession#1d2652ee: %w" , err )
}
return f .DecodeBare (b )
}
func (f *AccountFinishTakeoutSessionRequest ) DecodeBare (b *bin .Buffer ) error {
if f == nil {
return fmt .Errorf ("can't decode account.finishTakeoutSession#1d2652ee to nil" )
}
{
if err := f .Flags .Decode (b ); err != nil {
return fmt .Errorf ("unable to decode account.finishTakeoutSession#1d2652ee: field flags: %w" , err )
}
}
f .Success = f .Flags .Has (0 )
return nil
}
func (f *AccountFinishTakeoutSessionRequest ) SetSuccess (value bool ) {
if value {
f .Flags .Set (0 )
f .Success = true
} else {
f .Flags .Unset (0 )
f .Success = false
}
}
func (f *AccountFinishTakeoutSessionRequest ) GetSuccess () (value bool ) {
if f == nil {
return
}
return f .Flags .Has (0 )
}
func (c *Client ) AccountFinishTakeoutSession (ctx context .Context , request *AccountFinishTakeoutSessionRequest ) (bool , error ) {
var result BoolBox
if err := c .rpc .Invoke (ctx , request , &result ); err != nil {
return false , err
}
_ , ok := result .Bool .(*BoolTrue )
return ok , 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 .