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