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

262 lines
5.9 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{}
)
// VideoChatStream represents TL type `videoChatStream#bb5a57dc`.
type VideoChatStream struct {
// Identifier of an audio/video channel
ChannelID int32
// Scale of segment durations in the stream. The duration is 1000/(2**scale) milliseconds
Scale int32
// Point in time when the stream currently ends; Unix timestamp in milliseconds
TimeOffset int64
}
// VideoChatStreamTypeID is TL type id of VideoChatStream.
const VideoChatStreamTypeID = 0xbb5a57dc
// Ensuring interfaces in compile-time for VideoChatStream.
var (
_ bin.Encoder = &VideoChatStream{}
_ bin.Decoder = &VideoChatStream{}
_ bin.BareEncoder = &VideoChatStream{}
_ bin.BareDecoder = &VideoChatStream{}
)
func (v *VideoChatStream) Zero() bool {
if v == nil {
return true
}
if !(v.ChannelID == 0) {
return false
}
if !(v.Scale == 0) {
return false
}
if !(v.TimeOffset == 0) {
return false
}
return true
}
// String implements fmt.Stringer.
func (v *VideoChatStream) String() string {
if v == nil {
return "VideoChatStream(nil)"
}
type Alias VideoChatStream
return fmt.Sprintf("VideoChatStream%+v", Alias(*v))
}
// TypeID returns type id in TL schema.
//
// See https://core.telegram.org/mtproto/TL-tl#remarks.
func (*VideoChatStream) TypeID() uint32 {
return VideoChatStreamTypeID
}
// TypeName returns name of type in TL schema.
func (*VideoChatStream) TypeName() string {
return "videoChatStream"
}
// TypeInfo returns info about TL type.
func (v *VideoChatStream) TypeInfo() tdp.Type {
typ := tdp.Type{
Name: "videoChatStream",
ID: VideoChatStreamTypeID,
}
if v == nil {
typ.Null = true
return typ
}
typ.Fields = []tdp.Field{
{
Name: "ChannelID",
SchemaName: "channel_id",
},
{
Name: "Scale",
SchemaName: "scale",
},
{
Name: "TimeOffset",
SchemaName: "time_offset",
},
}
return typ
}
// Encode implements bin.Encoder.
func (v *VideoChatStream) Encode(b *bin.Buffer) error {
if v == nil {
return fmt.Errorf("can't encode videoChatStream#bb5a57dc as nil")
}
b.PutID(VideoChatStreamTypeID)
return v.EncodeBare(b)
}
// EncodeBare implements bin.BareEncoder.
func (v *VideoChatStream) EncodeBare(b *bin.Buffer) error {
if v == nil {
return fmt.Errorf("can't encode videoChatStream#bb5a57dc as nil")
}
b.PutInt32(v.ChannelID)
b.PutInt32(v.Scale)
b.PutInt53(v.TimeOffset)
return nil
}
// Decode implements bin.Decoder.
func (v *VideoChatStream) Decode(b *bin.Buffer) error {
if v == nil {
return fmt.Errorf("can't decode videoChatStream#bb5a57dc to nil")
}
if err := b.ConsumeID(VideoChatStreamTypeID); err != nil {
return fmt.Errorf("unable to decode videoChatStream#bb5a57dc: %w", err)
}
return v.DecodeBare(b)
}
// DecodeBare implements bin.BareDecoder.
func (v *VideoChatStream) DecodeBare(b *bin.Buffer) error {
if v == nil {
return fmt.Errorf("can't decode videoChatStream#bb5a57dc to nil")
}
{
value, err := b.Int32()
if err != nil {
return fmt.Errorf("unable to decode videoChatStream#bb5a57dc: field channel_id: %w", err)
}
v.ChannelID = value
}
{
value, err := b.Int32()
if err != nil {
return fmt.Errorf("unable to decode videoChatStream#bb5a57dc: field scale: %w", err)
}
v.Scale = value
}
{
value, err := b.Int53()
if err != nil {
return fmt.Errorf("unable to decode videoChatStream#bb5a57dc: field time_offset: %w", err)
}
v.TimeOffset = value
}
return nil
}
// EncodeTDLibJSON implements tdjson.TDLibEncoder.
func (v *VideoChatStream) EncodeTDLibJSON(b tdjson.Encoder) error {
if v == nil {
return fmt.Errorf("can't encode videoChatStream#bb5a57dc as nil")
}
b.ObjStart()
b.PutID("videoChatStream")
b.Comma()
b.FieldStart("channel_id")
b.PutInt32(v.ChannelID)
b.Comma()
b.FieldStart("scale")
b.PutInt32(v.Scale)
b.Comma()
b.FieldStart("time_offset")
b.PutInt53(v.TimeOffset)
b.Comma()
b.StripComma()
b.ObjEnd()
return nil
}
// DecodeTDLibJSON implements tdjson.TDLibDecoder.
func (v *VideoChatStream) DecodeTDLibJSON(b tdjson.Decoder) error {
if v == nil {
return fmt.Errorf("can't decode videoChatStream#bb5a57dc to nil")
}
return b.Obj(func(b tdjson.Decoder, key []byte) error {
switch string(key) {
case tdjson.TypeField:
if err := b.ConsumeID("videoChatStream"); err != nil {
return fmt.Errorf("unable to decode videoChatStream#bb5a57dc: %w", err)
}
case "channel_id":
value, err := b.Int32()
if err != nil {
return fmt.Errorf("unable to decode videoChatStream#bb5a57dc: field channel_id: %w", err)
}
v.ChannelID = value
case "scale":
value, err := b.Int32()
if err != nil {
return fmt.Errorf("unable to decode videoChatStream#bb5a57dc: field scale: %w", err)
}
v.Scale = value
case "time_offset":
value, err := b.Int53()
if err != nil {
return fmt.Errorf("unable to decode videoChatStream#bb5a57dc: field time_offset: %w", err)
}
v.TimeOffset = value
default:
return b.Skip()
}
return nil
})
}
// GetChannelID returns value of ChannelID field.
func (v *VideoChatStream) GetChannelID() (value int32) {
if v == nil {
return
}
return v.ChannelID
}
// GetScale returns value of Scale field.
func (v *VideoChatStream) GetScale() (value int32) {
if v == nil {
return
}
return v.Scale
}
// GetTimeOffset returns value of TimeOffset field.
func (v *VideoChatStream) GetTimeOffset() (value int64) {
if v == nil {
return
}
return v.TimeOffset
}