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 StickersCheckShortNameRequest struct {
ShortName string
}
const StickersCheckShortNameRequestTypeID = 0x284b3639
var (
_ bin .Encoder = &StickersCheckShortNameRequest {}
_ bin .Decoder = &StickersCheckShortNameRequest {}
_ bin .BareEncoder = &StickersCheckShortNameRequest {}
_ bin .BareDecoder = &StickersCheckShortNameRequest {}
)
func (c *StickersCheckShortNameRequest ) Zero () bool {
if c == nil {
return true
}
if !(c .ShortName == "" ) {
return false
}
return true
}
func (c *StickersCheckShortNameRequest ) String () string {
if c == nil {
return "StickersCheckShortNameRequest(nil)"
}
type Alias StickersCheckShortNameRequest
return fmt .Sprintf ("StickersCheckShortNameRequest%+v" , Alias (*c ))
}
func (c *StickersCheckShortNameRequest ) FillFrom (from interface {
GetShortName () (value string )
}) {
c .ShortName = from .GetShortName ()
}
func (*StickersCheckShortNameRequest ) TypeID () uint32 {
return StickersCheckShortNameRequestTypeID
}
func (*StickersCheckShortNameRequest ) TypeName () string {
return "stickers.checkShortName"
}
func (c *StickersCheckShortNameRequest ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "stickers.checkShortName" ,
ID : StickersCheckShortNameRequestTypeID ,
}
if c == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "ShortName" ,
SchemaName : "short_name" ,
},
}
return typ
}
func (c *StickersCheckShortNameRequest ) Encode (b *bin .Buffer ) error {
if c == nil {
return fmt .Errorf ("can't encode stickers.checkShortName#284b3639 as nil" )
}
b .PutID (StickersCheckShortNameRequestTypeID )
return c .EncodeBare (b )
}
func (c *StickersCheckShortNameRequest ) EncodeBare (b *bin .Buffer ) error {
if c == nil {
return fmt .Errorf ("can't encode stickers.checkShortName#284b3639 as nil" )
}
b .PutString (c .ShortName )
return nil
}
func (c *StickersCheckShortNameRequest ) Decode (b *bin .Buffer ) error {
if c == nil {
return fmt .Errorf ("can't decode stickers.checkShortName#284b3639 to nil" )
}
if err := b .ConsumeID (StickersCheckShortNameRequestTypeID ); err != nil {
return fmt .Errorf ("unable to decode stickers.checkShortName#284b3639: %w" , err )
}
return c .DecodeBare (b )
}
func (c *StickersCheckShortNameRequest ) DecodeBare (b *bin .Buffer ) error {
if c == nil {
return fmt .Errorf ("can't decode stickers.checkShortName#284b3639 to nil" )
}
{
value , err := b .String ()
if err != nil {
return fmt .Errorf ("unable to decode stickers.checkShortName#284b3639: field short_name: %w" , err )
}
c .ShortName = value
}
return nil
}
func (c *StickersCheckShortNameRequest ) GetShortName () (value string ) {
if c == nil {
return
}
return c .ShortName
}
func (c *Client ) StickersCheckShortName (ctx context .Context , shortname string ) (bool , error ) {
var result BoolBox
request := &StickersCheckShortNameRequest {
ShortName : shortname ,
}
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 .