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 ContactsGetContactIDsRequest struct {
Hash int64
}
const ContactsGetContactIDsRequestTypeID = 0x7adc669d
var (
_ bin .Encoder = &ContactsGetContactIDsRequest {}
_ bin .Decoder = &ContactsGetContactIDsRequest {}
_ bin .BareEncoder = &ContactsGetContactIDsRequest {}
_ bin .BareDecoder = &ContactsGetContactIDsRequest {}
)
func (g *ContactsGetContactIDsRequest ) Zero () bool {
if g == nil {
return true
}
if !(g .Hash == 0 ) {
return false
}
return true
}
func (g *ContactsGetContactIDsRequest ) String () string {
if g == nil {
return "ContactsGetContactIDsRequest(nil)"
}
type Alias ContactsGetContactIDsRequest
return fmt .Sprintf ("ContactsGetContactIDsRequest%+v" , Alias (*g ))
}
func (g *ContactsGetContactIDsRequest ) FillFrom (from interface {
GetHash () (value int64 )
}) {
g .Hash = from .GetHash ()
}
func (*ContactsGetContactIDsRequest ) TypeID () uint32 {
return ContactsGetContactIDsRequestTypeID
}
func (*ContactsGetContactIDsRequest ) TypeName () string {
return "contacts.getContactIDs"
}
func (g *ContactsGetContactIDsRequest ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "contacts.getContactIDs" ,
ID : ContactsGetContactIDsRequestTypeID ,
}
if g == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "Hash" ,
SchemaName : "hash" ,
},
}
return typ
}
func (g *ContactsGetContactIDsRequest ) Encode (b *bin .Buffer ) error {
if g == nil {
return fmt .Errorf ("can't encode contacts.getContactIDs#7adc669d as nil" )
}
b .PutID (ContactsGetContactIDsRequestTypeID )
return g .EncodeBare (b )
}
func (g *ContactsGetContactIDsRequest ) EncodeBare (b *bin .Buffer ) error {
if g == nil {
return fmt .Errorf ("can't encode contacts.getContactIDs#7adc669d as nil" )
}
b .PutLong (g .Hash )
return nil
}
func (g *ContactsGetContactIDsRequest ) Decode (b *bin .Buffer ) error {
if g == nil {
return fmt .Errorf ("can't decode contacts.getContactIDs#7adc669d to nil" )
}
if err := b .ConsumeID (ContactsGetContactIDsRequestTypeID ); err != nil {
return fmt .Errorf ("unable to decode contacts.getContactIDs#7adc669d: %w" , err )
}
return g .DecodeBare (b )
}
func (g *ContactsGetContactIDsRequest ) DecodeBare (b *bin .Buffer ) error {
if g == nil {
return fmt .Errorf ("can't decode contacts.getContactIDs#7adc669d to nil" )
}
{
value , err := b .Long ()
if err != nil {
return fmt .Errorf ("unable to decode contacts.getContactIDs#7adc669d: field hash: %w" , err )
}
g .Hash = value
}
return nil
}
func (g *ContactsGetContactIDsRequest ) GetHash () (value int64 ) {
if g == nil {
return
}
return g .Hash
}
func (c *Client ) ContactsGetContactIDs (ctx context .Context , hash int64 ) ([]int , error ) {
var result IntVector
request := &ContactsGetContactIDsRequest {
Hash : hash ,
}
if err := c .rpc .Invoke (ctx , request , &result ); err != nil {
return nil , err
}
return []int (result .Elems ), 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 .