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,206 @@
|
||||
// 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{}
|
||||
)
|
||||
|
||||
// DeleteAllCallMessagesRequest represents TL type `deleteAllCallMessages#a897d1f3`.
|
||||
type DeleteAllCallMessagesRequest struct {
|
||||
// Pass true to delete the messages for all users
|
||||
Revoke bool
|
||||
}
|
||||
|
||||
// DeleteAllCallMessagesRequestTypeID is TL type id of DeleteAllCallMessagesRequest.
|
||||
const DeleteAllCallMessagesRequestTypeID = 0xa897d1f3
|
||||
|
||||
// Ensuring interfaces in compile-time for DeleteAllCallMessagesRequest.
|
||||
var (
|
||||
_ bin.Encoder = &DeleteAllCallMessagesRequest{}
|
||||
_ bin.Decoder = &DeleteAllCallMessagesRequest{}
|
||||
_ bin.BareEncoder = &DeleteAllCallMessagesRequest{}
|
||||
_ bin.BareDecoder = &DeleteAllCallMessagesRequest{}
|
||||
)
|
||||
|
||||
func (d *DeleteAllCallMessagesRequest) Zero() bool {
|
||||
if d == nil {
|
||||
return true
|
||||
}
|
||||
if !(d.Revoke == false) {
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
// String implements fmt.Stringer.
|
||||
func (d *DeleteAllCallMessagesRequest) String() string {
|
||||
if d == nil {
|
||||
return "DeleteAllCallMessagesRequest(nil)"
|
||||
}
|
||||
type Alias DeleteAllCallMessagesRequest
|
||||
return fmt.Sprintf("DeleteAllCallMessagesRequest%+v", Alias(*d))
|
||||
}
|
||||
|
||||
// TypeID returns type id in TL schema.
|
||||
//
|
||||
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
||||
func (*DeleteAllCallMessagesRequest) TypeID() uint32 {
|
||||
return DeleteAllCallMessagesRequestTypeID
|
||||
}
|
||||
|
||||
// TypeName returns name of type in TL schema.
|
||||
func (*DeleteAllCallMessagesRequest) TypeName() string {
|
||||
return "deleteAllCallMessages"
|
||||
}
|
||||
|
||||
// TypeInfo returns info about TL type.
|
||||
func (d *DeleteAllCallMessagesRequest) TypeInfo() tdp.Type {
|
||||
typ := tdp.Type{
|
||||
Name: "deleteAllCallMessages",
|
||||
ID: DeleteAllCallMessagesRequestTypeID,
|
||||
}
|
||||
if d == nil {
|
||||
typ.Null = true
|
||||
return typ
|
||||
}
|
||||
typ.Fields = []tdp.Field{
|
||||
{
|
||||
Name: "Revoke",
|
||||
SchemaName: "revoke",
|
||||
},
|
||||
}
|
||||
return typ
|
||||
}
|
||||
|
||||
// Encode implements bin.Encoder.
|
||||
func (d *DeleteAllCallMessagesRequest) Encode(b *bin.Buffer) error {
|
||||
if d == nil {
|
||||
return fmt.Errorf("can't encode deleteAllCallMessages#a897d1f3 as nil")
|
||||
}
|
||||
b.PutID(DeleteAllCallMessagesRequestTypeID)
|
||||
return d.EncodeBare(b)
|
||||
}
|
||||
|
||||
// EncodeBare implements bin.BareEncoder.
|
||||
func (d *DeleteAllCallMessagesRequest) EncodeBare(b *bin.Buffer) error {
|
||||
if d == nil {
|
||||
return fmt.Errorf("can't encode deleteAllCallMessages#a897d1f3 as nil")
|
||||
}
|
||||
b.PutBool(d.Revoke)
|
||||
return nil
|
||||
}
|
||||
|
||||
// Decode implements bin.Decoder.
|
||||
func (d *DeleteAllCallMessagesRequest) Decode(b *bin.Buffer) error {
|
||||
if d == nil {
|
||||
return fmt.Errorf("can't decode deleteAllCallMessages#a897d1f3 to nil")
|
||||
}
|
||||
if err := b.ConsumeID(DeleteAllCallMessagesRequestTypeID); err != nil {
|
||||
return fmt.Errorf("unable to decode deleteAllCallMessages#a897d1f3: %w", err)
|
||||
}
|
||||
return d.DecodeBare(b)
|
||||
}
|
||||
|
||||
// DecodeBare implements bin.BareDecoder.
|
||||
func (d *DeleteAllCallMessagesRequest) DecodeBare(b *bin.Buffer) error {
|
||||
if d == nil {
|
||||
return fmt.Errorf("can't decode deleteAllCallMessages#a897d1f3 to nil")
|
||||
}
|
||||
{
|
||||
value, err := b.Bool()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode deleteAllCallMessages#a897d1f3: field revoke: %w", err)
|
||||
}
|
||||
d.Revoke = value
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// EncodeTDLibJSON implements tdjson.TDLibEncoder.
|
||||
func (d *DeleteAllCallMessagesRequest) EncodeTDLibJSON(b tdjson.Encoder) error {
|
||||
if d == nil {
|
||||
return fmt.Errorf("can't encode deleteAllCallMessages#a897d1f3 as nil")
|
||||
}
|
||||
b.ObjStart()
|
||||
b.PutID("deleteAllCallMessages")
|
||||
b.Comma()
|
||||
b.FieldStart("revoke")
|
||||
b.PutBool(d.Revoke)
|
||||
b.Comma()
|
||||
b.StripComma()
|
||||
b.ObjEnd()
|
||||
return nil
|
||||
}
|
||||
|
||||
// DecodeTDLibJSON implements tdjson.TDLibDecoder.
|
||||
func (d *DeleteAllCallMessagesRequest) DecodeTDLibJSON(b tdjson.Decoder) error {
|
||||
if d == nil {
|
||||
return fmt.Errorf("can't decode deleteAllCallMessages#a897d1f3 to nil")
|
||||
}
|
||||
|
||||
return b.Obj(func(b tdjson.Decoder, key []byte) error {
|
||||
switch string(key) {
|
||||
case tdjson.TypeField:
|
||||
if err := b.ConsumeID("deleteAllCallMessages"); err != nil {
|
||||
return fmt.Errorf("unable to decode deleteAllCallMessages#a897d1f3: %w", err)
|
||||
}
|
||||
case "revoke":
|
||||
value, err := b.Bool()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode deleteAllCallMessages#a897d1f3: field revoke: %w", err)
|
||||
}
|
||||
d.Revoke = value
|
||||
default:
|
||||
return b.Skip()
|
||||
}
|
||||
return nil
|
||||
})
|
||||
}
|
||||
|
||||
// GetRevoke returns value of Revoke field.
|
||||
func (d *DeleteAllCallMessagesRequest) GetRevoke() (value bool) {
|
||||
if d == nil {
|
||||
return
|
||||
}
|
||||
return d.Revoke
|
||||
}
|
||||
|
||||
// DeleteAllCallMessages invokes method deleteAllCallMessages#a897d1f3 returning error if any.
|
||||
func (c *Client) DeleteAllCallMessages(ctx context.Context, revoke bool) error {
|
||||
var ok Ok
|
||||
|
||||
request := &DeleteAllCallMessagesRequest{
|
||||
Revoke: revoke,
|
||||
}
|
||||
if err := c.rpc.Invoke(ctx, request, &ok); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
Reference in New Issue
Block a user