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 ContactsEditCloseFriendsRequest struct {
ID []int64
}
const ContactsEditCloseFriendsRequestTypeID = 0xba6705f0
var (
_ bin .Encoder = &ContactsEditCloseFriendsRequest {}
_ bin .Decoder = &ContactsEditCloseFriendsRequest {}
_ bin .BareEncoder = &ContactsEditCloseFriendsRequest {}
_ bin .BareDecoder = &ContactsEditCloseFriendsRequest {}
)
func (e *ContactsEditCloseFriendsRequest ) Zero () bool {
if e == nil {
return true
}
if !(e .ID == nil ) {
return false
}
return true
}
func (e *ContactsEditCloseFriendsRequest ) String () string {
if e == nil {
return "ContactsEditCloseFriendsRequest(nil)"
}
type Alias ContactsEditCloseFriendsRequest
return fmt .Sprintf ("ContactsEditCloseFriendsRequest%+v" , Alias (*e ))
}
func (e *ContactsEditCloseFriendsRequest ) FillFrom (from interface {
GetID () (value []int64 )
}) {
e .ID = from .GetID ()
}
func (*ContactsEditCloseFriendsRequest ) TypeID () uint32 {
return ContactsEditCloseFriendsRequestTypeID
}
func (*ContactsEditCloseFriendsRequest ) TypeName () string {
return "contacts.editCloseFriends"
}
func (e *ContactsEditCloseFriendsRequest ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "contacts.editCloseFriends" ,
ID : ContactsEditCloseFriendsRequestTypeID ,
}
if e == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "ID" ,
SchemaName : "id" ,
},
}
return typ
}
func (e *ContactsEditCloseFriendsRequest ) Encode (b *bin .Buffer ) error {
if e == nil {
return fmt .Errorf ("can't encode contacts.editCloseFriends#ba6705f0 as nil" )
}
b .PutID (ContactsEditCloseFriendsRequestTypeID )
return e .EncodeBare (b )
}
func (e *ContactsEditCloseFriendsRequest ) EncodeBare (b *bin .Buffer ) error {
if e == nil {
return fmt .Errorf ("can't encode contacts.editCloseFriends#ba6705f0 as nil" )
}
b .PutVectorHeader (len (e .ID ))
for _ , v := range e .ID {
b .PutLong (v )
}
return nil
}
func (e *ContactsEditCloseFriendsRequest ) Decode (b *bin .Buffer ) error {
if e == nil {
return fmt .Errorf ("can't decode contacts.editCloseFriends#ba6705f0 to nil" )
}
if err := b .ConsumeID (ContactsEditCloseFriendsRequestTypeID ); err != nil {
return fmt .Errorf ("unable to decode contacts.editCloseFriends#ba6705f0: %w" , err )
}
return e .DecodeBare (b )
}
func (e *ContactsEditCloseFriendsRequest ) DecodeBare (b *bin .Buffer ) error {
if e == nil {
return fmt .Errorf ("can't decode contacts.editCloseFriends#ba6705f0 to nil" )
}
{
headerLen , err := b .VectorHeader ()
if err != nil {
return fmt .Errorf ("unable to decode contacts.editCloseFriends#ba6705f0: field id: %w" , err )
}
if headerLen > 0 {
e .ID = make ([]int64 , 0 , headerLen %bin .PreallocateLimit )
}
for idx := 0 ; idx < headerLen ; idx ++ {
value , err := b .Long ()
if err != nil {
return fmt .Errorf ("unable to decode contacts.editCloseFriends#ba6705f0: field id: %w" , err )
}
e .ID = append (e .ID , value )
}
}
return nil
}
func (e *ContactsEditCloseFriendsRequest ) GetID () (value []int64 ) {
if e == nil {
return
}
return e .ID
}
func (c *Client ) ContactsEditCloseFriends (ctx context .Context , id []int64 ) (bool , error ) {
var result BoolBox
request := &ContactsEditCloseFriendsRequest {
ID : id ,
}
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 .