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 MessagesInstallStickerSetRequest struct {
Stickerset InputStickerSetClass
Archived bool
}
const MessagesInstallStickerSetRequestTypeID = 0xc78fe460
var (
_ bin .Encoder = &MessagesInstallStickerSetRequest {}
_ bin .Decoder = &MessagesInstallStickerSetRequest {}
_ bin .BareEncoder = &MessagesInstallStickerSetRequest {}
_ bin .BareDecoder = &MessagesInstallStickerSetRequest {}
)
func (i *MessagesInstallStickerSetRequest ) Zero () bool {
if i == nil {
return true
}
if !(i .Stickerset == nil ) {
return false
}
if !(i .Archived == false ) {
return false
}
return true
}
func (i *MessagesInstallStickerSetRequest ) String () string {
if i == nil {
return "MessagesInstallStickerSetRequest(nil)"
}
type Alias MessagesInstallStickerSetRequest
return fmt .Sprintf ("MessagesInstallStickerSetRequest%+v" , Alias (*i ))
}
func (i *MessagesInstallStickerSetRequest ) FillFrom (from interface {
GetStickerset () (value InputStickerSetClass )
GetArchived () (value bool )
}) {
i .Stickerset = from .GetStickerset ()
i .Archived = from .GetArchived ()
}
func (*MessagesInstallStickerSetRequest ) TypeID () uint32 {
return MessagesInstallStickerSetRequestTypeID
}
func (*MessagesInstallStickerSetRequest ) TypeName () string {
return "messages.installStickerSet"
}
func (i *MessagesInstallStickerSetRequest ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "messages.installStickerSet" ,
ID : MessagesInstallStickerSetRequestTypeID ,
}
if i == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "Stickerset" ,
SchemaName : "stickerset" ,
},
{
Name : "Archived" ,
SchemaName : "archived" ,
},
}
return typ
}
func (i *MessagesInstallStickerSetRequest ) Encode (b *bin .Buffer ) error {
if i == nil {
return fmt .Errorf ("can't encode messages.installStickerSet#c78fe460 as nil" )
}
b .PutID (MessagesInstallStickerSetRequestTypeID )
return i .EncodeBare (b )
}
func (i *MessagesInstallStickerSetRequest ) EncodeBare (b *bin .Buffer ) error {
if i == nil {
return fmt .Errorf ("can't encode messages.installStickerSet#c78fe460 as nil" )
}
if i .Stickerset == nil {
return fmt .Errorf ("unable to encode messages.installStickerSet#c78fe460: field stickerset is nil" )
}
if err := i .Stickerset .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode messages.installStickerSet#c78fe460: field stickerset: %w" , err )
}
b .PutBool (i .Archived )
return nil
}
func (i *MessagesInstallStickerSetRequest ) Decode (b *bin .Buffer ) error {
if i == nil {
return fmt .Errorf ("can't decode messages.installStickerSet#c78fe460 to nil" )
}
if err := b .ConsumeID (MessagesInstallStickerSetRequestTypeID ); err != nil {
return fmt .Errorf ("unable to decode messages.installStickerSet#c78fe460: %w" , err )
}
return i .DecodeBare (b )
}
func (i *MessagesInstallStickerSetRequest ) DecodeBare (b *bin .Buffer ) error {
if i == nil {
return fmt .Errorf ("can't decode messages.installStickerSet#c78fe460 to nil" )
}
{
value , err := DecodeInputStickerSet (b )
if err != nil {
return fmt .Errorf ("unable to decode messages.installStickerSet#c78fe460: field stickerset: %w" , err )
}
i .Stickerset = value
}
{
value , err := b .Bool ()
if err != nil {
return fmt .Errorf ("unable to decode messages.installStickerSet#c78fe460: field archived: %w" , err )
}
i .Archived = value
}
return nil
}
func (i *MessagesInstallStickerSetRequest ) GetStickerset () (value InputStickerSetClass ) {
if i == nil {
return
}
return i .Stickerset
}
func (i *MessagesInstallStickerSetRequest ) GetArchived () (value bool ) {
if i == nil {
return
}
return i .Archived
}
func (c *Client ) MessagesInstallStickerSet (ctx context .Context , request *MessagesInstallStickerSetRequest ) (MessagesStickerSetInstallResultClass , error ) {
var result MessagesStickerSetInstallResultBox
if err := c .rpc .Invoke (ctx , request , &result ); err != nil {
return nil , err
}
return result .StickerSetInstallResult , 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 .