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 ContactsResolvePhoneRequest struct {
Phone string
}
const ContactsResolvePhoneRequestTypeID = 0x8af94344
var (
_ bin .Encoder = &ContactsResolvePhoneRequest {}
_ bin .Decoder = &ContactsResolvePhoneRequest {}
_ bin .BareEncoder = &ContactsResolvePhoneRequest {}
_ bin .BareDecoder = &ContactsResolvePhoneRequest {}
)
func (r *ContactsResolvePhoneRequest ) Zero () bool {
if r == nil {
return true
}
if !(r .Phone == "" ) {
return false
}
return true
}
func (r *ContactsResolvePhoneRequest ) String () string {
if r == nil {
return "ContactsResolvePhoneRequest(nil)"
}
type Alias ContactsResolvePhoneRequest
return fmt .Sprintf ("ContactsResolvePhoneRequest%+v" , Alias (*r ))
}
func (r *ContactsResolvePhoneRequest ) FillFrom (from interface {
GetPhone () (value string )
}) {
r .Phone = from .GetPhone ()
}
func (*ContactsResolvePhoneRequest ) TypeID () uint32 {
return ContactsResolvePhoneRequestTypeID
}
func (*ContactsResolvePhoneRequest ) TypeName () string {
return "contacts.resolvePhone"
}
func (r *ContactsResolvePhoneRequest ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "contacts.resolvePhone" ,
ID : ContactsResolvePhoneRequestTypeID ,
}
if r == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "Phone" ,
SchemaName : "phone" ,
},
}
return typ
}
func (r *ContactsResolvePhoneRequest ) Encode (b *bin .Buffer ) error {
if r == nil {
return fmt .Errorf ("can't encode contacts.resolvePhone#8af94344 as nil" )
}
b .PutID (ContactsResolvePhoneRequestTypeID )
return r .EncodeBare (b )
}
func (r *ContactsResolvePhoneRequest ) EncodeBare (b *bin .Buffer ) error {
if r == nil {
return fmt .Errorf ("can't encode contacts.resolvePhone#8af94344 as nil" )
}
b .PutString (r .Phone )
return nil
}
func (r *ContactsResolvePhoneRequest ) Decode (b *bin .Buffer ) error {
if r == nil {
return fmt .Errorf ("can't decode contacts.resolvePhone#8af94344 to nil" )
}
if err := b .ConsumeID (ContactsResolvePhoneRequestTypeID ); err != nil {
return fmt .Errorf ("unable to decode contacts.resolvePhone#8af94344: %w" , err )
}
return r .DecodeBare (b )
}
func (r *ContactsResolvePhoneRequest ) DecodeBare (b *bin .Buffer ) error {
if r == nil {
return fmt .Errorf ("can't decode contacts.resolvePhone#8af94344 to nil" )
}
{
value , err := b .String ()
if err != nil {
return fmt .Errorf ("unable to decode contacts.resolvePhone#8af94344: field phone: %w" , err )
}
r .Phone = value
}
return nil
}
func (r *ContactsResolvePhoneRequest ) GetPhone () (value string ) {
if r == nil {
return
}
return r .Phone
}
func (c *Client ) ContactsResolvePhone (ctx context .Context , phone string ) (*ContactsResolvedPeer , error ) {
var result ContactsResolvedPeer
request := &ContactsResolvePhoneRequest {
Phone : phone ,
}
if err := c .rpc .Invoke (ctx , request , &result ); err != nil {
return nil , err
}
return &result , 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 .