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 MessagesSaveGifRequest struct {
ID InputDocumentClass
Unsave bool
}
const MessagesSaveGifRequestTypeID = 0x327a30cb
var (
_ bin .Encoder = &MessagesSaveGifRequest {}
_ bin .Decoder = &MessagesSaveGifRequest {}
_ bin .BareEncoder = &MessagesSaveGifRequest {}
_ bin .BareDecoder = &MessagesSaveGifRequest {}
)
func (s *MessagesSaveGifRequest ) Zero () bool {
if s == nil {
return true
}
if !(s .ID == nil ) {
return false
}
if !(s .Unsave == false ) {
return false
}
return true
}
func (s *MessagesSaveGifRequest ) String () string {
if s == nil {
return "MessagesSaveGifRequest(nil)"
}
type Alias MessagesSaveGifRequest
return fmt .Sprintf ("MessagesSaveGifRequest%+v" , Alias (*s ))
}
func (s *MessagesSaveGifRequest ) FillFrom (from interface {
GetID () (value InputDocumentClass )
GetUnsave () (value bool )
}) {
s .ID = from .GetID ()
s .Unsave = from .GetUnsave ()
}
func (*MessagesSaveGifRequest ) TypeID () uint32 {
return MessagesSaveGifRequestTypeID
}
func (*MessagesSaveGifRequest ) TypeName () string {
return "messages.saveGif"
}
func (s *MessagesSaveGifRequest ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "messages.saveGif" ,
ID : MessagesSaveGifRequestTypeID ,
}
if s == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "ID" ,
SchemaName : "id" ,
},
{
Name : "Unsave" ,
SchemaName : "unsave" ,
},
}
return typ
}
func (s *MessagesSaveGifRequest ) Encode (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't encode messages.saveGif#327a30cb as nil" )
}
b .PutID (MessagesSaveGifRequestTypeID )
return s .EncodeBare (b )
}
func (s *MessagesSaveGifRequest ) EncodeBare (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't encode messages.saveGif#327a30cb as nil" )
}
if s .ID == nil {
return fmt .Errorf ("unable to encode messages.saveGif#327a30cb: field id is nil" )
}
if err := s .ID .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode messages.saveGif#327a30cb: field id: %w" , err )
}
b .PutBool (s .Unsave )
return nil
}
func (s *MessagesSaveGifRequest ) Decode (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't decode messages.saveGif#327a30cb to nil" )
}
if err := b .ConsumeID (MessagesSaveGifRequestTypeID ); err != nil {
return fmt .Errorf ("unable to decode messages.saveGif#327a30cb: %w" , err )
}
return s .DecodeBare (b )
}
func (s *MessagesSaveGifRequest ) DecodeBare (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't decode messages.saveGif#327a30cb to nil" )
}
{
value , err := DecodeInputDocument (b )
if err != nil {
return fmt .Errorf ("unable to decode messages.saveGif#327a30cb: field id: %w" , err )
}
s .ID = value
}
{
value , err := b .Bool ()
if err != nil {
return fmt .Errorf ("unable to decode messages.saveGif#327a30cb: field unsave: %w" , err )
}
s .Unsave = value
}
return nil
}
func (s *MessagesSaveGifRequest ) GetID () (value InputDocumentClass ) {
if s == nil {
return
}
return s .ID
}
func (s *MessagesSaveGifRequest ) GetUnsave () (value bool ) {
if s == nil {
return
}
return s .Unsave
}
func (s *MessagesSaveGifRequest ) GetIDAsNotEmpty () (*InputDocument , bool ) {
return s .ID .AsNotEmpty ()
}
func (c *Client ) MessagesSaveGif (ctx context .Context , request *MessagesSaveGifRequest ) (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 .