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 PhoneSaveCallLogRequest struct {
Peer InputPhoneCall
File InputFileClass
}
const PhoneSaveCallLogRequestTypeID = 0x41248786
var (
_ bin .Encoder = &PhoneSaveCallLogRequest {}
_ bin .Decoder = &PhoneSaveCallLogRequest {}
_ bin .BareEncoder = &PhoneSaveCallLogRequest {}
_ bin .BareDecoder = &PhoneSaveCallLogRequest {}
)
func (s *PhoneSaveCallLogRequest ) Zero () bool {
if s == nil {
return true
}
if !(s .Peer .Zero ()) {
return false
}
if !(s .File == nil ) {
return false
}
return true
}
func (s *PhoneSaveCallLogRequest ) String () string {
if s == nil {
return "PhoneSaveCallLogRequest(nil)"
}
type Alias PhoneSaveCallLogRequest
return fmt .Sprintf ("PhoneSaveCallLogRequest%+v" , Alias (*s ))
}
func (s *PhoneSaveCallLogRequest ) FillFrom (from interface {
GetPeer () (value InputPhoneCall )
GetFile () (value InputFileClass )
}) {
s .Peer = from .GetPeer ()
s .File = from .GetFile ()
}
func (*PhoneSaveCallLogRequest ) TypeID () uint32 {
return PhoneSaveCallLogRequestTypeID
}
func (*PhoneSaveCallLogRequest ) TypeName () string {
return "phone.saveCallLog"
}
func (s *PhoneSaveCallLogRequest ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "phone.saveCallLog" ,
ID : PhoneSaveCallLogRequestTypeID ,
}
if s == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "Peer" ,
SchemaName : "peer" ,
},
{
Name : "File" ,
SchemaName : "file" ,
},
}
return typ
}
func (s *PhoneSaveCallLogRequest ) Encode (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't encode phone.saveCallLog#41248786 as nil" )
}
b .PutID (PhoneSaveCallLogRequestTypeID )
return s .EncodeBare (b )
}
func (s *PhoneSaveCallLogRequest ) EncodeBare (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't encode phone.saveCallLog#41248786 as nil" )
}
if err := s .Peer .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode phone.saveCallLog#41248786: field peer: %w" , err )
}
if s .File == nil {
return fmt .Errorf ("unable to encode phone.saveCallLog#41248786: field file is nil" )
}
if err := s .File .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode phone.saveCallLog#41248786: field file: %w" , err )
}
return nil
}
func (s *PhoneSaveCallLogRequest ) Decode (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't decode phone.saveCallLog#41248786 to nil" )
}
if err := b .ConsumeID (PhoneSaveCallLogRequestTypeID ); err != nil {
return fmt .Errorf ("unable to decode phone.saveCallLog#41248786: %w" , err )
}
return s .DecodeBare (b )
}
func (s *PhoneSaveCallLogRequest ) DecodeBare (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't decode phone.saveCallLog#41248786 to nil" )
}
{
if err := s .Peer .Decode (b ); err != nil {
return fmt .Errorf ("unable to decode phone.saveCallLog#41248786: field peer: %w" , err )
}
}
{
value , err := DecodeInputFile (b )
if err != nil {
return fmt .Errorf ("unable to decode phone.saveCallLog#41248786: field file: %w" , err )
}
s .File = value
}
return nil
}
func (s *PhoneSaveCallLogRequest ) GetPeer () (value InputPhoneCall ) {
if s == nil {
return
}
return s .Peer
}
func (s *PhoneSaveCallLogRequest ) GetFile () (value InputFileClass ) {
if s == nil {
return
}
return s .File
}
func (c *Client ) PhoneSaveCallLog (ctx context .Context , request *PhoneSaveCallLogRequest ) (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 .