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