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 ChannelsReportAntiSpamFalsePositiveRequest struct {
Channel InputChannelClass
MsgID int
}
const ChannelsReportAntiSpamFalsePositiveRequestTypeID = 0xa850a693
var (
_ bin .Encoder = &ChannelsReportAntiSpamFalsePositiveRequest {}
_ bin .Decoder = &ChannelsReportAntiSpamFalsePositiveRequest {}
_ bin .BareEncoder = &ChannelsReportAntiSpamFalsePositiveRequest {}
_ bin .BareDecoder = &ChannelsReportAntiSpamFalsePositiveRequest {}
)
func (r *ChannelsReportAntiSpamFalsePositiveRequest ) Zero () bool {
if r == nil {
return true
}
if !(r .Channel == nil ) {
return false
}
if !(r .MsgID == 0 ) {
return false
}
return true
}
func (r *ChannelsReportAntiSpamFalsePositiveRequest ) String () string {
if r == nil {
return "ChannelsReportAntiSpamFalsePositiveRequest(nil)"
}
type Alias ChannelsReportAntiSpamFalsePositiveRequest
return fmt .Sprintf ("ChannelsReportAntiSpamFalsePositiveRequest%+v" , Alias (*r ))
}
func (r *ChannelsReportAntiSpamFalsePositiveRequest ) FillFrom (from interface {
GetChannel () (value InputChannelClass )
GetMsgID () (value int )
}) {
r .Channel = from .GetChannel ()
r .MsgID = from .GetMsgID ()
}
func (*ChannelsReportAntiSpamFalsePositiveRequest ) TypeID () uint32 {
return ChannelsReportAntiSpamFalsePositiveRequestTypeID
}
func (*ChannelsReportAntiSpamFalsePositiveRequest ) TypeName () string {
return "channels.reportAntiSpamFalsePositive"
}
func (r *ChannelsReportAntiSpamFalsePositiveRequest ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "channels.reportAntiSpamFalsePositive" ,
ID : ChannelsReportAntiSpamFalsePositiveRequestTypeID ,
}
if r == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "Channel" ,
SchemaName : "channel" ,
},
{
Name : "MsgID" ,
SchemaName : "msg_id" ,
},
}
return typ
}
func (r *ChannelsReportAntiSpamFalsePositiveRequest ) Encode (b *bin .Buffer ) error {
if r == nil {
return fmt .Errorf ("can't encode channels.reportAntiSpamFalsePositive#a850a693 as nil" )
}
b .PutID (ChannelsReportAntiSpamFalsePositiveRequestTypeID )
return r .EncodeBare (b )
}
func (r *ChannelsReportAntiSpamFalsePositiveRequest ) EncodeBare (b *bin .Buffer ) error {
if r == nil {
return fmt .Errorf ("can't encode channels.reportAntiSpamFalsePositive#a850a693 as nil" )
}
if r .Channel == nil {
return fmt .Errorf ("unable to encode channels.reportAntiSpamFalsePositive#a850a693: field channel is nil" )
}
if err := r .Channel .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode channels.reportAntiSpamFalsePositive#a850a693: field channel: %w" , err )
}
b .PutInt (r .MsgID )
return nil
}
func (r *ChannelsReportAntiSpamFalsePositiveRequest ) Decode (b *bin .Buffer ) error {
if r == nil {
return fmt .Errorf ("can't decode channels.reportAntiSpamFalsePositive#a850a693 to nil" )
}
if err := b .ConsumeID (ChannelsReportAntiSpamFalsePositiveRequestTypeID ); err != nil {
return fmt .Errorf ("unable to decode channels.reportAntiSpamFalsePositive#a850a693: %w" , err )
}
return r .DecodeBare (b )
}
func (r *ChannelsReportAntiSpamFalsePositiveRequest ) DecodeBare (b *bin .Buffer ) error {
if r == nil {
return fmt .Errorf ("can't decode channels.reportAntiSpamFalsePositive#a850a693 to nil" )
}
{
value , err := DecodeInputChannel (b )
if err != nil {
return fmt .Errorf ("unable to decode channels.reportAntiSpamFalsePositive#a850a693: field channel: %w" , err )
}
r .Channel = value
}
{
value , err := b .Int ()
if err != nil {
return fmt .Errorf ("unable to decode channels.reportAntiSpamFalsePositive#a850a693: field msg_id: %w" , err )
}
r .MsgID = value
}
return nil
}
func (r *ChannelsReportAntiSpamFalsePositiveRequest ) GetChannel () (value InputChannelClass ) {
if r == nil {
return
}
return r .Channel
}
func (r *ChannelsReportAntiSpamFalsePositiveRequest ) GetMsgID () (value int ) {
if r == nil {
return
}
return r .MsgID
}
func (r *ChannelsReportAntiSpamFalsePositiveRequest ) GetChannelAsNotEmpty () (NotEmptyInputChannel , bool ) {
return r .Channel .AsNotEmpty ()
}
func (c *Client ) ChannelsReportAntiSpamFalsePositive (ctx context .Context , request *ChannelsReportAntiSpamFalsePositiveRequest ) (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 .