7a04f298d2
- 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
262 lines
6.8 KiB
Go
262 lines
6.8 KiB
Go
// 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{}
|
|
)
|
|
|
|
// InviteVideoChatParticipantsRequest represents TL type `inviteVideoChatParticipants#ba2f4776`.
|
|
type InviteVideoChatParticipantsRequest struct {
|
|
// Group call identifier
|
|
GroupCallID int32
|
|
// User identifiers. At most 10 users can be invited simultaneously
|
|
UserIDs []int64
|
|
}
|
|
|
|
// InviteVideoChatParticipantsRequestTypeID is TL type id of InviteVideoChatParticipantsRequest.
|
|
const InviteVideoChatParticipantsRequestTypeID = 0xba2f4776
|
|
|
|
// Ensuring interfaces in compile-time for InviteVideoChatParticipantsRequest.
|
|
var (
|
|
_ bin.Encoder = &InviteVideoChatParticipantsRequest{}
|
|
_ bin.Decoder = &InviteVideoChatParticipantsRequest{}
|
|
_ bin.BareEncoder = &InviteVideoChatParticipantsRequest{}
|
|
_ bin.BareDecoder = &InviteVideoChatParticipantsRequest{}
|
|
)
|
|
|
|
func (i *InviteVideoChatParticipantsRequest) Zero() bool {
|
|
if i == nil {
|
|
return true
|
|
}
|
|
if !(i.GroupCallID == 0) {
|
|
return false
|
|
}
|
|
if !(i.UserIDs == nil) {
|
|
return false
|
|
}
|
|
|
|
return true
|
|
}
|
|
|
|
// String implements fmt.Stringer.
|
|
func (i *InviteVideoChatParticipantsRequest) String() string {
|
|
if i == nil {
|
|
return "InviteVideoChatParticipantsRequest(nil)"
|
|
}
|
|
type Alias InviteVideoChatParticipantsRequest
|
|
return fmt.Sprintf("InviteVideoChatParticipantsRequest%+v", Alias(*i))
|
|
}
|
|
|
|
// TypeID returns type id in TL schema.
|
|
//
|
|
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
|
func (*InviteVideoChatParticipantsRequest) TypeID() uint32 {
|
|
return InviteVideoChatParticipantsRequestTypeID
|
|
}
|
|
|
|
// TypeName returns name of type in TL schema.
|
|
func (*InviteVideoChatParticipantsRequest) TypeName() string {
|
|
return "inviteVideoChatParticipants"
|
|
}
|
|
|
|
// TypeInfo returns info about TL type.
|
|
func (i *InviteVideoChatParticipantsRequest) TypeInfo() tdp.Type {
|
|
typ := tdp.Type{
|
|
Name: "inviteVideoChatParticipants",
|
|
ID: InviteVideoChatParticipantsRequestTypeID,
|
|
}
|
|
if i == nil {
|
|
typ.Null = true
|
|
return typ
|
|
}
|
|
typ.Fields = []tdp.Field{
|
|
{
|
|
Name: "GroupCallID",
|
|
SchemaName: "group_call_id",
|
|
},
|
|
{
|
|
Name: "UserIDs",
|
|
SchemaName: "user_ids",
|
|
},
|
|
}
|
|
return typ
|
|
}
|
|
|
|
// Encode implements bin.Encoder.
|
|
func (i *InviteVideoChatParticipantsRequest) Encode(b *bin.Buffer) error {
|
|
if i == nil {
|
|
return fmt.Errorf("can't encode inviteVideoChatParticipants#ba2f4776 as nil")
|
|
}
|
|
b.PutID(InviteVideoChatParticipantsRequestTypeID)
|
|
return i.EncodeBare(b)
|
|
}
|
|
|
|
// EncodeBare implements bin.BareEncoder.
|
|
func (i *InviteVideoChatParticipantsRequest) EncodeBare(b *bin.Buffer) error {
|
|
if i == nil {
|
|
return fmt.Errorf("can't encode inviteVideoChatParticipants#ba2f4776 as nil")
|
|
}
|
|
b.PutInt32(i.GroupCallID)
|
|
b.PutInt(len(i.UserIDs))
|
|
for _, v := range i.UserIDs {
|
|
b.PutInt53(v)
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// Decode implements bin.Decoder.
|
|
func (i *InviteVideoChatParticipantsRequest) Decode(b *bin.Buffer) error {
|
|
if i == nil {
|
|
return fmt.Errorf("can't decode inviteVideoChatParticipants#ba2f4776 to nil")
|
|
}
|
|
if err := b.ConsumeID(InviteVideoChatParticipantsRequestTypeID); err != nil {
|
|
return fmt.Errorf("unable to decode inviteVideoChatParticipants#ba2f4776: %w", err)
|
|
}
|
|
return i.DecodeBare(b)
|
|
}
|
|
|
|
// DecodeBare implements bin.BareDecoder.
|
|
func (i *InviteVideoChatParticipantsRequest) DecodeBare(b *bin.Buffer) error {
|
|
if i == nil {
|
|
return fmt.Errorf("can't decode inviteVideoChatParticipants#ba2f4776 to nil")
|
|
}
|
|
{
|
|
value, err := b.Int32()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode inviteVideoChatParticipants#ba2f4776: field group_call_id: %w", err)
|
|
}
|
|
i.GroupCallID = value
|
|
}
|
|
{
|
|
headerLen, err := b.Int()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode inviteVideoChatParticipants#ba2f4776: field user_ids: %w", err)
|
|
}
|
|
|
|
if headerLen > 0 {
|
|
i.UserIDs = make([]int64, 0, headerLen%bin.PreallocateLimit)
|
|
}
|
|
for idx := 0; idx < headerLen; idx++ {
|
|
value, err := b.Int53()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode inviteVideoChatParticipants#ba2f4776: field user_ids: %w", err)
|
|
}
|
|
i.UserIDs = append(i.UserIDs, value)
|
|
}
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// EncodeTDLibJSON implements tdjson.TDLibEncoder.
|
|
func (i *InviteVideoChatParticipantsRequest) EncodeTDLibJSON(b tdjson.Encoder) error {
|
|
if i == nil {
|
|
return fmt.Errorf("can't encode inviteVideoChatParticipants#ba2f4776 as nil")
|
|
}
|
|
b.ObjStart()
|
|
b.PutID("inviteVideoChatParticipants")
|
|
b.Comma()
|
|
b.FieldStart("group_call_id")
|
|
b.PutInt32(i.GroupCallID)
|
|
b.Comma()
|
|
b.FieldStart("user_ids")
|
|
b.ArrStart()
|
|
for _, v := range i.UserIDs {
|
|
b.PutInt53(v)
|
|
b.Comma()
|
|
}
|
|
b.StripComma()
|
|
b.ArrEnd()
|
|
b.Comma()
|
|
b.StripComma()
|
|
b.ObjEnd()
|
|
return nil
|
|
}
|
|
|
|
// DecodeTDLibJSON implements tdjson.TDLibDecoder.
|
|
func (i *InviteVideoChatParticipantsRequest) DecodeTDLibJSON(b tdjson.Decoder) error {
|
|
if i == nil {
|
|
return fmt.Errorf("can't decode inviteVideoChatParticipants#ba2f4776 to nil")
|
|
}
|
|
|
|
return b.Obj(func(b tdjson.Decoder, key []byte) error {
|
|
switch string(key) {
|
|
case tdjson.TypeField:
|
|
if err := b.ConsumeID("inviteVideoChatParticipants"); err != nil {
|
|
return fmt.Errorf("unable to decode inviteVideoChatParticipants#ba2f4776: %w", err)
|
|
}
|
|
case "group_call_id":
|
|
value, err := b.Int32()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode inviteVideoChatParticipants#ba2f4776: field group_call_id: %w", err)
|
|
}
|
|
i.GroupCallID = value
|
|
case "user_ids":
|
|
if err := b.Arr(func(b tdjson.Decoder) error {
|
|
value, err := b.Int53()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode inviteVideoChatParticipants#ba2f4776: field user_ids: %w", err)
|
|
}
|
|
i.UserIDs = append(i.UserIDs, value)
|
|
return nil
|
|
}); err != nil {
|
|
return fmt.Errorf("unable to decode inviteVideoChatParticipants#ba2f4776: field user_ids: %w", err)
|
|
}
|
|
default:
|
|
return b.Skip()
|
|
}
|
|
return nil
|
|
})
|
|
}
|
|
|
|
// GetGroupCallID returns value of GroupCallID field.
|
|
func (i *InviteVideoChatParticipantsRequest) GetGroupCallID() (value int32) {
|
|
if i == nil {
|
|
return
|
|
}
|
|
return i.GroupCallID
|
|
}
|
|
|
|
// GetUserIDs returns value of UserIDs field.
|
|
func (i *InviteVideoChatParticipantsRequest) GetUserIDs() (value []int64) {
|
|
if i == nil {
|
|
return
|
|
}
|
|
return i.UserIDs
|
|
}
|
|
|
|
// InviteVideoChatParticipants invokes method inviteVideoChatParticipants#ba2f4776 returning error if any.
|
|
func (c *Client) InviteVideoChatParticipants(ctx context.Context, request *InviteVideoChatParticipantsRequest) error {
|
|
var ok Ok
|
|
|
|
if err := c.rpc.Invoke(ctx, request, &ok); err != nil {
|
|
return err
|
|
}
|
|
return nil
|
|
}
|