move gotd fork into repo. (#111)
- 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
This commit is contained in:
@@ -0,0 +1,453 @@
|
||||
// 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{}
|
||||
)
|
||||
|
||||
// MessagesGetUnreadReactionsRequest represents TL type `messages.getUnreadReactions#bd7f90ac`.
|
||||
// Get unread reactions to messages you sent
|
||||
//
|
||||
// See https://core.telegram.org/method/messages.getUnreadReactions for reference.
|
||||
type MessagesGetUnreadReactionsRequest struct {
|
||||
// Flags, see TL conditional fields¹
|
||||
//
|
||||
// Links:
|
||||
// 1) https://core.telegram.org/mtproto/TL-combinators#conditional-fields
|
||||
Flags bin.Fields
|
||||
// Peer
|
||||
Peer InputPeerClass
|
||||
// If set, considers only reactions to messages within the specified forum topic¹
|
||||
//
|
||||
// Links:
|
||||
// 1) https://core.telegram.org/api/forum#forum-topics
|
||||
//
|
||||
// Use SetTopMsgID and GetTopMsgID helpers.
|
||||
TopMsgID int
|
||||
// SavedPeerID field of MessagesGetUnreadReactionsRequest.
|
||||
//
|
||||
// Use SetSavedPeerID and GetSavedPeerID helpers.
|
||||
SavedPeerID InputPeerClass
|
||||
// Offsets for pagination, for more info click here¹
|
||||
//
|
||||
// Links:
|
||||
// 1) https://core.telegram.org/api/offsets
|
||||
OffsetID int
|
||||
// Offsets for pagination, for more info click here¹
|
||||
//
|
||||
// Links:
|
||||
// 1) https://core.telegram.org/api/offsets
|
||||
AddOffset int
|
||||
// Maximum number of results to return, see pagination¹
|
||||
//
|
||||
// Links:
|
||||
// 1) https://core.telegram.org/api/offsets
|
||||
Limit int
|
||||
// Only return reactions for messages up until this message ID
|
||||
MaxID int
|
||||
// Only return reactions for messages starting from this message ID
|
||||
MinID int
|
||||
}
|
||||
|
||||
// MessagesGetUnreadReactionsRequestTypeID is TL type id of MessagesGetUnreadReactionsRequest.
|
||||
const MessagesGetUnreadReactionsRequestTypeID = 0xbd7f90ac
|
||||
|
||||
// Ensuring interfaces in compile-time for MessagesGetUnreadReactionsRequest.
|
||||
var (
|
||||
_ bin.Encoder = &MessagesGetUnreadReactionsRequest{}
|
||||
_ bin.Decoder = &MessagesGetUnreadReactionsRequest{}
|
||||
_ bin.BareEncoder = &MessagesGetUnreadReactionsRequest{}
|
||||
_ bin.BareDecoder = &MessagesGetUnreadReactionsRequest{}
|
||||
)
|
||||
|
||||
func (g *MessagesGetUnreadReactionsRequest) Zero() bool {
|
||||
if g == nil {
|
||||
return true
|
||||
}
|
||||
if !(g.Flags.Zero()) {
|
||||
return false
|
||||
}
|
||||
if !(g.Peer == nil) {
|
||||
return false
|
||||
}
|
||||
if !(g.TopMsgID == 0) {
|
||||
return false
|
||||
}
|
||||
if !(g.SavedPeerID == nil) {
|
||||
return false
|
||||
}
|
||||
if !(g.OffsetID == 0) {
|
||||
return false
|
||||
}
|
||||
if !(g.AddOffset == 0) {
|
||||
return false
|
||||
}
|
||||
if !(g.Limit == 0) {
|
||||
return false
|
||||
}
|
||||
if !(g.MaxID == 0) {
|
||||
return false
|
||||
}
|
||||
if !(g.MinID == 0) {
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
// String implements fmt.Stringer.
|
||||
func (g *MessagesGetUnreadReactionsRequest) String() string {
|
||||
if g == nil {
|
||||
return "MessagesGetUnreadReactionsRequest(nil)"
|
||||
}
|
||||
type Alias MessagesGetUnreadReactionsRequest
|
||||
return fmt.Sprintf("MessagesGetUnreadReactionsRequest%+v", Alias(*g))
|
||||
}
|
||||
|
||||
// FillFrom fills MessagesGetUnreadReactionsRequest from given interface.
|
||||
func (g *MessagesGetUnreadReactionsRequest) FillFrom(from interface {
|
||||
GetPeer() (value InputPeerClass)
|
||||
GetTopMsgID() (value int, ok bool)
|
||||
GetSavedPeerID() (value InputPeerClass, ok bool)
|
||||
GetOffsetID() (value int)
|
||||
GetAddOffset() (value int)
|
||||
GetLimit() (value int)
|
||||
GetMaxID() (value int)
|
||||
GetMinID() (value int)
|
||||
}) {
|
||||
g.Peer = from.GetPeer()
|
||||
if val, ok := from.GetTopMsgID(); ok {
|
||||
g.TopMsgID = val
|
||||
}
|
||||
|
||||
if val, ok := from.GetSavedPeerID(); ok {
|
||||
g.SavedPeerID = val
|
||||
}
|
||||
|
||||
g.OffsetID = from.GetOffsetID()
|
||||
g.AddOffset = from.GetAddOffset()
|
||||
g.Limit = from.GetLimit()
|
||||
g.MaxID = from.GetMaxID()
|
||||
g.MinID = from.GetMinID()
|
||||
}
|
||||
|
||||
// TypeID returns type id in TL schema.
|
||||
//
|
||||
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
||||
func (*MessagesGetUnreadReactionsRequest) TypeID() uint32 {
|
||||
return MessagesGetUnreadReactionsRequestTypeID
|
||||
}
|
||||
|
||||
// TypeName returns name of type in TL schema.
|
||||
func (*MessagesGetUnreadReactionsRequest) TypeName() string {
|
||||
return "messages.getUnreadReactions"
|
||||
}
|
||||
|
||||
// TypeInfo returns info about TL type.
|
||||
func (g *MessagesGetUnreadReactionsRequest) TypeInfo() tdp.Type {
|
||||
typ := tdp.Type{
|
||||
Name: "messages.getUnreadReactions",
|
||||
ID: MessagesGetUnreadReactionsRequestTypeID,
|
||||
}
|
||||
if g == nil {
|
||||
typ.Null = true
|
||||
return typ
|
||||
}
|
||||
typ.Fields = []tdp.Field{
|
||||
{
|
||||
Name: "Peer",
|
||||
SchemaName: "peer",
|
||||
},
|
||||
{
|
||||
Name: "TopMsgID",
|
||||
SchemaName: "top_msg_id",
|
||||
Null: !g.Flags.Has(0),
|
||||
},
|
||||
{
|
||||
Name: "SavedPeerID",
|
||||
SchemaName: "saved_peer_id",
|
||||
Null: !g.Flags.Has(1),
|
||||
},
|
||||
{
|
||||
Name: "OffsetID",
|
||||
SchemaName: "offset_id",
|
||||
},
|
||||
{
|
||||
Name: "AddOffset",
|
||||
SchemaName: "add_offset",
|
||||
},
|
||||
{
|
||||
Name: "Limit",
|
||||
SchemaName: "limit",
|
||||
},
|
||||
{
|
||||
Name: "MaxID",
|
||||
SchemaName: "max_id",
|
||||
},
|
||||
{
|
||||
Name: "MinID",
|
||||
SchemaName: "min_id",
|
||||
},
|
||||
}
|
||||
return typ
|
||||
}
|
||||
|
||||
// SetFlags sets flags for non-zero fields.
|
||||
func (g *MessagesGetUnreadReactionsRequest) SetFlags() {
|
||||
if !(g.TopMsgID == 0) {
|
||||
g.Flags.Set(0)
|
||||
}
|
||||
if !(g.SavedPeerID == nil) {
|
||||
g.Flags.Set(1)
|
||||
}
|
||||
}
|
||||
|
||||
// Encode implements bin.Encoder.
|
||||
func (g *MessagesGetUnreadReactionsRequest) Encode(b *bin.Buffer) error {
|
||||
if g == nil {
|
||||
return fmt.Errorf("can't encode messages.getUnreadReactions#bd7f90ac as nil")
|
||||
}
|
||||
b.PutID(MessagesGetUnreadReactionsRequestTypeID)
|
||||
return g.EncodeBare(b)
|
||||
}
|
||||
|
||||
// EncodeBare implements bin.BareEncoder.
|
||||
func (g *MessagesGetUnreadReactionsRequest) EncodeBare(b *bin.Buffer) error {
|
||||
if g == nil {
|
||||
return fmt.Errorf("can't encode messages.getUnreadReactions#bd7f90ac as nil")
|
||||
}
|
||||
g.SetFlags()
|
||||
if err := g.Flags.Encode(b); err != nil {
|
||||
return fmt.Errorf("unable to encode messages.getUnreadReactions#bd7f90ac: field flags: %w", err)
|
||||
}
|
||||
if g.Peer == nil {
|
||||
return fmt.Errorf("unable to encode messages.getUnreadReactions#bd7f90ac: field peer is nil")
|
||||
}
|
||||
if err := g.Peer.Encode(b); err != nil {
|
||||
return fmt.Errorf("unable to encode messages.getUnreadReactions#bd7f90ac: field peer: %w", err)
|
||||
}
|
||||
if g.Flags.Has(0) {
|
||||
b.PutInt(g.TopMsgID)
|
||||
}
|
||||
if g.Flags.Has(1) {
|
||||
if g.SavedPeerID == nil {
|
||||
return fmt.Errorf("unable to encode messages.getUnreadReactions#bd7f90ac: field saved_peer_id is nil")
|
||||
}
|
||||
if err := g.SavedPeerID.Encode(b); err != nil {
|
||||
return fmt.Errorf("unable to encode messages.getUnreadReactions#bd7f90ac: field saved_peer_id: %w", err)
|
||||
}
|
||||
}
|
||||
b.PutInt(g.OffsetID)
|
||||
b.PutInt(g.AddOffset)
|
||||
b.PutInt(g.Limit)
|
||||
b.PutInt(g.MaxID)
|
||||
b.PutInt(g.MinID)
|
||||
return nil
|
||||
}
|
||||
|
||||
// Decode implements bin.Decoder.
|
||||
func (g *MessagesGetUnreadReactionsRequest) Decode(b *bin.Buffer) error {
|
||||
if g == nil {
|
||||
return fmt.Errorf("can't decode messages.getUnreadReactions#bd7f90ac to nil")
|
||||
}
|
||||
if err := b.ConsumeID(MessagesGetUnreadReactionsRequestTypeID); err != nil {
|
||||
return fmt.Errorf("unable to decode messages.getUnreadReactions#bd7f90ac: %w", err)
|
||||
}
|
||||
return g.DecodeBare(b)
|
||||
}
|
||||
|
||||
// DecodeBare implements bin.BareDecoder.
|
||||
func (g *MessagesGetUnreadReactionsRequest) DecodeBare(b *bin.Buffer) error {
|
||||
if g == nil {
|
||||
return fmt.Errorf("can't decode messages.getUnreadReactions#bd7f90ac to nil")
|
||||
}
|
||||
{
|
||||
if err := g.Flags.Decode(b); err != nil {
|
||||
return fmt.Errorf("unable to decode messages.getUnreadReactions#bd7f90ac: field flags: %w", err)
|
||||
}
|
||||
}
|
||||
{
|
||||
value, err := DecodeInputPeer(b)
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode messages.getUnreadReactions#bd7f90ac: field peer: %w", err)
|
||||
}
|
||||
g.Peer = value
|
||||
}
|
||||
if g.Flags.Has(0) {
|
||||
value, err := b.Int()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode messages.getUnreadReactions#bd7f90ac: field top_msg_id: %w", err)
|
||||
}
|
||||
g.TopMsgID = value
|
||||
}
|
||||
if g.Flags.Has(1) {
|
||||
value, err := DecodeInputPeer(b)
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode messages.getUnreadReactions#bd7f90ac: field saved_peer_id: %w", err)
|
||||
}
|
||||
g.SavedPeerID = value
|
||||
}
|
||||
{
|
||||
value, err := b.Int()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode messages.getUnreadReactions#bd7f90ac: field offset_id: %w", err)
|
||||
}
|
||||
g.OffsetID = value
|
||||
}
|
||||
{
|
||||
value, err := b.Int()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode messages.getUnreadReactions#bd7f90ac: field add_offset: %w", err)
|
||||
}
|
||||
g.AddOffset = value
|
||||
}
|
||||
{
|
||||
value, err := b.Int()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode messages.getUnreadReactions#bd7f90ac: field limit: %w", err)
|
||||
}
|
||||
g.Limit = value
|
||||
}
|
||||
{
|
||||
value, err := b.Int()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode messages.getUnreadReactions#bd7f90ac: field max_id: %w", err)
|
||||
}
|
||||
g.MaxID = value
|
||||
}
|
||||
{
|
||||
value, err := b.Int()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode messages.getUnreadReactions#bd7f90ac: field min_id: %w", err)
|
||||
}
|
||||
g.MinID = value
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// GetPeer returns value of Peer field.
|
||||
func (g *MessagesGetUnreadReactionsRequest) GetPeer() (value InputPeerClass) {
|
||||
if g == nil {
|
||||
return
|
||||
}
|
||||
return g.Peer
|
||||
}
|
||||
|
||||
// SetTopMsgID sets value of TopMsgID conditional field.
|
||||
func (g *MessagesGetUnreadReactionsRequest) SetTopMsgID(value int) {
|
||||
g.Flags.Set(0)
|
||||
g.TopMsgID = value
|
||||
}
|
||||
|
||||
// GetTopMsgID returns value of TopMsgID conditional field and
|
||||
// boolean which is true if field was set.
|
||||
func (g *MessagesGetUnreadReactionsRequest) GetTopMsgID() (value int, ok bool) {
|
||||
if g == nil {
|
||||
return
|
||||
}
|
||||
if !g.Flags.Has(0) {
|
||||
return value, false
|
||||
}
|
||||
return g.TopMsgID, true
|
||||
}
|
||||
|
||||
// SetSavedPeerID sets value of SavedPeerID conditional field.
|
||||
func (g *MessagesGetUnreadReactionsRequest) SetSavedPeerID(value InputPeerClass) {
|
||||
g.Flags.Set(1)
|
||||
g.SavedPeerID = value
|
||||
}
|
||||
|
||||
// GetSavedPeerID returns value of SavedPeerID conditional field and
|
||||
// boolean which is true if field was set.
|
||||
func (g *MessagesGetUnreadReactionsRequest) GetSavedPeerID() (value InputPeerClass, ok bool) {
|
||||
if g == nil {
|
||||
return
|
||||
}
|
||||
if !g.Flags.Has(1) {
|
||||
return value, false
|
||||
}
|
||||
return g.SavedPeerID, true
|
||||
}
|
||||
|
||||
// GetOffsetID returns value of OffsetID field.
|
||||
func (g *MessagesGetUnreadReactionsRequest) GetOffsetID() (value int) {
|
||||
if g == nil {
|
||||
return
|
||||
}
|
||||
return g.OffsetID
|
||||
}
|
||||
|
||||
// GetAddOffset returns value of AddOffset field.
|
||||
func (g *MessagesGetUnreadReactionsRequest) GetAddOffset() (value int) {
|
||||
if g == nil {
|
||||
return
|
||||
}
|
||||
return g.AddOffset
|
||||
}
|
||||
|
||||
// GetLimit returns value of Limit field.
|
||||
func (g *MessagesGetUnreadReactionsRequest) GetLimit() (value int) {
|
||||
if g == nil {
|
||||
return
|
||||
}
|
||||
return g.Limit
|
||||
}
|
||||
|
||||
// GetMaxID returns value of MaxID field.
|
||||
func (g *MessagesGetUnreadReactionsRequest) GetMaxID() (value int) {
|
||||
if g == nil {
|
||||
return
|
||||
}
|
||||
return g.MaxID
|
||||
}
|
||||
|
||||
// GetMinID returns value of MinID field.
|
||||
func (g *MessagesGetUnreadReactionsRequest) GetMinID() (value int) {
|
||||
if g == nil {
|
||||
return
|
||||
}
|
||||
return g.MinID
|
||||
}
|
||||
|
||||
// MessagesGetUnreadReactions invokes method messages.getUnreadReactions#bd7f90ac returning error if any.
|
||||
// Get unread reactions to messages you sent
|
||||
//
|
||||
// Possible errors:
|
||||
//
|
||||
// 400 PEER_ID_INVALID: The provided peer id is invalid.
|
||||
//
|
||||
// See https://core.telegram.org/method/messages.getUnreadReactions for reference.
|
||||
func (c *Client) MessagesGetUnreadReactions(ctx context.Context, request *MessagesGetUnreadReactionsRequest) (MessagesMessagesClass, error) {
|
||||
var result MessagesMessagesBox
|
||||
|
||||
if err := c.rpc.Invoke(ctx, request, &result); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return result.Messages, nil
|
||||
}
|
||||
Reference in New Issue
Block a user