move gotd fork into repo. (#111)
- update to latest telegram layer - remove some references to fields in tg.Entities that don't exist in the schema - originally added here: https://github.com/beeper/td/commit/820929062a2ba0104397bc01235ab58a9cff780e - referenced here - https://github.com/mautrix/telegramgo/commit/124f0967ed195b5a380c9bd02e170ada9710dde3 - https://github.com/mautrix/telegramgo/commit/4205047aab2e0639217148b5d125bfaab668bd8e
This commit is contained in:
@@ -0,0 +1,247 @@
|
||||
// Code generated by gotdgen, DO NOT EDIT.
|
||||
|
||||
package tdapi
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
"sort"
|
||||
"strings"
|
||||
|
||||
"go.uber.org/multierr"
|
||||
|
||||
"go.mau.fi/mautrix-telegram/pkg/gotd/bin"
|
||||
"go.mau.fi/mautrix-telegram/pkg/gotd/tdjson"
|
||||
"go.mau.fi/mautrix-telegram/pkg/gotd/tdp"
|
||||
"go.mau.fi/mautrix-telegram/pkg/gotd/tgerr"
|
||||
)
|
||||
|
||||
// No-op definition for keeping imports.
|
||||
var (
|
||||
_ = bin.Buffer{}
|
||||
_ = context.Background()
|
||||
_ = fmt.Stringer(nil)
|
||||
_ = strings.Builder{}
|
||||
_ = errors.Is
|
||||
_ = multierr.AppendInto
|
||||
_ = sort.Ints
|
||||
_ = tdp.Format
|
||||
_ = tgerr.Error{}
|
||||
_ = tdjson.Encoder{}
|
||||
)
|
||||
|
||||
// SendCallLogRequest represents TL type `sendCallLog#3f0a47d1`.
|
||||
type SendCallLogRequest struct {
|
||||
// Call identifier
|
||||
CallID int32
|
||||
// Call log file. Only inputFileLocal and inputFileGenerated are supported
|
||||
LogFile InputFileClass
|
||||
}
|
||||
|
||||
// SendCallLogRequestTypeID is TL type id of SendCallLogRequest.
|
||||
const SendCallLogRequestTypeID = 0x3f0a47d1
|
||||
|
||||
// Ensuring interfaces in compile-time for SendCallLogRequest.
|
||||
var (
|
||||
_ bin.Encoder = &SendCallLogRequest{}
|
||||
_ bin.Decoder = &SendCallLogRequest{}
|
||||
_ bin.BareEncoder = &SendCallLogRequest{}
|
||||
_ bin.BareDecoder = &SendCallLogRequest{}
|
||||
)
|
||||
|
||||
func (s *SendCallLogRequest) Zero() bool {
|
||||
if s == nil {
|
||||
return true
|
||||
}
|
||||
if !(s.CallID == 0) {
|
||||
return false
|
||||
}
|
||||
if !(s.LogFile == nil) {
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
// String implements fmt.Stringer.
|
||||
func (s *SendCallLogRequest) String() string {
|
||||
if s == nil {
|
||||
return "SendCallLogRequest(nil)"
|
||||
}
|
||||
type Alias SendCallLogRequest
|
||||
return fmt.Sprintf("SendCallLogRequest%+v", Alias(*s))
|
||||
}
|
||||
|
||||
// TypeID returns type id in TL schema.
|
||||
//
|
||||
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
||||
func (*SendCallLogRequest) TypeID() uint32 {
|
||||
return SendCallLogRequestTypeID
|
||||
}
|
||||
|
||||
// TypeName returns name of type in TL schema.
|
||||
func (*SendCallLogRequest) TypeName() string {
|
||||
return "sendCallLog"
|
||||
}
|
||||
|
||||
// TypeInfo returns info about TL type.
|
||||
func (s *SendCallLogRequest) TypeInfo() tdp.Type {
|
||||
typ := tdp.Type{
|
||||
Name: "sendCallLog",
|
||||
ID: SendCallLogRequestTypeID,
|
||||
}
|
||||
if s == nil {
|
||||
typ.Null = true
|
||||
return typ
|
||||
}
|
||||
typ.Fields = []tdp.Field{
|
||||
{
|
||||
Name: "CallID",
|
||||
SchemaName: "call_id",
|
||||
},
|
||||
{
|
||||
Name: "LogFile",
|
||||
SchemaName: "log_file",
|
||||
},
|
||||
}
|
||||
return typ
|
||||
}
|
||||
|
||||
// Encode implements bin.Encoder.
|
||||
func (s *SendCallLogRequest) Encode(b *bin.Buffer) error {
|
||||
if s == nil {
|
||||
return fmt.Errorf("can't encode sendCallLog#3f0a47d1 as nil")
|
||||
}
|
||||
b.PutID(SendCallLogRequestTypeID)
|
||||
return s.EncodeBare(b)
|
||||
}
|
||||
|
||||
// EncodeBare implements bin.BareEncoder.
|
||||
func (s *SendCallLogRequest) EncodeBare(b *bin.Buffer) error {
|
||||
if s == nil {
|
||||
return fmt.Errorf("can't encode sendCallLog#3f0a47d1 as nil")
|
||||
}
|
||||
b.PutInt32(s.CallID)
|
||||
if s.LogFile == nil {
|
||||
return fmt.Errorf("unable to encode sendCallLog#3f0a47d1: field log_file is nil")
|
||||
}
|
||||
if err := s.LogFile.Encode(b); err != nil {
|
||||
return fmt.Errorf("unable to encode sendCallLog#3f0a47d1: field log_file: %w", err)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Decode implements bin.Decoder.
|
||||
func (s *SendCallLogRequest) Decode(b *bin.Buffer) error {
|
||||
if s == nil {
|
||||
return fmt.Errorf("can't decode sendCallLog#3f0a47d1 to nil")
|
||||
}
|
||||
if err := b.ConsumeID(SendCallLogRequestTypeID); err != nil {
|
||||
return fmt.Errorf("unable to decode sendCallLog#3f0a47d1: %w", err)
|
||||
}
|
||||
return s.DecodeBare(b)
|
||||
}
|
||||
|
||||
// DecodeBare implements bin.BareDecoder.
|
||||
func (s *SendCallLogRequest) DecodeBare(b *bin.Buffer) error {
|
||||
if s == nil {
|
||||
return fmt.Errorf("can't decode sendCallLog#3f0a47d1 to nil")
|
||||
}
|
||||
{
|
||||
value, err := b.Int32()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode sendCallLog#3f0a47d1: field call_id: %w", err)
|
||||
}
|
||||
s.CallID = value
|
||||
}
|
||||
{
|
||||
value, err := DecodeInputFile(b)
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode sendCallLog#3f0a47d1: field log_file: %w", err)
|
||||
}
|
||||
s.LogFile = value
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// EncodeTDLibJSON implements tdjson.TDLibEncoder.
|
||||
func (s *SendCallLogRequest) EncodeTDLibJSON(b tdjson.Encoder) error {
|
||||
if s == nil {
|
||||
return fmt.Errorf("can't encode sendCallLog#3f0a47d1 as nil")
|
||||
}
|
||||
b.ObjStart()
|
||||
b.PutID("sendCallLog")
|
||||
b.Comma()
|
||||
b.FieldStart("call_id")
|
||||
b.PutInt32(s.CallID)
|
||||
b.Comma()
|
||||
b.FieldStart("log_file")
|
||||
if s.LogFile == nil {
|
||||
return fmt.Errorf("unable to encode sendCallLog#3f0a47d1: field log_file is nil")
|
||||
}
|
||||
if err := s.LogFile.EncodeTDLibJSON(b); err != nil {
|
||||
return fmt.Errorf("unable to encode sendCallLog#3f0a47d1: field log_file: %w", err)
|
||||
}
|
||||
b.Comma()
|
||||
b.StripComma()
|
||||
b.ObjEnd()
|
||||
return nil
|
||||
}
|
||||
|
||||
// DecodeTDLibJSON implements tdjson.TDLibDecoder.
|
||||
func (s *SendCallLogRequest) DecodeTDLibJSON(b tdjson.Decoder) error {
|
||||
if s == nil {
|
||||
return fmt.Errorf("can't decode sendCallLog#3f0a47d1 to nil")
|
||||
}
|
||||
|
||||
return b.Obj(func(b tdjson.Decoder, key []byte) error {
|
||||
switch string(key) {
|
||||
case tdjson.TypeField:
|
||||
if err := b.ConsumeID("sendCallLog"); err != nil {
|
||||
return fmt.Errorf("unable to decode sendCallLog#3f0a47d1: %w", err)
|
||||
}
|
||||
case "call_id":
|
||||
value, err := b.Int32()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode sendCallLog#3f0a47d1: field call_id: %w", err)
|
||||
}
|
||||
s.CallID = value
|
||||
case "log_file":
|
||||
value, err := DecodeTDLibJSONInputFile(b)
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode sendCallLog#3f0a47d1: field log_file: %w", err)
|
||||
}
|
||||
s.LogFile = value
|
||||
default:
|
||||
return b.Skip()
|
||||
}
|
||||
return nil
|
||||
})
|
||||
}
|
||||
|
||||
// GetCallID returns value of CallID field.
|
||||
func (s *SendCallLogRequest) GetCallID() (value int32) {
|
||||
if s == nil {
|
||||
return
|
||||
}
|
||||
return s.CallID
|
||||
}
|
||||
|
||||
// GetLogFile returns value of LogFile field.
|
||||
func (s *SendCallLogRequest) GetLogFile() (value InputFileClass) {
|
||||
if s == nil {
|
||||
return
|
||||
}
|
||||
return s.LogFile
|
||||
}
|
||||
|
||||
// SendCallLog invokes method sendCallLog#3f0a47d1 returning error if any.
|
||||
func (c *Client) SendCallLog(ctx context.Context, request *SendCallLogRequest) error {
|
||||
var ok Ok
|
||||
|
||||
if err := c.rpc.Invoke(ctx, request, &ok); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
Reference in New Issue
Block a user