Files
mautrix-telegram/pkg/gotd/tdapi/tl_get_video_chat_streams_gen.go
T
2025-06-27 20:03:37 -07:00

207 lines
5.1 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{}
)
// GetVideoChatStreamsRequest represents TL type `getVideoChatStreams#1fb1fac5`.
type GetVideoChatStreamsRequest struct {
// Group call identifier
GroupCallID int32
}
// GetVideoChatStreamsRequestTypeID is TL type id of GetVideoChatStreamsRequest.
const GetVideoChatStreamsRequestTypeID = 0x1fb1fac5
// Ensuring interfaces in compile-time for GetVideoChatStreamsRequest.
var (
_ bin.Encoder = &GetVideoChatStreamsRequest{}
_ bin.Decoder = &GetVideoChatStreamsRequest{}
_ bin.BareEncoder = &GetVideoChatStreamsRequest{}
_ bin.BareDecoder = &GetVideoChatStreamsRequest{}
)
func (g *GetVideoChatStreamsRequest) Zero() bool {
if g == nil {
return true
}
if !(g.GroupCallID == 0) {
return false
}
return true
}
// String implements fmt.Stringer.
func (g *GetVideoChatStreamsRequest) String() string {
if g == nil {
return "GetVideoChatStreamsRequest(nil)"
}
type Alias GetVideoChatStreamsRequest
return fmt.Sprintf("GetVideoChatStreamsRequest%+v", Alias(*g))
}
// TypeID returns type id in TL schema.
//
// See https://core.telegram.org/mtproto/TL-tl#remarks.
func (*GetVideoChatStreamsRequest) TypeID() uint32 {
return GetVideoChatStreamsRequestTypeID
}
// TypeName returns name of type in TL schema.
func (*GetVideoChatStreamsRequest) TypeName() string {
return "getVideoChatStreams"
}
// TypeInfo returns info about TL type.
func (g *GetVideoChatStreamsRequest) TypeInfo() tdp.Type {
typ := tdp.Type{
Name: "getVideoChatStreams",
ID: GetVideoChatStreamsRequestTypeID,
}
if g == nil {
typ.Null = true
return typ
}
typ.Fields = []tdp.Field{
{
Name: "GroupCallID",
SchemaName: "group_call_id",
},
}
return typ
}
// Encode implements bin.Encoder.
func (g *GetVideoChatStreamsRequest) Encode(b *bin.Buffer) error {
if g == nil {
return fmt.Errorf("can't encode getVideoChatStreams#1fb1fac5 as nil")
}
b.PutID(GetVideoChatStreamsRequestTypeID)
return g.EncodeBare(b)
}
// EncodeBare implements bin.BareEncoder.
func (g *GetVideoChatStreamsRequest) EncodeBare(b *bin.Buffer) error {
if g == nil {
return fmt.Errorf("can't encode getVideoChatStreams#1fb1fac5 as nil")
}
b.PutInt32(g.GroupCallID)
return nil
}
// Decode implements bin.Decoder.
func (g *GetVideoChatStreamsRequest) Decode(b *bin.Buffer) error {
if g == nil {
return fmt.Errorf("can't decode getVideoChatStreams#1fb1fac5 to nil")
}
if err := b.ConsumeID(GetVideoChatStreamsRequestTypeID); err != nil {
return fmt.Errorf("unable to decode getVideoChatStreams#1fb1fac5: %w", err)
}
return g.DecodeBare(b)
}
// DecodeBare implements bin.BareDecoder.
func (g *GetVideoChatStreamsRequest) DecodeBare(b *bin.Buffer) error {
if g == nil {
return fmt.Errorf("can't decode getVideoChatStreams#1fb1fac5 to nil")
}
{
value, err := b.Int32()
if err != nil {
return fmt.Errorf("unable to decode getVideoChatStreams#1fb1fac5: field group_call_id: %w", err)
}
g.GroupCallID = value
}
return nil
}
// EncodeTDLibJSON implements tdjson.TDLibEncoder.
func (g *GetVideoChatStreamsRequest) EncodeTDLibJSON(b tdjson.Encoder) error {
if g == nil {
return fmt.Errorf("can't encode getVideoChatStreams#1fb1fac5 as nil")
}
b.ObjStart()
b.PutID("getVideoChatStreams")
b.Comma()
b.FieldStart("group_call_id")
b.PutInt32(g.GroupCallID)
b.Comma()
b.StripComma()
b.ObjEnd()
return nil
}
// DecodeTDLibJSON implements tdjson.TDLibDecoder.
func (g *GetVideoChatStreamsRequest) DecodeTDLibJSON(b tdjson.Decoder) error {
if g == nil {
return fmt.Errorf("can't decode getVideoChatStreams#1fb1fac5 to nil")
}
return b.Obj(func(b tdjson.Decoder, key []byte) error {
switch string(key) {
case tdjson.TypeField:
if err := b.ConsumeID("getVideoChatStreams"); err != nil {
return fmt.Errorf("unable to decode getVideoChatStreams#1fb1fac5: %w", err)
}
case "group_call_id":
value, err := b.Int32()
if err != nil {
return fmt.Errorf("unable to decode getVideoChatStreams#1fb1fac5: field group_call_id: %w", err)
}
g.GroupCallID = value
default:
return b.Skip()
}
return nil
})
}
// GetGroupCallID returns value of GroupCallID field.
func (g *GetVideoChatStreamsRequest) GetGroupCallID() (value int32) {
if g == nil {
return
}
return g.GroupCallID
}
// GetVideoChatStreams invokes method getVideoChatStreams#1fb1fac5 returning error if any.
func (c *Client) GetVideoChatStreams(ctx context.Context, groupcallid int32) (*VideoChatStreams, error) {
var result VideoChatStreams
request := &GetVideoChatStreamsRequest{
GroupCallID: groupcallid,
}
if err := c.rpc.Invoke(ctx, request, &result); err != nil {
return nil, err
}
return &result, nil
}