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 AccountResolveBusinessChatLinkRequest struct {
Slug string
}
const AccountResolveBusinessChatLinkRequestTypeID = 0x5492e5ee
var (
_ bin .Encoder = &AccountResolveBusinessChatLinkRequest {}
_ bin .Decoder = &AccountResolveBusinessChatLinkRequest {}
_ bin .BareEncoder = &AccountResolveBusinessChatLinkRequest {}
_ bin .BareDecoder = &AccountResolveBusinessChatLinkRequest {}
)
func (r *AccountResolveBusinessChatLinkRequest ) Zero () bool {
if r == nil {
return true
}
if !(r .Slug == "" ) {
return false
}
return true
}
func (r *AccountResolveBusinessChatLinkRequest ) String () string {
if r == nil {
return "AccountResolveBusinessChatLinkRequest(nil)"
}
type Alias AccountResolveBusinessChatLinkRequest
return fmt .Sprintf ("AccountResolveBusinessChatLinkRequest%+v" , Alias (*r ))
}
func (r *AccountResolveBusinessChatLinkRequest ) FillFrom (from interface {
GetSlug () (value string )
}) {
r .Slug = from .GetSlug ()
}
func (*AccountResolveBusinessChatLinkRequest ) TypeID () uint32 {
return AccountResolveBusinessChatLinkRequestTypeID
}
func (*AccountResolveBusinessChatLinkRequest ) TypeName () string {
return "account.resolveBusinessChatLink"
}
func (r *AccountResolveBusinessChatLinkRequest ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "account.resolveBusinessChatLink" ,
ID : AccountResolveBusinessChatLinkRequestTypeID ,
}
if r == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "Slug" ,
SchemaName : "slug" ,
},
}
return typ
}
func (r *AccountResolveBusinessChatLinkRequest ) Encode (b *bin .Buffer ) error {
if r == nil {
return fmt .Errorf ("can't encode account.resolveBusinessChatLink#5492e5ee as nil" )
}
b .PutID (AccountResolveBusinessChatLinkRequestTypeID )
return r .EncodeBare (b )
}
func (r *AccountResolveBusinessChatLinkRequest ) EncodeBare (b *bin .Buffer ) error {
if r == nil {
return fmt .Errorf ("can't encode account.resolveBusinessChatLink#5492e5ee as nil" )
}
b .PutString (r .Slug )
return nil
}
func (r *AccountResolveBusinessChatLinkRequest ) Decode (b *bin .Buffer ) error {
if r == nil {
return fmt .Errorf ("can't decode account.resolveBusinessChatLink#5492e5ee to nil" )
}
if err := b .ConsumeID (AccountResolveBusinessChatLinkRequestTypeID ); err != nil {
return fmt .Errorf ("unable to decode account.resolveBusinessChatLink#5492e5ee: %w" , err )
}
return r .DecodeBare (b )
}
func (r *AccountResolveBusinessChatLinkRequest ) DecodeBare (b *bin .Buffer ) error {
if r == nil {
return fmt .Errorf ("can't decode account.resolveBusinessChatLink#5492e5ee to nil" )
}
{
value , err := b .String ()
if err != nil {
return fmt .Errorf ("unable to decode account.resolveBusinessChatLink#5492e5ee: field slug: %w" , err )
}
r .Slug = value
}
return nil
}
func (r *AccountResolveBusinessChatLinkRequest ) GetSlug () (value string ) {
if r == nil {
return
}
return r .Slug
}
func (c *Client ) AccountResolveBusinessChatLink (ctx context .Context , slug string ) (*AccountResolvedBusinessChatLinks , error ) {
var result AccountResolvedBusinessChatLinks
request := &AccountResolveBusinessChatLinkRequest {
Slug : slug ,
}
if err := c .rpc .Invoke (ctx , request , &result ); err != nil {
return nil , err
}
return &result , nil
}
The pages are generated with Golds v0.8.4 . (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 @zigo_101 (reachable from the left QR code) to get the latest news of Golds .