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