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,262 @@
|
||||
// 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{}
|
||||
)
|
||||
|
||||
// ReportSupergroupSpamRequest represents TL type `reportSupergroupSpam#383e26f2`.
|
||||
type ReportSupergroupSpamRequest struct {
|
||||
// Supergroup identifier
|
||||
SupergroupID int64
|
||||
// Identifiers of messages to report. Use messageProperties.can_report_supergroup_spam to
|
||||
// check whether the message can be reported
|
||||
MessageIDs []int64
|
||||
}
|
||||
|
||||
// ReportSupergroupSpamRequestTypeID is TL type id of ReportSupergroupSpamRequest.
|
||||
const ReportSupergroupSpamRequestTypeID = 0x383e26f2
|
||||
|
||||
// Ensuring interfaces in compile-time for ReportSupergroupSpamRequest.
|
||||
var (
|
||||
_ bin.Encoder = &ReportSupergroupSpamRequest{}
|
||||
_ bin.Decoder = &ReportSupergroupSpamRequest{}
|
||||
_ bin.BareEncoder = &ReportSupergroupSpamRequest{}
|
||||
_ bin.BareDecoder = &ReportSupergroupSpamRequest{}
|
||||
)
|
||||
|
||||
func (r *ReportSupergroupSpamRequest) Zero() bool {
|
||||
if r == nil {
|
||||
return true
|
||||
}
|
||||
if !(r.SupergroupID == 0) {
|
||||
return false
|
||||
}
|
||||
if !(r.MessageIDs == nil) {
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
// String implements fmt.Stringer.
|
||||
func (r *ReportSupergroupSpamRequest) String() string {
|
||||
if r == nil {
|
||||
return "ReportSupergroupSpamRequest(nil)"
|
||||
}
|
||||
type Alias ReportSupergroupSpamRequest
|
||||
return fmt.Sprintf("ReportSupergroupSpamRequest%+v", Alias(*r))
|
||||
}
|
||||
|
||||
// TypeID returns type id in TL schema.
|
||||
//
|
||||
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
||||
func (*ReportSupergroupSpamRequest) TypeID() uint32 {
|
||||
return ReportSupergroupSpamRequestTypeID
|
||||
}
|
||||
|
||||
// TypeName returns name of type in TL schema.
|
||||
func (*ReportSupergroupSpamRequest) TypeName() string {
|
||||
return "reportSupergroupSpam"
|
||||
}
|
||||
|
||||
// TypeInfo returns info about TL type.
|
||||
func (r *ReportSupergroupSpamRequest) TypeInfo() tdp.Type {
|
||||
typ := tdp.Type{
|
||||
Name: "reportSupergroupSpam",
|
||||
ID: ReportSupergroupSpamRequestTypeID,
|
||||
}
|
||||
if r == nil {
|
||||
typ.Null = true
|
||||
return typ
|
||||
}
|
||||
typ.Fields = []tdp.Field{
|
||||
{
|
||||
Name: "SupergroupID",
|
||||
SchemaName: "supergroup_id",
|
||||
},
|
||||
{
|
||||
Name: "MessageIDs",
|
||||
SchemaName: "message_ids",
|
||||
},
|
||||
}
|
||||
return typ
|
||||
}
|
||||
|
||||
// Encode implements bin.Encoder.
|
||||
func (r *ReportSupergroupSpamRequest) Encode(b *bin.Buffer) error {
|
||||
if r == nil {
|
||||
return fmt.Errorf("can't encode reportSupergroupSpam#383e26f2 as nil")
|
||||
}
|
||||
b.PutID(ReportSupergroupSpamRequestTypeID)
|
||||
return r.EncodeBare(b)
|
||||
}
|
||||
|
||||
// EncodeBare implements bin.BareEncoder.
|
||||
func (r *ReportSupergroupSpamRequest) EncodeBare(b *bin.Buffer) error {
|
||||
if r == nil {
|
||||
return fmt.Errorf("can't encode reportSupergroupSpam#383e26f2 as nil")
|
||||
}
|
||||
b.PutInt53(r.SupergroupID)
|
||||
b.PutInt(len(r.MessageIDs))
|
||||
for _, v := range r.MessageIDs {
|
||||
b.PutInt53(v)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Decode implements bin.Decoder.
|
||||
func (r *ReportSupergroupSpamRequest) Decode(b *bin.Buffer) error {
|
||||
if r == nil {
|
||||
return fmt.Errorf("can't decode reportSupergroupSpam#383e26f2 to nil")
|
||||
}
|
||||
if err := b.ConsumeID(ReportSupergroupSpamRequestTypeID); err != nil {
|
||||
return fmt.Errorf("unable to decode reportSupergroupSpam#383e26f2: %w", err)
|
||||
}
|
||||
return r.DecodeBare(b)
|
||||
}
|
||||
|
||||
// DecodeBare implements bin.BareDecoder.
|
||||
func (r *ReportSupergroupSpamRequest) DecodeBare(b *bin.Buffer) error {
|
||||
if r == nil {
|
||||
return fmt.Errorf("can't decode reportSupergroupSpam#383e26f2 to nil")
|
||||
}
|
||||
{
|
||||
value, err := b.Int53()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode reportSupergroupSpam#383e26f2: field supergroup_id: %w", err)
|
||||
}
|
||||
r.SupergroupID = value
|
||||
}
|
||||
{
|
||||
headerLen, err := b.Int()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode reportSupergroupSpam#383e26f2: field message_ids: %w", err)
|
||||
}
|
||||
|
||||
if headerLen > 0 {
|
||||
r.MessageIDs = make([]int64, 0, headerLen%bin.PreallocateLimit)
|
||||
}
|
||||
for idx := 0; idx < headerLen; idx++ {
|
||||
value, err := b.Int53()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode reportSupergroupSpam#383e26f2: field message_ids: %w", err)
|
||||
}
|
||||
r.MessageIDs = append(r.MessageIDs, value)
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// EncodeTDLibJSON implements tdjson.TDLibEncoder.
|
||||
func (r *ReportSupergroupSpamRequest) EncodeTDLibJSON(b tdjson.Encoder) error {
|
||||
if r == nil {
|
||||
return fmt.Errorf("can't encode reportSupergroupSpam#383e26f2 as nil")
|
||||
}
|
||||
b.ObjStart()
|
||||
b.PutID("reportSupergroupSpam")
|
||||
b.Comma()
|
||||
b.FieldStart("supergroup_id")
|
||||
b.PutInt53(r.SupergroupID)
|
||||
b.Comma()
|
||||
b.FieldStart("message_ids")
|
||||
b.ArrStart()
|
||||
for _, v := range r.MessageIDs {
|
||||
b.PutInt53(v)
|
||||
b.Comma()
|
||||
}
|
||||
b.StripComma()
|
||||
b.ArrEnd()
|
||||
b.Comma()
|
||||
b.StripComma()
|
||||
b.ObjEnd()
|
||||
return nil
|
||||
}
|
||||
|
||||
// DecodeTDLibJSON implements tdjson.TDLibDecoder.
|
||||
func (r *ReportSupergroupSpamRequest) DecodeTDLibJSON(b tdjson.Decoder) error {
|
||||
if r == nil {
|
||||
return fmt.Errorf("can't decode reportSupergroupSpam#383e26f2 to nil")
|
||||
}
|
||||
|
||||
return b.Obj(func(b tdjson.Decoder, key []byte) error {
|
||||
switch string(key) {
|
||||
case tdjson.TypeField:
|
||||
if err := b.ConsumeID("reportSupergroupSpam"); err != nil {
|
||||
return fmt.Errorf("unable to decode reportSupergroupSpam#383e26f2: %w", err)
|
||||
}
|
||||
case "supergroup_id":
|
||||
value, err := b.Int53()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode reportSupergroupSpam#383e26f2: field supergroup_id: %w", err)
|
||||
}
|
||||
r.SupergroupID = value
|
||||
case "message_ids":
|
||||
if err := b.Arr(func(b tdjson.Decoder) error {
|
||||
value, err := b.Int53()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode reportSupergroupSpam#383e26f2: field message_ids: %w", err)
|
||||
}
|
||||
r.MessageIDs = append(r.MessageIDs, value)
|
||||
return nil
|
||||
}); err != nil {
|
||||
return fmt.Errorf("unable to decode reportSupergroupSpam#383e26f2: field message_ids: %w", err)
|
||||
}
|
||||
default:
|
||||
return b.Skip()
|
||||
}
|
||||
return nil
|
||||
})
|
||||
}
|
||||
|
||||
// GetSupergroupID returns value of SupergroupID field.
|
||||
func (r *ReportSupergroupSpamRequest) GetSupergroupID() (value int64) {
|
||||
if r == nil {
|
||||
return
|
||||
}
|
||||
return r.SupergroupID
|
||||
}
|
||||
|
||||
// GetMessageIDs returns value of MessageIDs field.
|
||||
func (r *ReportSupergroupSpamRequest) GetMessageIDs() (value []int64) {
|
||||
if r == nil {
|
||||
return
|
||||
}
|
||||
return r.MessageIDs
|
||||
}
|
||||
|
||||
// ReportSupergroupSpam invokes method reportSupergroupSpam#383e26f2 returning error if any.
|
||||
func (c *Client) ReportSupergroupSpam(ctx context.Context, request *ReportSupergroupSpamRequest) error {
|
||||
var ok Ok
|
||||
|
||||
if err := c.rpc.Invoke(ctx, request, &ok); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
Reference in New Issue
Block a user