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 HelpGetUserInfoRequest struct {
UserID InputUserClass
}
const HelpGetUserInfoRequestTypeID = 0x38a08d3
var (
_ bin .Encoder = &HelpGetUserInfoRequest {}
_ bin .Decoder = &HelpGetUserInfoRequest {}
_ bin .BareEncoder = &HelpGetUserInfoRequest {}
_ bin .BareDecoder = &HelpGetUserInfoRequest {}
)
func (g *HelpGetUserInfoRequest ) Zero () bool {
if g == nil {
return true
}
if !(g .UserID == nil ) {
return false
}
return true
}
func (g *HelpGetUserInfoRequest ) String () string {
if g == nil {
return "HelpGetUserInfoRequest(nil)"
}
type Alias HelpGetUserInfoRequest
return fmt .Sprintf ("HelpGetUserInfoRequest%+v" , Alias (*g ))
}
func (g *HelpGetUserInfoRequest ) FillFrom (from interface {
GetUserID () (value InputUserClass )
}) {
g .UserID = from .GetUserID ()
}
func (*HelpGetUserInfoRequest ) TypeID () uint32 {
return HelpGetUserInfoRequestTypeID
}
func (*HelpGetUserInfoRequest ) TypeName () string {
return "help.getUserInfo"
}
func (g *HelpGetUserInfoRequest ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "help.getUserInfo" ,
ID : HelpGetUserInfoRequestTypeID ,
}
if g == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "UserID" ,
SchemaName : "user_id" ,
},
}
return typ
}
func (g *HelpGetUserInfoRequest ) Encode (b *bin .Buffer ) error {
if g == nil {
return fmt .Errorf ("can't encode help.getUserInfo#38a08d3 as nil" )
}
b .PutID (HelpGetUserInfoRequestTypeID )
return g .EncodeBare (b )
}
func (g *HelpGetUserInfoRequest ) EncodeBare (b *bin .Buffer ) error {
if g == nil {
return fmt .Errorf ("can't encode help.getUserInfo#38a08d3 as nil" )
}
if g .UserID == nil {
return fmt .Errorf ("unable to encode help.getUserInfo#38a08d3: field user_id is nil" )
}
if err := g .UserID .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode help.getUserInfo#38a08d3: field user_id: %w" , err )
}
return nil
}
func (g *HelpGetUserInfoRequest ) Decode (b *bin .Buffer ) error {
if g == nil {
return fmt .Errorf ("can't decode help.getUserInfo#38a08d3 to nil" )
}
if err := b .ConsumeID (HelpGetUserInfoRequestTypeID ); err != nil {
return fmt .Errorf ("unable to decode help.getUserInfo#38a08d3: %w" , err )
}
return g .DecodeBare (b )
}
func (g *HelpGetUserInfoRequest ) DecodeBare (b *bin .Buffer ) error {
if g == nil {
return fmt .Errorf ("can't decode help.getUserInfo#38a08d3 to nil" )
}
{
value , err := DecodeInputUser (b )
if err != nil {
return fmt .Errorf ("unable to decode help.getUserInfo#38a08d3: field user_id: %w" , err )
}
g .UserID = value
}
return nil
}
func (g *HelpGetUserInfoRequest ) GetUserID () (value InputUserClass ) {
if g == nil {
return
}
return g .UserID
}
func (c *Client ) HelpGetUserInfo (ctx context .Context , userid InputUserClass ) (HelpUserInfoClass , error ) {
var result HelpUserInfoBox
request := &HelpGetUserInfoRequest {
UserID : userid ,
}
if err := c .rpc .Invoke (ctx , request , &result ); err != nil {
return nil , err
}
return result .UserInfo , 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 .