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 MessagesSetEncryptedTypingRequest struct {
Peer InputEncryptedChat
Typing bool
}
const MessagesSetEncryptedTypingRequestTypeID = 0x791451ed
var (
_ bin .Encoder = &MessagesSetEncryptedTypingRequest {}
_ bin .Decoder = &MessagesSetEncryptedTypingRequest {}
_ bin .BareEncoder = &MessagesSetEncryptedTypingRequest {}
_ bin .BareDecoder = &MessagesSetEncryptedTypingRequest {}
)
func (s *MessagesSetEncryptedTypingRequest ) Zero () bool {
if s == nil {
return true
}
if !(s .Peer .Zero ()) {
return false
}
if !(s .Typing == false ) {
return false
}
return true
}
func (s *MessagesSetEncryptedTypingRequest ) String () string {
if s == nil {
return "MessagesSetEncryptedTypingRequest(nil)"
}
type Alias MessagesSetEncryptedTypingRequest
return fmt .Sprintf ("MessagesSetEncryptedTypingRequest%+v" , Alias (*s ))
}
func (s *MessagesSetEncryptedTypingRequest ) FillFrom (from interface {
GetPeer () (value InputEncryptedChat )
GetTyping () (value bool )
}) {
s .Peer = from .GetPeer ()
s .Typing = from .GetTyping ()
}
func (*MessagesSetEncryptedTypingRequest ) TypeID () uint32 {
return MessagesSetEncryptedTypingRequestTypeID
}
func (*MessagesSetEncryptedTypingRequest ) TypeName () string {
return "messages.setEncryptedTyping"
}
func (s *MessagesSetEncryptedTypingRequest ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "messages.setEncryptedTyping" ,
ID : MessagesSetEncryptedTypingRequestTypeID ,
}
if s == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "Peer" ,
SchemaName : "peer" ,
},
{
Name : "Typing" ,
SchemaName : "typing" ,
},
}
return typ
}
func (s *MessagesSetEncryptedTypingRequest ) Encode (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't encode messages.setEncryptedTyping#791451ed as nil" )
}
b .PutID (MessagesSetEncryptedTypingRequestTypeID )
return s .EncodeBare (b )
}
func (s *MessagesSetEncryptedTypingRequest ) EncodeBare (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't encode messages.setEncryptedTyping#791451ed as nil" )
}
if err := s .Peer .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode messages.setEncryptedTyping#791451ed: field peer: %w" , err )
}
b .PutBool (s .Typing )
return nil
}
func (s *MessagesSetEncryptedTypingRequest ) Decode (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't decode messages.setEncryptedTyping#791451ed to nil" )
}
if err := b .ConsumeID (MessagesSetEncryptedTypingRequestTypeID ); err != nil {
return fmt .Errorf ("unable to decode messages.setEncryptedTyping#791451ed: %w" , err )
}
return s .DecodeBare (b )
}
func (s *MessagesSetEncryptedTypingRequest ) DecodeBare (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't decode messages.setEncryptedTyping#791451ed to nil" )
}
{
if err := s .Peer .Decode (b ); err != nil {
return fmt .Errorf ("unable to decode messages.setEncryptedTyping#791451ed: field peer: %w" , err )
}
}
{
value , err := b .Bool ()
if err != nil {
return fmt .Errorf ("unable to decode messages.setEncryptedTyping#791451ed: field typing: %w" , err )
}
s .Typing = value
}
return nil
}
func (s *MessagesSetEncryptedTypingRequest ) GetPeer () (value InputEncryptedChat ) {
if s == nil {
return
}
return s .Peer
}
func (s *MessagesSetEncryptedTypingRequest ) GetTyping () (value bool ) {
if s == nil {
return
}
return s .Typing
}
func (c *Client ) MessagesSetEncryptedTyping (ctx context .Context , request *MessagesSetEncryptedTypingRequest ) (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 .