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 ChannelsCheckSearchPostsFloodRequest struct {
Flags bin .Fields
Query string
}
const ChannelsCheckSearchPostsFloodRequestTypeID = 0x22567115
var (
_ bin .Encoder = &ChannelsCheckSearchPostsFloodRequest {}
_ bin .Decoder = &ChannelsCheckSearchPostsFloodRequest {}
_ bin .BareEncoder = &ChannelsCheckSearchPostsFloodRequest {}
_ bin .BareDecoder = &ChannelsCheckSearchPostsFloodRequest {}
)
func (c *ChannelsCheckSearchPostsFloodRequest ) Zero () bool {
if c == nil {
return true
}
if !(c .Flags .Zero ()) {
return false
}
if !(c .Query == "" ) {
return false
}
return true
}
func (c *ChannelsCheckSearchPostsFloodRequest ) String () string {
if c == nil {
return "ChannelsCheckSearchPostsFloodRequest(nil)"
}
type Alias ChannelsCheckSearchPostsFloodRequest
return fmt .Sprintf ("ChannelsCheckSearchPostsFloodRequest%+v" , Alias (*c ))
}
func (c *ChannelsCheckSearchPostsFloodRequest ) FillFrom (from interface {
GetQuery () (value string , ok bool )
}) {
if val , ok := from .GetQuery (); ok {
c .Query = val
}
}
func (*ChannelsCheckSearchPostsFloodRequest ) TypeID () uint32 {
return ChannelsCheckSearchPostsFloodRequestTypeID
}
func (*ChannelsCheckSearchPostsFloodRequest ) TypeName () string {
return "channels.checkSearchPostsFlood"
}
func (c *ChannelsCheckSearchPostsFloodRequest ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "channels.checkSearchPostsFlood" ,
ID : ChannelsCheckSearchPostsFloodRequestTypeID ,
}
if c == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "Query" ,
SchemaName : "query" ,
Null : !c .Flags .Has (0 ),
},
}
return typ
}
func (c *ChannelsCheckSearchPostsFloodRequest ) SetFlags () {
if !(c .Query == "" ) {
c .Flags .Set (0 )
}
}
func (c *ChannelsCheckSearchPostsFloodRequest ) Encode (b *bin .Buffer ) error {
if c == nil {
return fmt .Errorf ("can't encode channels.checkSearchPostsFlood#22567115 as nil" )
}
b .PutID (ChannelsCheckSearchPostsFloodRequestTypeID )
return c .EncodeBare (b )
}
func (c *ChannelsCheckSearchPostsFloodRequest ) EncodeBare (b *bin .Buffer ) error {
if c == nil {
return fmt .Errorf ("can't encode channels.checkSearchPostsFlood#22567115 as nil" )
}
c .SetFlags ()
if err := c .Flags .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode channels.checkSearchPostsFlood#22567115: field flags: %w" , err )
}
if c .Flags .Has (0 ) {
b .PutString (c .Query )
}
return nil
}
func (c *ChannelsCheckSearchPostsFloodRequest ) Decode (b *bin .Buffer ) error {
if c == nil {
return fmt .Errorf ("can't decode channels.checkSearchPostsFlood#22567115 to nil" )
}
if err := b .ConsumeID (ChannelsCheckSearchPostsFloodRequestTypeID ); err != nil {
return fmt .Errorf ("unable to decode channels.checkSearchPostsFlood#22567115: %w" , err )
}
return c .DecodeBare (b )
}
func (c *ChannelsCheckSearchPostsFloodRequest ) DecodeBare (b *bin .Buffer ) error {
if c == nil {
return fmt .Errorf ("can't decode channels.checkSearchPostsFlood#22567115 to nil" )
}
{
if err := c .Flags .Decode (b ); err != nil {
return fmt .Errorf ("unable to decode channels.checkSearchPostsFlood#22567115: field flags: %w" , err )
}
}
if c .Flags .Has (0 ) {
value , err := b .String ()
if err != nil {
return fmt .Errorf ("unable to decode channels.checkSearchPostsFlood#22567115: field query: %w" , err )
}
c .Query = value
}
return nil
}
func (c *ChannelsCheckSearchPostsFloodRequest ) SetQuery (value string ) {
c .Flags .Set (0 )
c .Query = value
}
func (c *ChannelsCheckSearchPostsFloodRequest ) GetQuery () (value string , ok bool ) {
if c == nil {
return
}
if !c .Flags .Has (0 ) {
return value , false
}
return c .Query , true
}
func (c *Client ) ChannelsCheckSearchPostsFlood (ctx context .Context , request *ChannelsCheckSearchPostsFloodRequest ) (*SearchPostsFlood , error ) {
var result SearchPostsFlood
if err := c .rpc .Invoke (ctx , request , &result ); err != nil {
return nil , err
}
return &result , nil
}
The pages are generated with Golds v0.8.4 . (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 @zigo_101 (reachable from the left QR code) to get the latest news of Golds .