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,373 @@
|
||||
// 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{}
|
||||
)
|
||||
|
||||
// DiscardCallRequest represents TL type `discardCall#a3da2a8e`.
|
||||
type DiscardCallRequest struct {
|
||||
// Call identifier
|
||||
CallID int32
|
||||
// Pass true if the user was disconnected
|
||||
IsDisconnected bool
|
||||
// If the call was upgraded to a group call, pass invite link to the group call
|
||||
InviteLink string
|
||||
// The call duration, in seconds
|
||||
Duration int32
|
||||
// Pass true if the call was a video call
|
||||
IsVideo bool
|
||||
// Identifier of the connection used during the call
|
||||
ConnectionID int64
|
||||
}
|
||||
|
||||
// DiscardCallRequestTypeID is TL type id of DiscardCallRequest.
|
||||
const DiscardCallRequestTypeID = 0xa3da2a8e
|
||||
|
||||
// Ensuring interfaces in compile-time for DiscardCallRequest.
|
||||
var (
|
||||
_ bin.Encoder = &DiscardCallRequest{}
|
||||
_ bin.Decoder = &DiscardCallRequest{}
|
||||
_ bin.BareEncoder = &DiscardCallRequest{}
|
||||
_ bin.BareDecoder = &DiscardCallRequest{}
|
||||
)
|
||||
|
||||
func (d *DiscardCallRequest) Zero() bool {
|
||||
if d == nil {
|
||||
return true
|
||||
}
|
||||
if !(d.CallID == 0) {
|
||||
return false
|
||||
}
|
||||
if !(d.IsDisconnected == false) {
|
||||
return false
|
||||
}
|
||||
if !(d.InviteLink == "") {
|
||||
return false
|
||||
}
|
||||
if !(d.Duration == 0) {
|
||||
return false
|
||||
}
|
||||
if !(d.IsVideo == false) {
|
||||
return false
|
||||
}
|
||||
if !(d.ConnectionID == 0) {
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
// String implements fmt.Stringer.
|
||||
func (d *DiscardCallRequest) String() string {
|
||||
if d == nil {
|
||||
return "DiscardCallRequest(nil)"
|
||||
}
|
||||
type Alias DiscardCallRequest
|
||||
return fmt.Sprintf("DiscardCallRequest%+v", Alias(*d))
|
||||
}
|
||||
|
||||
// TypeID returns type id in TL schema.
|
||||
//
|
||||
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
||||
func (*DiscardCallRequest) TypeID() uint32 {
|
||||
return DiscardCallRequestTypeID
|
||||
}
|
||||
|
||||
// TypeName returns name of type in TL schema.
|
||||
func (*DiscardCallRequest) TypeName() string {
|
||||
return "discardCall"
|
||||
}
|
||||
|
||||
// TypeInfo returns info about TL type.
|
||||
func (d *DiscardCallRequest) TypeInfo() tdp.Type {
|
||||
typ := tdp.Type{
|
||||
Name: "discardCall",
|
||||
ID: DiscardCallRequestTypeID,
|
||||
}
|
||||
if d == nil {
|
||||
typ.Null = true
|
||||
return typ
|
||||
}
|
||||
typ.Fields = []tdp.Field{
|
||||
{
|
||||
Name: "CallID",
|
||||
SchemaName: "call_id",
|
||||
},
|
||||
{
|
||||
Name: "IsDisconnected",
|
||||
SchemaName: "is_disconnected",
|
||||
},
|
||||
{
|
||||
Name: "InviteLink",
|
||||
SchemaName: "invite_link",
|
||||
},
|
||||
{
|
||||
Name: "Duration",
|
||||
SchemaName: "duration",
|
||||
},
|
||||
{
|
||||
Name: "IsVideo",
|
||||
SchemaName: "is_video",
|
||||
},
|
||||
{
|
||||
Name: "ConnectionID",
|
||||
SchemaName: "connection_id",
|
||||
},
|
||||
}
|
||||
return typ
|
||||
}
|
||||
|
||||
// Encode implements bin.Encoder.
|
||||
func (d *DiscardCallRequest) Encode(b *bin.Buffer) error {
|
||||
if d == nil {
|
||||
return fmt.Errorf("can't encode discardCall#a3da2a8e as nil")
|
||||
}
|
||||
b.PutID(DiscardCallRequestTypeID)
|
||||
return d.EncodeBare(b)
|
||||
}
|
||||
|
||||
// EncodeBare implements bin.BareEncoder.
|
||||
func (d *DiscardCallRequest) EncodeBare(b *bin.Buffer) error {
|
||||
if d == nil {
|
||||
return fmt.Errorf("can't encode discardCall#a3da2a8e as nil")
|
||||
}
|
||||
b.PutInt32(d.CallID)
|
||||
b.PutBool(d.IsDisconnected)
|
||||
b.PutString(d.InviteLink)
|
||||
b.PutInt32(d.Duration)
|
||||
b.PutBool(d.IsVideo)
|
||||
b.PutLong(d.ConnectionID)
|
||||
return nil
|
||||
}
|
||||
|
||||
// Decode implements bin.Decoder.
|
||||
func (d *DiscardCallRequest) Decode(b *bin.Buffer) error {
|
||||
if d == nil {
|
||||
return fmt.Errorf("can't decode discardCall#a3da2a8e to nil")
|
||||
}
|
||||
if err := b.ConsumeID(DiscardCallRequestTypeID); err != nil {
|
||||
return fmt.Errorf("unable to decode discardCall#a3da2a8e: %w", err)
|
||||
}
|
||||
return d.DecodeBare(b)
|
||||
}
|
||||
|
||||
// DecodeBare implements bin.BareDecoder.
|
||||
func (d *DiscardCallRequest) DecodeBare(b *bin.Buffer) error {
|
||||
if d == nil {
|
||||
return fmt.Errorf("can't decode discardCall#a3da2a8e to nil")
|
||||
}
|
||||
{
|
||||
value, err := b.Int32()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode discardCall#a3da2a8e: field call_id: %w", err)
|
||||
}
|
||||
d.CallID = value
|
||||
}
|
||||
{
|
||||
value, err := b.Bool()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode discardCall#a3da2a8e: field is_disconnected: %w", err)
|
||||
}
|
||||
d.IsDisconnected = value
|
||||
}
|
||||
{
|
||||
value, err := b.String()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode discardCall#a3da2a8e: field invite_link: %w", err)
|
||||
}
|
||||
d.InviteLink = value
|
||||
}
|
||||
{
|
||||
value, err := b.Int32()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode discardCall#a3da2a8e: field duration: %w", err)
|
||||
}
|
||||
d.Duration = value
|
||||
}
|
||||
{
|
||||
value, err := b.Bool()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode discardCall#a3da2a8e: field is_video: %w", err)
|
||||
}
|
||||
d.IsVideo = value
|
||||
}
|
||||
{
|
||||
value, err := b.Long()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode discardCall#a3da2a8e: field connection_id: %w", err)
|
||||
}
|
||||
d.ConnectionID = value
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// EncodeTDLibJSON implements tdjson.TDLibEncoder.
|
||||
func (d *DiscardCallRequest) EncodeTDLibJSON(b tdjson.Encoder) error {
|
||||
if d == nil {
|
||||
return fmt.Errorf("can't encode discardCall#a3da2a8e as nil")
|
||||
}
|
||||
b.ObjStart()
|
||||
b.PutID("discardCall")
|
||||
b.Comma()
|
||||
b.FieldStart("call_id")
|
||||
b.PutInt32(d.CallID)
|
||||
b.Comma()
|
||||
b.FieldStart("is_disconnected")
|
||||
b.PutBool(d.IsDisconnected)
|
||||
b.Comma()
|
||||
b.FieldStart("invite_link")
|
||||
b.PutString(d.InviteLink)
|
||||
b.Comma()
|
||||
b.FieldStart("duration")
|
||||
b.PutInt32(d.Duration)
|
||||
b.Comma()
|
||||
b.FieldStart("is_video")
|
||||
b.PutBool(d.IsVideo)
|
||||
b.Comma()
|
||||
b.FieldStart("connection_id")
|
||||
b.PutLong(d.ConnectionID)
|
||||
b.Comma()
|
||||
b.StripComma()
|
||||
b.ObjEnd()
|
||||
return nil
|
||||
}
|
||||
|
||||
// DecodeTDLibJSON implements tdjson.TDLibDecoder.
|
||||
func (d *DiscardCallRequest) DecodeTDLibJSON(b tdjson.Decoder) error {
|
||||
if d == nil {
|
||||
return fmt.Errorf("can't decode discardCall#a3da2a8e to nil")
|
||||
}
|
||||
|
||||
return b.Obj(func(b tdjson.Decoder, key []byte) error {
|
||||
switch string(key) {
|
||||
case tdjson.TypeField:
|
||||
if err := b.ConsumeID("discardCall"); err != nil {
|
||||
return fmt.Errorf("unable to decode discardCall#a3da2a8e: %w", err)
|
||||
}
|
||||
case "call_id":
|
||||
value, err := b.Int32()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode discardCall#a3da2a8e: field call_id: %w", err)
|
||||
}
|
||||
d.CallID = value
|
||||
case "is_disconnected":
|
||||
value, err := b.Bool()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode discardCall#a3da2a8e: field is_disconnected: %w", err)
|
||||
}
|
||||
d.IsDisconnected = value
|
||||
case "invite_link":
|
||||
value, err := b.String()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode discardCall#a3da2a8e: field invite_link: %w", err)
|
||||
}
|
||||
d.InviteLink = value
|
||||
case "duration":
|
||||
value, err := b.Int32()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode discardCall#a3da2a8e: field duration: %w", err)
|
||||
}
|
||||
d.Duration = value
|
||||
case "is_video":
|
||||
value, err := b.Bool()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode discardCall#a3da2a8e: field is_video: %w", err)
|
||||
}
|
||||
d.IsVideo = value
|
||||
case "connection_id":
|
||||
value, err := b.Long()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode discardCall#a3da2a8e: field connection_id: %w", err)
|
||||
}
|
||||
d.ConnectionID = value
|
||||
default:
|
||||
return b.Skip()
|
||||
}
|
||||
return nil
|
||||
})
|
||||
}
|
||||
|
||||
// GetCallID returns value of CallID field.
|
||||
func (d *DiscardCallRequest) GetCallID() (value int32) {
|
||||
if d == nil {
|
||||
return
|
||||
}
|
||||
return d.CallID
|
||||
}
|
||||
|
||||
// GetIsDisconnected returns value of IsDisconnected field.
|
||||
func (d *DiscardCallRequest) GetIsDisconnected() (value bool) {
|
||||
if d == nil {
|
||||
return
|
||||
}
|
||||
return d.IsDisconnected
|
||||
}
|
||||
|
||||
// GetInviteLink returns value of InviteLink field.
|
||||
func (d *DiscardCallRequest) GetInviteLink() (value string) {
|
||||
if d == nil {
|
||||
return
|
||||
}
|
||||
return d.InviteLink
|
||||
}
|
||||
|
||||
// GetDuration returns value of Duration field.
|
||||
func (d *DiscardCallRequest) GetDuration() (value int32) {
|
||||
if d == nil {
|
||||
return
|
||||
}
|
||||
return d.Duration
|
||||
}
|
||||
|
||||
// GetIsVideo returns value of IsVideo field.
|
||||
func (d *DiscardCallRequest) GetIsVideo() (value bool) {
|
||||
if d == nil {
|
||||
return
|
||||
}
|
||||
return d.IsVideo
|
||||
}
|
||||
|
||||
// GetConnectionID returns value of ConnectionID field.
|
||||
func (d *DiscardCallRequest) GetConnectionID() (value int64) {
|
||||
if d == nil {
|
||||
return
|
||||
}
|
||||
return d.ConnectionID
|
||||
}
|
||||
|
||||
// DiscardCall invokes method discardCall#a3da2a8e returning error if any.
|
||||
func (c *Client) DiscardCall(ctx context.Context, request *DiscardCallRequest) 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