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
213 lines
6.0 KiB
Go
213 lines
6.0 KiB
Go
// 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{}
|
|
)
|
|
|
|
// ChannelsGetFullChannelRequest represents TL type `channels.getFullChannel#8736a09`.
|
|
// Get full info about a supergroup¹, gigagroup² or channel³
|
|
//
|
|
// Links:
|
|
// 1. https://core.telegram.org/api/channel#supergroups
|
|
// 2. https://core.telegram.org/api/channel#gigagroups
|
|
// 3. https://core.telegram.org/api/channel#channels
|
|
//
|
|
// See https://core.telegram.org/method/channels.getFullChannel for reference.
|
|
type ChannelsGetFullChannelRequest struct {
|
|
// The channel¹, supergroup² or gigagroup³ to get info about
|
|
//
|
|
// Links:
|
|
// 1) https://core.telegram.org/api/channel#channels
|
|
// 2) https://core.telegram.org/api/channel#supergroups
|
|
// 3) https://core.telegram.org/api/channel#gigagroups
|
|
Channel InputChannelClass
|
|
}
|
|
|
|
// ChannelsGetFullChannelRequestTypeID is TL type id of ChannelsGetFullChannelRequest.
|
|
const ChannelsGetFullChannelRequestTypeID = 0x8736a09
|
|
|
|
// Ensuring interfaces in compile-time for ChannelsGetFullChannelRequest.
|
|
var (
|
|
_ bin.Encoder = &ChannelsGetFullChannelRequest{}
|
|
_ bin.Decoder = &ChannelsGetFullChannelRequest{}
|
|
_ bin.BareEncoder = &ChannelsGetFullChannelRequest{}
|
|
_ bin.BareDecoder = &ChannelsGetFullChannelRequest{}
|
|
)
|
|
|
|
func (g *ChannelsGetFullChannelRequest) Zero() bool {
|
|
if g == nil {
|
|
return true
|
|
}
|
|
if !(g.Channel == nil) {
|
|
return false
|
|
}
|
|
|
|
return true
|
|
}
|
|
|
|
// String implements fmt.Stringer.
|
|
func (g *ChannelsGetFullChannelRequest) String() string {
|
|
if g == nil {
|
|
return "ChannelsGetFullChannelRequest(nil)"
|
|
}
|
|
type Alias ChannelsGetFullChannelRequest
|
|
return fmt.Sprintf("ChannelsGetFullChannelRequest%+v", Alias(*g))
|
|
}
|
|
|
|
// FillFrom fills ChannelsGetFullChannelRequest from given interface.
|
|
func (g *ChannelsGetFullChannelRequest) FillFrom(from interface {
|
|
GetChannel() (value InputChannelClass)
|
|
}) {
|
|
g.Channel = from.GetChannel()
|
|
}
|
|
|
|
// TypeID returns type id in TL schema.
|
|
//
|
|
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
|
func (*ChannelsGetFullChannelRequest) TypeID() uint32 {
|
|
return ChannelsGetFullChannelRequestTypeID
|
|
}
|
|
|
|
// TypeName returns name of type in TL schema.
|
|
func (*ChannelsGetFullChannelRequest) TypeName() string {
|
|
return "channels.getFullChannel"
|
|
}
|
|
|
|
// TypeInfo returns info about TL type.
|
|
func (g *ChannelsGetFullChannelRequest) TypeInfo() tdp.Type {
|
|
typ := tdp.Type{
|
|
Name: "channels.getFullChannel",
|
|
ID: ChannelsGetFullChannelRequestTypeID,
|
|
}
|
|
if g == nil {
|
|
typ.Null = true
|
|
return typ
|
|
}
|
|
typ.Fields = []tdp.Field{
|
|
{
|
|
Name: "Channel",
|
|
SchemaName: "channel",
|
|
},
|
|
}
|
|
return typ
|
|
}
|
|
|
|
// Encode implements bin.Encoder.
|
|
func (g *ChannelsGetFullChannelRequest) Encode(b *bin.Buffer) error {
|
|
if g == nil {
|
|
return fmt.Errorf("can't encode channels.getFullChannel#8736a09 as nil")
|
|
}
|
|
b.PutID(ChannelsGetFullChannelRequestTypeID)
|
|
return g.EncodeBare(b)
|
|
}
|
|
|
|
// EncodeBare implements bin.BareEncoder.
|
|
func (g *ChannelsGetFullChannelRequest) EncodeBare(b *bin.Buffer) error {
|
|
if g == nil {
|
|
return fmt.Errorf("can't encode channels.getFullChannel#8736a09 as nil")
|
|
}
|
|
if g.Channel == nil {
|
|
return fmt.Errorf("unable to encode channels.getFullChannel#8736a09: field channel is nil")
|
|
}
|
|
if err := g.Channel.Encode(b); err != nil {
|
|
return fmt.Errorf("unable to encode channels.getFullChannel#8736a09: field channel: %w", err)
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// Decode implements bin.Decoder.
|
|
func (g *ChannelsGetFullChannelRequest) Decode(b *bin.Buffer) error {
|
|
if g == nil {
|
|
return fmt.Errorf("can't decode channels.getFullChannel#8736a09 to nil")
|
|
}
|
|
if err := b.ConsumeID(ChannelsGetFullChannelRequestTypeID); err != nil {
|
|
return fmt.Errorf("unable to decode channels.getFullChannel#8736a09: %w", err)
|
|
}
|
|
return g.DecodeBare(b)
|
|
}
|
|
|
|
// DecodeBare implements bin.BareDecoder.
|
|
func (g *ChannelsGetFullChannelRequest) DecodeBare(b *bin.Buffer) error {
|
|
if g == nil {
|
|
return fmt.Errorf("can't decode channels.getFullChannel#8736a09 to nil")
|
|
}
|
|
{
|
|
value, err := DecodeInputChannel(b)
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode channels.getFullChannel#8736a09: field channel: %w", err)
|
|
}
|
|
g.Channel = value
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// GetChannel returns value of Channel field.
|
|
func (g *ChannelsGetFullChannelRequest) GetChannel() (value InputChannelClass) {
|
|
if g == nil {
|
|
return
|
|
}
|
|
return g.Channel
|
|
}
|
|
|
|
// GetChannelAsNotEmpty returns mapped value of Channel field.
|
|
func (g *ChannelsGetFullChannelRequest) GetChannelAsNotEmpty() (NotEmptyInputChannel, bool) {
|
|
return g.Channel.AsNotEmpty()
|
|
}
|
|
|
|
// ChannelsGetFullChannel invokes method channels.getFullChannel#8736a09 returning error if any.
|
|
// Get full info about a supergroup¹, gigagroup² or channel³
|
|
//
|
|
// Links:
|
|
// 1. https://core.telegram.org/api/channel#supergroups
|
|
// 2. https://core.telegram.org/api/channel#gigagroups
|
|
// 3. https://core.telegram.org/api/channel#channels
|
|
//
|
|
// Possible errors:
|
|
//
|
|
// 400 CHANNEL_INVALID: The provided channel is invalid.
|
|
// 406 CHANNEL_PRIVATE: You haven't joined this channel/supergroup.
|
|
// 403 CHANNEL_PUBLIC_GROUP_NA: channel/supergroup not available.
|
|
// 400 CHAT_NOT_MODIFIED: No changes were made to chat information because the new information you passed is identical to the current information.
|
|
// 400 MSG_ID_INVALID: Invalid message ID provided.
|
|
//
|
|
// See https://core.telegram.org/method/channels.getFullChannel for reference.
|
|
// Can be used by bots.
|
|
func (c *Client) ChannelsGetFullChannel(ctx context.Context, channel InputChannelClass) (*MessagesChatFull, error) {
|
|
var result MessagesChatFull
|
|
|
|
request := &ChannelsGetFullChannelRequest{
|
|
Channel: channel,
|
|
}
|
|
if err := c.rpc.Invoke(ctx, request, &result); err != nil {
|
|
return nil, err
|
|
}
|
|
return &result, nil
|
|
}
|