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 AccountUpdateStatusRequest struct {
Offline bool
}
const AccountUpdateStatusRequestTypeID = 0x6628562c
var (
_ bin .Encoder = &AccountUpdateStatusRequest {}
_ bin .Decoder = &AccountUpdateStatusRequest {}
_ bin .BareEncoder = &AccountUpdateStatusRequest {}
_ bin .BareDecoder = &AccountUpdateStatusRequest {}
)
func (u *AccountUpdateStatusRequest ) Zero () bool {
if u == nil {
return true
}
if !(u .Offline == false ) {
return false
}
return true
}
func (u *AccountUpdateStatusRequest ) String () string {
if u == nil {
return "AccountUpdateStatusRequest(nil)"
}
type Alias AccountUpdateStatusRequest
return fmt .Sprintf ("AccountUpdateStatusRequest%+v" , Alias (*u ))
}
func (u *AccountUpdateStatusRequest ) FillFrom (from interface {
GetOffline () (value bool )
}) {
u .Offline = from .GetOffline ()
}
func (*AccountUpdateStatusRequest ) TypeID () uint32 {
return AccountUpdateStatusRequestTypeID
}
func (*AccountUpdateStatusRequest ) TypeName () string {
return "account.updateStatus"
}
func (u *AccountUpdateStatusRequest ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "account.updateStatus" ,
ID : AccountUpdateStatusRequestTypeID ,
}
if u == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "Offline" ,
SchemaName : "offline" ,
},
}
return typ
}
func (u *AccountUpdateStatusRequest ) Encode (b *bin .Buffer ) error {
if u == nil {
return fmt .Errorf ("can't encode account.updateStatus#6628562c as nil" )
}
b .PutID (AccountUpdateStatusRequestTypeID )
return u .EncodeBare (b )
}
func (u *AccountUpdateStatusRequest ) EncodeBare (b *bin .Buffer ) error {
if u == nil {
return fmt .Errorf ("can't encode account.updateStatus#6628562c as nil" )
}
b .PutBool (u .Offline )
return nil
}
func (u *AccountUpdateStatusRequest ) Decode (b *bin .Buffer ) error {
if u == nil {
return fmt .Errorf ("can't decode account.updateStatus#6628562c to nil" )
}
if err := b .ConsumeID (AccountUpdateStatusRequestTypeID ); err != nil {
return fmt .Errorf ("unable to decode account.updateStatus#6628562c: %w" , err )
}
return u .DecodeBare (b )
}
func (u *AccountUpdateStatusRequest ) DecodeBare (b *bin .Buffer ) error {
if u == nil {
return fmt .Errorf ("can't decode account.updateStatus#6628562c to nil" )
}
{
value , err := b .Bool ()
if err != nil {
return fmt .Errorf ("unable to decode account.updateStatus#6628562c: field offline: %w" , err )
}
u .Offline = value
}
return nil
}
func (u *AccountUpdateStatusRequest ) GetOffline () (value bool ) {
if u == nil {
return
}
return u .Offline
}
func (c *Client ) AccountUpdateStatus (ctx context .Context , offline bool ) (bool , error ) {
var result BoolBox
request := &AccountUpdateStatusRequest {
Offline : offline ,
}
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 .