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

787 lines
22 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{}
)
// GroupCallParticipant represents TL type `groupCallParticipant#7abca1eb`.
type GroupCallParticipant struct {
// Identifier of the group call participant
ParticipantID MessageSenderClass
// User's audio channel synchronization source identifier
AudioSourceID int32
// User's screen sharing audio channel synchronization source identifier
ScreenSharingAudioSourceID int32
// Information about user's video channel; may be null if there is no active video
VideoInfo GroupCallParticipantVideoInfo
// Information about user's screen sharing video channel; may be null if there is no
// active screen sharing video
ScreenSharingVideoInfo GroupCallParticipantVideoInfo
// The participant user's bio or the participant chat's description
Bio string
// True, if the participant is the current user
IsCurrentUser bool
// True, if the participant is speaking as set by setGroupCallParticipantIsSpeaking
IsSpeaking bool
// True, if the participant hand is raised
IsHandRaised bool
// True, if the current user can mute the participant for all other group call
// participants
CanBeMutedForAllUsers bool
// True, if the current user can allow the participant to unmute themselves or unmute the
// participant (if the participant is the current user)
CanBeUnmutedForAllUsers bool
// True, if the current user can mute the participant only for self
CanBeMutedForCurrentUser bool
// True, if the current user can unmute the participant for self
CanBeUnmutedForCurrentUser bool
// True, if the participant is muted for all users
IsMutedForAllUsers bool
// True, if the participant is muted for the current user
IsMutedForCurrentUser bool
// True, if the participant is muted for all users, but can unmute themselves
CanUnmuteSelf bool
// Participant's volume level; 1-20000 in hundreds of percents
VolumeLevel int32
// User's order in the group call participant list. Orders must be compared
// lexicographically. The bigger is order, the higher is user in the list. If order is
// empty, the user must be removed from the participant list
Order string
}
// GroupCallParticipantTypeID is TL type id of GroupCallParticipant.
const GroupCallParticipantTypeID = 0x7abca1eb
// Ensuring interfaces in compile-time for GroupCallParticipant.
var (
_ bin.Encoder = &GroupCallParticipant{}
_ bin.Decoder = &GroupCallParticipant{}
_ bin.BareEncoder = &GroupCallParticipant{}
_ bin.BareDecoder = &GroupCallParticipant{}
)
func (g *GroupCallParticipant) Zero() bool {
if g == nil {
return true
}
if !(g.ParticipantID == nil) {
return false
}
if !(g.AudioSourceID == 0) {
return false
}
if !(g.ScreenSharingAudioSourceID == 0) {
return false
}
if !(g.VideoInfo.Zero()) {
return false
}
if !(g.ScreenSharingVideoInfo.Zero()) {
return false
}
if !(g.Bio == "") {
return false
}
if !(g.IsCurrentUser == false) {
return false
}
if !(g.IsSpeaking == false) {
return false
}
if !(g.IsHandRaised == false) {
return false
}
if !(g.CanBeMutedForAllUsers == false) {
return false
}
if !(g.CanBeUnmutedForAllUsers == false) {
return false
}
if !(g.CanBeMutedForCurrentUser == false) {
return false
}
if !(g.CanBeUnmutedForCurrentUser == false) {
return false
}
if !(g.IsMutedForAllUsers == false) {
return false
}
if !(g.IsMutedForCurrentUser == false) {
return false
}
if !(g.CanUnmuteSelf == false) {
return false
}
if !(g.VolumeLevel == 0) {
return false
}
if !(g.Order == "") {
return false
}
return true
}
// String implements fmt.Stringer.
func (g *GroupCallParticipant) String() string {
if g == nil {
return "GroupCallParticipant(nil)"
}
type Alias GroupCallParticipant
return fmt.Sprintf("GroupCallParticipant%+v", Alias(*g))
}
// TypeID returns type id in TL schema.
//
// See https://core.telegram.org/mtproto/TL-tl#remarks.
func (*GroupCallParticipant) TypeID() uint32 {
return GroupCallParticipantTypeID
}
// TypeName returns name of type in TL schema.
func (*GroupCallParticipant) TypeName() string {
return "groupCallParticipant"
}
// TypeInfo returns info about TL type.
func (g *GroupCallParticipant) TypeInfo() tdp.Type {
typ := tdp.Type{
Name: "groupCallParticipant",
ID: GroupCallParticipantTypeID,
}
if g == nil {
typ.Null = true
return typ
}
typ.Fields = []tdp.Field{
{
Name: "ParticipantID",
SchemaName: "participant_id",
},
{
Name: "AudioSourceID",
SchemaName: "audio_source_id",
},
{
Name: "ScreenSharingAudioSourceID",
SchemaName: "screen_sharing_audio_source_id",
},
{
Name: "VideoInfo",
SchemaName: "video_info",
},
{
Name: "ScreenSharingVideoInfo",
SchemaName: "screen_sharing_video_info",
},
{
Name: "Bio",
SchemaName: "bio",
},
{
Name: "IsCurrentUser",
SchemaName: "is_current_user",
},
{
Name: "IsSpeaking",
SchemaName: "is_speaking",
},
{
Name: "IsHandRaised",
SchemaName: "is_hand_raised",
},
{
Name: "CanBeMutedForAllUsers",
SchemaName: "can_be_muted_for_all_users",
},
{
Name: "CanBeUnmutedForAllUsers",
SchemaName: "can_be_unmuted_for_all_users",
},
{
Name: "CanBeMutedForCurrentUser",
SchemaName: "can_be_muted_for_current_user",
},
{
Name: "CanBeUnmutedForCurrentUser",
SchemaName: "can_be_unmuted_for_current_user",
},
{
Name: "IsMutedForAllUsers",
SchemaName: "is_muted_for_all_users",
},
{
Name: "IsMutedForCurrentUser",
SchemaName: "is_muted_for_current_user",
},
{
Name: "CanUnmuteSelf",
SchemaName: "can_unmute_self",
},
{
Name: "VolumeLevel",
SchemaName: "volume_level",
},
{
Name: "Order",
SchemaName: "order",
},
}
return typ
}
// Encode implements bin.Encoder.
func (g *GroupCallParticipant) Encode(b *bin.Buffer) error {
if g == nil {
return fmt.Errorf("can't encode groupCallParticipant#7abca1eb as nil")
}
b.PutID(GroupCallParticipantTypeID)
return g.EncodeBare(b)
}
// EncodeBare implements bin.BareEncoder.
func (g *GroupCallParticipant) EncodeBare(b *bin.Buffer) error {
if g == nil {
return fmt.Errorf("can't encode groupCallParticipant#7abca1eb as nil")
}
if g.ParticipantID == nil {
return fmt.Errorf("unable to encode groupCallParticipant#7abca1eb: field participant_id is nil")
}
if err := g.ParticipantID.Encode(b); err != nil {
return fmt.Errorf("unable to encode groupCallParticipant#7abca1eb: field participant_id: %w", err)
}
b.PutInt32(g.AudioSourceID)
b.PutInt32(g.ScreenSharingAudioSourceID)
if err := g.VideoInfo.Encode(b); err != nil {
return fmt.Errorf("unable to encode groupCallParticipant#7abca1eb: field video_info: %w", err)
}
if err := g.ScreenSharingVideoInfo.Encode(b); err != nil {
return fmt.Errorf("unable to encode groupCallParticipant#7abca1eb: field screen_sharing_video_info: %w", err)
}
b.PutString(g.Bio)
b.PutBool(g.IsCurrentUser)
b.PutBool(g.IsSpeaking)
b.PutBool(g.IsHandRaised)
b.PutBool(g.CanBeMutedForAllUsers)
b.PutBool(g.CanBeUnmutedForAllUsers)
b.PutBool(g.CanBeMutedForCurrentUser)
b.PutBool(g.CanBeUnmutedForCurrentUser)
b.PutBool(g.IsMutedForAllUsers)
b.PutBool(g.IsMutedForCurrentUser)
b.PutBool(g.CanUnmuteSelf)
b.PutInt32(g.VolumeLevel)
b.PutString(g.Order)
return nil
}
// Decode implements bin.Decoder.
func (g *GroupCallParticipant) Decode(b *bin.Buffer) error {
if g == nil {
return fmt.Errorf("can't decode groupCallParticipant#7abca1eb to nil")
}
if err := b.ConsumeID(GroupCallParticipantTypeID); err != nil {
return fmt.Errorf("unable to decode groupCallParticipant#7abca1eb: %w", err)
}
return g.DecodeBare(b)
}
// DecodeBare implements bin.BareDecoder.
func (g *GroupCallParticipant) DecodeBare(b *bin.Buffer) error {
if g == nil {
return fmt.Errorf("can't decode groupCallParticipant#7abca1eb to nil")
}
{
value, err := DecodeMessageSender(b)
if err != nil {
return fmt.Errorf("unable to decode groupCallParticipant#7abca1eb: field participant_id: %w", err)
}
g.ParticipantID = value
}
{
value, err := b.Int32()
if err != nil {
return fmt.Errorf("unable to decode groupCallParticipant#7abca1eb: field audio_source_id: %w", err)
}
g.AudioSourceID = value
}
{
value, err := b.Int32()
if err != nil {
return fmt.Errorf("unable to decode groupCallParticipant#7abca1eb: field screen_sharing_audio_source_id: %w", err)
}
g.ScreenSharingAudioSourceID = value
}
{
if err := g.VideoInfo.Decode(b); err != nil {
return fmt.Errorf("unable to decode groupCallParticipant#7abca1eb: field video_info: %w", err)
}
}
{
if err := g.ScreenSharingVideoInfo.Decode(b); err != nil {
return fmt.Errorf("unable to decode groupCallParticipant#7abca1eb: field screen_sharing_video_info: %w", err)
}
}
{
value, err := b.String()
if err != nil {
return fmt.Errorf("unable to decode groupCallParticipant#7abca1eb: field bio: %w", err)
}
g.Bio = value
}
{
value, err := b.Bool()
if err != nil {
return fmt.Errorf("unable to decode groupCallParticipant#7abca1eb: field is_current_user: %w", err)
}
g.IsCurrentUser = value
}
{
value, err := b.Bool()
if err != nil {
return fmt.Errorf("unable to decode groupCallParticipant#7abca1eb: field is_speaking: %w", err)
}
g.IsSpeaking = value
}
{
value, err := b.Bool()
if err != nil {
return fmt.Errorf("unable to decode groupCallParticipant#7abca1eb: field is_hand_raised: %w", err)
}
g.IsHandRaised = value
}
{
value, err := b.Bool()
if err != nil {
return fmt.Errorf("unable to decode groupCallParticipant#7abca1eb: field can_be_muted_for_all_users: %w", err)
}
g.CanBeMutedForAllUsers = value
}
{
value, err := b.Bool()
if err != nil {
return fmt.Errorf("unable to decode groupCallParticipant#7abca1eb: field can_be_unmuted_for_all_users: %w", err)
}
g.CanBeUnmutedForAllUsers = value
}
{
value, err := b.Bool()
if err != nil {
return fmt.Errorf("unable to decode groupCallParticipant#7abca1eb: field can_be_muted_for_current_user: %w", err)
}
g.CanBeMutedForCurrentUser = value
}
{
value, err := b.Bool()
if err != nil {
return fmt.Errorf("unable to decode groupCallParticipant#7abca1eb: field can_be_unmuted_for_current_user: %w", err)
}
g.CanBeUnmutedForCurrentUser = value
}
{
value, err := b.Bool()
if err != nil {
return fmt.Errorf("unable to decode groupCallParticipant#7abca1eb: field is_muted_for_all_users: %w", err)
}
g.IsMutedForAllUsers = value
}
{
value, err := b.Bool()
if err != nil {
return fmt.Errorf("unable to decode groupCallParticipant#7abca1eb: field is_muted_for_current_user: %w", err)
}
g.IsMutedForCurrentUser = value
}
{
value, err := b.Bool()
if err != nil {
return fmt.Errorf("unable to decode groupCallParticipant#7abca1eb: field can_unmute_self: %w", err)
}
g.CanUnmuteSelf = value
}
{
value, err := b.Int32()
if err != nil {
return fmt.Errorf("unable to decode groupCallParticipant#7abca1eb: field volume_level: %w", err)
}
g.VolumeLevel = value
}
{
value, err := b.String()
if err != nil {
return fmt.Errorf("unable to decode groupCallParticipant#7abca1eb: field order: %w", err)
}
g.Order = value
}
return nil
}
// EncodeTDLibJSON implements tdjson.TDLibEncoder.
func (g *GroupCallParticipant) EncodeTDLibJSON(b tdjson.Encoder) error {
if g == nil {
return fmt.Errorf("can't encode groupCallParticipant#7abca1eb as nil")
}
b.ObjStart()
b.PutID("groupCallParticipant")
b.Comma()
b.FieldStart("participant_id")
if g.ParticipantID == nil {
return fmt.Errorf("unable to encode groupCallParticipant#7abca1eb: field participant_id is nil")
}
if err := g.ParticipantID.EncodeTDLibJSON(b); err != nil {
return fmt.Errorf("unable to encode groupCallParticipant#7abca1eb: field participant_id: %w", err)
}
b.Comma()
b.FieldStart("audio_source_id")
b.PutInt32(g.AudioSourceID)
b.Comma()
b.FieldStart("screen_sharing_audio_source_id")
b.PutInt32(g.ScreenSharingAudioSourceID)
b.Comma()
b.FieldStart("video_info")
if err := g.VideoInfo.EncodeTDLibJSON(b); err != nil {
return fmt.Errorf("unable to encode groupCallParticipant#7abca1eb: field video_info: %w", err)
}
b.Comma()
b.FieldStart("screen_sharing_video_info")
if err := g.ScreenSharingVideoInfo.EncodeTDLibJSON(b); err != nil {
return fmt.Errorf("unable to encode groupCallParticipant#7abca1eb: field screen_sharing_video_info: %w", err)
}
b.Comma()
b.FieldStart("bio")
b.PutString(g.Bio)
b.Comma()
b.FieldStart("is_current_user")
b.PutBool(g.IsCurrentUser)
b.Comma()
b.FieldStart("is_speaking")
b.PutBool(g.IsSpeaking)
b.Comma()
b.FieldStart("is_hand_raised")
b.PutBool(g.IsHandRaised)
b.Comma()
b.FieldStart("can_be_muted_for_all_users")
b.PutBool(g.CanBeMutedForAllUsers)
b.Comma()
b.FieldStart("can_be_unmuted_for_all_users")
b.PutBool(g.CanBeUnmutedForAllUsers)
b.Comma()
b.FieldStart("can_be_muted_for_current_user")
b.PutBool(g.CanBeMutedForCurrentUser)
b.Comma()
b.FieldStart("can_be_unmuted_for_current_user")
b.PutBool(g.CanBeUnmutedForCurrentUser)
b.Comma()
b.FieldStart("is_muted_for_all_users")
b.PutBool(g.IsMutedForAllUsers)
b.Comma()
b.FieldStart("is_muted_for_current_user")
b.PutBool(g.IsMutedForCurrentUser)
b.Comma()
b.FieldStart("can_unmute_self")
b.PutBool(g.CanUnmuteSelf)
b.Comma()
b.FieldStart("volume_level")
b.PutInt32(g.VolumeLevel)
b.Comma()
b.FieldStart("order")
b.PutString(g.Order)
b.Comma()
b.StripComma()
b.ObjEnd()
return nil
}
// DecodeTDLibJSON implements tdjson.TDLibDecoder.
func (g *GroupCallParticipant) DecodeTDLibJSON(b tdjson.Decoder) error {
if g == nil {
return fmt.Errorf("can't decode groupCallParticipant#7abca1eb to nil")
}
return b.Obj(func(b tdjson.Decoder, key []byte) error {
switch string(key) {
case tdjson.TypeField:
if err := b.ConsumeID("groupCallParticipant"); err != nil {
return fmt.Errorf("unable to decode groupCallParticipant#7abca1eb: %w", err)
}
case "participant_id":
value, err := DecodeTDLibJSONMessageSender(b)
if err != nil {
return fmt.Errorf("unable to decode groupCallParticipant#7abca1eb: field participant_id: %w", err)
}
g.ParticipantID = value
case "audio_source_id":
value, err := b.Int32()
if err != nil {
return fmt.Errorf("unable to decode groupCallParticipant#7abca1eb: field audio_source_id: %w", err)
}
g.AudioSourceID = value
case "screen_sharing_audio_source_id":
value, err := b.Int32()
if err != nil {
return fmt.Errorf("unable to decode groupCallParticipant#7abca1eb: field screen_sharing_audio_source_id: %w", err)
}
g.ScreenSharingAudioSourceID = value
case "video_info":
if err := g.VideoInfo.DecodeTDLibJSON(b); err != nil {
return fmt.Errorf("unable to decode groupCallParticipant#7abca1eb: field video_info: %w", err)
}
case "screen_sharing_video_info":
if err := g.ScreenSharingVideoInfo.DecodeTDLibJSON(b); err != nil {
return fmt.Errorf("unable to decode groupCallParticipant#7abca1eb: field screen_sharing_video_info: %w", err)
}
case "bio":
value, err := b.String()
if err != nil {
return fmt.Errorf("unable to decode groupCallParticipant#7abca1eb: field bio: %w", err)
}
g.Bio = value
case "is_current_user":
value, err := b.Bool()
if err != nil {
return fmt.Errorf("unable to decode groupCallParticipant#7abca1eb: field is_current_user: %w", err)
}
g.IsCurrentUser = value
case "is_speaking":
value, err := b.Bool()
if err != nil {
return fmt.Errorf("unable to decode groupCallParticipant#7abca1eb: field is_speaking: %w", err)
}
g.IsSpeaking = value
case "is_hand_raised":
value, err := b.Bool()
if err != nil {
return fmt.Errorf("unable to decode groupCallParticipant#7abca1eb: field is_hand_raised: %w", err)
}
g.IsHandRaised = value
case "can_be_muted_for_all_users":
value, err := b.Bool()
if err != nil {
return fmt.Errorf("unable to decode groupCallParticipant#7abca1eb: field can_be_muted_for_all_users: %w", err)
}
g.CanBeMutedForAllUsers = value
case "can_be_unmuted_for_all_users":
value, err := b.Bool()
if err != nil {
return fmt.Errorf("unable to decode groupCallParticipant#7abca1eb: field can_be_unmuted_for_all_users: %w", err)
}
g.CanBeUnmutedForAllUsers = value
case "can_be_muted_for_current_user":
value, err := b.Bool()
if err != nil {
return fmt.Errorf("unable to decode groupCallParticipant#7abca1eb: field can_be_muted_for_current_user: %w", err)
}
g.CanBeMutedForCurrentUser = value
case "can_be_unmuted_for_current_user":
value, err := b.Bool()
if err != nil {
return fmt.Errorf("unable to decode groupCallParticipant#7abca1eb: field can_be_unmuted_for_current_user: %w", err)
}
g.CanBeUnmutedForCurrentUser = value
case "is_muted_for_all_users":
value, err := b.Bool()
if err != nil {
return fmt.Errorf("unable to decode groupCallParticipant#7abca1eb: field is_muted_for_all_users: %w", err)
}
g.IsMutedForAllUsers = value
case "is_muted_for_current_user":
value, err := b.Bool()
if err != nil {
return fmt.Errorf("unable to decode groupCallParticipant#7abca1eb: field is_muted_for_current_user: %w", err)
}
g.IsMutedForCurrentUser = value
case "can_unmute_self":
value, err := b.Bool()
if err != nil {
return fmt.Errorf("unable to decode groupCallParticipant#7abca1eb: field can_unmute_self: %w", err)
}
g.CanUnmuteSelf = value
case "volume_level":
value, err := b.Int32()
if err != nil {
return fmt.Errorf("unable to decode groupCallParticipant#7abca1eb: field volume_level: %w", err)
}
g.VolumeLevel = value
case "order":
value, err := b.String()
if err != nil {
return fmt.Errorf("unable to decode groupCallParticipant#7abca1eb: field order: %w", err)
}
g.Order = value
default:
return b.Skip()
}
return nil
})
}
// GetParticipantID returns value of ParticipantID field.
func (g *GroupCallParticipant) GetParticipantID() (value MessageSenderClass) {
if g == nil {
return
}
return g.ParticipantID
}
// GetAudioSourceID returns value of AudioSourceID field.
func (g *GroupCallParticipant) GetAudioSourceID() (value int32) {
if g == nil {
return
}
return g.AudioSourceID
}
// GetScreenSharingAudioSourceID returns value of ScreenSharingAudioSourceID field.
func (g *GroupCallParticipant) GetScreenSharingAudioSourceID() (value int32) {
if g == nil {
return
}
return g.ScreenSharingAudioSourceID
}
// GetVideoInfo returns value of VideoInfo field.
func (g *GroupCallParticipant) GetVideoInfo() (value GroupCallParticipantVideoInfo) {
if g == nil {
return
}
return g.VideoInfo
}
// GetScreenSharingVideoInfo returns value of ScreenSharingVideoInfo field.
func (g *GroupCallParticipant) GetScreenSharingVideoInfo() (value GroupCallParticipantVideoInfo) {
if g == nil {
return
}
return g.ScreenSharingVideoInfo
}
// GetBio returns value of Bio field.
func (g *GroupCallParticipant) GetBio() (value string) {
if g == nil {
return
}
return g.Bio
}
// GetIsCurrentUser returns value of IsCurrentUser field.
func (g *GroupCallParticipant) GetIsCurrentUser() (value bool) {
if g == nil {
return
}
return g.IsCurrentUser
}
// GetIsSpeaking returns value of IsSpeaking field.
func (g *GroupCallParticipant) GetIsSpeaking() (value bool) {
if g == nil {
return
}
return g.IsSpeaking
}
// GetIsHandRaised returns value of IsHandRaised field.
func (g *GroupCallParticipant) GetIsHandRaised() (value bool) {
if g == nil {
return
}
return g.IsHandRaised
}
// GetCanBeMutedForAllUsers returns value of CanBeMutedForAllUsers field.
func (g *GroupCallParticipant) GetCanBeMutedForAllUsers() (value bool) {
if g == nil {
return
}
return g.CanBeMutedForAllUsers
}
// GetCanBeUnmutedForAllUsers returns value of CanBeUnmutedForAllUsers field.
func (g *GroupCallParticipant) GetCanBeUnmutedForAllUsers() (value bool) {
if g == nil {
return
}
return g.CanBeUnmutedForAllUsers
}
// GetCanBeMutedForCurrentUser returns value of CanBeMutedForCurrentUser field.
func (g *GroupCallParticipant) GetCanBeMutedForCurrentUser() (value bool) {
if g == nil {
return
}
return g.CanBeMutedForCurrentUser
}
// GetCanBeUnmutedForCurrentUser returns value of CanBeUnmutedForCurrentUser field.
func (g *GroupCallParticipant) GetCanBeUnmutedForCurrentUser() (value bool) {
if g == nil {
return
}
return g.CanBeUnmutedForCurrentUser
}
// GetIsMutedForAllUsers returns value of IsMutedForAllUsers field.
func (g *GroupCallParticipant) GetIsMutedForAllUsers() (value bool) {
if g == nil {
return
}
return g.IsMutedForAllUsers
}
// GetIsMutedForCurrentUser returns value of IsMutedForCurrentUser field.
func (g *GroupCallParticipant) GetIsMutedForCurrentUser() (value bool) {
if g == nil {
return
}
return g.IsMutedForCurrentUser
}
// GetCanUnmuteSelf returns value of CanUnmuteSelf field.
func (g *GroupCallParticipant) GetCanUnmuteSelf() (value bool) {
if g == nil {
return
}
return g.CanUnmuteSelf
}
// GetVolumeLevel returns value of VolumeLevel field.
func (g *GroupCallParticipant) GetVolumeLevel() (value int32) {
if g == nil {
return
}
return g.VolumeLevel
}
// GetOrder returns value of Order field.
func (g *GroupCallParticipant) GetOrder() (value string) {
if g == nil {
return
}
return g.Order
}