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