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 MessagesSetHistoryTTLRequest struct {
Peer InputPeerClass
Period int
}
const MessagesSetHistoryTTLRequestTypeID = 0xb80e5fe4
var (
_ bin .Encoder = &MessagesSetHistoryTTLRequest {}
_ bin .Decoder = &MessagesSetHistoryTTLRequest {}
_ bin .BareEncoder = &MessagesSetHistoryTTLRequest {}
_ bin .BareDecoder = &MessagesSetHistoryTTLRequest {}
)
func (s *MessagesSetHistoryTTLRequest ) Zero () bool {
if s == nil {
return true
}
if !(s .Peer == nil ) {
return false
}
if !(s .Period == 0 ) {
return false
}
return true
}
func (s *MessagesSetHistoryTTLRequest ) String () string {
if s == nil {
return "MessagesSetHistoryTTLRequest(nil)"
}
type Alias MessagesSetHistoryTTLRequest
return fmt .Sprintf ("MessagesSetHistoryTTLRequest%+v" , Alias (*s ))
}
func (s *MessagesSetHistoryTTLRequest ) FillFrom (from interface {
GetPeer () (value InputPeerClass )
GetPeriod () (value int )
}) {
s .Peer = from .GetPeer ()
s .Period = from .GetPeriod ()
}
func (*MessagesSetHistoryTTLRequest ) TypeID () uint32 {
return MessagesSetHistoryTTLRequestTypeID
}
func (*MessagesSetHistoryTTLRequest ) TypeName () string {
return "messages.setHistoryTTL"
}
func (s *MessagesSetHistoryTTLRequest ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "messages.setHistoryTTL" ,
ID : MessagesSetHistoryTTLRequestTypeID ,
}
if s == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "Peer" ,
SchemaName : "peer" ,
},
{
Name : "Period" ,
SchemaName : "period" ,
},
}
return typ
}
func (s *MessagesSetHistoryTTLRequest ) Encode (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't encode messages.setHistoryTTL#b80e5fe4 as nil" )
}
b .PutID (MessagesSetHistoryTTLRequestTypeID )
return s .EncodeBare (b )
}
func (s *MessagesSetHistoryTTLRequest ) EncodeBare (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't encode messages.setHistoryTTL#b80e5fe4 as nil" )
}
if s .Peer == nil {
return fmt .Errorf ("unable to encode messages.setHistoryTTL#b80e5fe4: field peer is nil" )
}
if err := s .Peer .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode messages.setHistoryTTL#b80e5fe4: field peer: %w" , err )
}
b .PutInt (s .Period )
return nil
}
func (s *MessagesSetHistoryTTLRequest ) Decode (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't decode messages.setHistoryTTL#b80e5fe4 to nil" )
}
if err := b .ConsumeID (MessagesSetHistoryTTLRequestTypeID ); err != nil {
return fmt .Errorf ("unable to decode messages.setHistoryTTL#b80e5fe4: %w" , err )
}
return s .DecodeBare (b )
}
func (s *MessagesSetHistoryTTLRequest ) DecodeBare (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't decode messages.setHistoryTTL#b80e5fe4 to nil" )
}
{
value , err := DecodeInputPeer (b )
if err != nil {
return fmt .Errorf ("unable to decode messages.setHistoryTTL#b80e5fe4: field peer: %w" , err )
}
s .Peer = value
}
{
value , err := b .Int ()
if err != nil {
return fmt .Errorf ("unable to decode messages.setHistoryTTL#b80e5fe4: field period: %w" , err )
}
s .Period = value
}
return nil
}
func (s *MessagesSetHistoryTTLRequest ) GetPeer () (value InputPeerClass ) {
if s == nil {
return
}
return s .Peer
}
func (s *MessagesSetHistoryTTLRequest ) GetPeriod () (value int ) {
if s == nil {
return
}
return s .Period
}
func (c *Client ) MessagesSetHistoryTTL (ctx context .Context , request *MessagesSetHistoryTTLRequest ) (UpdatesClass , error ) {
var result UpdatesBox
if err := c .rpc .Invoke (ctx , request , &result ); err != nil {
return nil , err
}
return result .Updates , 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 .