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 HelpSupport struct {
PhoneNumber string
User UserClass
}
const HelpSupportTypeID = 0x17c6b5f6
var (
_ bin .Encoder = &HelpSupport {}
_ bin .Decoder = &HelpSupport {}
_ bin .BareEncoder = &HelpSupport {}
_ bin .BareDecoder = &HelpSupport {}
)
func (s *HelpSupport ) Zero () bool {
if s == nil {
return true
}
if !(s .PhoneNumber == "" ) {
return false
}
if !(s .User == nil ) {
return false
}
return true
}
func (s *HelpSupport ) String () string {
if s == nil {
return "HelpSupport(nil)"
}
type Alias HelpSupport
return fmt .Sprintf ("HelpSupport%+v" , Alias (*s ))
}
func (s *HelpSupport ) FillFrom (from interface {
GetPhoneNumber () (value string )
GetUser () (value UserClass )
}) {
s .PhoneNumber = from .GetPhoneNumber ()
s .User = from .GetUser ()
}
func (*HelpSupport ) TypeID () uint32 {
return HelpSupportTypeID
}
func (*HelpSupport ) TypeName () string {
return "help.support"
}
func (s *HelpSupport ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "help.support" ,
ID : HelpSupportTypeID ,
}
if s == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "PhoneNumber" ,
SchemaName : "phone_number" ,
},
{
Name : "User" ,
SchemaName : "user" ,
},
}
return typ
}
func (s *HelpSupport ) Encode (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't encode help.support#17c6b5f6 as nil" )
}
b .PutID (HelpSupportTypeID )
return s .EncodeBare (b )
}
func (s *HelpSupport ) EncodeBare (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't encode help.support#17c6b5f6 as nil" )
}
b .PutString (s .PhoneNumber )
if s .User == nil {
return fmt .Errorf ("unable to encode help.support#17c6b5f6: field user is nil" )
}
if err := s .User .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode help.support#17c6b5f6: field user: %w" , err )
}
return nil
}
func (s *HelpSupport ) Decode (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't decode help.support#17c6b5f6 to nil" )
}
if err := b .ConsumeID (HelpSupportTypeID ); err != nil {
return fmt .Errorf ("unable to decode help.support#17c6b5f6: %w" , err )
}
return s .DecodeBare (b )
}
func (s *HelpSupport ) DecodeBare (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't decode help.support#17c6b5f6 to nil" )
}
{
value , err := b .String ()
if err != nil {
return fmt .Errorf ("unable to decode help.support#17c6b5f6: field phone_number: %w" , err )
}
s .PhoneNumber = value
}
{
value , err := DecodeUser (b )
if err != nil {
return fmt .Errorf ("unable to decode help.support#17c6b5f6: field user: %w" , err )
}
s .User = value
}
return nil
}
func (s *HelpSupport ) GetPhoneNumber () (value string ) {
if s == nil {
return
}
return s .PhoneNumber
}
func (s *HelpSupport ) GetUser () (value UserClass ) {
if s == nil {
return
}
return s .User
}
func (s *HelpSupport ) GetUserAsNotEmpty () (*User , bool ) {
return s .User .AsNotEmpty ()
}
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 .