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 ContactsDeleteContactsRequest struct {
ID []InputUserClass
}
const ContactsDeleteContactsRequestTypeID = 0x96a0e00
var (
_ bin .Encoder = &ContactsDeleteContactsRequest {}
_ bin .Decoder = &ContactsDeleteContactsRequest {}
_ bin .BareEncoder = &ContactsDeleteContactsRequest {}
_ bin .BareDecoder = &ContactsDeleteContactsRequest {}
)
func (d *ContactsDeleteContactsRequest ) Zero () bool {
if d == nil {
return true
}
if !(d .ID == nil ) {
return false
}
return true
}
func (d *ContactsDeleteContactsRequest ) String () string {
if d == nil {
return "ContactsDeleteContactsRequest(nil)"
}
type Alias ContactsDeleteContactsRequest
return fmt .Sprintf ("ContactsDeleteContactsRequest%+v" , Alias (*d ))
}
func (d *ContactsDeleteContactsRequest ) FillFrom (from interface {
GetID () (value []InputUserClass )
}) {
d .ID = from .GetID ()
}
func (*ContactsDeleteContactsRequest ) TypeID () uint32 {
return ContactsDeleteContactsRequestTypeID
}
func (*ContactsDeleteContactsRequest ) TypeName () string {
return "contacts.deleteContacts"
}
func (d *ContactsDeleteContactsRequest ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "contacts.deleteContacts" ,
ID : ContactsDeleteContactsRequestTypeID ,
}
if d == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "ID" ,
SchemaName : "id" ,
},
}
return typ
}
func (d *ContactsDeleteContactsRequest ) Encode (b *bin .Buffer ) error {
if d == nil {
return fmt .Errorf ("can't encode contacts.deleteContacts#96a0e00 as nil" )
}
b .PutID (ContactsDeleteContactsRequestTypeID )
return d .EncodeBare (b )
}
func (d *ContactsDeleteContactsRequest ) EncodeBare (b *bin .Buffer ) error {
if d == nil {
return fmt .Errorf ("can't encode contacts.deleteContacts#96a0e00 as nil" )
}
b .PutVectorHeader (len (d .ID ))
for idx , v := range d .ID {
if v == nil {
return fmt .Errorf ("unable to encode contacts.deleteContacts#96a0e00: field id element with index %d is nil" , idx )
}
if err := v .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode contacts.deleteContacts#96a0e00: field id element with index %d: %w" , idx , err )
}
}
return nil
}
func (d *ContactsDeleteContactsRequest ) Decode (b *bin .Buffer ) error {
if d == nil {
return fmt .Errorf ("can't decode contacts.deleteContacts#96a0e00 to nil" )
}
if err := b .ConsumeID (ContactsDeleteContactsRequestTypeID ); err != nil {
return fmt .Errorf ("unable to decode contacts.deleteContacts#96a0e00: %w" , err )
}
return d .DecodeBare (b )
}
func (d *ContactsDeleteContactsRequest ) DecodeBare (b *bin .Buffer ) error {
if d == nil {
return fmt .Errorf ("can't decode contacts.deleteContacts#96a0e00 to nil" )
}
{
headerLen , err := b .VectorHeader ()
if err != nil {
return fmt .Errorf ("unable to decode contacts.deleteContacts#96a0e00: field id: %w" , err )
}
if headerLen > 0 {
d .ID = make ([]InputUserClass , 0 , headerLen %bin .PreallocateLimit )
}
for idx := 0 ; idx < headerLen ; idx ++ {
value , err := DecodeInputUser (b )
if err != nil {
return fmt .Errorf ("unable to decode contacts.deleteContacts#96a0e00: field id: %w" , err )
}
d .ID = append (d .ID , value )
}
}
return nil
}
func (d *ContactsDeleteContactsRequest ) GetID () (value []InputUserClass ) {
if d == nil {
return
}
return d .ID
}
func (d *ContactsDeleteContactsRequest ) MapID () (value InputUserClassArray ) {
return InputUserClassArray (d .ID )
}
func (c *Client ) ContactsDeleteContacts (ctx context .Context , id []InputUserClass ) (UpdatesClass , error ) {
var result UpdatesBox
request := &ContactsDeleteContactsRequest {
ID : id ,
}
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 .