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