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 MessagesStartHistoryImportRequest struct {
Peer InputPeerClass
ImportID int64
}
const MessagesStartHistoryImportRequestTypeID = 0xb43df344
var (
_ bin .Encoder = &MessagesStartHistoryImportRequest {}
_ bin .Decoder = &MessagesStartHistoryImportRequest {}
_ bin .BareEncoder = &MessagesStartHistoryImportRequest {}
_ bin .BareDecoder = &MessagesStartHistoryImportRequest {}
)
func (s *MessagesStartHistoryImportRequest ) Zero () bool {
if s == nil {
return true
}
if !(s .Peer == nil ) {
return false
}
if !(s .ImportID == 0 ) {
return false
}
return true
}
func (s *MessagesStartHistoryImportRequest ) String () string {
if s == nil {
return "MessagesStartHistoryImportRequest(nil)"
}
type Alias MessagesStartHistoryImportRequest
return fmt .Sprintf ("MessagesStartHistoryImportRequest%+v" , Alias (*s ))
}
func (s *MessagesStartHistoryImportRequest ) FillFrom (from interface {
GetPeer () (value InputPeerClass )
GetImportID () (value int64 )
}) {
s .Peer = from .GetPeer ()
s .ImportID = from .GetImportID ()
}
func (*MessagesStartHistoryImportRequest ) TypeID () uint32 {
return MessagesStartHistoryImportRequestTypeID
}
func (*MessagesStartHistoryImportRequest ) TypeName () string {
return "messages.startHistoryImport"
}
func (s *MessagesStartHistoryImportRequest ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "messages.startHistoryImport" ,
ID : MessagesStartHistoryImportRequestTypeID ,
}
if s == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "Peer" ,
SchemaName : "peer" ,
},
{
Name : "ImportID" ,
SchemaName : "import_id" ,
},
}
return typ
}
func (s *MessagesStartHistoryImportRequest ) Encode (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't encode messages.startHistoryImport#b43df344 as nil" )
}
b .PutID (MessagesStartHistoryImportRequestTypeID )
return s .EncodeBare (b )
}
func (s *MessagesStartHistoryImportRequest ) EncodeBare (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't encode messages.startHistoryImport#b43df344 as nil" )
}
if s .Peer == nil {
return fmt .Errorf ("unable to encode messages.startHistoryImport#b43df344: field peer is nil" )
}
if err := s .Peer .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode messages.startHistoryImport#b43df344: field peer: %w" , err )
}
b .PutLong (s .ImportID )
return nil
}
func (s *MessagesStartHistoryImportRequest ) Decode (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't decode messages.startHistoryImport#b43df344 to nil" )
}
if err := b .ConsumeID (MessagesStartHistoryImportRequestTypeID ); err != nil {
return fmt .Errorf ("unable to decode messages.startHistoryImport#b43df344: %w" , err )
}
return s .DecodeBare (b )
}
func (s *MessagesStartHistoryImportRequest ) DecodeBare (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't decode messages.startHistoryImport#b43df344 to nil" )
}
{
value , err := DecodeInputPeer (b )
if err != nil {
return fmt .Errorf ("unable to decode messages.startHistoryImport#b43df344: field peer: %w" , err )
}
s .Peer = value
}
{
value , err := b .Long ()
if err != nil {
return fmt .Errorf ("unable to decode messages.startHistoryImport#b43df344: field import_id: %w" , err )
}
s .ImportID = value
}
return nil
}
func (s *MessagesStartHistoryImportRequest ) GetPeer () (value InputPeerClass ) {
if s == nil {
return
}
return s .Peer
}
func (s *MessagesStartHistoryImportRequest ) GetImportID () (value int64 ) {
if s == nil {
return
}
return s .ImportID
}
func (c *Client ) MessagesStartHistoryImport (ctx context .Context , request *MessagesStartHistoryImportRequest ) (bool , error ) {
var result BoolBox
if err := c .rpc .Invoke (ctx , request , &result ); err != nil {
return false , err
}
_ , ok := result .Bool .(*BoolTrue )
return ok , 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 .