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 MessagesImportChatInviteRequest struct {
Hash string
}
const MessagesImportChatInviteRequestTypeID = 0x6c50051c
var (
_ bin .Encoder = &MessagesImportChatInviteRequest {}
_ bin .Decoder = &MessagesImportChatInviteRequest {}
_ bin .BareEncoder = &MessagesImportChatInviteRequest {}
_ bin .BareDecoder = &MessagesImportChatInviteRequest {}
)
func (i *MessagesImportChatInviteRequest ) Zero () bool {
if i == nil {
return true
}
if !(i .Hash == "" ) {
return false
}
return true
}
func (i *MessagesImportChatInviteRequest ) String () string {
if i == nil {
return "MessagesImportChatInviteRequest(nil)"
}
type Alias MessagesImportChatInviteRequest
return fmt .Sprintf ("MessagesImportChatInviteRequest%+v" , Alias (*i ))
}
func (i *MessagesImportChatInviteRequest ) FillFrom (from interface {
GetHash () (value string )
}) {
i .Hash = from .GetHash ()
}
func (*MessagesImportChatInviteRequest ) TypeID () uint32 {
return MessagesImportChatInviteRequestTypeID
}
func (*MessagesImportChatInviteRequest ) TypeName () string {
return "messages.importChatInvite"
}
func (i *MessagesImportChatInviteRequest ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "messages.importChatInvite" ,
ID : MessagesImportChatInviteRequestTypeID ,
}
if i == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "Hash" ,
SchemaName : "hash" ,
},
}
return typ
}
func (i *MessagesImportChatInviteRequest ) Encode (b *bin .Buffer ) error {
if i == nil {
return fmt .Errorf ("can't encode messages.importChatInvite#6c50051c as nil" )
}
b .PutID (MessagesImportChatInviteRequestTypeID )
return i .EncodeBare (b )
}
func (i *MessagesImportChatInviteRequest ) EncodeBare (b *bin .Buffer ) error {
if i == nil {
return fmt .Errorf ("can't encode messages.importChatInvite#6c50051c as nil" )
}
b .PutString (i .Hash )
return nil
}
func (i *MessagesImportChatInviteRequest ) Decode (b *bin .Buffer ) error {
if i == nil {
return fmt .Errorf ("can't decode messages.importChatInvite#6c50051c to nil" )
}
if err := b .ConsumeID (MessagesImportChatInviteRequestTypeID ); err != nil {
return fmt .Errorf ("unable to decode messages.importChatInvite#6c50051c: %w" , err )
}
return i .DecodeBare (b )
}
func (i *MessagesImportChatInviteRequest ) DecodeBare (b *bin .Buffer ) error {
if i == nil {
return fmt .Errorf ("can't decode messages.importChatInvite#6c50051c to nil" )
}
{
value , err := b .String ()
if err != nil {
return fmt .Errorf ("unable to decode messages.importChatInvite#6c50051c: field hash: %w" , err )
}
i .Hash = value
}
return nil
}
func (i *MessagesImportChatInviteRequest ) GetHash () (value string ) {
if i == nil {
return
}
return i .Hash
}
func (c *Client ) MessagesImportChatInvite (ctx context .Context , hash string ) (UpdatesClass , error ) {
var result UpdatesBox
request := &MessagesImportChatInviteRequest {
Hash : hash ,
}
if err := c .rpc .Invoke (ctx , request , &result ); err != nil {
return nil , err
}
return result .Updates , 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 .