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 ContactsBlockFromRepliesRequest struct {
Flags bin .Fields
DeleteMessage bool
DeleteHistory bool
ReportSpam bool
MsgID int
}
const ContactsBlockFromRepliesRequestTypeID = 0x29a8962c
var (
_ bin .Encoder = &ContactsBlockFromRepliesRequest {}
_ bin .Decoder = &ContactsBlockFromRepliesRequest {}
_ bin .BareEncoder = &ContactsBlockFromRepliesRequest {}
_ bin .BareDecoder = &ContactsBlockFromRepliesRequest {}
)
func (b *ContactsBlockFromRepliesRequest ) Zero () bool {
if b == nil {
return true
}
if !(b .Flags .Zero ()) {
return false
}
if !(b .DeleteMessage == false ) {
return false
}
if !(b .DeleteHistory == false ) {
return false
}
if !(b .ReportSpam == false ) {
return false
}
if !(b .MsgID == 0 ) {
return false
}
return true
}
func (b *ContactsBlockFromRepliesRequest ) String () string {
if b == nil {
return "ContactsBlockFromRepliesRequest(nil)"
}
type Alias ContactsBlockFromRepliesRequest
return fmt .Sprintf ("ContactsBlockFromRepliesRequest%+v" , Alias (*b ))
}
func (b *ContactsBlockFromRepliesRequest ) FillFrom (from interface {
GetDeleteMessage () (value bool )
GetDeleteHistory () (value bool )
GetReportSpam () (value bool )
GetMsgID () (value int )
}) {
b .DeleteMessage = from .GetDeleteMessage ()
b .DeleteHistory = from .GetDeleteHistory ()
b .ReportSpam = from .GetReportSpam ()
b .MsgID = from .GetMsgID ()
}
func (*ContactsBlockFromRepliesRequest ) TypeID () uint32 {
return ContactsBlockFromRepliesRequestTypeID
}
func (*ContactsBlockFromRepliesRequest ) TypeName () string {
return "contacts.blockFromReplies"
}
func (b *ContactsBlockFromRepliesRequest ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "contacts.blockFromReplies" ,
ID : ContactsBlockFromRepliesRequestTypeID ,
}
if b == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "DeleteMessage" ,
SchemaName : "delete_message" ,
Null : !b .Flags .Has (0 ),
},
{
Name : "DeleteHistory" ,
SchemaName : "delete_history" ,
Null : !b .Flags .Has (1 ),
},
{
Name : "ReportSpam" ,
SchemaName : "report_spam" ,
Null : !b .Flags .Has (2 ),
},
{
Name : "MsgID" ,
SchemaName : "msg_id" ,
},
}
return typ
}
func (b *ContactsBlockFromRepliesRequest ) SetFlags () {
if !(b .DeleteMessage == false ) {
b .Flags .Set (0 )
}
if !(b .DeleteHistory == false ) {
b .Flags .Set (1 )
}
if !(b .ReportSpam == false ) {
b .Flags .Set (2 )
}
}
func (b *ContactsBlockFromRepliesRequest ) Encode (buf *bin .Buffer ) error {
if b == nil {
return fmt .Errorf ("can't encode contacts.blockFromReplies#29a8962c as nil" )
}
buf .PutID (ContactsBlockFromRepliesRequestTypeID )
return b .EncodeBare (buf )
}
func (b *ContactsBlockFromRepliesRequest ) EncodeBare (buf *bin .Buffer ) error {
if b == nil {
return fmt .Errorf ("can't encode contacts.blockFromReplies#29a8962c as nil" )
}
b .SetFlags ()
if err := b .Flags .Encode (buf ); err != nil {
return fmt .Errorf ("unable to encode contacts.blockFromReplies#29a8962c: field flags: %w" , err )
}
buf .PutInt (b .MsgID )
return nil
}
func (b *ContactsBlockFromRepliesRequest ) Decode (buf *bin .Buffer ) error {
if b == nil {
return fmt .Errorf ("can't decode contacts.blockFromReplies#29a8962c to nil" )
}
if err := buf .ConsumeID (ContactsBlockFromRepliesRequestTypeID ); err != nil {
return fmt .Errorf ("unable to decode contacts.blockFromReplies#29a8962c: %w" , err )
}
return b .DecodeBare (buf )
}
func (b *ContactsBlockFromRepliesRequest ) DecodeBare (buf *bin .Buffer ) error {
if b == nil {
return fmt .Errorf ("can't decode contacts.blockFromReplies#29a8962c to nil" )
}
{
if err := b .Flags .Decode (buf ); err != nil {
return fmt .Errorf ("unable to decode contacts.blockFromReplies#29a8962c: field flags: %w" , err )
}
}
b .DeleteMessage = b .Flags .Has (0 )
b .DeleteHistory = b .Flags .Has (1 )
b .ReportSpam = b .Flags .Has (2 )
{
value , err := buf .Int ()
if err != nil {
return fmt .Errorf ("unable to decode contacts.blockFromReplies#29a8962c: field msg_id: %w" , err )
}
b .MsgID = value
}
return nil
}
func (b *ContactsBlockFromRepliesRequest ) SetDeleteMessage (value bool ) {
if value {
b .Flags .Set (0 )
b .DeleteMessage = true
} else {
b .Flags .Unset (0 )
b .DeleteMessage = false
}
}
func (b *ContactsBlockFromRepliesRequest ) GetDeleteMessage () (value bool ) {
if b == nil {
return
}
return b .Flags .Has (0 )
}
func (b *ContactsBlockFromRepliesRequest ) SetDeleteHistory (value bool ) {
if value {
b .Flags .Set (1 )
b .DeleteHistory = true
} else {
b .Flags .Unset (1 )
b .DeleteHistory = false
}
}
func (b *ContactsBlockFromRepliesRequest ) GetDeleteHistory () (value bool ) {
if b == nil {
return
}
return b .Flags .Has (1 )
}
func (b *ContactsBlockFromRepliesRequest ) SetReportSpam (value bool ) {
if value {
b .Flags .Set (2 )
b .ReportSpam = true
} else {
b .Flags .Unset (2 )
b .ReportSpam = false
}
}
func (b *ContactsBlockFromRepliesRequest ) GetReportSpam () (value bool ) {
if b == nil {
return
}
return b .Flags .Has (2 )
}
func (b *ContactsBlockFromRepliesRequest ) GetMsgID () (value int ) {
if b == nil {
return
}
return b .MsgID
}
func (c *Client ) ContactsBlockFromReplies (ctx context .Context , request *ContactsBlockFromRepliesRequest ) (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 .