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
308 lines
7.3 KiB
Go
308 lines
7.3 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{}
|
|
)
|
|
|
|
// CreateVideoChatRequest represents TL type `createVideoChat#7ea4958d`.
|
|
type CreateVideoChatRequest struct {
|
|
// Identifier of a chat in which the video chat will be created
|
|
ChatID int64
|
|
// Group call title; if empty, chat title will be used
|
|
Title string
|
|
// Point in time (Unix timestamp) when the group call is expected to be started by an
|
|
// administrator; 0 to start the video chat immediately. The date must be at least 10
|
|
// seconds and at most 8 days in the future
|
|
StartDate int32
|
|
// Pass true to create an RTMP stream instead of an ordinary video chat
|
|
IsRtmpStream bool
|
|
}
|
|
|
|
// CreateVideoChatRequestTypeID is TL type id of CreateVideoChatRequest.
|
|
const CreateVideoChatRequestTypeID = 0x7ea4958d
|
|
|
|
// Ensuring interfaces in compile-time for CreateVideoChatRequest.
|
|
var (
|
|
_ bin.Encoder = &CreateVideoChatRequest{}
|
|
_ bin.Decoder = &CreateVideoChatRequest{}
|
|
_ bin.BareEncoder = &CreateVideoChatRequest{}
|
|
_ bin.BareDecoder = &CreateVideoChatRequest{}
|
|
)
|
|
|
|
func (c *CreateVideoChatRequest) Zero() bool {
|
|
if c == nil {
|
|
return true
|
|
}
|
|
if !(c.ChatID == 0) {
|
|
return false
|
|
}
|
|
if !(c.Title == "") {
|
|
return false
|
|
}
|
|
if !(c.StartDate == 0) {
|
|
return false
|
|
}
|
|
if !(c.IsRtmpStream == false) {
|
|
return false
|
|
}
|
|
|
|
return true
|
|
}
|
|
|
|
// String implements fmt.Stringer.
|
|
func (c *CreateVideoChatRequest) String() string {
|
|
if c == nil {
|
|
return "CreateVideoChatRequest(nil)"
|
|
}
|
|
type Alias CreateVideoChatRequest
|
|
return fmt.Sprintf("CreateVideoChatRequest%+v", Alias(*c))
|
|
}
|
|
|
|
// TypeID returns type id in TL schema.
|
|
//
|
|
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
|
func (*CreateVideoChatRequest) TypeID() uint32 {
|
|
return CreateVideoChatRequestTypeID
|
|
}
|
|
|
|
// TypeName returns name of type in TL schema.
|
|
func (*CreateVideoChatRequest) TypeName() string {
|
|
return "createVideoChat"
|
|
}
|
|
|
|
// TypeInfo returns info about TL type.
|
|
func (c *CreateVideoChatRequest) TypeInfo() tdp.Type {
|
|
typ := tdp.Type{
|
|
Name: "createVideoChat",
|
|
ID: CreateVideoChatRequestTypeID,
|
|
}
|
|
if c == nil {
|
|
typ.Null = true
|
|
return typ
|
|
}
|
|
typ.Fields = []tdp.Field{
|
|
{
|
|
Name: "ChatID",
|
|
SchemaName: "chat_id",
|
|
},
|
|
{
|
|
Name: "Title",
|
|
SchemaName: "title",
|
|
},
|
|
{
|
|
Name: "StartDate",
|
|
SchemaName: "start_date",
|
|
},
|
|
{
|
|
Name: "IsRtmpStream",
|
|
SchemaName: "is_rtmp_stream",
|
|
},
|
|
}
|
|
return typ
|
|
}
|
|
|
|
// Encode implements bin.Encoder.
|
|
func (c *CreateVideoChatRequest) Encode(b *bin.Buffer) error {
|
|
if c == nil {
|
|
return fmt.Errorf("can't encode createVideoChat#7ea4958d as nil")
|
|
}
|
|
b.PutID(CreateVideoChatRequestTypeID)
|
|
return c.EncodeBare(b)
|
|
}
|
|
|
|
// EncodeBare implements bin.BareEncoder.
|
|
func (c *CreateVideoChatRequest) EncodeBare(b *bin.Buffer) error {
|
|
if c == nil {
|
|
return fmt.Errorf("can't encode createVideoChat#7ea4958d as nil")
|
|
}
|
|
b.PutInt53(c.ChatID)
|
|
b.PutString(c.Title)
|
|
b.PutInt32(c.StartDate)
|
|
b.PutBool(c.IsRtmpStream)
|
|
return nil
|
|
}
|
|
|
|
// Decode implements bin.Decoder.
|
|
func (c *CreateVideoChatRequest) Decode(b *bin.Buffer) error {
|
|
if c == nil {
|
|
return fmt.Errorf("can't decode createVideoChat#7ea4958d to nil")
|
|
}
|
|
if err := b.ConsumeID(CreateVideoChatRequestTypeID); err != nil {
|
|
return fmt.Errorf("unable to decode createVideoChat#7ea4958d: %w", err)
|
|
}
|
|
return c.DecodeBare(b)
|
|
}
|
|
|
|
// DecodeBare implements bin.BareDecoder.
|
|
func (c *CreateVideoChatRequest) DecodeBare(b *bin.Buffer) error {
|
|
if c == nil {
|
|
return fmt.Errorf("can't decode createVideoChat#7ea4958d to nil")
|
|
}
|
|
{
|
|
value, err := b.Int53()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode createVideoChat#7ea4958d: field chat_id: %w", err)
|
|
}
|
|
c.ChatID = value
|
|
}
|
|
{
|
|
value, err := b.String()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode createVideoChat#7ea4958d: field title: %w", err)
|
|
}
|
|
c.Title = value
|
|
}
|
|
{
|
|
value, err := b.Int32()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode createVideoChat#7ea4958d: field start_date: %w", err)
|
|
}
|
|
c.StartDate = value
|
|
}
|
|
{
|
|
value, err := b.Bool()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode createVideoChat#7ea4958d: field is_rtmp_stream: %w", err)
|
|
}
|
|
c.IsRtmpStream = value
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// EncodeTDLibJSON implements tdjson.TDLibEncoder.
|
|
func (c *CreateVideoChatRequest) EncodeTDLibJSON(b tdjson.Encoder) error {
|
|
if c == nil {
|
|
return fmt.Errorf("can't encode createVideoChat#7ea4958d as nil")
|
|
}
|
|
b.ObjStart()
|
|
b.PutID("createVideoChat")
|
|
b.Comma()
|
|
b.FieldStart("chat_id")
|
|
b.PutInt53(c.ChatID)
|
|
b.Comma()
|
|
b.FieldStart("title")
|
|
b.PutString(c.Title)
|
|
b.Comma()
|
|
b.FieldStart("start_date")
|
|
b.PutInt32(c.StartDate)
|
|
b.Comma()
|
|
b.FieldStart("is_rtmp_stream")
|
|
b.PutBool(c.IsRtmpStream)
|
|
b.Comma()
|
|
b.StripComma()
|
|
b.ObjEnd()
|
|
return nil
|
|
}
|
|
|
|
// DecodeTDLibJSON implements tdjson.TDLibDecoder.
|
|
func (c *CreateVideoChatRequest) DecodeTDLibJSON(b tdjson.Decoder) error {
|
|
if c == nil {
|
|
return fmt.Errorf("can't decode createVideoChat#7ea4958d to nil")
|
|
}
|
|
|
|
return b.Obj(func(b tdjson.Decoder, key []byte) error {
|
|
switch string(key) {
|
|
case tdjson.TypeField:
|
|
if err := b.ConsumeID("createVideoChat"); err != nil {
|
|
return fmt.Errorf("unable to decode createVideoChat#7ea4958d: %w", err)
|
|
}
|
|
case "chat_id":
|
|
value, err := b.Int53()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode createVideoChat#7ea4958d: field chat_id: %w", err)
|
|
}
|
|
c.ChatID = value
|
|
case "title":
|
|
value, err := b.String()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode createVideoChat#7ea4958d: field title: %w", err)
|
|
}
|
|
c.Title = value
|
|
case "start_date":
|
|
value, err := b.Int32()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode createVideoChat#7ea4958d: field start_date: %w", err)
|
|
}
|
|
c.StartDate = value
|
|
case "is_rtmp_stream":
|
|
value, err := b.Bool()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode createVideoChat#7ea4958d: field is_rtmp_stream: %w", err)
|
|
}
|
|
c.IsRtmpStream = value
|
|
default:
|
|
return b.Skip()
|
|
}
|
|
return nil
|
|
})
|
|
}
|
|
|
|
// GetChatID returns value of ChatID field.
|
|
func (c *CreateVideoChatRequest) GetChatID() (value int64) {
|
|
if c == nil {
|
|
return
|
|
}
|
|
return c.ChatID
|
|
}
|
|
|
|
// GetTitle returns value of Title field.
|
|
func (c *CreateVideoChatRequest) GetTitle() (value string) {
|
|
if c == nil {
|
|
return
|
|
}
|
|
return c.Title
|
|
}
|
|
|
|
// GetStartDate returns value of StartDate field.
|
|
func (c *CreateVideoChatRequest) GetStartDate() (value int32) {
|
|
if c == nil {
|
|
return
|
|
}
|
|
return c.StartDate
|
|
}
|
|
|
|
// GetIsRtmpStream returns value of IsRtmpStream field.
|
|
func (c *CreateVideoChatRequest) GetIsRtmpStream() (value bool) {
|
|
if c == nil {
|
|
return
|
|
}
|
|
return c.IsRtmpStream
|
|
}
|
|
|
|
// CreateVideoChat invokes method createVideoChat#7ea4958d returning error if any.
|
|
func (c *Client) CreateVideoChat(ctx context.Context, request *CreateVideoChatRequest) (*GroupCallID, error) {
|
|
var result GroupCallID
|
|
|
|
if err := c.rpc.Invoke(ctx, request, &result); err != nil {
|
|
return nil, err
|
|
}
|
|
return &result, nil
|
|
}
|