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 FoldersEditPeerFoldersRequest struct {
FolderPeers []InputFolderPeer
}
const FoldersEditPeerFoldersRequestTypeID = 0x6847d0ab
var (
_ bin .Encoder = &FoldersEditPeerFoldersRequest {}
_ bin .Decoder = &FoldersEditPeerFoldersRequest {}
_ bin .BareEncoder = &FoldersEditPeerFoldersRequest {}
_ bin .BareDecoder = &FoldersEditPeerFoldersRequest {}
)
func (e *FoldersEditPeerFoldersRequest ) Zero () bool {
if e == nil {
return true
}
if !(e .FolderPeers == nil ) {
return false
}
return true
}
func (e *FoldersEditPeerFoldersRequest ) String () string {
if e == nil {
return "FoldersEditPeerFoldersRequest(nil)"
}
type Alias FoldersEditPeerFoldersRequest
return fmt .Sprintf ("FoldersEditPeerFoldersRequest%+v" , Alias (*e ))
}
func (e *FoldersEditPeerFoldersRequest ) FillFrom (from interface {
GetFolderPeers () (value []InputFolderPeer )
}) {
e .FolderPeers = from .GetFolderPeers ()
}
func (*FoldersEditPeerFoldersRequest ) TypeID () uint32 {
return FoldersEditPeerFoldersRequestTypeID
}
func (*FoldersEditPeerFoldersRequest ) TypeName () string {
return "folders.editPeerFolders"
}
func (e *FoldersEditPeerFoldersRequest ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "folders.editPeerFolders" ,
ID : FoldersEditPeerFoldersRequestTypeID ,
}
if e == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "FolderPeers" ,
SchemaName : "folder_peers" ,
},
}
return typ
}
func (e *FoldersEditPeerFoldersRequest ) Encode (b *bin .Buffer ) error {
if e == nil {
return fmt .Errorf ("can't encode folders.editPeerFolders#6847d0ab as nil" )
}
b .PutID (FoldersEditPeerFoldersRequestTypeID )
return e .EncodeBare (b )
}
func (e *FoldersEditPeerFoldersRequest ) EncodeBare (b *bin .Buffer ) error {
if e == nil {
return fmt .Errorf ("can't encode folders.editPeerFolders#6847d0ab as nil" )
}
b .PutVectorHeader (len (e .FolderPeers ))
for idx , v := range e .FolderPeers {
if err := v .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode folders.editPeerFolders#6847d0ab: field folder_peers element with index %d: %w" , idx , err )
}
}
return nil
}
func (e *FoldersEditPeerFoldersRequest ) Decode (b *bin .Buffer ) error {
if e == nil {
return fmt .Errorf ("can't decode folders.editPeerFolders#6847d0ab to nil" )
}
if err := b .ConsumeID (FoldersEditPeerFoldersRequestTypeID ); err != nil {
return fmt .Errorf ("unable to decode folders.editPeerFolders#6847d0ab: %w" , err )
}
return e .DecodeBare (b )
}
func (e *FoldersEditPeerFoldersRequest ) DecodeBare (b *bin .Buffer ) error {
if e == nil {
return fmt .Errorf ("can't decode folders.editPeerFolders#6847d0ab to nil" )
}
{
headerLen , err := b .VectorHeader ()
if err != nil {
return fmt .Errorf ("unable to decode folders.editPeerFolders#6847d0ab: field folder_peers: %w" , err )
}
if headerLen > 0 {
e .FolderPeers = make ([]InputFolderPeer , 0 , headerLen %bin .PreallocateLimit )
}
for idx := 0 ; idx < headerLen ; idx ++ {
var value InputFolderPeer
if err := value .Decode (b ); err != nil {
return fmt .Errorf ("unable to decode folders.editPeerFolders#6847d0ab: field folder_peers: %w" , err )
}
e .FolderPeers = append (e .FolderPeers , value )
}
}
return nil
}
func (e *FoldersEditPeerFoldersRequest ) GetFolderPeers () (value []InputFolderPeer ) {
if e == nil {
return
}
return e .FolderPeers
}
func (c *Client ) FoldersEditPeerFolders (ctx context .Context , folderpeers []InputFolderPeer ) (UpdatesClass , error ) {
var result UpdatesBox
request := &FoldersEditPeerFoldersRequest {
FolderPeers : folderpeers ,
}
if err := c .rpc .Invoke (ctx , request , &result ); err != nil {
return nil , err
}
return result .Updates , 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 .