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 ChannelsReportSpamRequest struct {
Channel InputChannelClass
Participant InputPeerClass
ID []int
}
const ChannelsReportSpamRequestTypeID = 0xf44a8315
var (
_ bin .Encoder = &ChannelsReportSpamRequest {}
_ bin .Decoder = &ChannelsReportSpamRequest {}
_ bin .BareEncoder = &ChannelsReportSpamRequest {}
_ bin .BareDecoder = &ChannelsReportSpamRequest {}
)
func (r *ChannelsReportSpamRequest ) Zero () bool {
if r == nil {
return true
}
if !(r .Channel == nil ) {
return false
}
if !(r .Participant == nil ) {
return false
}
if !(r .ID == nil ) {
return false
}
return true
}
func (r *ChannelsReportSpamRequest ) String () string {
if r == nil {
return "ChannelsReportSpamRequest(nil)"
}
type Alias ChannelsReportSpamRequest
return fmt .Sprintf ("ChannelsReportSpamRequest%+v" , Alias (*r ))
}
func (r *ChannelsReportSpamRequest ) FillFrom (from interface {
GetChannel () (value InputChannelClass )
GetParticipant () (value InputPeerClass )
GetID () (value []int )
}) {
r .Channel = from .GetChannel ()
r .Participant = from .GetParticipant ()
r .ID = from .GetID ()
}
func (*ChannelsReportSpamRequest ) TypeID () uint32 {
return ChannelsReportSpamRequestTypeID
}
func (*ChannelsReportSpamRequest ) TypeName () string {
return "channels.reportSpam"
}
func (r *ChannelsReportSpamRequest ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "channels.reportSpam" ,
ID : ChannelsReportSpamRequestTypeID ,
}
if r == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "Channel" ,
SchemaName : "channel" ,
},
{
Name : "Participant" ,
SchemaName : "participant" ,
},
{
Name : "ID" ,
SchemaName : "id" ,
},
}
return typ
}
func (r *ChannelsReportSpamRequest ) Encode (b *bin .Buffer ) error {
if r == nil {
return fmt .Errorf ("can't encode channels.reportSpam#f44a8315 as nil" )
}
b .PutID (ChannelsReportSpamRequestTypeID )
return r .EncodeBare (b )
}
func (r *ChannelsReportSpamRequest ) EncodeBare (b *bin .Buffer ) error {
if r == nil {
return fmt .Errorf ("can't encode channels.reportSpam#f44a8315 as nil" )
}
if r .Channel == nil {
return fmt .Errorf ("unable to encode channels.reportSpam#f44a8315: field channel is nil" )
}
if err := r .Channel .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode channels.reportSpam#f44a8315: field channel: %w" , err )
}
if r .Participant == nil {
return fmt .Errorf ("unable to encode channels.reportSpam#f44a8315: field participant is nil" )
}
if err := r .Participant .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode channels.reportSpam#f44a8315: field participant: %w" , err )
}
b .PutVectorHeader (len (r .ID ))
for _ , v := range r .ID {
b .PutInt (v )
}
return nil
}
func (r *ChannelsReportSpamRequest ) Decode (b *bin .Buffer ) error {
if r == nil {
return fmt .Errorf ("can't decode channels.reportSpam#f44a8315 to nil" )
}
if err := b .ConsumeID (ChannelsReportSpamRequestTypeID ); err != nil {
return fmt .Errorf ("unable to decode channels.reportSpam#f44a8315: %w" , err )
}
return r .DecodeBare (b )
}
func (r *ChannelsReportSpamRequest ) DecodeBare (b *bin .Buffer ) error {
if r == nil {
return fmt .Errorf ("can't decode channels.reportSpam#f44a8315 to nil" )
}
{
value , err := DecodeInputChannel (b )
if err != nil {
return fmt .Errorf ("unable to decode channels.reportSpam#f44a8315: field channel: %w" , err )
}
r .Channel = value
}
{
value , err := DecodeInputPeer (b )
if err != nil {
return fmt .Errorf ("unable to decode channels.reportSpam#f44a8315: field participant: %w" , err )
}
r .Participant = value
}
{
headerLen , err := b .VectorHeader ()
if err != nil {
return fmt .Errorf ("unable to decode channels.reportSpam#f44a8315: field id: %w" , err )
}
if headerLen > 0 {
r .ID = make ([]int , 0 , headerLen %bin .PreallocateLimit )
}
for idx := 0 ; idx < headerLen ; idx ++ {
value , err := b .Int ()
if err != nil {
return fmt .Errorf ("unable to decode channels.reportSpam#f44a8315: field id: %w" , err )
}
r .ID = append (r .ID , value )
}
}
return nil
}
func (r *ChannelsReportSpamRequest ) GetChannel () (value InputChannelClass ) {
if r == nil {
return
}
return r .Channel
}
func (r *ChannelsReportSpamRequest ) GetParticipant () (value InputPeerClass ) {
if r == nil {
return
}
return r .Participant
}
func (r *ChannelsReportSpamRequest ) GetID () (value []int ) {
if r == nil {
return
}
return r .ID
}
func (r *ChannelsReportSpamRequest ) GetChannelAsNotEmpty () (NotEmptyInputChannel , bool ) {
return r .Channel .AsNotEmpty ()
}
func (c *Client ) ChannelsReportSpam (ctx context .Context , request *ChannelsReportSpamRequest ) (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 .