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,295 @@
|
||||
// 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{}
|
||||
)
|
||||
|
||||
// GroupCallJoinParameters represents TL type `groupCallJoinParameters#691bede6`.
|
||||
type GroupCallJoinParameters struct {
|
||||
// Audio channel synchronization source identifier; received from tgcalls
|
||||
AudioSourceID int32
|
||||
// Group call join payload; received from tgcalls
|
||||
Payload string
|
||||
// Pass true to join the call with muted microphone
|
||||
IsMuted bool
|
||||
// Pass true if the user's video is enabled
|
||||
IsMyVideoEnabled bool
|
||||
}
|
||||
|
||||
// GroupCallJoinParametersTypeID is TL type id of GroupCallJoinParameters.
|
||||
const GroupCallJoinParametersTypeID = 0x691bede6
|
||||
|
||||
// Ensuring interfaces in compile-time for GroupCallJoinParameters.
|
||||
var (
|
||||
_ bin.Encoder = &GroupCallJoinParameters{}
|
||||
_ bin.Decoder = &GroupCallJoinParameters{}
|
||||
_ bin.BareEncoder = &GroupCallJoinParameters{}
|
||||
_ bin.BareDecoder = &GroupCallJoinParameters{}
|
||||
)
|
||||
|
||||
func (g *GroupCallJoinParameters) Zero() bool {
|
||||
if g == nil {
|
||||
return true
|
||||
}
|
||||
if !(g.AudioSourceID == 0) {
|
||||
return false
|
||||
}
|
||||
if !(g.Payload == "") {
|
||||
return false
|
||||
}
|
||||
if !(g.IsMuted == false) {
|
||||
return false
|
||||
}
|
||||
if !(g.IsMyVideoEnabled == false) {
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
// String implements fmt.Stringer.
|
||||
func (g *GroupCallJoinParameters) String() string {
|
||||
if g == nil {
|
||||
return "GroupCallJoinParameters(nil)"
|
||||
}
|
||||
type Alias GroupCallJoinParameters
|
||||
return fmt.Sprintf("GroupCallJoinParameters%+v", Alias(*g))
|
||||
}
|
||||
|
||||
// TypeID returns type id in TL schema.
|
||||
//
|
||||
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
||||
func (*GroupCallJoinParameters) TypeID() uint32 {
|
||||
return GroupCallJoinParametersTypeID
|
||||
}
|
||||
|
||||
// TypeName returns name of type in TL schema.
|
||||
func (*GroupCallJoinParameters) TypeName() string {
|
||||
return "groupCallJoinParameters"
|
||||
}
|
||||
|
||||
// TypeInfo returns info about TL type.
|
||||
func (g *GroupCallJoinParameters) TypeInfo() tdp.Type {
|
||||
typ := tdp.Type{
|
||||
Name: "groupCallJoinParameters",
|
||||
ID: GroupCallJoinParametersTypeID,
|
||||
}
|
||||
if g == nil {
|
||||
typ.Null = true
|
||||
return typ
|
||||
}
|
||||
typ.Fields = []tdp.Field{
|
||||
{
|
||||
Name: "AudioSourceID",
|
||||
SchemaName: "audio_source_id",
|
||||
},
|
||||
{
|
||||
Name: "Payload",
|
||||
SchemaName: "payload",
|
||||
},
|
||||
{
|
||||
Name: "IsMuted",
|
||||
SchemaName: "is_muted",
|
||||
},
|
||||
{
|
||||
Name: "IsMyVideoEnabled",
|
||||
SchemaName: "is_my_video_enabled",
|
||||
},
|
||||
}
|
||||
return typ
|
||||
}
|
||||
|
||||
// Encode implements bin.Encoder.
|
||||
func (g *GroupCallJoinParameters) Encode(b *bin.Buffer) error {
|
||||
if g == nil {
|
||||
return fmt.Errorf("can't encode groupCallJoinParameters#691bede6 as nil")
|
||||
}
|
||||
b.PutID(GroupCallJoinParametersTypeID)
|
||||
return g.EncodeBare(b)
|
||||
}
|
||||
|
||||
// EncodeBare implements bin.BareEncoder.
|
||||
func (g *GroupCallJoinParameters) EncodeBare(b *bin.Buffer) error {
|
||||
if g == nil {
|
||||
return fmt.Errorf("can't encode groupCallJoinParameters#691bede6 as nil")
|
||||
}
|
||||
b.PutInt32(g.AudioSourceID)
|
||||
b.PutString(g.Payload)
|
||||
b.PutBool(g.IsMuted)
|
||||
b.PutBool(g.IsMyVideoEnabled)
|
||||
return nil
|
||||
}
|
||||
|
||||
// Decode implements bin.Decoder.
|
||||
func (g *GroupCallJoinParameters) Decode(b *bin.Buffer) error {
|
||||
if g == nil {
|
||||
return fmt.Errorf("can't decode groupCallJoinParameters#691bede6 to nil")
|
||||
}
|
||||
if err := b.ConsumeID(GroupCallJoinParametersTypeID); err != nil {
|
||||
return fmt.Errorf("unable to decode groupCallJoinParameters#691bede6: %w", err)
|
||||
}
|
||||
return g.DecodeBare(b)
|
||||
}
|
||||
|
||||
// DecodeBare implements bin.BareDecoder.
|
||||
func (g *GroupCallJoinParameters) DecodeBare(b *bin.Buffer) error {
|
||||
if g == nil {
|
||||
return fmt.Errorf("can't decode groupCallJoinParameters#691bede6 to nil")
|
||||
}
|
||||
{
|
||||
value, err := b.Int32()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode groupCallJoinParameters#691bede6: field audio_source_id: %w", err)
|
||||
}
|
||||
g.AudioSourceID = value
|
||||
}
|
||||
{
|
||||
value, err := b.String()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode groupCallJoinParameters#691bede6: field payload: %w", err)
|
||||
}
|
||||
g.Payload = value
|
||||
}
|
||||
{
|
||||
value, err := b.Bool()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode groupCallJoinParameters#691bede6: field is_muted: %w", err)
|
||||
}
|
||||
g.IsMuted = value
|
||||
}
|
||||
{
|
||||
value, err := b.Bool()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode groupCallJoinParameters#691bede6: field is_my_video_enabled: %w", err)
|
||||
}
|
||||
g.IsMyVideoEnabled = value
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// EncodeTDLibJSON implements tdjson.TDLibEncoder.
|
||||
func (g *GroupCallJoinParameters) EncodeTDLibJSON(b tdjson.Encoder) error {
|
||||
if g == nil {
|
||||
return fmt.Errorf("can't encode groupCallJoinParameters#691bede6 as nil")
|
||||
}
|
||||
b.ObjStart()
|
||||
b.PutID("groupCallJoinParameters")
|
||||
b.Comma()
|
||||
b.FieldStart("audio_source_id")
|
||||
b.PutInt32(g.AudioSourceID)
|
||||
b.Comma()
|
||||
b.FieldStart("payload")
|
||||
b.PutString(g.Payload)
|
||||
b.Comma()
|
||||
b.FieldStart("is_muted")
|
||||
b.PutBool(g.IsMuted)
|
||||
b.Comma()
|
||||
b.FieldStart("is_my_video_enabled")
|
||||
b.PutBool(g.IsMyVideoEnabled)
|
||||
b.Comma()
|
||||
b.StripComma()
|
||||
b.ObjEnd()
|
||||
return nil
|
||||
}
|
||||
|
||||
// DecodeTDLibJSON implements tdjson.TDLibDecoder.
|
||||
func (g *GroupCallJoinParameters) DecodeTDLibJSON(b tdjson.Decoder) error {
|
||||
if g == nil {
|
||||
return fmt.Errorf("can't decode groupCallJoinParameters#691bede6 to nil")
|
||||
}
|
||||
|
||||
return b.Obj(func(b tdjson.Decoder, key []byte) error {
|
||||
switch string(key) {
|
||||
case tdjson.TypeField:
|
||||
if err := b.ConsumeID("groupCallJoinParameters"); err != nil {
|
||||
return fmt.Errorf("unable to decode groupCallJoinParameters#691bede6: %w", err)
|
||||
}
|
||||
case "audio_source_id":
|
||||
value, err := b.Int32()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode groupCallJoinParameters#691bede6: field audio_source_id: %w", err)
|
||||
}
|
||||
g.AudioSourceID = value
|
||||
case "payload":
|
||||
value, err := b.String()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode groupCallJoinParameters#691bede6: field payload: %w", err)
|
||||
}
|
||||
g.Payload = value
|
||||
case "is_muted":
|
||||
value, err := b.Bool()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode groupCallJoinParameters#691bede6: field is_muted: %w", err)
|
||||
}
|
||||
g.IsMuted = value
|
||||
case "is_my_video_enabled":
|
||||
value, err := b.Bool()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode groupCallJoinParameters#691bede6: field is_my_video_enabled: %w", err)
|
||||
}
|
||||
g.IsMyVideoEnabled = value
|
||||
default:
|
||||
return b.Skip()
|
||||
}
|
||||
return nil
|
||||
})
|
||||
}
|
||||
|
||||
// GetAudioSourceID returns value of AudioSourceID field.
|
||||
func (g *GroupCallJoinParameters) GetAudioSourceID() (value int32) {
|
||||
if g == nil {
|
||||
return
|
||||
}
|
||||
return g.AudioSourceID
|
||||
}
|
||||
|
||||
// GetPayload returns value of Payload field.
|
||||
func (g *GroupCallJoinParameters) GetPayload() (value string) {
|
||||
if g == nil {
|
||||
return
|
||||
}
|
||||
return g.Payload
|
||||
}
|
||||
|
||||
// GetIsMuted returns value of IsMuted field.
|
||||
func (g *GroupCallJoinParameters) GetIsMuted() (value bool) {
|
||||
if g == nil {
|
||||
return
|
||||
}
|
||||
return g.IsMuted
|
||||
}
|
||||
|
||||
// GetIsMyVideoEnabled returns value of IsMyVideoEnabled field.
|
||||
func (g *GroupCallJoinParameters) GetIsMyVideoEnabled() (value bool) {
|
||||
if g == nil {
|
||||
return
|
||||
}
|
||||
return g.IsMyVideoEnabled
|
||||
}
|
||||
Reference in New Issue
Block a user