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 AccountEditBusinessChatLinkRequest struct {
Slug string
Link InputBusinessChatLink
}
const AccountEditBusinessChatLinkRequestTypeID = 0x8c3410af
var (
_ bin .Encoder = &AccountEditBusinessChatLinkRequest {}
_ bin .Decoder = &AccountEditBusinessChatLinkRequest {}
_ bin .BareEncoder = &AccountEditBusinessChatLinkRequest {}
_ bin .BareDecoder = &AccountEditBusinessChatLinkRequest {}
)
func (e *AccountEditBusinessChatLinkRequest ) Zero () bool {
if e == nil {
return true
}
if !(e .Slug == "" ) {
return false
}
if !(e .Link .Zero ()) {
return false
}
return true
}
func (e *AccountEditBusinessChatLinkRequest ) String () string {
if e == nil {
return "AccountEditBusinessChatLinkRequest(nil)"
}
type Alias AccountEditBusinessChatLinkRequest
return fmt .Sprintf ("AccountEditBusinessChatLinkRequest%+v" , Alias (*e ))
}
func (e *AccountEditBusinessChatLinkRequest ) FillFrom (from interface {
GetSlug () (value string )
GetLink () (value InputBusinessChatLink )
}) {
e .Slug = from .GetSlug ()
e .Link = from .GetLink ()
}
func (*AccountEditBusinessChatLinkRequest ) TypeID () uint32 {
return AccountEditBusinessChatLinkRequestTypeID
}
func (*AccountEditBusinessChatLinkRequest ) TypeName () string {
return "account.editBusinessChatLink"
}
func (e *AccountEditBusinessChatLinkRequest ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "account.editBusinessChatLink" ,
ID : AccountEditBusinessChatLinkRequestTypeID ,
}
if e == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "Slug" ,
SchemaName : "slug" ,
},
{
Name : "Link" ,
SchemaName : "link" ,
},
}
return typ
}
func (e *AccountEditBusinessChatLinkRequest ) Encode (b *bin .Buffer ) error {
if e == nil {
return fmt .Errorf ("can't encode account.editBusinessChatLink#8c3410af as nil" )
}
b .PutID (AccountEditBusinessChatLinkRequestTypeID )
return e .EncodeBare (b )
}
func (e *AccountEditBusinessChatLinkRequest ) EncodeBare (b *bin .Buffer ) error {
if e == nil {
return fmt .Errorf ("can't encode account.editBusinessChatLink#8c3410af as nil" )
}
b .PutString (e .Slug )
if err := e .Link .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode account.editBusinessChatLink#8c3410af: field link: %w" , err )
}
return nil
}
func (e *AccountEditBusinessChatLinkRequest ) Decode (b *bin .Buffer ) error {
if e == nil {
return fmt .Errorf ("can't decode account.editBusinessChatLink#8c3410af to nil" )
}
if err := b .ConsumeID (AccountEditBusinessChatLinkRequestTypeID ); err != nil {
return fmt .Errorf ("unable to decode account.editBusinessChatLink#8c3410af: %w" , err )
}
return e .DecodeBare (b )
}
func (e *AccountEditBusinessChatLinkRequest ) DecodeBare (b *bin .Buffer ) error {
if e == nil {
return fmt .Errorf ("can't decode account.editBusinessChatLink#8c3410af to nil" )
}
{
value , err := b .String ()
if err != nil {
return fmt .Errorf ("unable to decode account.editBusinessChatLink#8c3410af: field slug: %w" , err )
}
e .Slug = value
}
{
if err := e .Link .Decode (b ); err != nil {
return fmt .Errorf ("unable to decode account.editBusinessChatLink#8c3410af: field link: %w" , err )
}
}
return nil
}
func (e *AccountEditBusinessChatLinkRequest ) GetSlug () (value string ) {
if e == nil {
return
}
return e .Slug
}
func (e *AccountEditBusinessChatLinkRequest ) GetLink () (value InputBusinessChatLink ) {
if e == nil {
return
}
return e .Link
}
func (c *Client ) AccountEditBusinessChatLink (ctx context .Context , request *AccountEditBusinessChatLinkRequest ) (*BusinessChatLink , error ) {
var result BusinessChatLink
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 .