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
216 lines
5.2 KiB
Go
Generated
216 lines
5.2 KiB
Go
Generated
// Code generated by gotdgen, DO NOT EDIT.
|
|
|
|
package tg
|
|
|
|
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{}
|
|
)
|
|
|
|
// PhoneGetGroupCallRequest represents TL type `phone.getGroupCall#41845db`.
|
|
// Get info about a group call
|
|
//
|
|
// See https://core.telegram.org/method/phone.getGroupCall for reference.
|
|
type PhoneGetGroupCallRequest struct {
|
|
// The group call
|
|
Call InputGroupCallClass
|
|
// Maximum number of results to return, see pagination¹
|
|
//
|
|
// Links:
|
|
// 1) https://core.telegram.org/api/offsets
|
|
Limit int
|
|
}
|
|
|
|
// PhoneGetGroupCallRequestTypeID is TL type id of PhoneGetGroupCallRequest.
|
|
const PhoneGetGroupCallRequestTypeID = 0x41845db
|
|
|
|
// Ensuring interfaces in compile-time for PhoneGetGroupCallRequest.
|
|
var (
|
|
_ bin.Encoder = &PhoneGetGroupCallRequest{}
|
|
_ bin.Decoder = &PhoneGetGroupCallRequest{}
|
|
_ bin.BareEncoder = &PhoneGetGroupCallRequest{}
|
|
_ bin.BareDecoder = &PhoneGetGroupCallRequest{}
|
|
)
|
|
|
|
func (g *PhoneGetGroupCallRequest) Zero() bool {
|
|
if g == nil {
|
|
return true
|
|
}
|
|
if !(g.Call == nil) {
|
|
return false
|
|
}
|
|
if !(g.Limit == 0) {
|
|
return false
|
|
}
|
|
|
|
return true
|
|
}
|
|
|
|
// String implements fmt.Stringer.
|
|
func (g *PhoneGetGroupCallRequest) String() string {
|
|
if g == nil {
|
|
return "PhoneGetGroupCallRequest(nil)"
|
|
}
|
|
type Alias PhoneGetGroupCallRequest
|
|
return fmt.Sprintf("PhoneGetGroupCallRequest%+v", Alias(*g))
|
|
}
|
|
|
|
// FillFrom fills PhoneGetGroupCallRequest from given interface.
|
|
func (g *PhoneGetGroupCallRequest) FillFrom(from interface {
|
|
GetCall() (value InputGroupCallClass)
|
|
GetLimit() (value int)
|
|
}) {
|
|
g.Call = from.GetCall()
|
|
g.Limit = from.GetLimit()
|
|
}
|
|
|
|
// TypeID returns type id in TL schema.
|
|
//
|
|
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
|
func (*PhoneGetGroupCallRequest) TypeID() uint32 {
|
|
return PhoneGetGroupCallRequestTypeID
|
|
}
|
|
|
|
// TypeName returns name of type in TL schema.
|
|
func (*PhoneGetGroupCallRequest) TypeName() string {
|
|
return "phone.getGroupCall"
|
|
}
|
|
|
|
// TypeInfo returns info about TL type.
|
|
func (g *PhoneGetGroupCallRequest) TypeInfo() tdp.Type {
|
|
typ := tdp.Type{
|
|
Name: "phone.getGroupCall",
|
|
ID: PhoneGetGroupCallRequestTypeID,
|
|
}
|
|
if g == nil {
|
|
typ.Null = true
|
|
return typ
|
|
}
|
|
typ.Fields = []tdp.Field{
|
|
{
|
|
Name: "Call",
|
|
SchemaName: "call",
|
|
},
|
|
{
|
|
Name: "Limit",
|
|
SchemaName: "limit",
|
|
},
|
|
}
|
|
return typ
|
|
}
|
|
|
|
// Encode implements bin.Encoder.
|
|
func (g *PhoneGetGroupCallRequest) Encode(b *bin.Buffer) error {
|
|
if g == nil {
|
|
return fmt.Errorf("can't encode phone.getGroupCall#41845db as nil")
|
|
}
|
|
b.PutID(PhoneGetGroupCallRequestTypeID)
|
|
return g.EncodeBare(b)
|
|
}
|
|
|
|
// EncodeBare implements bin.BareEncoder.
|
|
func (g *PhoneGetGroupCallRequest) EncodeBare(b *bin.Buffer) error {
|
|
if g == nil {
|
|
return fmt.Errorf("can't encode phone.getGroupCall#41845db as nil")
|
|
}
|
|
if g.Call == nil {
|
|
return fmt.Errorf("unable to encode phone.getGroupCall#41845db: field call is nil")
|
|
}
|
|
if err := g.Call.Encode(b); err != nil {
|
|
return fmt.Errorf("unable to encode phone.getGroupCall#41845db: field call: %w", err)
|
|
}
|
|
b.PutInt(g.Limit)
|
|
return nil
|
|
}
|
|
|
|
// Decode implements bin.Decoder.
|
|
func (g *PhoneGetGroupCallRequest) Decode(b *bin.Buffer) error {
|
|
if g == nil {
|
|
return fmt.Errorf("can't decode phone.getGroupCall#41845db to nil")
|
|
}
|
|
if err := b.ConsumeID(PhoneGetGroupCallRequestTypeID); err != nil {
|
|
return fmt.Errorf("unable to decode phone.getGroupCall#41845db: %w", err)
|
|
}
|
|
return g.DecodeBare(b)
|
|
}
|
|
|
|
// DecodeBare implements bin.BareDecoder.
|
|
func (g *PhoneGetGroupCallRequest) DecodeBare(b *bin.Buffer) error {
|
|
if g == nil {
|
|
return fmt.Errorf("can't decode phone.getGroupCall#41845db to nil")
|
|
}
|
|
{
|
|
value, err := DecodeInputGroupCall(b)
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode phone.getGroupCall#41845db: field call: %w", err)
|
|
}
|
|
g.Call = value
|
|
}
|
|
{
|
|
value, err := b.Int()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode phone.getGroupCall#41845db: field limit: %w", err)
|
|
}
|
|
g.Limit = value
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// GetCall returns value of Call field.
|
|
func (g *PhoneGetGroupCallRequest) GetCall() (value InputGroupCallClass) {
|
|
if g == nil {
|
|
return
|
|
}
|
|
return g.Call
|
|
}
|
|
|
|
// GetLimit returns value of Limit field.
|
|
func (g *PhoneGetGroupCallRequest) GetLimit() (value int) {
|
|
if g == nil {
|
|
return
|
|
}
|
|
return g.Limit
|
|
}
|
|
|
|
// PhoneGetGroupCall invokes method phone.getGroupCall#41845db returning error if any.
|
|
// Get info about a group call
|
|
//
|
|
// Possible errors:
|
|
//
|
|
// 403 GROUPCALL_FORBIDDEN: The group call has already ended.
|
|
// 400 GROUPCALL_INVALID: The specified group call is invalid.
|
|
//
|
|
// See https://core.telegram.org/method/phone.getGroupCall for reference.
|
|
func (c *Client) PhoneGetGroupCall(ctx context.Context, request *PhoneGetGroupCallRequest) (*PhoneGroupCall, error) {
|
|
var result PhoneGroupCall
|
|
|
|
if err := c.rpc.Invoke(ctx, request, &result); err != nil {
|
|
return nil, err
|
|
}
|
|
return &result, nil
|
|
}
|