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 MessagesReadEncryptedHistoryRequest struct {
Peer InputEncryptedChat
MaxDate int
}
const MessagesReadEncryptedHistoryRequestTypeID = 0x7f4b690a
var (
_ bin .Encoder = &MessagesReadEncryptedHistoryRequest {}
_ bin .Decoder = &MessagesReadEncryptedHistoryRequest {}
_ bin .BareEncoder = &MessagesReadEncryptedHistoryRequest {}
_ bin .BareDecoder = &MessagesReadEncryptedHistoryRequest {}
)
func (r *MessagesReadEncryptedHistoryRequest ) Zero () bool {
if r == nil {
return true
}
if !(r .Peer .Zero ()) {
return false
}
if !(r .MaxDate == 0 ) {
return false
}
return true
}
func (r *MessagesReadEncryptedHistoryRequest ) String () string {
if r == nil {
return "MessagesReadEncryptedHistoryRequest(nil)"
}
type Alias MessagesReadEncryptedHistoryRequest
return fmt .Sprintf ("MessagesReadEncryptedHistoryRequest%+v" , Alias (*r ))
}
func (r *MessagesReadEncryptedHistoryRequest ) FillFrom (from interface {
GetPeer () (value InputEncryptedChat )
GetMaxDate () (value int )
}) {
r .Peer = from .GetPeer ()
r .MaxDate = from .GetMaxDate ()
}
func (*MessagesReadEncryptedHistoryRequest ) TypeID () uint32 {
return MessagesReadEncryptedHistoryRequestTypeID
}
func (*MessagesReadEncryptedHistoryRequest ) TypeName () string {
return "messages.readEncryptedHistory"
}
func (r *MessagesReadEncryptedHistoryRequest ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "messages.readEncryptedHistory" ,
ID : MessagesReadEncryptedHistoryRequestTypeID ,
}
if r == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "Peer" ,
SchemaName : "peer" ,
},
{
Name : "MaxDate" ,
SchemaName : "max_date" ,
},
}
return typ
}
func (r *MessagesReadEncryptedHistoryRequest ) Encode (b *bin .Buffer ) error {
if r == nil {
return fmt .Errorf ("can't encode messages.readEncryptedHistory#7f4b690a as nil" )
}
b .PutID (MessagesReadEncryptedHistoryRequestTypeID )
return r .EncodeBare (b )
}
func (r *MessagesReadEncryptedHistoryRequest ) EncodeBare (b *bin .Buffer ) error {
if r == nil {
return fmt .Errorf ("can't encode messages.readEncryptedHistory#7f4b690a as nil" )
}
if err := r .Peer .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode messages.readEncryptedHistory#7f4b690a: field peer: %w" , err )
}
b .PutInt (r .MaxDate )
return nil
}
func (r *MessagesReadEncryptedHistoryRequest ) Decode (b *bin .Buffer ) error {
if r == nil {
return fmt .Errorf ("can't decode messages.readEncryptedHistory#7f4b690a to nil" )
}
if err := b .ConsumeID (MessagesReadEncryptedHistoryRequestTypeID ); err != nil {
return fmt .Errorf ("unable to decode messages.readEncryptedHistory#7f4b690a: %w" , err )
}
return r .DecodeBare (b )
}
func (r *MessagesReadEncryptedHistoryRequest ) DecodeBare (b *bin .Buffer ) error {
if r == nil {
return fmt .Errorf ("can't decode messages.readEncryptedHistory#7f4b690a to nil" )
}
{
if err := r .Peer .Decode (b ); err != nil {
return fmt .Errorf ("unable to decode messages.readEncryptedHistory#7f4b690a: field peer: %w" , err )
}
}
{
value , err := b .Int ()
if err != nil {
return fmt .Errorf ("unable to decode messages.readEncryptedHistory#7f4b690a: field max_date: %w" , err )
}
r .MaxDate = value
}
return nil
}
func (r *MessagesReadEncryptedHistoryRequest ) GetPeer () (value InputEncryptedChat ) {
if r == nil {
return
}
return r .Peer
}
func (r *MessagesReadEncryptedHistoryRequest ) GetMaxDate () (value int ) {
if r == nil {
return
}
return r .MaxDate
}
func (c *Client ) MessagesReadEncryptedHistory (ctx context .Context , request *MessagesReadEncryptedHistoryRequest ) (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 .