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 InputPhoneContact struct {
ClientID int64
Phone string
FirstName string
LastName string
}
const InputPhoneContactTypeID = 0xf392b7f4
var (
_ bin .Encoder = &InputPhoneContact {}
_ bin .Decoder = &InputPhoneContact {}
_ bin .BareEncoder = &InputPhoneContact {}
_ bin .BareDecoder = &InputPhoneContact {}
)
func (i *InputPhoneContact ) Zero () bool {
if i == nil {
return true
}
if !(i .ClientID == 0 ) {
return false
}
if !(i .Phone == "" ) {
return false
}
if !(i .FirstName == "" ) {
return false
}
if !(i .LastName == "" ) {
return false
}
return true
}
func (i *InputPhoneContact ) String () string {
if i == nil {
return "InputPhoneContact(nil)"
}
type Alias InputPhoneContact
return fmt .Sprintf ("InputPhoneContact%+v" , Alias (*i ))
}
func (i *InputPhoneContact ) FillFrom (from interface {
GetClientID () (value int64 )
GetPhone () (value string )
GetFirstName () (value string )
GetLastName () (value string )
}) {
i .ClientID = from .GetClientID ()
i .Phone = from .GetPhone ()
i .FirstName = from .GetFirstName ()
i .LastName = from .GetLastName ()
}
func (*InputPhoneContact ) TypeID () uint32 {
return InputPhoneContactTypeID
}
func (*InputPhoneContact ) TypeName () string {
return "inputPhoneContact"
}
func (i *InputPhoneContact ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "inputPhoneContact" ,
ID : InputPhoneContactTypeID ,
}
if i == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "ClientID" ,
SchemaName : "client_id" ,
},
{
Name : "Phone" ,
SchemaName : "phone" ,
},
{
Name : "FirstName" ,
SchemaName : "first_name" ,
},
{
Name : "LastName" ,
SchemaName : "last_name" ,
},
}
return typ
}
func (i *InputPhoneContact ) Encode (b *bin .Buffer ) error {
if i == nil {
return fmt .Errorf ("can't encode inputPhoneContact#f392b7f4 as nil" )
}
b .PutID (InputPhoneContactTypeID )
return i .EncodeBare (b )
}
func (i *InputPhoneContact ) EncodeBare (b *bin .Buffer ) error {
if i == nil {
return fmt .Errorf ("can't encode inputPhoneContact#f392b7f4 as nil" )
}
b .PutLong (i .ClientID )
b .PutString (i .Phone )
b .PutString (i .FirstName )
b .PutString (i .LastName )
return nil
}
func (i *InputPhoneContact ) Decode (b *bin .Buffer ) error {
if i == nil {
return fmt .Errorf ("can't decode inputPhoneContact#f392b7f4 to nil" )
}
if err := b .ConsumeID (InputPhoneContactTypeID ); err != nil {
return fmt .Errorf ("unable to decode inputPhoneContact#f392b7f4: %w" , err )
}
return i .DecodeBare (b )
}
func (i *InputPhoneContact ) DecodeBare (b *bin .Buffer ) error {
if i == nil {
return fmt .Errorf ("can't decode inputPhoneContact#f392b7f4 to nil" )
}
{
value , err := b .Long ()
if err != nil {
return fmt .Errorf ("unable to decode inputPhoneContact#f392b7f4: field client_id: %w" , err )
}
i .ClientID = value
}
{
value , err := b .String ()
if err != nil {
return fmt .Errorf ("unable to decode inputPhoneContact#f392b7f4: field phone: %w" , err )
}
i .Phone = value
}
{
value , err := b .String ()
if err != nil {
return fmt .Errorf ("unable to decode inputPhoneContact#f392b7f4: field first_name: %w" , err )
}
i .FirstName = value
}
{
value , err := b .String ()
if err != nil {
return fmt .Errorf ("unable to decode inputPhoneContact#f392b7f4: field last_name: %w" , err )
}
i .LastName = value
}
return nil
}
func (i *InputPhoneContact ) GetClientID () (value int64 ) {
if i == nil {
return
}
return i .ClientID
}
func (i *InputPhoneContact ) GetPhone () (value string ) {
if i == nil {
return
}
return i .Phone
}
func (i *InputPhoneContact ) GetFirstName () (value string ) {
if i == nil {
return
}
return i .FirstName
}
func (i *InputPhoneContact ) GetLastName () (value string ) {
if i == nil {
return
}
return i .LastName
}
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 .