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,2 @@
|
||||
// Package e2e implements MTProto encoding and decoding.
|
||||
package e2e
|
||||
@@ -0,0 +1,325 @@
|
||||
// Code generated by gotdgen, DO NOT EDIT.
|
||||
|
||||
package e2e
|
||||
|
||||
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{}
|
||||
)
|
||||
|
||||
// BoolFalse represents TL type `boolFalse#bc799737`.
|
||||
// Constructor may be interpreted as a booleanfalse value.
|
||||
//
|
||||
// See https://core.telegram.org/constructor/boolFalse for reference.
|
||||
type BoolFalse struct {
|
||||
}
|
||||
|
||||
// BoolFalseTypeID is TL type id of BoolFalse.
|
||||
const BoolFalseTypeID = 0xbc799737
|
||||
|
||||
// construct implements constructor of BoolClass.
|
||||
func (b BoolFalse) construct() BoolClass { return &b }
|
||||
|
||||
// Ensuring interfaces in compile-time for BoolFalse.
|
||||
var (
|
||||
_ bin.Encoder = &BoolFalse{}
|
||||
_ bin.Decoder = &BoolFalse{}
|
||||
_ bin.BareEncoder = &BoolFalse{}
|
||||
_ bin.BareDecoder = &BoolFalse{}
|
||||
|
||||
_ BoolClass = &BoolFalse{}
|
||||
)
|
||||
|
||||
func (b *BoolFalse) Zero() bool {
|
||||
if b == nil {
|
||||
return true
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
// String implements fmt.Stringer.
|
||||
func (b *BoolFalse) String() string {
|
||||
if b == nil {
|
||||
return "BoolFalse(nil)"
|
||||
}
|
||||
type Alias BoolFalse
|
||||
return fmt.Sprintf("BoolFalse%+v", Alias(*b))
|
||||
}
|
||||
|
||||
// TypeID returns type id in TL schema.
|
||||
//
|
||||
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
||||
func (*BoolFalse) TypeID() uint32 {
|
||||
return BoolFalseTypeID
|
||||
}
|
||||
|
||||
// TypeName returns name of type in TL schema.
|
||||
func (*BoolFalse) TypeName() string {
|
||||
return "boolFalse"
|
||||
}
|
||||
|
||||
// TypeInfo returns info about TL type.
|
||||
func (b *BoolFalse) TypeInfo() tdp.Type {
|
||||
typ := tdp.Type{
|
||||
Name: "boolFalse",
|
||||
ID: BoolFalseTypeID,
|
||||
}
|
||||
if b == nil {
|
||||
typ.Null = true
|
||||
return typ
|
||||
}
|
||||
typ.Fields = []tdp.Field{}
|
||||
return typ
|
||||
}
|
||||
|
||||
// Encode implements bin.Encoder.
|
||||
func (b *BoolFalse) Encode(buf *bin.Buffer) error {
|
||||
if b == nil {
|
||||
return fmt.Errorf("can't encode boolFalse#bc799737 as nil")
|
||||
}
|
||||
buf.PutID(BoolFalseTypeID)
|
||||
return b.EncodeBare(buf)
|
||||
}
|
||||
|
||||
// EncodeBare implements bin.BareEncoder.
|
||||
func (b *BoolFalse) EncodeBare(buf *bin.Buffer) error {
|
||||
if b == nil {
|
||||
return fmt.Errorf("can't encode boolFalse#bc799737 as nil")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Decode implements bin.Decoder.
|
||||
func (b *BoolFalse) Decode(buf *bin.Buffer) error {
|
||||
if b == nil {
|
||||
return fmt.Errorf("can't decode boolFalse#bc799737 to nil")
|
||||
}
|
||||
if err := buf.ConsumeID(BoolFalseTypeID); err != nil {
|
||||
return fmt.Errorf("unable to decode boolFalse#bc799737: %w", err)
|
||||
}
|
||||
return b.DecodeBare(buf)
|
||||
}
|
||||
|
||||
// DecodeBare implements bin.BareDecoder.
|
||||
func (b *BoolFalse) DecodeBare(buf *bin.Buffer) error {
|
||||
if b == nil {
|
||||
return fmt.Errorf("can't decode boolFalse#bc799737 to nil")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// BoolTrue represents TL type `boolTrue#997275b5`.
|
||||
// The constructor can be interpreted as a booleantrue value.
|
||||
//
|
||||
// See https://core.telegram.org/constructor/boolTrue for reference.
|
||||
type BoolTrue struct {
|
||||
}
|
||||
|
||||
// BoolTrueTypeID is TL type id of BoolTrue.
|
||||
const BoolTrueTypeID = 0x997275b5
|
||||
|
||||
// construct implements constructor of BoolClass.
|
||||
func (b BoolTrue) construct() BoolClass { return &b }
|
||||
|
||||
// Ensuring interfaces in compile-time for BoolTrue.
|
||||
var (
|
||||
_ bin.Encoder = &BoolTrue{}
|
||||
_ bin.Decoder = &BoolTrue{}
|
||||
_ bin.BareEncoder = &BoolTrue{}
|
||||
_ bin.BareDecoder = &BoolTrue{}
|
||||
|
||||
_ BoolClass = &BoolTrue{}
|
||||
)
|
||||
|
||||
func (b *BoolTrue) Zero() bool {
|
||||
if b == nil {
|
||||
return true
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
// String implements fmt.Stringer.
|
||||
func (b *BoolTrue) String() string {
|
||||
if b == nil {
|
||||
return "BoolTrue(nil)"
|
||||
}
|
||||
type Alias BoolTrue
|
||||
return fmt.Sprintf("BoolTrue%+v", Alias(*b))
|
||||
}
|
||||
|
||||
// TypeID returns type id in TL schema.
|
||||
//
|
||||
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
||||
func (*BoolTrue) TypeID() uint32 {
|
||||
return BoolTrueTypeID
|
||||
}
|
||||
|
||||
// TypeName returns name of type in TL schema.
|
||||
func (*BoolTrue) TypeName() string {
|
||||
return "boolTrue"
|
||||
}
|
||||
|
||||
// TypeInfo returns info about TL type.
|
||||
func (b *BoolTrue) TypeInfo() tdp.Type {
|
||||
typ := tdp.Type{
|
||||
Name: "boolTrue",
|
||||
ID: BoolTrueTypeID,
|
||||
}
|
||||
if b == nil {
|
||||
typ.Null = true
|
||||
return typ
|
||||
}
|
||||
typ.Fields = []tdp.Field{}
|
||||
return typ
|
||||
}
|
||||
|
||||
// Encode implements bin.Encoder.
|
||||
func (b *BoolTrue) Encode(buf *bin.Buffer) error {
|
||||
if b == nil {
|
||||
return fmt.Errorf("can't encode boolTrue#997275b5 as nil")
|
||||
}
|
||||
buf.PutID(BoolTrueTypeID)
|
||||
return b.EncodeBare(buf)
|
||||
}
|
||||
|
||||
// EncodeBare implements bin.BareEncoder.
|
||||
func (b *BoolTrue) EncodeBare(buf *bin.Buffer) error {
|
||||
if b == nil {
|
||||
return fmt.Errorf("can't encode boolTrue#997275b5 as nil")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Decode implements bin.Decoder.
|
||||
func (b *BoolTrue) Decode(buf *bin.Buffer) error {
|
||||
if b == nil {
|
||||
return fmt.Errorf("can't decode boolTrue#997275b5 to nil")
|
||||
}
|
||||
if err := buf.ConsumeID(BoolTrueTypeID); err != nil {
|
||||
return fmt.Errorf("unable to decode boolTrue#997275b5: %w", err)
|
||||
}
|
||||
return b.DecodeBare(buf)
|
||||
}
|
||||
|
||||
// DecodeBare implements bin.BareDecoder.
|
||||
func (b *BoolTrue) DecodeBare(buf *bin.Buffer) error {
|
||||
if b == nil {
|
||||
return fmt.Errorf("can't decode boolTrue#997275b5 to nil")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// BoolClassName is schema name of BoolClass.
|
||||
const BoolClassName = "Bool"
|
||||
|
||||
// BoolClass represents Bool generic type.
|
||||
//
|
||||
// See https://core.telegram.org/type/Bool for reference.
|
||||
//
|
||||
// Example:
|
||||
//
|
||||
// g, err := e2e.DecodeBool(buf)
|
||||
// if err != nil {
|
||||
// panic(err)
|
||||
// }
|
||||
// switch v := g.(type) {
|
||||
// case *e2e.BoolFalse: // boolFalse#bc799737
|
||||
// case *e2e.BoolTrue: // boolTrue#997275b5
|
||||
// default: panic(v)
|
||||
// }
|
||||
type BoolClass interface {
|
||||
bin.Encoder
|
||||
bin.Decoder
|
||||
bin.BareEncoder
|
||||
bin.BareDecoder
|
||||
construct() BoolClass
|
||||
|
||||
// TypeID returns type id in TL schema.
|
||||
//
|
||||
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
||||
TypeID() uint32
|
||||
// TypeName returns name of type in TL schema.
|
||||
TypeName() string
|
||||
// String implements fmt.Stringer.
|
||||
String() string
|
||||
// Zero returns true if current object has a zero value.
|
||||
Zero() bool
|
||||
}
|
||||
|
||||
// DecodeBool implements binary de-serialization for BoolClass.
|
||||
func DecodeBool(buf *bin.Buffer) (BoolClass, error) {
|
||||
id, err := buf.PeekID()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
switch id {
|
||||
case BoolFalseTypeID:
|
||||
// Decoding boolFalse#bc799737.
|
||||
v := BoolFalse{}
|
||||
if err := v.Decode(buf); err != nil {
|
||||
return nil, fmt.Errorf("unable to decode BoolClass: %w", err)
|
||||
}
|
||||
return &v, nil
|
||||
case BoolTrueTypeID:
|
||||
// Decoding boolTrue#997275b5.
|
||||
v := BoolTrue{}
|
||||
if err := v.Decode(buf); err != nil {
|
||||
return nil, fmt.Errorf("unable to decode BoolClass: %w", err)
|
||||
}
|
||||
return &v, nil
|
||||
default:
|
||||
return nil, fmt.Errorf("unable to decode BoolClass: %w", bin.NewUnexpectedID(id))
|
||||
}
|
||||
}
|
||||
|
||||
// Bool boxes the BoolClass providing a helper.
|
||||
type BoolBox struct {
|
||||
Bool BoolClass
|
||||
}
|
||||
|
||||
// Decode implements bin.Decoder for BoolBox.
|
||||
func (b *BoolBox) Decode(buf *bin.Buffer) error {
|
||||
if b == nil {
|
||||
return fmt.Errorf("unable to decode BoolBox to nil")
|
||||
}
|
||||
v, err := DecodeBool(buf)
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode boxed value: %w", err)
|
||||
}
|
||||
b.Bool = v
|
||||
return nil
|
||||
}
|
||||
|
||||
// Encode implements bin.Encode for BoolBox.
|
||||
func (b *BoolBox) Encode(buf *bin.Buffer) error {
|
||||
if b == nil || b.Bool == nil {
|
||||
return fmt.Errorf("unable to encode BoolClass as nil")
|
||||
}
|
||||
return b.Bool.Encode(buf)
|
||||
}
|
||||
@@ -0,0 +1,128 @@
|
||||
// Code generated by gotdgen, DO NOT EDIT.
|
||||
|
||||
package e2e
|
||||
|
||||
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{}
|
||||
)
|
||||
|
||||
// Bytes represents TL type `bytes#e937bb82`.
|
||||
//
|
||||
// See https://core.telegram.org/constructor/bytes for reference.
|
||||
type Bytes struct {
|
||||
}
|
||||
|
||||
// BytesTypeID is TL type id of Bytes.
|
||||
const BytesTypeID = 0xe937bb82
|
||||
|
||||
// Ensuring interfaces in compile-time for Bytes.
|
||||
var (
|
||||
_ bin.Encoder = &Bytes{}
|
||||
_ bin.Decoder = &Bytes{}
|
||||
_ bin.BareEncoder = &Bytes{}
|
||||
_ bin.BareDecoder = &Bytes{}
|
||||
)
|
||||
|
||||
func (b *Bytes) Zero() bool {
|
||||
if b == nil {
|
||||
return true
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
// String implements fmt.Stringer.
|
||||
func (b *Bytes) String() string {
|
||||
if b == nil {
|
||||
return "Bytes(nil)"
|
||||
}
|
||||
type Alias Bytes
|
||||
return fmt.Sprintf("Bytes%+v", Alias(*b))
|
||||
}
|
||||
|
||||
// TypeID returns type id in TL schema.
|
||||
//
|
||||
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
||||
func (*Bytes) TypeID() uint32 {
|
||||
return BytesTypeID
|
||||
}
|
||||
|
||||
// TypeName returns name of type in TL schema.
|
||||
func (*Bytes) TypeName() string {
|
||||
return "bytes"
|
||||
}
|
||||
|
||||
// TypeInfo returns info about TL type.
|
||||
func (b *Bytes) TypeInfo() tdp.Type {
|
||||
typ := tdp.Type{
|
||||
Name: "bytes",
|
||||
ID: BytesTypeID,
|
||||
}
|
||||
if b == nil {
|
||||
typ.Null = true
|
||||
return typ
|
||||
}
|
||||
typ.Fields = []tdp.Field{}
|
||||
return typ
|
||||
}
|
||||
|
||||
// Encode implements bin.Encoder.
|
||||
func (b *Bytes) Encode(buf *bin.Buffer) error {
|
||||
if b == nil {
|
||||
return fmt.Errorf("can't encode bytes#e937bb82 as nil")
|
||||
}
|
||||
buf.PutID(BytesTypeID)
|
||||
return b.EncodeBare(buf)
|
||||
}
|
||||
|
||||
// EncodeBare implements bin.BareEncoder.
|
||||
func (b *Bytes) EncodeBare(buf *bin.Buffer) error {
|
||||
if b == nil {
|
||||
return fmt.Errorf("can't encode bytes#e937bb82 as nil")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Decode implements bin.Decoder.
|
||||
func (b *Bytes) Decode(buf *bin.Buffer) error {
|
||||
if b == nil {
|
||||
return fmt.Errorf("can't decode bytes#e937bb82 to nil")
|
||||
}
|
||||
if err := buf.ConsumeID(BytesTypeID); err != nil {
|
||||
return fmt.Errorf("unable to decode bytes#e937bb82: %w", err)
|
||||
}
|
||||
return b.DecodeBare(buf)
|
||||
}
|
||||
|
||||
// DecodeBare implements bin.BareDecoder.
|
||||
func (b *Bytes) DecodeBare(buf *bin.Buffer) error {
|
||||
if b == nil {
|
||||
return fmt.Errorf("can't decode bytes#e937bb82 to nil")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
// Code generated by gotdgen, DO NOT EDIT.
|
||||
|
||||
package e2e
|
||||
|
||||
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{}
|
||||
)
|
||||
|
||||
// Invoker can invoke raw MTProto rpc calls.
|
||||
type Invoker interface {
|
||||
Invoke(ctx context.Context, input bin.Encoder, output bin.Decoder) error
|
||||
}
|
||||
|
||||
// Client implement methods for calling functions from TL schema via Invoker.
|
||||
type Client struct {
|
||||
rpc Invoker
|
||||
}
|
||||
|
||||
// Invoker returns Invoker used by this client.
|
||||
func (c *Client) Invoker() Invoker {
|
||||
return c.rpc
|
||||
}
|
||||
|
||||
// NewClient creates new Client.
|
||||
func NewClient(invoker Invoker) *Client {
|
||||
return &Client{
|
||||
rpc: invoker,
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,259 @@
|
||||
// Code generated by gotdgen, DO NOT EDIT.
|
||||
|
||||
package e2e
|
||||
|
||||
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{}
|
||||
)
|
||||
|
||||
// DecryptedMessageLayer represents TL type `decryptedMessageLayer#1be31789`.
|
||||
//
|
||||
// See https://core.telegram.org/constructor/decryptedMessageLayer for reference.
|
||||
type DecryptedMessageLayer struct {
|
||||
// RandomBytes field of DecryptedMessageLayer.
|
||||
RandomBytes []byte
|
||||
// Layer field of DecryptedMessageLayer.
|
||||
Layer int
|
||||
// InSeqNo field of DecryptedMessageLayer.
|
||||
InSeqNo int
|
||||
// OutSeqNo field of DecryptedMessageLayer.
|
||||
OutSeqNo int
|
||||
// Message field of DecryptedMessageLayer.
|
||||
Message DecryptedMessageClass
|
||||
}
|
||||
|
||||
// DecryptedMessageLayerTypeID is TL type id of DecryptedMessageLayer.
|
||||
const DecryptedMessageLayerTypeID = 0x1be31789
|
||||
|
||||
// Ensuring interfaces in compile-time for DecryptedMessageLayer.
|
||||
var (
|
||||
_ bin.Encoder = &DecryptedMessageLayer{}
|
||||
_ bin.Decoder = &DecryptedMessageLayer{}
|
||||
_ bin.BareEncoder = &DecryptedMessageLayer{}
|
||||
_ bin.BareDecoder = &DecryptedMessageLayer{}
|
||||
)
|
||||
|
||||
func (d *DecryptedMessageLayer) Zero() bool {
|
||||
if d == nil {
|
||||
return true
|
||||
}
|
||||
if !(d.RandomBytes == nil) {
|
||||
return false
|
||||
}
|
||||
if !(d.Layer == 0) {
|
||||
return false
|
||||
}
|
||||
if !(d.InSeqNo == 0) {
|
||||
return false
|
||||
}
|
||||
if !(d.OutSeqNo == 0) {
|
||||
return false
|
||||
}
|
||||
if !(d.Message == nil) {
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
// String implements fmt.Stringer.
|
||||
func (d *DecryptedMessageLayer) String() string {
|
||||
if d == nil {
|
||||
return "DecryptedMessageLayer(nil)"
|
||||
}
|
||||
type Alias DecryptedMessageLayer
|
||||
return fmt.Sprintf("DecryptedMessageLayer%+v", Alias(*d))
|
||||
}
|
||||
|
||||
// TypeID returns type id in TL schema.
|
||||
//
|
||||
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
||||
func (*DecryptedMessageLayer) TypeID() uint32 {
|
||||
return DecryptedMessageLayerTypeID
|
||||
}
|
||||
|
||||
// TypeName returns name of type in TL schema.
|
||||
func (*DecryptedMessageLayer) TypeName() string {
|
||||
return "decryptedMessageLayer"
|
||||
}
|
||||
|
||||
// TypeInfo returns info about TL type.
|
||||
func (d *DecryptedMessageLayer) TypeInfo() tdp.Type {
|
||||
typ := tdp.Type{
|
||||
Name: "decryptedMessageLayer",
|
||||
ID: DecryptedMessageLayerTypeID,
|
||||
}
|
||||
if d == nil {
|
||||
typ.Null = true
|
||||
return typ
|
||||
}
|
||||
typ.Fields = []tdp.Field{
|
||||
{
|
||||
Name: "RandomBytes",
|
||||
SchemaName: "random_bytes",
|
||||
},
|
||||
{
|
||||
Name: "Layer",
|
||||
SchemaName: "layer",
|
||||
},
|
||||
{
|
||||
Name: "InSeqNo",
|
||||
SchemaName: "in_seq_no",
|
||||
},
|
||||
{
|
||||
Name: "OutSeqNo",
|
||||
SchemaName: "out_seq_no",
|
||||
},
|
||||
{
|
||||
Name: "Message",
|
||||
SchemaName: "message",
|
||||
},
|
||||
}
|
||||
return typ
|
||||
}
|
||||
|
||||
// Encode implements bin.Encoder.
|
||||
func (d *DecryptedMessageLayer) Encode(b *bin.Buffer) error {
|
||||
if d == nil {
|
||||
return fmt.Errorf("can't encode decryptedMessageLayer#1be31789 as nil")
|
||||
}
|
||||
b.PutID(DecryptedMessageLayerTypeID)
|
||||
return d.EncodeBare(b)
|
||||
}
|
||||
|
||||
// EncodeBare implements bin.BareEncoder.
|
||||
func (d *DecryptedMessageLayer) EncodeBare(b *bin.Buffer) error {
|
||||
if d == nil {
|
||||
return fmt.Errorf("can't encode decryptedMessageLayer#1be31789 as nil")
|
||||
}
|
||||
b.PutBytes(d.RandomBytes)
|
||||
b.PutInt(d.Layer)
|
||||
b.PutInt(d.InSeqNo)
|
||||
b.PutInt(d.OutSeqNo)
|
||||
if d.Message == nil {
|
||||
return fmt.Errorf("unable to encode decryptedMessageLayer#1be31789: field message is nil")
|
||||
}
|
||||
if err := d.Message.Encode(b); err != nil {
|
||||
return fmt.Errorf("unable to encode decryptedMessageLayer#1be31789: field message: %w", err)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Decode implements bin.Decoder.
|
||||
func (d *DecryptedMessageLayer) Decode(b *bin.Buffer) error {
|
||||
if d == nil {
|
||||
return fmt.Errorf("can't decode decryptedMessageLayer#1be31789 to nil")
|
||||
}
|
||||
if err := b.ConsumeID(DecryptedMessageLayerTypeID); err != nil {
|
||||
return fmt.Errorf("unable to decode decryptedMessageLayer#1be31789: %w", err)
|
||||
}
|
||||
return d.DecodeBare(b)
|
||||
}
|
||||
|
||||
// DecodeBare implements bin.BareDecoder.
|
||||
func (d *DecryptedMessageLayer) DecodeBare(b *bin.Buffer) error {
|
||||
if d == nil {
|
||||
return fmt.Errorf("can't decode decryptedMessageLayer#1be31789 to nil")
|
||||
}
|
||||
{
|
||||
value, err := b.Bytes()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode decryptedMessageLayer#1be31789: field random_bytes: %w", err)
|
||||
}
|
||||
d.RandomBytes = value
|
||||
}
|
||||
{
|
||||
value, err := b.Int()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode decryptedMessageLayer#1be31789: field layer: %w", err)
|
||||
}
|
||||
d.Layer = value
|
||||
}
|
||||
{
|
||||
value, err := b.Int()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode decryptedMessageLayer#1be31789: field in_seq_no: %w", err)
|
||||
}
|
||||
d.InSeqNo = value
|
||||
}
|
||||
{
|
||||
value, err := b.Int()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode decryptedMessageLayer#1be31789: field out_seq_no: %w", err)
|
||||
}
|
||||
d.OutSeqNo = value
|
||||
}
|
||||
{
|
||||
value, err := DecodeDecryptedMessage(b)
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode decryptedMessageLayer#1be31789: field message: %w", err)
|
||||
}
|
||||
d.Message = value
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// GetRandomBytes returns value of RandomBytes field.
|
||||
func (d *DecryptedMessageLayer) GetRandomBytes() (value []byte) {
|
||||
if d == nil {
|
||||
return
|
||||
}
|
||||
return d.RandomBytes
|
||||
}
|
||||
|
||||
// GetLayer returns value of Layer field.
|
||||
func (d *DecryptedMessageLayer) GetLayer() (value int) {
|
||||
if d == nil {
|
||||
return
|
||||
}
|
||||
return d.Layer
|
||||
}
|
||||
|
||||
// GetInSeqNo returns value of InSeqNo field.
|
||||
func (d *DecryptedMessageLayer) GetInSeqNo() (value int) {
|
||||
if d == nil {
|
||||
return
|
||||
}
|
||||
return d.InSeqNo
|
||||
}
|
||||
|
||||
// GetOutSeqNo returns value of OutSeqNo field.
|
||||
func (d *DecryptedMessageLayer) GetOutSeqNo() (value int) {
|
||||
if d == nil {
|
||||
return
|
||||
}
|
||||
return d.OutSeqNo
|
||||
}
|
||||
|
||||
// GetMessage returns value of Message field.
|
||||
func (d *DecryptedMessageLayer) GetMessage() (value DecryptedMessageClass) {
|
||||
if d == nil {
|
||||
return
|
||||
}
|
||||
return d.Message
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,128 @@
|
||||
// Code generated by gotdgen, DO NOT EDIT.
|
||||
|
||||
package e2e
|
||||
|
||||
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{}
|
||||
)
|
||||
|
||||
// Double represents TL type `double#2210c154`.
|
||||
//
|
||||
// See https://core.telegram.org/constructor/double for reference.
|
||||
type Double struct {
|
||||
}
|
||||
|
||||
// DoubleTypeID is TL type id of Double.
|
||||
const DoubleTypeID = 0x2210c154
|
||||
|
||||
// Ensuring interfaces in compile-time for Double.
|
||||
var (
|
||||
_ bin.Encoder = &Double{}
|
||||
_ bin.Decoder = &Double{}
|
||||
_ bin.BareEncoder = &Double{}
|
||||
_ bin.BareDecoder = &Double{}
|
||||
)
|
||||
|
||||
func (d *Double) Zero() bool {
|
||||
if d == nil {
|
||||
return true
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
// String implements fmt.Stringer.
|
||||
func (d *Double) String() string {
|
||||
if d == nil {
|
||||
return "Double(nil)"
|
||||
}
|
||||
type Alias Double
|
||||
return fmt.Sprintf("Double%+v", Alias(*d))
|
||||
}
|
||||
|
||||
// TypeID returns type id in TL schema.
|
||||
//
|
||||
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
||||
func (*Double) TypeID() uint32 {
|
||||
return DoubleTypeID
|
||||
}
|
||||
|
||||
// TypeName returns name of type in TL schema.
|
||||
func (*Double) TypeName() string {
|
||||
return "double"
|
||||
}
|
||||
|
||||
// TypeInfo returns info about TL type.
|
||||
func (d *Double) TypeInfo() tdp.Type {
|
||||
typ := tdp.Type{
|
||||
Name: "double",
|
||||
ID: DoubleTypeID,
|
||||
}
|
||||
if d == nil {
|
||||
typ.Null = true
|
||||
return typ
|
||||
}
|
||||
typ.Fields = []tdp.Field{}
|
||||
return typ
|
||||
}
|
||||
|
||||
// Encode implements bin.Encoder.
|
||||
func (d *Double) Encode(b *bin.Buffer) error {
|
||||
if d == nil {
|
||||
return fmt.Errorf("can't encode double#2210c154 as nil")
|
||||
}
|
||||
b.PutID(DoubleTypeID)
|
||||
return d.EncodeBare(b)
|
||||
}
|
||||
|
||||
// EncodeBare implements bin.BareEncoder.
|
||||
func (d *Double) EncodeBare(b *bin.Buffer) error {
|
||||
if d == nil {
|
||||
return fmt.Errorf("can't encode double#2210c154 as nil")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Decode implements bin.Decoder.
|
||||
func (d *Double) Decode(b *bin.Buffer) error {
|
||||
if d == nil {
|
||||
return fmt.Errorf("can't decode double#2210c154 to nil")
|
||||
}
|
||||
if err := b.ConsumeID(DoubleTypeID); err != nil {
|
||||
return fmt.Errorf("unable to decode double#2210c154: %w", err)
|
||||
}
|
||||
return d.DecodeBare(b)
|
||||
}
|
||||
|
||||
// DecodeBare implements bin.BareDecoder.
|
||||
func (d *Double) DecodeBare(b *bin.Buffer) error {
|
||||
if d == nil {
|
||||
return fmt.Errorf("can't decode double#2210c154 to nil")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
@@ -0,0 +1,507 @@
|
||||
// Code generated by gotdgen, DO NOT EDIT.
|
||||
|
||||
package e2e
|
||||
|
||||
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{}
|
||||
)
|
||||
|
||||
// FileLocationUnavailable represents TL type `fileLocationUnavailable#7c596b46`.
|
||||
//
|
||||
// See https://core.telegram.org/constructor/fileLocationUnavailable for reference.
|
||||
type FileLocationUnavailable struct {
|
||||
// VolumeID field of FileLocationUnavailable.
|
||||
VolumeID int64
|
||||
// LocalID field of FileLocationUnavailable.
|
||||
LocalID int
|
||||
// Secret field of FileLocationUnavailable.
|
||||
Secret int64
|
||||
}
|
||||
|
||||
// FileLocationUnavailableTypeID is TL type id of FileLocationUnavailable.
|
||||
const FileLocationUnavailableTypeID = 0x7c596b46
|
||||
|
||||
// construct implements constructor of FileLocationClass.
|
||||
func (f FileLocationUnavailable) construct() FileLocationClass { return &f }
|
||||
|
||||
// Ensuring interfaces in compile-time for FileLocationUnavailable.
|
||||
var (
|
||||
_ bin.Encoder = &FileLocationUnavailable{}
|
||||
_ bin.Decoder = &FileLocationUnavailable{}
|
||||
_ bin.BareEncoder = &FileLocationUnavailable{}
|
||||
_ bin.BareDecoder = &FileLocationUnavailable{}
|
||||
|
||||
_ FileLocationClass = &FileLocationUnavailable{}
|
||||
)
|
||||
|
||||
func (f *FileLocationUnavailable) Zero() bool {
|
||||
if f == nil {
|
||||
return true
|
||||
}
|
||||
if !(f.VolumeID == 0) {
|
||||
return false
|
||||
}
|
||||
if !(f.LocalID == 0) {
|
||||
return false
|
||||
}
|
||||
if !(f.Secret == 0) {
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
// String implements fmt.Stringer.
|
||||
func (f *FileLocationUnavailable) String() string {
|
||||
if f == nil {
|
||||
return "FileLocationUnavailable(nil)"
|
||||
}
|
||||
type Alias FileLocationUnavailable
|
||||
return fmt.Sprintf("FileLocationUnavailable%+v", Alias(*f))
|
||||
}
|
||||
|
||||
// TypeID returns type id in TL schema.
|
||||
//
|
||||
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
||||
func (*FileLocationUnavailable) TypeID() uint32 {
|
||||
return FileLocationUnavailableTypeID
|
||||
}
|
||||
|
||||
// TypeName returns name of type in TL schema.
|
||||
func (*FileLocationUnavailable) TypeName() string {
|
||||
return "fileLocationUnavailable"
|
||||
}
|
||||
|
||||
// TypeInfo returns info about TL type.
|
||||
func (f *FileLocationUnavailable) TypeInfo() tdp.Type {
|
||||
typ := tdp.Type{
|
||||
Name: "fileLocationUnavailable",
|
||||
ID: FileLocationUnavailableTypeID,
|
||||
}
|
||||
if f == nil {
|
||||
typ.Null = true
|
||||
return typ
|
||||
}
|
||||
typ.Fields = []tdp.Field{
|
||||
{
|
||||
Name: "VolumeID",
|
||||
SchemaName: "volume_id",
|
||||
},
|
||||
{
|
||||
Name: "LocalID",
|
||||
SchemaName: "local_id",
|
||||
},
|
||||
{
|
||||
Name: "Secret",
|
||||
SchemaName: "secret",
|
||||
},
|
||||
}
|
||||
return typ
|
||||
}
|
||||
|
||||
// Encode implements bin.Encoder.
|
||||
func (f *FileLocationUnavailable) Encode(b *bin.Buffer) error {
|
||||
if f == nil {
|
||||
return fmt.Errorf("can't encode fileLocationUnavailable#7c596b46 as nil")
|
||||
}
|
||||
b.PutID(FileLocationUnavailableTypeID)
|
||||
return f.EncodeBare(b)
|
||||
}
|
||||
|
||||
// EncodeBare implements bin.BareEncoder.
|
||||
func (f *FileLocationUnavailable) EncodeBare(b *bin.Buffer) error {
|
||||
if f == nil {
|
||||
return fmt.Errorf("can't encode fileLocationUnavailable#7c596b46 as nil")
|
||||
}
|
||||
b.PutLong(f.VolumeID)
|
||||
b.PutInt(f.LocalID)
|
||||
b.PutLong(f.Secret)
|
||||
return nil
|
||||
}
|
||||
|
||||
// Decode implements bin.Decoder.
|
||||
func (f *FileLocationUnavailable) Decode(b *bin.Buffer) error {
|
||||
if f == nil {
|
||||
return fmt.Errorf("can't decode fileLocationUnavailable#7c596b46 to nil")
|
||||
}
|
||||
if err := b.ConsumeID(FileLocationUnavailableTypeID); err != nil {
|
||||
return fmt.Errorf("unable to decode fileLocationUnavailable#7c596b46: %w", err)
|
||||
}
|
||||
return f.DecodeBare(b)
|
||||
}
|
||||
|
||||
// DecodeBare implements bin.BareDecoder.
|
||||
func (f *FileLocationUnavailable) DecodeBare(b *bin.Buffer) error {
|
||||
if f == nil {
|
||||
return fmt.Errorf("can't decode fileLocationUnavailable#7c596b46 to nil")
|
||||
}
|
||||
{
|
||||
value, err := b.Long()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode fileLocationUnavailable#7c596b46: field volume_id: %w", err)
|
||||
}
|
||||
f.VolumeID = value
|
||||
}
|
||||
{
|
||||
value, err := b.Int()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode fileLocationUnavailable#7c596b46: field local_id: %w", err)
|
||||
}
|
||||
f.LocalID = value
|
||||
}
|
||||
{
|
||||
value, err := b.Long()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode fileLocationUnavailable#7c596b46: field secret: %w", err)
|
||||
}
|
||||
f.Secret = value
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// GetVolumeID returns value of VolumeID field.
|
||||
func (f *FileLocationUnavailable) GetVolumeID() (value int64) {
|
||||
if f == nil {
|
||||
return
|
||||
}
|
||||
return f.VolumeID
|
||||
}
|
||||
|
||||
// GetLocalID returns value of LocalID field.
|
||||
func (f *FileLocationUnavailable) GetLocalID() (value int) {
|
||||
if f == nil {
|
||||
return
|
||||
}
|
||||
return f.LocalID
|
||||
}
|
||||
|
||||
// GetSecret returns value of Secret field.
|
||||
func (f *FileLocationUnavailable) GetSecret() (value int64) {
|
||||
if f == nil {
|
||||
return
|
||||
}
|
||||
return f.Secret
|
||||
}
|
||||
|
||||
// FileLocation represents TL type `fileLocation#53d69076`.
|
||||
//
|
||||
// See https://core.telegram.org/constructor/fileLocation for reference.
|
||||
type FileLocation struct {
|
||||
// DCID field of FileLocation.
|
||||
DCID int
|
||||
// VolumeID field of FileLocation.
|
||||
VolumeID int64
|
||||
// LocalID field of FileLocation.
|
||||
LocalID int
|
||||
// Secret field of FileLocation.
|
||||
Secret int64
|
||||
}
|
||||
|
||||
// FileLocationTypeID is TL type id of FileLocation.
|
||||
const FileLocationTypeID = 0x53d69076
|
||||
|
||||
// construct implements constructor of FileLocationClass.
|
||||
func (f FileLocation) construct() FileLocationClass { return &f }
|
||||
|
||||
// Ensuring interfaces in compile-time for FileLocation.
|
||||
var (
|
||||
_ bin.Encoder = &FileLocation{}
|
||||
_ bin.Decoder = &FileLocation{}
|
||||
_ bin.BareEncoder = &FileLocation{}
|
||||
_ bin.BareDecoder = &FileLocation{}
|
||||
|
||||
_ FileLocationClass = &FileLocation{}
|
||||
)
|
||||
|
||||
func (f *FileLocation) Zero() bool {
|
||||
if f == nil {
|
||||
return true
|
||||
}
|
||||
if !(f.DCID == 0) {
|
||||
return false
|
||||
}
|
||||
if !(f.VolumeID == 0) {
|
||||
return false
|
||||
}
|
||||
if !(f.LocalID == 0) {
|
||||
return false
|
||||
}
|
||||
if !(f.Secret == 0) {
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
// String implements fmt.Stringer.
|
||||
func (f *FileLocation) String() string {
|
||||
if f == nil {
|
||||
return "FileLocation(nil)"
|
||||
}
|
||||
type Alias FileLocation
|
||||
return fmt.Sprintf("FileLocation%+v", Alias(*f))
|
||||
}
|
||||
|
||||
// TypeID returns type id in TL schema.
|
||||
//
|
||||
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
||||
func (*FileLocation) TypeID() uint32 {
|
||||
return FileLocationTypeID
|
||||
}
|
||||
|
||||
// TypeName returns name of type in TL schema.
|
||||
func (*FileLocation) TypeName() string {
|
||||
return "fileLocation"
|
||||
}
|
||||
|
||||
// TypeInfo returns info about TL type.
|
||||
func (f *FileLocation) TypeInfo() tdp.Type {
|
||||
typ := tdp.Type{
|
||||
Name: "fileLocation",
|
||||
ID: FileLocationTypeID,
|
||||
}
|
||||
if f == nil {
|
||||
typ.Null = true
|
||||
return typ
|
||||
}
|
||||
typ.Fields = []tdp.Field{
|
||||
{
|
||||
Name: "DCID",
|
||||
SchemaName: "dc_id",
|
||||
},
|
||||
{
|
||||
Name: "VolumeID",
|
||||
SchemaName: "volume_id",
|
||||
},
|
||||
{
|
||||
Name: "LocalID",
|
||||
SchemaName: "local_id",
|
||||
},
|
||||
{
|
||||
Name: "Secret",
|
||||
SchemaName: "secret",
|
||||
},
|
||||
}
|
||||
return typ
|
||||
}
|
||||
|
||||
// Encode implements bin.Encoder.
|
||||
func (f *FileLocation) Encode(b *bin.Buffer) error {
|
||||
if f == nil {
|
||||
return fmt.Errorf("can't encode fileLocation#53d69076 as nil")
|
||||
}
|
||||
b.PutID(FileLocationTypeID)
|
||||
return f.EncodeBare(b)
|
||||
}
|
||||
|
||||
// EncodeBare implements bin.BareEncoder.
|
||||
func (f *FileLocation) EncodeBare(b *bin.Buffer) error {
|
||||
if f == nil {
|
||||
return fmt.Errorf("can't encode fileLocation#53d69076 as nil")
|
||||
}
|
||||
b.PutInt(f.DCID)
|
||||
b.PutLong(f.VolumeID)
|
||||
b.PutInt(f.LocalID)
|
||||
b.PutLong(f.Secret)
|
||||
return nil
|
||||
}
|
||||
|
||||
// Decode implements bin.Decoder.
|
||||
func (f *FileLocation) Decode(b *bin.Buffer) error {
|
||||
if f == nil {
|
||||
return fmt.Errorf("can't decode fileLocation#53d69076 to nil")
|
||||
}
|
||||
if err := b.ConsumeID(FileLocationTypeID); err != nil {
|
||||
return fmt.Errorf("unable to decode fileLocation#53d69076: %w", err)
|
||||
}
|
||||
return f.DecodeBare(b)
|
||||
}
|
||||
|
||||
// DecodeBare implements bin.BareDecoder.
|
||||
func (f *FileLocation) DecodeBare(b *bin.Buffer) error {
|
||||
if f == nil {
|
||||
return fmt.Errorf("can't decode fileLocation#53d69076 to nil")
|
||||
}
|
||||
{
|
||||
value, err := b.Int()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode fileLocation#53d69076: field dc_id: %w", err)
|
||||
}
|
||||
f.DCID = value
|
||||
}
|
||||
{
|
||||
value, err := b.Long()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode fileLocation#53d69076: field volume_id: %w", err)
|
||||
}
|
||||
f.VolumeID = value
|
||||
}
|
||||
{
|
||||
value, err := b.Int()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode fileLocation#53d69076: field local_id: %w", err)
|
||||
}
|
||||
f.LocalID = value
|
||||
}
|
||||
{
|
||||
value, err := b.Long()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode fileLocation#53d69076: field secret: %w", err)
|
||||
}
|
||||
f.Secret = value
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// GetDCID returns value of DCID field.
|
||||
func (f *FileLocation) GetDCID() (value int) {
|
||||
if f == nil {
|
||||
return
|
||||
}
|
||||
return f.DCID
|
||||
}
|
||||
|
||||
// GetVolumeID returns value of VolumeID field.
|
||||
func (f *FileLocation) GetVolumeID() (value int64) {
|
||||
if f == nil {
|
||||
return
|
||||
}
|
||||
return f.VolumeID
|
||||
}
|
||||
|
||||
// GetLocalID returns value of LocalID field.
|
||||
func (f *FileLocation) GetLocalID() (value int) {
|
||||
if f == nil {
|
||||
return
|
||||
}
|
||||
return f.LocalID
|
||||
}
|
||||
|
||||
// GetSecret returns value of Secret field.
|
||||
func (f *FileLocation) GetSecret() (value int64) {
|
||||
if f == nil {
|
||||
return
|
||||
}
|
||||
return f.Secret
|
||||
}
|
||||
|
||||
// FileLocationClassName is schema name of FileLocationClass.
|
||||
const FileLocationClassName = "FileLocation"
|
||||
|
||||
// FileLocationClass represents FileLocation generic type.
|
||||
//
|
||||
// See https://core.telegram.org/type/FileLocation for reference.
|
||||
//
|
||||
// Example:
|
||||
//
|
||||
// g, err := e2e.DecodeFileLocation(buf)
|
||||
// if err != nil {
|
||||
// panic(err)
|
||||
// }
|
||||
// switch v := g.(type) {
|
||||
// case *e2e.FileLocationUnavailable: // fileLocationUnavailable#7c596b46
|
||||
// case *e2e.FileLocation: // fileLocation#53d69076
|
||||
// default: panic(v)
|
||||
// }
|
||||
type FileLocationClass interface {
|
||||
bin.Encoder
|
||||
bin.Decoder
|
||||
bin.BareEncoder
|
||||
bin.BareDecoder
|
||||
construct() FileLocationClass
|
||||
|
||||
// TypeID returns type id in TL schema.
|
||||
//
|
||||
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
||||
TypeID() uint32
|
||||
// TypeName returns name of type in TL schema.
|
||||
TypeName() string
|
||||
// String implements fmt.Stringer.
|
||||
String() string
|
||||
// Zero returns true if current object has a zero value.
|
||||
Zero() bool
|
||||
|
||||
// VolumeID field of FileLocationUnavailable.
|
||||
GetVolumeID() (value int64)
|
||||
// LocalID field of FileLocationUnavailable.
|
||||
GetLocalID() (value int)
|
||||
// Secret field of FileLocationUnavailable.
|
||||
GetSecret() (value int64)
|
||||
}
|
||||
|
||||
// DecodeFileLocation implements binary de-serialization for FileLocationClass.
|
||||
func DecodeFileLocation(buf *bin.Buffer) (FileLocationClass, error) {
|
||||
id, err := buf.PeekID()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
switch id {
|
||||
case FileLocationUnavailableTypeID:
|
||||
// Decoding fileLocationUnavailable#7c596b46.
|
||||
v := FileLocationUnavailable{}
|
||||
if err := v.Decode(buf); err != nil {
|
||||
return nil, fmt.Errorf("unable to decode FileLocationClass: %w", err)
|
||||
}
|
||||
return &v, nil
|
||||
case FileLocationTypeID:
|
||||
// Decoding fileLocation#53d69076.
|
||||
v := FileLocation{}
|
||||
if err := v.Decode(buf); err != nil {
|
||||
return nil, fmt.Errorf("unable to decode FileLocationClass: %w", err)
|
||||
}
|
||||
return &v, nil
|
||||
default:
|
||||
return nil, fmt.Errorf("unable to decode FileLocationClass: %w", bin.NewUnexpectedID(id))
|
||||
}
|
||||
}
|
||||
|
||||
// FileLocation boxes the FileLocationClass providing a helper.
|
||||
type FileLocationBox struct {
|
||||
FileLocation FileLocationClass
|
||||
}
|
||||
|
||||
// Decode implements bin.Decoder for FileLocationBox.
|
||||
func (b *FileLocationBox) Decode(buf *bin.Buffer) error {
|
||||
if b == nil {
|
||||
return fmt.Errorf("unable to decode FileLocationBox to nil")
|
||||
}
|
||||
v, err := DecodeFileLocation(buf)
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode boxed value: %w", err)
|
||||
}
|
||||
b.FileLocation = v
|
||||
return nil
|
||||
}
|
||||
|
||||
// Encode implements bin.Encode for FileLocationBox.
|
||||
func (b *FileLocationBox) Encode(buf *bin.Buffer) error {
|
||||
if b == nil || b.FileLocation == nil {
|
||||
return fmt.Errorf("unable to encode FileLocationClass as nil")
|
||||
}
|
||||
return b.FileLocation.Encode(buf)
|
||||
}
|
||||
@@ -0,0 +1,357 @@
|
||||
// Code generated by gotdgen, DO NOT EDIT.
|
||||
|
||||
package e2e
|
||||
|
||||
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{}
|
||||
)
|
||||
|
||||
// InputStickerSetShortName represents TL type `inputStickerSetShortName#861cc8a0`.
|
||||
// Stickerset by short name, from a stickerset deep link »¹
|
||||
//
|
||||
// Links:
|
||||
// 1. https://core.telegram.org/api/links#stickerset-links
|
||||
//
|
||||
// See https://core.telegram.org/constructor/inputStickerSetShortName for reference.
|
||||
type InputStickerSetShortName struct {
|
||||
// Short name from a stickerset deep link »¹
|
||||
//
|
||||
// Links:
|
||||
// 1) https://core.telegram.org/api/links#stickerset-links
|
||||
ShortName string
|
||||
}
|
||||
|
||||
// InputStickerSetShortNameTypeID is TL type id of InputStickerSetShortName.
|
||||
const InputStickerSetShortNameTypeID = 0x861cc8a0
|
||||
|
||||
// construct implements constructor of InputStickerSetClass.
|
||||
func (i InputStickerSetShortName) construct() InputStickerSetClass { return &i }
|
||||
|
||||
// Ensuring interfaces in compile-time for InputStickerSetShortName.
|
||||
var (
|
||||
_ bin.Encoder = &InputStickerSetShortName{}
|
||||
_ bin.Decoder = &InputStickerSetShortName{}
|
||||
_ bin.BareEncoder = &InputStickerSetShortName{}
|
||||
_ bin.BareDecoder = &InputStickerSetShortName{}
|
||||
|
||||
_ InputStickerSetClass = &InputStickerSetShortName{}
|
||||
)
|
||||
|
||||
func (i *InputStickerSetShortName) Zero() bool {
|
||||
if i == nil {
|
||||
return true
|
||||
}
|
||||
if !(i.ShortName == "") {
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
// String implements fmt.Stringer.
|
||||
func (i *InputStickerSetShortName) String() string {
|
||||
if i == nil {
|
||||
return "InputStickerSetShortName(nil)"
|
||||
}
|
||||
type Alias InputStickerSetShortName
|
||||
return fmt.Sprintf("InputStickerSetShortName%+v", Alias(*i))
|
||||
}
|
||||
|
||||
// TypeID returns type id in TL schema.
|
||||
//
|
||||
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
||||
func (*InputStickerSetShortName) TypeID() uint32 {
|
||||
return InputStickerSetShortNameTypeID
|
||||
}
|
||||
|
||||
// TypeName returns name of type in TL schema.
|
||||
func (*InputStickerSetShortName) TypeName() string {
|
||||
return "inputStickerSetShortName"
|
||||
}
|
||||
|
||||
// TypeInfo returns info about TL type.
|
||||
func (i *InputStickerSetShortName) TypeInfo() tdp.Type {
|
||||
typ := tdp.Type{
|
||||
Name: "inputStickerSetShortName",
|
||||
ID: InputStickerSetShortNameTypeID,
|
||||
}
|
||||
if i == nil {
|
||||
typ.Null = true
|
||||
return typ
|
||||
}
|
||||
typ.Fields = []tdp.Field{
|
||||
{
|
||||
Name: "ShortName",
|
||||
SchemaName: "short_name",
|
||||
},
|
||||
}
|
||||
return typ
|
||||
}
|
||||
|
||||
// Encode implements bin.Encoder.
|
||||
func (i *InputStickerSetShortName) Encode(b *bin.Buffer) error {
|
||||
if i == nil {
|
||||
return fmt.Errorf("can't encode inputStickerSetShortName#861cc8a0 as nil")
|
||||
}
|
||||
b.PutID(InputStickerSetShortNameTypeID)
|
||||
return i.EncodeBare(b)
|
||||
}
|
||||
|
||||
// EncodeBare implements bin.BareEncoder.
|
||||
func (i *InputStickerSetShortName) EncodeBare(b *bin.Buffer) error {
|
||||
if i == nil {
|
||||
return fmt.Errorf("can't encode inputStickerSetShortName#861cc8a0 as nil")
|
||||
}
|
||||
b.PutString(i.ShortName)
|
||||
return nil
|
||||
}
|
||||
|
||||
// Decode implements bin.Decoder.
|
||||
func (i *InputStickerSetShortName) Decode(b *bin.Buffer) error {
|
||||
if i == nil {
|
||||
return fmt.Errorf("can't decode inputStickerSetShortName#861cc8a0 to nil")
|
||||
}
|
||||
if err := b.ConsumeID(InputStickerSetShortNameTypeID); err != nil {
|
||||
return fmt.Errorf("unable to decode inputStickerSetShortName#861cc8a0: %w", err)
|
||||
}
|
||||
return i.DecodeBare(b)
|
||||
}
|
||||
|
||||
// DecodeBare implements bin.BareDecoder.
|
||||
func (i *InputStickerSetShortName) DecodeBare(b *bin.Buffer) error {
|
||||
if i == nil {
|
||||
return fmt.Errorf("can't decode inputStickerSetShortName#861cc8a0 to nil")
|
||||
}
|
||||
{
|
||||
value, err := b.String()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode inputStickerSetShortName#861cc8a0: field short_name: %w", err)
|
||||
}
|
||||
i.ShortName = value
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// GetShortName returns value of ShortName field.
|
||||
func (i *InputStickerSetShortName) GetShortName() (value string) {
|
||||
if i == nil {
|
||||
return
|
||||
}
|
||||
return i.ShortName
|
||||
}
|
||||
|
||||
// InputStickerSetEmpty represents TL type `inputStickerSetEmpty#ffb62b95`.
|
||||
// Empty constructor
|
||||
//
|
||||
// See https://core.telegram.org/constructor/inputStickerSetEmpty for reference.
|
||||
type InputStickerSetEmpty struct {
|
||||
}
|
||||
|
||||
// InputStickerSetEmptyTypeID is TL type id of InputStickerSetEmpty.
|
||||
const InputStickerSetEmptyTypeID = 0xffb62b95
|
||||
|
||||
// construct implements constructor of InputStickerSetClass.
|
||||
func (i InputStickerSetEmpty) construct() InputStickerSetClass { return &i }
|
||||
|
||||
// Ensuring interfaces in compile-time for InputStickerSetEmpty.
|
||||
var (
|
||||
_ bin.Encoder = &InputStickerSetEmpty{}
|
||||
_ bin.Decoder = &InputStickerSetEmpty{}
|
||||
_ bin.BareEncoder = &InputStickerSetEmpty{}
|
||||
_ bin.BareDecoder = &InputStickerSetEmpty{}
|
||||
|
||||
_ InputStickerSetClass = &InputStickerSetEmpty{}
|
||||
)
|
||||
|
||||
func (i *InputStickerSetEmpty) Zero() bool {
|
||||
if i == nil {
|
||||
return true
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
// String implements fmt.Stringer.
|
||||
func (i *InputStickerSetEmpty) String() string {
|
||||
if i == nil {
|
||||
return "InputStickerSetEmpty(nil)"
|
||||
}
|
||||
type Alias InputStickerSetEmpty
|
||||
return fmt.Sprintf("InputStickerSetEmpty%+v", Alias(*i))
|
||||
}
|
||||
|
||||
// TypeID returns type id in TL schema.
|
||||
//
|
||||
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
||||
func (*InputStickerSetEmpty) TypeID() uint32 {
|
||||
return InputStickerSetEmptyTypeID
|
||||
}
|
||||
|
||||
// TypeName returns name of type in TL schema.
|
||||
func (*InputStickerSetEmpty) TypeName() string {
|
||||
return "inputStickerSetEmpty"
|
||||
}
|
||||
|
||||
// TypeInfo returns info about TL type.
|
||||
func (i *InputStickerSetEmpty) TypeInfo() tdp.Type {
|
||||
typ := tdp.Type{
|
||||
Name: "inputStickerSetEmpty",
|
||||
ID: InputStickerSetEmptyTypeID,
|
||||
}
|
||||
if i == nil {
|
||||
typ.Null = true
|
||||
return typ
|
||||
}
|
||||
typ.Fields = []tdp.Field{}
|
||||
return typ
|
||||
}
|
||||
|
||||
// Encode implements bin.Encoder.
|
||||
func (i *InputStickerSetEmpty) Encode(b *bin.Buffer) error {
|
||||
if i == nil {
|
||||
return fmt.Errorf("can't encode inputStickerSetEmpty#ffb62b95 as nil")
|
||||
}
|
||||
b.PutID(InputStickerSetEmptyTypeID)
|
||||
return i.EncodeBare(b)
|
||||
}
|
||||
|
||||
// EncodeBare implements bin.BareEncoder.
|
||||
func (i *InputStickerSetEmpty) EncodeBare(b *bin.Buffer) error {
|
||||
if i == nil {
|
||||
return fmt.Errorf("can't encode inputStickerSetEmpty#ffb62b95 as nil")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Decode implements bin.Decoder.
|
||||
func (i *InputStickerSetEmpty) Decode(b *bin.Buffer) error {
|
||||
if i == nil {
|
||||
return fmt.Errorf("can't decode inputStickerSetEmpty#ffb62b95 to nil")
|
||||
}
|
||||
if err := b.ConsumeID(InputStickerSetEmptyTypeID); err != nil {
|
||||
return fmt.Errorf("unable to decode inputStickerSetEmpty#ffb62b95: %w", err)
|
||||
}
|
||||
return i.DecodeBare(b)
|
||||
}
|
||||
|
||||
// DecodeBare implements bin.BareDecoder.
|
||||
func (i *InputStickerSetEmpty) DecodeBare(b *bin.Buffer) error {
|
||||
if i == nil {
|
||||
return fmt.Errorf("can't decode inputStickerSetEmpty#ffb62b95 to nil")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// InputStickerSetClassName is schema name of InputStickerSetClass.
|
||||
const InputStickerSetClassName = "InputStickerSet"
|
||||
|
||||
// InputStickerSetClass represents InputStickerSet generic type.
|
||||
//
|
||||
// See https://core.telegram.org/type/InputStickerSet for reference.
|
||||
//
|
||||
// Example:
|
||||
//
|
||||
// g, err := e2e.DecodeInputStickerSet(buf)
|
||||
// if err != nil {
|
||||
// panic(err)
|
||||
// }
|
||||
// switch v := g.(type) {
|
||||
// case *e2e.InputStickerSetShortName: // inputStickerSetShortName#861cc8a0
|
||||
// case *e2e.InputStickerSetEmpty: // inputStickerSetEmpty#ffb62b95
|
||||
// default: panic(v)
|
||||
// }
|
||||
type InputStickerSetClass interface {
|
||||
bin.Encoder
|
||||
bin.Decoder
|
||||
bin.BareEncoder
|
||||
bin.BareDecoder
|
||||
construct() InputStickerSetClass
|
||||
|
||||
// TypeID returns type id in TL schema.
|
||||
//
|
||||
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
||||
TypeID() uint32
|
||||
// TypeName returns name of type in TL schema.
|
||||
TypeName() string
|
||||
// String implements fmt.Stringer.
|
||||
String() string
|
||||
// Zero returns true if current object has a zero value.
|
||||
Zero() bool
|
||||
}
|
||||
|
||||
// DecodeInputStickerSet implements binary de-serialization for InputStickerSetClass.
|
||||
func DecodeInputStickerSet(buf *bin.Buffer) (InputStickerSetClass, error) {
|
||||
id, err := buf.PeekID()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
switch id {
|
||||
case InputStickerSetShortNameTypeID:
|
||||
// Decoding inputStickerSetShortName#861cc8a0.
|
||||
v := InputStickerSetShortName{}
|
||||
if err := v.Decode(buf); err != nil {
|
||||
return nil, fmt.Errorf("unable to decode InputStickerSetClass: %w", err)
|
||||
}
|
||||
return &v, nil
|
||||
case InputStickerSetEmptyTypeID:
|
||||
// Decoding inputStickerSetEmpty#ffb62b95.
|
||||
v := InputStickerSetEmpty{}
|
||||
if err := v.Decode(buf); err != nil {
|
||||
return nil, fmt.Errorf("unable to decode InputStickerSetClass: %w", err)
|
||||
}
|
||||
return &v, nil
|
||||
default:
|
||||
return nil, fmt.Errorf("unable to decode InputStickerSetClass: %w", bin.NewUnexpectedID(id))
|
||||
}
|
||||
}
|
||||
|
||||
// InputStickerSet boxes the InputStickerSetClass providing a helper.
|
||||
type InputStickerSetBox struct {
|
||||
InputStickerSet InputStickerSetClass
|
||||
}
|
||||
|
||||
// Decode implements bin.Decoder for InputStickerSetBox.
|
||||
func (b *InputStickerSetBox) Decode(buf *bin.Buffer) error {
|
||||
if b == nil {
|
||||
return fmt.Errorf("unable to decode InputStickerSetBox to nil")
|
||||
}
|
||||
v, err := DecodeInputStickerSet(buf)
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode boxed value: %w", err)
|
||||
}
|
||||
b.InputStickerSet = v
|
||||
return nil
|
||||
}
|
||||
|
||||
// Encode implements bin.Encode for InputStickerSetBox.
|
||||
func (b *InputStickerSetBox) Encode(buf *bin.Buffer) error {
|
||||
if b == nil || b.InputStickerSet == nil {
|
||||
return fmt.Errorf("unable to encode InputStickerSetClass as nil")
|
||||
}
|
||||
return b.InputStickerSet.Encode(buf)
|
||||
}
|
||||
@@ -0,0 +1,128 @@
|
||||
// Code generated by gotdgen, DO NOT EDIT.
|
||||
|
||||
package e2e
|
||||
|
||||
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{}
|
||||
)
|
||||
|
||||
// Int represents TL type `int#a8509bda`.
|
||||
//
|
||||
// See https://core.telegram.org/constructor/int for reference.
|
||||
type Int struct {
|
||||
}
|
||||
|
||||
// IntTypeID is TL type id of Int.
|
||||
const IntTypeID = 0xa8509bda
|
||||
|
||||
// Ensuring interfaces in compile-time for Int.
|
||||
var (
|
||||
_ bin.Encoder = &Int{}
|
||||
_ bin.Decoder = &Int{}
|
||||
_ bin.BareEncoder = &Int{}
|
||||
_ bin.BareDecoder = &Int{}
|
||||
)
|
||||
|
||||
func (i *Int) Zero() bool {
|
||||
if i == nil {
|
||||
return true
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
// String implements fmt.Stringer.
|
||||
func (i *Int) String() string {
|
||||
if i == nil {
|
||||
return "Int(nil)"
|
||||
}
|
||||
type Alias Int
|
||||
return fmt.Sprintf("Int%+v", Alias(*i))
|
||||
}
|
||||
|
||||
// TypeID returns type id in TL schema.
|
||||
//
|
||||
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
||||
func (*Int) TypeID() uint32 {
|
||||
return IntTypeID
|
||||
}
|
||||
|
||||
// TypeName returns name of type in TL schema.
|
||||
func (*Int) TypeName() string {
|
||||
return "int"
|
||||
}
|
||||
|
||||
// TypeInfo returns info about TL type.
|
||||
func (i *Int) TypeInfo() tdp.Type {
|
||||
typ := tdp.Type{
|
||||
Name: "int",
|
||||
ID: IntTypeID,
|
||||
}
|
||||
if i == nil {
|
||||
typ.Null = true
|
||||
return typ
|
||||
}
|
||||
typ.Fields = []tdp.Field{}
|
||||
return typ
|
||||
}
|
||||
|
||||
// Encode implements bin.Encoder.
|
||||
func (i *Int) Encode(b *bin.Buffer) error {
|
||||
if i == nil {
|
||||
return fmt.Errorf("can't encode int#a8509bda as nil")
|
||||
}
|
||||
b.PutID(IntTypeID)
|
||||
return i.EncodeBare(b)
|
||||
}
|
||||
|
||||
// EncodeBare implements bin.BareEncoder.
|
||||
func (i *Int) EncodeBare(b *bin.Buffer) error {
|
||||
if i == nil {
|
||||
return fmt.Errorf("can't encode int#a8509bda as nil")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Decode implements bin.Decoder.
|
||||
func (i *Int) Decode(b *bin.Buffer) error {
|
||||
if i == nil {
|
||||
return fmt.Errorf("can't decode int#a8509bda to nil")
|
||||
}
|
||||
if err := b.ConsumeID(IntTypeID); err != nil {
|
||||
return fmt.Errorf("unable to decode int#a8509bda: %w", err)
|
||||
}
|
||||
return i.DecodeBare(b)
|
||||
}
|
||||
|
||||
// DecodeBare implements bin.BareDecoder.
|
||||
func (i *Int) DecodeBare(b *bin.Buffer) error {
|
||||
if i == nil {
|
||||
return fmt.Errorf("can't decode int#a8509bda to nil")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
@@ -0,0 +1,128 @@
|
||||
// Code generated by gotdgen, DO NOT EDIT.
|
||||
|
||||
package e2e
|
||||
|
||||
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{}
|
||||
)
|
||||
|
||||
// Long represents TL type `long#22076cba`.
|
||||
//
|
||||
// See https://core.telegram.org/constructor/long for reference.
|
||||
type Long struct {
|
||||
}
|
||||
|
||||
// LongTypeID is TL type id of Long.
|
||||
const LongTypeID = 0x22076cba
|
||||
|
||||
// Ensuring interfaces in compile-time for Long.
|
||||
var (
|
||||
_ bin.Encoder = &Long{}
|
||||
_ bin.Decoder = &Long{}
|
||||
_ bin.BareEncoder = &Long{}
|
||||
_ bin.BareDecoder = &Long{}
|
||||
)
|
||||
|
||||
func (l *Long) Zero() bool {
|
||||
if l == nil {
|
||||
return true
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
// String implements fmt.Stringer.
|
||||
func (l *Long) String() string {
|
||||
if l == nil {
|
||||
return "Long(nil)"
|
||||
}
|
||||
type Alias Long
|
||||
return fmt.Sprintf("Long%+v", Alias(*l))
|
||||
}
|
||||
|
||||
// TypeID returns type id in TL schema.
|
||||
//
|
||||
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
||||
func (*Long) TypeID() uint32 {
|
||||
return LongTypeID
|
||||
}
|
||||
|
||||
// TypeName returns name of type in TL schema.
|
||||
func (*Long) TypeName() string {
|
||||
return "long"
|
||||
}
|
||||
|
||||
// TypeInfo returns info about TL type.
|
||||
func (l *Long) TypeInfo() tdp.Type {
|
||||
typ := tdp.Type{
|
||||
Name: "long",
|
||||
ID: LongTypeID,
|
||||
}
|
||||
if l == nil {
|
||||
typ.Null = true
|
||||
return typ
|
||||
}
|
||||
typ.Fields = []tdp.Field{}
|
||||
return typ
|
||||
}
|
||||
|
||||
// Encode implements bin.Encoder.
|
||||
func (l *Long) Encode(b *bin.Buffer) error {
|
||||
if l == nil {
|
||||
return fmt.Errorf("can't encode long#22076cba as nil")
|
||||
}
|
||||
b.PutID(LongTypeID)
|
||||
return l.EncodeBare(b)
|
||||
}
|
||||
|
||||
// EncodeBare implements bin.BareEncoder.
|
||||
func (l *Long) EncodeBare(b *bin.Buffer) error {
|
||||
if l == nil {
|
||||
return fmt.Errorf("can't encode long#22076cba as nil")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Decode implements bin.Decoder.
|
||||
func (l *Long) Decode(b *bin.Buffer) error {
|
||||
if l == nil {
|
||||
return fmt.Errorf("can't decode long#22076cba to nil")
|
||||
}
|
||||
if err := b.ConsumeID(LongTypeID); err != nil {
|
||||
return fmt.Errorf("unable to decode long#22076cba: %w", err)
|
||||
}
|
||||
return l.DecodeBare(b)
|
||||
}
|
||||
|
||||
// DecodeBare implements bin.BareDecoder.
|
||||
func (l *Long) DecodeBare(b *bin.Buffer) error {
|
||||
if l == nil {
|
||||
return fmt.Errorf("can't decode long#22076cba to nil")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,735 @@
|
||||
// Code generated by gotdgen, DO NOT EDIT.
|
||||
|
||||
package e2e
|
||||
|
||||
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{}
|
||||
)
|
||||
|
||||
// PhotoSizeEmpty represents TL type `photoSizeEmpty#e17e23c`.
|
||||
// Empty constructor. Image with this thumbnail is unavailable.
|
||||
//
|
||||
// See https://core.telegram.org/constructor/photoSizeEmpty for reference.
|
||||
type PhotoSizeEmpty struct {
|
||||
// Thumbnail type »¹
|
||||
//
|
||||
// Links:
|
||||
// 1) https://core.telegram.org/api/files#image-thumbnail-types
|
||||
Type string
|
||||
}
|
||||
|
||||
// PhotoSizeEmptyTypeID is TL type id of PhotoSizeEmpty.
|
||||
const PhotoSizeEmptyTypeID = 0xe17e23c
|
||||
|
||||
// construct implements constructor of PhotoSizeClass.
|
||||
func (p PhotoSizeEmpty) construct() PhotoSizeClass { return &p }
|
||||
|
||||
// Ensuring interfaces in compile-time for PhotoSizeEmpty.
|
||||
var (
|
||||
_ bin.Encoder = &PhotoSizeEmpty{}
|
||||
_ bin.Decoder = &PhotoSizeEmpty{}
|
||||
_ bin.BareEncoder = &PhotoSizeEmpty{}
|
||||
_ bin.BareDecoder = &PhotoSizeEmpty{}
|
||||
|
||||
_ PhotoSizeClass = &PhotoSizeEmpty{}
|
||||
)
|
||||
|
||||
func (p *PhotoSizeEmpty) Zero() bool {
|
||||
if p == nil {
|
||||
return true
|
||||
}
|
||||
if !(p.Type == "") {
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
// String implements fmt.Stringer.
|
||||
func (p *PhotoSizeEmpty) String() string {
|
||||
if p == nil {
|
||||
return "PhotoSizeEmpty(nil)"
|
||||
}
|
||||
type Alias PhotoSizeEmpty
|
||||
return fmt.Sprintf("PhotoSizeEmpty%+v", Alias(*p))
|
||||
}
|
||||
|
||||
// TypeID returns type id in TL schema.
|
||||
//
|
||||
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
||||
func (*PhotoSizeEmpty) TypeID() uint32 {
|
||||
return PhotoSizeEmptyTypeID
|
||||
}
|
||||
|
||||
// TypeName returns name of type in TL schema.
|
||||
func (*PhotoSizeEmpty) TypeName() string {
|
||||
return "photoSizeEmpty"
|
||||
}
|
||||
|
||||
// TypeInfo returns info about TL type.
|
||||
func (p *PhotoSizeEmpty) TypeInfo() tdp.Type {
|
||||
typ := tdp.Type{
|
||||
Name: "photoSizeEmpty",
|
||||
ID: PhotoSizeEmptyTypeID,
|
||||
}
|
||||
if p == nil {
|
||||
typ.Null = true
|
||||
return typ
|
||||
}
|
||||
typ.Fields = []tdp.Field{
|
||||
{
|
||||
Name: "Type",
|
||||
SchemaName: "type",
|
||||
},
|
||||
}
|
||||
return typ
|
||||
}
|
||||
|
||||
// Encode implements bin.Encoder.
|
||||
func (p *PhotoSizeEmpty) Encode(b *bin.Buffer) error {
|
||||
if p == nil {
|
||||
return fmt.Errorf("can't encode photoSizeEmpty#e17e23c as nil")
|
||||
}
|
||||
b.PutID(PhotoSizeEmptyTypeID)
|
||||
return p.EncodeBare(b)
|
||||
}
|
||||
|
||||
// EncodeBare implements bin.BareEncoder.
|
||||
func (p *PhotoSizeEmpty) EncodeBare(b *bin.Buffer) error {
|
||||
if p == nil {
|
||||
return fmt.Errorf("can't encode photoSizeEmpty#e17e23c as nil")
|
||||
}
|
||||
b.PutString(p.Type)
|
||||
return nil
|
||||
}
|
||||
|
||||
// Decode implements bin.Decoder.
|
||||
func (p *PhotoSizeEmpty) Decode(b *bin.Buffer) error {
|
||||
if p == nil {
|
||||
return fmt.Errorf("can't decode photoSizeEmpty#e17e23c to nil")
|
||||
}
|
||||
if err := b.ConsumeID(PhotoSizeEmptyTypeID); err != nil {
|
||||
return fmt.Errorf("unable to decode photoSizeEmpty#e17e23c: %w", err)
|
||||
}
|
||||
return p.DecodeBare(b)
|
||||
}
|
||||
|
||||
// DecodeBare implements bin.BareDecoder.
|
||||
func (p *PhotoSizeEmpty) DecodeBare(b *bin.Buffer) error {
|
||||
if p == nil {
|
||||
return fmt.Errorf("can't decode photoSizeEmpty#e17e23c to nil")
|
||||
}
|
||||
{
|
||||
value, err := b.String()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode photoSizeEmpty#e17e23c: field type: %w", err)
|
||||
}
|
||||
p.Type = value
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// GetType returns value of Type field.
|
||||
func (p *PhotoSizeEmpty) GetType() (value string) {
|
||||
if p == nil {
|
||||
return
|
||||
}
|
||||
return p.Type
|
||||
}
|
||||
|
||||
// PhotoSize represents TL type `photoSize#77bfb61b`.
|
||||
// Image description.
|
||||
//
|
||||
// See https://core.telegram.org/constructor/photoSize for reference.
|
||||
type PhotoSize struct {
|
||||
// Thumbnail type »¹
|
||||
//
|
||||
// Links:
|
||||
// 1) https://core.telegram.org/api/files#image-thumbnail-types
|
||||
Type string
|
||||
// Location field of PhotoSize.
|
||||
Location FileLocationClass
|
||||
// Image width
|
||||
W int
|
||||
// Image height
|
||||
H int
|
||||
// File size
|
||||
Size int
|
||||
}
|
||||
|
||||
// PhotoSizeTypeID is TL type id of PhotoSize.
|
||||
const PhotoSizeTypeID = 0x77bfb61b
|
||||
|
||||
// construct implements constructor of PhotoSizeClass.
|
||||
func (p PhotoSize) construct() PhotoSizeClass { return &p }
|
||||
|
||||
// Ensuring interfaces in compile-time for PhotoSize.
|
||||
var (
|
||||
_ bin.Encoder = &PhotoSize{}
|
||||
_ bin.Decoder = &PhotoSize{}
|
||||
_ bin.BareEncoder = &PhotoSize{}
|
||||
_ bin.BareDecoder = &PhotoSize{}
|
||||
|
||||
_ PhotoSizeClass = &PhotoSize{}
|
||||
)
|
||||
|
||||
func (p *PhotoSize) Zero() bool {
|
||||
if p == nil {
|
||||
return true
|
||||
}
|
||||
if !(p.Type == "") {
|
||||
return false
|
||||
}
|
||||
if !(p.Location == nil) {
|
||||
return false
|
||||
}
|
||||
if !(p.W == 0) {
|
||||
return false
|
||||
}
|
||||
if !(p.H == 0) {
|
||||
return false
|
||||
}
|
||||
if !(p.Size == 0) {
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
// String implements fmt.Stringer.
|
||||
func (p *PhotoSize) String() string {
|
||||
if p == nil {
|
||||
return "PhotoSize(nil)"
|
||||
}
|
||||
type Alias PhotoSize
|
||||
return fmt.Sprintf("PhotoSize%+v", Alias(*p))
|
||||
}
|
||||
|
||||
// TypeID returns type id in TL schema.
|
||||
//
|
||||
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
||||
func (*PhotoSize) TypeID() uint32 {
|
||||
return PhotoSizeTypeID
|
||||
}
|
||||
|
||||
// TypeName returns name of type in TL schema.
|
||||
func (*PhotoSize) TypeName() string {
|
||||
return "photoSize"
|
||||
}
|
||||
|
||||
// TypeInfo returns info about TL type.
|
||||
func (p *PhotoSize) TypeInfo() tdp.Type {
|
||||
typ := tdp.Type{
|
||||
Name: "photoSize",
|
||||
ID: PhotoSizeTypeID,
|
||||
}
|
||||
if p == nil {
|
||||
typ.Null = true
|
||||
return typ
|
||||
}
|
||||
typ.Fields = []tdp.Field{
|
||||
{
|
||||
Name: "Type",
|
||||
SchemaName: "type",
|
||||
},
|
||||
{
|
||||
Name: "Location",
|
||||
SchemaName: "location",
|
||||
},
|
||||
{
|
||||
Name: "W",
|
||||
SchemaName: "w",
|
||||
},
|
||||
{
|
||||
Name: "H",
|
||||
SchemaName: "h",
|
||||
},
|
||||
{
|
||||
Name: "Size",
|
||||
SchemaName: "size",
|
||||
},
|
||||
}
|
||||
return typ
|
||||
}
|
||||
|
||||
// Encode implements bin.Encoder.
|
||||
func (p *PhotoSize) Encode(b *bin.Buffer) error {
|
||||
if p == nil {
|
||||
return fmt.Errorf("can't encode photoSize#77bfb61b as nil")
|
||||
}
|
||||
b.PutID(PhotoSizeTypeID)
|
||||
return p.EncodeBare(b)
|
||||
}
|
||||
|
||||
// EncodeBare implements bin.BareEncoder.
|
||||
func (p *PhotoSize) EncodeBare(b *bin.Buffer) error {
|
||||
if p == nil {
|
||||
return fmt.Errorf("can't encode photoSize#77bfb61b as nil")
|
||||
}
|
||||
b.PutString(p.Type)
|
||||
if p.Location == nil {
|
||||
return fmt.Errorf("unable to encode photoSize#77bfb61b: field location is nil")
|
||||
}
|
||||
if err := p.Location.Encode(b); err != nil {
|
||||
return fmt.Errorf("unable to encode photoSize#77bfb61b: field location: %w", err)
|
||||
}
|
||||
b.PutInt(p.W)
|
||||
b.PutInt(p.H)
|
||||
b.PutInt(p.Size)
|
||||
return nil
|
||||
}
|
||||
|
||||
// Decode implements bin.Decoder.
|
||||
func (p *PhotoSize) Decode(b *bin.Buffer) error {
|
||||
if p == nil {
|
||||
return fmt.Errorf("can't decode photoSize#77bfb61b to nil")
|
||||
}
|
||||
if err := b.ConsumeID(PhotoSizeTypeID); err != nil {
|
||||
return fmt.Errorf("unable to decode photoSize#77bfb61b: %w", err)
|
||||
}
|
||||
return p.DecodeBare(b)
|
||||
}
|
||||
|
||||
// DecodeBare implements bin.BareDecoder.
|
||||
func (p *PhotoSize) DecodeBare(b *bin.Buffer) error {
|
||||
if p == nil {
|
||||
return fmt.Errorf("can't decode photoSize#77bfb61b to nil")
|
||||
}
|
||||
{
|
||||
value, err := b.String()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode photoSize#77bfb61b: field type: %w", err)
|
||||
}
|
||||
p.Type = value
|
||||
}
|
||||
{
|
||||
value, err := DecodeFileLocation(b)
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode photoSize#77bfb61b: field location: %w", err)
|
||||
}
|
||||
p.Location = value
|
||||
}
|
||||
{
|
||||
value, err := b.Int()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode photoSize#77bfb61b: field w: %w", err)
|
||||
}
|
||||
p.W = value
|
||||
}
|
||||
{
|
||||
value, err := b.Int()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode photoSize#77bfb61b: field h: %w", err)
|
||||
}
|
||||
p.H = value
|
||||
}
|
||||
{
|
||||
value, err := b.Int()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode photoSize#77bfb61b: field size: %w", err)
|
||||
}
|
||||
p.Size = value
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// GetType returns value of Type field.
|
||||
func (p *PhotoSize) GetType() (value string) {
|
||||
if p == nil {
|
||||
return
|
||||
}
|
||||
return p.Type
|
||||
}
|
||||
|
||||
// GetLocation returns value of Location field.
|
||||
func (p *PhotoSize) GetLocation() (value FileLocationClass) {
|
||||
if p == nil {
|
||||
return
|
||||
}
|
||||
return p.Location
|
||||
}
|
||||
|
||||
// GetW returns value of W field.
|
||||
func (p *PhotoSize) GetW() (value int) {
|
||||
if p == nil {
|
||||
return
|
||||
}
|
||||
return p.W
|
||||
}
|
||||
|
||||
// GetH returns value of H field.
|
||||
func (p *PhotoSize) GetH() (value int) {
|
||||
if p == nil {
|
||||
return
|
||||
}
|
||||
return p.H
|
||||
}
|
||||
|
||||
// GetSize returns value of Size field.
|
||||
func (p *PhotoSize) GetSize() (value int) {
|
||||
if p == nil {
|
||||
return
|
||||
}
|
||||
return p.Size
|
||||
}
|
||||
|
||||
// PhotoCachedSize represents TL type `photoCachedSize#e9a734fa`.
|
||||
// Description of an image and its content.
|
||||
//
|
||||
// See https://core.telegram.org/constructor/photoCachedSize for reference.
|
||||
type PhotoCachedSize struct {
|
||||
// Thumbnail type
|
||||
Type string
|
||||
// Location field of PhotoCachedSize.
|
||||
Location FileLocationClass
|
||||
// Image width
|
||||
W int
|
||||
// Image height
|
||||
H int
|
||||
// Binary data, file content
|
||||
Bytes []byte
|
||||
}
|
||||
|
||||
// PhotoCachedSizeTypeID is TL type id of PhotoCachedSize.
|
||||
const PhotoCachedSizeTypeID = 0xe9a734fa
|
||||
|
||||
// construct implements constructor of PhotoSizeClass.
|
||||
func (p PhotoCachedSize) construct() PhotoSizeClass { return &p }
|
||||
|
||||
// Ensuring interfaces in compile-time for PhotoCachedSize.
|
||||
var (
|
||||
_ bin.Encoder = &PhotoCachedSize{}
|
||||
_ bin.Decoder = &PhotoCachedSize{}
|
||||
_ bin.BareEncoder = &PhotoCachedSize{}
|
||||
_ bin.BareDecoder = &PhotoCachedSize{}
|
||||
|
||||
_ PhotoSizeClass = &PhotoCachedSize{}
|
||||
)
|
||||
|
||||
func (p *PhotoCachedSize) Zero() bool {
|
||||
if p == nil {
|
||||
return true
|
||||
}
|
||||
if !(p.Type == "") {
|
||||
return false
|
||||
}
|
||||
if !(p.Location == nil) {
|
||||
return false
|
||||
}
|
||||
if !(p.W == 0) {
|
||||
return false
|
||||
}
|
||||
if !(p.H == 0) {
|
||||
return false
|
||||
}
|
||||
if !(p.Bytes == nil) {
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
// String implements fmt.Stringer.
|
||||
func (p *PhotoCachedSize) String() string {
|
||||
if p == nil {
|
||||
return "PhotoCachedSize(nil)"
|
||||
}
|
||||
type Alias PhotoCachedSize
|
||||
return fmt.Sprintf("PhotoCachedSize%+v", Alias(*p))
|
||||
}
|
||||
|
||||
// TypeID returns type id in TL schema.
|
||||
//
|
||||
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
||||
func (*PhotoCachedSize) TypeID() uint32 {
|
||||
return PhotoCachedSizeTypeID
|
||||
}
|
||||
|
||||
// TypeName returns name of type in TL schema.
|
||||
func (*PhotoCachedSize) TypeName() string {
|
||||
return "photoCachedSize"
|
||||
}
|
||||
|
||||
// TypeInfo returns info about TL type.
|
||||
func (p *PhotoCachedSize) TypeInfo() tdp.Type {
|
||||
typ := tdp.Type{
|
||||
Name: "photoCachedSize",
|
||||
ID: PhotoCachedSizeTypeID,
|
||||
}
|
||||
if p == nil {
|
||||
typ.Null = true
|
||||
return typ
|
||||
}
|
||||
typ.Fields = []tdp.Field{
|
||||
{
|
||||
Name: "Type",
|
||||
SchemaName: "type",
|
||||
},
|
||||
{
|
||||
Name: "Location",
|
||||
SchemaName: "location",
|
||||
},
|
||||
{
|
||||
Name: "W",
|
||||
SchemaName: "w",
|
||||
},
|
||||
{
|
||||
Name: "H",
|
||||
SchemaName: "h",
|
||||
},
|
||||
{
|
||||
Name: "Bytes",
|
||||
SchemaName: "bytes",
|
||||
},
|
||||
}
|
||||
return typ
|
||||
}
|
||||
|
||||
// Encode implements bin.Encoder.
|
||||
func (p *PhotoCachedSize) Encode(b *bin.Buffer) error {
|
||||
if p == nil {
|
||||
return fmt.Errorf("can't encode photoCachedSize#e9a734fa as nil")
|
||||
}
|
||||
b.PutID(PhotoCachedSizeTypeID)
|
||||
return p.EncodeBare(b)
|
||||
}
|
||||
|
||||
// EncodeBare implements bin.BareEncoder.
|
||||
func (p *PhotoCachedSize) EncodeBare(b *bin.Buffer) error {
|
||||
if p == nil {
|
||||
return fmt.Errorf("can't encode photoCachedSize#e9a734fa as nil")
|
||||
}
|
||||
b.PutString(p.Type)
|
||||
if p.Location == nil {
|
||||
return fmt.Errorf("unable to encode photoCachedSize#e9a734fa: field location is nil")
|
||||
}
|
||||
if err := p.Location.Encode(b); err != nil {
|
||||
return fmt.Errorf("unable to encode photoCachedSize#e9a734fa: field location: %w", err)
|
||||
}
|
||||
b.PutInt(p.W)
|
||||
b.PutInt(p.H)
|
||||
b.PutBytes(p.Bytes)
|
||||
return nil
|
||||
}
|
||||
|
||||
// Decode implements bin.Decoder.
|
||||
func (p *PhotoCachedSize) Decode(b *bin.Buffer) error {
|
||||
if p == nil {
|
||||
return fmt.Errorf("can't decode photoCachedSize#e9a734fa to nil")
|
||||
}
|
||||
if err := b.ConsumeID(PhotoCachedSizeTypeID); err != nil {
|
||||
return fmt.Errorf("unable to decode photoCachedSize#e9a734fa: %w", err)
|
||||
}
|
||||
return p.DecodeBare(b)
|
||||
}
|
||||
|
||||
// DecodeBare implements bin.BareDecoder.
|
||||
func (p *PhotoCachedSize) DecodeBare(b *bin.Buffer) error {
|
||||
if p == nil {
|
||||
return fmt.Errorf("can't decode photoCachedSize#e9a734fa to nil")
|
||||
}
|
||||
{
|
||||
value, err := b.String()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode photoCachedSize#e9a734fa: field type: %w", err)
|
||||
}
|
||||
p.Type = value
|
||||
}
|
||||
{
|
||||
value, err := DecodeFileLocation(b)
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode photoCachedSize#e9a734fa: field location: %w", err)
|
||||
}
|
||||
p.Location = value
|
||||
}
|
||||
{
|
||||
value, err := b.Int()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode photoCachedSize#e9a734fa: field w: %w", err)
|
||||
}
|
||||
p.W = value
|
||||
}
|
||||
{
|
||||
value, err := b.Int()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode photoCachedSize#e9a734fa: field h: %w", err)
|
||||
}
|
||||
p.H = value
|
||||
}
|
||||
{
|
||||
value, err := b.Bytes()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode photoCachedSize#e9a734fa: field bytes: %w", err)
|
||||
}
|
||||
p.Bytes = value
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// GetType returns value of Type field.
|
||||
func (p *PhotoCachedSize) GetType() (value string) {
|
||||
if p == nil {
|
||||
return
|
||||
}
|
||||
return p.Type
|
||||
}
|
||||
|
||||
// GetLocation returns value of Location field.
|
||||
func (p *PhotoCachedSize) GetLocation() (value FileLocationClass) {
|
||||
if p == nil {
|
||||
return
|
||||
}
|
||||
return p.Location
|
||||
}
|
||||
|
||||
// GetW returns value of W field.
|
||||
func (p *PhotoCachedSize) GetW() (value int) {
|
||||
if p == nil {
|
||||
return
|
||||
}
|
||||
return p.W
|
||||
}
|
||||
|
||||
// GetH returns value of H field.
|
||||
func (p *PhotoCachedSize) GetH() (value int) {
|
||||
if p == nil {
|
||||
return
|
||||
}
|
||||
return p.H
|
||||
}
|
||||
|
||||
// GetBytes returns value of Bytes field.
|
||||
func (p *PhotoCachedSize) GetBytes() (value []byte) {
|
||||
if p == nil {
|
||||
return
|
||||
}
|
||||
return p.Bytes
|
||||
}
|
||||
|
||||
// PhotoSizeClassName is schema name of PhotoSizeClass.
|
||||
const PhotoSizeClassName = "PhotoSize"
|
||||
|
||||
// PhotoSizeClass represents PhotoSize generic type.
|
||||
//
|
||||
// See https://core.telegram.org/type/PhotoSize for reference.
|
||||
//
|
||||
// Example:
|
||||
//
|
||||
// g, err := e2e.DecodePhotoSize(buf)
|
||||
// if err != nil {
|
||||
// panic(err)
|
||||
// }
|
||||
// switch v := g.(type) {
|
||||
// case *e2e.PhotoSizeEmpty: // photoSizeEmpty#e17e23c
|
||||
// case *e2e.PhotoSize: // photoSize#77bfb61b
|
||||
// case *e2e.PhotoCachedSize: // photoCachedSize#e9a734fa
|
||||
// default: panic(v)
|
||||
// }
|
||||
type PhotoSizeClass interface {
|
||||
bin.Encoder
|
||||
bin.Decoder
|
||||
bin.BareEncoder
|
||||
bin.BareDecoder
|
||||
construct() PhotoSizeClass
|
||||
|
||||
// TypeID returns type id in TL schema.
|
||||
//
|
||||
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
||||
TypeID() uint32
|
||||
// TypeName returns name of type in TL schema.
|
||||
TypeName() string
|
||||
// String implements fmt.Stringer.
|
||||
String() string
|
||||
// Zero returns true if current object has a zero value.
|
||||
Zero() bool
|
||||
|
||||
// Thumbnail type »¹
|
||||
//
|
||||
// Links:
|
||||
// 1) https://core.telegram.org/api/files#image-thumbnail-types
|
||||
GetType() (value string)
|
||||
}
|
||||
|
||||
// DecodePhotoSize implements binary de-serialization for PhotoSizeClass.
|
||||
func DecodePhotoSize(buf *bin.Buffer) (PhotoSizeClass, error) {
|
||||
id, err := buf.PeekID()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
switch id {
|
||||
case PhotoSizeEmptyTypeID:
|
||||
// Decoding photoSizeEmpty#e17e23c.
|
||||
v := PhotoSizeEmpty{}
|
||||
if err := v.Decode(buf); err != nil {
|
||||
return nil, fmt.Errorf("unable to decode PhotoSizeClass: %w", err)
|
||||
}
|
||||
return &v, nil
|
||||
case PhotoSizeTypeID:
|
||||
// Decoding photoSize#77bfb61b.
|
||||
v := PhotoSize{}
|
||||
if err := v.Decode(buf); err != nil {
|
||||
return nil, fmt.Errorf("unable to decode PhotoSizeClass: %w", err)
|
||||
}
|
||||
return &v, nil
|
||||
case PhotoCachedSizeTypeID:
|
||||
// Decoding photoCachedSize#e9a734fa.
|
||||
v := PhotoCachedSize{}
|
||||
if err := v.Decode(buf); err != nil {
|
||||
return nil, fmt.Errorf("unable to decode PhotoSizeClass: %w", err)
|
||||
}
|
||||
return &v, nil
|
||||
default:
|
||||
return nil, fmt.Errorf("unable to decode PhotoSizeClass: %w", bin.NewUnexpectedID(id))
|
||||
}
|
||||
}
|
||||
|
||||
// PhotoSize boxes the PhotoSizeClass providing a helper.
|
||||
type PhotoSizeBox struct {
|
||||
PhotoSize PhotoSizeClass
|
||||
}
|
||||
|
||||
// Decode implements bin.Decoder for PhotoSizeBox.
|
||||
func (b *PhotoSizeBox) Decode(buf *bin.Buffer) error {
|
||||
if b == nil {
|
||||
return fmt.Errorf("unable to decode PhotoSizeBox to nil")
|
||||
}
|
||||
v, err := DecodePhotoSize(buf)
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode boxed value: %w", err)
|
||||
}
|
||||
b.PhotoSize = v
|
||||
return nil
|
||||
}
|
||||
|
||||
// Encode implements bin.Encode for PhotoSizeBox.
|
||||
func (b *PhotoSizeBox) Encode(buf *bin.Buffer) error {
|
||||
if b == nil || b.PhotoSize == nil {
|
||||
return fmt.Errorf("unable to encode PhotoSizeClass as nil")
|
||||
}
|
||||
return b.PhotoSize.Encode(buf)
|
||||
}
|
||||
@@ -0,0 +1,444 @@
|
||||
// Code generated by gotdgen, DO NOT EDIT.
|
||||
|
||||
package e2e
|
||||
|
||||
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{}
|
||||
)
|
||||
|
||||
// TypesMap returns mapping from type ids to TL type names.
|
||||
func TypesMap() map[uint32]string {
|
||||
return map[uint32]string{
|
||||
IntTypeID: "int#a8509bda",
|
||||
LongTypeID: "long#22076cba",
|
||||
DoubleTypeID: "double#2210c154",
|
||||
StringTypeID: "string#b5286e24",
|
||||
BytesTypeID: "bytes#e937bb82",
|
||||
BoolFalseTypeID: "boolFalse#bc799737",
|
||||
BoolTrueTypeID: "boolTrue#997275b5",
|
||||
TrueTypeID: "true#3fedd339",
|
||||
DecryptedMessage8TypeID: "decryptedMessage8#1f814f1f",
|
||||
DecryptedMessageService8TypeID: "decryptedMessageService8#aa48327d",
|
||||
DecryptedMessageMediaEmptyTypeID: "decryptedMessageMediaEmpty#89f5c4a",
|
||||
DecryptedMessageMediaPhoto8TypeID: "decryptedMessageMediaPhoto8#32798a8c",
|
||||
DecryptedMessageMediaVideo8TypeID: "decryptedMessageMediaVideo8#4cee6ef3",
|
||||
DecryptedMessageMediaGeoPointTypeID: "decryptedMessageMediaGeoPoint#35480a59",
|
||||
DecryptedMessageMediaContactTypeID: "decryptedMessageMediaContact#588a0a97",
|
||||
DecryptedMessageActionSetMessageTTLTypeID: "decryptedMessageActionSetMessageTTL#a1733aec",
|
||||
DecryptedMessageMediaDocument8TypeID: "decryptedMessageMediaDocument8#b095434b",
|
||||
DecryptedMessageMediaAudio8TypeID: "decryptedMessageMediaAudio8#6080758f",
|
||||
DecryptedMessageActionReadMessagesTypeID: "decryptedMessageActionReadMessages#c4f40be",
|
||||
DecryptedMessageActionDeleteMessagesTypeID: "decryptedMessageActionDeleteMessages#65614304",
|
||||
DecryptedMessageActionScreenshotMessagesTypeID: "decryptedMessageActionScreenshotMessages#8ac1f475",
|
||||
DecryptedMessageActionFlushHistoryTypeID: "decryptedMessageActionFlushHistory#6719e45c",
|
||||
DecryptedMessage23TypeID: "decryptedMessage23#204d3878",
|
||||
DecryptedMessageServiceTypeID: "decryptedMessageService#73164160",
|
||||
DecryptedMessageMediaVideo23TypeID: "decryptedMessageMediaVideo23#524a415d",
|
||||
DecryptedMessageMediaAudioTypeID: "decryptedMessageMediaAudio#57e0a9cb",
|
||||
DecryptedMessageLayerTypeID: "decryptedMessageLayer#1be31789",
|
||||
SendMessageTypingActionTypeID: "sendMessageTypingAction#16bf744e",
|
||||
SendMessageCancelActionTypeID: "sendMessageCancelAction#fd5ec8f5",
|
||||
SendMessageRecordVideoActionTypeID: "sendMessageRecordVideoAction#a187d66f",
|
||||
SendMessageUploadVideoActionTypeID: "sendMessageUploadVideoAction#92042ff7",
|
||||
SendMessageRecordAudioActionTypeID: "sendMessageRecordAudioAction#d52f73f7",
|
||||
SendMessageUploadAudioActionTypeID: "sendMessageUploadAudioAction#e6ac8a6f",
|
||||
SendMessageUploadPhotoActionTypeID: "sendMessageUploadPhotoAction#990a3c1a",
|
||||
SendMessageUploadDocumentActionTypeID: "sendMessageUploadDocumentAction#8faee98e",
|
||||
SendMessageGeoLocationActionTypeID: "sendMessageGeoLocationAction#176f8ba1",
|
||||
SendMessageChooseContactActionTypeID: "sendMessageChooseContactAction#628cbc6f",
|
||||
DecryptedMessageActionResendTypeID: "decryptedMessageActionResend#511110b0",
|
||||
DecryptedMessageActionNotifyLayerTypeID: "decryptedMessageActionNotifyLayer#f3048883",
|
||||
DecryptedMessageActionTypingTypeID: "decryptedMessageActionTyping#ccb27641",
|
||||
DecryptedMessageActionRequestKeyTypeID: "decryptedMessageActionRequestKey#f3c9611b",
|
||||
DecryptedMessageActionAcceptKeyTypeID: "decryptedMessageActionAcceptKey#6fe1735b",
|
||||
DecryptedMessageActionAbortKeyTypeID: "decryptedMessageActionAbortKey#dd05ec6b",
|
||||
DecryptedMessageActionCommitKeyTypeID: "decryptedMessageActionCommitKey#ec2e0b9b",
|
||||
DecryptedMessageActionNoopTypeID: "decryptedMessageActionNoop#a82fdd63",
|
||||
DocumentAttributeImageSizeTypeID: "documentAttributeImageSize#6c37c15c",
|
||||
DocumentAttributeAnimatedTypeID: "documentAttributeAnimated#11b58939",
|
||||
DocumentAttributeSticker23TypeID: "documentAttributeSticker23#fb0a5727",
|
||||
DocumentAttributeVideo23TypeID: "documentAttributeVideo23#5910cccb",
|
||||
DocumentAttributeAudio23TypeID: "documentAttributeAudio23#51448e5",
|
||||
DocumentAttributeFilenameTypeID: "documentAttributeFilename#15590068",
|
||||
PhotoSizeEmptyTypeID: "photoSizeEmpty#e17e23c",
|
||||
PhotoSizeTypeID: "photoSize#77bfb61b",
|
||||
PhotoCachedSizeTypeID: "photoCachedSize#e9a734fa",
|
||||
FileLocationUnavailableTypeID: "fileLocationUnavailable#7c596b46",
|
||||
FileLocationTypeID: "fileLocation#53d69076",
|
||||
DecryptedMessageMediaExternalDocumentTypeID: "decryptedMessageMediaExternalDocument#fa95b0dd",
|
||||
DocumentAttributeAudio45TypeID: "documentAttributeAudio45#ded218e0",
|
||||
DecryptedMessage46TypeID: "decryptedMessage46#36b091de",
|
||||
DecryptedMessageMediaPhotoTypeID: "decryptedMessageMediaPhoto#f1fa8d78",
|
||||
DecryptedMessageMediaVideoTypeID: "decryptedMessageMediaVideo#970c8c0e",
|
||||
DecryptedMessageMediaDocument46TypeID: "decryptedMessageMediaDocument46#7afe8ae2",
|
||||
DocumentAttributeStickerTypeID: "documentAttributeSticker#3a556302",
|
||||
DocumentAttributeAudioTypeID: "documentAttributeAudio#9852f9c6",
|
||||
MessageEntityUnknownTypeID: "messageEntityUnknown#bb92ba95",
|
||||
MessageEntityMentionTypeID: "messageEntityMention#fa04579d",
|
||||
MessageEntityHashtagTypeID: "messageEntityHashtag#6f635b0d",
|
||||
MessageEntityBotCommandTypeID: "messageEntityBotCommand#6cef8ac7",
|
||||
MessageEntityURLTypeID: "messageEntityUrl#6ed02538",
|
||||
MessageEntityEmailTypeID: "messageEntityEmail#64e475c2",
|
||||
MessageEntityBoldTypeID: "messageEntityBold#bd610bc9",
|
||||
MessageEntityItalicTypeID: "messageEntityItalic#826f8b60",
|
||||
MessageEntityCodeTypeID: "messageEntityCode#28a20571",
|
||||
MessageEntityPreTypeID: "messageEntityPre#73924be0",
|
||||
MessageEntityTextURLTypeID: "messageEntityTextUrl#76a6d327",
|
||||
MessageEntityMentionNameTypeID: "messageEntityMentionName#352dca58",
|
||||
MessageEntityPhoneTypeID: "messageEntityPhone#9b69e34b",
|
||||
MessageEntityCashtagTypeID: "messageEntityCashtag#4c4e743f",
|
||||
MessageEntityBankCardTypeID: "messageEntityBankCard#761e6af4",
|
||||
InputStickerSetShortNameTypeID: "inputStickerSetShortName#861cc8a0",
|
||||
InputStickerSetEmptyTypeID: "inputStickerSetEmpty#ffb62b95",
|
||||
DecryptedMessageMediaVenueTypeID: "decryptedMessageMediaVenue#8a0df56f",
|
||||
DecryptedMessageMediaWebPageTypeID: "decryptedMessageMediaWebPage#e50511d8",
|
||||
SendMessageRecordRoundActionTypeID: "sendMessageRecordRoundAction#88f27fbc",
|
||||
SendMessageUploadRoundActionTypeID: "sendMessageUploadRoundAction#bb718624",
|
||||
DocumentAttributeVideoTypeID: "documentAttributeVideo#ef02ce6",
|
||||
DecryptedMessageTypeID: "decryptedMessage#91cc4674",
|
||||
MessageEntityUnderlineTypeID: "messageEntityUnderline#9c4e7e8b",
|
||||
MessageEntityStrikeTypeID: "messageEntityStrike#bf0693d4",
|
||||
MessageEntityBlockquoteTypeID: "messageEntityBlockquote#20df5d0",
|
||||
DecryptedMessageMediaDocumentTypeID: "decryptedMessageMediaDocument#6abd9782",
|
||||
MessageEntitySpoilerTypeID: "messageEntitySpoiler#32ca960f",
|
||||
MessageEntityCustomEmojiTypeID: "messageEntityCustomEmoji#c8cf05f8",
|
||||
TestDummyFunctionRequestTypeID: "test.dummyFunction#c8357709",
|
||||
}
|
||||
}
|
||||
|
||||
// NamesMap returns mapping from type names to TL type ids.
|
||||
func NamesMap() map[string]uint32 {
|
||||
return map[string]uint32{
|
||||
"int": IntTypeID,
|
||||
"long": LongTypeID,
|
||||
"double": DoubleTypeID,
|
||||
"string": StringTypeID,
|
||||
"bytes": BytesTypeID,
|
||||
"boolFalse": BoolFalseTypeID,
|
||||
"boolTrue": BoolTrueTypeID,
|
||||
"true": TrueTypeID,
|
||||
"decryptedMessage8": DecryptedMessage8TypeID,
|
||||
"decryptedMessageService8": DecryptedMessageService8TypeID,
|
||||
"decryptedMessageMediaEmpty": DecryptedMessageMediaEmptyTypeID,
|
||||
"decryptedMessageMediaPhoto8": DecryptedMessageMediaPhoto8TypeID,
|
||||
"decryptedMessageMediaVideo8": DecryptedMessageMediaVideo8TypeID,
|
||||
"decryptedMessageMediaGeoPoint": DecryptedMessageMediaGeoPointTypeID,
|
||||
"decryptedMessageMediaContact": DecryptedMessageMediaContactTypeID,
|
||||
"decryptedMessageActionSetMessageTTL": DecryptedMessageActionSetMessageTTLTypeID,
|
||||
"decryptedMessageMediaDocument8": DecryptedMessageMediaDocument8TypeID,
|
||||
"decryptedMessageMediaAudio8": DecryptedMessageMediaAudio8TypeID,
|
||||
"decryptedMessageActionReadMessages": DecryptedMessageActionReadMessagesTypeID,
|
||||
"decryptedMessageActionDeleteMessages": DecryptedMessageActionDeleteMessagesTypeID,
|
||||
"decryptedMessageActionScreenshotMessages": DecryptedMessageActionScreenshotMessagesTypeID,
|
||||
"decryptedMessageActionFlushHistory": DecryptedMessageActionFlushHistoryTypeID,
|
||||
"decryptedMessage23": DecryptedMessage23TypeID,
|
||||
"decryptedMessageService": DecryptedMessageServiceTypeID,
|
||||
"decryptedMessageMediaVideo23": DecryptedMessageMediaVideo23TypeID,
|
||||
"decryptedMessageMediaAudio": DecryptedMessageMediaAudioTypeID,
|
||||
"decryptedMessageLayer": DecryptedMessageLayerTypeID,
|
||||
"sendMessageTypingAction": SendMessageTypingActionTypeID,
|
||||
"sendMessageCancelAction": SendMessageCancelActionTypeID,
|
||||
"sendMessageRecordVideoAction": SendMessageRecordVideoActionTypeID,
|
||||
"sendMessageUploadVideoAction": SendMessageUploadVideoActionTypeID,
|
||||
"sendMessageRecordAudioAction": SendMessageRecordAudioActionTypeID,
|
||||
"sendMessageUploadAudioAction": SendMessageUploadAudioActionTypeID,
|
||||
"sendMessageUploadPhotoAction": SendMessageUploadPhotoActionTypeID,
|
||||
"sendMessageUploadDocumentAction": SendMessageUploadDocumentActionTypeID,
|
||||
"sendMessageGeoLocationAction": SendMessageGeoLocationActionTypeID,
|
||||
"sendMessageChooseContactAction": SendMessageChooseContactActionTypeID,
|
||||
"decryptedMessageActionResend": DecryptedMessageActionResendTypeID,
|
||||
"decryptedMessageActionNotifyLayer": DecryptedMessageActionNotifyLayerTypeID,
|
||||
"decryptedMessageActionTyping": DecryptedMessageActionTypingTypeID,
|
||||
"decryptedMessageActionRequestKey": DecryptedMessageActionRequestKeyTypeID,
|
||||
"decryptedMessageActionAcceptKey": DecryptedMessageActionAcceptKeyTypeID,
|
||||
"decryptedMessageActionAbortKey": DecryptedMessageActionAbortKeyTypeID,
|
||||
"decryptedMessageActionCommitKey": DecryptedMessageActionCommitKeyTypeID,
|
||||
"decryptedMessageActionNoop": DecryptedMessageActionNoopTypeID,
|
||||
"documentAttributeImageSize": DocumentAttributeImageSizeTypeID,
|
||||
"documentAttributeAnimated": DocumentAttributeAnimatedTypeID,
|
||||
"documentAttributeSticker23": DocumentAttributeSticker23TypeID,
|
||||
"documentAttributeVideo23": DocumentAttributeVideo23TypeID,
|
||||
"documentAttributeAudio23": DocumentAttributeAudio23TypeID,
|
||||
"documentAttributeFilename": DocumentAttributeFilenameTypeID,
|
||||
"photoSizeEmpty": PhotoSizeEmptyTypeID,
|
||||
"photoSize": PhotoSizeTypeID,
|
||||
"photoCachedSize": PhotoCachedSizeTypeID,
|
||||
"fileLocationUnavailable": FileLocationUnavailableTypeID,
|
||||
"fileLocation": FileLocationTypeID,
|
||||
"decryptedMessageMediaExternalDocument": DecryptedMessageMediaExternalDocumentTypeID,
|
||||
"documentAttributeAudio45": DocumentAttributeAudio45TypeID,
|
||||
"decryptedMessage46": DecryptedMessage46TypeID,
|
||||
"decryptedMessageMediaPhoto": DecryptedMessageMediaPhotoTypeID,
|
||||
"decryptedMessageMediaVideo": DecryptedMessageMediaVideoTypeID,
|
||||
"decryptedMessageMediaDocument46": DecryptedMessageMediaDocument46TypeID,
|
||||
"documentAttributeSticker": DocumentAttributeStickerTypeID,
|
||||
"documentAttributeAudio": DocumentAttributeAudioTypeID,
|
||||
"messageEntityUnknown": MessageEntityUnknownTypeID,
|
||||
"messageEntityMention": MessageEntityMentionTypeID,
|
||||
"messageEntityHashtag": MessageEntityHashtagTypeID,
|
||||
"messageEntityBotCommand": MessageEntityBotCommandTypeID,
|
||||
"messageEntityUrl": MessageEntityURLTypeID,
|
||||
"messageEntityEmail": MessageEntityEmailTypeID,
|
||||
"messageEntityBold": MessageEntityBoldTypeID,
|
||||
"messageEntityItalic": MessageEntityItalicTypeID,
|
||||
"messageEntityCode": MessageEntityCodeTypeID,
|
||||
"messageEntityPre": MessageEntityPreTypeID,
|
||||
"messageEntityTextUrl": MessageEntityTextURLTypeID,
|
||||
"messageEntityMentionName": MessageEntityMentionNameTypeID,
|
||||
"messageEntityPhone": MessageEntityPhoneTypeID,
|
||||
"messageEntityCashtag": MessageEntityCashtagTypeID,
|
||||
"messageEntityBankCard": MessageEntityBankCardTypeID,
|
||||
"inputStickerSetShortName": InputStickerSetShortNameTypeID,
|
||||
"inputStickerSetEmpty": InputStickerSetEmptyTypeID,
|
||||
"decryptedMessageMediaVenue": DecryptedMessageMediaVenueTypeID,
|
||||
"decryptedMessageMediaWebPage": DecryptedMessageMediaWebPageTypeID,
|
||||
"sendMessageRecordRoundAction": SendMessageRecordRoundActionTypeID,
|
||||
"sendMessageUploadRoundAction": SendMessageUploadRoundActionTypeID,
|
||||
"documentAttributeVideo": DocumentAttributeVideoTypeID,
|
||||
"decryptedMessage": DecryptedMessageTypeID,
|
||||
"messageEntityUnderline": MessageEntityUnderlineTypeID,
|
||||
"messageEntityStrike": MessageEntityStrikeTypeID,
|
||||
"messageEntityBlockquote": MessageEntityBlockquoteTypeID,
|
||||
"decryptedMessageMediaDocument": DecryptedMessageMediaDocumentTypeID,
|
||||
"messageEntitySpoiler": MessageEntitySpoilerTypeID,
|
||||
"messageEntityCustomEmoji": MessageEntityCustomEmojiTypeID,
|
||||
"test.dummyFunction": TestDummyFunctionRequestTypeID,
|
||||
}
|
||||
}
|
||||
|
||||
// TypesConstructorMap maps type ids to constructors.
|
||||
func TypesConstructorMap() map[uint32]func() bin.Object {
|
||||
return map[uint32]func() bin.Object{
|
||||
IntTypeID: func() bin.Object { return &Int{} },
|
||||
LongTypeID: func() bin.Object { return &Long{} },
|
||||
DoubleTypeID: func() bin.Object { return &Double{} },
|
||||
StringTypeID: func() bin.Object { return &String{} },
|
||||
BytesTypeID: func() bin.Object { return &Bytes{} },
|
||||
BoolFalseTypeID: func() bin.Object { return &BoolFalse{} },
|
||||
BoolTrueTypeID: func() bin.Object { return &BoolTrue{} },
|
||||
TrueTypeID: func() bin.Object { return &True{} },
|
||||
DecryptedMessage8TypeID: func() bin.Object { return &DecryptedMessage8{} },
|
||||
DecryptedMessageService8TypeID: func() bin.Object { return &DecryptedMessageService8{} },
|
||||
DecryptedMessageMediaEmptyTypeID: func() bin.Object { return &DecryptedMessageMediaEmpty{} },
|
||||
DecryptedMessageMediaPhoto8TypeID: func() bin.Object { return &DecryptedMessageMediaPhoto8{} },
|
||||
DecryptedMessageMediaVideo8TypeID: func() bin.Object { return &DecryptedMessageMediaVideo8{} },
|
||||
DecryptedMessageMediaGeoPointTypeID: func() bin.Object { return &DecryptedMessageMediaGeoPoint{} },
|
||||
DecryptedMessageMediaContactTypeID: func() bin.Object { return &DecryptedMessageMediaContact{} },
|
||||
DecryptedMessageActionSetMessageTTLTypeID: func() bin.Object { return &DecryptedMessageActionSetMessageTTL{} },
|
||||
DecryptedMessageMediaDocument8TypeID: func() bin.Object { return &DecryptedMessageMediaDocument8{} },
|
||||
DecryptedMessageMediaAudio8TypeID: func() bin.Object { return &DecryptedMessageMediaAudio8{} },
|
||||
DecryptedMessageActionReadMessagesTypeID: func() bin.Object { return &DecryptedMessageActionReadMessages{} },
|
||||
DecryptedMessageActionDeleteMessagesTypeID: func() bin.Object { return &DecryptedMessageActionDeleteMessages{} },
|
||||
DecryptedMessageActionScreenshotMessagesTypeID: func() bin.Object { return &DecryptedMessageActionScreenshotMessages{} },
|
||||
DecryptedMessageActionFlushHistoryTypeID: func() bin.Object { return &DecryptedMessageActionFlushHistory{} },
|
||||
DecryptedMessage23TypeID: func() bin.Object { return &DecryptedMessage23{} },
|
||||
DecryptedMessageServiceTypeID: func() bin.Object { return &DecryptedMessageService{} },
|
||||
DecryptedMessageMediaVideo23TypeID: func() bin.Object { return &DecryptedMessageMediaVideo23{} },
|
||||
DecryptedMessageMediaAudioTypeID: func() bin.Object { return &DecryptedMessageMediaAudio{} },
|
||||
DecryptedMessageLayerTypeID: func() bin.Object { return &DecryptedMessageLayer{} },
|
||||
SendMessageTypingActionTypeID: func() bin.Object { return &SendMessageTypingAction{} },
|
||||
SendMessageCancelActionTypeID: func() bin.Object { return &SendMessageCancelAction{} },
|
||||
SendMessageRecordVideoActionTypeID: func() bin.Object { return &SendMessageRecordVideoAction{} },
|
||||
SendMessageUploadVideoActionTypeID: func() bin.Object { return &SendMessageUploadVideoAction{} },
|
||||
SendMessageRecordAudioActionTypeID: func() bin.Object { return &SendMessageRecordAudioAction{} },
|
||||
SendMessageUploadAudioActionTypeID: func() bin.Object { return &SendMessageUploadAudioAction{} },
|
||||
SendMessageUploadPhotoActionTypeID: func() bin.Object { return &SendMessageUploadPhotoAction{} },
|
||||
SendMessageUploadDocumentActionTypeID: func() bin.Object { return &SendMessageUploadDocumentAction{} },
|
||||
SendMessageGeoLocationActionTypeID: func() bin.Object { return &SendMessageGeoLocationAction{} },
|
||||
SendMessageChooseContactActionTypeID: func() bin.Object { return &SendMessageChooseContactAction{} },
|
||||
DecryptedMessageActionResendTypeID: func() bin.Object { return &DecryptedMessageActionResend{} },
|
||||
DecryptedMessageActionNotifyLayerTypeID: func() bin.Object { return &DecryptedMessageActionNotifyLayer{} },
|
||||
DecryptedMessageActionTypingTypeID: func() bin.Object { return &DecryptedMessageActionTyping{} },
|
||||
DecryptedMessageActionRequestKeyTypeID: func() bin.Object { return &DecryptedMessageActionRequestKey{} },
|
||||
DecryptedMessageActionAcceptKeyTypeID: func() bin.Object { return &DecryptedMessageActionAcceptKey{} },
|
||||
DecryptedMessageActionAbortKeyTypeID: func() bin.Object { return &DecryptedMessageActionAbortKey{} },
|
||||
DecryptedMessageActionCommitKeyTypeID: func() bin.Object { return &DecryptedMessageActionCommitKey{} },
|
||||
DecryptedMessageActionNoopTypeID: func() bin.Object { return &DecryptedMessageActionNoop{} },
|
||||
DocumentAttributeImageSizeTypeID: func() bin.Object { return &DocumentAttributeImageSize{} },
|
||||
DocumentAttributeAnimatedTypeID: func() bin.Object { return &DocumentAttributeAnimated{} },
|
||||
DocumentAttributeSticker23TypeID: func() bin.Object { return &DocumentAttributeSticker23{} },
|
||||
DocumentAttributeVideo23TypeID: func() bin.Object { return &DocumentAttributeVideo23{} },
|
||||
DocumentAttributeAudio23TypeID: func() bin.Object { return &DocumentAttributeAudio23{} },
|
||||
DocumentAttributeFilenameTypeID: func() bin.Object { return &DocumentAttributeFilename{} },
|
||||
PhotoSizeEmptyTypeID: func() bin.Object { return &PhotoSizeEmpty{} },
|
||||
PhotoSizeTypeID: func() bin.Object { return &PhotoSize{} },
|
||||
PhotoCachedSizeTypeID: func() bin.Object { return &PhotoCachedSize{} },
|
||||
FileLocationUnavailableTypeID: func() bin.Object { return &FileLocationUnavailable{} },
|
||||
FileLocationTypeID: func() bin.Object { return &FileLocation{} },
|
||||
DecryptedMessageMediaExternalDocumentTypeID: func() bin.Object { return &DecryptedMessageMediaExternalDocument{} },
|
||||
DocumentAttributeAudio45TypeID: func() bin.Object { return &DocumentAttributeAudio45{} },
|
||||
DecryptedMessage46TypeID: func() bin.Object { return &DecryptedMessage46{} },
|
||||
DecryptedMessageMediaPhotoTypeID: func() bin.Object { return &DecryptedMessageMediaPhoto{} },
|
||||
DecryptedMessageMediaVideoTypeID: func() bin.Object { return &DecryptedMessageMediaVideo{} },
|
||||
DecryptedMessageMediaDocument46TypeID: func() bin.Object { return &DecryptedMessageMediaDocument46{} },
|
||||
DocumentAttributeStickerTypeID: func() bin.Object { return &DocumentAttributeSticker{} },
|
||||
DocumentAttributeAudioTypeID: func() bin.Object { return &DocumentAttributeAudio{} },
|
||||
MessageEntityUnknownTypeID: func() bin.Object { return &MessageEntityUnknown{} },
|
||||
MessageEntityMentionTypeID: func() bin.Object { return &MessageEntityMention{} },
|
||||
MessageEntityHashtagTypeID: func() bin.Object { return &MessageEntityHashtag{} },
|
||||
MessageEntityBotCommandTypeID: func() bin.Object { return &MessageEntityBotCommand{} },
|
||||
MessageEntityURLTypeID: func() bin.Object { return &MessageEntityURL{} },
|
||||
MessageEntityEmailTypeID: func() bin.Object { return &MessageEntityEmail{} },
|
||||
MessageEntityBoldTypeID: func() bin.Object { return &MessageEntityBold{} },
|
||||
MessageEntityItalicTypeID: func() bin.Object { return &MessageEntityItalic{} },
|
||||
MessageEntityCodeTypeID: func() bin.Object { return &MessageEntityCode{} },
|
||||
MessageEntityPreTypeID: func() bin.Object { return &MessageEntityPre{} },
|
||||
MessageEntityTextURLTypeID: func() bin.Object { return &MessageEntityTextURL{} },
|
||||
MessageEntityMentionNameTypeID: func() bin.Object { return &MessageEntityMentionName{} },
|
||||
MessageEntityPhoneTypeID: func() bin.Object { return &MessageEntityPhone{} },
|
||||
MessageEntityCashtagTypeID: func() bin.Object { return &MessageEntityCashtag{} },
|
||||
MessageEntityBankCardTypeID: func() bin.Object { return &MessageEntityBankCard{} },
|
||||
InputStickerSetShortNameTypeID: func() bin.Object { return &InputStickerSetShortName{} },
|
||||
InputStickerSetEmptyTypeID: func() bin.Object { return &InputStickerSetEmpty{} },
|
||||
DecryptedMessageMediaVenueTypeID: func() bin.Object { return &DecryptedMessageMediaVenue{} },
|
||||
DecryptedMessageMediaWebPageTypeID: func() bin.Object { return &DecryptedMessageMediaWebPage{} },
|
||||
SendMessageRecordRoundActionTypeID: func() bin.Object { return &SendMessageRecordRoundAction{} },
|
||||
SendMessageUploadRoundActionTypeID: func() bin.Object { return &SendMessageUploadRoundAction{} },
|
||||
DocumentAttributeVideoTypeID: func() bin.Object { return &DocumentAttributeVideo{} },
|
||||
DecryptedMessageTypeID: func() bin.Object { return &DecryptedMessage{} },
|
||||
MessageEntityUnderlineTypeID: func() bin.Object { return &MessageEntityUnderline{} },
|
||||
MessageEntityStrikeTypeID: func() bin.Object { return &MessageEntityStrike{} },
|
||||
MessageEntityBlockquoteTypeID: func() bin.Object { return &MessageEntityBlockquote{} },
|
||||
DecryptedMessageMediaDocumentTypeID: func() bin.Object { return &DecryptedMessageMediaDocument{} },
|
||||
MessageEntitySpoilerTypeID: func() bin.Object { return &MessageEntitySpoiler{} },
|
||||
MessageEntityCustomEmojiTypeID: func() bin.Object { return &MessageEntityCustomEmoji{} },
|
||||
TestDummyFunctionRequestTypeID: func() bin.Object { return &TestDummyFunctionRequest{} },
|
||||
}
|
||||
}
|
||||
|
||||
// ClassConstructorsMap maps class schema name to constructors type ids.
|
||||
func ClassConstructorsMap() map[string][]uint32 {
|
||||
return map[string][]uint32{
|
||||
BoolClassName: {
|
||||
BoolFalseTypeID,
|
||||
BoolTrueTypeID,
|
||||
},
|
||||
DecryptedMessageActionClassName: {
|
||||
DecryptedMessageActionSetMessageTTLTypeID,
|
||||
DecryptedMessageActionReadMessagesTypeID,
|
||||
DecryptedMessageActionDeleteMessagesTypeID,
|
||||
DecryptedMessageActionScreenshotMessagesTypeID,
|
||||
DecryptedMessageActionFlushHistoryTypeID,
|
||||
DecryptedMessageActionResendTypeID,
|
||||
DecryptedMessageActionNotifyLayerTypeID,
|
||||
DecryptedMessageActionTypingTypeID,
|
||||
DecryptedMessageActionRequestKeyTypeID,
|
||||
DecryptedMessageActionAcceptKeyTypeID,
|
||||
DecryptedMessageActionAbortKeyTypeID,
|
||||
DecryptedMessageActionCommitKeyTypeID,
|
||||
DecryptedMessageActionNoopTypeID,
|
||||
},
|
||||
DecryptedMessageClassName: {
|
||||
DecryptedMessage8TypeID,
|
||||
DecryptedMessageService8TypeID,
|
||||
DecryptedMessage23TypeID,
|
||||
DecryptedMessageServiceTypeID,
|
||||
DecryptedMessage46TypeID,
|
||||
DecryptedMessageTypeID,
|
||||
},
|
||||
DecryptedMessageMediaClassName: {
|
||||
DecryptedMessageMediaEmptyTypeID,
|
||||
DecryptedMessageMediaPhoto8TypeID,
|
||||
DecryptedMessageMediaVideo8TypeID,
|
||||
DecryptedMessageMediaGeoPointTypeID,
|
||||
DecryptedMessageMediaContactTypeID,
|
||||
DecryptedMessageMediaDocument8TypeID,
|
||||
DecryptedMessageMediaAudio8TypeID,
|
||||
DecryptedMessageMediaVideo23TypeID,
|
||||
DecryptedMessageMediaAudioTypeID,
|
||||
DecryptedMessageMediaExternalDocumentTypeID,
|
||||
DecryptedMessageMediaPhotoTypeID,
|
||||
DecryptedMessageMediaVideoTypeID,
|
||||
DecryptedMessageMediaDocument46TypeID,
|
||||
DecryptedMessageMediaVenueTypeID,
|
||||
DecryptedMessageMediaWebPageTypeID,
|
||||
DecryptedMessageMediaDocumentTypeID,
|
||||
},
|
||||
DocumentAttributeClassName: {
|
||||
DocumentAttributeImageSizeTypeID,
|
||||
DocumentAttributeAnimatedTypeID,
|
||||
DocumentAttributeSticker23TypeID,
|
||||
DocumentAttributeVideo23TypeID,
|
||||
DocumentAttributeAudio23TypeID,
|
||||
DocumentAttributeFilenameTypeID,
|
||||
DocumentAttributeAudio45TypeID,
|
||||
DocumentAttributeStickerTypeID,
|
||||
DocumentAttributeAudioTypeID,
|
||||
DocumentAttributeVideoTypeID,
|
||||
},
|
||||
FileLocationClassName: {
|
||||
FileLocationUnavailableTypeID,
|
||||
FileLocationTypeID,
|
||||
},
|
||||
InputStickerSetClassName: {
|
||||
InputStickerSetShortNameTypeID,
|
||||
InputStickerSetEmptyTypeID,
|
||||
},
|
||||
MessageEntityClassName: {
|
||||
MessageEntityUnknownTypeID,
|
||||
MessageEntityMentionTypeID,
|
||||
MessageEntityHashtagTypeID,
|
||||
MessageEntityBotCommandTypeID,
|
||||
MessageEntityURLTypeID,
|
||||
MessageEntityEmailTypeID,
|
||||
MessageEntityBoldTypeID,
|
||||
MessageEntityItalicTypeID,
|
||||
MessageEntityCodeTypeID,
|
||||
MessageEntityPreTypeID,
|
||||
MessageEntityTextURLTypeID,
|
||||
MessageEntityMentionNameTypeID,
|
||||
MessageEntityPhoneTypeID,
|
||||
MessageEntityCashtagTypeID,
|
||||
MessageEntityBankCardTypeID,
|
||||
MessageEntityUnderlineTypeID,
|
||||
MessageEntityStrikeTypeID,
|
||||
MessageEntityBlockquoteTypeID,
|
||||
MessageEntitySpoilerTypeID,
|
||||
MessageEntityCustomEmojiTypeID,
|
||||
},
|
||||
PhotoSizeClassName: {
|
||||
PhotoSizeEmptyTypeID,
|
||||
PhotoSizeTypeID,
|
||||
PhotoCachedSizeTypeID,
|
||||
},
|
||||
SendMessageActionClassName: {
|
||||
SendMessageTypingActionTypeID,
|
||||
SendMessageCancelActionTypeID,
|
||||
SendMessageRecordVideoActionTypeID,
|
||||
SendMessageUploadVideoActionTypeID,
|
||||
SendMessageRecordAudioActionTypeID,
|
||||
SendMessageUploadAudioActionTypeID,
|
||||
SendMessageUploadPhotoActionTypeID,
|
||||
SendMessageUploadDocumentActionTypeID,
|
||||
SendMessageGeoLocationActionTypeID,
|
||||
SendMessageChooseContactActionTypeID,
|
||||
SendMessageRecordRoundActionTypeID,
|
||||
SendMessageUploadRoundActionTypeID,
|
||||
},
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,128 @@
|
||||
// Code generated by gotdgen, DO NOT EDIT.
|
||||
|
||||
package e2e
|
||||
|
||||
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{}
|
||||
)
|
||||
|
||||
// String represents TL type `string#b5286e24`.
|
||||
//
|
||||
// See https://core.telegram.org/constructor/string for reference.
|
||||
type String struct {
|
||||
}
|
||||
|
||||
// StringTypeID is TL type id of String.
|
||||
const StringTypeID = 0xb5286e24
|
||||
|
||||
// Ensuring interfaces in compile-time for String.
|
||||
var (
|
||||
_ bin.Encoder = &String{}
|
||||
_ bin.Decoder = &String{}
|
||||
_ bin.BareEncoder = &String{}
|
||||
_ bin.BareDecoder = &String{}
|
||||
)
|
||||
|
||||
func (s *String) Zero() bool {
|
||||
if s == nil {
|
||||
return true
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
// String implements fmt.Stringer.
|
||||
func (s *String) String() string {
|
||||
if s == nil {
|
||||
return "String(nil)"
|
||||
}
|
||||
type Alias String
|
||||
return fmt.Sprintf("String%+v", Alias(*s))
|
||||
}
|
||||
|
||||
// TypeID returns type id in TL schema.
|
||||
//
|
||||
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
||||
func (*String) TypeID() uint32 {
|
||||
return StringTypeID
|
||||
}
|
||||
|
||||
// TypeName returns name of type in TL schema.
|
||||
func (*String) TypeName() string {
|
||||
return "string"
|
||||
}
|
||||
|
||||
// TypeInfo returns info about TL type.
|
||||
func (s *String) TypeInfo() tdp.Type {
|
||||
typ := tdp.Type{
|
||||
Name: "string",
|
||||
ID: StringTypeID,
|
||||
}
|
||||
if s == nil {
|
||||
typ.Null = true
|
||||
return typ
|
||||
}
|
||||
typ.Fields = []tdp.Field{}
|
||||
return typ
|
||||
}
|
||||
|
||||
// Encode implements bin.Encoder.
|
||||
func (s *String) Encode(b *bin.Buffer) error {
|
||||
if s == nil {
|
||||
return fmt.Errorf("can't encode string#b5286e24 as nil")
|
||||
}
|
||||
b.PutID(StringTypeID)
|
||||
return s.EncodeBare(b)
|
||||
}
|
||||
|
||||
// EncodeBare implements bin.BareEncoder.
|
||||
func (s *String) EncodeBare(b *bin.Buffer) error {
|
||||
if s == nil {
|
||||
return fmt.Errorf("can't encode string#b5286e24 as nil")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Decode implements bin.Decoder.
|
||||
func (s *String) Decode(b *bin.Buffer) error {
|
||||
if s == nil {
|
||||
return fmt.Errorf("can't decode string#b5286e24 to nil")
|
||||
}
|
||||
if err := b.ConsumeID(StringTypeID); err != nil {
|
||||
return fmt.Errorf("unable to decode string#b5286e24: %w", err)
|
||||
}
|
||||
return s.DecodeBare(b)
|
||||
}
|
||||
|
||||
// DecodeBare implements bin.BareDecoder.
|
||||
func (s *String) DecodeBare(b *bin.Buffer) error {
|
||||
if s == nil {
|
||||
return fmt.Errorf("can't decode string#b5286e24 to nil")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
@@ -0,0 +1,142 @@
|
||||
// Code generated by gotdgen, DO NOT EDIT.
|
||||
|
||||
package e2e
|
||||
|
||||
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{}
|
||||
)
|
||||
|
||||
// TestDummyFunctionRequest represents TL type `test.dummyFunction#c8357709`.
|
||||
//
|
||||
// See https://core.telegram.org/method/test.dummyFunction for reference.
|
||||
type TestDummyFunctionRequest struct {
|
||||
}
|
||||
|
||||
// TestDummyFunctionRequestTypeID is TL type id of TestDummyFunctionRequest.
|
||||
const TestDummyFunctionRequestTypeID = 0xc8357709
|
||||
|
||||
// Ensuring interfaces in compile-time for TestDummyFunctionRequest.
|
||||
var (
|
||||
_ bin.Encoder = &TestDummyFunctionRequest{}
|
||||
_ bin.Decoder = &TestDummyFunctionRequest{}
|
||||
_ bin.BareEncoder = &TestDummyFunctionRequest{}
|
||||
_ bin.BareDecoder = &TestDummyFunctionRequest{}
|
||||
)
|
||||
|
||||
func (d *TestDummyFunctionRequest) Zero() bool {
|
||||
if d == nil {
|
||||
return true
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
// String implements fmt.Stringer.
|
||||
func (d *TestDummyFunctionRequest) String() string {
|
||||
if d == nil {
|
||||
return "TestDummyFunctionRequest(nil)"
|
||||
}
|
||||
type Alias TestDummyFunctionRequest
|
||||
return fmt.Sprintf("TestDummyFunctionRequest%+v", Alias(*d))
|
||||
}
|
||||
|
||||
// TypeID returns type id in TL schema.
|
||||
//
|
||||
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
||||
func (*TestDummyFunctionRequest) TypeID() uint32 {
|
||||
return TestDummyFunctionRequestTypeID
|
||||
}
|
||||
|
||||
// TypeName returns name of type in TL schema.
|
||||
func (*TestDummyFunctionRequest) TypeName() string {
|
||||
return "test.dummyFunction"
|
||||
}
|
||||
|
||||
// TypeInfo returns info about TL type.
|
||||
func (d *TestDummyFunctionRequest) TypeInfo() tdp.Type {
|
||||
typ := tdp.Type{
|
||||
Name: "test.dummyFunction",
|
||||
ID: TestDummyFunctionRequestTypeID,
|
||||
}
|
||||
if d == nil {
|
||||
typ.Null = true
|
||||
return typ
|
||||
}
|
||||
typ.Fields = []tdp.Field{}
|
||||
return typ
|
||||
}
|
||||
|
||||
// Encode implements bin.Encoder.
|
||||
func (d *TestDummyFunctionRequest) Encode(b *bin.Buffer) error {
|
||||
if d == nil {
|
||||
return fmt.Errorf("can't encode test.dummyFunction#c8357709 as nil")
|
||||
}
|
||||
b.PutID(TestDummyFunctionRequestTypeID)
|
||||
return d.EncodeBare(b)
|
||||
}
|
||||
|
||||
// EncodeBare implements bin.BareEncoder.
|
||||
func (d *TestDummyFunctionRequest) EncodeBare(b *bin.Buffer) error {
|
||||
if d == nil {
|
||||
return fmt.Errorf("can't encode test.dummyFunction#c8357709 as nil")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Decode implements bin.Decoder.
|
||||
func (d *TestDummyFunctionRequest) Decode(b *bin.Buffer) error {
|
||||
if d == nil {
|
||||
return fmt.Errorf("can't decode test.dummyFunction#c8357709 to nil")
|
||||
}
|
||||
if err := b.ConsumeID(TestDummyFunctionRequestTypeID); err != nil {
|
||||
return fmt.Errorf("unable to decode test.dummyFunction#c8357709: %w", err)
|
||||
}
|
||||
return d.DecodeBare(b)
|
||||
}
|
||||
|
||||
// DecodeBare implements bin.BareDecoder.
|
||||
func (d *TestDummyFunctionRequest) DecodeBare(b *bin.Buffer) error {
|
||||
if d == nil {
|
||||
return fmt.Errorf("can't decode test.dummyFunction#c8357709 to nil")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// TestDummyFunction invokes method test.dummyFunction#c8357709 returning error if any.
|
||||
//
|
||||
// See https://core.telegram.org/method/test.dummyFunction for reference.
|
||||
func (c *Client) TestDummyFunction(ctx context.Context) (bool, error) {
|
||||
var result BoolBox
|
||||
|
||||
request := &TestDummyFunctionRequest{}
|
||||
if err := c.rpc.Invoke(ctx, request, &result); err != nil {
|
||||
return false, err
|
||||
}
|
||||
_, ok := result.Bool.(*BoolTrue)
|
||||
return ok, nil
|
||||
}
|
||||
@@ -0,0 +1,132 @@
|
||||
// Code generated by gotdgen, DO NOT EDIT.
|
||||
|
||||
package e2e
|
||||
|
||||
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{}
|
||||
)
|
||||
|
||||
// True represents TL type `true#3fedd339`.
|
||||
// See predefined identifiers¹.
|
||||
//
|
||||
// Links:
|
||||
// 1. https://core.telegram.org/mtproto/TL-formal#predefined-identifiers
|
||||
//
|
||||
// See https://core.telegram.org/constructor/true for reference.
|
||||
type True struct {
|
||||
}
|
||||
|
||||
// TrueTypeID is TL type id of True.
|
||||
const TrueTypeID = 0x3fedd339
|
||||
|
||||
// Ensuring interfaces in compile-time for True.
|
||||
var (
|
||||
_ bin.Encoder = &True{}
|
||||
_ bin.Decoder = &True{}
|
||||
_ bin.BareEncoder = &True{}
|
||||
_ bin.BareDecoder = &True{}
|
||||
)
|
||||
|
||||
func (t *True) Zero() bool {
|
||||
if t == nil {
|
||||
return true
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
// String implements fmt.Stringer.
|
||||
func (t *True) String() string {
|
||||
if t == nil {
|
||||
return "True(nil)"
|
||||
}
|
||||
type Alias True
|
||||
return fmt.Sprintf("True%+v", Alias(*t))
|
||||
}
|
||||
|
||||
// TypeID returns type id in TL schema.
|
||||
//
|
||||
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
||||
func (*True) TypeID() uint32 {
|
||||
return TrueTypeID
|
||||
}
|
||||
|
||||
// TypeName returns name of type in TL schema.
|
||||
func (*True) TypeName() string {
|
||||
return "true"
|
||||
}
|
||||
|
||||
// TypeInfo returns info about TL type.
|
||||
func (t *True) TypeInfo() tdp.Type {
|
||||
typ := tdp.Type{
|
||||
Name: "true",
|
||||
ID: TrueTypeID,
|
||||
}
|
||||
if t == nil {
|
||||
typ.Null = true
|
||||
return typ
|
||||
}
|
||||
typ.Fields = []tdp.Field{}
|
||||
return typ
|
||||
}
|
||||
|
||||
// Encode implements bin.Encoder.
|
||||
func (t *True) Encode(b *bin.Buffer) error {
|
||||
if t == nil {
|
||||
return fmt.Errorf("can't encode true#3fedd339 as nil")
|
||||
}
|
||||
b.PutID(TrueTypeID)
|
||||
return t.EncodeBare(b)
|
||||
}
|
||||
|
||||
// EncodeBare implements bin.BareEncoder.
|
||||
func (t *True) EncodeBare(b *bin.Buffer) error {
|
||||
if t == nil {
|
||||
return fmt.Errorf("can't encode true#3fedd339 as nil")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Decode implements bin.Decoder.
|
||||
func (t *True) Decode(b *bin.Buffer) error {
|
||||
if t == nil {
|
||||
return fmt.Errorf("can't decode true#3fedd339 to nil")
|
||||
}
|
||||
if err := b.ConsumeID(TrueTypeID); err != nil {
|
||||
return fmt.Errorf("unable to decode true#3fedd339: %w", err)
|
||||
}
|
||||
return t.DecodeBare(b)
|
||||
}
|
||||
|
||||
// DecodeBare implements bin.BareDecoder.
|
||||
func (t *True) DecodeBare(b *bin.Buffer) error {
|
||||
if t == nil {
|
||||
return fmt.Errorf("can't decode true#3fedd339 to nil")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
// Package tg contains generated types from MTProto Telegram API.
|
||||
package tg
|
||||
@@ -0,0 +1,238 @@
|
||||
// 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{}
|
||||
)
|
||||
|
||||
// AccessPointRule represents TL type `accessPointRule#4679b65f`.
|
||||
//
|
||||
// See https://core.telegram.org/constructor/accessPointRule for reference.
|
||||
type AccessPointRule struct {
|
||||
// PhonePrefixRules field of AccessPointRule.
|
||||
PhonePrefixRules string
|
||||
// DCID field of AccessPointRule.
|
||||
DCID int
|
||||
// IPs field of AccessPointRule.
|
||||
IPs []IPPortClass
|
||||
}
|
||||
|
||||
// AccessPointRuleTypeID is TL type id of AccessPointRule.
|
||||
const AccessPointRuleTypeID = 0x4679b65f
|
||||
|
||||
// Ensuring interfaces in compile-time for AccessPointRule.
|
||||
var (
|
||||
_ bin.Encoder = &AccessPointRule{}
|
||||
_ bin.Decoder = &AccessPointRule{}
|
||||
_ bin.BareEncoder = &AccessPointRule{}
|
||||
_ bin.BareDecoder = &AccessPointRule{}
|
||||
)
|
||||
|
||||
func (a *AccessPointRule) Zero() bool {
|
||||
if a == nil {
|
||||
return true
|
||||
}
|
||||
if !(a.PhonePrefixRules == "") {
|
||||
return false
|
||||
}
|
||||
if !(a.DCID == 0) {
|
||||
return false
|
||||
}
|
||||
if !(a.IPs == nil) {
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
// String implements fmt.Stringer.
|
||||
func (a *AccessPointRule) String() string {
|
||||
if a == nil {
|
||||
return "AccessPointRule(nil)"
|
||||
}
|
||||
type Alias AccessPointRule
|
||||
return fmt.Sprintf("AccessPointRule%+v", Alias(*a))
|
||||
}
|
||||
|
||||
// FillFrom fills AccessPointRule from given interface.
|
||||
func (a *AccessPointRule) FillFrom(from interface {
|
||||
GetPhonePrefixRules() (value string)
|
||||
GetDCID() (value int)
|
||||
GetIPs() (value []IPPortClass)
|
||||
}) {
|
||||
a.PhonePrefixRules = from.GetPhonePrefixRules()
|
||||
a.DCID = from.GetDCID()
|
||||
a.IPs = from.GetIPs()
|
||||
}
|
||||
|
||||
// TypeID returns type id in TL schema.
|
||||
//
|
||||
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
||||
func (*AccessPointRule) TypeID() uint32 {
|
||||
return AccessPointRuleTypeID
|
||||
}
|
||||
|
||||
// TypeName returns name of type in TL schema.
|
||||
func (*AccessPointRule) TypeName() string {
|
||||
return "accessPointRule"
|
||||
}
|
||||
|
||||
// TypeInfo returns info about TL type.
|
||||
func (a *AccessPointRule) TypeInfo() tdp.Type {
|
||||
typ := tdp.Type{
|
||||
Name: "accessPointRule",
|
||||
ID: AccessPointRuleTypeID,
|
||||
}
|
||||
if a == nil {
|
||||
typ.Null = true
|
||||
return typ
|
||||
}
|
||||
typ.Fields = []tdp.Field{
|
||||
{
|
||||
Name: "PhonePrefixRules",
|
||||
SchemaName: "phone_prefix_rules",
|
||||
},
|
||||
{
|
||||
Name: "DCID",
|
||||
SchemaName: "dc_id",
|
||||
},
|
||||
{
|
||||
Name: "IPs",
|
||||
SchemaName: "ips",
|
||||
},
|
||||
}
|
||||
return typ
|
||||
}
|
||||
|
||||
// Encode implements bin.Encoder.
|
||||
func (a *AccessPointRule) Encode(b *bin.Buffer) error {
|
||||
if a == nil {
|
||||
return fmt.Errorf("can't encode accessPointRule#4679b65f as nil")
|
||||
}
|
||||
b.PutID(AccessPointRuleTypeID)
|
||||
return a.EncodeBare(b)
|
||||
}
|
||||
|
||||
// EncodeBare implements bin.BareEncoder.
|
||||
func (a *AccessPointRule) EncodeBare(b *bin.Buffer) error {
|
||||
if a == nil {
|
||||
return fmt.Errorf("can't encode accessPointRule#4679b65f as nil")
|
||||
}
|
||||
b.PutString(a.PhonePrefixRules)
|
||||
b.PutInt(a.DCID)
|
||||
b.PutInt(len(a.IPs))
|
||||
for idx, v := range a.IPs {
|
||||
if v == nil {
|
||||
return fmt.Errorf("unable to encode accessPointRule#4679b65f: field ips element with index %d is nil", idx)
|
||||
}
|
||||
if err := v.EncodeBare(b); err != nil {
|
||||
return fmt.Errorf("unable to encode bare accessPointRule#4679b65f: field ips element with index %d: %w", idx, err)
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Decode implements bin.Decoder.
|
||||
func (a *AccessPointRule) Decode(b *bin.Buffer) error {
|
||||
if a == nil {
|
||||
return fmt.Errorf("can't decode accessPointRule#4679b65f to nil")
|
||||
}
|
||||
if err := b.ConsumeID(AccessPointRuleTypeID); err != nil {
|
||||
return fmt.Errorf("unable to decode accessPointRule#4679b65f: %w", err)
|
||||
}
|
||||
return a.DecodeBare(b)
|
||||
}
|
||||
|
||||
// DecodeBare implements bin.BareDecoder.
|
||||
func (a *AccessPointRule) DecodeBare(b *bin.Buffer) error {
|
||||
if a == nil {
|
||||
return fmt.Errorf("can't decode accessPointRule#4679b65f to nil")
|
||||
}
|
||||
{
|
||||
value, err := b.String()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode accessPointRule#4679b65f: field phone_prefix_rules: %w", err)
|
||||
}
|
||||
a.PhonePrefixRules = value
|
||||
}
|
||||
{
|
||||
value, err := b.Int()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode accessPointRule#4679b65f: field dc_id: %w", err)
|
||||
}
|
||||
a.DCID = value
|
||||
}
|
||||
{
|
||||
headerLen, err := b.Int()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode accessPointRule#4679b65f: field ips: %w", err)
|
||||
}
|
||||
|
||||
if headerLen > 0 {
|
||||
a.IPs = make([]IPPortClass, 0, headerLen%bin.PreallocateLimit)
|
||||
}
|
||||
for idx := 0; idx < headerLen; idx++ {
|
||||
value, err := DecodeIPPort(b)
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode accessPointRule#4679b65f: field ips: %w", err)
|
||||
}
|
||||
a.IPs = append(a.IPs, value)
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// GetPhonePrefixRules returns value of PhonePrefixRules field.
|
||||
func (a *AccessPointRule) GetPhonePrefixRules() (value string) {
|
||||
if a == nil {
|
||||
return
|
||||
}
|
||||
return a.PhonePrefixRules
|
||||
}
|
||||
|
||||
// GetDCID returns value of DCID field.
|
||||
func (a *AccessPointRule) GetDCID() (value int) {
|
||||
if a == nil {
|
||||
return
|
||||
}
|
||||
return a.DCID
|
||||
}
|
||||
|
||||
// GetIPs returns value of IPs field.
|
||||
func (a *AccessPointRule) GetIPs() (value []IPPortClass) {
|
||||
if a == nil {
|
||||
return
|
||||
}
|
||||
return a.IPs
|
||||
}
|
||||
|
||||
// MapIPs returns field IPs wrapped in IPPortClassArray helper.
|
||||
func (a *AccessPointRule) MapIPs() (value IPPortClassArray) {
|
||||
return IPPortClassArray(a.IPs)
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
//go:build !no_gotd_slices
|
||||
// +build !no_gotd_slices
|
||||
|
||||
// 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{}
|
||||
)
|
||||
@@ -0,0 +1,306 @@
|
||||
// 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{}
|
||||
)
|
||||
|
||||
// AccountAcceptAuthorizationRequest represents TL type `account.acceptAuthorization#f3ed4c73`.
|
||||
// Sends a Telegram Passport authorization form, effectively sharing data with the
|
||||
// service
|
||||
//
|
||||
// See https://core.telegram.org/method/account.acceptAuthorization for reference.
|
||||
type AccountAcceptAuthorizationRequest struct {
|
||||
// Bot ID
|
||||
BotID int64
|
||||
// Telegram Passport element types requested by the service
|
||||
Scope string
|
||||
// Service's public key
|
||||
PublicKey string
|
||||
// Types of values sent and their hashes
|
||||
ValueHashes []SecureValueHash
|
||||
// Encrypted values
|
||||
Credentials SecureCredentialsEncrypted
|
||||
}
|
||||
|
||||
// AccountAcceptAuthorizationRequestTypeID is TL type id of AccountAcceptAuthorizationRequest.
|
||||
const AccountAcceptAuthorizationRequestTypeID = 0xf3ed4c73
|
||||
|
||||
// Ensuring interfaces in compile-time for AccountAcceptAuthorizationRequest.
|
||||
var (
|
||||
_ bin.Encoder = &AccountAcceptAuthorizationRequest{}
|
||||
_ bin.Decoder = &AccountAcceptAuthorizationRequest{}
|
||||
_ bin.BareEncoder = &AccountAcceptAuthorizationRequest{}
|
||||
_ bin.BareDecoder = &AccountAcceptAuthorizationRequest{}
|
||||
)
|
||||
|
||||
func (a *AccountAcceptAuthorizationRequest) Zero() bool {
|
||||
if a == nil {
|
||||
return true
|
||||
}
|
||||
if !(a.BotID == 0) {
|
||||
return false
|
||||
}
|
||||
if !(a.Scope == "") {
|
||||
return false
|
||||
}
|
||||
if !(a.PublicKey == "") {
|
||||
return false
|
||||
}
|
||||
if !(a.ValueHashes == nil) {
|
||||
return false
|
||||
}
|
||||
if !(a.Credentials.Zero()) {
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
// String implements fmt.Stringer.
|
||||
func (a *AccountAcceptAuthorizationRequest) String() string {
|
||||
if a == nil {
|
||||
return "AccountAcceptAuthorizationRequest(nil)"
|
||||
}
|
||||
type Alias AccountAcceptAuthorizationRequest
|
||||
return fmt.Sprintf("AccountAcceptAuthorizationRequest%+v", Alias(*a))
|
||||
}
|
||||
|
||||
// FillFrom fills AccountAcceptAuthorizationRequest from given interface.
|
||||
func (a *AccountAcceptAuthorizationRequest) FillFrom(from interface {
|
||||
GetBotID() (value int64)
|
||||
GetScope() (value string)
|
||||
GetPublicKey() (value string)
|
||||
GetValueHashes() (value []SecureValueHash)
|
||||
GetCredentials() (value SecureCredentialsEncrypted)
|
||||
}) {
|
||||
a.BotID = from.GetBotID()
|
||||
a.Scope = from.GetScope()
|
||||
a.PublicKey = from.GetPublicKey()
|
||||
a.ValueHashes = from.GetValueHashes()
|
||||
a.Credentials = from.GetCredentials()
|
||||
}
|
||||
|
||||
// TypeID returns type id in TL schema.
|
||||
//
|
||||
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
||||
func (*AccountAcceptAuthorizationRequest) TypeID() uint32 {
|
||||
return AccountAcceptAuthorizationRequestTypeID
|
||||
}
|
||||
|
||||
// TypeName returns name of type in TL schema.
|
||||
func (*AccountAcceptAuthorizationRequest) TypeName() string {
|
||||
return "account.acceptAuthorization"
|
||||
}
|
||||
|
||||
// TypeInfo returns info about TL type.
|
||||
func (a *AccountAcceptAuthorizationRequest) TypeInfo() tdp.Type {
|
||||
typ := tdp.Type{
|
||||
Name: "account.acceptAuthorization",
|
||||
ID: AccountAcceptAuthorizationRequestTypeID,
|
||||
}
|
||||
if a == nil {
|
||||
typ.Null = true
|
||||
return typ
|
||||
}
|
||||
typ.Fields = []tdp.Field{
|
||||
{
|
||||
Name: "BotID",
|
||||
SchemaName: "bot_id",
|
||||
},
|
||||
{
|
||||
Name: "Scope",
|
||||
SchemaName: "scope",
|
||||
},
|
||||
{
|
||||
Name: "PublicKey",
|
||||
SchemaName: "public_key",
|
||||
},
|
||||
{
|
||||
Name: "ValueHashes",
|
||||
SchemaName: "value_hashes",
|
||||
},
|
||||
{
|
||||
Name: "Credentials",
|
||||
SchemaName: "credentials",
|
||||
},
|
||||
}
|
||||
return typ
|
||||
}
|
||||
|
||||
// Encode implements bin.Encoder.
|
||||
func (a *AccountAcceptAuthorizationRequest) Encode(b *bin.Buffer) error {
|
||||
if a == nil {
|
||||
return fmt.Errorf("can't encode account.acceptAuthorization#f3ed4c73 as nil")
|
||||
}
|
||||
b.PutID(AccountAcceptAuthorizationRequestTypeID)
|
||||
return a.EncodeBare(b)
|
||||
}
|
||||
|
||||
// EncodeBare implements bin.BareEncoder.
|
||||
func (a *AccountAcceptAuthorizationRequest) EncodeBare(b *bin.Buffer) error {
|
||||
if a == nil {
|
||||
return fmt.Errorf("can't encode account.acceptAuthorization#f3ed4c73 as nil")
|
||||
}
|
||||
b.PutLong(a.BotID)
|
||||
b.PutString(a.Scope)
|
||||
b.PutString(a.PublicKey)
|
||||
b.PutVectorHeader(len(a.ValueHashes))
|
||||
for idx, v := range a.ValueHashes {
|
||||
if err := v.Encode(b); err != nil {
|
||||
return fmt.Errorf("unable to encode account.acceptAuthorization#f3ed4c73: field value_hashes element with index %d: %w", idx, err)
|
||||
}
|
||||
}
|
||||
if err := a.Credentials.Encode(b); err != nil {
|
||||
return fmt.Errorf("unable to encode account.acceptAuthorization#f3ed4c73: field credentials: %w", err)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Decode implements bin.Decoder.
|
||||
func (a *AccountAcceptAuthorizationRequest) Decode(b *bin.Buffer) error {
|
||||
if a == nil {
|
||||
return fmt.Errorf("can't decode account.acceptAuthorization#f3ed4c73 to nil")
|
||||
}
|
||||
if err := b.ConsumeID(AccountAcceptAuthorizationRequestTypeID); err != nil {
|
||||
return fmt.Errorf("unable to decode account.acceptAuthorization#f3ed4c73: %w", err)
|
||||
}
|
||||
return a.DecodeBare(b)
|
||||
}
|
||||
|
||||
// DecodeBare implements bin.BareDecoder.
|
||||
func (a *AccountAcceptAuthorizationRequest) DecodeBare(b *bin.Buffer) error {
|
||||
if a == nil {
|
||||
return fmt.Errorf("can't decode account.acceptAuthorization#f3ed4c73 to nil")
|
||||
}
|
||||
{
|
||||
value, err := b.Long()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode account.acceptAuthorization#f3ed4c73: field bot_id: %w", err)
|
||||
}
|
||||
a.BotID = value
|
||||
}
|
||||
{
|
||||
value, err := b.String()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode account.acceptAuthorization#f3ed4c73: field scope: %w", err)
|
||||
}
|
||||
a.Scope = value
|
||||
}
|
||||
{
|
||||
value, err := b.String()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode account.acceptAuthorization#f3ed4c73: field public_key: %w", err)
|
||||
}
|
||||
a.PublicKey = value
|
||||
}
|
||||
{
|
||||
headerLen, err := b.VectorHeader()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode account.acceptAuthorization#f3ed4c73: field value_hashes: %w", err)
|
||||
}
|
||||
|
||||
if headerLen > 0 {
|
||||
a.ValueHashes = make([]SecureValueHash, 0, headerLen%bin.PreallocateLimit)
|
||||
}
|
||||
for idx := 0; idx < headerLen; idx++ {
|
||||
var value SecureValueHash
|
||||
if err := value.Decode(b); err != nil {
|
||||
return fmt.Errorf("unable to decode account.acceptAuthorization#f3ed4c73: field value_hashes: %w", err)
|
||||
}
|
||||
a.ValueHashes = append(a.ValueHashes, value)
|
||||
}
|
||||
}
|
||||
{
|
||||
if err := a.Credentials.Decode(b); err != nil {
|
||||
return fmt.Errorf("unable to decode account.acceptAuthorization#f3ed4c73: field credentials: %w", err)
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// GetBotID returns value of BotID field.
|
||||
func (a *AccountAcceptAuthorizationRequest) GetBotID() (value int64) {
|
||||
if a == nil {
|
||||
return
|
||||
}
|
||||
return a.BotID
|
||||
}
|
||||
|
||||
// GetScope returns value of Scope field.
|
||||
func (a *AccountAcceptAuthorizationRequest) GetScope() (value string) {
|
||||
if a == nil {
|
||||
return
|
||||
}
|
||||
return a.Scope
|
||||
}
|
||||
|
||||
// GetPublicKey returns value of PublicKey field.
|
||||
func (a *AccountAcceptAuthorizationRequest) GetPublicKey() (value string) {
|
||||
if a == nil {
|
||||
return
|
||||
}
|
||||
return a.PublicKey
|
||||
}
|
||||
|
||||
// GetValueHashes returns value of ValueHashes field.
|
||||
func (a *AccountAcceptAuthorizationRequest) GetValueHashes() (value []SecureValueHash) {
|
||||
if a == nil {
|
||||
return
|
||||
}
|
||||
return a.ValueHashes
|
||||
}
|
||||
|
||||
// GetCredentials returns value of Credentials field.
|
||||
func (a *AccountAcceptAuthorizationRequest) GetCredentials() (value SecureCredentialsEncrypted) {
|
||||
if a == nil {
|
||||
return
|
||||
}
|
||||
return a.Credentials
|
||||
}
|
||||
|
||||
// AccountAcceptAuthorization invokes method account.acceptAuthorization#f3ed4c73 returning error if any.
|
||||
// Sends a Telegram Passport authorization form, effectively sharing data with the
|
||||
// service
|
||||
//
|
||||
// Possible errors:
|
||||
//
|
||||
// 400 BOT_INVALID: This is not a valid bot.
|
||||
// 400 PUBLIC_KEY_REQUIRED: A public key is required.
|
||||
//
|
||||
// See https://core.telegram.org/method/account.acceptAuthorization for reference.
|
||||
func (c *Client) AccountAcceptAuthorization(ctx context.Context, request *AccountAcceptAuthorizationRequest) (bool, error) {
|
||||
var result BoolBox
|
||||
|
||||
if err := c.rpc.Invoke(ctx, request, &result); err != nil {
|
||||
return false, err
|
||||
}
|
||||
_, ok := result.Bool.(*BoolTrue)
|
||||
return ok, nil
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
//go:build !no_gotd_slices
|
||||
// +build !no_gotd_slices
|
||||
|
||||
// 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{}
|
||||
)
|
||||
@@ -0,0 +1,232 @@
|
||||
// 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{}
|
||||
)
|
||||
|
||||
// AccountAddNoPaidMessagesExceptionRequest represents TL type `account.addNoPaidMessagesException#6f688aa7`.
|
||||
//
|
||||
// See https://core.telegram.org/method/account.addNoPaidMessagesException for reference.
|
||||
type AccountAddNoPaidMessagesExceptionRequest struct {
|
||||
// Flags field of AccountAddNoPaidMessagesExceptionRequest.
|
||||
Flags bin.Fields
|
||||
// RefundCharged field of AccountAddNoPaidMessagesExceptionRequest.
|
||||
RefundCharged bool
|
||||
// UserID field of AccountAddNoPaidMessagesExceptionRequest.
|
||||
UserID InputUserClass
|
||||
}
|
||||
|
||||
// AccountAddNoPaidMessagesExceptionRequestTypeID is TL type id of AccountAddNoPaidMessagesExceptionRequest.
|
||||
const AccountAddNoPaidMessagesExceptionRequestTypeID = 0x6f688aa7
|
||||
|
||||
// Ensuring interfaces in compile-time for AccountAddNoPaidMessagesExceptionRequest.
|
||||
var (
|
||||
_ bin.Encoder = &AccountAddNoPaidMessagesExceptionRequest{}
|
||||
_ bin.Decoder = &AccountAddNoPaidMessagesExceptionRequest{}
|
||||
_ bin.BareEncoder = &AccountAddNoPaidMessagesExceptionRequest{}
|
||||
_ bin.BareDecoder = &AccountAddNoPaidMessagesExceptionRequest{}
|
||||
)
|
||||
|
||||
func (a *AccountAddNoPaidMessagesExceptionRequest) Zero() bool {
|
||||
if a == nil {
|
||||
return true
|
||||
}
|
||||
if !(a.Flags.Zero()) {
|
||||
return false
|
||||
}
|
||||
if !(a.RefundCharged == false) {
|
||||
return false
|
||||
}
|
||||
if !(a.UserID == nil) {
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
// String implements fmt.Stringer.
|
||||
func (a *AccountAddNoPaidMessagesExceptionRequest) String() string {
|
||||
if a == nil {
|
||||
return "AccountAddNoPaidMessagesExceptionRequest(nil)"
|
||||
}
|
||||
type Alias AccountAddNoPaidMessagesExceptionRequest
|
||||
return fmt.Sprintf("AccountAddNoPaidMessagesExceptionRequest%+v", Alias(*a))
|
||||
}
|
||||
|
||||
// FillFrom fills AccountAddNoPaidMessagesExceptionRequest from given interface.
|
||||
func (a *AccountAddNoPaidMessagesExceptionRequest) FillFrom(from interface {
|
||||
GetRefundCharged() (value bool)
|
||||
GetUserID() (value InputUserClass)
|
||||
}) {
|
||||
a.RefundCharged = from.GetRefundCharged()
|
||||
a.UserID = from.GetUserID()
|
||||
}
|
||||
|
||||
// TypeID returns type id in TL schema.
|
||||
//
|
||||
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
||||
func (*AccountAddNoPaidMessagesExceptionRequest) TypeID() uint32 {
|
||||
return AccountAddNoPaidMessagesExceptionRequestTypeID
|
||||
}
|
||||
|
||||
// TypeName returns name of type in TL schema.
|
||||
func (*AccountAddNoPaidMessagesExceptionRequest) TypeName() string {
|
||||
return "account.addNoPaidMessagesException"
|
||||
}
|
||||
|
||||
// TypeInfo returns info about TL type.
|
||||
func (a *AccountAddNoPaidMessagesExceptionRequest) TypeInfo() tdp.Type {
|
||||
typ := tdp.Type{
|
||||
Name: "account.addNoPaidMessagesException",
|
||||
ID: AccountAddNoPaidMessagesExceptionRequestTypeID,
|
||||
}
|
||||
if a == nil {
|
||||
typ.Null = true
|
||||
return typ
|
||||
}
|
||||
typ.Fields = []tdp.Field{
|
||||
{
|
||||
Name: "RefundCharged",
|
||||
SchemaName: "refund_charged",
|
||||
Null: !a.Flags.Has(0),
|
||||
},
|
||||
{
|
||||
Name: "UserID",
|
||||
SchemaName: "user_id",
|
||||
},
|
||||
}
|
||||
return typ
|
||||
}
|
||||
|
||||
// SetFlags sets flags for non-zero fields.
|
||||
func (a *AccountAddNoPaidMessagesExceptionRequest) SetFlags() {
|
||||
if !(a.RefundCharged == false) {
|
||||
a.Flags.Set(0)
|
||||
}
|
||||
}
|
||||
|
||||
// Encode implements bin.Encoder.
|
||||
func (a *AccountAddNoPaidMessagesExceptionRequest) Encode(b *bin.Buffer) error {
|
||||
if a == nil {
|
||||
return fmt.Errorf("can't encode account.addNoPaidMessagesException#6f688aa7 as nil")
|
||||
}
|
||||
b.PutID(AccountAddNoPaidMessagesExceptionRequestTypeID)
|
||||
return a.EncodeBare(b)
|
||||
}
|
||||
|
||||
// EncodeBare implements bin.BareEncoder.
|
||||
func (a *AccountAddNoPaidMessagesExceptionRequest) EncodeBare(b *bin.Buffer) error {
|
||||
if a == nil {
|
||||
return fmt.Errorf("can't encode account.addNoPaidMessagesException#6f688aa7 as nil")
|
||||
}
|
||||
a.SetFlags()
|
||||
if err := a.Flags.Encode(b); err != nil {
|
||||
return fmt.Errorf("unable to encode account.addNoPaidMessagesException#6f688aa7: field flags: %w", err)
|
||||
}
|
||||
if a.UserID == nil {
|
||||
return fmt.Errorf("unable to encode account.addNoPaidMessagesException#6f688aa7: field user_id is nil")
|
||||
}
|
||||
if err := a.UserID.Encode(b); err != nil {
|
||||
return fmt.Errorf("unable to encode account.addNoPaidMessagesException#6f688aa7: field user_id: %w", err)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Decode implements bin.Decoder.
|
||||
func (a *AccountAddNoPaidMessagesExceptionRequest) Decode(b *bin.Buffer) error {
|
||||
if a == nil {
|
||||
return fmt.Errorf("can't decode account.addNoPaidMessagesException#6f688aa7 to nil")
|
||||
}
|
||||
if err := b.ConsumeID(AccountAddNoPaidMessagesExceptionRequestTypeID); err != nil {
|
||||
return fmt.Errorf("unable to decode account.addNoPaidMessagesException#6f688aa7: %w", err)
|
||||
}
|
||||
return a.DecodeBare(b)
|
||||
}
|
||||
|
||||
// DecodeBare implements bin.BareDecoder.
|
||||
func (a *AccountAddNoPaidMessagesExceptionRequest) DecodeBare(b *bin.Buffer) error {
|
||||
if a == nil {
|
||||
return fmt.Errorf("can't decode account.addNoPaidMessagesException#6f688aa7 to nil")
|
||||
}
|
||||
{
|
||||
if err := a.Flags.Decode(b); err != nil {
|
||||
return fmt.Errorf("unable to decode account.addNoPaidMessagesException#6f688aa7: field flags: %w", err)
|
||||
}
|
||||
}
|
||||
a.RefundCharged = a.Flags.Has(0)
|
||||
{
|
||||
value, err := DecodeInputUser(b)
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode account.addNoPaidMessagesException#6f688aa7: field user_id: %w", err)
|
||||
}
|
||||
a.UserID = value
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// SetRefundCharged sets value of RefundCharged conditional field.
|
||||
func (a *AccountAddNoPaidMessagesExceptionRequest) SetRefundCharged(value bool) {
|
||||
if value {
|
||||
a.Flags.Set(0)
|
||||
a.RefundCharged = true
|
||||
} else {
|
||||
a.Flags.Unset(0)
|
||||
a.RefundCharged = false
|
||||
}
|
||||
}
|
||||
|
||||
// GetRefundCharged returns value of RefundCharged conditional field.
|
||||
func (a *AccountAddNoPaidMessagesExceptionRequest) GetRefundCharged() (value bool) {
|
||||
if a == nil {
|
||||
return
|
||||
}
|
||||
return a.Flags.Has(0)
|
||||
}
|
||||
|
||||
// GetUserID returns value of UserID field.
|
||||
func (a *AccountAddNoPaidMessagesExceptionRequest) GetUserID() (value InputUserClass) {
|
||||
if a == nil {
|
||||
return
|
||||
}
|
||||
return a.UserID
|
||||
}
|
||||
|
||||
// AccountAddNoPaidMessagesException invokes method account.addNoPaidMessagesException#6f688aa7 returning error if any.
|
||||
//
|
||||
// See https://core.telegram.org/method/account.addNoPaidMessagesException for reference.
|
||||
func (c *Client) AccountAddNoPaidMessagesException(ctx context.Context, request *AccountAddNoPaidMessagesExceptionRequest) (bool, error) {
|
||||
var result BoolBox
|
||||
|
||||
if err := c.rpc.Invoke(ctx, request, &result); err != nil {
|
||||
return false, err
|
||||
}
|
||||
_, ok := result.Bool.(*BoolTrue)
|
||||
return ok, nil
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
//go:build !no_gotd_slices
|
||||
// +build !no_gotd_slices
|
||||
|
||||
// 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{}
|
||||
)
|
||||
@@ -0,0 +1,408 @@
|
||||
// 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{}
|
||||
)
|
||||
|
||||
// AccountAuthorizationForm represents TL type `account.authorizationForm#ad2e1cd8`.
|
||||
// Telegram Passport¹ authorization form
|
||||
//
|
||||
// Links:
|
||||
// 1. https://core.telegram.org/passport
|
||||
//
|
||||
// See https://core.telegram.org/constructor/account.authorizationForm for reference.
|
||||
type AccountAuthorizationForm struct {
|
||||
// Flags, see TL conditional fields¹
|
||||
//
|
||||
// Links:
|
||||
// 1) https://core.telegram.org/mtproto/TL-combinators#conditional-fields
|
||||
Flags bin.Fields
|
||||
// Required Telegram Passport¹ documents
|
||||
//
|
||||
// Links:
|
||||
// 1) https://core.telegram.org/passport
|
||||
RequiredTypes []SecureRequiredTypeClass
|
||||
// Already submitted Telegram Passport¹ documents
|
||||
//
|
||||
// Links:
|
||||
// 1) https://core.telegram.org/passport
|
||||
Values []SecureValue
|
||||
// Telegram Passport¹ errors
|
||||
//
|
||||
// Links:
|
||||
// 1) https://core.telegram.org/passport
|
||||
Errors []SecureValueErrorClass
|
||||
// Info about the bot to which the form will be submitted
|
||||
Users []UserClass
|
||||
// URL of the service's privacy policy
|
||||
//
|
||||
// Use SetPrivacyPolicyURL and GetPrivacyPolicyURL helpers.
|
||||
PrivacyPolicyURL string
|
||||
}
|
||||
|
||||
// AccountAuthorizationFormTypeID is TL type id of AccountAuthorizationForm.
|
||||
const AccountAuthorizationFormTypeID = 0xad2e1cd8
|
||||
|
||||
// Ensuring interfaces in compile-time for AccountAuthorizationForm.
|
||||
var (
|
||||
_ bin.Encoder = &AccountAuthorizationForm{}
|
||||
_ bin.Decoder = &AccountAuthorizationForm{}
|
||||
_ bin.BareEncoder = &AccountAuthorizationForm{}
|
||||
_ bin.BareDecoder = &AccountAuthorizationForm{}
|
||||
)
|
||||
|
||||
func (a *AccountAuthorizationForm) Zero() bool {
|
||||
if a == nil {
|
||||
return true
|
||||
}
|
||||
if !(a.Flags.Zero()) {
|
||||
return false
|
||||
}
|
||||
if !(a.RequiredTypes == nil) {
|
||||
return false
|
||||
}
|
||||
if !(a.Values == nil) {
|
||||
return false
|
||||
}
|
||||
if !(a.Errors == nil) {
|
||||
return false
|
||||
}
|
||||
if !(a.Users == nil) {
|
||||
return false
|
||||
}
|
||||
if !(a.PrivacyPolicyURL == "") {
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
// String implements fmt.Stringer.
|
||||
func (a *AccountAuthorizationForm) String() string {
|
||||
if a == nil {
|
||||
return "AccountAuthorizationForm(nil)"
|
||||
}
|
||||
type Alias AccountAuthorizationForm
|
||||
return fmt.Sprintf("AccountAuthorizationForm%+v", Alias(*a))
|
||||
}
|
||||
|
||||
// FillFrom fills AccountAuthorizationForm from given interface.
|
||||
func (a *AccountAuthorizationForm) FillFrom(from interface {
|
||||
GetRequiredTypes() (value []SecureRequiredTypeClass)
|
||||
GetValues() (value []SecureValue)
|
||||
GetErrors() (value []SecureValueErrorClass)
|
||||
GetUsers() (value []UserClass)
|
||||
GetPrivacyPolicyURL() (value string, ok bool)
|
||||
}) {
|
||||
a.RequiredTypes = from.GetRequiredTypes()
|
||||
a.Values = from.GetValues()
|
||||
a.Errors = from.GetErrors()
|
||||
a.Users = from.GetUsers()
|
||||
if val, ok := from.GetPrivacyPolicyURL(); ok {
|
||||
a.PrivacyPolicyURL = val
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// TypeID returns type id in TL schema.
|
||||
//
|
||||
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
||||
func (*AccountAuthorizationForm) TypeID() uint32 {
|
||||
return AccountAuthorizationFormTypeID
|
||||
}
|
||||
|
||||
// TypeName returns name of type in TL schema.
|
||||
func (*AccountAuthorizationForm) TypeName() string {
|
||||
return "account.authorizationForm"
|
||||
}
|
||||
|
||||
// TypeInfo returns info about TL type.
|
||||
func (a *AccountAuthorizationForm) TypeInfo() tdp.Type {
|
||||
typ := tdp.Type{
|
||||
Name: "account.authorizationForm",
|
||||
ID: AccountAuthorizationFormTypeID,
|
||||
}
|
||||
if a == nil {
|
||||
typ.Null = true
|
||||
return typ
|
||||
}
|
||||
typ.Fields = []tdp.Field{
|
||||
{
|
||||
Name: "RequiredTypes",
|
||||
SchemaName: "required_types",
|
||||
},
|
||||
{
|
||||
Name: "Values",
|
||||
SchemaName: "values",
|
||||
},
|
||||
{
|
||||
Name: "Errors",
|
||||
SchemaName: "errors",
|
||||
},
|
||||
{
|
||||
Name: "Users",
|
||||
SchemaName: "users",
|
||||
},
|
||||
{
|
||||
Name: "PrivacyPolicyURL",
|
||||
SchemaName: "privacy_policy_url",
|
||||
Null: !a.Flags.Has(0),
|
||||
},
|
||||
}
|
||||
return typ
|
||||
}
|
||||
|
||||
// SetFlags sets flags for non-zero fields.
|
||||
func (a *AccountAuthorizationForm) SetFlags() {
|
||||
if !(a.PrivacyPolicyURL == "") {
|
||||
a.Flags.Set(0)
|
||||
}
|
||||
}
|
||||
|
||||
// Encode implements bin.Encoder.
|
||||
func (a *AccountAuthorizationForm) Encode(b *bin.Buffer) error {
|
||||
if a == nil {
|
||||
return fmt.Errorf("can't encode account.authorizationForm#ad2e1cd8 as nil")
|
||||
}
|
||||
b.PutID(AccountAuthorizationFormTypeID)
|
||||
return a.EncodeBare(b)
|
||||
}
|
||||
|
||||
// EncodeBare implements bin.BareEncoder.
|
||||
func (a *AccountAuthorizationForm) EncodeBare(b *bin.Buffer) error {
|
||||
if a == nil {
|
||||
return fmt.Errorf("can't encode account.authorizationForm#ad2e1cd8 as nil")
|
||||
}
|
||||
a.SetFlags()
|
||||
if err := a.Flags.Encode(b); err != nil {
|
||||
return fmt.Errorf("unable to encode account.authorizationForm#ad2e1cd8: field flags: %w", err)
|
||||
}
|
||||
b.PutVectorHeader(len(a.RequiredTypes))
|
||||
for idx, v := range a.RequiredTypes {
|
||||
if v == nil {
|
||||
return fmt.Errorf("unable to encode account.authorizationForm#ad2e1cd8: field required_types element with index %d is nil", idx)
|
||||
}
|
||||
if err := v.Encode(b); err != nil {
|
||||
return fmt.Errorf("unable to encode account.authorizationForm#ad2e1cd8: field required_types element with index %d: %w", idx, err)
|
||||
}
|
||||
}
|
||||
b.PutVectorHeader(len(a.Values))
|
||||
for idx, v := range a.Values {
|
||||
if err := v.Encode(b); err != nil {
|
||||
return fmt.Errorf("unable to encode account.authorizationForm#ad2e1cd8: field values element with index %d: %w", idx, err)
|
||||
}
|
||||
}
|
||||
b.PutVectorHeader(len(a.Errors))
|
||||
for idx, v := range a.Errors {
|
||||
if v == nil {
|
||||
return fmt.Errorf("unable to encode account.authorizationForm#ad2e1cd8: field errors element with index %d is nil", idx)
|
||||
}
|
||||
if err := v.Encode(b); err != nil {
|
||||
return fmt.Errorf("unable to encode account.authorizationForm#ad2e1cd8: field errors element with index %d: %w", idx, err)
|
||||
}
|
||||
}
|
||||
b.PutVectorHeader(len(a.Users))
|
||||
for idx, v := range a.Users {
|
||||
if v == nil {
|
||||
return fmt.Errorf("unable to encode account.authorizationForm#ad2e1cd8: field users element with index %d is nil", idx)
|
||||
}
|
||||
if err := v.Encode(b); err != nil {
|
||||
return fmt.Errorf("unable to encode account.authorizationForm#ad2e1cd8: field users element with index %d: %w", idx, err)
|
||||
}
|
||||
}
|
||||
if a.Flags.Has(0) {
|
||||
b.PutString(a.PrivacyPolicyURL)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Decode implements bin.Decoder.
|
||||
func (a *AccountAuthorizationForm) Decode(b *bin.Buffer) error {
|
||||
if a == nil {
|
||||
return fmt.Errorf("can't decode account.authorizationForm#ad2e1cd8 to nil")
|
||||
}
|
||||
if err := b.ConsumeID(AccountAuthorizationFormTypeID); err != nil {
|
||||
return fmt.Errorf("unable to decode account.authorizationForm#ad2e1cd8: %w", err)
|
||||
}
|
||||
return a.DecodeBare(b)
|
||||
}
|
||||
|
||||
// DecodeBare implements bin.BareDecoder.
|
||||
func (a *AccountAuthorizationForm) DecodeBare(b *bin.Buffer) error {
|
||||
if a == nil {
|
||||
return fmt.Errorf("can't decode account.authorizationForm#ad2e1cd8 to nil")
|
||||
}
|
||||
{
|
||||
if err := a.Flags.Decode(b); err != nil {
|
||||
return fmt.Errorf("unable to decode account.authorizationForm#ad2e1cd8: field flags: %w", err)
|
||||
}
|
||||
}
|
||||
{
|
||||
headerLen, err := b.VectorHeader()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode account.authorizationForm#ad2e1cd8: field required_types: %w", err)
|
||||
}
|
||||
|
||||
if headerLen > 0 {
|
||||
a.RequiredTypes = make([]SecureRequiredTypeClass, 0, headerLen%bin.PreallocateLimit)
|
||||
}
|
||||
for idx := 0; idx < headerLen; idx++ {
|
||||
value, err := DecodeSecureRequiredType(b)
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode account.authorizationForm#ad2e1cd8: field required_types: %w", err)
|
||||
}
|
||||
a.RequiredTypes = append(a.RequiredTypes, value)
|
||||
}
|
||||
}
|
||||
{
|
||||
headerLen, err := b.VectorHeader()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode account.authorizationForm#ad2e1cd8: field values: %w", err)
|
||||
}
|
||||
|
||||
if headerLen > 0 {
|
||||
a.Values = make([]SecureValue, 0, headerLen%bin.PreallocateLimit)
|
||||
}
|
||||
for idx := 0; idx < headerLen; idx++ {
|
||||
var value SecureValue
|
||||
if err := value.Decode(b); err != nil {
|
||||
return fmt.Errorf("unable to decode account.authorizationForm#ad2e1cd8: field values: %w", err)
|
||||
}
|
||||
a.Values = append(a.Values, value)
|
||||
}
|
||||
}
|
||||
{
|
||||
headerLen, err := b.VectorHeader()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode account.authorizationForm#ad2e1cd8: field errors: %w", err)
|
||||
}
|
||||
|
||||
if headerLen > 0 {
|
||||
a.Errors = make([]SecureValueErrorClass, 0, headerLen%bin.PreallocateLimit)
|
||||
}
|
||||
for idx := 0; idx < headerLen; idx++ {
|
||||
value, err := DecodeSecureValueError(b)
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode account.authorizationForm#ad2e1cd8: field errors: %w", err)
|
||||
}
|
||||
a.Errors = append(a.Errors, value)
|
||||
}
|
||||
}
|
||||
{
|
||||
headerLen, err := b.VectorHeader()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode account.authorizationForm#ad2e1cd8: field users: %w", err)
|
||||
}
|
||||
|
||||
if headerLen > 0 {
|
||||
a.Users = make([]UserClass, 0, headerLen%bin.PreallocateLimit)
|
||||
}
|
||||
for idx := 0; idx < headerLen; idx++ {
|
||||
value, err := DecodeUser(b)
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode account.authorizationForm#ad2e1cd8: field users: %w", err)
|
||||
}
|
||||
a.Users = append(a.Users, value)
|
||||
}
|
||||
}
|
||||
if a.Flags.Has(0) {
|
||||
value, err := b.String()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode account.authorizationForm#ad2e1cd8: field privacy_policy_url: %w", err)
|
||||
}
|
||||
a.PrivacyPolicyURL = value
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// GetRequiredTypes returns value of RequiredTypes field.
|
||||
func (a *AccountAuthorizationForm) GetRequiredTypes() (value []SecureRequiredTypeClass) {
|
||||
if a == nil {
|
||||
return
|
||||
}
|
||||
return a.RequiredTypes
|
||||
}
|
||||
|
||||
// GetValues returns value of Values field.
|
||||
func (a *AccountAuthorizationForm) GetValues() (value []SecureValue) {
|
||||
if a == nil {
|
||||
return
|
||||
}
|
||||
return a.Values
|
||||
}
|
||||
|
||||
// GetErrors returns value of Errors field.
|
||||
func (a *AccountAuthorizationForm) GetErrors() (value []SecureValueErrorClass) {
|
||||
if a == nil {
|
||||
return
|
||||
}
|
||||
return a.Errors
|
||||
}
|
||||
|
||||
// GetUsers returns value of Users field.
|
||||
func (a *AccountAuthorizationForm) GetUsers() (value []UserClass) {
|
||||
if a == nil {
|
||||
return
|
||||
}
|
||||
return a.Users
|
||||
}
|
||||
|
||||
// SetPrivacyPolicyURL sets value of PrivacyPolicyURL conditional field.
|
||||
func (a *AccountAuthorizationForm) SetPrivacyPolicyURL(value string) {
|
||||
a.Flags.Set(0)
|
||||
a.PrivacyPolicyURL = value
|
||||
}
|
||||
|
||||
// GetPrivacyPolicyURL returns value of PrivacyPolicyURL conditional field and
|
||||
// boolean which is true if field was set.
|
||||
func (a *AccountAuthorizationForm) GetPrivacyPolicyURL() (value string, ok bool) {
|
||||
if a == nil {
|
||||
return
|
||||
}
|
||||
if !a.Flags.Has(0) {
|
||||
return value, false
|
||||
}
|
||||
return a.PrivacyPolicyURL, true
|
||||
}
|
||||
|
||||
// MapRequiredTypes returns field RequiredTypes wrapped in SecureRequiredTypeClassArray helper.
|
||||
func (a *AccountAuthorizationForm) MapRequiredTypes() (value SecureRequiredTypeClassArray) {
|
||||
return SecureRequiredTypeClassArray(a.RequiredTypes)
|
||||
}
|
||||
|
||||
// MapErrors returns field Errors wrapped in SecureValueErrorClassArray helper.
|
||||
func (a *AccountAuthorizationForm) MapErrors() (value SecureValueErrorClassArray) {
|
||||
return SecureValueErrorClassArray(a.Errors)
|
||||
}
|
||||
|
||||
// MapUsers returns field Users wrapped in UserClassArray helper.
|
||||
func (a *AccountAuthorizationForm) MapUsers() (value UserClassArray) {
|
||||
return UserClassArray(a.Users)
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
//go:build !no_gotd_slices
|
||||
// +build !no_gotd_slices
|
||||
|
||||
// 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{}
|
||||
)
|
||||
@@ -0,0 +1,204 @@
|
||||
// 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{}
|
||||
)
|
||||
|
||||
// AccountAuthorizations represents TL type `account.authorizations#4bff8ea0`.
|
||||
// Logged-in sessions
|
||||
//
|
||||
// See https://core.telegram.org/constructor/account.authorizations for reference.
|
||||
type AccountAuthorizations struct {
|
||||
// Time-to-live of session
|
||||
AuthorizationTTLDays int
|
||||
// Logged-in sessions
|
||||
Authorizations []Authorization
|
||||
}
|
||||
|
||||
// AccountAuthorizationsTypeID is TL type id of AccountAuthorizations.
|
||||
const AccountAuthorizationsTypeID = 0x4bff8ea0
|
||||
|
||||
// Ensuring interfaces in compile-time for AccountAuthorizations.
|
||||
var (
|
||||
_ bin.Encoder = &AccountAuthorizations{}
|
||||
_ bin.Decoder = &AccountAuthorizations{}
|
||||
_ bin.BareEncoder = &AccountAuthorizations{}
|
||||
_ bin.BareDecoder = &AccountAuthorizations{}
|
||||
)
|
||||
|
||||
func (a *AccountAuthorizations) Zero() bool {
|
||||
if a == nil {
|
||||
return true
|
||||
}
|
||||
if !(a.AuthorizationTTLDays == 0) {
|
||||
return false
|
||||
}
|
||||
if !(a.Authorizations == nil) {
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
// String implements fmt.Stringer.
|
||||
func (a *AccountAuthorizations) String() string {
|
||||
if a == nil {
|
||||
return "AccountAuthorizations(nil)"
|
||||
}
|
||||
type Alias AccountAuthorizations
|
||||
return fmt.Sprintf("AccountAuthorizations%+v", Alias(*a))
|
||||
}
|
||||
|
||||
// FillFrom fills AccountAuthorizations from given interface.
|
||||
func (a *AccountAuthorizations) FillFrom(from interface {
|
||||
GetAuthorizationTTLDays() (value int)
|
||||
GetAuthorizations() (value []Authorization)
|
||||
}) {
|
||||
a.AuthorizationTTLDays = from.GetAuthorizationTTLDays()
|
||||
a.Authorizations = from.GetAuthorizations()
|
||||
}
|
||||
|
||||
// TypeID returns type id in TL schema.
|
||||
//
|
||||
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
||||
func (*AccountAuthorizations) TypeID() uint32 {
|
||||
return AccountAuthorizationsTypeID
|
||||
}
|
||||
|
||||
// TypeName returns name of type in TL schema.
|
||||
func (*AccountAuthorizations) TypeName() string {
|
||||
return "account.authorizations"
|
||||
}
|
||||
|
||||
// TypeInfo returns info about TL type.
|
||||
func (a *AccountAuthorizations) TypeInfo() tdp.Type {
|
||||
typ := tdp.Type{
|
||||
Name: "account.authorizations",
|
||||
ID: AccountAuthorizationsTypeID,
|
||||
}
|
||||
if a == nil {
|
||||
typ.Null = true
|
||||
return typ
|
||||
}
|
||||
typ.Fields = []tdp.Field{
|
||||
{
|
||||
Name: "AuthorizationTTLDays",
|
||||
SchemaName: "authorization_ttl_days",
|
||||
},
|
||||
{
|
||||
Name: "Authorizations",
|
||||
SchemaName: "authorizations",
|
||||
},
|
||||
}
|
||||
return typ
|
||||
}
|
||||
|
||||
// Encode implements bin.Encoder.
|
||||
func (a *AccountAuthorizations) Encode(b *bin.Buffer) error {
|
||||
if a == nil {
|
||||
return fmt.Errorf("can't encode account.authorizations#4bff8ea0 as nil")
|
||||
}
|
||||
b.PutID(AccountAuthorizationsTypeID)
|
||||
return a.EncodeBare(b)
|
||||
}
|
||||
|
||||
// EncodeBare implements bin.BareEncoder.
|
||||
func (a *AccountAuthorizations) EncodeBare(b *bin.Buffer) error {
|
||||
if a == nil {
|
||||
return fmt.Errorf("can't encode account.authorizations#4bff8ea0 as nil")
|
||||
}
|
||||
b.PutInt(a.AuthorizationTTLDays)
|
||||
b.PutVectorHeader(len(a.Authorizations))
|
||||
for idx, v := range a.Authorizations {
|
||||
if err := v.Encode(b); err != nil {
|
||||
return fmt.Errorf("unable to encode account.authorizations#4bff8ea0: field authorizations element with index %d: %w", idx, err)
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Decode implements bin.Decoder.
|
||||
func (a *AccountAuthorizations) Decode(b *bin.Buffer) error {
|
||||
if a == nil {
|
||||
return fmt.Errorf("can't decode account.authorizations#4bff8ea0 to nil")
|
||||
}
|
||||
if err := b.ConsumeID(AccountAuthorizationsTypeID); err != nil {
|
||||
return fmt.Errorf("unable to decode account.authorizations#4bff8ea0: %w", err)
|
||||
}
|
||||
return a.DecodeBare(b)
|
||||
}
|
||||
|
||||
// DecodeBare implements bin.BareDecoder.
|
||||
func (a *AccountAuthorizations) DecodeBare(b *bin.Buffer) error {
|
||||
if a == nil {
|
||||
return fmt.Errorf("can't decode account.authorizations#4bff8ea0 to nil")
|
||||
}
|
||||
{
|
||||
value, err := b.Int()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode account.authorizations#4bff8ea0: field authorization_ttl_days: %w", err)
|
||||
}
|
||||
a.AuthorizationTTLDays = value
|
||||
}
|
||||
{
|
||||
headerLen, err := b.VectorHeader()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode account.authorizations#4bff8ea0: field authorizations: %w", err)
|
||||
}
|
||||
|
||||
if headerLen > 0 {
|
||||
a.Authorizations = make([]Authorization, 0, headerLen%bin.PreallocateLimit)
|
||||
}
|
||||
for idx := 0; idx < headerLen; idx++ {
|
||||
var value Authorization
|
||||
if err := value.Decode(b); err != nil {
|
||||
return fmt.Errorf("unable to decode account.authorizations#4bff8ea0: field authorizations: %w", err)
|
||||
}
|
||||
a.Authorizations = append(a.Authorizations, value)
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// GetAuthorizationTTLDays returns value of AuthorizationTTLDays field.
|
||||
func (a *AccountAuthorizations) GetAuthorizationTTLDays() (value int) {
|
||||
if a == nil {
|
||||
return
|
||||
}
|
||||
return a.AuthorizationTTLDays
|
||||
}
|
||||
|
||||
// GetAuthorizations returns value of Authorizations field.
|
||||
func (a *AccountAuthorizations) GetAuthorizations() (value []Authorization) {
|
||||
if a == nil {
|
||||
return
|
||||
}
|
||||
return a.Authorizations
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
//go:build !no_gotd_slices
|
||||
// +build !no_gotd_slices
|
||||
|
||||
// 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{}
|
||||
)
|
||||
@@ -0,0 +1,216 @@
|
||||
// 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{}
|
||||
)
|
||||
|
||||
// AccountAutoDownloadSettings represents TL type `account.autoDownloadSettings#63cacf26`.
|
||||
// Media autodownload settings
|
||||
//
|
||||
// See https://core.telegram.org/constructor/account.autoDownloadSettings for reference.
|
||||
type AccountAutoDownloadSettings struct {
|
||||
// Low data usage preset
|
||||
Low AutoDownloadSettings
|
||||
// Medium data usage preset
|
||||
Medium AutoDownloadSettings
|
||||
// High data usage preset
|
||||
High AutoDownloadSettings
|
||||
}
|
||||
|
||||
// AccountAutoDownloadSettingsTypeID is TL type id of AccountAutoDownloadSettings.
|
||||
const AccountAutoDownloadSettingsTypeID = 0x63cacf26
|
||||
|
||||
// Ensuring interfaces in compile-time for AccountAutoDownloadSettings.
|
||||
var (
|
||||
_ bin.Encoder = &AccountAutoDownloadSettings{}
|
||||
_ bin.Decoder = &AccountAutoDownloadSettings{}
|
||||
_ bin.BareEncoder = &AccountAutoDownloadSettings{}
|
||||
_ bin.BareDecoder = &AccountAutoDownloadSettings{}
|
||||
)
|
||||
|
||||
func (a *AccountAutoDownloadSettings) Zero() bool {
|
||||
if a == nil {
|
||||
return true
|
||||
}
|
||||
if !(a.Low.Zero()) {
|
||||
return false
|
||||
}
|
||||
if !(a.Medium.Zero()) {
|
||||
return false
|
||||
}
|
||||
if !(a.High.Zero()) {
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
// String implements fmt.Stringer.
|
||||
func (a *AccountAutoDownloadSettings) String() string {
|
||||
if a == nil {
|
||||
return "AccountAutoDownloadSettings(nil)"
|
||||
}
|
||||
type Alias AccountAutoDownloadSettings
|
||||
return fmt.Sprintf("AccountAutoDownloadSettings%+v", Alias(*a))
|
||||
}
|
||||
|
||||
// FillFrom fills AccountAutoDownloadSettings from given interface.
|
||||
func (a *AccountAutoDownloadSettings) FillFrom(from interface {
|
||||
GetLow() (value AutoDownloadSettings)
|
||||
GetMedium() (value AutoDownloadSettings)
|
||||
GetHigh() (value AutoDownloadSettings)
|
||||
}) {
|
||||
a.Low = from.GetLow()
|
||||
a.Medium = from.GetMedium()
|
||||
a.High = from.GetHigh()
|
||||
}
|
||||
|
||||
// TypeID returns type id in TL schema.
|
||||
//
|
||||
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
||||
func (*AccountAutoDownloadSettings) TypeID() uint32 {
|
||||
return AccountAutoDownloadSettingsTypeID
|
||||
}
|
||||
|
||||
// TypeName returns name of type in TL schema.
|
||||
func (*AccountAutoDownloadSettings) TypeName() string {
|
||||
return "account.autoDownloadSettings"
|
||||
}
|
||||
|
||||
// TypeInfo returns info about TL type.
|
||||
func (a *AccountAutoDownloadSettings) TypeInfo() tdp.Type {
|
||||
typ := tdp.Type{
|
||||
Name: "account.autoDownloadSettings",
|
||||
ID: AccountAutoDownloadSettingsTypeID,
|
||||
}
|
||||
if a == nil {
|
||||
typ.Null = true
|
||||
return typ
|
||||
}
|
||||
typ.Fields = []tdp.Field{
|
||||
{
|
||||
Name: "Low",
|
||||
SchemaName: "low",
|
||||
},
|
||||
{
|
||||
Name: "Medium",
|
||||
SchemaName: "medium",
|
||||
},
|
||||
{
|
||||
Name: "High",
|
||||
SchemaName: "high",
|
||||
},
|
||||
}
|
||||
return typ
|
||||
}
|
||||
|
||||
// Encode implements bin.Encoder.
|
||||
func (a *AccountAutoDownloadSettings) Encode(b *bin.Buffer) error {
|
||||
if a == nil {
|
||||
return fmt.Errorf("can't encode account.autoDownloadSettings#63cacf26 as nil")
|
||||
}
|
||||
b.PutID(AccountAutoDownloadSettingsTypeID)
|
||||
return a.EncodeBare(b)
|
||||
}
|
||||
|
||||
// EncodeBare implements bin.BareEncoder.
|
||||
func (a *AccountAutoDownloadSettings) EncodeBare(b *bin.Buffer) error {
|
||||
if a == nil {
|
||||
return fmt.Errorf("can't encode account.autoDownloadSettings#63cacf26 as nil")
|
||||
}
|
||||
if err := a.Low.Encode(b); err != nil {
|
||||
return fmt.Errorf("unable to encode account.autoDownloadSettings#63cacf26: field low: %w", err)
|
||||
}
|
||||
if err := a.Medium.Encode(b); err != nil {
|
||||
return fmt.Errorf("unable to encode account.autoDownloadSettings#63cacf26: field medium: %w", err)
|
||||
}
|
||||
if err := a.High.Encode(b); err != nil {
|
||||
return fmt.Errorf("unable to encode account.autoDownloadSettings#63cacf26: field high: %w", err)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Decode implements bin.Decoder.
|
||||
func (a *AccountAutoDownloadSettings) Decode(b *bin.Buffer) error {
|
||||
if a == nil {
|
||||
return fmt.Errorf("can't decode account.autoDownloadSettings#63cacf26 to nil")
|
||||
}
|
||||
if err := b.ConsumeID(AccountAutoDownloadSettingsTypeID); err != nil {
|
||||
return fmt.Errorf("unable to decode account.autoDownloadSettings#63cacf26: %w", err)
|
||||
}
|
||||
return a.DecodeBare(b)
|
||||
}
|
||||
|
||||
// DecodeBare implements bin.BareDecoder.
|
||||
func (a *AccountAutoDownloadSettings) DecodeBare(b *bin.Buffer) error {
|
||||
if a == nil {
|
||||
return fmt.Errorf("can't decode account.autoDownloadSettings#63cacf26 to nil")
|
||||
}
|
||||
{
|
||||
if err := a.Low.Decode(b); err != nil {
|
||||
return fmt.Errorf("unable to decode account.autoDownloadSettings#63cacf26: field low: %w", err)
|
||||
}
|
||||
}
|
||||
{
|
||||
if err := a.Medium.Decode(b); err != nil {
|
||||
return fmt.Errorf("unable to decode account.autoDownloadSettings#63cacf26: field medium: %w", err)
|
||||
}
|
||||
}
|
||||
{
|
||||
if err := a.High.Decode(b); err != nil {
|
||||
return fmt.Errorf("unable to decode account.autoDownloadSettings#63cacf26: field high: %w", err)
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// GetLow returns value of Low field.
|
||||
func (a *AccountAutoDownloadSettings) GetLow() (value AutoDownloadSettings) {
|
||||
if a == nil {
|
||||
return
|
||||
}
|
||||
return a.Low
|
||||
}
|
||||
|
||||
// GetMedium returns value of Medium field.
|
||||
func (a *AccountAutoDownloadSettings) GetMedium() (value AutoDownloadSettings) {
|
||||
if a == nil {
|
||||
return
|
||||
}
|
||||
return a.Medium
|
||||
}
|
||||
|
||||
// GetHigh returns value of High field.
|
||||
func (a *AccountAutoDownloadSettings) GetHigh() (value AutoDownloadSettings) {
|
||||
if a == nil {
|
||||
return
|
||||
}
|
||||
return a.High
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
//go:build !no_gotd_slices
|
||||
// +build !no_gotd_slices
|
||||
|
||||
// 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{}
|
||||
)
|
||||
@@ -0,0 +1,364 @@
|
||||
// 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{}
|
||||
)
|
||||
|
||||
// AccountAutoSaveSettings represents TL type `account.autoSaveSettings#4c3e069d`.
|
||||
// Contains media autosave settings
|
||||
//
|
||||
// See https://core.telegram.org/constructor/account.autoSaveSettings for reference.
|
||||
type AccountAutoSaveSettings struct {
|
||||
// Default media autosave settings for private chats
|
||||
UsersSettings AutoSaveSettings
|
||||
// Default media autosave settings for groups and supergroups¹
|
||||
//
|
||||
// Links:
|
||||
// 1) https://core.telegram.org/api/channel
|
||||
ChatsSettings AutoSaveSettings
|
||||
// Default media autosave settings for channels¹
|
||||
//
|
||||
// Links:
|
||||
// 1) https://core.telegram.org/api/channel
|
||||
BroadcastsSettings AutoSaveSettings
|
||||
// Peer-specific granular autosave settings
|
||||
Exceptions []AutoSaveException
|
||||
// Chats mentioned in the peer-specific granular autosave settings
|
||||
Chats []ChatClass
|
||||
// Users mentioned in the peer-specific granular autosave settings
|
||||
Users []UserClass
|
||||
}
|
||||
|
||||
// AccountAutoSaveSettingsTypeID is TL type id of AccountAutoSaveSettings.
|
||||
const AccountAutoSaveSettingsTypeID = 0x4c3e069d
|
||||
|
||||
// Ensuring interfaces in compile-time for AccountAutoSaveSettings.
|
||||
var (
|
||||
_ bin.Encoder = &AccountAutoSaveSettings{}
|
||||
_ bin.Decoder = &AccountAutoSaveSettings{}
|
||||
_ bin.BareEncoder = &AccountAutoSaveSettings{}
|
||||
_ bin.BareDecoder = &AccountAutoSaveSettings{}
|
||||
)
|
||||
|
||||
func (a *AccountAutoSaveSettings) Zero() bool {
|
||||
if a == nil {
|
||||
return true
|
||||
}
|
||||
if !(a.UsersSettings.Zero()) {
|
||||
return false
|
||||
}
|
||||
if !(a.ChatsSettings.Zero()) {
|
||||
return false
|
||||
}
|
||||
if !(a.BroadcastsSettings.Zero()) {
|
||||
return false
|
||||
}
|
||||
if !(a.Exceptions == nil) {
|
||||
return false
|
||||
}
|
||||
if !(a.Chats == nil) {
|
||||
return false
|
||||
}
|
||||
if !(a.Users == nil) {
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
// String implements fmt.Stringer.
|
||||
func (a *AccountAutoSaveSettings) String() string {
|
||||
if a == nil {
|
||||
return "AccountAutoSaveSettings(nil)"
|
||||
}
|
||||
type Alias AccountAutoSaveSettings
|
||||
return fmt.Sprintf("AccountAutoSaveSettings%+v", Alias(*a))
|
||||
}
|
||||
|
||||
// FillFrom fills AccountAutoSaveSettings from given interface.
|
||||
func (a *AccountAutoSaveSettings) FillFrom(from interface {
|
||||
GetUsersSettings() (value AutoSaveSettings)
|
||||
GetChatsSettings() (value AutoSaveSettings)
|
||||
GetBroadcastsSettings() (value AutoSaveSettings)
|
||||
GetExceptions() (value []AutoSaveException)
|
||||
GetChats() (value []ChatClass)
|
||||
GetUsers() (value []UserClass)
|
||||
}) {
|
||||
a.UsersSettings = from.GetUsersSettings()
|
||||
a.ChatsSettings = from.GetChatsSettings()
|
||||
a.BroadcastsSettings = from.GetBroadcastsSettings()
|
||||
a.Exceptions = from.GetExceptions()
|
||||
a.Chats = from.GetChats()
|
||||
a.Users = from.GetUsers()
|
||||
}
|
||||
|
||||
// TypeID returns type id in TL schema.
|
||||
//
|
||||
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
||||
func (*AccountAutoSaveSettings) TypeID() uint32 {
|
||||
return AccountAutoSaveSettingsTypeID
|
||||
}
|
||||
|
||||
// TypeName returns name of type in TL schema.
|
||||
func (*AccountAutoSaveSettings) TypeName() string {
|
||||
return "account.autoSaveSettings"
|
||||
}
|
||||
|
||||
// TypeInfo returns info about TL type.
|
||||
func (a *AccountAutoSaveSettings) TypeInfo() tdp.Type {
|
||||
typ := tdp.Type{
|
||||
Name: "account.autoSaveSettings",
|
||||
ID: AccountAutoSaveSettingsTypeID,
|
||||
}
|
||||
if a == nil {
|
||||
typ.Null = true
|
||||
return typ
|
||||
}
|
||||
typ.Fields = []tdp.Field{
|
||||
{
|
||||
Name: "UsersSettings",
|
||||
SchemaName: "users_settings",
|
||||
},
|
||||
{
|
||||
Name: "ChatsSettings",
|
||||
SchemaName: "chats_settings",
|
||||
},
|
||||
{
|
||||
Name: "BroadcastsSettings",
|
||||
SchemaName: "broadcasts_settings",
|
||||
},
|
||||
{
|
||||
Name: "Exceptions",
|
||||
SchemaName: "exceptions",
|
||||
},
|
||||
{
|
||||
Name: "Chats",
|
||||
SchemaName: "chats",
|
||||
},
|
||||
{
|
||||
Name: "Users",
|
||||
SchemaName: "users",
|
||||
},
|
||||
}
|
||||
return typ
|
||||
}
|
||||
|
||||
// Encode implements bin.Encoder.
|
||||
func (a *AccountAutoSaveSettings) Encode(b *bin.Buffer) error {
|
||||
if a == nil {
|
||||
return fmt.Errorf("can't encode account.autoSaveSettings#4c3e069d as nil")
|
||||
}
|
||||
b.PutID(AccountAutoSaveSettingsTypeID)
|
||||
return a.EncodeBare(b)
|
||||
}
|
||||
|
||||
// EncodeBare implements bin.BareEncoder.
|
||||
func (a *AccountAutoSaveSettings) EncodeBare(b *bin.Buffer) error {
|
||||
if a == nil {
|
||||
return fmt.Errorf("can't encode account.autoSaveSettings#4c3e069d as nil")
|
||||
}
|
||||
if err := a.UsersSettings.Encode(b); err != nil {
|
||||
return fmt.Errorf("unable to encode account.autoSaveSettings#4c3e069d: field users_settings: %w", err)
|
||||
}
|
||||
if err := a.ChatsSettings.Encode(b); err != nil {
|
||||
return fmt.Errorf("unable to encode account.autoSaveSettings#4c3e069d: field chats_settings: %w", err)
|
||||
}
|
||||
if err := a.BroadcastsSettings.Encode(b); err != nil {
|
||||
return fmt.Errorf("unable to encode account.autoSaveSettings#4c3e069d: field broadcasts_settings: %w", err)
|
||||
}
|
||||
b.PutVectorHeader(len(a.Exceptions))
|
||||
for idx, v := range a.Exceptions {
|
||||
if err := v.Encode(b); err != nil {
|
||||
return fmt.Errorf("unable to encode account.autoSaveSettings#4c3e069d: field exceptions element with index %d: %w", idx, err)
|
||||
}
|
||||
}
|
||||
b.PutVectorHeader(len(a.Chats))
|
||||
for idx, v := range a.Chats {
|
||||
if v == nil {
|
||||
return fmt.Errorf("unable to encode account.autoSaveSettings#4c3e069d: field chats element with index %d is nil", idx)
|
||||
}
|
||||
if err := v.Encode(b); err != nil {
|
||||
return fmt.Errorf("unable to encode account.autoSaveSettings#4c3e069d: field chats element with index %d: %w", idx, err)
|
||||
}
|
||||
}
|
||||
b.PutVectorHeader(len(a.Users))
|
||||
for idx, v := range a.Users {
|
||||
if v == nil {
|
||||
return fmt.Errorf("unable to encode account.autoSaveSettings#4c3e069d: field users element with index %d is nil", idx)
|
||||
}
|
||||
if err := v.Encode(b); err != nil {
|
||||
return fmt.Errorf("unable to encode account.autoSaveSettings#4c3e069d: field users element with index %d: %w", idx, err)
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Decode implements bin.Decoder.
|
||||
func (a *AccountAutoSaveSettings) Decode(b *bin.Buffer) error {
|
||||
if a == nil {
|
||||
return fmt.Errorf("can't decode account.autoSaveSettings#4c3e069d to nil")
|
||||
}
|
||||
if err := b.ConsumeID(AccountAutoSaveSettingsTypeID); err != nil {
|
||||
return fmt.Errorf("unable to decode account.autoSaveSettings#4c3e069d: %w", err)
|
||||
}
|
||||
return a.DecodeBare(b)
|
||||
}
|
||||
|
||||
// DecodeBare implements bin.BareDecoder.
|
||||
func (a *AccountAutoSaveSettings) DecodeBare(b *bin.Buffer) error {
|
||||
if a == nil {
|
||||
return fmt.Errorf("can't decode account.autoSaveSettings#4c3e069d to nil")
|
||||
}
|
||||
{
|
||||
if err := a.UsersSettings.Decode(b); err != nil {
|
||||
return fmt.Errorf("unable to decode account.autoSaveSettings#4c3e069d: field users_settings: %w", err)
|
||||
}
|
||||
}
|
||||
{
|
||||
if err := a.ChatsSettings.Decode(b); err != nil {
|
||||
return fmt.Errorf("unable to decode account.autoSaveSettings#4c3e069d: field chats_settings: %w", err)
|
||||
}
|
||||
}
|
||||
{
|
||||
if err := a.BroadcastsSettings.Decode(b); err != nil {
|
||||
return fmt.Errorf("unable to decode account.autoSaveSettings#4c3e069d: field broadcasts_settings: %w", err)
|
||||
}
|
||||
}
|
||||
{
|
||||
headerLen, err := b.VectorHeader()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode account.autoSaveSettings#4c3e069d: field exceptions: %w", err)
|
||||
}
|
||||
|
||||
if headerLen > 0 {
|
||||
a.Exceptions = make([]AutoSaveException, 0, headerLen%bin.PreallocateLimit)
|
||||
}
|
||||
for idx := 0; idx < headerLen; idx++ {
|
||||
var value AutoSaveException
|
||||
if err := value.Decode(b); err != nil {
|
||||
return fmt.Errorf("unable to decode account.autoSaveSettings#4c3e069d: field exceptions: %w", err)
|
||||
}
|
||||
a.Exceptions = append(a.Exceptions, value)
|
||||
}
|
||||
}
|
||||
{
|
||||
headerLen, err := b.VectorHeader()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode account.autoSaveSettings#4c3e069d: field chats: %w", err)
|
||||
}
|
||||
|
||||
if headerLen > 0 {
|
||||
a.Chats = make([]ChatClass, 0, headerLen%bin.PreallocateLimit)
|
||||
}
|
||||
for idx := 0; idx < headerLen; idx++ {
|
||||
value, err := DecodeChat(b)
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode account.autoSaveSettings#4c3e069d: field chats: %w", err)
|
||||
}
|
||||
a.Chats = append(a.Chats, value)
|
||||
}
|
||||
}
|
||||
{
|
||||
headerLen, err := b.VectorHeader()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode account.autoSaveSettings#4c3e069d: field users: %w", err)
|
||||
}
|
||||
|
||||
if headerLen > 0 {
|
||||
a.Users = make([]UserClass, 0, headerLen%bin.PreallocateLimit)
|
||||
}
|
||||
for idx := 0; idx < headerLen; idx++ {
|
||||
value, err := DecodeUser(b)
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode account.autoSaveSettings#4c3e069d: field users: %w", err)
|
||||
}
|
||||
a.Users = append(a.Users, value)
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// GetUsersSettings returns value of UsersSettings field.
|
||||
func (a *AccountAutoSaveSettings) GetUsersSettings() (value AutoSaveSettings) {
|
||||
if a == nil {
|
||||
return
|
||||
}
|
||||
return a.UsersSettings
|
||||
}
|
||||
|
||||
// GetChatsSettings returns value of ChatsSettings field.
|
||||
func (a *AccountAutoSaveSettings) GetChatsSettings() (value AutoSaveSettings) {
|
||||
if a == nil {
|
||||
return
|
||||
}
|
||||
return a.ChatsSettings
|
||||
}
|
||||
|
||||
// GetBroadcastsSettings returns value of BroadcastsSettings field.
|
||||
func (a *AccountAutoSaveSettings) GetBroadcastsSettings() (value AutoSaveSettings) {
|
||||
if a == nil {
|
||||
return
|
||||
}
|
||||
return a.BroadcastsSettings
|
||||
}
|
||||
|
||||
// GetExceptions returns value of Exceptions field.
|
||||
func (a *AccountAutoSaveSettings) GetExceptions() (value []AutoSaveException) {
|
||||
if a == nil {
|
||||
return
|
||||
}
|
||||
return a.Exceptions
|
||||
}
|
||||
|
||||
// GetChats returns value of Chats field.
|
||||
func (a *AccountAutoSaveSettings) GetChats() (value []ChatClass) {
|
||||
if a == nil {
|
||||
return
|
||||
}
|
||||
return a.Chats
|
||||
}
|
||||
|
||||
// GetUsers returns value of Users field.
|
||||
func (a *AccountAutoSaveSettings) GetUsers() (value []UserClass) {
|
||||
if a == nil {
|
||||
return
|
||||
}
|
||||
return a.Users
|
||||
}
|
||||
|
||||
// MapChats returns field Chats wrapped in ChatClassArray helper.
|
||||
func (a *AccountAutoSaveSettings) MapChats() (value ChatClassArray) {
|
||||
return ChatClassArray(a.Chats)
|
||||
}
|
||||
|
||||
// MapUsers returns field Users wrapped in UserClassArray helper.
|
||||
func (a *AccountAutoSaveSettings) MapUsers() (value UserClassArray) {
|
||||
return UserClassArray(a.Users)
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
//go:build !no_gotd_slices
|
||||
// +build !no_gotd_slices
|
||||
|
||||
// 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{}
|
||||
)
|
||||
@@ -0,0 +1,280 @@
|
||||
// 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{}
|
||||
)
|
||||
|
||||
// AccountBusinessChatLinks represents TL type `account.businessChatLinks#ec43a2d1`.
|
||||
// Contains info about business chat deep links »¹ created by the current account.
|
||||
//
|
||||
// Links:
|
||||
// 1. https://core.telegram.org/api/business#business-chat-links
|
||||
//
|
||||
// See https://core.telegram.org/constructor/account.businessChatLinks for reference.
|
||||
type AccountBusinessChatLinks struct {
|
||||
// Links
|
||||
Links []BusinessChatLink
|
||||
// Mentioned chats
|
||||
Chats []ChatClass
|
||||
// Mentioned users
|
||||
Users []UserClass
|
||||
}
|
||||
|
||||
// AccountBusinessChatLinksTypeID is TL type id of AccountBusinessChatLinks.
|
||||
const AccountBusinessChatLinksTypeID = 0xec43a2d1
|
||||
|
||||
// Ensuring interfaces in compile-time for AccountBusinessChatLinks.
|
||||
var (
|
||||
_ bin.Encoder = &AccountBusinessChatLinks{}
|
||||
_ bin.Decoder = &AccountBusinessChatLinks{}
|
||||
_ bin.BareEncoder = &AccountBusinessChatLinks{}
|
||||
_ bin.BareDecoder = &AccountBusinessChatLinks{}
|
||||
)
|
||||
|
||||
func (b *AccountBusinessChatLinks) Zero() bool {
|
||||
if b == nil {
|
||||
return true
|
||||
}
|
||||
if !(b.Links == nil) {
|
||||
return false
|
||||
}
|
||||
if !(b.Chats == nil) {
|
||||
return false
|
||||
}
|
||||
if !(b.Users == nil) {
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
// String implements fmt.Stringer.
|
||||
func (b *AccountBusinessChatLinks) String() string {
|
||||
if b == nil {
|
||||
return "AccountBusinessChatLinks(nil)"
|
||||
}
|
||||
type Alias AccountBusinessChatLinks
|
||||
return fmt.Sprintf("AccountBusinessChatLinks%+v", Alias(*b))
|
||||
}
|
||||
|
||||
// FillFrom fills AccountBusinessChatLinks from given interface.
|
||||
func (b *AccountBusinessChatLinks) FillFrom(from interface {
|
||||
GetLinks() (value []BusinessChatLink)
|
||||
GetChats() (value []ChatClass)
|
||||
GetUsers() (value []UserClass)
|
||||
}) {
|
||||
b.Links = from.GetLinks()
|
||||
b.Chats = from.GetChats()
|
||||
b.Users = from.GetUsers()
|
||||
}
|
||||
|
||||
// TypeID returns type id in TL schema.
|
||||
//
|
||||
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
||||
func (*AccountBusinessChatLinks) TypeID() uint32 {
|
||||
return AccountBusinessChatLinksTypeID
|
||||
}
|
||||
|
||||
// TypeName returns name of type in TL schema.
|
||||
func (*AccountBusinessChatLinks) TypeName() string {
|
||||
return "account.businessChatLinks"
|
||||
}
|
||||
|
||||
// TypeInfo returns info about TL type.
|
||||
func (b *AccountBusinessChatLinks) TypeInfo() tdp.Type {
|
||||
typ := tdp.Type{
|
||||
Name: "account.businessChatLinks",
|
||||
ID: AccountBusinessChatLinksTypeID,
|
||||
}
|
||||
if b == nil {
|
||||
typ.Null = true
|
||||
return typ
|
||||
}
|
||||
typ.Fields = []tdp.Field{
|
||||
{
|
||||
Name: "Links",
|
||||
SchemaName: "links",
|
||||
},
|
||||
{
|
||||
Name: "Chats",
|
||||
SchemaName: "chats",
|
||||
},
|
||||
{
|
||||
Name: "Users",
|
||||
SchemaName: "users",
|
||||
},
|
||||
}
|
||||
return typ
|
||||
}
|
||||
|
||||
// Encode implements bin.Encoder.
|
||||
func (b *AccountBusinessChatLinks) Encode(buf *bin.Buffer) error {
|
||||
if b == nil {
|
||||
return fmt.Errorf("can't encode account.businessChatLinks#ec43a2d1 as nil")
|
||||
}
|
||||
buf.PutID(AccountBusinessChatLinksTypeID)
|
||||
return b.EncodeBare(buf)
|
||||
}
|
||||
|
||||
// EncodeBare implements bin.BareEncoder.
|
||||
func (b *AccountBusinessChatLinks) EncodeBare(buf *bin.Buffer) error {
|
||||
if b == nil {
|
||||
return fmt.Errorf("can't encode account.businessChatLinks#ec43a2d1 as nil")
|
||||
}
|
||||
buf.PutVectorHeader(len(b.Links))
|
||||
for idx, v := range b.Links {
|
||||
if err := v.Encode(buf); err != nil {
|
||||
return fmt.Errorf("unable to encode account.businessChatLinks#ec43a2d1: field links element with index %d: %w", idx, err)
|
||||
}
|
||||
}
|
||||
buf.PutVectorHeader(len(b.Chats))
|
||||
for idx, v := range b.Chats {
|
||||
if v == nil {
|
||||
return fmt.Errorf("unable to encode account.businessChatLinks#ec43a2d1: field chats element with index %d is nil", idx)
|
||||
}
|
||||
if err := v.Encode(buf); err != nil {
|
||||
return fmt.Errorf("unable to encode account.businessChatLinks#ec43a2d1: field chats element with index %d: %w", idx, err)
|
||||
}
|
||||
}
|
||||
buf.PutVectorHeader(len(b.Users))
|
||||
for idx, v := range b.Users {
|
||||
if v == nil {
|
||||
return fmt.Errorf("unable to encode account.businessChatLinks#ec43a2d1: field users element with index %d is nil", idx)
|
||||
}
|
||||
if err := v.Encode(buf); err != nil {
|
||||
return fmt.Errorf("unable to encode account.businessChatLinks#ec43a2d1: field users element with index %d: %w", idx, err)
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Decode implements bin.Decoder.
|
||||
func (b *AccountBusinessChatLinks) Decode(buf *bin.Buffer) error {
|
||||
if b == nil {
|
||||
return fmt.Errorf("can't decode account.businessChatLinks#ec43a2d1 to nil")
|
||||
}
|
||||
if err := buf.ConsumeID(AccountBusinessChatLinksTypeID); err != nil {
|
||||
return fmt.Errorf("unable to decode account.businessChatLinks#ec43a2d1: %w", err)
|
||||
}
|
||||
return b.DecodeBare(buf)
|
||||
}
|
||||
|
||||
// DecodeBare implements bin.BareDecoder.
|
||||
func (b *AccountBusinessChatLinks) DecodeBare(buf *bin.Buffer) error {
|
||||
if b == nil {
|
||||
return fmt.Errorf("can't decode account.businessChatLinks#ec43a2d1 to nil")
|
||||
}
|
||||
{
|
||||
headerLen, err := buf.VectorHeader()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode account.businessChatLinks#ec43a2d1: field links: %w", err)
|
||||
}
|
||||
|
||||
if headerLen > 0 {
|
||||
b.Links = make([]BusinessChatLink, 0, headerLen%bin.PreallocateLimit)
|
||||
}
|
||||
for idx := 0; idx < headerLen; idx++ {
|
||||
var value BusinessChatLink
|
||||
if err := value.Decode(buf); err != nil {
|
||||
return fmt.Errorf("unable to decode account.businessChatLinks#ec43a2d1: field links: %w", err)
|
||||
}
|
||||
b.Links = append(b.Links, value)
|
||||
}
|
||||
}
|
||||
{
|
||||
headerLen, err := buf.VectorHeader()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode account.businessChatLinks#ec43a2d1: field chats: %w", err)
|
||||
}
|
||||
|
||||
if headerLen > 0 {
|
||||
b.Chats = make([]ChatClass, 0, headerLen%bin.PreallocateLimit)
|
||||
}
|
||||
for idx := 0; idx < headerLen; idx++ {
|
||||
value, err := DecodeChat(buf)
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode account.businessChatLinks#ec43a2d1: field chats: %w", err)
|
||||
}
|
||||
b.Chats = append(b.Chats, value)
|
||||
}
|
||||
}
|
||||
{
|
||||
headerLen, err := buf.VectorHeader()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode account.businessChatLinks#ec43a2d1: field users: %w", err)
|
||||
}
|
||||
|
||||
if headerLen > 0 {
|
||||
b.Users = make([]UserClass, 0, headerLen%bin.PreallocateLimit)
|
||||
}
|
||||
for idx := 0; idx < headerLen; idx++ {
|
||||
value, err := DecodeUser(buf)
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode account.businessChatLinks#ec43a2d1: field users: %w", err)
|
||||
}
|
||||
b.Users = append(b.Users, value)
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// GetLinks returns value of Links field.
|
||||
func (b *AccountBusinessChatLinks) GetLinks() (value []BusinessChatLink) {
|
||||
if b == nil {
|
||||
return
|
||||
}
|
||||
return b.Links
|
||||
}
|
||||
|
||||
// GetChats returns value of Chats field.
|
||||
func (b *AccountBusinessChatLinks) GetChats() (value []ChatClass) {
|
||||
if b == nil {
|
||||
return
|
||||
}
|
||||
return b.Chats
|
||||
}
|
||||
|
||||
// GetUsers returns value of Users field.
|
||||
func (b *AccountBusinessChatLinks) GetUsers() (value []UserClass) {
|
||||
if b == nil {
|
||||
return
|
||||
}
|
||||
return b.Users
|
||||
}
|
||||
|
||||
// MapChats returns field Chats wrapped in ChatClassArray helper.
|
||||
func (b *AccountBusinessChatLinks) MapChats() (value ChatClassArray) {
|
||||
return ChatClassArray(b.Chats)
|
||||
}
|
||||
|
||||
// MapUsers returns field Users wrapped in UserClassArray helper.
|
||||
func (b *AccountBusinessChatLinks) MapUsers() (value UserClassArray) {
|
||||
return UserClassArray(b.Users)
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
//go:build !no_gotd_slices
|
||||
// +build !no_gotd_slices
|
||||
|
||||
// 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{}
|
||||
)
|
||||
@@ -0,0 +1,154 @@
|
||||
// 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{}
|
||||
)
|
||||
|
||||
// AccountCancelPasswordEmailRequest represents TL type `account.cancelPasswordEmail#c1cbd5b6`.
|
||||
// Cancel the code that was sent to verify an email to use as 2FA recovery method¹.
|
||||
//
|
||||
// Links:
|
||||
// 1. https://core.telegram.org/api/srp
|
||||
//
|
||||
// See https://core.telegram.org/method/account.cancelPasswordEmail for reference.
|
||||
type AccountCancelPasswordEmailRequest struct {
|
||||
}
|
||||
|
||||
// AccountCancelPasswordEmailRequestTypeID is TL type id of AccountCancelPasswordEmailRequest.
|
||||
const AccountCancelPasswordEmailRequestTypeID = 0xc1cbd5b6
|
||||
|
||||
// Ensuring interfaces in compile-time for AccountCancelPasswordEmailRequest.
|
||||
var (
|
||||
_ bin.Encoder = &AccountCancelPasswordEmailRequest{}
|
||||
_ bin.Decoder = &AccountCancelPasswordEmailRequest{}
|
||||
_ bin.BareEncoder = &AccountCancelPasswordEmailRequest{}
|
||||
_ bin.BareDecoder = &AccountCancelPasswordEmailRequest{}
|
||||
)
|
||||
|
||||
func (c *AccountCancelPasswordEmailRequest) Zero() bool {
|
||||
if c == nil {
|
||||
return true
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
// String implements fmt.Stringer.
|
||||
func (c *AccountCancelPasswordEmailRequest) String() string {
|
||||
if c == nil {
|
||||
return "AccountCancelPasswordEmailRequest(nil)"
|
||||
}
|
||||
type Alias AccountCancelPasswordEmailRequest
|
||||
return fmt.Sprintf("AccountCancelPasswordEmailRequest%+v", Alias(*c))
|
||||
}
|
||||
|
||||
// TypeID returns type id in TL schema.
|
||||
//
|
||||
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
||||
func (*AccountCancelPasswordEmailRequest) TypeID() uint32 {
|
||||
return AccountCancelPasswordEmailRequestTypeID
|
||||
}
|
||||
|
||||
// TypeName returns name of type in TL schema.
|
||||
func (*AccountCancelPasswordEmailRequest) TypeName() string {
|
||||
return "account.cancelPasswordEmail"
|
||||
}
|
||||
|
||||
// TypeInfo returns info about TL type.
|
||||
func (c *AccountCancelPasswordEmailRequest) TypeInfo() tdp.Type {
|
||||
typ := tdp.Type{
|
||||
Name: "account.cancelPasswordEmail",
|
||||
ID: AccountCancelPasswordEmailRequestTypeID,
|
||||
}
|
||||
if c == nil {
|
||||
typ.Null = true
|
||||
return typ
|
||||
}
|
||||
typ.Fields = []tdp.Field{}
|
||||
return typ
|
||||
}
|
||||
|
||||
// Encode implements bin.Encoder.
|
||||
func (c *AccountCancelPasswordEmailRequest) Encode(b *bin.Buffer) error {
|
||||
if c == nil {
|
||||
return fmt.Errorf("can't encode account.cancelPasswordEmail#c1cbd5b6 as nil")
|
||||
}
|
||||
b.PutID(AccountCancelPasswordEmailRequestTypeID)
|
||||
return c.EncodeBare(b)
|
||||
}
|
||||
|
||||
// EncodeBare implements bin.BareEncoder.
|
||||
func (c *AccountCancelPasswordEmailRequest) EncodeBare(b *bin.Buffer) error {
|
||||
if c == nil {
|
||||
return fmt.Errorf("can't encode account.cancelPasswordEmail#c1cbd5b6 as nil")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Decode implements bin.Decoder.
|
||||
func (c *AccountCancelPasswordEmailRequest) Decode(b *bin.Buffer) error {
|
||||
if c == nil {
|
||||
return fmt.Errorf("can't decode account.cancelPasswordEmail#c1cbd5b6 to nil")
|
||||
}
|
||||
if err := b.ConsumeID(AccountCancelPasswordEmailRequestTypeID); err != nil {
|
||||
return fmt.Errorf("unable to decode account.cancelPasswordEmail#c1cbd5b6: %w", err)
|
||||
}
|
||||
return c.DecodeBare(b)
|
||||
}
|
||||
|
||||
// DecodeBare implements bin.BareDecoder.
|
||||
func (c *AccountCancelPasswordEmailRequest) DecodeBare(b *bin.Buffer) error {
|
||||
if c == nil {
|
||||
return fmt.Errorf("can't decode account.cancelPasswordEmail#c1cbd5b6 to nil")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// AccountCancelPasswordEmail invokes method account.cancelPasswordEmail#c1cbd5b6 returning error if any.
|
||||
// Cancel the code that was sent to verify an email to use as 2FA recovery method¹.
|
||||
//
|
||||
// Links:
|
||||
// 1. https://core.telegram.org/api/srp
|
||||
//
|
||||
// Possible errors:
|
||||
//
|
||||
// 400 EMAIL_HASH_EXPIRED: Email hash expired.
|
||||
//
|
||||
// See https://core.telegram.org/method/account.cancelPasswordEmail for reference.
|
||||
func (c *Client) AccountCancelPasswordEmail(ctx context.Context) (bool, error) {
|
||||
var result BoolBox
|
||||
|
||||
request := &AccountCancelPasswordEmailRequest{}
|
||||
if err := c.rpc.Invoke(ctx, request, &result); err != nil {
|
||||
return false, err
|
||||
}
|
||||
_, ok := result.Bool.(*BoolTrue)
|
||||
return ok, nil
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
//go:build !no_gotd_slices
|
||||
// +build !no_gotd_slices
|
||||
|
||||
// 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{}
|
||||
)
|
||||
@@ -0,0 +1,342 @@
|
||||
// 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{}
|
||||
)
|
||||
|
||||
// AccountChangeAuthorizationSettingsRequest represents TL type `account.changeAuthorizationSettings#40f48462`.
|
||||
// Change settings related to a session.
|
||||
//
|
||||
// See https://core.telegram.org/method/account.changeAuthorizationSettings for reference.
|
||||
type AccountChangeAuthorizationSettingsRequest struct {
|
||||
// Flags, see TL conditional fields¹
|
||||
//
|
||||
// Links:
|
||||
// 1) https://core.telegram.org/mtproto/TL-combinators#conditional-fields
|
||||
Flags bin.Fields
|
||||
// If set, confirms a newly logged in session »¹.
|
||||
//
|
||||
// Links:
|
||||
// 1) https://core.telegram.org/api/auth#confirming-login
|
||||
Confirmed bool
|
||||
// Session ID from the authorization¹ constructor, fetchable using account
|
||||
// getAuthorizations²
|
||||
//
|
||||
// Links:
|
||||
// 1) https://core.telegram.org/constructor/authorization
|
||||
// 2) https://core.telegram.org/method/account.getAuthorizations
|
||||
Hash int64
|
||||
// Whether to enable or disable receiving encrypted chats: if the flag is not set, the
|
||||
// previous setting is not changed
|
||||
//
|
||||
// Use SetEncryptedRequestsDisabled and GetEncryptedRequestsDisabled helpers.
|
||||
EncryptedRequestsDisabled bool
|
||||
// Whether to enable or disable receiving calls: if the flag is not set, the previous
|
||||
// setting is not changed
|
||||
//
|
||||
// Use SetCallRequestsDisabled and GetCallRequestsDisabled helpers.
|
||||
CallRequestsDisabled bool
|
||||
}
|
||||
|
||||
// AccountChangeAuthorizationSettingsRequestTypeID is TL type id of AccountChangeAuthorizationSettingsRequest.
|
||||
const AccountChangeAuthorizationSettingsRequestTypeID = 0x40f48462
|
||||
|
||||
// Ensuring interfaces in compile-time for AccountChangeAuthorizationSettingsRequest.
|
||||
var (
|
||||
_ bin.Encoder = &AccountChangeAuthorizationSettingsRequest{}
|
||||
_ bin.Decoder = &AccountChangeAuthorizationSettingsRequest{}
|
||||
_ bin.BareEncoder = &AccountChangeAuthorizationSettingsRequest{}
|
||||
_ bin.BareDecoder = &AccountChangeAuthorizationSettingsRequest{}
|
||||
)
|
||||
|
||||
func (c *AccountChangeAuthorizationSettingsRequest) Zero() bool {
|
||||
if c == nil {
|
||||
return true
|
||||
}
|
||||
if !(c.Flags.Zero()) {
|
||||
return false
|
||||
}
|
||||
if !(c.Confirmed == false) {
|
||||
return false
|
||||
}
|
||||
if !(c.Hash == 0) {
|
||||
return false
|
||||
}
|
||||
if !(c.EncryptedRequestsDisabled == false) {
|
||||
return false
|
||||
}
|
||||
if !(c.CallRequestsDisabled == false) {
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
// String implements fmt.Stringer.
|
||||
func (c *AccountChangeAuthorizationSettingsRequest) String() string {
|
||||
if c == nil {
|
||||
return "AccountChangeAuthorizationSettingsRequest(nil)"
|
||||
}
|
||||
type Alias AccountChangeAuthorizationSettingsRequest
|
||||
return fmt.Sprintf("AccountChangeAuthorizationSettingsRequest%+v", Alias(*c))
|
||||
}
|
||||
|
||||
// FillFrom fills AccountChangeAuthorizationSettingsRequest from given interface.
|
||||
func (c *AccountChangeAuthorizationSettingsRequest) FillFrom(from interface {
|
||||
GetConfirmed() (value bool)
|
||||
GetHash() (value int64)
|
||||
GetEncryptedRequestsDisabled() (value bool, ok bool)
|
||||
GetCallRequestsDisabled() (value bool, ok bool)
|
||||
}) {
|
||||
c.Confirmed = from.GetConfirmed()
|
||||
c.Hash = from.GetHash()
|
||||
if val, ok := from.GetEncryptedRequestsDisabled(); ok {
|
||||
c.EncryptedRequestsDisabled = val
|
||||
}
|
||||
|
||||
if val, ok := from.GetCallRequestsDisabled(); ok {
|
||||
c.CallRequestsDisabled = val
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// TypeID returns type id in TL schema.
|
||||
//
|
||||
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
||||
func (*AccountChangeAuthorizationSettingsRequest) TypeID() uint32 {
|
||||
return AccountChangeAuthorizationSettingsRequestTypeID
|
||||
}
|
||||
|
||||
// TypeName returns name of type in TL schema.
|
||||
func (*AccountChangeAuthorizationSettingsRequest) TypeName() string {
|
||||
return "account.changeAuthorizationSettings"
|
||||
}
|
||||
|
||||
// TypeInfo returns info about TL type.
|
||||
func (c *AccountChangeAuthorizationSettingsRequest) TypeInfo() tdp.Type {
|
||||
typ := tdp.Type{
|
||||
Name: "account.changeAuthorizationSettings",
|
||||
ID: AccountChangeAuthorizationSettingsRequestTypeID,
|
||||
}
|
||||
if c == nil {
|
||||
typ.Null = true
|
||||
return typ
|
||||
}
|
||||
typ.Fields = []tdp.Field{
|
||||
{
|
||||
Name: "Confirmed",
|
||||
SchemaName: "confirmed",
|
||||
Null: !c.Flags.Has(3),
|
||||
},
|
||||
{
|
||||
Name: "Hash",
|
||||
SchemaName: "hash",
|
||||
},
|
||||
{
|
||||
Name: "EncryptedRequestsDisabled",
|
||||
SchemaName: "encrypted_requests_disabled",
|
||||
Null: !c.Flags.Has(0),
|
||||
},
|
||||
{
|
||||
Name: "CallRequestsDisabled",
|
||||
SchemaName: "call_requests_disabled",
|
||||
Null: !c.Flags.Has(1),
|
||||
},
|
||||
}
|
||||
return typ
|
||||
}
|
||||
|
||||
// SetFlags sets flags for non-zero fields.
|
||||
func (c *AccountChangeAuthorizationSettingsRequest) SetFlags() {
|
||||
if !(c.Confirmed == false) {
|
||||
c.Flags.Set(3)
|
||||
}
|
||||
if !(c.EncryptedRequestsDisabled == false) {
|
||||
c.Flags.Set(0)
|
||||
}
|
||||
if !(c.CallRequestsDisabled == false) {
|
||||
c.Flags.Set(1)
|
||||
}
|
||||
}
|
||||
|
||||
// Encode implements bin.Encoder.
|
||||
func (c *AccountChangeAuthorizationSettingsRequest) Encode(b *bin.Buffer) error {
|
||||
if c == nil {
|
||||
return fmt.Errorf("can't encode account.changeAuthorizationSettings#40f48462 as nil")
|
||||
}
|
||||
b.PutID(AccountChangeAuthorizationSettingsRequestTypeID)
|
||||
return c.EncodeBare(b)
|
||||
}
|
||||
|
||||
// EncodeBare implements bin.BareEncoder.
|
||||
func (c *AccountChangeAuthorizationSettingsRequest) EncodeBare(b *bin.Buffer) error {
|
||||
if c == nil {
|
||||
return fmt.Errorf("can't encode account.changeAuthorizationSettings#40f48462 as nil")
|
||||
}
|
||||
c.SetFlags()
|
||||
if err := c.Flags.Encode(b); err != nil {
|
||||
return fmt.Errorf("unable to encode account.changeAuthorizationSettings#40f48462: field flags: %w", err)
|
||||
}
|
||||
b.PutLong(c.Hash)
|
||||
if c.Flags.Has(0) {
|
||||
b.PutBool(c.EncryptedRequestsDisabled)
|
||||
}
|
||||
if c.Flags.Has(1) {
|
||||
b.PutBool(c.CallRequestsDisabled)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Decode implements bin.Decoder.
|
||||
func (c *AccountChangeAuthorizationSettingsRequest) Decode(b *bin.Buffer) error {
|
||||
if c == nil {
|
||||
return fmt.Errorf("can't decode account.changeAuthorizationSettings#40f48462 to nil")
|
||||
}
|
||||
if err := b.ConsumeID(AccountChangeAuthorizationSettingsRequestTypeID); err != nil {
|
||||
return fmt.Errorf("unable to decode account.changeAuthorizationSettings#40f48462: %w", err)
|
||||
}
|
||||
return c.DecodeBare(b)
|
||||
}
|
||||
|
||||
// DecodeBare implements bin.BareDecoder.
|
||||
func (c *AccountChangeAuthorizationSettingsRequest) DecodeBare(b *bin.Buffer) error {
|
||||
if c == nil {
|
||||
return fmt.Errorf("can't decode account.changeAuthorizationSettings#40f48462 to nil")
|
||||
}
|
||||
{
|
||||
if err := c.Flags.Decode(b); err != nil {
|
||||
return fmt.Errorf("unable to decode account.changeAuthorizationSettings#40f48462: field flags: %w", err)
|
||||
}
|
||||
}
|
||||
c.Confirmed = c.Flags.Has(3)
|
||||
{
|
||||
value, err := b.Long()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode account.changeAuthorizationSettings#40f48462: field hash: %w", err)
|
||||
}
|
||||
c.Hash = value
|
||||
}
|
||||
if c.Flags.Has(0) {
|
||||
value, err := b.Bool()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode account.changeAuthorizationSettings#40f48462: field encrypted_requests_disabled: %w", err)
|
||||
}
|
||||
c.EncryptedRequestsDisabled = value
|
||||
}
|
||||
if c.Flags.Has(1) {
|
||||
value, err := b.Bool()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode account.changeAuthorizationSettings#40f48462: field call_requests_disabled: %w", err)
|
||||
}
|
||||
c.CallRequestsDisabled = value
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// SetConfirmed sets value of Confirmed conditional field.
|
||||
func (c *AccountChangeAuthorizationSettingsRequest) SetConfirmed(value bool) {
|
||||
if value {
|
||||
c.Flags.Set(3)
|
||||
c.Confirmed = true
|
||||
} else {
|
||||
c.Flags.Unset(3)
|
||||
c.Confirmed = false
|
||||
}
|
||||
}
|
||||
|
||||
// GetConfirmed returns value of Confirmed conditional field.
|
||||
func (c *AccountChangeAuthorizationSettingsRequest) GetConfirmed() (value bool) {
|
||||
if c == nil {
|
||||
return
|
||||
}
|
||||
return c.Flags.Has(3)
|
||||
}
|
||||
|
||||
// GetHash returns value of Hash field.
|
||||
func (c *AccountChangeAuthorizationSettingsRequest) GetHash() (value int64) {
|
||||
if c == nil {
|
||||
return
|
||||
}
|
||||
return c.Hash
|
||||
}
|
||||
|
||||
// SetEncryptedRequestsDisabled sets value of EncryptedRequestsDisabled conditional field.
|
||||
func (c *AccountChangeAuthorizationSettingsRequest) SetEncryptedRequestsDisabled(value bool) {
|
||||
c.Flags.Set(0)
|
||||
c.EncryptedRequestsDisabled = value
|
||||
}
|
||||
|
||||
// GetEncryptedRequestsDisabled returns value of EncryptedRequestsDisabled conditional field and
|
||||
// boolean which is true if field was set.
|
||||
func (c *AccountChangeAuthorizationSettingsRequest) GetEncryptedRequestsDisabled() (value bool, ok bool) {
|
||||
if c == nil {
|
||||
return
|
||||
}
|
||||
if !c.Flags.Has(0) {
|
||||
return value, false
|
||||
}
|
||||
return c.EncryptedRequestsDisabled, true
|
||||
}
|
||||
|
||||
// SetCallRequestsDisabled sets value of CallRequestsDisabled conditional field.
|
||||
func (c *AccountChangeAuthorizationSettingsRequest) SetCallRequestsDisabled(value bool) {
|
||||
c.Flags.Set(1)
|
||||
c.CallRequestsDisabled = value
|
||||
}
|
||||
|
||||
// GetCallRequestsDisabled returns value of CallRequestsDisabled conditional field and
|
||||
// boolean which is true if field was set.
|
||||
func (c *AccountChangeAuthorizationSettingsRequest) GetCallRequestsDisabled() (value bool, ok bool) {
|
||||
if c == nil {
|
||||
return
|
||||
}
|
||||
if !c.Flags.Has(1) {
|
||||
return value, false
|
||||
}
|
||||
return c.CallRequestsDisabled, true
|
||||
}
|
||||
|
||||
// AccountChangeAuthorizationSettings invokes method account.changeAuthorizationSettings#40f48462 returning error if any.
|
||||
// Change settings related to a session.
|
||||
//
|
||||
// Possible errors:
|
||||
//
|
||||
// 400 HASH_INVALID: The provided hash is invalid.
|
||||
//
|
||||
// See https://core.telegram.org/method/account.changeAuthorizationSettings for reference.
|
||||
func (c *Client) AccountChangeAuthorizationSettings(ctx context.Context, request *AccountChangeAuthorizationSettingsRequest) (bool, error) {
|
||||
var result BoolBox
|
||||
|
||||
if err := c.rpc.Invoke(ctx, request, &result); err != nil {
|
||||
return false, err
|
||||
}
|
||||
_, ok := result.Bool.(*BoolTrue)
|
||||
return ok, nil
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
//go:build !no_gotd_slices
|
||||
// +build !no_gotd_slices
|
||||
|
||||
// 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{}
|
||||
)
|
||||
@@ -0,0 +1,242 @@
|
||||
// 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{}
|
||||
)
|
||||
|
||||
// AccountChangePhoneRequest represents TL type `account.changePhone#70c32edb`.
|
||||
// Change the phone number of the current account
|
||||
//
|
||||
// See https://core.telegram.org/method/account.changePhone for reference.
|
||||
type AccountChangePhoneRequest struct {
|
||||
// New phone number
|
||||
PhoneNumber string
|
||||
// Phone code hash received when calling account.sendChangePhoneCode¹
|
||||
//
|
||||
// Links:
|
||||
// 1) https://core.telegram.org/method/account.sendChangePhoneCode
|
||||
PhoneCodeHash string
|
||||
// Phone code received when calling account.sendChangePhoneCode¹
|
||||
//
|
||||
// Links:
|
||||
// 1) https://core.telegram.org/method/account.sendChangePhoneCode
|
||||
PhoneCode string
|
||||
}
|
||||
|
||||
// AccountChangePhoneRequestTypeID is TL type id of AccountChangePhoneRequest.
|
||||
const AccountChangePhoneRequestTypeID = 0x70c32edb
|
||||
|
||||
// Ensuring interfaces in compile-time for AccountChangePhoneRequest.
|
||||
var (
|
||||
_ bin.Encoder = &AccountChangePhoneRequest{}
|
||||
_ bin.Decoder = &AccountChangePhoneRequest{}
|
||||
_ bin.BareEncoder = &AccountChangePhoneRequest{}
|
||||
_ bin.BareDecoder = &AccountChangePhoneRequest{}
|
||||
)
|
||||
|
||||
func (c *AccountChangePhoneRequest) Zero() bool {
|
||||
if c == nil {
|
||||
return true
|
||||
}
|
||||
if !(c.PhoneNumber == "") {
|
||||
return false
|
||||
}
|
||||
if !(c.PhoneCodeHash == "") {
|
||||
return false
|
||||
}
|
||||
if !(c.PhoneCode == "") {
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
// String implements fmt.Stringer.
|
||||
func (c *AccountChangePhoneRequest) String() string {
|
||||
if c == nil {
|
||||
return "AccountChangePhoneRequest(nil)"
|
||||
}
|
||||
type Alias AccountChangePhoneRequest
|
||||
return fmt.Sprintf("AccountChangePhoneRequest%+v", Alias(*c))
|
||||
}
|
||||
|
||||
// FillFrom fills AccountChangePhoneRequest from given interface.
|
||||
func (c *AccountChangePhoneRequest) FillFrom(from interface {
|
||||
GetPhoneNumber() (value string)
|
||||
GetPhoneCodeHash() (value string)
|
||||
GetPhoneCode() (value string)
|
||||
}) {
|
||||
c.PhoneNumber = from.GetPhoneNumber()
|
||||
c.PhoneCodeHash = from.GetPhoneCodeHash()
|
||||
c.PhoneCode = from.GetPhoneCode()
|
||||
}
|
||||
|
||||
// TypeID returns type id in TL schema.
|
||||
//
|
||||
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
||||
func (*AccountChangePhoneRequest) TypeID() uint32 {
|
||||
return AccountChangePhoneRequestTypeID
|
||||
}
|
||||
|
||||
// TypeName returns name of type in TL schema.
|
||||
func (*AccountChangePhoneRequest) TypeName() string {
|
||||
return "account.changePhone"
|
||||
}
|
||||
|
||||
// TypeInfo returns info about TL type.
|
||||
func (c *AccountChangePhoneRequest) TypeInfo() tdp.Type {
|
||||
typ := tdp.Type{
|
||||
Name: "account.changePhone",
|
||||
ID: AccountChangePhoneRequestTypeID,
|
||||
}
|
||||
if c == nil {
|
||||
typ.Null = true
|
||||
return typ
|
||||
}
|
||||
typ.Fields = []tdp.Field{
|
||||
{
|
||||
Name: "PhoneNumber",
|
||||
SchemaName: "phone_number",
|
||||
},
|
||||
{
|
||||
Name: "PhoneCodeHash",
|
||||
SchemaName: "phone_code_hash",
|
||||
},
|
||||
{
|
||||
Name: "PhoneCode",
|
||||
SchemaName: "phone_code",
|
||||
},
|
||||
}
|
||||
return typ
|
||||
}
|
||||
|
||||
// Encode implements bin.Encoder.
|
||||
func (c *AccountChangePhoneRequest) Encode(b *bin.Buffer) error {
|
||||
if c == nil {
|
||||
return fmt.Errorf("can't encode account.changePhone#70c32edb as nil")
|
||||
}
|
||||
b.PutID(AccountChangePhoneRequestTypeID)
|
||||
return c.EncodeBare(b)
|
||||
}
|
||||
|
||||
// EncodeBare implements bin.BareEncoder.
|
||||
func (c *AccountChangePhoneRequest) EncodeBare(b *bin.Buffer) error {
|
||||
if c == nil {
|
||||
return fmt.Errorf("can't encode account.changePhone#70c32edb as nil")
|
||||
}
|
||||
b.PutString(c.PhoneNumber)
|
||||
b.PutString(c.PhoneCodeHash)
|
||||
b.PutString(c.PhoneCode)
|
||||
return nil
|
||||
}
|
||||
|
||||
// Decode implements bin.Decoder.
|
||||
func (c *AccountChangePhoneRequest) Decode(b *bin.Buffer) error {
|
||||
if c == nil {
|
||||
return fmt.Errorf("can't decode account.changePhone#70c32edb to nil")
|
||||
}
|
||||
if err := b.ConsumeID(AccountChangePhoneRequestTypeID); err != nil {
|
||||
return fmt.Errorf("unable to decode account.changePhone#70c32edb: %w", err)
|
||||
}
|
||||
return c.DecodeBare(b)
|
||||
}
|
||||
|
||||
// DecodeBare implements bin.BareDecoder.
|
||||
func (c *AccountChangePhoneRequest) DecodeBare(b *bin.Buffer) error {
|
||||
if c == nil {
|
||||
return fmt.Errorf("can't decode account.changePhone#70c32edb to nil")
|
||||
}
|
||||
{
|
||||
value, err := b.String()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode account.changePhone#70c32edb: field phone_number: %w", err)
|
||||
}
|
||||
c.PhoneNumber = value
|
||||
}
|
||||
{
|
||||
value, err := b.String()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode account.changePhone#70c32edb: field phone_code_hash: %w", err)
|
||||
}
|
||||
c.PhoneCodeHash = value
|
||||
}
|
||||
{
|
||||
value, err := b.String()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode account.changePhone#70c32edb: field phone_code: %w", err)
|
||||
}
|
||||
c.PhoneCode = value
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// GetPhoneNumber returns value of PhoneNumber field.
|
||||
func (c *AccountChangePhoneRequest) GetPhoneNumber() (value string) {
|
||||
if c == nil {
|
||||
return
|
||||
}
|
||||
return c.PhoneNumber
|
||||
}
|
||||
|
||||
// GetPhoneCodeHash returns value of PhoneCodeHash field.
|
||||
func (c *AccountChangePhoneRequest) GetPhoneCodeHash() (value string) {
|
||||
if c == nil {
|
||||
return
|
||||
}
|
||||
return c.PhoneCodeHash
|
||||
}
|
||||
|
||||
// GetPhoneCode returns value of PhoneCode field.
|
||||
func (c *AccountChangePhoneRequest) GetPhoneCode() (value string) {
|
||||
if c == nil {
|
||||
return
|
||||
}
|
||||
return c.PhoneCode
|
||||
}
|
||||
|
||||
// AccountChangePhone invokes method account.changePhone#70c32edb returning error if any.
|
||||
// Change the phone number of the current account
|
||||
//
|
||||
// Possible errors:
|
||||
//
|
||||
// 400 PHONE_CODE_EMPTY: phone_code is missing.
|
||||
// 400 PHONE_CODE_EXPIRED: The phone code you provided has expired.
|
||||
// 406 PHONE_NUMBER_INVALID: The phone number is invalid.
|
||||
// 400 PHONE_NUMBER_OCCUPIED: The phone number is already in use.
|
||||
//
|
||||
// See https://core.telegram.org/method/account.changePhone for reference.
|
||||
func (c *Client) AccountChangePhone(ctx context.Context, request *AccountChangePhoneRequest) (UserClass, error) {
|
||||
var result UserBox
|
||||
|
||||
if err := c.rpc.Invoke(ctx, request, &result); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return result.User, nil
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
//go:build !no_gotd_slices
|
||||
// +build !no_gotd_slices
|
||||
|
||||
// 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{}
|
||||
)
|
||||
@@ -0,0 +1,186 @@
|
||||
// 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{}
|
||||
)
|
||||
|
||||
// AccountCheckUsernameRequest represents TL type `account.checkUsername#2714d86c`.
|
||||
// Validates a username and checks availability.
|
||||
//
|
||||
// See https://core.telegram.org/method/account.checkUsername for reference.
|
||||
type AccountCheckUsernameRequest struct {
|
||||
// usernameAccepted characters: A-z (case-insensitive), 0-9 and underscores.Length: 5-32
|
||||
// characters.
|
||||
Username string
|
||||
}
|
||||
|
||||
// AccountCheckUsernameRequestTypeID is TL type id of AccountCheckUsernameRequest.
|
||||
const AccountCheckUsernameRequestTypeID = 0x2714d86c
|
||||
|
||||
// Ensuring interfaces in compile-time for AccountCheckUsernameRequest.
|
||||
var (
|
||||
_ bin.Encoder = &AccountCheckUsernameRequest{}
|
||||
_ bin.Decoder = &AccountCheckUsernameRequest{}
|
||||
_ bin.BareEncoder = &AccountCheckUsernameRequest{}
|
||||
_ bin.BareDecoder = &AccountCheckUsernameRequest{}
|
||||
)
|
||||
|
||||
func (c *AccountCheckUsernameRequest) Zero() bool {
|
||||
if c == nil {
|
||||
return true
|
||||
}
|
||||
if !(c.Username == "") {
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
// String implements fmt.Stringer.
|
||||
func (c *AccountCheckUsernameRequest) String() string {
|
||||
if c == nil {
|
||||
return "AccountCheckUsernameRequest(nil)"
|
||||
}
|
||||
type Alias AccountCheckUsernameRequest
|
||||
return fmt.Sprintf("AccountCheckUsernameRequest%+v", Alias(*c))
|
||||
}
|
||||
|
||||
// FillFrom fills AccountCheckUsernameRequest from given interface.
|
||||
func (c *AccountCheckUsernameRequest) FillFrom(from interface {
|
||||
GetUsername() (value string)
|
||||
}) {
|
||||
c.Username = from.GetUsername()
|
||||
}
|
||||
|
||||
// TypeID returns type id in TL schema.
|
||||
//
|
||||
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
||||
func (*AccountCheckUsernameRequest) TypeID() uint32 {
|
||||
return AccountCheckUsernameRequestTypeID
|
||||
}
|
||||
|
||||
// TypeName returns name of type in TL schema.
|
||||
func (*AccountCheckUsernameRequest) TypeName() string {
|
||||
return "account.checkUsername"
|
||||
}
|
||||
|
||||
// TypeInfo returns info about TL type.
|
||||
func (c *AccountCheckUsernameRequest) TypeInfo() tdp.Type {
|
||||
typ := tdp.Type{
|
||||
Name: "account.checkUsername",
|
||||
ID: AccountCheckUsernameRequestTypeID,
|
||||
}
|
||||
if c == nil {
|
||||
typ.Null = true
|
||||
return typ
|
||||
}
|
||||
typ.Fields = []tdp.Field{
|
||||
{
|
||||
Name: "Username",
|
||||
SchemaName: "username",
|
||||
},
|
||||
}
|
||||
return typ
|
||||
}
|
||||
|
||||
// Encode implements bin.Encoder.
|
||||
func (c *AccountCheckUsernameRequest) Encode(b *bin.Buffer) error {
|
||||
if c == nil {
|
||||
return fmt.Errorf("can't encode account.checkUsername#2714d86c as nil")
|
||||
}
|
||||
b.PutID(AccountCheckUsernameRequestTypeID)
|
||||
return c.EncodeBare(b)
|
||||
}
|
||||
|
||||
// EncodeBare implements bin.BareEncoder.
|
||||
func (c *AccountCheckUsernameRequest) EncodeBare(b *bin.Buffer) error {
|
||||
if c == nil {
|
||||
return fmt.Errorf("can't encode account.checkUsername#2714d86c as nil")
|
||||
}
|
||||
b.PutString(c.Username)
|
||||
return nil
|
||||
}
|
||||
|
||||
// Decode implements bin.Decoder.
|
||||
func (c *AccountCheckUsernameRequest) Decode(b *bin.Buffer) error {
|
||||
if c == nil {
|
||||
return fmt.Errorf("can't decode account.checkUsername#2714d86c to nil")
|
||||
}
|
||||
if err := b.ConsumeID(AccountCheckUsernameRequestTypeID); err != nil {
|
||||
return fmt.Errorf("unable to decode account.checkUsername#2714d86c: %w", err)
|
||||
}
|
||||
return c.DecodeBare(b)
|
||||
}
|
||||
|
||||
// DecodeBare implements bin.BareDecoder.
|
||||
func (c *AccountCheckUsernameRequest) DecodeBare(b *bin.Buffer) error {
|
||||
if c == nil {
|
||||
return fmt.Errorf("can't decode account.checkUsername#2714d86c to nil")
|
||||
}
|
||||
{
|
||||
value, err := b.String()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode account.checkUsername#2714d86c: field username: %w", err)
|
||||
}
|
||||
c.Username = value
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// GetUsername returns value of Username field.
|
||||
func (c *AccountCheckUsernameRequest) GetUsername() (value string) {
|
||||
if c == nil {
|
||||
return
|
||||
}
|
||||
return c.Username
|
||||
}
|
||||
|
||||
// AccountCheckUsername invokes method account.checkUsername#2714d86c returning error if any.
|
||||
// Validates a username and checks availability.
|
||||
//
|
||||
// Possible errors:
|
||||
//
|
||||
// 400 USERNAME_INVALID: The provided username is not valid.
|
||||
// 400 USERNAME_OCCUPIED: The provided username is already occupied.
|
||||
// 400 USERNAME_PURCHASE_AVAILABLE: The specified username can be purchased on https://fragment.com.
|
||||
//
|
||||
// See https://core.telegram.org/method/account.checkUsername for reference.
|
||||
func (c *Client) AccountCheckUsername(ctx context.Context, username string) (bool, error) {
|
||||
var result BoolBox
|
||||
|
||||
request := &AccountCheckUsernameRequest{
|
||||
Username: username,
|
||||
}
|
||||
if err := c.rpc.Invoke(ctx, request, &result); err != nil {
|
||||
return false, err
|
||||
}
|
||||
_, ok := result.Bool.(*BoolTrue)
|
||||
return ok, nil
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
//go:build !no_gotd_slices
|
||||
// +build !no_gotd_slices
|
||||
|
||||
// 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{}
|
||||
)
|
||||
@@ -0,0 +1,150 @@
|
||||
// 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{}
|
||||
)
|
||||
|
||||
// AccountClearRecentEmojiStatusesRequest represents TL type `account.clearRecentEmojiStatuses#18201aae`.
|
||||
// Clears list of recently used emoji statuses¹
|
||||
//
|
||||
// Links:
|
||||
// 1. https://core.telegram.org/api/emoji-status
|
||||
//
|
||||
// See https://core.telegram.org/method/account.clearRecentEmojiStatuses for reference.
|
||||
type AccountClearRecentEmojiStatusesRequest struct {
|
||||
}
|
||||
|
||||
// AccountClearRecentEmojiStatusesRequestTypeID is TL type id of AccountClearRecentEmojiStatusesRequest.
|
||||
const AccountClearRecentEmojiStatusesRequestTypeID = 0x18201aae
|
||||
|
||||
// Ensuring interfaces in compile-time for AccountClearRecentEmojiStatusesRequest.
|
||||
var (
|
||||
_ bin.Encoder = &AccountClearRecentEmojiStatusesRequest{}
|
||||
_ bin.Decoder = &AccountClearRecentEmojiStatusesRequest{}
|
||||
_ bin.BareEncoder = &AccountClearRecentEmojiStatusesRequest{}
|
||||
_ bin.BareDecoder = &AccountClearRecentEmojiStatusesRequest{}
|
||||
)
|
||||
|
||||
func (c *AccountClearRecentEmojiStatusesRequest) Zero() bool {
|
||||
if c == nil {
|
||||
return true
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
// String implements fmt.Stringer.
|
||||
func (c *AccountClearRecentEmojiStatusesRequest) String() string {
|
||||
if c == nil {
|
||||
return "AccountClearRecentEmojiStatusesRequest(nil)"
|
||||
}
|
||||
type Alias AccountClearRecentEmojiStatusesRequest
|
||||
return fmt.Sprintf("AccountClearRecentEmojiStatusesRequest%+v", Alias(*c))
|
||||
}
|
||||
|
||||
// TypeID returns type id in TL schema.
|
||||
//
|
||||
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
||||
func (*AccountClearRecentEmojiStatusesRequest) TypeID() uint32 {
|
||||
return AccountClearRecentEmojiStatusesRequestTypeID
|
||||
}
|
||||
|
||||
// TypeName returns name of type in TL schema.
|
||||
func (*AccountClearRecentEmojiStatusesRequest) TypeName() string {
|
||||
return "account.clearRecentEmojiStatuses"
|
||||
}
|
||||
|
||||
// TypeInfo returns info about TL type.
|
||||
func (c *AccountClearRecentEmojiStatusesRequest) TypeInfo() tdp.Type {
|
||||
typ := tdp.Type{
|
||||
Name: "account.clearRecentEmojiStatuses",
|
||||
ID: AccountClearRecentEmojiStatusesRequestTypeID,
|
||||
}
|
||||
if c == nil {
|
||||
typ.Null = true
|
||||
return typ
|
||||
}
|
||||
typ.Fields = []tdp.Field{}
|
||||
return typ
|
||||
}
|
||||
|
||||
// Encode implements bin.Encoder.
|
||||
func (c *AccountClearRecentEmojiStatusesRequest) Encode(b *bin.Buffer) error {
|
||||
if c == nil {
|
||||
return fmt.Errorf("can't encode account.clearRecentEmojiStatuses#18201aae as nil")
|
||||
}
|
||||
b.PutID(AccountClearRecentEmojiStatusesRequestTypeID)
|
||||
return c.EncodeBare(b)
|
||||
}
|
||||
|
||||
// EncodeBare implements bin.BareEncoder.
|
||||
func (c *AccountClearRecentEmojiStatusesRequest) EncodeBare(b *bin.Buffer) error {
|
||||
if c == nil {
|
||||
return fmt.Errorf("can't encode account.clearRecentEmojiStatuses#18201aae as nil")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Decode implements bin.Decoder.
|
||||
func (c *AccountClearRecentEmojiStatusesRequest) Decode(b *bin.Buffer) error {
|
||||
if c == nil {
|
||||
return fmt.Errorf("can't decode account.clearRecentEmojiStatuses#18201aae to nil")
|
||||
}
|
||||
if err := b.ConsumeID(AccountClearRecentEmojiStatusesRequestTypeID); err != nil {
|
||||
return fmt.Errorf("unable to decode account.clearRecentEmojiStatuses#18201aae: %w", err)
|
||||
}
|
||||
return c.DecodeBare(b)
|
||||
}
|
||||
|
||||
// DecodeBare implements bin.BareDecoder.
|
||||
func (c *AccountClearRecentEmojiStatusesRequest) DecodeBare(b *bin.Buffer) error {
|
||||
if c == nil {
|
||||
return fmt.Errorf("can't decode account.clearRecentEmojiStatuses#18201aae to nil")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// AccountClearRecentEmojiStatuses invokes method account.clearRecentEmojiStatuses#18201aae returning error if any.
|
||||
// Clears list of recently used emoji statuses¹
|
||||
//
|
||||
// Links:
|
||||
// 1. https://core.telegram.org/api/emoji-status
|
||||
//
|
||||
// See https://core.telegram.org/method/account.clearRecentEmojiStatuses for reference.
|
||||
func (c *Client) AccountClearRecentEmojiStatuses(ctx context.Context) (bool, error) {
|
||||
var result BoolBox
|
||||
|
||||
request := &AccountClearRecentEmojiStatusesRequest{}
|
||||
if err := c.rpc.Invoke(ctx, request, &result); err != nil {
|
||||
return false, err
|
||||
}
|
||||
_, ok := result.Bool.(*BoolTrue)
|
||||
return ok, nil
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
//go:build !no_gotd_slices
|
||||
// +build !no_gotd_slices
|
||||
|
||||
// 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{}
|
||||
)
|
||||
@@ -0,0 +1,193 @@
|
||||
// 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{}
|
||||
)
|
||||
|
||||
// AccountConfirmPasswordEmailRequest represents TL type `account.confirmPasswordEmail#8fdf1920`.
|
||||
// Verify an email to use as 2FA recovery method¹.
|
||||
//
|
||||
// Links:
|
||||
// 1. https://core.telegram.org/api/srp
|
||||
//
|
||||
// See https://core.telegram.org/method/account.confirmPasswordEmail for reference.
|
||||
type AccountConfirmPasswordEmailRequest struct {
|
||||
// The phone code that was received after setting a recovery email¹
|
||||
//
|
||||
// Links:
|
||||
// 1) https://core.telegram.org/api/srp#email-verification
|
||||
Code string
|
||||
}
|
||||
|
||||
// AccountConfirmPasswordEmailRequestTypeID is TL type id of AccountConfirmPasswordEmailRequest.
|
||||
const AccountConfirmPasswordEmailRequestTypeID = 0x8fdf1920
|
||||
|
||||
// Ensuring interfaces in compile-time for AccountConfirmPasswordEmailRequest.
|
||||
var (
|
||||
_ bin.Encoder = &AccountConfirmPasswordEmailRequest{}
|
||||
_ bin.Decoder = &AccountConfirmPasswordEmailRequest{}
|
||||
_ bin.BareEncoder = &AccountConfirmPasswordEmailRequest{}
|
||||
_ bin.BareDecoder = &AccountConfirmPasswordEmailRequest{}
|
||||
)
|
||||
|
||||
func (c *AccountConfirmPasswordEmailRequest) Zero() bool {
|
||||
if c == nil {
|
||||
return true
|
||||
}
|
||||
if !(c.Code == "") {
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
// String implements fmt.Stringer.
|
||||
func (c *AccountConfirmPasswordEmailRequest) String() string {
|
||||
if c == nil {
|
||||
return "AccountConfirmPasswordEmailRequest(nil)"
|
||||
}
|
||||
type Alias AccountConfirmPasswordEmailRequest
|
||||
return fmt.Sprintf("AccountConfirmPasswordEmailRequest%+v", Alias(*c))
|
||||
}
|
||||
|
||||
// FillFrom fills AccountConfirmPasswordEmailRequest from given interface.
|
||||
func (c *AccountConfirmPasswordEmailRequest) FillFrom(from interface {
|
||||
GetCode() (value string)
|
||||
}) {
|
||||
c.Code = from.GetCode()
|
||||
}
|
||||
|
||||
// TypeID returns type id in TL schema.
|
||||
//
|
||||
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
||||
func (*AccountConfirmPasswordEmailRequest) TypeID() uint32 {
|
||||
return AccountConfirmPasswordEmailRequestTypeID
|
||||
}
|
||||
|
||||
// TypeName returns name of type in TL schema.
|
||||
func (*AccountConfirmPasswordEmailRequest) TypeName() string {
|
||||
return "account.confirmPasswordEmail"
|
||||
}
|
||||
|
||||
// TypeInfo returns info about TL type.
|
||||
func (c *AccountConfirmPasswordEmailRequest) TypeInfo() tdp.Type {
|
||||
typ := tdp.Type{
|
||||
Name: "account.confirmPasswordEmail",
|
||||
ID: AccountConfirmPasswordEmailRequestTypeID,
|
||||
}
|
||||
if c == nil {
|
||||
typ.Null = true
|
||||
return typ
|
||||
}
|
||||
typ.Fields = []tdp.Field{
|
||||
{
|
||||
Name: "Code",
|
||||
SchemaName: "code",
|
||||
},
|
||||
}
|
||||
return typ
|
||||
}
|
||||
|
||||
// Encode implements bin.Encoder.
|
||||
func (c *AccountConfirmPasswordEmailRequest) Encode(b *bin.Buffer) error {
|
||||
if c == nil {
|
||||
return fmt.Errorf("can't encode account.confirmPasswordEmail#8fdf1920 as nil")
|
||||
}
|
||||
b.PutID(AccountConfirmPasswordEmailRequestTypeID)
|
||||
return c.EncodeBare(b)
|
||||
}
|
||||
|
||||
// EncodeBare implements bin.BareEncoder.
|
||||
func (c *AccountConfirmPasswordEmailRequest) EncodeBare(b *bin.Buffer) error {
|
||||
if c == nil {
|
||||
return fmt.Errorf("can't encode account.confirmPasswordEmail#8fdf1920 as nil")
|
||||
}
|
||||
b.PutString(c.Code)
|
||||
return nil
|
||||
}
|
||||
|
||||
// Decode implements bin.Decoder.
|
||||
func (c *AccountConfirmPasswordEmailRequest) Decode(b *bin.Buffer) error {
|
||||
if c == nil {
|
||||
return fmt.Errorf("can't decode account.confirmPasswordEmail#8fdf1920 to nil")
|
||||
}
|
||||
if err := b.ConsumeID(AccountConfirmPasswordEmailRequestTypeID); err != nil {
|
||||
return fmt.Errorf("unable to decode account.confirmPasswordEmail#8fdf1920: %w", err)
|
||||
}
|
||||
return c.DecodeBare(b)
|
||||
}
|
||||
|
||||
// DecodeBare implements bin.BareDecoder.
|
||||
func (c *AccountConfirmPasswordEmailRequest) DecodeBare(b *bin.Buffer) error {
|
||||
if c == nil {
|
||||
return fmt.Errorf("can't decode account.confirmPasswordEmail#8fdf1920 to nil")
|
||||
}
|
||||
{
|
||||
value, err := b.String()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode account.confirmPasswordEmail#8fdf1920: field code: %w", err)
|
||||
}
|
||||
c.Code = value
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// GetCode returns value of Code field.
|
||||
func (c *AccountConfirmPasswordEmailRequest) GetCode() (value string) {
|
||||
if c == nil {
|
||||
return
|
||||
}
|
||||
return c.Code
|
||||
}
|
||||
|
||||
// AccountConfirmPasswordEmail invokes method account.confirmPasswordEmail#8fdf1920 returning error if any.
|
||||
// Verify an email to use as 2FA recovery method¹.
|
||||
//
|
||||
// Links:
|
||||
// 1. https://core.telegram.org/api/srp
|
||||
//
|
||||
// Possible errors:
|
||||
//
|
||||
// 400 CODE_INVALID: Code invalid.
|
||||
// 400 EMAIL_HASH_EXPIRED: Email hash expired.
|
||||
//
|
||||
// See https://core.telegram.org/method/account.confirmPasswordEmail for reference.
|
||||
func (c *Client) AccountConfirmPasswordEmail(ctx context.Context, code string) (bool, error) {
|
||||
var result BoolBox
|
||||
|
||||
request := &AccountConfirmPasswordEmailRequest{
|
||||
Code: code,
|
||||
}
|
||||
if err := c.rpc.Invoke(ctx, request, &result); err != nil {
|
||||
return false, err
|
||||
}
|
||||
_, ok := result.Bool.(*BoolTrue)
|
||||
return ok, nil
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
//go:build !no_gotd_slices
|
||||
// +build !no_gotd_slices
|
||||
|
||||
// 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{}
|
||||
)
|
||||
@@ -0,0 +1,220 @@
|
||||
// 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{}
|
||||
)
|
||||
|
||||
// AccountConfirmPhoneRequest represents TL type `account.confirmPhone#5f2178c3`.
|
||||
// Confirm a phone number to cancel account deletion, for more info click here »¹
|
||||
//
|
||||
// Links:
|
||||
// 1. https://core.telegram.org/api/account-deletion
|
||||
//
|
||||
// See https://core.telegram.org/method/account.confirmPhone for reference.
|
||||
type AccountConfirmPhoneRequest struct {
|
||||
// Phone code hash, for more info click here »¹
|
||||
//
|
||||
// Links:
|
||||
// 1) https://core.telegram.org/api/account-deletion
|
||||
PhoneCodeHash string
|
||||
// SMS code, for more info click here »¹
|
||||
//
|
||||
// Links:
|
||||
// 1) https://core.telegram.org/api/account-deletion
|
||||
PhoneCode string
|
||||
}
|
||||
|
||||
// AccountConfirmPhoneRequestTypeID is TL type id of AccountConfirmPhoneRequest.
|
||||
const AccountConfirmPhoneRequestTypeID = 0x5f2178c3
|
||||
|
||||
// Ensuring interfaces in compile-time for AccountConfirmPhoneRequest.
|
||||
var (
|
||||
_ bin.Encoder = &AccountConfirmPhoneRequest{}
|
||||
_ bin.Decoder = &AccountConfirmPhoneRequest{}
|
||||
_ bin.BareEncoder = &AccountConfirmPhoneRequest{}
|
||||
_ bin.BareDecoder = &AccountConfirmPhoneRequest{}
|
||||
)
|
||||
|
||||
func (c *AccountConfirmPhoneRequest) Zero() bool {
|
||||
if c == nil {
|
||||
return true
|
||||
}
|
||||
if !(c.PhoneCodeHash == "") {
|
||||
return false
|
||||
}
|
||||
if !(c.PhoneCode == "") {
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
// String implements fmt.Stringer.
|
||||
func (c *AccountConfirmPhoneRequest) String() string {
|
||||
if c == nil {
|
||||
return "AccountConfirmPhoneRequest(nil)"
|
||||
}
|
||||
type Alias AccountConfirmPhoneRequest
|
||||
return fmt.Sprintf("AccountConfirmPhoneRequest%+v", Alias(*c))
|
||||
}
|
||||
|
||||
// FillFrom fills AccountConfirmPhoneRequest from given interface.
|
||||
func (c *AccountConfirmPhoneRequest) FillFrom(from interface {
|
||||
GetPhoneCodeHash() (value string)
|
||||
GetPhoneCode() (value string)
|
||||
}) {
|
||||
c.PhoneCodeHash = from.GetPhoneCodeHash()
|
||||
c.PhoneCode = from.GetPhoneCode()
|
||||
}
|
||||
|
||||
// TypeID returns type id in TL schema.
|
||||
//
|
||||
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
||||
func (*AccountConfirmPhoneRequest) TypeID() uint32 {
|
||||
return AccountConfirmPhoneRequestTypeID
|
||||
}
|
||||
|
||||
// TypeName returns name of type in TL schema.
|
||||
func (*AccountConfirmPhoneRequest) TypeName() string {
|
||||
return "account.confirmPhone"
|
||||
}
|
||||
|
||||
// TypeInfo returns info about TL type.
|
||||
func (c *AccountConfirmPhoneRequest) TypeInfo() tdp.Type {
|
||||
typ := tdp.Type{
|
||||
Name: "account.confirmPhone",
|
||||
ID: AccountConfirmPhoneRequestTypeID,
|
||||
}
|
||||
if c == nil {
|
||||
typ.Null = true
|
||||
return typ
|
||||
}
|
||||
typ.Fields = []tdp.Field{
|
||||
{
|
||||
Name: "PhoneCodeHash",
|
||||
SchemaName: "phone_code_hash",
|
||||
},
|
||||
{
|
||||
Name: "PhoneCode",
|
||||
SchemaName: "phone_code",
|
||||
},
|
||||
}
|
||||
return typ
|
||||
}
|
||||
|
||||
// Encode implements bin.Encoder.
|
||||
func (c *AccountConfirmPhoneRequest) Encode(b *bin.Buffer) error {
|
||||
if c == nil {
|
||||
return fmt.Errorf("can't encode account.confirmPhone#5f2178c3 as nil")
|
||||
}
|
||||
b.PutID(AccountConfirmPhoneRequestTypeID)
|
||||
return c.EncodeBare(b)
|
||||
}
|
||||
|
||||
// EncodeBare implements bin.BareEncoder.
|
||||
func (c *AccountConfirmPhoneRequest) EncodeBare(b *bin.Buffer) error {
|
||||
if c == nil {
|
||||
return fmt.Errorf("can't encode account.confirmPhone#5f2178c3 as nil")
|
||||
}
|
||||
b.PutString(c.PhoneCodeHash)
|
||||
b.PutString(c.PhoneCode)
|
||||
return nil
|
||||
}
|
||||
|
||||
// Decode implements bin.Decoder.
|
||||
func (c *AccountConfirmPhoneRequest) Decode(b *bin.Buffer) error {
|
||||
if c == nil {
|
||||
return fmt.Errorf("can't decode account.confirmPhone#5f2178c3 to nil")
|
||||
}
|
||||
if err := b.ConsumeID(AccountConfirmPhoneRequestTypeID); err != nil {
|
||||
return fmt.Errorf("unable to decode account.confirmPhone#5f2178c3: %w", err)
|
||||
}
|
||||
return c.DecodeBare(b)
|
||||
}
|
||||
|
||||
// DecodeBare implements bin.BareDecoder.
|
||||
func (c *AccountConfirmPhoneRequest) DecodeBare(b *bin.Buffer) error {
|
||||
if c == nil {
|
||||
return fmt.Errorf("can't decode account.confirmPhone#5f2178c3 to nil")
|
||||
}
|
||||
{
|
||||
value, err := b.String()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode account.confirmPhone#5f2178c3: field phone_code_hash: %w", err)
|
||||
}
|
||||
c.PhoneCodeHash = value
|
||||
}
|
||||
{
|
||||
value, err := b.String()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode account.confirmPhone#5f2178c3: field phone_code: %w", err)
|
||||
}
|
||||
c.PhoneCode = value
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// GetPhoneCodeHash returns value of PhoneCodeHash field.
|
||||
func (c *AccountConfirmPhoneRequest) GetPhoneCodeHash() (value string) {
|
||||
if c == nil {
|
||||
return
|
||||
}
|
||||
return c.PhoneCodeHash
|
||||
}
|
||||
|
||||
// GetPhoneCode returns value of PhoneCode field.
|
||||
func (c *AccountConfirmPhoneRequest) GetPhoneCode() (value string) {
|
||||
if c == nil {
|
||||
return
|
||||
}
|
||||
return c.PhoneCode
|
||||
}
|
||||
|
||||
// AccountConfirmPhone invokes method account.confirmPhone#5f2178c3 returning error if any.
|
||||
// Confirm a phone number to cancel account deletion, for more info click here »¹
|
||||
//
|
||||
// Links:
|
||||
// 1. https://core.telegram.org/api/account-deletion
|
||||
//
|
||||
// Possible errors:
|
||||
//
|
||||
// 400 CODE_HASH_INVALID: Code hash invalid.
|
||||
// 400 PHONE_CODE_EMPTY: phone_code is missing.
|
||||
//
|
||||
// See https://core.telegram.org/method/account.confirmPhone for reference.
|
||||
func (c *Client) AccountConfirmPhone(ctx context.Context, request *AccountConfirmPhoneRequest) (bool, error) {
|
||||
var result BoolBox
|
||||
|
||||
if err := c.rpc.Invoke(ctx, request, &result); err != nil {
|
||||
return false, err
|
||||
}
|
||||
_, ok := result.Bool.(*BoolTrue)
|
||||
return ok, nil
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
//go:build !no_gotd_slices
|
||||
// +build !no_gotd_slices
|
||||
|
||||
// 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{}
|
||||
)
|
||||
@@ -0,0 +1,230 @@
|
||||
// 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{}
|
||||
)
|
||||
|
||||
// AccountConnectedBots represents TL type `account.connectedBots#17d7f87b`.
|
||||
// Info about currently connected business bots¹.
|
||||
//
|
||||
// Links:
|
||||
// 1. https://core.telegram.org/api/business#connected-bots
|
||||
//
|
||||
// See https://core.telegram.org/constructor/account.connectedBots for reference.
|
||||
type AccountConnectedBots struct {
|
||||
// Info about the connected bots
|
||||
ConnectedBots []ConnectedBot
|
||||
// Bot information
|
||||
Users []UserClass
|
||||
}
|
||||
|
||||
// AccountConnectedBotsTypeID is TL type id of AccountConnectedBots.
|
||||
const AccountConnectedBotsTypeID = 0x17d7f87b
|
||||
|
||||
// Ensuring interfaces in compile-time for AccountConnectedBots.
|
||||
var (
|
||||
_ bin.Encoder = &AccountConnectedBots{}
|
||||
_ bin.Decoder = &AccountConnectedBots{}
|
||||
_ bin.BareEncoder = &AccountConnectedBots{}
|
||||
_ bin.BareDecoder = &AccountConnectedBots{}
|
||||
)
|
||||
|
||||
func (c *AccountConnectedBots) Zero() bool {
|
||||
if c == nil {
|
||||
return true
|
||||
}
|
||||
if !(c.ConnectedBots == nil) {
|
||||
return false
|
||||
}
|
||||
if !(c.Users == nil) {
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
// String implements fmt.Stringer.
|
||||
func (c *AccountConnectedBots) String() string {
|
||||
if c == nil {
|
||||
return "AccountConnectedBots(nil)"
|
||||
}
|
||||
type Alias AccountConnectedBots
|
||||
return fmt.Sprintf("AccountConnectedBots%+v", Alias(*c))
|
||||
}
|
||||
|
||||
// FillFrom fills AccountConnectedBots from given interface.
|
||||
func (c *AccountConnectedBots) FillFrom(from interface {
|
||||
GetConnectedBots() (value []ConnectedBot)
|
||||
GetUsers() (value []UserClass)
|
||||
}) {
|
||||
c.ConnectedBots = from.GetConnectedBots()
|
||||
c.Users = from.GetUsers()
|
||||
}
|
||||
|
||||
// TypeID returns type id in TL schema.
|
||||
//
|
||||
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
||||
func (*AccountConnectedBots) TypeID() uint32 {
|
||||
return AccountConnectedBotsTypeID
|
||||
}
|
||||
|
||||
// TypeName returns name of type in TL schema.
|
||||
func (*AccountConnectedBots) TypeName() string {
|
||||
return "account.connectedBots"
|
||||
}
|
||||
|
||||
// TypeInfo returns info about TL type.
|
||||
func (c *AccountConnectedBots) TypeInfo() tdp.Type {
|
||||
typ := tdp.Type{
|
||||
Name: "account.connectedBots",
|
||||
ID: AccountConnectedBotsTypeID,
|
||||
}
|
||||
if c == nil {
|
||||
typ.Null = true
|
||||
return typ
|
||||
}
|
||||
typ.Fields = []tdp.Field{
|
||||
{
|
||||
Name: "ConnectedBots",
|
||||
SchemaName: "connected_bots",
|
||||
},
|
||||
{
|
||||
Name: "Users",
|
||||
SchemaName: "users",
|
||||
},
|
||||
}
|
||||
return typ
|
||||
}
|
||||
|
||||
// Encode implements bin.Encoder.
|
||||
func (c *AccountConnectedBots) Encode(b *bin.Buffer) error {
|
||||
if c == nil {
|
||||
return fmt.Errorf("can't encode account.connectedBots#17d7f87b as nil")
|
||||
}
|
||||
b.PutID(AccountConnectedBotsTypeID)
|
||||
return c.EncodeBare(b)
|
||||
}
|
||||
|
||||
// EncodeBare implements bin.BareEncoder.
|
||||
func (c *AccountConnectedBots) EncodeBare(b *bin.Buffer) error {
|
||||
if c == nil {
|
||||
return fmt.Errorf("can't encode account.connectedBots#17d7f87b as nil")
|
||||
}
|
||||
b.PutVectorHeader(len(c.ConnectedBots))
|
||||
for idx, v := range c.ConnectedBots {
|
||||
if err := v.Encode(b); err != nil {
|
||||
return fmt.Errorf("unable to encode account.connectedBots#17d7f87b: field connected_bots element with index %d: %w", idx, err)
|
||||
}
|
||||
}
|
||||
b.PutVectorHeader(len(c.Users))
|
||||
for idx, v := range c.Users {
|
||||
if v == nil {
|
||||
return fmt.Errorf("unable to encode account.connectedBots#17d7f87b: field users element with index %d is nil", idx)
|
||||
}
|
||||
if err := v.Encode(b); err != nil {
|
||||
return fmt.Errorf("unable to encode account.connectedBots#17d7f87b: field users element with index %d: %w", idx, err)
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Decode implements bin.Decoder.
|
||||
func (c *AccountConnectedBots) Decode(b *bin.Buffer) error {
|
||||
if c == nil {
|
||||
return fmt.Errorf("can't decode account.connectedBots#17d7f87b to nil")
|
||||
}
|
||||
if err := b.ConsumeID(AccountConnectedBotsTypeID); err != nil {
|
||||
return fmt.Errorf("unable to decode account.connectedBots#17d7f87b: %w", err)
|
||||
}
|
||||
return c.DecodeBare(b)
|
||||
}
|
||||
|
||||
// DecodeBare implements bin.BareDecoder.
|
||||
func (c *AccountConnectedBots) DecodeBare(b *bin.Buffer) error {
|
||||
if c == nil {
|
||||
return fmt.Errorf("can't decode account.connectedBots#17d7f87b to nil")
|
||||
}
|
||||
{
|
||||
headerLen, err := b.VectorHeader()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode account.connectedBots#17d7f87b: field connected_bots: %w", err)
|
||||
}
|
||||
|
||||
if headerLen > 0 {
|
||||
c.ConnectedBots = make([]ConnectedBot, 0, headerLen%bin.PreallocateLimit)
|
||||
}
|
||||
for idx := 0; idx < headerLen; idx++ {
|
||||
var value ConnectedBot
|
||||
if err := value.Decode(b); err != nil {
|
||||
return fmt.Errorf("unable to decode account.connectedBots#17d7f87b: field connected_bots: %w", err)
|
||||
}
|
||||
c.ConnectedBots = append(c.ConnectedBots, value)
|
||||
}
|
||||
}
|
||||
{
|
||||
headerLen, err := b.VectorHeader()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode account.connectedBots#17d7f87b: field users: %w", err)
|
||||
}
|
||||
|
||||
if headerLen > 0 {
|
||||
c.Users = make([]UserClass, 0, headerLen%bin.PreallocateLimit)
|
||||
}
|
||||
for idx := 0; idx < headerLen; idx++ {
|
||||
value, err := DecodeUser(b)
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode account.connectedBots#17d7f87b: field users: %w", err)
|
||||
}
|
||||
c.Users = append(c.Users, value)
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// GetConnectedBots returns value of ConnectedBots field.
|
||||
func (c *AccountConnectedBots) GetConnectedBots() (value []ConnectedBot) {
|
||||
if c == nil {
|
||||
return
|
||||
}
|
||||
return c.ConnectedBots
|
||||
}
|
||||
|
||||
// GetUsers returns value of Users field.
|
||||
func (c *AccountConnectedBots) GetUsers() (value []UserClass) {
|
||||
if c == nil {
|
||||
return
|
||||
}
|
||||
return c.Users
|
||||
}
|
||||
|
||||
// MapUsers returns field Users wrapped in UserClassArray helper.
|
||||
func (c *AccountConnectedBots) MapUsers() (value UserClassArray) {
|
||||
return UserClassArray(c.Users)
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
//go:build !no_gotd_slices
|
||||
// +build !no_gotd_slices
|
||||
|
||||
// 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{}
|
||||
)
|
||||
@@ -0,0 +1,227 @@
|
||||
// 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{}
|
||||
)
|
||||
|
||||
// AccountContentSettings represents TL type `account.contentSettings#57e28221`.
|
||||
// Sensitive content settings
|
||||
//
|
||||
// See https://core.telegram.org/constructor/account.contentSettings for reference.
|
||||
type AccountContentSettings struct {
|
||||
// Flags, see TL conditional fields¹
|
||||
//
|
||||
// Links:
|
||||
// 1) https://core.telegram.org/mtproto/TL-combinators#conditional-fields
|
||||
Flags bin.Fields
|
||||
// Whether viewing of sensitive (NSFW) content is enabled
|
||||
SensitiveEnabled bool
|
||||
// Whether the current client can change the sensitive content settings to view NSFW
|
||||
// content
|
||||
SensitiveCanChange bool
|
||||
}
|
||||
|
||||
// AccountContentSettingsTypeID is TL type id of AccountContentSettings.
|
||||
const AccountContentSettingsTypeID = 0x57e28221
|
||||
|
||||
// Ensuring interfaces in compile-time for AccountContentSettings.
|
||||
var (
|
||||
_ bin.Encoder = &AccountContentSettings{}
|
||||
_ bin.Decoder = &AccountContentSettings{}
|
||||
_ bin.BareEncoder = &AccountContentSettings{}
|
||||
_ bin.BareDecoder = &AccountContentSettings{}
|
||||
)
|
||||
|
||||
func (c *AccountContentSettings) Zero() bool {
|
||||
if c == nil {
|
||||
return true
|
||||
}
|
||||
if !(c.Flags.Zero()) {
|
||||
return false
|
||||
}
|
||||
if !(c.SensitiveEnabled == false) {
|
||||
return false
|
||||
}
|
||||
if !(c.SensitiveCanChange == false) {
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
// String implements fmt.Stringer.
|
||||
func (c *AccountContentSettings) String() string {
|
||||
if c == nil {
|
||||
return "AccountContentSettings(nil)"
|
||||
}
|
||||
type Alias AccountContentSettings
|
||||
return fmt.Sprintf("AccountContentSettings%+v", Alias(*c))
|
||||
}
|
||||
|
||||
// FillFrom fills AccountContentSettings from given interface.
|
||||
func (c *AccountContentSettings) FillFrom(from interface {
|
||||
GetSensitiveEnabled() (value bool)
|
||||
GetSensitiveCanChange() (value bool)
|
||||
}) {
|
||||
c.SensitiveEnabled = from.GetSensitiveEnabled()
|
||||
c.SensitiveCanChange = from.GetSensitiveCanChange()
|
||||
}
|
||||
|
||||
// TypeID returns type id in TL schema.
|
||||
//
|
||||
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
||||
func (*AccountContentSettings) TypeID() uint32 {
|
||||
return AccountContentSettingsTypeID
|
||||
}
|
||||
|
||||
// TypeName returns name of type in TL schema.
|
||||
func (*AccountContentSettings) TypeName() string {
|
||||
return "account.contentSettings"
|
||||
}
|
||||
|
||||
// TypeInfo returns info about TL type.
|
||||
func (c *AccountContentSettings) TypeInfo() tdp.Type {
|
||||
typ := tdp.Type{
|
||||
Name: "account.contentSettings",
|
||||
ID: AccountContentSettingsTypeID,
|
||||
}
|
||||
if c == nil {
|
||||
typ.Null = true
|
||||
return typ
|
||||
}
|
||||
typ.Fields = []tdp.Field{
|
||||
{
|
||||
Name: "SensitiveEnabled",
|
||||
SchemaName: "sensitive_enabled",
|
||||
Null: !c.Flags.Has(0),
|
||||
},
|
||||
{
|
||||
Name: "SensitiveCanChange",
|
||||
SchemaName: "sensitive_can_change",
|
||||
Null: !c.Flags.Has(1),
|
||||
},
|
||||
}
|
||||
return typ
|
||||
}
|
||||
|
||||
// SetFlags sets flags for non-zero fields.
|
||||
func (c *AccountContentSettings) SetFlags() {
|
||||
if !(c.SensitiveEnabled == false) {
|
||||
c.Flags.Set(0)
|
||||
}
|
||||
if !(c.SensitiveCanChange == false) {
|
||||
c.Flags.Set(1)
|
||||
}
|
||||
}
|
||||
|
||||
// Encode implements bin.Encoder.
|
||||
func (c *AccountContentSettings) Encode(b *bin.Buffer) error {
|
||||
if c == nil {
|
||||
return fmt.Errorf("can't encode account.contentSettings#57e28221 as nil")
|
||||
}
|
||||
b.PutID(AccountContentSettingsTypeID)
|
||||
return c.EncodeBare(b)
|
||||
}
|
||||
|
||||
// EncodeBare implements bin.BareEncoder.
|
||||
func (c *AccountContentSettings) EncodeBare(b *bin.Buffer) error {
|
||||
if c == nil {
|
||||
return fmt.Errorf("can't encode account.contentSettings#57e28221 as nil")
|
||||
}
|
||||
c.SetFlags()
|
||||
if err := c.Flags.Encode(b); err != nil {
|
||||
return fmt.Errorf("unable to encode account.contentSettings#57e28221: field flags: %w", err)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Decode implements bin.Decoder.
|
||||
func (c *AccountContentSettings) Decode(b *bin.Buffer) error {
|
||||
if c == nil {
|
||||
return fmt.Errorf("can't decode account.contentSettings#57e28221 to nil")
|
||||
}
|
||||
if err := b.ConsumeID(AccountContentSettingsTypeID); err != nil {
|
||||
return fmt.Errorf("unable to decode account.contentSettings#57e28221: %w", err)
|
||||
}
|
||||
return c.DecodeBare(b)
|
||||
}
|
||||
|
||||
// DecodeBare implements bin.BareDecoder.
|
||||
func (c *AccountContentSettings) DecodeBare(b *bin.Buffer) error {
|
||||
if c == nil {
|
||||
return fmt.Errorf("can't decode account.contentSettings#57e28221 to nil")
|
||||
}
|
||||
{
|
||||
if err := c.Flags.Decode(b); err != nil {
|
||||
return fmt.Errorf("unable to decode account.contentSettings#57e28221: field flags: %w", err)
|
||||
}
|
||||
}
|
||||
c.SensitiveEnabled = c.Flags.Has(0)
|
||||
c.SensitiveCanChange = c.Flags.Has(1)
|
||||
return nil
|
||||
}
|
||||
|
||||
// SetSensitiveEnabled sets value of SensitiveEnabled conditional field.
|
||||
func (c *AccountContentSettings) SetSensitiveEnabled(value bool) {
|
||||
if value {
|
||||
c.Flags.Set(0)
|
||||
c.SensitiveEnabled = true
|
||||
} else {
|
||||
c.Flags.Unset(0)
|
||||
c.SensitiveEnabled = false
|
||||
}
|
||||
}
|
||||
|
||||
// GetSensitiveEnabled returns value of SensitiveEnabled conditional field.
|
||||
func (c *AccountContentSettings) GetSensitiveEnabled() (value bool) {
|
||||
if c == nil {
|
||||
return
|
||||
}
|
||||
return c.Flags.Has(0)
|
||||
}
|
||||
|
||||
// SetSensitiveCanChange sets value of SensitiveCanChange conditional field.
|
||||
func (c *AccountContentSettings) SetSensitiveCanChange(value bool) {
|
||||
if value {
|
||||
c.Flags.Set(1)
|
||||
c.SensitiveCanChange = true
|
||||
} else {
|
||||
c.Flags.Unset(1)
|
||||
c.SensitiveCanChange = false
|
||||
}
|
||||
}
|
||||
|
||||
// GetSensitiveCanChange returns value of SensitiveCanChange conditional field.
|
||||
func (c *AccountContentSettings) GetSensitiveCanChange() (value bool) {
|
||||
if c == nil {
|
||||
return
|
||||
}
|
||||
return c.Flags.Has(1)
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
//go:build !no_gotd_slices
|
||||
// +build !no_gotd_slices
|
||||
|
||||
// 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{}
|
||||
)
|
||||
@@ -0,0 +1,189 @@
|
||||
// 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{}
|
||||
)
|
||||
|
||||
// AccountCreateBusinessChatLinkRequest represents TL type `account.createBusinessChatLink#8851e68e`.
|
||||
// Create a business chat deep link »¹.
|
||||
//
|
||||
// Links:
|
||||
// 1. https://core.telegram.org/api/business#business-chat-links
|
||||
//
|
||||
// See https://core.telegram.org/method/account.createBusinessChatLink for reference.
|
||||
type AccountCreateBusinessChatLinkRequest struct {
|
||||
// Info about the link to create.
|
||||
Link InputBusinessChatLink
|
||||
}
|
||||
|
||||
// AccountCreateBusinessChatLinkRequestTypeID is TL type id of AccountCreateBusinessChatLinkRequest.
|
||||
const AccountCreateBusinessChatLinkRequestTypeID = 0x8851e68e
|
||||
|
||||
// Ensuring interfaces in compile-time for AccountCreateBusinessChatLinkRequest.
|
||||
var (
|
||||
_ bin.Encoder = &AccountCreateBusinessChatLinkRequest{}
|
||||
_ bin.Decoder = &AccountCreateBusinessChatLinkRequest{}
|
||||
_ bin.BareEncoder = &AccountCreateBusinessChatLinkRequest{}
|
||||
_ bin.BareDecoder = &AccountCreateBusinessChatLinkRequest{}
|
||||
)
|
||||
|
||||
func (c *AccountCreateBusinessChatLinkRequest) Zero() bool {
|
||||
if c == nil {
|
||||
return true
|
||||
}
|
||||
if !(c.Link.Zero()) {
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
// String implements fmt.Stringer.
|
||||
func (c *AccountCreateBusinessChatLinkRequest) String() string {
|
||||
if c == nil {
|
||||
return "AccountCreateBusinessChatLinkRequest(nil)"
|
||||
}
|
||||
type Alias AccountCreateBusinessChatLinkRequest
|
||||
return fmt.Sprintf("AccountCreateBusinessChatLinkRequest%+v", Alias(*c))
|
||||
}
|
||||
|
||||
// FillFrom fills AccountCreateBusinessChatLinkRequest from given interface.
|
||||
func (c *AccountCreateBusinessChatLinkRequest) FillFrom(from interface {
|
||||
GetLink() (value InputBusinessChatLink)
|
||||
}) {
|
||||
c.Link = from.GetLink()
|
||||
}
|
||||
|
||||
// TypeID returns type id in TL schema.
|
||||
//
|
||||
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
||||
func (*AccountCreateBusinessChatLinkRequest) TypeID() uint32 {
|
||||
return AccountCreateBusinessChatLinkRequestTypeID
|
||||
}
|
||||
|
||||
// TypeName returns name of type in TL schema.
|
||||
func (*AccountCreateBusinessChatLinkRequest) TypeName() string {
|
||||
return "account.createBusinessChatLink"
|
||||
}
|
||||
|
||||
// TypeInfo returns info about TL type.
|
||||
func (c *AccountCreateBusinessChatLinkRequest) TypeInfo() tdp.Type {
|
||||
typ := tdp.Type{
|
||||
Name: "account.createBusinessChatLink",
|
||||
ID: AccountCreateBusinessChatLinkRequestTypeID,
|
||||
}
|
||||
if c == nil {
|
||||
typ.Null = true
|
||||
return typ
|
||||
}
|
||||
typ.Fields = []tdp.Field{
|
||||
{
|
||||
Name: "Link",
|
||||
SchemaName: "link",
|
||||
},
|
||||
}
|
||||
return typ
|
||||
}
|
||||
|
||||
// Encode implements bin.Encoder.
|
||||
func (c *AccountCreateBusinessChatLinkRequest) Encode(b *bin.Buffer) error {
|
||||
if c == nil {
|
||||
return fmt.Errorf("can't encode account.createBusinessChatLink#8851e68e as nil")
|
||||
}
|
||||
b.PutID(AccountCreateBusinessChatLinkRequestTypeID)
|
||||
return c.EncodeBare(b)
|
||||
}
|
||||
|
||||
// EncodeBare implements bin.BareEncoder.
|
||||
func (c *AccountCreateBusinessChatLinkRequest) EncodeBare(b *bin.Buffer) error {
|
||||
if c == nil {
|
||||
return fmt.Errorf("can't encode account.createBusinessChatLink#8851e68e as nil")
|
||||
}
|
||||
if err := c.Link.Encode(b); err != nil {
|
||||
return fmt.Errorf("unable to encode account.createBusinessChatLink#8851e68e: field link: %w", err)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Decode implements bin.Decoder.
|
||||
func (c *AccountCreateBusinessChatLinkRequest) Decode(b *bin.Buffer) error {
|
||||
if c == nil {
|
||||
return fmt.Errorf("can't decode account.createBusinessChatLink#8851e68e to nil")
|
||||
}
|
||||
if err := b.ConsumeID(AccountCreateBusinessChatLinkRequestTypeID); err != nil {
|
||||
return fmt.Errorf("unable to decode account.createBusinessChatLink#8851e68e: %w", err)
|
||||
}
|
||||
return c.DecodeBare(b)
|
||||
}
|
||||
|
||||
// DecodeBare implements bin.BareDecoder.
|
||||
func (c *AccountCreateBusinessChatLinkRequest) DecodeBare(b *bin.Buffer) error {
|
||||
if c == nil {
|
||||
return fmt.Errorf("can't decode account.createBusinessChatLink#8851e68e to nil")
|
||||
}
|
||||
{
|
||||
if err := c.Link.Decode(b); err != nil {
|
||||
return fmt.Errorf("unable to decode account.createBusinessChatLink#8851e68e: field link: %w", err)
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// GetLink returns value of Link field.
|
||||
func (c *AccountCreateBusinessChatLinkRequest) GetLink() (value InputBusinessChatLink) {
|
||||
if c == nil {
|
||||
return
|
||||
}
|
||||
return c.Link
|
||||
}
|
||||
|
||||
// AccountCreateBusinessChatLink invokes method account.createBusinessChatLink#8851e68e returning error if any.
|
||||
// Create a business chat deep link »¹.
|
||||
//
|
||||
// Links:
|
||||
// 1. https://core.telegram.org/api/business#business-chat-links
|
||||
//
|
||||
// Possible errors:
|
||||
//
|
||||
// 400 CHATLINKS_TOO_MUCH: Too many business chat links were created, please delete some older links.
|
||||
// 403 PREMIUM_ACCOUNT_REQUIRED: A premium account is required to execute this action.
|
||||
//
|
||||
// See https://core.telegram.org/method/account.createBusinessChatLink for reference.
|
||||
func (c *Client) AccountCreateBusinessChatLink(ctx context.Context, link InputBusinessChatLink) (*BusinessChatLink, error) {
|
||||
var result BusinessChatLink
|
||||
|
||||
request := &AccountCreateBusinessChatLinkRequest{
|
||||
Link: link,
|
||||
}
|
||||
if err := c.rpc.Invoke(ctx, request, &result); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &result, nil
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
//go:build !no_gotd_slices
|
||||
// +build !no_gotd_slices
|
||||
|
||||
// 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{}
|
||||
)
|
||||
@@ -0,0 +1,358 @@
|
||||
// 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{}
|
||||
)
|
||||
|
||||
// AccountCreateThemeRequest represents TL type `account.createTheme#652e4400`.
|
||||
// Create a theme
|
||||
//
|
||||
// See https://core.telegram.org/method/account.createTheme for reference.
|
||||
type AccountCreateThemeRequest struct {
|
||||
// Flags, see TL conditional fields¹
|
||||
//
|
||||
// Links:
|
||||
// 1) https://core.telegram.org/mtproto/TL-combinators#conditional-fields
|
||||
Flags bin.Fields
|
||||
// Unique theme ID used to generate theme deep links¹, can be empty to autogenerate a
|
||||
// random ID.
|
||||
//
|
||||
// Links:
|
||||
// 1) https://core.telegram.org/api/links#theme-links
|
||||
Slug string
|
||||
// Theme name
|
||||
Title string
|
||||
// Theme file
|
||||
//
|
||||
// Use SetDocument and GetDocument helpers.
|
||||
Document InputDocumentClass
|
||||
// Theme settings, multiple values can be provided for the different base themes
|
||||
// (day/night mode, etc).
|
||||
//
|
||||
// Use SetSettings and GetSettings helpers.
|
||||
Settings []InputThemeSettings
|
||||
}
|
||||
|
||||
// AccountCreateThemeRequestTypeID is TL type id of AccountCreateThemeRequest.
|
||||
const AccountCreateThemeRequestTypeID = 0x652e4400
|
||||
|
||||
// Ensuring interfaces in compile-time for AccountCreateThemeRequest.
|
||||
var (
|
||||
_ bin.Encoder = &AccountCreateThemeRequest{}
|
||||
_ bin.Decoder = &AccountCreateThemeRequest{}
|
||||
_ bin.BareEncoder = &AccountCreateThemeRequest{}
|
||||
_ bin.BareDecoder = &AccountCreateThemeRequest{}
|
||||
)
|
||||
|
||||
func (c *AccountCreateThemeRequest) Zero() bool {
|
||||
if c == nil {
|
||||
return true
|
||||
}
|
||||
if !(c.Flags.Zero()) {
|
||||
return false
|
||||
}
|
||||
if !(c.Slug == "") {
|
||||
return false
|
||||
}
|
||||
if !(c.Title == "") {
|
||||
return false
|
||||
}
|
||||
if !(c.Document == nil) {
|
||||
return false
|
||||
}
|
||||
if !(c.Settings == nil) {
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
// String implements fmt.Stringer.
|
||||
func (c *AccountCreateThemeRequest) String() string {
|
||||
if c == nil {
|
||||
return "AccountCreateThemeRequest(nil)"
|
||||
}
|
||||
type Alias AccountCreateThemeRequest
|
||||
return fmt.Sprintf("AccountCreateThemeRequest%+v", Alias(*c))
|
||||
}
|
||||
|
||||
// FillFrom fills AccountCreateThemeRequest from given interface.
|
||||
func (c *AccountCreateThemeRequest) FillFrom(from interface {
|
||||
GetSlug() (value string)
|
||||
GetTitle() (value string)
|
||||
GetDocument() (value InputDocumentClass, ok bool)
|
||||
GetSettings() (value []InputThemeSettings, ok bool)
|
||||
}) {
|
||||
c.Slug = from.GetSlug()
|
||||
c.Title = from.GetTitle()
|
||||
if val, ok := from.GetDocument(); ok {
|
||||
c.Document = val
|
||||
}
|
||||
|
||||
if val, ok := from.GetSettings(); ok {
|
||||
c.Settings = val
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// TypeID returns type id in TL schema.
|
||||
//
|
||||
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
||||
func (*AccountCreateThemeRequest) TypeID() uint32 {
|
||||
return AccountCreateThemeRequestTypeID
|
||||
}
|
||||
|
||||
// TypeName returns name of type in TL schema.
|
||||
func (*AccountCreateThemeRequest) TypeName() string {
|
||||
return "account.createTheme"
|
||||
}
|
||||
|
||||
// TypeInfo returns info about TL type.
|
||||
func (c *AccountCreateThemeRequest) TypeInfo() tdp.Type {
|
||||
typ := tdp.Type{
|
||||
Name: "account.createTheme",
|
||||
ID: AccountCreateThemeRequestTypeID,
|
||||
}
|
||||
if c == nil {
|
||||
typ.Null = true
|
||||
return typ
|
||||
}
|
||||
typ.Fields = []tdp.Field{
|
||||
{
|
||||
Name: "Slug",
|
||||
SchemaName: "slug",
|
||||
},
|
||||
{
|
||||
Name: "Title",
|
||||
SchemaName: "title",
|
||||
},
|
||||
{
|
||||
Name: "Document",
|
||||
SchemaName: "document",
|
||||
Null: !c.Flags.Has(2),
|
||||
},
|
||||
{
|
||||
Name: "Settings",
|
||||
SchemaName: "settings",
|
||||
Null: !c.Flags.Has(3),
|
||||
},
|
||||
}
|
||||
return typ
|
||||
}
|
||||
|
||||
// SetFlags sets flags for non-zero fields.
|
||||
func (c *AccountCreateThemeRequest) SetFlags() {
|
||||
if !(c.Document == nil) {
|
||||
c.Flags.Set(2)
|
||||
}
|
||||
if !(c.Settings == nil) {
|
||||
c.Flags.Set(3)
|
||||
}
|
||||
}
|
||||
|
||||
// Encode implements bin.Encoder.
|
||||
func (c *AccountCreateThemeRequest) Encode(b *bin.Buffer) error {
|
||||
if c == nil {
|
||||
return fmt.Errorf("can't encode account.createTheme#652e4400 as nil")
|
||||
}
|
||||
b.PutID(AccountCreateThemeRequestTypeID)
|
||||
return c.EncodeBare(b)
|
||||
}
|
||||
|
||||
// EncodeBare implements bin.BareEncoder.
|
||||
func (c *AccountCreateThemeRequest) EncodeBare(b *bin.Buffer) error {
|
||||
if c == nil {
|
||||
return fmt.Errorf("can't encode account.createTheme#652e4400 as nil")
|
||||
}
|
||||
c.SetFlags()
|
||||
if err := c.Flags.Encode(b); err != nil {
|
||||
return fmt.Errorf("unable to encode account.createTheme#652e4400: field flags: %w", err)
|
||||
}
|
||||
b.PutString(c.Slug)
|
||||
b.PutString(c.Title)
|
||||
if c.Flags.Has(2) {
|
||||
if c.Document == nil {
|
||||
return fmt.Errorf("unable to encode account.createTheme#652e4400: field document is nil")
|
||||
}
|
||||
if err := c.Document.Encode(b); err != nil {
|
||||
return fmt.Errorf("unable to encode account.createTheme#652e4400: field document: %w", err)
|
||||
}
|
||||
}
|
||||
if c.Flags.Has(3) {
|
||||
b.PutVectorHeader(len(c.Settings))
|
||||
for idx, v := range c.Settings {
|
||||
if err := v.Encode(b); err != nil {
|
||||
return fmt.Errorf("unable to encode account.createTheme#652e4400: field settings element with index %d: %w", idx, err)
|
||||
}
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Decode implements bin.Decoder.
|
||||
func (c *AccountCreateThemeRequest) Decode(b *bin.Buffer) error {
|
||||
if c == nil {
|
||||
return fmt.Errorf("can't decode account.createTheme#652e4400 to nil")
|
||||
}
|
||||
if err := b.ConsumeID(AccountCreateThemeRequestTypeID); err != nil {
|
||||
return fmt.Errorf("unable to decode account.createTheme#652e4400: %w", err)
|
||||
}
|
||||
return c.DecodeBare(b)
|
||||
}
|
||||
|
||||
// DecodeBare implements bin.BareDecoder.
|
||||
func (c *AccountCreateThemeRequest) DecodeBare(b *bin.Buffer) error {
|
||||
if c == nil {
|
||||
return fmt.Errorf("can't decode account.createTheme#652e4400 to nil")
|
||||
}
|
||||
{
|
||||
if err := c.Flags.Decode(b); err != nil {
|
||||
return fmt.Errorf("unable to decode account.createTheme#652e4400: field flags: %w", err)
|
||||
}
|
||||
}
|
||||
{
|
||||
value, err := b.String()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode account.createTheme#652e4400: field slug: %w", err)
|
||||
}
|
||||
c.Slug = value
|
||||
}
|
||||
{
|
||||
value, err := b.String()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode account.createTheme#652e4400: field title: %w", err)
|
||||
}
|
||||
c.Title = value
|
||||
}
|
||||
if c.Flags.Has(2) {
|
||||
value, err := DecodeInputDocument(b)
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode account.createTheme#652e4400: field document: %w", err)
|
||||
}
|
||||
c.Document = value
|
||||
}
|
||||
if c.Flags.Has(3) {
|
||||
headerLen, err := b.VectorHeader()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode account.createTheme#652e4400: field settings: %w", err)
|
||||
}
|
||||
|
||||
if headerLen > 0 {
|
||||
c.Settings = make([]InputThemeSettings, 0, headerLen%bin.PreallocateLimit)
|
||||
}
|
||||
for idx := 0; idx < headerLen; idx++ {
|
||||
var value InputThemeSettings
|
||||
if err := value.Decode(b); err != nil {
|
||||
return fmt.Errorf("unable to decode account.createTheme#652e4400: field settings: %w", err)
|
||||
}
|
||||
c.Settings = append(c.Settings, value)
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// GetSlug returns value of Slug field.
|
||||
func (c *AccountCreateThemeRequest) GetSlug() (value string) {
|
||||
if c == nil {
|
||||
return
|
||||
}
|
||||
return c.Slug
|
||||
}
|
||||
|
||||
// GetTitle returns value of Title field.
|
||||
func (c *AccountCreateThemeRequest) GetTitle() (value string) {
|
||||
if c == nil {
|
||||
return
|
||||
}
|
||||
return c.Title
|
||||
}
|
||||
|
||||
// SetDocument sets value of Document conditional field.
|
||||
func (c *AccountCreateThemeRequest) SetDocument(value InputDocumentClass) {
|
||||
c.Flags.Set(2)
|
||||
c.Document = value
|
||||
}
|
||||
|
||||
// GetDocument returns value of Document conditional field and
|
||||
// boolean which is true if field was set.
|
||||
func (c *AccountCreateThemeRequest) GetDocument() (value InputDocumentClass, ok bool) {
|
||||
if c == nil {
|
||||
return
|
||||
}
|
||||
if !c.Flags.Has(2) {
|
||||
return value, false
|
||||
}
|
||||
return c.Document, true
|
||||
}
|
||||
|
||||
// SetSettings sets value of Settings conditional field.
|
||||
func (c *AccountCreateThemeRequest) SetSettings(value []InputThemeSettings) {
|
||||
c.Flags.Set(3)
|
||||
c.Settings = value
|
||||
}
|
||||
|
||||
// GetSettings returns value of Settings conditional field and
|
||||
// boolean which is true if field was set.
|
||||
func (c *AccountCreateThemeRequest) GetSettings() (value []InputThemeSettings, ok bool) {
|
||||
if c == nil {
|
||||
return
|
||||
}
|
||||
if !c.Flags.Has(3) {
|
||||
return value, false
|
||||
}
|
||||
return c.Settings, true
|
||||
}
|
||||
|
||||
// GetDocumentAsNotEmpty returns mapped value of Document conditional field and
|
||||
// boolean which is true if field was set.
|
||||
func (c *AccountCreateThemeRequest) GetDocumentAsNotEmpty() (*InputDocument, bool) {
|
||||
if value, ok := c.GetDocument(); ok {
|
||||
return value.AsNotEmpty()
|
||||
}
|
||||
return nil, false
|
||||
}
|
||||
|
||||
// AccountCreateTheme invokes method account.createTheme#652e4400 returning error if any.
|
||||
// Create a theme
|
||||
//
|
||||
// Possible errors:
|
||||
//
|
||||
// 400 THEME_MIME_INVALID: The theme's MIME type is invalid.
|
||||
// 400 THEME_TITLE_INVALID: The specified theme title is invalid.
|
||||
//
|
||||
// See https://core.telegram.org/method/account.createTheme for reference.
|
||||
func (c *Client) AccountCreateTheme(ctx context.Context, request *AccountCreateThemeRequest) (*Theme, error) {
|
||||
var result Theme
|
||||
|
||||
if err := c.rpc.Invoke(ctx, request, &result); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &result, nil
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
//go:build !no_gotd_slices
|
||||
// +build !no_gotd_slices
|
||||
|
||||
// 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{}
|
||||
)
|
||||
@@ -0,0 +1,162 @@
|
||||
// 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{}
|
||||
)
|
||||
|
||||
// AccountDaysTTL represents TL type `accountDaysTTL#b8d0afdf`.
|
||||
// Time to live in days of the current account
|
||||
//
|
||||
// See https://core.telegram.org/constructor/accountDaysTTL for reference.
|
||||
type AccountDaysTTL struct {
|
||||
// This account will self-destruct in the specified number of days
|
||||
Days int
|
||||
}
|
||||
|
||||
// AccountDaysTTLTypeID is TL type id of AccountDaysTTL.
|
||||
const AccountDaysTTLTypeID = 0xb8d0afdf
|
||||
|
||||
// Ensuring interfaces in compile-time for AccountDaysTTL.
|
||||
var (
|
||||
_ bin.Encoder = &AccountDaysTTL{}
|
||||
_ bin.Decoder = &AccountDaysTTL{}
|
||||
_ bin.BareEncoder = &AccountDaysTTL{}
|
||||
_ bin.BareDecoder = &AccountDaysTTL{}
|
||||
)
|
||||
|
||||
func (a *AccountDaysTTL) Zero() bool {
|
||||
if a == nil {
|
||||
return true
|
||||
}
|
||||
if !(a.Days == 0) {
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
// String implements fmt.Stringer.
|
||||
func (a *AccountDaysTTL) String() string {
|
||||
if a == nil {
|
||||
return "AccountDaysTTL(nil)"
|
||||
}
|
||||
type Alias AccountDaysTTL
|
||||
return fmt.Sprintf("AccountDaysTTL%+v", Alias(*a))
|
||||
}
|
||||
|
||||
// FillFrom fills AccountDaysTTL from given interface.
|
||||
func (a *AccountDaysTTL) FillFrom(from interface {
|
||||
GetDays() (value int)
|
||||
}) {
|
||||
a.Days = from.GetDays()
|
||||
}
|
||||
|
||||
// TypeID returns type id in TL schema.
|
||||
//
|
||||
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
||||
func (*AccountDaysTTL) TypeID() uint32 {
|
||||
return AccountDaysTTLTypeID
|
||||
}
|
||||
|
||||
// TypeName returns name of type in TL schema.
|
||||
func (*AccountDaysTTL) TypeName() string {
|
||||
return "accountDaysTTL"
|
||||
}
|
||||
|
||||
// TypeInfo returns info about TL type.
|
||||
func (a *AccountDaysTTL) TypeInfo() tdp.Type {
|
||||
typ := tdp.Type{
|
||||
Name: "accountDaysTTL",
|
||||
ID: AccountDaysTTLTypeID,
|
||||
}
|
||||
if a == nil {
|
||||
typ.Null = true
|
||||
return typ
|
||||
}
|
||||
typ.Fields = []tdp.Field{
|
||||
{
|
||||
Name: "Days",
|
||||
SchemaName: "days",
|
||||
},
|
||||
}
|
||||
return typ
|
||||
}
|
||||
|
||||
// Encode implements bin.Encoder.
|
||||
func (a *AccountDaysTTL) Encode(b *bin.Buffer) error {
|
||||
if a == nil {
|
||||
return fmt.Errorf("can't encode accountDaysTTL#b8d0afdf as nil")
|
||||
}
|
||||
b.PutID(AccountDaysTTLTypeID)
|
||||
return a.EncodeBare(b)
|
||||
}
|
||||
|
||||
// EncodeBare implements bin.BareEncoder.
|
||||
func (a *AccountDaysTTL) EncodeBare(b *bin.Buffer) error {
|
||||
if a == nil {
|
||||
return fmt.Errorf("can't encode accountDaysTTL#b8d0afdf as nil")
|
||||
}
|
||||
b.PutInt(a.Days)
|
||||
return nil
|
||||
}
|
||||
|
||||
// Decode implements bin.Decoder.
|
||||
func (a *AccountDaysTTL) Decode(b *bin.Buffer) error {
|
||||
if a == nil {
|
||||
return fmt.Errorf("can't decode accountDaysTTL#b8d0afdf to nil")
|
||||
}
|
||||
if err := b.ConsumeID(AccountDaysTTLTypeID); err != nil {
|
||||
return fmt.Errorf("unable to decode accountDaysTTL#b8d0afdf: %w", err)
|
||||
}
|
||||
return a.DecodeBare(b)
|
||||
}
|
||||
|
||||
// DecodeBare implements bin.BareDecoder.
|
||||
func (a *AccountDaysTTL) DecodeBare(b *bin.Buffer) error {
|
||||
if a == nil {
|
||||
return fmt.Errorf("can't decode accountDaysTTL#b8d0afdf to nil")
|
||||
}
|
||||
{
|
||||
value, err := b.Int()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode accountDaysTTL#b8d0afdf: field days: %w", err)
|
||||
}
|
||||
a.Days = value
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// GetDays returns value of Days field.
|
||||
func (a *AccountDaysTTL) GetDays() (value int) {
|
||||
if a == nil {
|
||||
return
|
||||
}
|
||||
return a.Days
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
//go:build !no_gotd_slices
|
||||
// +build !no_gotd_slices
|
||||
|
||||
// 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{}
|
||||
)
|
||||
@@ -0,0 +1,154 @@
|
||||
// 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{}
|
||||
)
|
||||
|
||||
// AccountDeclinePasswordResetRequest represents TL type `account.declinePasswordReset#4c9409f6`.
|
||||
// Abort a pending 2FA password reset, see here for more info »¹
|
||||
//
|
||||
// Links:
|
||||
// 1. https://core.telegram.org/api/srp#password-reset
|
||||
//
|
||||
// See https://core.telegram.org/method/account.declinePasswordReset for reference.
|
||||
type AccountDeclinePasswordResetRequest struct {
|
||||
}
|
||||
|
||||
// AccountDeclinePasswordResetRequestTypeID is TL type id of AccountDeclinePasswordResetRequest.
|
||||
const AccountDeclinePasswordResetRequestTypeID = 0x4c9409f6
|
||||
|
||||
// Ensuring interfaces in compile-time for AccountDeclinePasswordResetRequest.
|
||||
var (
|
||||
_ bin.Encoder = &AccountDeclinePasswordResetRequest{}
|
||||
_ bin.Decoder = &AccountDeclinePasswordResetRequest{}
|
||||
_ bin.BareEncoder = &AccountDeclinePasswordResetRequest{}
|
||||
_ bin.BareDecoder = &AccountDeclinePasswordResetRequest{}
|
||||
)
|
||||
|
||||
func (d *AccountDeclinePasswordResetRequest) Zero() bool {
|
||||
if d == nil {
|
||||
return true
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
// String implements fmt.Stringer.
|
||||
func (d *AccountDeclinePasswordResetRequest) String() string {
|
||||
if d == nil {
|
||||
return "AccountDeclinePasswordResetRequest(nil)"
|
||||
}
|
||||
type Alias AccountDeclinePasswordResetRequest
|
||||
return fmt.Sprintf("AccountDeclinePasswordResetRequest%+v", Alias(*d))
|
||||
}
|
||||
|
||||
// TypeID returns type id in TL schema.
|
||||
//
|
||||
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
||||
func (*AccountDeclinePasswordResetRequest) TypeID() uint32 {
|
||||
return AccountDeclinePasswordResetRequestTypeID
|
||||
}
|
||||
|
||||
// TypeName returns name of type in TL schema.
|
||||
func (*AccountDeclinePasswordResetRequest) TypeName() string {
|
||||
return "account.declinePasswordReset"
|
||||
}
|
||||
|
||||
// TypeInfo returns info about TL type.
|
||||
func (d *AccountDeclinePasswordResetRequest) TypeInfo() tdp.Type {
|
||||
typ := tdp.Type{
|
||||
Name: "account.declinePasswordReset",
|
||||
ID: AccountDeclinePasswordResetRequestTypeID,
|
||||
}
|
||||
if d == nil {
|
||||
typ.Null = true
|
||||
return typ
|
||||
}
|
||||
typ.Fields = []tdp.Field{}
|
||||
return typ
|
||||
}
|
||||
|
||||
// Encode implements bin.Encoder.
|
||||
func (d *AccountDeclinePasswordResetRequest) Encode(b *bin.Buffer) error {
|
||||
if d == nil {
|
||||
return fmt.Errorf("can't encode account.declinePasswordReset#4c9409f6 as nil")
|
||||
}
|
||||
b.PutID(AccountDeclinePasswordResetRequestTypeID)
|
||||
return d.EncodeBare(b)
|
||||
}
|
||||
|
||||
// EncodeBare implements bin.BareEncoder.
|
||||
func (d *AccountDeclinePasswordResetRequest) EncodeBare(b *bin.Buffer) error {
|
||||
if d == nil {
|
||||
return fmt.Errorf("can't encode account.declinePasswordReset#4c9409f6 as nil")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Decode implements bin.Decoder.
|
||||
func (d *AccountDeclinePasswordResetRequest) Decode(b *bin.Buffer) error {
|
||||
if d == nil {
|
||||
return fmt.Errorf("can't decode account.declinePasswordReset#4c9409f6 to nil")
|
||||
}
|
||||
if err := b.ConsumeID(AccountDeclinePasswordResetRequestTypeID); err != nil {
|
||||
return fmt.Errorf("unable to decode account.declinePasswordReset#4c9409f6: %w", err)
|
||||
}
|
||||
return d.DecodeBare(b)
|
||||
}
|
||||
|
||||
// DecodeBare implements bin.BareDecoder.
|
||||
func (d *AccountDeclinePasswordResetRequest) DecodeBare(b *bin.Buffer) error {
|
||||
if d == nil {
|
||||
return fmt.Errorf("can't decode account.declinePasswordReset#4c9409f6 to nil")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// AccountDeclinePasswordReset invokes method account.declinePasswordReset#4c9409f6 returning error if any.
|
||||
// Abort a pending 2FA password reset, see here for more info »¹
|
||||
//
|
||||
// Links:
|
||||
// 1. https://core.telegram.org/api/srp#password-reset
|
||||
//
|
||||
// Possible errors:
|
||||
//
|
||||
// 400 RESET_REQUEST_MISSING: No password reset is in progress.
|
||||
//
|
||||
// See https://core.telegram.org/method/account.declinePasswordReset for reference.
|
||||
func (c *Client) AccountDeclinePasswordReset(ctx context.Context) (bool, error) {
|
||||
var result BoolBox
|
||||
|
||||
request := &AccountDeclinePasswordResetRequest{}
|
||||
if err := c.rpc.Invoke(ctx, request, &result); err != nil {
|
||||
return false, err
|
||||
}
|
||||
_, ok := result.Bool.(*BoolTrue)
|
||||
return ok, nil
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
//go:build !no_gotd_slices
|
||||
// +build !no_gotd_slices
|
||||
|
||||
// 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{}
|
||||
)
|
||||
@@ -0,0 +1,282 @@
|
||||
// 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{}
|
||||
)
|
||||
|
||||
// AccountDeleteAccountRequest represents TL type `account.deleteAccount#a2c0cf74`.
|
||||
// Delete the user's account from the telegram servers.
|
||||
// Can also be used to delete the account of a user that provided the login code, but
|
||||
// forgot the 2FA password and no recovery method is configured, see here »¹ for more
|
||||
// info on password recovery, and here »² for more info on account deletion.
|
||||
//
|
||||
// Links:
|
||||
// 1. https://core.telegram.org/api/srp#password-recovery
|
||||
// 2. https://core.telegram.org/api/account-deletion
|
||||
//
|
||||
// See https://core.telegram.org/method/account.deleteAccount for reference.
|
||||
type AccountDeleteAccountRequest struct {
|
||||
// Flags, see TL conditional fields¹
|
||||
//
|
||||
// Links:
|
||||
// 1) https://core.telegram.org/mtproto/TL-combinators#conditional-fields
|
||||
Flags bin.Fields
|
||||
// Why is the account being deleted, can be empty
|
||||
Reason string
|
||||
// 2FA password¹: this field can be omitted even for accounts with 2FA enabled: in this
|
||||
// case account account deletion will be delayed by 7 days as specified in the docs »²
|
||||
//
|
||||
// Links:
|
||||
// 1) https://core.telegram.org/api/srp
|
||||
// 2) https://core.telegram.org/api/account-deletion
|
||||
//
|
||||
// Use SetPassword and GetPassword helpers.
|
||||
Password InputCheckPasswordSRPClass
|
||||
}
|
||||
|
||||
// AccountDeleteAccountRequestTypeID is TL type id of AccountDeleteAccountRequest.
|
||||
const AccountDeleteAccountRequestTypeID = 0xa2c0cf74
|
||||
|
||||
// Ensuring interfaces in compile-time for AccountDeleteAccountRequest.
|
||||
var (
|
||||
_ bin.Encoder = &AccountDeleteAccountRequest{}
|
||||
_ bin.Decoder = &AccountDeleteAccountRequest{}
|
||||
_ bin.BareEncoder = &AccountDeleteAccountRequest{}
|
||||
_ bin.BareDecoder = &AccountDeleteAccountRequest{}
|
||||
)
|
||||
|
||||
func (d *AccountDeleteAccountRequest) Zero() bool {
|
||||
if d == nil {
|
||||
return true
|
||||
}
|
||||
if !(d.Flags.Zero()) {
|
||||
return false
|
||||
}
|
||||
if !(d.Reason == "") {
|
||||
return false
|
||||
}
|
||||
if !(d.Password == nil) {
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
// String implements fmt.Stringer.
|
||||
func (d *AccountDeleteAccountRequest) String() string {
|
||||
if d == nil {
|
||||
return "AccountDeleteAccountRequest(nil)"
|
||||
}
|
||||
type Alias AccountDeleteAccountRequest
|
||||
return fmt.Sprintf("AccountDeleteAccountRequest%+v", Alias(*d))
|
||||
}
|
||||
|
||||
// FillFrom fills AccountDeleteAccountRequest from given interface.
|
||||
func (d *AccountDeleteAccountRequest) FillFrom(from interface {
|
||||
GetReason() (value string)
|
||||
GetPassword() (value InputCheckPasswordSRPClass, ok bool)
|
||||
}) {
|
||||
d.Reason = from.GetReason()
|
||||
if val, ok := from.GetPassword(); ok {
|
||||
d.Password = val
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// TypeID returns type id in TL schema.
|
||||
//
|
||||
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
||||
func (*AccountDeleteAccountRequest) TypeID() uint32 {
|
||||
return AccountDeleteAccountRequestTypeID
|
||||
}
|
||||
|
||||
// TypeName returns name of type in TL schema.
|
||||
func (*AccountDeleteAccountRequest) TypeName() string {
|
||||
return "account.deleteAccount"
|
||||
}
|
||||
|
||||
// TypeInfo returns info about TL type.
|
||||
func (d *AccountDeleteAccountRequest) TypeInfo() tdp.Type {
|
||||
typ := tdp.Type{
|
||||
Name: "account.deleteAccount",
|
||||
ID: AccountDeleteAccountRequestTypeID,
|
||||
}
|
||||
if d == nil {
|
||||
typ.Null = true
|
||||
return typ
|
||||
}
|
||||
typ.Fields = []tdp.Field{
|
||||
{
|
||||
Name: "Reason",
|
||||
SchemaName: "reason",
|
||||
},
|
||||
{
|
||||
Name: "Password",
|
||||
SchemaName: "password",
|
||||
Null: !d.Flags.Has(0),
|
||||
},
|
||||
}
|
||||
return typ
|
||||
}
|
||||
|
||||
// SetFlags sets flags for non-zero fields.
|
||||
func (d *AccountDeleteAccountRequest) SetFlags() {
|
||||
if !(d.Password == nil) {
|
||||
d.Flags.Set(0)
|
||||
}
|
||||
}
|
||||
|
||||
// Encode implements bin.Encoder.
|
||||
func (d *AccountDeleteAccountRequest) Encode(b *bin.Buffer) error {
|
||||
if d == nil {
|
||||
return fmt.Errorf("can't encode account.deleteAccount#a2c0cf74 as nil")
|
||||
}
|
||||
b.PutID(AccountDeleteAccountRequestTypeID)
|
||||
return d.EncodeBare(b)
|
||||
}
|
||||
|
||||
// EncodeBare implements bin.BareEncoder.
|
||||
func (d *AccountDeleteAccountRequest) EncodeBare(b *bin.Buffer) error {
|
||||
if d == nil {
|
||||
return fmt.Errorf("can't encode account.deleteAccount#a2c0cf74 as nil")
|
||||
}
|
||||
d.SetFlags()
|
||||
if err := d.Flags.Encode(b); err != nil {
|
||||
return fmt.Errorf("unable to encode account.deleteAccount#a2c0cf74: field flags: %w", err)
|
||||
}
|
||||
b.PutString(d.Reason)
|
||||
if d.Flags.Has(0) {
|
||||
if d.Password == nil {
|
||||
return fmt.Errorf("unable to encode account.deleteAccount#a2c0cf74: field password is nil")
|
||||
}
|
||||
if err := d.Password.Encode(b); err != nil {
|
||||
return fmt.Errorf("unable to encode account.deleteAccount#a2c0cf74: field password: %w", err)
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Decode implements bin.Decoder.
|
||||
func (d *AccountDeleteAccountRequest) Decode(b *bin.Buffer) error {
|
||||
if d == nil {
|
||||
return fmt.Errorf("can't decode account.deleteAccount#a2c0cf74 to nil")
|
||||
}
|
||||
if err := b.ConsumeID(AccountDeleteAccountRequestTypeID); err != nil {
|
||||
return fmt.Errorf("unable to decode account.deleteAccount#a2c0cf74: %w", err)
|
||||
}
|
||||
return d.DecodeBare(b)
|
||||
}
|
||||
|
||||
// DecodeBare implements bin.BareDecoder.
|
||||
func (d *AccountDeleteAccountRequest) DecodeBare(b *bin.Buffer) error {
|
||||
if d == nil {
|
||||
return fmt.Errorf("can't decode account.deleteAccount#a2c0cf74 to nil")
|
||||
}
|
||||
{
|
||||
if err := d.Flags.Decode(b); err != nil {
|
||||
return fmt.Errorf("unable to decode account.deleteAccount#a2c0cf74: field flags: %w", err)
|
||||
}
|
||||
}
|
||||
{
|
||||
value, err := b.String()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode account.deleteAccount#a2c0cf74: field reason: %w", err)
|
||||
}
|
||||
d.Reason = value
|
||||
}
|
||||
if d.Flags.Has(0) {
|
||||
value, err := DecodeInputCheckPasswordSRP(b)
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode account.deleteAccount#a2c0cf74: field password: %w", err)
|
||||
}
|
||||
d.Password = value
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// GetReason returns value of Reason field.
|
||||
func (d *AccountDeleteAccountRequest) GetReason() (value string) {
|
||||
if d == nil {
|
||||
return
|
||||
}
|
||||
return d.Reason
|
||||
}
|
||||
|
||||
// SetPassword sets value of Password conditional field.
|
||||
func (d *AccountDeleteAccountRequest) SetPassword(value InputCheckPasswordSRPClass) {
|
||||
d.Flags.Set(0)
|
||||
d.Password = value
|
||||
}
|
||||
|
||||
// GetPassword returns value of Password conditional field and
|
||||
// boolean which is true if field was set.
|
||||
func (d *AccountDeleteAccountRequest) GetPassword() (value InputCheckPasswordSRPClass, ok bool) {
|
||||
if d == nil {
|
||||
return
|
||||
}
|
||||
if !d.Flags.Has(0) {
|
||||
return value, false
|
||||
}
|
||||
return d.Password, true
|
||||
}
|
||||
|
||||
// GetPasswordAsNotEmpty returns mapped value of Password conditional field and
|
||||
// boolean which is true if field was set.
|
||||
func (d *AccountDeleteAccountRequest) GetPasswordAsNotEmpty() (*InputCheckPasswordSRP, bool) {
|
||||
if value, ok := d.GetPassword(); ok {
|
||||
return value.AsNotEmpty()
|
||||
}
|
||||
return nil, false
|
||||
}
|
||||
|
||||
// AccountDeleteAccount invokes method account.deleteAccount#a2c0cf74 returning error if any.
|
||||
// Delete the user's account from the telegram servers.
|
||||
// Can also be used to delete the account of a user that provided the login code, but
|
||||
// forgot the 2FA password and no recovery method is configured, see here »¹ for more
|
||||
// info on password recovery, and here »² for more info on account deletion.
|
||||
//
|
||||
// Links:
|
||||
// 1. https://core.telegram.org/api/srp#password-recovery
|
||||
// 2. https://core.telegram.org/api/account-deletion
|
||||
//
|
||||
// Possible errors:
|
||||
//
|
||||
// 420 2FA_CONFIRM_WAIT_%d: Since this account is active and protected by a 2FA password, we will delete it in 1 week for security purposes. You can cancel this process at any time, you'll be able to reset your account in %d seconds.
|
||||
//
|
||||
// See https://core.telegram.org/method/account.deleteAccount for reference.
|
||||
func (c *Client) AccountDeleteAccount(ctx context.Context, request *AccountDeleteAccountRequest) (bool, error) {
|
||||
var result BoolBox
|
||||
|
||||
if err := c.rpc.Invoke(ctx, request, &result); err != nil {
|
||||
return false, err
|
||||
}
|
||||
_, ok := result.Bool.(*BoolTrue)
|
||||
return ok, nil
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
//go:build !no_gotd_slices
|
||||
// +build !no_gotd_slices
|
||||
|
||||
// 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{}
|
||||
)
|
||||
@@ -0,0 +1,144 @@
|
||||
// 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{}
|
||||
)
|
||||
|
||||
// AccountDeleteAutoSaveExceptionsRequest represents TL type `account.deleteAutoSaveExceptions#53bc0020`.
|
||||
// Clear all peer-specific autosave settings.
|
||||
//
|
||||
// See https://core.telegram.org/method/account.deleteAutoSaveExceptions for reference.
|
||||
type AccountDeleteAutoSaveExceptionsRequest struct {
|
||||
}
|
||||
|
||||
// AccountDeleteAutoSaveExceptionsRequestTypeID is TL type id of AccountDeleteAutoSaveExceptionsRequest.
|
||||
const AccountDeleteAutoSaveExceptionsRequestTypeID = 0x53bc0020
|
||||
|
||||
// Ensuring interfaces in compile-time for AccountDeleteAutoSaveExceptionsRequest.
|
||||
var (
|
||||
_ bin.Encoder = &AccountDeleteAutoSaveExceptionsRequest{}
|
||||
_ bin.Decoder = &AccountDeleteAutoSaveExceptionsRequest{}
|
||||
_ bin.BareEncoder = &AccountDeleteAutoSaveExceptionsRequest{}
|
||||
_ bin.BareDecoder = &AccountDeleteAutoSaveExceptionsRequest{}
|
||||
)
|
||||
|
||||
func (d *AccountDeleteAutoSaveExceptionsRequest) Zero() bool {
|
||||
if d == nil {
|
||||
return true
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
// String implements fmt.Stringer.
|
||||
func (d *AccountDeleteAutoSaveExceptionsRequest) String() string {
|
||||
if d == nil {
|
||||
return "AccountDeleteAutoSaveExceptionsRequest(nil)"
|
||||
}
|
||||
type Alias AccountDeleteAutoSaveExceptionsRequest
|
||||
return fmt.Sprintf("AccountDeleteAutoSaveExceptionsRequest%+v", Alias(*d))
|
||||
}
|
||||
|
||||
// TypeID returns type id in TL schema.
|
||||
//
|
||||
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
||||
func (*AccountDeleteAutoSaveExceptionsRequest) TypeID() uint32 {
|
||||
return AccountDeleteAutoSaveExceptionsRequestTypeID
|
||||
}
|
||||
|
||||
// TypeName returns name of type in TL schema.
|
||||
func (*AccountDeleteAutoSaveExceptionsRequest) TypeName() string {
|
||||
return "account.deleteAutoSaveExceptions"
|
||||
}
|
||||
|
||||
// TypeInfo returns info about TL type.
|
||||
func (d *AccountDeleteAutoSaveExceptionsRequest) TypeInfo() tdp.Type {
|
||||
typ := tdp.Type{
|
||||
Name: "account.deleteAutoSaveExceptions",
|
||||
ID: AccountDeleteAutoSaveExceptionsRequestTypeID,
|
||||
}
|
||||
if d == nil {
|
||||
typ.Null = true
|
||||
return typ
|
||||
}
|
||||
typ.Fields = []tdp.Field{}
|
||||
return typ
|
||||
}
|
||||
|
||||
// Encode implements bin.Encoder.
|
||||
func (d *AccountDeleteAutoSaveExceptionsRequest) Encode(b *bin.Buffer) error {
|
||||
if d == nil {
|
||||
return fmt.Errorf("can't encode account.deleteAutoSaveExceptions#53bc0020 as nil")
|
||||
}
|
||||
b.PutID(AccountDeleteAutoSaveExceptionsRequestTypeID)
|
||||
return d.EncodeBare(b)
|
||||
}
|
||||
|
||||
// EncodeBare implements bin.BareEncoder.
|
||||
func (d *AccountDeleteAutoSaveExceptionsRequest) EncodeBare(b *bin.Buffer) error {
|
||||
if d == nil {
|
||||
return fmt.Errorf("can't encode account.deleteAutoSaveExceptions#53bc0020 as nil")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Decode implements bin.Decoder.
|
||||
func (d *AccountDeleteAutoSaveExceptionsRequest) Decode(b *bin.Buffer) error {
|
||||
if d == nil {
|
||||
return fmt.Errorf("can't decode account.deleteAutoSaveExceptions#53bc0020 to nil")
|
||||
}
|
||||
if err := b.ConsumeID(AccountDeleteAutoSaveExceptionsRequestTypeID); err != nil {
|
||||
return fmt.Errorf("unable to decode account.deleteAutoSaveExceptions#53bc0020: %w", err)
|
||||
}
|
||||
return d.DecodeBare(b)
|
||||
}
|
||||
|
||||
// DecodeBare implements bin.BareDecoder.
|
||||
func (d *AccountDeleteAutoSaveExceptionsRequest) DecodeBare(b *bin.Buffer) error {
|
||||
if d == nil {
|
||||
return fmt.Errorf("can't decode account.deleteAutoSaveExceptions#53bc0020 to nil")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// AccountDeleteAutoSaveExceptions invokes method account.deleteAutoSaveExceptions#53bc0020 returning error if any.
|
||||
// Clear all peer-specific autosave settings.
|
||||
//
|
||||
// See https://core.telegram.org/method/account.deleteAutoSaveExceptions for reference.
|
||||
func (c *Client) AccountDeleteAutoSaveExceptions(ctx context.Context) (bool, error) {
|
||||
var result BoolBox
|
||||
|
||||
request := &AccountDeleteAutoSaveExceptionsRequest{}
|
||||
if err := c.rpc.Invoke(ctx, request, &result); err != nil {
|
||||
return false, err
|
||||
}
|
||||
_, ok := result.Bool.(*BoolTrue)
|
||||
return ok, nil
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
//go:build !no_gotd_slices
|
||||
// +build !no_gotd_slices
|
||||
|
||||
// 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{}
|
||||
)
|
||||
@@ -0,0 +1,193 @@
|
||||
// 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{}
|
||||
)
|
||||
|
||||
// AccountDeleteBusinessChatLinkRequest represents TL type `account.deleteBusinessChatLink#60073674`.
|
||||
// Delete a business chat deep link »¹.
|
||||
//
|
||||
// Links:
|
||||
// 1. https://core.telegram.org/api/business#business-chat-links
|
||||
//
|
||||
// See https://core.telegram.org/method/account.deleteBusinessChatLink for reference.
|
||||
type AccountDeleteBusinessChatLinkRequest struct {
|
||||
// Slug of the link, obtained as specified here »¹.
|
||||
//
|
||||
// Links:
|
||||
// 1) https://core.telegram.org/api/links#business-chat-links
|
||||
Slug string
|
||||
}
|
||||
|
||||
// AccountDeleteBusinessChatLinkRequestTypeID is TL type id of AccountDeleteBusinessChatLinkRequest.
|
||||
const AccountDeleteBusinessChatLinkRequestTypeID = 0x60073674
|
||||
|
||||
// Ensuring interfaces in compile-time for AccountDeleteBusinessChatLinkRequest.
|
||||
var (
|
||||
_ bin.Encoder = &AccountDeleteBusinessChatLinkRequest{}
|
||||
_ bin.Decoder = &AccountDeleteBusinessChatLinkRequest{}
|
||||
_ bin.BareEncoder = &AccountDeleteBusinessChatLinkRequest{}
|
||||
_ bin.BareDecoder = &AccountDeleteBusinessChatLinkRequest{}
|
||||
)
|
||||
|
||||
func (d *AccountDeleteBusinessChatLinkRequest) Zero() bool {
|
||||
if d == nil {
|
||||
return true
|
||||
}
|
||||
if !(d.Slug == "") {
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
// String implements fmt.Stringer.
|
||||
func (d *AccountDeleteBusinessChatLinkRequest) String() string {
|
||||
if d == nil {
|
||||
return "AccountDeleteBusinessChatLinkRequest(nil)"
|
||||
}
|
||||
type Alias AccountDeleteBusinessChatLinkRequest
|
||||
return fmt.Sprintf("AccountDeleteBusinessChatLinkRequest%+v", Alias(*d))
|
||||
}
|
||||
|
||||
// FillFrom fills AccountDeleteBusinessChatLinkRequest from given interface.
|
||||
func (d *AccountDeleteBusinessChatLinkRequest) FillFrom(from interface {
|
||||
GetSlug() (value string)
|
||||
}) {
|
||||
d.Slug = from.GetSlug()
|
||||
}
|
||||
|
||||
// TypeID returns type id in TL schema.
|
||||
//
|
||||
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
||||
func (*AccountDeleteBusinessChatLinkRequest) TypeID() uint32 {
|
||||
return AccountDeleteBusinessChatLinkRequestTypeID
|
||||
}
|
||||
|
||||
// TypeName returns name of type in TL schema.
|
||||
func (*AccountDeleteBusinessChatLinkRequest) TypeName() string {
|
||||
return "account.deleteBusinessChatLink"
|
||||
}
|
||||
|
||||
// TypeInfo returns info about TL type.
|
||||
func (d *AccountDeleteBusinessChatLinkRequest) TypeInfo() tdp.Type {
|
||||
typ := tdp.Type{
|
||||
Name: "account.deleteBusinessChatLink",
|
||||
ID: AccountDeleteBusinessChatLinkRequestTypeID,
|
||||
}
|
||||
if d == nil {
|
||||
typ.Null = true
|
||||
return typ
|
||||
}
|
||||
typ.Fields = []tdp.Field{
|
||||
{
|
||||
Name: "Slug",
|
||||
SchemaName: "slug",
|
||||
},
|
||||
}
|
||||
return typ
|
||||
}
|
||||
|
||||
// Encode implements bin.Encoder.
|
||||
func (d *AccountDeleteBusinessChatLinkRequest) Encode(b *bin.Buffer) error {
|
||||
if d == nil {
|
||||
return fmt.Errorf("can't encode account.deleteBusinessChatLink#60073674 as nil")
|
||||
}
|
||||
b.PutID(AccountDeleteBusinessChatLinkRequestTypeID)
|
||||
return d.EncodeBare(b)
|
||||
}
|
||||
|
||||
// EncodeBare implements bin.BareEncoder.
|
||||
func (d *AccountDeleteBusinessChatLinkRequest) EncodeBare(b *bin.Buffer) error {
|
||||
if d == nil {
|
||||
return fmt.Errorf("can't encode account.deleteBusinessChatLink#60073674 as nil")
|
||||
}
|
||||
b.PutString(d.Slug)
|
||||
return nil
|
||||
}
|
||||
|
||||
// Decode implements bin.Decoder.
|
||||
func (d *AccountDeleteBusinessChatLinkRequest) Decode(b *bin.Buffer) error {
|
||||
if d == nil {
|
||||
return fmt.Errorf("can't decode account.deleteBusinessChatLink#60073674 to nil")
|
||||
}
|
||||
if err := b.ConsumeID(AccountDeleteBusinessChatLinkRequestTypeID); err != nil {
|
||||
return fmt.Errorf("unable to decode account.deleteBusinessChatLink#60073674: %w", err)
|
||||
}
|
||||
return d.DecodeBare(b)
|
||||
}
|
||||
|
||||
// DecodeBare implements bin.BareDecoder.
|
||||
func (d *AccountDeleteBusinessChatLinkRequest) DecodeBare(b *bin.Buffer) error {
|
||||
if d == nil {
|
||||
return fmt.Errorf("can't decode account.deleteBusinessChatLink#60073674 to nil")
|
||||
}
|
||||
{
|
||||
value, err := b.String()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode account.deleteBusinessChatLink#60073674: field slug: %w", err)
|
||||
}
|
||||
d.Slug = value
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// GetSlug returns value of Slug field.
|
||||
func (d *AccountDeleteBusinessChatLinkRequest) GetSlug() (value string) {
|
||||
if d == nil {
|
||||
return
|
||||
}
|
||||
return d.Slug
|
||||
}
|
||||
|
||||
// AccountDeleteBusinessChatLink invokes method account.deleteBusinessChatLink#60073674 returning error if any.
|
||||
// Delete a business chat deep link »¹.
|
||||
//
|
||||
// Links:
|
||||
// 1. https://core.telegram.org/api/business#business-chat-links
|
||||
//
|
||||
// Possible errors:
|
||||
//
|
||||
// 400 CHATLINK_SLUG_EMPTY: The specified slug is empty.
|
||||
// 400 CHATLINK_SLUG_EXPIRED: The specified business chat link has expired.
|
||||
//
|
||||
// See https://core.telegram.org/method/account.deleteBusinessChatLink for reference.
|
||||
func (c *Client) AccountDeleteBusinessChatLink(ctx context.Context, slug string) (bool, error) {
|
||||
var result BoolBox
|
||||
|
||||
request := &AccountDeleteBusinessChatLinkRequest{
|
||||
Slug: slug,
|
||||
}
|
||||
if err := c.rpc.Invoke(ctx, request, &result); err != nil {
|
||||
return false, err
|
||||
}
|
||||
_, ok := result.Bool.(*BoolTrue)
|
||||
return ok, nil
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
//go:build !no_gotd_slices
|
||||
// +build !no_gotd_slices
|
||||
|
||||
// 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{}
|
||||
)
|
||||
@@ -0,0 +1,210 @@
|
||||
// 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{}
|
||||
)
|
||||
|
||||
// AccountDeleteSecureValueRequest represents TL type `account.deleteSecureValue#b880bc4b`.
|
||||
// Delete stored Telegram Passport¹ documents, for more info see the passport docs »²
|
||||
//
|
||||
// Links:
|
||||
// 1. https://core.telegram.org/passport
|
||||
// 2. https://core.telegram.org/passport/encryption#encryption
|
||||
//
|
||||
// See https://core.telegram.org/method/account.deleteSecureValue for reference.
|
||||
type AccountDeleteSecureValueRequest struct {
|
||||
// Document types to delete
|
||||
Types []SecureValueTypeClass
|
||||
}
|
||||
|
||||
// AccountDeleteSecureValueRequestTypeID is TL type id of AccountDeleteSecureValueRequest.
|
||||
const AccountDeleteSecureValueRequestTypeID = 0xb880bc4b
|
||||
|
||||
// Ensuring interfaces in compile-time for AccountDeleteSecureValueRequest.
|
||||
var (
|
||||
_ bin.Encoder = &AccountDeleteSecureValueRequest{}
|
||||
_ bin.Decoder = &AccountDeleteSecureValueRequest{}
|
||||
_ bin.BareEncoder = &AccountDeleteSecureValueRequest{}
|
||||
_ bin.BareDecoder = &AccountDeleteSecureValueRequest{}
|
||||
)
|
||||
|
||||
func (d *AccountDeleteSecureValueRequest) Zero() bool {
|
||||
if d == nil {
|
||||
return true
|
||||
}
|
||||
if !(d.Types == nil) {
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
// String implements fmt.Stringer.
|
||||
func (d *AccountDeleteSecureValueRequest) String() string {
|
||||
if d == nil {
|
||||
return "AccountDeleteSecureValueRequest(nil)"
|
||||
}
|
||||
type Alias AccountDeleteSecureValueRequest
|
||||
return fmt.Sprintf("AccountDeleteSecureValueRequest%+v", Alias(*d))
|
||||
}
|
||||
|
||||
// FillFrom fills AccountDeleteSecureValueRequest from given interface.
|
||||
func (d *AccountDeleteSecureValueRequest) FillFrom(from interface {
|
||||
GetTypes() (value []SecureValueTypeClass)
|
||||
}) {
|
||||
d.Types = from.GetTypes()
|
||||
}
|
||||
|
||||
// TypeID returns type id in TL schema.
|
||||
//
|
||||
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
||||
func (*AccountDeleteSecureValueRequest) TypeID() uint32 {
|
||||
return AccountDeleteSecureValueRequestTypeID
|
||||
}
|
||||
|
||||
// TypeName returns name of type in TL schema.
|
||||
func (*AccountDeleteSecureValueRequest) TypeName() string {
|
||||
return "account.deleteSecureValue"
|
||||
}
|
||||
|
||||
// TypeInfo returns info about TL type.
|
||||
func (d *AccountDeleteSecureValueRequest) TypeInfo() tdp.Type {
|
||||
typ := tdp.Type{
|
||||
Name: "account.deleteSecureValue",
|
||||
ID: AccountDeleteSecureValueRequestTypeID,
|
||||
}
|
||||
if d == nil {
|
||||
typ.Null = true
|
||||
return typ
|
||||
}
|
||||
typ.Fields = []tdp.Field{
|
||||
{
|
||||
Name: "Types",
|
||||
SchemaName: "types",
|
||||
},
|
||||
}
|
||||
return typ
|
||||
}
|
||||
|
||||
// Encode implements bin.Encoder.
|
||||
func (d *AccountDeleteSecureValueRequest) Encode(b *bin.Buffer) error {
|
||||
if d == nil {
|
||||
return fmt.Errorf("can't encode account.deleteSecureValue#b880bc4b as nil")
|
||||
}
|
||||
b.PutID(AccountDeleteSecureValueRequestTypeID)
|
||||
return d.EncodeBare(b)
|
||||
}
|
||||
|
||||
// EncodeBare implements bin.BareEncoder.
|
||||
func (d *AccountDeleteSecureValueRequest) EncodeBare(b *bin.Buffer) error {
|
||||
if d == nil {
|
||||
return fmt.Errorf("can't encode account.deleteSecureValue#b880bc4b as nil")
|
||||
}
|
||||
b.PutVectorHeader(len(d.Types))
|
||||
for idx, v := range d.Types {
|
||||
if v == nil {
|
||||
return fmt.Errorf("unable to encode account.deleteSecureValue#b880bc4b: field types element with index %d is nil", idx)
|
||||
}
|
||||
if err := v.Encode(b); err != nil {
|
||||
return fmt.Errorf("unable to encode account.deleteSecureValue#b880bc4b: field types element with index %d: %w", idx, err)
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Decode implements bin.Decoder.
|
||||
func (d *AccountDeleteSecureValueRequest) Decode(b *bin.Buffer) error {
|
||||
if d == nil {
|
||||
return fmt.Errorf("can't decode account.deleteSecureValue#b880bc4b to nil")
|
||||
}
|
||||
if err := b.ConsumeID(AccountDeleteSecureValueRequestTypeID); err != nil {
|
||||
return fmt.Errorf("unable to decode account.deleteSecureValue#b880bc4b: %w", err)
|
||||
}
|
||||
return d.DecodeBare(b)
|
||||
}
|
||||
|
||||
// DecodeBare implements bin.BareDecoder.
|
||||
func (d *AccountDeleteSecureValueRequest) DecodeBare(b *bin.Buffer) error {
|
||||
if d == nil {
|
||||
return fmt.Errorf("can't decode account.deleteSecureValue#b880bc4b to nil")
|
||||
}
|
||||
{
|
||||
headerLen, err := b.VectorHeader()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode account.deleteSecureValue#b880bc4b: field types: %w", err)
|
||||
}
|
||||
|
||||
if headerLen > 0 {
|
||||
d.Types = make([]SecureValueTypeClass, 0, headerLen%bin.PreallocateLimit)
|
||||
}
|
||||
for idx := 0; idx < headerLen; idx++ {
|
||||
value, err := DecodeSecureValueType(b)
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode account.deleteSecureValue#b880bc4b: field types: %w", err)
|
||||
}
|
||||
d.Types = append(d.Types, value)
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// GetTypes returns value of Types field.
|
||||
func (d *AccountDeleteSecureValueRequest) GetTypes() (value []SecureValueTypeClass) {
|
||||
if d == nil {
|
||||
return
|
||||
}
|
||||
return d.Types
|
||||
}
|
||||
|
||||
// MapTypes returns field Types wrapped in SecureValueTypeClassArray helper.
|
||||
func (d *AccountDeleteSecureValueRequest) MapTypes() (value SecureValueTypeClassArray) {
|
||||
return SecureValueTypeClassArray(d.Types)
|
||||
}
|
||||
|
||||
// AccountDeleteSecureValue invokes method account.deleteSecureValue#b880bc4b returning error if any.
|
||||
// Delete stored Telegram Passport¹ documents, for more info see the passport docs »²
|
||||
//
|
||||
// Links:
|
||||
// 1. https://core.telegram.org/passport
|
||||
// 2. https://core.telegram.org/passport/encryption#encryption
|
||||
//
|
||||
// See https://core.telegram.org/method/account.deleteSecureValue for reference.
|
||||
func (c *Client) AccountDeleteSecureValue(ctx context.Context, types []SecureValueTypeClass) (bool, error) {
|
||||
var result BoolBox
|
||||
|
||||
request := &AccountDeleteSecureValueRequest{
|
||||
Types: types,
|
||||
}
|
||||
if err := c.rpc.Invoke(ctx, request, &result); err != nil {
|
||||
return false, err
|
||||
}
|
||||
_, ok := result.Bool.(*BoolTrue)
|
||||
return ok, nil
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
//go:build !no_gotd_slices
|
||||
// +build !no_gotd_slices
|
||||
|
||||
// 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{}
|
||||
)
|
||||
@@ -0,0 +1,206 @@
|
||||
// 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{}
|
||||
)
|
||||
|
||||
// AccountDisablePeerConnectedBotRequest represents TL type `account.disablePeerConnectedBot#5e437ed9`.
|
||||
// Permanently disconnect a specific chat from all business bots »¹ (equivalent to
|
||||
// specifying it in recipients.exclude_users during initial configuration with account
|
||||
// updateConnectedBot »²); to reconnect of a chat disconnected using this method the
|
||||
// user must reconnect the entire bot by invoking account.updateConnectedBot »³.
|
||||
//
|
||||
// Links:
|
||||
// 1. https://core.telegram.org/api/business#connected-bots
|
||||
// 2. https://core.telegram.org/method/account.updateConnectedBot
|
||||
// 3. https://core.telegram.org/method/account.updateConnectedBot
|
||||
//
|
||||
// See https://core.telegram.org/method/account.disablePeerConnectedBot for reference.
|
||||
type AccountDisablePeerConnectedBotRequest struct {
|
||||
// The chat to disconnect
|
||||
Peer InputPeerClass
|
||||
}
|
||||
|
||||
// AccountDisablePeerConnectedBotRequestTypeID is TL type id of AccountDisablePeerConnectedBotRequest.
|
||||
const AccountDisablePeerConnectedBotRequestTypeID = 0x5e437ed9
|
||||
|
||||
// Ensuring interfaces in compile-time for AccountDisablePeerConnectedBotRequest.
|
||||
var (
|
||||
_ bin.Encoder = &AccountDisablePeerConnectedBotRequest{}
|
||||
_ bin.Decoder = &AccountDisablePeerConnectedBotRequest{}
|
||||
_ bin.BareEncoder = &AccountDisablePeerConnectedBotRequest{}
|
||||
_ bin.BareDecoder = &AccountDisablePeerConnectedBotRequest{}
|
||||
)
|
||||
|
||||
func (d *AccountDisablePeerConnectedBotRequest) Zero() bool {
|
||||
if d == nil {
|
||||
return true
|
||||
}
|
||||
if !(d.Peer == nil) {
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
// String implements fmt.Stringer.
|
||||
func (d *AccountDisablePeerConnectedBotRequest) String() string {
|
||||
if d == nil {
|
||||
return "AccountDisablePeerConnectedBotRequest(nil)"
|
||||
}
|
||||
type Alias AccountDisablePeerConnectedBotRequest
|
||||
return fmt.Sprintf("AccountDisablePeerConnectedBotRequest%+v", Alias(*d))
|
||||
}
|
||||
|
||||
// FillFrom fills AccountDisablePeerConnectedBotRequest from given interface.
|
||||
func (d *AccountDisablePeerConnectedBotRequest) FillFrom(from interface {
|
||||
GetPeer() (value InputPeerClass)
|
||||
}) {
|
||||
d.Peer = from.GetPeer()
|
||||
}
|
||||
|
||||
// TypeID returns type id in TL schema.
|
||||
//
|
||||
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
||||
func (*AccountDisablePeerConnectedBotRequest) TypeID() uint32 {
|
||||
return AccountDisablePeerConnectedBotRequestTypeID
|
||||
}
|
||||
|
||||
// TypeName returns name of type in TL schema.
|
||||
func (*AccountDisablePeerConnectedBotRequest) TypeName() string {
|
||||
return "account.disablePeerConnectedBot"
|
||||
}
|
||||
|
||||
// TypeInfo returns info about TL type.
|
||||
func (d *AccountDisablePeerConnectedBotRequest) TypeInfo() tdp.Type {
|
||||
typ := tdp.Type{
|
||||
Name: "account.disablePeerConnectedBot",
|
||||
ID: AccountDisablePeerConnectedBotRequestTypeID,
|
||||
}
|
||||
if d == nil {
|
||||
typ.Null = true
|
||||
return typ
|
||||
}
|
||||
typ.Fields = []tdp.Field{
|
||||
{
|
||||
Name: "Peer",
|
||||
SchemaName: "peer",
|
||||
},
|
||||
}
|
||||
return typ
|
||||
}
|
||||
|
||||
// Encode implements bin.Encoder.
|
||||
func (d *AccountDisablePeerConnectedBotRequest) Encode(b *bin.Buffer) error {
|
||||
if d == nil {
|
||||
return fmt.Errorf("can't encode account.disablePeerConnectedBot#5e437ed9 as nil")
|
||||
}
|
||||
b.PutID(AccountDisablePeerConnectedBotRequestTypeID)
|
||||
return d.EncodeBare(b)
|
||||
}
|
||||
|
||||
// EncodeBare implements bin.BareEncoder.
|
||||
func (d *AccountDisablePeerConnectedBotRequest) EncodeBare(b *bin.Buffer) error {
|
||||
if d == nil {
|
||||
return fmt.Errorf("can't encode account.disablePeerConnectedBot#5e437ed9 as nil")
|
||||
}
|
||||
if d.Peer == nil {
|
||||
return fmt.Errorf("unable to encode account.disablePeerConnectedBot#5e437ed9: field peer is nil")
|
||||
}
|
||||
if err := d.Peer.Encode(b); err != nil {
|
||||
return fmt.Errorf("unable to encode account.disablePeerConnectedBot#5e437ed9: field peer: %w", err)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Decode implements bin.Decoder.
|
||||
func (d *AccountDisablePeerConnectedBotRequest) Decode(b *bin.Buffer) error {
|
||||
if d == nil {
|
||||
return fmt.Errorf("can't decode account.disablePeerConnectedBot#5e437ed9 to nil")
|
||||
}
|
||||
if err := b.ConsumeID(AccountDisablePeerConnectedBotRequestTypeID); err != nil {
|
||||
return fmt.Errorf("unable to decode account.disablePeerConnectedBot#5e437ed9: %w", err)
|
||||
}
|
||||
return d.DecodeBare(b)
|
||||
}
|
||||
|
||||
// DecodeBare implements bin.BareDecoder.
|
||||
func (d *AccountDisablePeerConnectedBotRequest) DecodeBare(b *bin.Buffer) error {
|
||||
if d == nil {
|
||||
return fmt.Errorf("can't decode account.disablePeerConnectedBot#5e437ed9 to nil")
|
||||
}
|
||||
{
|
||||
value, err := DecodeInputPeer(b)
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode account.disablePeerConnectedBot#5e437ed9: field peer: %w", err)
|
||||
}
|
||||
d.Peer = value
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// GetPeer returns value of Peer field.
|
||||
func (d *AccountDisablePeerConnectedBotRequest) GetPeer() (value InputPeerClass) {
|
||||
if d == nil {
|
||||
return
|
||||
}
|
||||
return d.Peer
|
||||
}
|
||||
|
||||
// AccountDisablePeerConnectedBot invokes method account.disablePeerConnectedBot#5e437ed9 returning error if any.
|
||||
// Permanently disconnect a specific chat from all business bots »¹ (equivalent to
|
||||
// specifying it in recipients.exclude_users during initial configuration with account
|
||||
// updateConnectedBot »²); to reconnect of a chat disconnected using this method the
|
||||
// user must reconnect the entire bot by invoking account.updateConnectedBot »³.
|
||||
//
|
||||
// Links:
|
||||
// 1. https://core.telegram.org/api/business#connected-bots
|
||||
// 2. https://core.telegram.org/method/account.updateConnectedBot
|
||||
// 3. https://core.telegram.org/method/account.updateConnectedBot
|
||||
//
|
||||
// Possible errors:
|
||||
//
|
||||
// 400 BOT_ALREADY_DISABLED: The connected business bot was already disabled for the specified peer.
|
||||
// 400 BOT_NOT_CONNECTED_YET: No business bot is connected to the currently logged in user.
|
||||
// 400 PEER_ID_INVALID: The provided peer id is invalid.
|
||||
//
|
||||
// See https://core.telegram.org/method/account.disablePeerConnectedBot for reference.
|
||||
func (c *Client) AccountDisablePeerConnectedBot(ctx context.Context, peer InputPeerClass) (bool, error) {
|
||||
var result BoolBox
|
||||
|
||||
request := &AccountDisablePeerConnectedBotRequest{
|
||||
Peer: peer,
|
||||
}
|
||||
if err := c.rpc.Invoke(ctx, request, &result); err != nil {
|
||||
return false, err
|
||||
}
|
||||
_, ok := result.Bool.(*BoolTrue)
|
||||
return ok, nil
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
//go:build !no_gotd_slices
|
||||
// +build !no_gotd_slices
|
||||
|
||||
// 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{}
|
||||
)
|
||||
@@ -0,0 +1,216 @@
|
||||
// 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{}
|
||||
)
|
||||
|
||||
// AccountEditBusinessChatLinkRequest represents TL type `account.editBusinessChatLink#8c3410af`.
|
||||
// Edit a created business chat deep link »¹.
|
||||
//
|
||||
// Links:
|
||||
// 1. https://core.telegram.org/api/business#business-chat-links
|
||||
//
|
||||
// See https://core.telegram.org/method/account.editBusinessChatLink for reference.
|
||||
type AccountEditBusinessChatLinkRequest struct {
|
||||
// Slug of the link, obtained as specified here »¹.
|
||||
//
|
||||
// Links:
|
||||
// 1) https://core.telegram.org/api/links#business-chat-links
|
||||
Slug string
|
||||
// New link information.
|
||||
Link InputBusinessChatLink
|
||||
}
|
||||
|
||||
// AccountEditBusinessChatLinkRequestTypeID is TL type id of AccountEditBusinessChatLinkRequest.
|
||||
const AccountEditBusinessChatLinkRequestTypeID = 0x8c3410af
|
||||
|
||||
// Ensuring interfaces in compile-time for AccountEditBusinessChatLinkRequest.
|
||||
var (
|
||||
_ bin.Encoder = &AccountEditBusinessChatLinkRequest{}
|
||||
_ bin.Decoder = &AccountEditBusinessChatLinkRequest{}
|
||||
_ bin.BareEncoder = &AccountEditBusinessChatLinkRequest{}
|
||||
_ bin.BareDecoder = &AccountEditBusinessChatLinkRequest{}
|
||||
)
|
||||
|
||||
func (e *AccountEditBusinessChatLinkRequest) Zero() bool {
|
||||
if e == nil {
|
||||
return true
|
||||
}
|
||||
if !(e.Slug == "") {
|
||||
return false
|
||||
}
|
||||
if !(e.Link.Zero()) {
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
// String implements fmt.Stringer.
|
||||
func (e *AccountEditBusinessChatLinkRequest) String() string {
|
||||
if e == nil {
|
||||
return "AccountEditBusinessChatLinkRequest(nil)"
|
||||
}
|
||||
type Alias AccountEditBusinessChatLinkRequest
|
||||
return fmt.Sprintf("AccountEditBusinessChatLinkRequest%+v", Alias(*e))
|
||||
}
|
||||
|
||||
// FillFrom fills AccountEditBusinessChatLinkRequest from given interface.
|
||||
func (e *AccountEditBusinessChatLinkRequest) FillFrom(from interface {
|
||||
GetSlug() (value string)
|
||||
GetLink() (value InputBusinessChatLink)
|
||||
}) {
|
||||
e.Slug = from.GetSlug()
|
||||
e.Link = from.GetLink()
|
||||
}
|
||||
|
||||
// TypeID returns type id in TL schema.
|
||||
//
|
||||
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
||||
func (*AccountEditBusinessChatLinkRequest) TypeID() uint32 {
|
||||
return AccountEditBusinessChatLinkRequestTypeID
|
||||
}
|
||||
|
||||
// TypeName returns name of type in TL schema.
|
||||
func (*AccountEditBusinessChatLinkRequest) TypeName() string {
|
||||
return "account.editBusinessChatLink"
|
||||
}
|
||||
|
||||
// TypeInfo returns info about TL type.
|
||||
func (e *AccountEditBusinessChatLinkRequest) TypeInfo() tdp.Type {
|
||||
typ := tdp.Type{
|
||||
Name: "account.editBusinessChatLink",
|
||||
ID: AccountEditBusinessChatLinkRequestTypeID,
|
||||
}
|
||||
if e == nil {
|
||||
typ.Null = true
|
||||
return typ
|
||||
}
|
||||
typ.Fields = []tdp.Field{
|
||||
{
|
||||
Name: "Slug",
|
||||
SchemaName: "slug",
|
||||
},
|
||||
{
|
||||
Name: "Link",
|
||||
SchemaName: "link",
|
||||
},
|
||||
}
|
||||
return typ
|
||||
}
|
||||
|
||||
// Encode implements bin.Encoder.
|
||||
func (e *AccountEditBusinessChatLinkRequest) Encode(b *bin.Buffer) error {
|
||||
if e == nil {
|
||||
return fmt.Errorf("can't encode account.editBusinessChatLink#8c3410af as nil")
|
||||
}
|
||||
b.PutID(AccountEditBusinessChatLinkRequestTypeID)
|
||||
return e.EncodeBare(b)
|
||||
}
|
||||
|
||||
// EncodeBare implements bin.BareEncoder.
|
||||
func (e *AccountEditBusinessChatLinkRequest) EncodeBare(b *bin.Buffer) error {
|
||||
if e == nil {
|
||||
return fmt.Errorf("can't encode account.editBusinessChatLink#8c3410af as nil")
|
||||
}
|
||||
b.PutString(e.Slug)
|
||||
if err := e.Link.Encode(b); err != nil {
|
||||
return fmt.Errorf("unable to encode account.editBusinessChatLink#8c3410af: field link: %w", err)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Decode implements bin.Decoder.
|
||||
func (e *AccountEditBusinessChatLinkRequest) Decode(b *bin.Buffer) error {
|
||||
if e == nil {
|
||||
return fmt.Errorf("can't decode account.editBusinessChatLink#8c3410af to nil")
|
||||
}
|
||||
if err := b.ConsumeID(AccountEditBusinessChatLinkRequestTypeID); err != nil {
|
||||
return fmt.Errorf("unable to decode account.editBusinessChatLink#8c3410af: %w", err)
|
||||
}
|
||||
return e.DecodeBare(b)
|
||||
}
|
||||
|
||||
// DecodeBare implements bin.BareDecoder.
|
||||
func (e *AccountEditBusinessChatLinkRequest) DecodeBare(b *bin.Buffer) error {
|
||||
if e == nil {
|
||||
return fmt.Errorf("can't decode account.editBusinessChatLink#8c3410af to nil")
|
||||
}
|
||||
{
|
||||
value, err := b.String()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode account.editBusinessChatLink#8c3410af: field slug: %w", err)
|
||||
}
|
||||
e.Slug = value
|
||||
}
|
||||
{
|
||||
if err := e.Link.Decode(b); err != nil {
|
||||
return fmt.Errorf("unable to decode account.editBusinessChatLink#8c3410af: field link: %w", err)
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// GetSlug returns value of Slug field.
|
||||
func (e *AccountEditBusinessChatLinkRequest) GetSlug() (value string) {
|
||||
if e == nil {
|
||||
return
|
||||
}
|
||||
return e.Slug
|
||||
}
|
||||
|
||||
// GetLink returns value of Link field.
|
||||
func (e *AccountEditBusinessChatLinkRequest) GetLink() (value InputBusinessChatLink) {
|
||||
if e == nil {
|
||||
return
|
||||
}
|
||||
return e.Link
|
||||
}
|
||||
|
||||
// AccountEditBusinessChatLink invokes method account.editBusinessChatLink#8c3410af returning error if any.
|
||||
// Edit a created business chat deep link »¹.
|
||||
//
|
||||
// Links:
|
||||
// 1. https://core.telegram.org/api/business#business-chat-links
|
||||
//
|
||||
// Possible errors:
|
||||
//
|
||||
// 400 CHATLINK_SLUG_EMPTY: The specified slug is empty.
|
||||
// 403 PREMIUM_ACCOUNT_REQUIRED: A premium account is required to execute this action.
|
||||
//
|
||||
// See https://core.telegram.org/method/account.editBusinessChatLink for reference.
|
||||
func (c *Client) AccountEditBusinessChatLink(ctx context.Context, request *AccountEditBusinessChatLinkRequest) (*BusinessChatLink, error) {
|
||||
var result BusinessChatLink
|
||||
|
||||
if err := c.rpc.Invoke(ctx, request, &result); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &result, nil
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
//go:build !no_gotd_slices
|
||||
// +build !no_gotd_slices
|
||||
|
||||
// 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{}
|
||||
)
|
||||
@@ -0,0 +1,429 @@
|
||||
// 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{}
|
||||
)
|
||||
|
||||
// AccountEmailVerified represents TL type `account.emailVerified#2b96cd1b`.
|
||||
// The email was verified correctly.
|
||||
//
|
||||
// See https://core.telegram.org/constructor/account.emailVerified for reference.
|
||||
type AccountEmailVerified struct {
|
||||
// The verified email address.
|
||||
Email string
|
||||
}
|
||||
|
||||
// AccountEmailVerifiedTypeID is TL type id of AccountEmailVerified.
|
||||
const AccountEmailVerifiedTypeID = 0x2b96cd1b
|
||||
|
||||
// construct implements constructor of AccountEmailVerifiedClass.
|
||||
func (e AccountEmailVerified) construct() AccountEmailVerifiedClass { return &e }
|
||||
|
||||
// Ensuring interfaces in compile-time for AccountEmailVerified.
|
||||
var (
|
||||
_ bin.Encoder = &AccountEmailVerified{}
|
||||
_ bin.Decoder = &AccountEmailVerified{}
|
||||
_ bin.BareEncoder = &AccountEmailVerified{}
|
||||
_ bin.BareDecoder = &AccountEmailVerified{}
|
||||
|
||||
_ AccountEmailVerifiedClass = &AccountEmailVerified{}
|
||||
)
|
||||
|
||||
func (e *AccountEmailVerified) Zero() bool {
|
||||
if e == nil {
|
||||
return true
|
||||
}
|
||||
if !(e.Email == "") {
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
// String implements fmt.Stringer.
|
||||
func (e *AccountEmailVerified) String() string {
|
||||
if e == nil {
|
||||
return "AccountEmailVerified(nil)"
|
||||
}
|
||||
type Alias AccountEmailVerified
|
||||
return fmt.Sprintf("AccountEmailVerified%+v", Alias(*e))
|
||||
}
|
||||
|
||||
// FillFrom fills AccountEmailVerified from given interface.
|
||||
func (e *AccountEmailVerified) FillFrom(from interface {
|
||||
GetEmail() (value string)
|
||||
}) {
|
||||
e.Email = from.GetEmail()
|
||||
}
|
||||
|
||||
// TypeID returns type id in TL schema.
|
||||
//
|
||||
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
||||
func (*AccountEmailVerified) TypeID() uint32 {
|
||||
return AccountEmailVerifiedTypeID
|
||||
}
|
||||
|
||||
// TypeName returns name of type in TL schema.
|
||||
func (*AccountEmailVerified) TypeName() string {
|
||||
return "account.emailVerified"
|
||||
}
|
||||
|
||||
// TypeInfo returns info about TL type.
|
||||
func (e *AccountEmailVerified) TypeInfo() tdp.Type {
|
||||
typ := tdp.Type{
|
||||
Name: "account.emailVerified",
|
||||
ID: AccountEmailVerifiedTypeID,
|
||||
}
|
||||
if e == nil {
|
||||
typ.Null = true
|
||||
return typ
|
||||
}
|
||||
typ.Fields = []tdp.Field{
|
||||
{
|
||||
Name: "Email",
|
||||
SchemaName: "email",
|
||||
},
|
||||
}
|
||||
return typ
|
||||
}
|
||||
|
||||
// Encode implements bin.Encoder.
|
||||
func (e *AccountEmailVerified) Encode(b *bin.Buffer) error {
|
||||
if e == nil {
|
||||
return fmt.Errorf("can't encode account.emailVerified#2b96cd1b as nil")
|
||||
}
|
||||
b.PutID(AccountEmailVerifiedTypeID)
|
||||
return e.EncodeBare(b)
|
||||
}
|
||||
|
||||
// EncodeBare implements bin.BareEncoder.
|
||||
func (e *AccountEmailVerified) EncodeBare(b *bin.Buffer) error {
|
||||
if e == nil {
|
||||
return fmt.Errorf("can't encode account.emailVerified#2b96cd1b as nil")
|
||||
}
|
||||
b.PutString(e.Email)
|
||||
return nil
|
||||
}
|
||||
|
||||
// Decode implements bin.Decoder.
|
||||
func (e *AccountEmailVerified) Decode(b *bin.Buffer) error {
|
||||
if e == nil {
|
||||
return fmt.Errorf("can't decode account.emailVerified#2b96cd1b to nil")
|
||||
}
|
||||
if err := b.ConsumeID(AccountEmailVerifiedTypeID); err != nil {
|
||||
return fmt.Errorf("unable to decode account.emailVerified#2b96cd1b: %w", err)
|
||||
}
|
||||
return e.DecodeBare(b)
|
||||
}
|
||||
|
||||
// DecodeBare implements bin.BareDecoder.
|
||||
func (e *AccountEmailVerified) DecodeBare(b *bin.Buffer) error {
|
||||
if e == nil {
|
||||
return fmt.Errorf("can't decode account.emailVerified#2b96cd1b to nil")
|
||||
}
|
||||
{
|
||||
value, err := b.String()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode account.emailVerified#2b96cd1b: field email: %w", err)
|
||||
}
|
||||
e.Email = value
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// GetEmail returns value of Email field.
|
||||
func (e *AccountEmailVerified) GetEmail() (value string) {
|
||||
if e == nil {
|
||||
return
|
||||
}
|
||||
return e.Email
|
||||
}
|
||||
|
||||
// AccountEmailVerifiedLogin represents TL type `account.emailVerifiedLogin#e1bb0d61`.
|
||||
// The email was verified correctly, and a login code was just sent to it.
|
||||
//
|
||||
// See https://core.telegram.org/constructor/account.emailVerifiedLogin for reference.
|
||||
type AccountEmailVerifiedLogin struct {
|
||||
// The verified email address.
|
||||
Email string
|
||||
// Info about the sent login code¹
|
||||
//
|
||||
// Links:
|
||||
// 1) https://core.telegram.org/api/auth
|
||||
SentCode AuthSentCodeClass
|
||||
}
|
||||
|
||||
// AccountEmailVerifiedLoginTypeID is TL type id of AccountEmailVerifiedLogin.
|
||||
const AccountEmailVerifiedLoginTypeID = 0xe1bb0d61
|
||||
|
||||
// construct implements constructor of AccountEmailVerifiedClass.
|
||||
func (e AccountEmailVerifiedLogin) construct() AccountEmailVerifiedClass { return &e }
|
||||
|
||||
// Ensuring interfaces in compile-time for AccountEmailVerifiedLogin.
|
||||
var (
|
||||
_ bin.Encoder = &AccountEmailVerifiedLogin{}
|
||||
_ bin.Decoder = &AccountEmailVerifiedLogin{}
|
||||
_ bin.BareEncoder = &AccountEmailVerifiedLogin{}
|
||||
_ bin.BareDecoder = &AccountEmailVerifiedLogin{}
|
||||
|
||||
_ AccountEmailVerifiedClass = &AccountEmailVerifiedLogin{}
|
||||
)
|
||||
|
||||
func (e *AccountEmailVerifiedLogin) Zero() bool {
|
||||
if e == nil {
|
||||
return true
|
||||
}
|
||||
if !(e.Email == "") {
|
||||
return false
|
||||
}
|
||||
if !(e.SentCode == nil) {
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
// String implements fmt.Stringer.
|
||||
func (e *AccountEmailVerifiedLogin) String() string {
|
||||
if e == nil {
|
||||
return "AccountEmailVerifiedLogin(nil)"
|
||||
}
|
||||
type Alias AccountEmailVerifiedLogin
|
||||
return fmt.Sprintf("AccountEmailVerifiedLogin%+v", Alias(*e))
|
||||
}
|
||||
|
||||
// FillFrom fills AccountEmailVerifiedLogin from given interface.
|
||||
func (e *AccountEmailVerifiedLogin) FillFrom(from interface {
|
||||
GetEmail() (value string)
|
||||
GetSentCode() (value AuthSentCodeClass)
|
||||
}) {
|
||||
e.Email = from.GetEmail()
|
||||
e.SentCode = from.GetSentCode()
|
||||
}
|
||||
|
||||
// TypeID returns type id in TL schema.
|
||||
//
|
||||
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
||||
func (*AccountEmailVerifiedLogin) TypeID() uint32 {
|
||||
return AccountEmailVerifiedLoginTypeID
|
||||
}
|
||||
|
||||
// TypeName returns name of type in TL schema.
|
||||
func (*AccountEmailVerifiedLogin) TypeName() string {
|
||||
return "account.emailVerifiedLogin"
|
||||
}
|
||||
|
||||
// TypeInfo returns info about TL type.
|
||||
func (e *AccountEmailVerifiedLogin) TypeInfo() tdp.Type {
|
||||
typ := tdp.Type{
|
||||
Name: "account.emailVerifiedLogin",
|
||||
ID: AccountEmailVerifiedLoginTypeID,
|
||||
}
|
||||
if e == nil {
|
||||
typ.Null = true
|
||||
return typ
|
||||
}
|
||||
typ.Fields = []tdp.Field{
|
||||
{
|
||||
Name: "Email",
|
||||
SchemaName: "email",
|
||||
},
|
||||
{
|
||||
Name: "SentCode",
|
||||
SchemaName: "sent_code",
|
||||
},
|
||||
}
|
||||
return typ
|
||||
}
|
||||
|
||||
// Encode implements bin.Encoder.
|
||||
func (e *AccountEmailVerifiedLogin) Encode(b *bin.Buffer) error {
|
||||
if e == nil {
|
||||
return fmt.Errorf("can't encode account.emailVerifiedLogin#e1bb0d61 as nil")
|
||||
}
|
||||
b.PutID(AccountEmailVerifiedLoginTypeID)
|
||||
return e.EncodeBare(b)
|
||||
}
|
||||
|
||||
// EncodeBare implements bin.BareEncoder.
|
||||
func (e *AccountEmailVerifiedLogin) EncodeBare(b *bin.Buffer) error {
|
||||
if e == nil {
|
||||
return fmt.Errorf("can't encode account.emailVerifiedLogin#e1bb0d61 as nil")
|
||||
}
|
||||
b.PutString(e.Email)
|
||||
if e.SentCode == nil {
|
||||
return fmt.Errorf("unable to encode account.emailVerifiedLogin#e1bb0d61: field sent_code is nil")
|
||||
}
|
||||
if err := e.SentCode.Encode(b); err != nil {
|
||||
return fmt.Errorf("unable to encode account.emailVerifiedLogin#e1bb0d61: field sent_code: %w", err)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Decode implements bin.Decoder.
|
||||
func (e *AccountEmailVerifiedLogin) Decode(b *bin.Buffer) error {
|
||||
if e == nil {
|
||||
return fmt.Errorf("can't decode account.emailVerifiedLogin#e1bb0d61 to nil")
|
||||
}
|
||||
if err := b.ConsumeID(AccountEmailVerifiedLoginTypeID); err != nil {
|
||||
return fmt.Errorf("unable to decode account.emailVerifiedLogin#e1bb0d61: %w", err)
|
||||
}
|
||||
return e.DecodeBare(b)
|
||||
}
|
||||
|
||||
// DecodeBare implements bin.BareDecoder.
|
||||
func (e *AccountEmailVerifiedLogin) DecodeBare(b *bin.Buffer) error {
|
||||
if e == nil {
|
||||
return fmt.Errorf("can't decode account.emailVerifiedLogin#e1bb0d61 to nil")
|
||||
}
|
||||
{
|
||||
value, err := b.String()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode account.emailVerifiedLogin#e1bb0d61: field email: %w", err)
|
||||
}
|
||||
e.Email = value
|
||||
}
|
||||
{
|
||||
value, err := DecodeAuthSentCode(b)
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode account.emailVerifiedLogin#e1bb0d61: field sent_code: %w", err)
|
||||
}
|
||||
e.SentCode = value
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// GetEmail returns value of Email field.
|
||||
func (e *AccountEmailVerifiedLogin) GetEmail() (value string) {
|
||||
if e == nil {
|
||||
return
|
||||
}
|
||||
return e.Email
|
||||
}
|
||||
|
||||
// GetSentCode returns value of SentCode field.
|
||||
func (e *AccountEmailVerifiedLogin) GetSentCode() (value AuthSentCodeClass) {
|
||||
if e == nil {
|
||||
return
|
||||
}
|
||||
return e.SentCode
|
||||
}
|
||||
|
||||
// AccountEmailVerifiedClassName is schema name of AccountEmailVerifiedClass.
|
||||
const AccountEmailVerifiedClassName = "account.EmailVerified"
|
||||
|
||||
// AccountEmailVerifiedClass represents account.EmailVerified generic type.
|
||||
//
|
||||
// See https://core.telegram.org/type/account.EmailVerified for reference.
|
||||
//
|
||||
// Example:
|
||||
//
|
||||
// g, err := tg.DecodeAccountEmailVerified(buf)
|
||||
// if err != nil {
|
||||
// panic(err)
|
||||
// }
|
||||
// switch v := g.(type) {
|
||||
// case *tg.AccountEmailVerified: // account.emailVerified#2b96cd1b
|
||||
// case *tg.AccountEmailVerifiedLogin: // account.emailVerifiedLogin#e1bb0d61
|
||||
// default: panic(v)
|
||||
// }
|
||||
type AccountEmailVerifiedClass interface {
|
||||
bin.Encoder
|
||||
bin.Decoder
|
||||
bin.BareEncoder
|
||||
bin.BareDecoder
|
||||
construct() AccountEmailVerifiedClass
|
||||
|
||||
// TypeID returns type id in TL schema.
|
||||
//
|
||||
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
||||
TypeID() uint32
|
||||
// TypeName returns name of type in TL schema.
|
||||
TypeName() string
|
||||
// String implements fmt.Stringer.
|
||||
String() string
|
||||
// Zero returns true if current object has a zero value.
|
||||
Zero() bool
|
||||
|
||||
// The verified email address.
|
||||
GetEmail() (value string)
|
||||
}
|
||||
|
||||
// DecodeAccountEmailVerified implements binary de-serialization for AccountEmailVerifiedClass.
|
||||
func DecodeAccountEmailVerified(buf *bin.Buffer) (AccountEmailVerifiedClass, error) {
|
||||
id, err := buf.PeekID()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
switch id {
|
||||
case AccountEmailVerifiedTypeID:
|
||||
// Decoding account.emailVerified#2b96cd1b.
|
||||
v := AccountEmailVerified{}
|
||||
if err := v.Decode(buf); err != nil {
|
||||
return nil, fmt.Errorf("unable to decode AccountEmailVerifiedClass: %w", err)
|
||||
}
|
||||
return &v, nil
|
||||
case AccountEmailVerifiedLoginTypeID:
|
||||
// Decoding account.emailVerifiedLogin#e1bb0d61.
|
||||
v := AccountEmailVerifiedLogin{}
|
||||
if err := v.Decode(buf); err != nil {
|
||||
return nil, fmt.Errorf("unable to decode AccountEmailVerifiedClass: %w", err)
|
||||
}
|
||||
return &v, nil
|
||||
default:
|
||||
return nil, fmt.Errorf("unable to decode AccountEmailVerifiedClass: %w", bin.NewUnexpectedID(id))
|
||||
}
|
||||
}
|
||||
|
||||
// AccountEmailVerified boxes the AccountEmailVerifiedClass providing a helper.
|
||||
type AccountEmailVerifiedBox struct {
|
||||
EmailVerified AccountEmailVerifiedClass
|
||||
}
|
||||
|
||||
// Decode implements bin.Decoder for AccountEmailVerifiedBox.
|
||||
func (b *AccountEmailVerifiedBox) Decode(buf *bin.Buffer) error {
|
||||
if b == nil {
|
||||
return fmt.Errorf("unable to decode AccountEmailVerifiedBox to nil")
|
||||
}
|
||||
v, err := DecodeAccountEmailVerified(buf)
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode boxed value: %w", err)
|
||||
}
|
||||
b.EmailVerified = v
|
||||
return nil
|
||||
}
|
||||
|
||||
// Encode implements bin.Encode for AccountEmailVerifiedBox.
|
||||
func (b *AccountEmailVerifiedBox) Encode(buf *bin.Buffer) error {
|
||||
if b == nil || b.EmailVerified == nil {
|
||||
return fmt.Errorf("unable to encode AccountEmailVerifiedClass as nil")
|
||||
}
|
||||
return b.EmailVerified.Encode(buf)
|
||||
}
|
||||
@@ -0,0 +1,307 @@
|
||||
//go:build !no_gotd_slices
|
||||
// +build !no_gotd_slices
|
||||
|
||||
// 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{}
|
||||
)
|
||||
|
||||
// AccountEmailVerifiedClassArray is adapter for slice of AccountEmailVerifiedClass.
|
||||
type AccountEmailVerifiedClassArray []AccountEmailVerifiedClass
|
||||
|
||||
// Sort sorts slice of AccountEmailVerifiedClass.
|
||||
func (s AccountEmailVerifiedClassArray) Sort(less func(a, b AccountEmailVerifiedClass) bool) AccountEmailVerifiedClassArray {
|
||||
sort.Slice(s, func(i, j int) bool {
|
||||
return less(s[i], s[j])
|
||||
})
|
||||
return s
|
||||
}
|
||||
|
||||
// SortStable sorts slice of AccountEmailVerifiedClass.
|
||||
func (s AccountEmailVerifiedClassArray) SortStable(less func(a, b AccountEmailVerifiedClass) bool) AccountEmailVerifiedClassArray {
|
||||
sort.SliceStable(s, func(i, j int) bool {
|
||||
return less(s[i], s[j])
|
||||
})
|
||||
return s
|
||||
}
|
||||
|
||||
// Retain filters in-place slice of AccountEmailVerifiedClass.
|
||||
func (s AccountEmailVerifiedClassArray) Retain(keep func(x AccountEmailVerifiedClass) bool) AccountEmailVerifiedClassArray {
|
||||
n := 0
|
||||
for _, x := range s {
|
||||
if keep(x) {
|
||||
s[n] = x
|
||||
n++
|
||||
}
|
||||
}
|
||||
s = s[:n]
|
||||
|
||||
return s
|
||||
}
|
||||
|
||||
// First returns first element of slice (if exists).
|
||||
func (s AccountEmailVerifiedClassArray) First() (v AccountEmailVerifiedClass, ok bool) {
|
||||
if len(s) < 1 {
|
||||
return
|
||||
}
|
||||
return s[0], true
|
||||
}
|
||||
|
||||
// Last returns last element of slice (if exists).
|
||||
func (s AccountEmailVerifiedClassArray) Last() (v AccountEmailVerifiedClass, ok bool) {
|
||||
if len(s) < 1 {
|
||||
return
|
||||
}
|
||||
return s[len(s)-1], true
|
||||
}
|
||||
|
||||
// PopFirst returns first element of slice (if exists) and deletes it.
|
||||
func (s *AccountEmailVerifiedClassArray) PopFirst() (v AccountEmailVerifiedClass, ok bool) {
|
||||
if s == nil || len(*s) < 1 {
|
||||
return
|
||||
}
|
||||
|
||||
a := *s
|
||||
v = a[0]
|
||||
|
||||
// Delete by index from SliceTricks.
|
||||
copy(a[0:], a[1:])
|
||||
var zero AccountEmailVerifiedClass
|
||||
a[len(a)-1] = zero
|
||||
a = a[:len(a)-1]
|
||||
*s = a
|
||||
|
||||
return v, true
|
||||
}
|
||||
|
||||
// Pop returns last element of slice (if exists) and deletes it.
|
||||
func (s *AccountEmailVerifiedClassArray) Pop() (v AccountEmailVerifiedClass, ok bool) {
|
||||
if s == nil || len(*s) < 1 {
|
||||
return
|
||||
}
|
||||
|
||||
a := *s
|
||||
v = a[len(a)-1]
|
||||
a = a[:len(a)-1]
|
||||
*s = a
|
||||
|
||||
return v, true
|
||||
}
|
||||
|
||||
// AsAccountEmailVerified returns copy with only AccountEmailVerified constructors.
|
||||
func (s AccountEmailVerifiedClassArray) AsAccountEmailVerified() (to AccountEmailVerifiedArray) {
|
||||
for _, elem := range s {
|
||||
value, ok := elem.(*AccountEmailVerified)
|
||||
if !ok {
|
||||
continue
|
||||
}
|
||||
to = append(to, *value)
|
||||
}
|
||||
|
||||
return to
|
||||
}
|
||||
|
||||
// AsAccountEmailVerifiedLogin returns copy with only AccountEmailVerifiedLogin constructors.
|
||||
func (s AccountEmailVerifiedClassArray) AsAccountEmailVerifiedLogin() (to AccountEmailVerifiedLoginArray) {
|
||||
for _, elem := range s {
|
||||
value, ok := elem.(*AccountEmailVerifiedLogin)
|
||||
if !ok {
|
||||
continue
|
||||
}
|
||||
to = append(to, *value)
|
||||
}
|
||||
|
||||
return to
|
||||
}
|
||||
|
||||
// AccountEmailVerifiedArray is adapter for slice of AccountEmailVerified.
|
||||
type AccountEmailVerifiedArray []AccountEmailVerified
|
||||
|
||||
// Sort sorts slice of AccountEmailVerified.
|
||||
func (s AccountEmailVerifiedArray) Sort(less func(a, b AccountEmailVerified) bool) AccountEmailVerifiedArray {
|
||||
sort.Slice(s, func(i, j int) bool {
|
||||
return less(s[i], s[j])
|
||||
})
|
||||
return s
|
||||
}
|
||||
|
||||
// SortStable sorts slice of AccountEmailVerified.
|
||||
func (s AccountEmailVerifiedArray) SortStable(less func(a, b AccountEmailVerified) bool) AccountEmailVerifiedArray {
|
||||
sort.SliceStable(s, func(i, j int) bool {
|
||||
return less(s[i], s[j])
|
||||
})
|
||||
return s
|
||||
}
|
||||
|
||||
// Retain filters in-place slice of AccountEmailVerified.
|
||||
func (s AccountEmailVerifiedArray) Retain(keep func(x AccountEmailVerified) bool) AccountEmailVerifiedArray {
|
||||
n := 0
|
||||
for _, x := range s {
|
||||
if keep(x) {
|
||||
s[n] = x
|
||||
n++
|
||||
}
|
||||
}
|
||||
s = s[:n]
|
||||
|
||||
return s
|
||||
}
|
||||
|
||||
// First returns first element of slice (if exists).
|
||||
func (s AccountEmailVerifiedArray) First() (v AccountEmailVerified, ok bool) {
|
||||
if len(s) < 1 {
|
||||
return
|
||||
}
|
||||
return s[0], true
|
||||
}
|
||||
|
||||
// Last returns last element of slice (if exists).
|
||||
func (s AccountEmailVerifiedArray) Last() (v AccountEmailVerified, ok bool) {
|
||||
if len(s) < 1 {
|
||||
return
|
||||
}
|
||||
return s[len(s)-1], true
|
||||
}
|
||||
|
||||
// PopFirst returns first element of slice (if exists) and deletes it.
|
||||
func (s *AccountEmailVerifiedArray) PopFirst() (v AccountEmailVerified, ok bool) {
|
||||
if s == nil || len(*s) < 1 {
|
||||
return
|
||||
}
|
||||
|
||||
a := *s
|
||||
v = a[0]
|
||||
|
||||
// Delete by index from SliceTricks.
|
||||
copy(a[0:], a[1:])
|
||||
var zero AccountEmailVerified
|
||||
a[len(a)-1] = zero
|
||||
a = a[:len(a)-1]
|
||||
*s = a
|
||||
|
||||
return v, true
|
||||
}
|
||||
|
||||
// Pop returns last element of slice (if exists) and deletes it.
|
||||
func (s *AccountEmailVerifiedArray) Pop() (v AccountEmailVerified, ok bool) {
|
||||
if s == nil || len(*s) < 1 {
|
||||
return
|
||||
}
|
||||
|
||||
a := *s
|
||||
v = a[len(a)-1]
|
||||
a = a[:len(a)-1]
|
||||
*s = a
|
||||
|
||||
return v, true
|
||||
}
|
||||
|
||||
// AccountEmailVerifiedLoginArray is adapter for slice of AccountEmailVerifiedLogin.
|
||||
type AccountEmailVerifiedLoginArray []AccountEmailVerifiedLogin
|
||||
|
||||
// Sort sorts slice of AccountEmailVerifiedLogin.
|
||||
func (s AccountEmailVerifiedLoginArray) Sort(less func(a, b AccountEmailVerifiedLogin) bool) AccountEmailVerifiedLoginArray {
|
||||
sort.Slice(s, func(i, j int) bool {
|
||||
return less(s[i], s[j])
|
||||
})
|
||||
return s
|
||||
}
|
||||
|
||||
// SortStable sorts slice of AccountEmailVerifiedLogin.
|
||||
func (s AccountEmailVerifiedLoginArray) SortStable(less func(a, b AccountEmailVerifiedLogin) bool) AccountEmailVerifiedLoginArray {
|
||||
sort.SliceStable(s, func(i, j int) bool {
|
||||
return less(s[i], s[j])
|
||||
})
|
||||
return s
|
||||
}
|
||||
|
||||
// Retain filters in-place slice of AccountEmailVerifiedLogin.
|
||||
func (s AccountEmailVerifiedLoginArray) Retain(keep func(x AccountEmailVerifiedLogin) bool) AccountEmailVerifiedLoginArray {
|
||||
n := 0
|
||||
for _, x := range s {
|
||||
if keep(x) {
|
||||
s[n] = x
|
||||
n++
|
||||
}
|
||||
}
|
||||
s = s[:n]
|
||||
|
||||
return s
|
||||
}
|
||||
|
||||
// First returns first element of slice (if exists).
|
||||
func (s AccountEmailVerifiedLoginArray) First() (v AccountEmailVerifiedLogin, ok bool) {
|
||||
if len(s) < 1 {
|
||||
return
|
||||
}
|
||||
return s[0], true
|
||||
}
|
||||
|
||||
// Last returns last element of slice (if exists).
|
||||
func (s AccountEmailVerifiedLoginArray) Last() (v AccountEmailVerifiedLogin, ok bool) {
|
||||
if len(s) < 1 {
|
||||
return
|
||||
}
|
||||
return s[len(s)-1], true
|
||||
}
|
||||
|
||||
// PopFirst returns first element of slice (if exists) and deletes it.
|
||||
func (s *AccountEmailVerifiedLoginArray) PopFirst() (v AccountEmailVerifiedLogin, ok bool) {
|
||||
if s == nil || len(*s) < 1 {
|
||||
return
|
||||
}
|
||||
|
||||
a := *s
|
||||
v = a[0]
|
||||
|
||||
// Delete by index from SliceTricks.
|
||||
copy(a[0:], a[1:])
|
||||
var zero AccountEmailVerifiedLogin
|
||||
a[len(a)-1] = zero
|
||||
a = a[:len(a)-1]
|
||||
*s = a
|
||||
|
||||
return v, true
|
||||
}
|
||||
|
||||
// Pop returns last element of slice (if exists) and deletes it.
|
||||
func (s *AccountEmailVerifiedLoginArray) Pop() (v AccountEmailVerifiedLogin, ok bool) {
|
||||
if s == nil || len(*s) < 1 {
|
||||
return
|
||||
}
|
||||
|
||||
a := *s
|
||||
v = a[len(a)-1]
|
||||
a = a[:len(a)-1]
|
||||
*s = a
|
||||
|
||||
return v, true
|
||||
}
|
||||
@@ -0,0 +1,433 @@
|
||||
// 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{}
|
||||
)
|
||||
|
||||
// AccountEmojiStatusesNotModified represents TL type `account.emojiStatusesNotModified#d08ce645`.
|
||||
// The server-side list of emoji statuses¹ hasn't changed
|
||||
//
|
||||
// Links:
|
||||
// 1. https://core.telegram.org/api/emoji-status
|
||||
//
|
||||
// See https://core.telegram.org/constructor/account.emojiStatusesNotModified for reference.
|
||||
type AccountEmojiStatusesNotModified struct {
|
||||
}
|
||||
|
||||
// AccountEmojiStatusesNotModifiedTypeID is TL type id of AccountEmojiStatusesNotModified.
|
||||
const AccountEmojiStatusesNotModifiedTypeID = 0xd08ce645
|
||||
|
||||
// construct implements constructor of AccountEmojiStatusesClass.
|
||||
func (e AccountEmojiStatusesNotModified) construct() AccountEmojiStatusesClass { return &e }
|
||||
|
||||
// Ensuring interfaces in compile-time for AccountEmojiStatusesNotModified.
|
||||
var (
|
||||
_ bin.Encoder = &AccountEmojiStatusesNotModified{}
|
||||
_ bin.Decoder = &AccountEmojiStatusesNotModified{}
|
||||
_ bin.BareEncoder = &AccountEmojiStatusesNotModified{}
|
||||
_ bin.BareDecoder = &AccountEmojiStatusesNotModified{}
|
||||
|
||||
_ AccountEmojiStatusesClass = &AccountEmojiStatusesNotModified{}
|
||||
)
|
||||
|
||||
func (e *AccountEmojiStatusesNotModified) Zero() bool {
|
||||
if e == nil {
|
||||
return true
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
// String implements fmt.Stringer.
|
||||
func (e *AccountEmojiStatusesNotModified) String() string {
|
||||
if e == nil {
|
||||
return "AccountEmojiStatusesNotModified(nil)"
|
||||
}
|
||||
type Alias AccountEmojiStatusesNotModified
|
||||
return fmt.Sprintf("AccountEmojiStatusesNotModified%+v", Alias(*e))
|
||||
}
|
||||
|
||||
// TypeID returns type id in TL schema.
|
||||
//
|
||||
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
||||
func (*AccountEmojiStatusesNotModified) TypeID() uint32 {
|
||||
return AccountEmojiStatusesNotModifiedTypeID
|
||||
}
|
||||
|
||||
// TypeName returns name of type in TL schema.
|
||||
func (*AccountEmojiStatusesNotModified) TypeName() string {
|
||||
return "account.emojiStatusesNotModified"
|
||||
}
|
||||
|
||||
// TypeInfo returns info about TL type.
|
||||
func (e *AccountEmojiStatusesNotModified) TypeInfo() tdp.Type {
|
||||
typ := tdp.Type{
|
||||
Name: "account.emojiStatusesNotModified",
|
||||
ID: AccountEmojiStatusesNotModifiedTypeID,
|
||||
}
|
||||
if e == nil {
|
||||
typ.Null = true
|
||||
return typ
|
||||
}
|
||||
typ.Fields = []tdp.Field{}
|
||||
return typ
|
||||
}
|
||||
|
||||
// Encode implements bin.Encoder.
|
||||
func (e *AccountEmojiStatusesNotModified) Encode(b *bin.Buffer) error {
|
||||
if e == nil {
|
||||
return fmt.Errorf("can't encode account.emojiStatusesNotModified#d08ce645 as nil")
|
||||
}
|
||||
b.PutID(AccountEmojiStatusesNotModifiedTypeID)
|
||||
return e.EncodeBare(b)
|
||||
}
|
||||
|
||||
// EncodeBare implements bin.BareEncoder.
|
||||
func (e *AccountEmojiStatusesNotModified) EncodeBare(b *bin.Buffer) error {
|
||||
if e == nil {
|
||||
return fmt.Errorf("can't encode account.emojiStatusesNotModified#d08ce645 as nil")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Decode implements bin.Decoder.
|
||||
func (e *AccountEmojiStatusesNotModified) Decode(b *bin.Buffer) error {
|
||||
if e == nil {
|
||||
return fmt.Errorf("can't decode account.emojiStatusesNotModified#d08ce645 to nil")
|
||||
}
|
||||
if err := b.ConsumeID(AccountEmojiStatusesNotModifiedTypeID); err != nil {
|
||||
return fmt.Errorf("unable to decode account.emojiStatusesNotModified#d08ce645: %w", err)
|
||||
}
|
||||
return e.DecodeBare(b)
|
||||
}
|
||||
|
||||
// DecodeBare implements bin.BareDecoder.
|
||||
func (e *AccountEmojiStatusesNotModified) DecodeBare(b *bin.Buffer) error {
|
||||
if e == nil {
|
||||
return fmt.Errorf("can't decode account.emojiStatusesNotModified#d08ce645 to nil")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// AccountEmojiStatuses represents TL type `account.emojiStatuses#90c467d1`.
|
||||
// A list of emoji statuses¹
|
||||
//
|
||||
// Links:
|
||||
// 1. https://core.telegram.org/api/emoji-status
|
||||
//
|
||||
// See https://core.telegram.org/constructor/account.emojiStatuses for reference.
|
||||
type AccountEmojiStatuses struct {
|
||||
// Hash used for caching, for more info click here¹
|
||||
//
|
||||
// Links:
|
||||
// 1) https://core.telegram.org/api/offsets#hash-generation
|
||||
Hash int64
|
||||
// Emoji statuses¹
|
||||
//
|
||||
// Links:
|
||||
// 1) https://core.telegram.org/api/emoji-status
|
||||
Statuses []EmojiStatusClass
|
||||
}
|
||||
|
||||
// AccountEmojiStatusesTypeID is TL type id of AccountEmojiStatuses.
|
||||
const AccountEmojiStatusesTypeID = 0x90c467d1
|
||||
|
||||
// construct implements constructor of AccountEmojiStatusesClass.
|
||||
func (e AccountEmojiStatuses) construct() AccountEmojiStatusesClass { return &e }
|
||||
|
||||
// Ensuring interfaces in compile-time for AccountEmojiStatuses.
|
||||
var (
|
||||
_ bin.Encoder = &AccountEmojiStatuses{}
|
||||
_ bin.Decoder = &AccountEmojiStatuses{}
|
||||
_ bin.BareEncoder = &AccountEmojiStatuses{}
|
||||
_ bin.BareDecoder = &AccountEmojiStatuses{}
|
||||
|
||||
_ AccountEmojiStatusesClass = &AccountEmojiStatuses{}
|
||||
)
|
||||
|
||||
func (e *AccountEmojiStatuses) Zero() bool {
|
||||
if e == nil {
|
||||
return true
|
||||
}
|
||||
if !(e.Hash == 0) {
|
||||
return false
|
||||
}
|
||||
if !(e.Statuses == nil) {
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
// String implements fmt.Stringer.
|
||||
func (e *AccountEmojiStatuses) String() string {
|
||||
if e == nil {
|
||||
return "AccountEmojiStatuses(nil)"
|
||||
}
|
||||
type Alias AccountEmojiStatuses
|
||||
return fmt.Sprintf("AccountEmojiStatuses%+v", Alias(*e))
|
||||
}
|
||||
|
||||
// FillFrom fills AccountEmojiStatuses from given interface.
|
||||
func (e *AccountEmojiStatuses) FillFrom(from interface {
|
||||
GetHash() (value int64)
|
||||
GetStatuses() (value []EmojiStatusClass)
|
||||
}) {
|
||||
e.Hash = from.GetHash()
|
||||
e.Statuses = from.GetStatuses()
|
||||
}
|
||||
|
||||
// TypeID returns type id in TL schema.
|
||||
//
|
||||
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
||||
func (*AccountEmojiStatuses) TypeID() uint32 {
|
||||
return AccountEmojiStatusesTypeID
|
||||
}
|
||||
|
||||
// TypeName returns name of type in TL schema.
|
||||
func (*AccountEmojiStatuses) TypeName() string {
|
||||
return "account.emojiStatuses"
|
||||
}
|
||||
|
||||
// TypeInfo returns info about TL type.
|
||||
func (e *AccountEmojiStatuses) TypeInfo() tdp.Type {
|
||||
typ := tdp.Type{
|
||||
Name: "account.emojiStatuses",
|
||||
ID: AccountEmojiStatusesTypeID,
|
||||
}
|
||||
if e == nil {
|
||||
typ.Null = true
|
||||
return typ
|
||||
}
|
||||
typ.Fields = []tdp.Field{
|
||||
{
|
||||
Name: "Hash",
|
||||
SchemaName: "hash",
|
||||
},
|
||||
{
|
||||
Name: "Statuses",
|
||||
SchemaName: "statuses",
|
||||
},
|
||||
}
|
||||
return typ
|
||||
}
|
||||
|
||||
// Encode implements bin.Encoder.
|
||||
func (e *AccountEmojiStatuses) Encode(b *bin.Buffer) error {
|
||||
if e == nil {
|
||||
return fmt.Errorf("can't encode account.emojiStatuses#90c467d1 as nil")
|
||||
}
|
||||
b.PutID(AccountEmojiStatusesTypeID)
|
||||
return e.EncodeBare(b)
|
||||
}
|
||||
|
||||
// EncodeBare implements bin.BareEncoder.
|
||||
func (e *AccountEmojiStatuses) EncodeBare(b *bin.Buffer) error {
|
||||
if e == nil {
|
||||
return fmt.Errorf("can't encode account.emojiStatuses#90c467d1 as nil")
|
||||
}
|
||||
b.PutLong(e.Hash)
|
||||
b.PutVectorHeader(len(e.Statuses))
|
||||
for idx, v := range e.Statuses {
|
||||
if v == nil {
|
||||
return fmt.Errorf("unable to encode account.emojiStatuses#90c467d1: field statuses element with index %d is nil", idx)
|
||||
}
|
||||
if err := v.Encode(b); err != nil {
|
||||
return fmt.Errorf("unable to encode account.emojiStatuses#90c467d1: field statuses element with index %d: %w", idx, err)
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Decode implements bin.Decoder.
|
||||
func (e *AccountEmojiStatuses) Decode(b *bin.Buffer) error {
|
||||
if e == nil {
|
||||
return fmt.Errorf("can't decode account.emojiStatuses#90c467d1 to nil")
|
||||
}
|
||||
if err := b.ConsumeID(AccountEmojiStatusesTypeID); err != nil {
|
||||
return fmt.Errorf("unable to decode account.emojiStatuses#90c467d1: %w", err)
|
||||
}
|
||||
return e.DecodeBare(b)
|
||||
}
|
||||
|
||||
// DecodeBare implements bin.BareDecoder.
|
||||
func (e *AccountEmojiStatuses) DecodeBare(b *bin.Buffer) error {
|
||||
if e == nil {
|
||||
return fmt.Errorf("can't decode account.emojiStatuses#90c467d1 to nil")
|
||||
}
|
||||
{
|
||||
value, err := b.Long()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode account.emojiStatuses#90c467d1: field hash: %w", err)
|
||||
}
|
||||
e.Hash = value
|
||||
}
|
||||
{
|
||||
headerLen, err := b.VectorHeader()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode account.emojiStatuses#90c467d1: field statuses: %w", err)
|
||||
}
|
||||
|
||||
if headerLen > 0 {
|
||||
e.Statuses = make([]EmojiStatusClass, 0, headerLen%bin.PreallocateLimit)
|
||||
}
|
||||
for idx := 0; idx < headerLen; idx++ {
|
||||
value, err := DecodeEmojiStatus(b)
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode account.emojiStatuses#90c467d1: field statuses: %w", err)
|
||||
}
|
||||
e.Statuses = append(e.Statuses, value)
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// GetHash returns value of Hash field.
|
||||
func (e *AccountEmojiStatuses) GetHash() (value int64) {
|
||||
if e == nil {
|
||||
return
|
||||
}
|
||||
return e.Hash
|
||||
}
|
||||
|
||||
// GetStatuses returns value of Statuses field.
|
||||
func (e *AccountEmojiStatuses) GetStatuses() (value []EmojiStatusClass) {
|
||||
if e == nil {
|
||||
return
|
||||
}
|
||||
return e.Statuses
|
||||
}
|
||||
|
||||
// MapStatuses returns field Statuses wrapped in EmojiStatusClassArray helper.
|
||||
func (e *AccountEmojiStatuses) MapStatuses() (value EmojiStatusClassArray) {
|
||||
return EmojiStatusClassArray(e.Statuses)
|
||||
}
|
||||
|
||||
// AccountEmojiStatusesClassName is schema name of AccountEmojiStatusesClass.
|
||||
const AccountEmojiStatusesClassName = "account.EmojiStatuses"
|
||||
|
||||
// AccountEmojiStatusesClass represents account.EmojiStatuses generic type.
|
||||
//
|
||||
// See https://core.telegram.org/type/account.EmojiStatuses for reference.
|
||||
//
|
||||
// Example:
|
||||
//
|
||||
// g, err := tg.DecodeAccountEmojiStatuses(buf)
|
||||
// if err != nil {
|
||||
// panic(err)
|
||||
// }
|
||||
// switch v := g.(type) {
|
||||
// case *tg.AccountEmojiStatusesNotModified: // account.emojiStatusesNotModified#d08ce645
|
||||
// case *tg.AccountEmojiStatuses: // account.emojiStatuses#90c467d1
|
||||
// default: panic(v)
|
||||
// }
|
||||
type AccountEmojiStatusesClass interface {
|
||||
bin.Encoder
|
||||
bin.Decoder
|
||||
bin.BareEncoder
|
||||
bin.BareDecoder
|
||||
construct() AccountEmojiStatusesClass
|
||||
|
||||
// TypeID returns type id in TL schema.
|
||||
//
|
||||
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
||||
TypeID() uint32
|
||||
// TypeName returns name of type in TL schema.
|
||||
TypeName() string
|
||||
// String implements fmt.Stringer.
|
||||
String() string
|
||||
// Zero returns true if current object has a zero value.
|
||||
Zero() bool
|
||||
|
||||
// AsModified tries to map AccountEmojiStatusesClass to AccountEmojiStatuses.
|
||||
AsModified() (*AccountEmojiStatuses, bool)
|
||||
}
|
||||
|
||||
// AsModified tries to map AccountEmojiStatusesNotModified to AccountEmojiStatuses.
|
||||
func (e *AccountEmojiStatusesNotModified) AsModified() (*AccountEmojiStatuses, bool) {
|
||||
return nil, false
|
||||
}
|
||||
|
||||
// AsModified tries to map AccountEmojiStatuses to AccountEmojiStatuses.
|
||||
func (e *AccountEmojiStatuses) AsModified() (*AccountEmojiStatuses, bool) {
|
||||
return e, true
|
||||
}
|
||||
|
||||
// DecodeAccountEmojiStatuses implements binary de-serialization for AccountEmojiStatusesClass.
|
||||
func DecodeAccountEmojiStatuses(buf *bin.Buffer) (AccountEmojiStatusesClass, error) {
|
||||
id, err := buf.PeekID()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
switch id {
|
||||
case AccountEmojiStatusesNotModifiedTypeID:
|
||||
// Decoding account.emojiStatusesNotModified#d08ce645.
|
||||
v := AccountEmojiStatusesNotModified{}
|
||||
if err := v.Decode(buf); err != nil {
|
||||
return nil, fmt.Errorf("unable to decode AccountEmojiStatusesClass: %w", err)
|
||||
}
|
||||
return &v, nil
|
||||
case AccountEmojiStatusesTypeID:
|
||||
// Decoding account.emojiStatuses#90c467d1.
|
||||
v := AccountEmojiStatuses{}
|
||||
if err := v.Decode(buf); err != nil {
|
||||
return nil, fmt.Errorf("unable to decode AccountEmojiStatusesClass: %w", err)
|
||||
}
|
||||
return &v, nil
|
||||
default:
|
||||
return nil, fmt.Errorf("unable to decode AccountEmojiStatusesClass: %w", bin.NewUnexpectedID(id))
|
||||
}
|
||||
}
|
||||
|
||||
// AccountEmojiStatuses boxes the AccountEmojiStatusesClass providing a helper.
|
||||
type AccountEmojiStatusesBox struct {
|
||||
EmojiStatuses AccountEmojiStatusesClass
|
||||
}
|
||||
|
||||
// Decode implements bin.Decoder for AccountEmojiStatusesBox.
|
||||
func (b *AccountEmojiStatusesBox) Decode(buf *bin.Buffer) error {
|
||||
if b == nil {
|
||||
return fmt.Errorf("unable to decode AccountEmojiStatusesBox to nil")
|
||||
}
|
||||
v, err := DecodeAccountEmojiStatuses(buf)
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode boxed value: %w", err)
|
||||
}
|
||||
b.EmojiStatuses = v
|
||||
return nil
|
||||
}
|
||||
|
||||
// Encode implements bin.Encode for AccountEmojiStatusesBox.
|
||||
func (b *AccountEmojiStatusesBox) Encode(buf *bin.Buffer) error {
|
||||
if b == nil || b.EmojiStatuses == nil {
|
||||
return fmt.Errorf("unable to encode AccountEmojiStatusesClass as nil")
|
||||
}
|
||||
return b.EmojiStatuses.Encode(buf)
|
||||
}
|
||||
@@ -0,0 +1,267 @@
|
||||
//go:build !no_gotd_slices
|
||||
// +build !no_gotd_slices
|
||||
|
||||
// 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{}
|
||||
)
|
||||
|
||||
// AccountEmojiStatusesClassArray is adapter for slice of AccountEmojiStatusesClass.
|
||||
type AccountEmojiStatusesClassArray []AccountEmojiStatusesClass
|
||||
|
||||
// Sort sorts slice of AccountEmojiStatusesClass.
|
||||
func (s AccountEmojiStatusesClassArray) Sort(less func(a, b AccountEmojiStatusesClass) bool) AccountEmojiStatusesClassArray {
|
||||
sort.Slice(s, func(i, j int) bool {
|
||||
return less(s[i], s[j])
|
||||
})
|
||||
return s
|
||||
}
|
||||
|
||||
// SortStable sorts slice of AccountEmojiStatusesClass.
|
||||
func (s AccountEmojiStatusesClassArray) SortStable(less func(a, b AccountEmojiStatusesClass) bool) AccountEmojiStatusesClassArray {
|
||||
sort.SliceStable(s, func(i, j int) bool {
|
||||
return less(s[i], s[j])
|
||||
})
|
||||
return s
|
||||
}
|
||||
|
||||
// Retain filters in-place slice of AccountEmojiStatusesClass.
|
||||
func (s AccountEmojiStatusesClassArray) Retain(keep func(x AccountEmojiStatusesClass) bool) AccountEmojiStatusesClassArray {
|
||||
n := 0
|
||||
for _, x := range s {
|
||||
if keep(x) {
|
||||
s[n] = x
|
||||
n++
|
||||
}
|
||||
}
|
||||
s = s[:n]
|
||||
|
||||
return s
|
||||
}
|
||||
|
||||
// First returns first element of slice (if exists).
|
||||
func (s AccountEmojiStatusesClassArray) First() (v AccountEmojiStatusesClass, ok bool) {
|
||||
if len(s) < 1 {
|
||||
return
|
||||
}
|
||||
return s[0], true
|
||||
}
|
||||
|
||||
// Last returns last element of slice (if exists).
|
||||
func (s AccountEmojiStatusesClassArray) Last() (v AccountEmojiStatusesClass, ok bool) {
|
||||
if len(s) < 1 {
|
||||
return
|
||||
}
|
||||
return s[len(s)-1], true
|
||||
}
|
||||
|
||||
// PopFirst returns first element of slice (if exists) and deletes it.
|
||||
func (s *AccountEmojiStatusesClassArray) PopFirst() (v AccountEmojiStatusesClass, ok bool) {
|
||||
if s == nil || len(*s) < 1 {
|
||||
return
|
||||
}
|
||||
|
||||
a := *s
|
||||
v = a[0]
|
||||
|
||||
// Delete by index from SliceTricks.
|
||||
copy(a[0:], a[1:])
|
||||
var zero AccountEmojiStatusesClass
|
||||
a[len(a)-1] = zero
|
||||
a = a[:len(a)-1]
|
||||
*s = a
|
||||
|
||||
return v, true
|
||||
}
|
||||
|
||||
// Pop returns last element of slice (if exists) and deletes it.
|
||||
func (s *AccountEmojiStatusesClassArray) Pop() (v AccountEmojiStatusesClass, ok bool) {
|
||||
if s == nil || len(*s) < 1 {
|
||||
return
|
||||
}
|
||||
|
||||
a := *s
|
||||
v = a[len(a)-1]
|
||||
a = a[:len(a)-1]
|
||||
*s = a
|
||||
|
||||
return v, true
|
||||
}
|
||||
|
||||
// AsAccountEmojiStatuses returns copy with only AccountEmojiStatuses constructors.
|
||||
func (s AccountEmojiStatusesClassArray) AsAccountEmojiStatuses() (to AccountEmojiStatusesArray) {
|
||||
for _, elem := range s {
|
||||
value, ok := elem.(*AccountEmojiStatuses)
|
||||
if !ok {
|
||||
continue
|
||||
}
|
||||
to = append(to, *value)
|
||||
}
|
||||
|
||||
return to
|
||||
}
|
||||
|
||||
// AppendOnlyModified appends only Modified constructors to
|
||||
// given slice.
|
||||
func (s AccountEmojiStatusesClassArray) AppendOnlyModified(to []*AccountEmojiStatuses) []*AccountEmojiStatuses {
|
||||
for _, elem := range s {
|
||||
value, ok := elem.AsModified()
|
||||
if !ok {
|
||||
continue
|
||||
}
|
||||
to = append(to, value)
|
||||
}
|
||||
|
||||
return to
|
||||
}
|
||||
|
||||
// AsModified returns copy with only Modified constructors.
|
||||
func (s AccountEmojiStatusesClassArray) AsModified() (to []*AccountEmojiStatuses) {
|
||||
return s.AppendOnlyModified(to)
|
||||
}
|
||||
|
||||
// FirstAsModified returns first element of slice (if exists).
|
||||
func (s AccountEmojiStatusesClassArray) FirstAsModified() (v *AccountEmojiStatuses, ok bool) {
|
||||
value, ok := s.First()
|
||||
if !ok {
|
||||
return
|
||||
}
|
||||
return value.AsModified()
|
||||
}
|
||||
|
||||
// LastAsModified returns last element of slice (if exists).
|
||||
func (s AccountEmojiStatusesClassArray) LastAsModified() (v *AccountEmojiStatuses, ok bool) {
|
||||
value, ok := s.Last()
|
||||
if !ok {
|
||||
return
|
||||
}
|
||||
return value.AsModified()
|
||||
}
|
||||
|
||||
// PopFirstAsModified returns element of slice (if exists).
|
||||
func (s *AccountEmojiStatusesClassArray) PopFirstAsModified() (v *AccountEmojiStatuses, ok bool) {
|
||||
value, ok := s.PopFirst()
|
||||
if !ok {
|
||||
return
|
||||
}
|
||||
return value.AsModified()
|
||||
}
|
||||
|
||||
// PopAsModified returns element of slice (if exists).
|
||||
func (s *AccountEmojiStatusesClassArray) PopAsModified() (v *AccountEmojiStatuses, ok bool) {
|
||||
value, ok := s.Pop()
|
||||
if !ok {
|
||||
return
|
||||
}
|
||||
return value.AsModified()
|
||||
}
|
||||
|
||||
// AccountEmojiStatusesArray is adapter for slice of AccountEmojiStatuses.
|
||||
type AccountEmojiStatusesArray []AccountEmojiStatuses
|
||||
|
||||
// Sort sorts slice of AccountEmojiStatuses.
|
||||
func (s AccountEmojiStatusesArray) Sort(less func(a, b AccountEmojiStatuses) bool) AccountEmojiStatusesArray {
|
||||
sort.Slice(s, func(i, j int) bool {
|
||||
return less(s[i], s[j])
|
||||
})
|
||||
return s
|
||||
}
|
||||
|
||||
// SortStable sorts slice of AccountEmojiStatuses.
|
||||
func (s AccountEmojiStatusesArray) SortStable(less func(a, b AccountEmojiStatuses) bool) AccountEmojiStatusesArray {
|
||||
sort.SliceStable(s, func(i, j int) bool {
|
||||
return less(s[i], s[j])
|
||||
})
|
||||
return s
|
||||
}
|
||||
|
||||
// Retain filters in-place slice of AccountEmojiStatuses.
|
||||
func (s AccountEmojiStatusesArray) Retain(keep func(x AccountEmojiStatuses) bool) AccountEmojiStatusesArray {
|
||||
n := 0
|
||||
for _, x := range s {
|
||||
if keep(x) {
|
||||
s[n] = x
|
||||
n++
|
||||
}
|
||||
}
|
||||
s = s[:n]
|
||||
|
||||
return s
|
||||
}
|
||||
|
||||
// First returns first element of slice (if exists).
|
||||
func (s AccountEmojiStatusesArray) First() (v AccountEmojiStatuses, ok bool) {
|
||||
if len(s) < 1 {
|
||||
return
|
||||
}
|
||||
return s[0], true
|
||||
}
|
||||
|
||||
// Last returns last element of slice (if exists).
|
||||
func (s AccountEmojiStatusesArray) Last() (v AccountEmojiStatuses, ok bool) {
|
||||
if len(s) < 1 {
|
||||
return
|
||||
}
|
||||
return s[len(s)-1], true
|
||||
}
|
||||
|
||||
// PopFirst returns first element of slice (if exists) and deletes it.
|
||||
func (s *AccountEmojiStatusesArray) PopFirst() (v AccountEmojiStatuses, ok bool) {
|
||||
if s == nil || len(*s) < 1 {
|
||||
return
|
||||
}
|
||||
|
||||
a := *s
|
||||
v = a[0]
|
||||
|
||||
// Delete by index from SliceTricks.
|
||||
copy(a[0:], a[1:])
|
||||
var zero AccountEmojiStatuses
|
||||
a[len(a)-1] = zero
|
||||
a = a[:len(a)-1]
|
||||
*s = a
|
||||
|
||||
return v, true
|
||||
}
|
||||
|
||||
// Pop returns last element of slice (if exists) and deletes it.
|
||||
func (s *AccountEmojiStatusesArray) Pop() (v AccountEmojiStatuses, ok bool) {
|
||||
if s == nil || len(*s) < 1 {
|
||||
return
|
||||
}
|
||||
|
||||
a := *s
|
||||
v = a[len(a)-1]
|
||||
a = a[:len(a)-1]
|
||||
*s = a
|
||||
|
||||
return v, true
|
||||
}
|
||||
@@ -0,0 +1,215 @@
|
||||
// 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{}
|
||||
)
|
||||
|
||||
// AccountFinishTakeoutSessionRequest represents TL type `account.finishTakeoutSession#1d2652ee`.
|
||||
// Terminate a takeout session, see here » for more info¹.
|
||||
//
|
||||
// Links:
|
||||
// 1. https://core.telegram.org/api/takeout
|
||||
//
|
||||
// See https://core.telegram.org/method/account.finishTakeoutSession for reference.
|
||||
type AccountFinishTakeoutSessionRequest struct {
|
||||
// Flags, see TL conditional fields¹
|
||||
//
|
||||
// Links:
|
||||
// 1) https://core.telegram.org/mtproto/TL-combinators#conditional-fields
|
||||
Flags bin.Fields
|
||||
// Data exported successfully
|
||||
Success bool
|
||||
}
|
||||
|
||||
// AccountFinishTakeoutSessionRequestTypeID is TL type id of AccountFinishTakeoutSessionRequest.
|
||||
const AccountFinishTakeoutSessionRequestTypeID = 0x1d2652ee
|
||||
|
||||
// Ensuring interfaces in compile-time for AccountFinishTakeoutSessionRequest.
|
||||
var (
|
||||
_ bin.Encoder = &AccountFinishTakeoutSessionRequest{}
|
||||
_ bin.Decoder = &AccountFinishTakeoutSessionRequest{}
|
||||
_ bin.BareEncoder = &AccountFinishTakeoutSessionRequest{}
|
||||
_ bin.BareDecoder = &AccountFinishTakeoutSessionRequest{}
|
||||
)
|
||||
|
||||
func (f *AccountFinishTakeoutSessionRequest) Zero() bool {
|
||||
if f == nil {
|
||||
return true
|
||||
}
|
||||
if !(f.Flags.Zero()) {
|
||||
return false
|
||||
}
|
||||
if !(f.Success == false) {
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
// String implements fmt.Stringer.
|
||||
func (f *AccountFinishTakeoutSessionRequest) String() string {
|
||||
if f == nil {
|
||||
return "AccountFinishTakeoutSessionRequest(nil)"
|
||||
}
|
||||
type Alias AccountFinishTakeoutSessionRequest
|
||||
return fmt.Sprintf("AccountFinishTakeoutSessionRequest%+v", Alias(*f))
|
||||
}
|
||||
|
||||
// FillFrom fills AccountFinishTakeoutSessionRequest from given interface.
|
||||
func (f *AccountFinishTakeoutSessionRequest) FillFrom(from interface {
|
||||
GetSuccess() (value bool)
|
||||
}) {
|
||||
f.Success = from.GetSuccess()
|
||||
}
|
||||
|
||||
// TypeID returns type id in TL schema.
|
||||
//
|
||||
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
||||
func (*AccountFinishTakeoutSessionRequest) TypeID() uint32 {
|
||||
return AccountFinishTakeoutSessionRequestTypeID
|
||||
}
|
||||
|
||||
// TypeName returns name of type in TL schema.
|
||||
func (*AccountFinishTakeoutSessionRequest) TypeName() string {
|
||||
return "account.finishTakeoutSession"
|
||||
}
|
||||
|
||||
// TypeInfo returns info about TL type.
|
||||
func (f *AccountFinishTakeoutSessionRequest) TypeInfo() tdp.Type {
|
||||
typ := tdp.Type{
|
||||
Name: "account.finishTakeoutSession",
|
||||
ID: AccountFinishTakeoutSessionRequestTypeID,
|
||||
}
|
||||
if f == nil {
|
||||
typ.Null = true
|
||||
return typ
|
||||
}
|
||||
typ.Fields = []tdp.Field{
|
||||
{
|
||||
Name: "Success",
|
||||
SchemaName: "success",
|
||||
Null: !f.Flags.Has(0),
|
||||
},
|
||||
}
|
||||
return typ
|
||||
}
|
||||
|
||||
// SetFlags sets flags for non-zero fields.
|
||||
func (f *AccountFinishTakeoutSessionRequest) SetFlags() {
|
||||
if !(f.Success == false) {
|
||||
f.Flags.Set(0)
|
||||
}
|
||||
}
|
||||
|
||||
// Encode implements bin.Encoder.
|
||||
func (f *AccountFinishTakeoutSessionRequest) Encode(b *bin.Buffer) error {
|
||||
if f == nil {
|
||||
return fmt.Errorf("can't encode account.finishTakeoutSession#1d2652ee as nil")
|
||||
}
|
||||
b.PutID(AccountFinishTakeoutSessionRequestTypeID)
|
||||
return f.EncodeBare(b)
|
||||
}
|
||||
|
||||
// EncodeBare implements bin.BareEncoder.
|
||||
func (f *AccountFinishTakeoutSessionRequest) EncodeBare(b *bin.Buffer) error {
|
||||
if f == nil {
|
||||
return fmt.Errorf("can't encode account.finishTakeoutSession#1d2652ee as nil")
|
||||
}
|
||||
f.SetFlags()
|
||||
if err := f.Flags.Encode(b); err != nil {
|
||||
return fmt.Errorf("unable to encode account.finishTakeoutSession#1d2652ee: field flags: %w", err)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Decode implements bin.Decoder.
|
||||
func (f *AccountFinishTakeoutSessionRequest) Decode(b *bin.Buffer) error {
|
||||
if f == nil {
|
||||
return fmt.Errorf("can't decode account.finishTakeoutSession#1d2652ee to nil")
|
||||
}
|
||||
if err := b.ConsumeID(AccountFinishTakeoutSessionRequestTypeID); err != nil {
|
||||
return fmt.Errorf("unable to decode account.finishTakeoutSession#1d2652ee: %w", err)
|
||||
}
|
||||
return f.DecodeBare(b)
|
||||
}
|
||||
|
||||
// DecodeBare implements bin.BareDecoder.
|
||||
func (f *AccountFinishTakeoutSessionRequest) DecodeBare(b *bin.Buffer) error {
|
||||
if f == nil {
|
||||
return fmt.Errorf("can't decode account.finishTakeoutSession#1d2652ee to nil")
|
||||
}
|
||||
{
|
||||
if err := f.Flags.Decode(b); err != nil {
|
||||
return fmt.Errorf("unable to decode account.finishTakeoutSession#1d2652ee: field flags: %w", err)
|
||||
}
|
||||
}
|
||||
f.Success = f.Flags.Has(0)
|
||||
return nil
|
||||
}
|
||||
|
||||
// SetSuccess sets value of Success conditional field.
|
||||
func (f *AccountFinishTakeoutSessionRequest) SetSuccess(value bool) {
|
||||
if value {
|
||||
f.Flags.Set(0)
|
||||
f.Success = true
|
||||
} else {
|
||||
f.Flags.Unset(0)
|
||||
f.Success = false
|
||||
}
|
||||
}
|
||||
|
||||
// GetSuccess returns value of Success conditional field.
|
||||
func (f *AccountFinishTakeoutSessionRequest) GetSuccess() (value bool) {
|
||||
if f == nil {
|
||||
return
|
||||
}
|
||||
return f.Flags.Has(0)
|
||||
}
|
||||
|
||||
// AccountFinishTakeoutSession invokes method account.finishTakeoutSession#1d2652ee returning error if any.
|
||||
// Terminate a takeout session, see here » for more info¹.
|
||||
//
|
||||
// Links:
|
||||
// 1. https://core.telegram.org/api/takeout
|
||||
//
|
||||
// Possible errors:
|
||||
//
|
||||
// 403 TAKEOUT_REQUIRED: A takeout session needs to be initialized first, see here » for more info.
|
||||
//
|
||||
// See https://core.telegram.org/method/account.finishTakeoutSession for reference.
|
||||
func (c *Client) AccountFinishTakeoutSession(ctx context.Context, request *AccountFinishTakeoutSessionRequest) (bool, error) {
|
||||
var result BoolBox
|
||||
|
||||
if err := c.rpc.Invoke(ctx, request, &result); err != nil {
|
||||
return false, err
|
||||
}
|
||||
_, ok := result.Bool.(*BoolTrue)
|
||||
return ok, nil
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
//go:build !no_gotd_slices
|
||||
// +build !no_gotd_slices
|
||||
|
||||
// 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{}
|
||||
)
|
||||
@@ -0,0 +1,143 @@
|
||||
// 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{}
|
||||
)
|
||||
|
||||
// AccountGetAccountTTLRequest represents TL type `account.getAccountTTL#8fc711d`.
|
||||
// Get days to live of account
|
||||
//
|
||||
// See https://core.telegram.org/method/account.getAccountTTL for reference.
|
||||
type AccountGetAccountTTLRequest struct {
|
||||
}
|
||||
|
||||
// AccountGetAccountTTLRequestTypeID is TL type id of AccountGetAccountTTLRequest.
|
||||
const AccountGetAccountTTLRequestTypeID = 0x8fc711d
|
||||
|
||||
// Ensuring interfaces in compile-time for AccountGetAccountTTLRequest.
|
||||
var (
|
||||
_ bin.Encoder = &AccountGetAccountTTLRequest{}
|
||||
_ bin.Decoder = &AccountGetAccountTTLRequest{}
|
||||
_ bin.BareEncoder = &AccountGetAccountTTLRequest{}
|
||||
_ bin.BareDecoder = &AccountGetAccountTTLRequest{}
|
||||
)
|
||||
|
||||
func (g *AccountGetAccountTTLRequest) Zero() bool {
|
||||
if g == nil {
|
||||
return true
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
// String implements fmt.Stringer.
|
||||
func (g *AccountGetAccountTTLRequest) String() string {
|
||||
if g == nil {
|
||||
return "AccountGetAccountTTLRequest(nil)"
|
||||
}
|
||||
type Alias AccountGetAccountTTLRequest
|
||||
return fmt.Sprintf("AccountGetAccountTTLRequest%+v", Alias(*g))
|
||||
}
|
||||
|
||||
// TypeID returns type id in TL schema.
|
||||
//
|
||||
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
||||
func (*AccountGetAccountTTLRequest) TypeID() uint32 {
|
||||
return AccountGetAccountTTLRequestTypeID
|
||||
}
|
||||
|
||||
// TypeName returns name of type in TL schema.
|
||||
func (*AccountGetAccountTTLRequest) TypeName() string {
|
||||
return "account.getAccountTTL"
|
||||
}
|
||||
|
||||
// TypeInfo returns info about TL type.
|
||||
func (g *AccountGetAccountTTLRequest) TypeInfo() tdp.Type {
|
||||
typ := tdp.Type{
|
||||
Name: "account.getAccountTTL",
|
||||
ID: AccountGetAccountTTLRequestTypeID,
|
||||
}
|
||||
if g == nil {
|
||||
typ.Null = true
|
||||
return typ
|
||||
}
|
||||
typ.Fields = []tdp.Field{}
|
||||
return typ
|
||||
}
|
||||
|
||||
// Encode implements bin.Encoder.
|
||||
func (g *AccountGetAccountTTLRequest) Encode(b *bin.Buffer) error {
|
||||
if g == nil {
|
||||
return fmt.Errorf("can't encode account.getAccountTTL#8fc711d as nil")
|
||||
}
|
||||
b.PutID(AccountGetAccountTTLRequestTypeID)
|
||||
return g.EncodeBare(b)
|
||||
}
|
||||
|
||||
// EncodeBare implements bin.BareEncoder.
|
||||
func (g *AccountGetAccountTTLRequest) EncodeBare(b *bin.Buffer) error {
|
||||
if g == nil {
|
||||
return fmt.Errorf("can't encode account.getAccountTTL#8fc711d as nil")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Decode implements bin.Decoder.
|
||||
func (g *AccountGetAccountTTLRequest) Decode(b *bin.Buffer) error {
|
||||
if g == nil {
|
||||
return fmt.Errorf("can't decode account.getAccountTTL#8fc711d to nil")
|
||||
}
|
||||
if err := b.ConsumeID(AccountGetAccountTTLRequestTypeID); err != nil {
|
||||
return fmt.Errorf("unable to decode account.getAccountTTL#8fc711d: %w", err)
|
||||
}
|
||||
return g.DecodeBare(b)
|
||||
}
|
||||
|
||||
// DecodeBare implements bin.BareDecoder.
|
||||
func (g *AccountGetAccountTTLRequest) DecodeBare(b *bin.Buffer) error {
|
||||
if g == nil {
|
||||
return fmt.Errorf("can't decode account.getAccountTTL#8fc711d to nil")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// AccountGetAccountTTL invokes method account.getAccountTTL#8fc711d returning error if any.
|
||||
// Get days to live of account
|
||||
//
|
||||
// See https://core.telegram.org/method/account.getAccountTTL for reference.
|
||||
func (c *Client) AccountGetAccountTTL(ctx context.Context) (*AccountDaysTTL, error) {
|
||||
var result AccountDaysTTL
|
||||
|
||||
request := &AccountGetAccountTTLRequest{}
|
||||
if err := c.rpc.Invoke(ctx, request, &result); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &result, nil
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
//go:build !no_gotd_slices
|
||||
// +build !no_gotd_slices
|
||||
|
||||
// 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{}
|
||||
)
|
||||
@@ -0,0 +1,151 @@
|
||||
// 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{}
|
||||
)
|
||||
|
||||
// AccountGetAllSecureValuesRequest represents TL type `account.getAllSecureValues#b288bc7d`.
|
||||
// Get all saved Telegram Passport¹ documents, for more info see the passport docs »²
|
||||
//
|
||||
// Links:
|
||||
// 1. https://core.telegram.org/passport
|
||||
// 2. https://core.telegram.org/passport/encryption#encryption
|
||||
//
|
||||
// See https://core.telegram.org/method/account.getAllSecureValues for reference.
|
||||
type AccountGetAllSecureValuesRequest struct {
|
||||
}
|
||||
|
||||
// AccountGetAllSecureValuesRequestTypeID is TL type id of AccountGetAllSecureValuesRequest.
|
||||
const AccountGetAllSecureValuesRequestTypeID = 0xb288bc7d
|
||||
|
||||
// Ensuring interfaces in compile-time for AccountGetAllSecureValuesRequest.
|
||||
var (
|
||||
_ bin.Encoder = &AccountGetAllSecureValuesRequest{}
|
||||
_ bin.Decoder = &AccountGetAllSecureValuesRequest{}
|
||||
_ bin.BareEncoder = &AccountGetAllSecureValuesRequest{}
|
||||
_ bin.BareDecoder = &AccountGetAllSecureValuesRequest{}
|
||||
)
|
||||
|
||||
func (g *AccountGetAllSecureValuesRequest) Zero() bool {
|
||||
if g == nil {
|
||||
return true
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
// String implements fmt.Stringer.
|
||||
func (g *AccountGetAllSecureValuesRequest) String() string {
|
||||
if g == nil {
|
||||
return "AccountGetAllSecureValuesRequest(nil)"
|
||||
}
|
||||
type Alias AccountGetAllSecureValuesRequest
|
||||
return fmt.Sprintf("AccountGetAllSecureValuesRequest%+v", Alias(*g))
|
||||
}
|
||||
|
||||
// TypeID returns type id in TL schema.
|
||||
//
|
||||
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
||||
func (*AccountGetAllSecureValuesRequest) TypeID() uint32 {
|
||||
return AccountGetAllSecureValuesRequestTypeID
|
||||
}
|
||||
|
||||
// TypeName returns name of type in TL schema.
|
||||
func (*AccountGetAllSecureValuesRequest) TypeName() string {
|
||||
return "account.getAllSecureValues"
|
||||
}
|
||||
|
||||
// TypeInfo returns info about TL type.
|
||||
func (g *AccountGetAllSecureValuesRequest) TypeInfo() tdp.Type {
|
||||
typ := tdp.Type{
|
||||
Name: "account.getAllSecureValues",
|
||||
ID: AccountGetAllSecureValuesRequestTypeID,
|
||||
}
|
||||
if g == nil {
|
||||
typ.Null = true
|
||||
return typ
|
||||
}
|
||||
typ.Fields = []tdp.Field{}
|
||||
return typ
|
||||
}
|
||||
|
||||
// Encode implements bin.Encoder.
|
||||
func (g *AccountGetAllSecureValuesRequest) Encode(b *bin.Buffer) error {
|
||||
if g == nil {
|
||||
return fmt.Errorf("can't encode account.getAllSecureValues#b288bc7d as nil")
|
||||
}
|
||||
b.PutID(AccountGetAllSecureValuesRequestTypeID)
|
||||
return g.EncodeBare(b)
|
||||
}
|
||||
|
||||
// EncodeBare implements bin.BareEncoder.
|
||||
func (g *AccountGetAllSecureValuesRequest) EncodeBare(b *bin.Buffer) error {
|
||||
if g == nil {
|
||||
return fmt.Errorf("can't encode account.getAllSecureValues#b288bc7d as nil")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Decode implements bin.Decoder.
|
||||
func (g *AccountGetAllSecureValuesRequest) Decode(b *bin.Buffer) error {
|
||||
if g == nil {
|
||||
return fmt.Errorf("can't decode account.getAllSecureValues#b288bc7d to nil")
|
||||
}
|
||||
if err := b.ConsumeID(AccountGetAllSecureValuesRequestTypeID); err != nil {
|
||||
return fmt.Errorf("unable to decode account.getAllSecureValues#b288bc7d: %w", err)
|
||||
}
|
||||
return g.DecodeBare(b)
|
||||
}
|
||||
|
||||
// DecodeBare implements bin.BareDecoder.
|
||||
func (g *AccountGetAllSecureValuesRequest) DecodeBare(b *bin.Buffer) error {
|
||||
if g == nil {
|
||||
return fmt.Errorf("can't decode account.getAllSecureValues#b288bc7d to nil")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// AccountGetAllSecureValues invokes method account.getAllSecureValues#b288bc7d returning error if any.
|
||||
// Get all saved Telegram Passport¹ documents, for more info see the passport docs »²
|
||||
//
|
||||
// Links:
|
||||
// 1. https://core.telegram.org/passport
|
||||
// 2. https://core.telegram.org/passport/encryption#encryption
|
||||
//
|
||||
// See https://core.telegram.org/method/account.getAllSecureValues for reference.
|
||||
func (c *Client) AccountGetAllSecureValues(ctx context.Context) ([]SecureValue, error) {
|
||||
var result SecureValueVector
|
||||
|
||||
request := &AccountGetAllSecureValuesRequest{}
|
||||
if err := c.rpc.Invoke(ctx, request, &result); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return []SecureValue(result.Elems), nil
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
//go:build !no_gotd_slices
|
||||
// +build !no_gotd_slices
|
||||
|
||||
// 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{}
|
||||
)
|
||||
@@ -0,0 +1,234 @@
|
||||
// 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{}
|
||||
)
|
||||
|
||||
// AccountGetAuthorizationFormRequest represents TL type `account.getAuthorizationForm#a929597a`.
|
||||
// Returns a Telegram Passport authorization form for sharing data with a service
|
||||
//
|
||||
// See https://core.telegram.org/method/account.getAuthorizationForm for reference.
|
||||
type AccountGetAuthorizationFormRequest struct {
|
||||
// User identifier of the service's bot
|
||||
BotID int64
|
||||
// Telegram Passport element types requested by the service
|
||||
Scope string
|
||||
// Service's public key
|
||||
PublicKey string
|
||||
}
|
||||
|
||||
// AccountGetAuthorizationFormRequestTypeID is TL type id of AccountGetAuthorizationFormRequest.
|
||||
const AccountGetAuthorizationFormRequestTypeID = 0xa929597a
|
||||
|
||||
// Ensuring interfaces in compile-time for AccountGetAuthorizationFormRequest.
|
||||
var (
|
||||
_ bin.Encoder = &AccountGetAuthorizationFormRequest{}
|
||||
_ bin.Decoder = &AccountGetAuthorizationFormRequest{}
|
||||
_ bin.BareEncoder = &AccountGetAuthorizationFormRequest{}
|
||||
_ bin.BareDecoder = &AccountGetAuthorizationFormRequest{}
|
||||
)
|
||||
|
||||
func (g *AccountGetAuthorizationFormRequest) Zero() bool {
|
||||
if g == nil {
|
||||
return true
|
||||
}
|
||||
if !(g.BotID == 0) {
|
||||
return false
|
||||
}
|
||||
if !(g.Scope == "") {
|
||||
return false
|
||||
}
|
||||
if !(g.PublicKey == "") {
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
// String implements fmt.Stringer.
|
||||
func (g *AccountGetAuthorizationFormRequest) String() string {
|
||||
if g == nil {
|
||||
return "AccountGetAuthorizationFormRequest(nil)"
|
||||
}
|
||||
type Alias AccountGetAuthorizationFormRequest
|
||||
return fmt.Sprintf("AccountGetAuthorizationFormRequest%+v", Alias(*g))
|
||||
}
|
||||
|
||||
// FillFrom fills AccountGetAuthorizationFormRequest from given interface.
|
||||
func (g *AccountGetAuthorizationFormRequest) FillFrom(from interface {
|
||||
GetBotID() (value int64)
|
||||
GetScope() (value string)
|
||||
GetPublicKey() (value string)
|
||||
}) {
|
||||
g.BotID = from.GetBotID()
|
||||
g.Scope = from.GetScope()
|
||||
g.PublicKey = from.GetPublicKey()
|
||||
}
|
||||
|
||||
// TypeID returns type id in TL schema.
|
||||
//
|
||||
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
||||
func (*AccountGetAuthorizationFormRequest) TypeID() uint32 {
|
||||
return AccountGetAuthorizationFormRequestTypeID
|
||||
}
|
||||
|
||||
// TypeName returns name of type in TL schema.
|
||||
func (*AccountGetAuthorizationFormRequest) TypeName() string {
|
||||
return "account.getAuthorizationForm"
|
||||
}
|
||||
|
||||
// TypeInfo returns info about TL type.
|
||||
func (g *AccountGetAuthorizationFormRequest) TypeInfo() tdp.Type {
|
||||
typ := tdp.Type{
|
||||
Name: "account.getAuthorizationForm",
|
||||
ID: AccountGetAuthorizationFormRequestTypeID,
|
||||
}
|
||||
if g == nil {
|
||||
typ.Null = true
|
||||
return typ
|
||||
}
|
||||
typ.Fields = []tdp.Field{
|
||||
{
|
||||
Name: "BotID",
|
||||
SchemaName: "bot_id",
|
||||
},
|
||||
{
|
||||
Name: "Scope",
|
||||
SchemaName: "scope",
|
||||
},
|
||||
{
|
||||
Name: "PublicKey",
|
||||
SchemaName: "public_key",
|
||||
},
|
||||
}
|
||||
return typ
|
||||
}
|
||||
|
||||
// Encode implements bin.Encoder.
|
||||
func (g *AccountGetAuthorizationFormRequest) Encode(b *bin.Buffer) error {
|
||||
if g == nil {
|
||||
return fmt.Errorf("can't encode account.getAuthorizationForm#a929597a as nil")
|
||||
}
|
||||
b.PutID(AccountGetAuthorizationFormRequestTypeID)
|
||||
return g.EncodeBare(b)
|
||||
}
|
||||
|
||||
// EncodeBare implements bin.BareEncoder.
|
||||
func (g *AccountGetAuthorizationFormRequest) EncodeBare(b *bin.Buffer) error {
|
||||
if g == nil {
|
||||
return fmt.Errorf("can't encode account.getAuthorizationForm#a929597a as nil")
|
||||
}
|
||||
b.PutLong(g.BotID)
|
||||
b.PutString(g.Scope)
|
||||
b.PutString(g.PublicKey)
|
||||
return nil
|
||||
}
|
||||
|
||||
// Decode implements bin.Decoder.
|
||||
func (g *AccountGetAuthorizationFormRequest) Decode(b *bin.Buffer) error {
|
||||
if g == nil {
|
||||
return fmt.Errorf("can't decode account.getAuthorizationForm#a929597a to nil")
|
||||
}
|
||||
if err := b.ConsumeID(AccountGetAuthorizationFormRequestTypeID); err != nil {
|
||||
return fmt.Errorf("unable to decode account.getAuthorizationForm#a929597a: %w", err)
|
||||
}
|
||||
return g.DecodeBare(b)
|
||||
}
|
||||
|
||||
// DecodeBare implements bin.BareDecoder.
|
||||
func (g *AccountGetAuthorizationFormRequest) DecodeBare(b *bin.Buffer) error {
|
||||
if g == nil {
|
||||
return fmt.Errorf("can't decode account.getAuthorizationForm#a929597a to nil")
|
||||
}
|
||||
{
|
||||
value, err := b.Long()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode account.getAuthorizationForm#a929597a: field bot_id: %w", err)
|
||||
}
|
||||
g.BotID = value
|
||||
}
|
||||
{
|
||||
value, err := b.String()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode account.getAuthorizationForm#a929597a: field scope: %w", err)
|
||||
}
|
||||
g.Scope = value
|
||||
}
|
||||
{
|
||||
value, err := b.String()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode account.getAuthorizationForm#a929597a: field public_key: %w", err)
|
||||
}
|
||||
g.PublicKey = value
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// GetBotID returns value of BotID field.
|
||||
func (g *AccountGetAuthorizationFormRequest) GetBotID() (value int64) {
|
||||
if g == nil {
|
||||
return
|
||||
}
|
||||
return g.BotID
|
||||
}
|
||||
|
||||
// GetScope returns value of Scope field.
|
||||
func (g *AccountGetAuthorizationFormRequest) GetScope() (value string) {
|
||||
if g == nil {
|
||||
return
|
||||
}
|
||||
return g.Scope
|
||||
}
|
||||
|
||||
// GetPublicKey returns value of PublicKey field.
|
||||
func (g *AccountGetAuthorizationFormRequest) GetPublicKey() (value string) {
|
||||
if g == nil {
|
||||
return
|
||||
}
|
||||
return g.PublicKey
|
||||
}
|
||||
|
||||
// AccountGetAuthorizationForm invokes method account.getAuthorizationForm#a929597a returning error if any.
|
||||
// Returns a Telegram Passport authorization form for sharing data with a service
|
||||
//
|
||||
// Possible errors:
|
||||
//
|
||||
// 400 BOT_INVALID: This is not a valid bot.
|
||||
// 400 PUBLIC_KEY_REQUIRED: A public key is required.
|
||||
//
|
||||
// See https://core.telegram.org/method/account.getAuthorizationForm for reference.
|
||||
func (c *Client) AccountGetAuthorizationForm(ctx context.Context, request *AccountGetAuthorizationFormRequest) (*AccountAuthorizationForm, error) {
|
||||
var result AccountAuthorizationForm
|
||||
|
||||
if err := c.rpc.Invoke(ctx, request, &result); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &result, nil
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
//go:build !no_gotd_slices
|
||||
// +build !no_gotd_slices
|
||||
|
||||
// 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{}
|
||||
)
|
||||
@@ -0,0 +1,143 @@
|
||||
// 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{}
|
||||
)
|
||||
|
||||
// AccountGetAuthorizationsRequest represents TL type `account.getAuthorizations#e320c158`.
|
||||
// Get logged-in sessions
|
||||
//
|
||||
// See https://core.telegram.org/method/account.getAuthorizations for reference.
|
||||
type AccountGetAuthorizationsRequest struct {
|
||||
}
|
||||
|
||||
// AccountGetAuthorizationsRequestTypeID is TL type id of AccountGetAuthorizationsRequest.
|
||||
const AccountGetAuthorizationsRequestTypeID = 0xe320c158
|
||||
|
||||
// Ensuring interfaces in compile-time for AccountGetAuthorizationsRequest.
|
||||
var (
|
||||
_ bin.Encoder = &AccountGetAuthorizationsRequest{}
|
||||
_ bin.Decoder = &AccountGetAuthorizationsRequest{}
|
||||
_ bin.BareEncoder = &AccountGetAuthorizationsRequest{}
|
||||
_ bin.BareDecoder = &AccountGetAuthorizationsRequest{}
|
||||
)
|
||||
|
||||
func (g *AccountGetAuthorizationsRequest) Zero() bool {
|
||||
if g == nil {
|
||||
return true
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
// String implements fmt.Stringer.
|
||||
func (g *AccountGetAuthorizationsRequest) String() string {
|
||||
if g == nil {
|
||||
return "AccountGetAuthorizationsRequest(nil)"
|
||||
}
|
||||
type Alias AccountGetAuthorizationsRequest
|
||||
return fmt.Sprintf("AccountGetAuthorizationsRequest%+v", Alias(*g))
|
||||
}
|
||||
|
||||
// TypeID returns type id in TL schema.
|
||||
//
|
||||
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
||||
func (*AccountGetAuthorizationsRequest) TypeID() uint32 {
|
||||
return AccountGetAuthorizationsRequestTypeID
|
||||
}
|
||||
|
||||
// TypeName returns name of type in TL schema.
|
||||
func (*AccountGetAuthorizationsRequest) TypeName() string {
|
||||
return "account.getAuthorizations"
|
||||
}
|
||||
|
||||
// TypeInfo returns info about TL type.
|
||||
func (g *AccountGetAuthorizationsRequest) TypeInfo() tdp.Type {
|
||||
typ := tdp.Type{
|
||||
Name: "account.getAuthorizations",
|
||||
ID: AccountGetAuthorizationsRequestTypeID,
|
||||
}
|
||||
if g == nil {
|
||||
typ.Null = true
|
||||
return typ
|
||||
}
|
||||
typ.Fields = []tdp.Field{}
|
||||
return typ
|
||||
}
|
||||
|
||||
// Encode implements bin.Encoder.
|
||||
func (g *AccountGetAuthorizationsRequest) Encode(b *bin.Buffer) error {
|
||||
if g == nil {
|
||||
return fmt.Errorf("can't encode account.getAuthorizations#e320c158 as nil")
|
||||
}
|
||||
b.PutID(AccountGetAuthorizationsRequestTypeID)
|
||||
return g.EncodeBare(b)
|
||||
}
|
||||
|
||||
// EncodeBare implements bin.BareEncoder.
|
||||
func (g *AccountGetAuthorizationsRequest) EncodeBare(b *bin.Buffer) error {
|
||||
if g == nil {
|
||||
return fmt.Errorf("can't encode account.getAuthorizations#e320c158 as nil")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Decode implements bin.Decoder.
|
||||
func (g *AccountGetAuthorizationsRequest) Decode(b *bin.Buffer) error {
|
||||
if g == nil {
|
||||
return fmt.Errorf("can't decode account.getAuthorizations#e320c158 to nil")
|
||||
}
|
||||
if err := b.ConsumeID(AccountGetAuthorizationsRequestTypeID); err != nil {
|
||||
return fmt.Errorf("unable to decode account.getAuthorizations#e320c158: %w", err)
|
||||
}
|
||||
return g.DecodeBare(b)
|
||||
}
|
||||
|
||||
// DecodeBare implements bin.BareDecoder.
|
||||
func (g *AccountGetAuthorizationsRequest) DecodeBare(b *bin.Buffer) error {
|
||||
if g == nil {
|
||||
return fmt.Errorf("can't decode account.getAuthorizations#e320c158 to nil")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// AccountGetAuthorizations invokes method account.getAuthorizations#e320c158 returning error if any.
|
||||
// Get logged-in sessions
|
||||
//
|
||||
// See https://core.telegram.org/method/account.getAuthorizations for reference.
|
||||
func (c *Client) AccountGetAuthorizations(ctx context.Context) (*AccountAuthorizations, error) {
|
||||
var result AccountAuthorizations
|
||||
|
||||
request := &AccountGetAuthorizationsRequest{}
|
||||
if err := c.rpc.Invoke(ctx, request, &result); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &result, nil
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
//go:build !no_gotd_slices
|
||||
// +build !no_gotd_slices
|
||||
|
||||
// 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{}
|
||||
)
|
||||
@@ -0,0 +1,143 @@
|
||||
// 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{}
|
||||
)
|
||||
|
||||
// AccountGetAutoDownloadSettingsRequest represents TL type `account.getAutoDownloadSettings#56da0b3f`.
|
||||
// Get media autodownload settings
|
||||
//
|
||||
// See https://core.telegram.org/method/account.getAutoDownloadSettings for reference.
|
||||
type AccountGetAutoDownloadSettingsRequest struct {
|
||||
}
|
||||
|
||||
// AccountGetAutoDownloadSettingsRequestTypeID is TL type id of AccountGetAutoDownloadSettingsRequest.
|
||||
const AccountGetAutoDownloadSettingsRequestTypeID = 0x56da0b3f
|
||||
|
||||
// Ensuring interfaces in compile-time for AccountGetAutoDownloadSettingsRequest.
|
||||
var (
|
||||
_ bin.Encoder = &AccountGetAutoDownloadSettingsRequest{}
|
||||
_ bin.Decoder = &AccountGetAutoDownloadSettingsRequest{}
|
||||
_ bin.BareEncoder = &AccountGetAutoDownloadSettingsRequest{}
|
||||
_ bin.BareDecoder = &AccountGetAutoDownloadSettingsRequest{}
|
||||
)
|
||||
|
||||
func (g *AccountGetAutoDownloadSettingsRequest) Zero() bool {
|
||||
if g == nil {
|
||||
return true
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
// String implements fmt.Stringer.
|
||||
func (g *AccountGetAutoDownloadSettingsRequest) String() string {
|
||||
if g == nil {
|
||||
return "AccountGetAutoDownloadSettingsRequest(nil)"
|
||||
}
|
||||
type Alias AccountGetAutoDownloadSettingsRequest
|
||||
return fmt.Sprintf("AccountGetAutoDownloadSettingsRequest%+v", Alias(*g))
|
||||
}
|
||||
|
||||
// TypeID returns type id in TL schema.
|
||||
//
|
||||
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
||||
func (*AccountGetAutoDownloadSettingsRequest) TypeID() uint32 {
|
||||
return AccountGetAutoDownloadSettingsRequestTypeID
|
||||
}
|
||||
|
||||
// TypeName returns name of type in TL schema.
|
||||
func (*AccountGetAutoDownloadSettingsRequest) TypeName() string {
|
||||
return "account.getAutoDownloadSettings"
|
||||
}
|
||||
|
||||
// TypeInfo returns info about TL type.
|
||||
func (g *AccountGetAutoDownloadSettingsRequest) TypeInfo() tdp.Type {
|
||||
typ := tdp.Type{
|
||||
Name: "account.getAutoDownloadSettings",
|
||||
ID: AccountGetAutoDownloadSettingsRequestTypeID,
|
||||
}
|
||||
if g == nil {
|
||||
typ.Null = true
|
||||
return typ
|
||||
}
|
||||
typ.Fields = []tdp.Field{}
|
||||
return typ
|
||||
}
|
||||
|
||||
// Encode implements bin.Encoder.
|
||||
func (g *AccountGetAutoDownloadSettingsRequest) Encode(b *bin.Buffer) error {
|
||||
if g == nil {
|
||||
return fmt.Errorf("can't encode account.getAutoDownloadSettings#56da0b3f as nil")
|
||||
}
|
||||
b.PutID(AccountGetAutoDownloadSettingsRequestTypeID)
|
||||
return g.EncodeBare(b)
|
||||
}
|
||||
|
||||
// EncodeBare implements bin.BareEncoder.
|
||||
func (g *AccountGetAutoDownloadSettingsRequest) EncodeBare(b *bin.Buffer) error {
|
||||
if g == nil {
|
||||
return fmt.Errorf("can't encode account.getAutoDownloadSettings#56da0b3f as nil")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Decode implements bin.Decoder.
|
||||
func (g *AccountGetAutoDownloadSettingsRequest) Decode(b *bin.Buffer) error {
|
||||
if g == nil {
|
||||
return fmt.Errorf("can't decode account.getAutoDownloadSettings#56da0b3f to nil")
|
||||
}
|
||||
if err := b.ConsumeID(AccountGetAutoDownloadSettingsRequestTypeID); err != nil {
|
||||
return fmt.Errorf("unable to decode account.getAutoDownloadSettings#56da0b3f: %w", err)
|
||||
}
|
||||
return g.DecodeBare(b)
|
||||
}
|
||||
|
||||
// DecodeBare implements bin.BareDecoder.
|
||||
func (g *AccountGetAutoDownloadSettingsRequest) DecodeBare(b *bin.Buffer) error {
|
||||
if g == nil {
|
||||
return fmt.Errorf("can't decode account.getAutoDownloadSettings#56da0b3f to nil")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// AccountGetAutoDownloadSettings invokes method account.getAutoDownloadSettings#56da0b3f returning error if any.
|
||||
// Get media autodownload settings
|
||||
//
|
||||
// See https://core.telegram.org/method/account.getAutoDownloadSettings for reference.
|
||||
func (c *Client) AccountGetAutoDownloadSettings(ctx context.Context) (*AccountAutoDownloadSettings, error) {
|
||||
var result AccountAutoDownloadSettings
|
||||
|
||||
request := &AccountGetAutoDownloadSettingsRequest{}
|
||||
if err := c.rpc.Invoke(ctx, request, &result); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &result, nil
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
//go:build !no_gotd_slices
|
||||
// +build !no_gotd_slices
|
||||
|
||||
// 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{}
|
||||
)
|
||||
@@ -0,0 +1,143 @@
|
||||
// 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{}
|
||||
)
|
||||
|
||||
// AccountGetAutoSaveSettingsRequest represents TL type `account.getAutoSaveSettings#adcbbcda`.
|
||||
// Get autosave settings
|
||||
//
|
||||
// See https://core.telegram.org/method/account.getAutoSaveSettings for reference.
|
||||
type AccountGetAutoSaveSettingsRequest struct {
|
||||
}
|
||||
|
||||
// AccountGetAutoSaveSettingsRequestTypeID is TL type id of AccountGetAutoSaveSettingsRequest.
|
||||
const AccountGetAutoSaveSettingsRequestTypeID = 0xadcbbcda
|
||||
|
||||
// Ensuring interfaces in compile-time for AccountGetAutoSaveSettingsRequest.
|
||||
var (
|
||||
_ bin.Encoder = &AccountGetAutoSaveSettingsRequest{}
|
||||
_ bin.Decoder = &AccountGetAutoSaveSettingsRequest{}
|
||||
_ bin.BareEncoder = &AccountGetAutoSaveSettingsRequest{}
|
||||
_ bin.BareDecoder = &AccountGetAutoSaveSettingsRequest{}
|
||||
)
|
||||
|
||||
func (g *AccountGetAutoSaveSettingsRequest) Zero() bool {
|
||||
if g == nil {
|
||||
return true
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
// String implements fmt.Stringer.
|
||||
func (g *AccountGetAutoSaveSettingsRequest) String() string {
|
||||
if g == nil {
|
||||
return "AccountGetAutoSaveSettingsRequest(nil)"
|
||||
}
|
||||
type Alias AccountGetAutoSaveSettingsRequest
|
||||
return fmt.Sprintf("AccountGetAutoSaveSettingsRequest%+v", Alias(*g))
|
||||
}
|
||||
|
||||
// TypeID returns type id in TL schema.
|
||||
//
|
||||
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
||||
func (*AccountGetAutoSaveSettingsRequest) TypeID() uint32 {
|
||||
return AccountGetAutoSaveSettingsRequestTypeID
|
||||
}
|
||||
|
||||
// TypeName returns name of type in TL schema.
|
||||
func (*AccountGetAutoSaveSettingsRequest) TypeName() string {
|
||||
return "account.getAutoSaveSettings"
|
||||
}
|
||||
|
||||
// TypeInfo returns info about TL type.
|
||||
func (g *AccountGetAutoSaveSettingsRequest) TypeInfo() tdp.Type {
|
||||
typ := tdp.Type{
|
||||
Name: "account.getAutoSaveSettings",
|
||||
ID: AccountGetAutoSaveSettingsRequestTypeID,
|
||||
}
|
||||
if g == nil {
|
||||
typ.Null = true
|
||||
return typ
|
||||
}
|
||||
typ.Fields = []tdp.Field{}
|
||||
return typ
|
||||
}
|
||||
|
||||
// Encode implements bin.Encoder.
|
||||
func (g *AccountGetAutoSaveSettingsRequest) Encode(b *bin.Buffer) error {
|
||||
if g == nil {
|
||||
return fmt.Errorf("can't encode account.getAutoSaveSettings#adcbbcda as nil")
|
||||
}
|
||||
b.PutID(AccountGetAutoSaveSettingsRequestTypeID)
|
||||
return g.EncodeBare(b)
|
||||
}
|
||||
|
||||
// EncodeBare implements bin.BareEncoder.
|
||||
func (g *AccountGetAutoSaveSettingsRequest) EncodeBare(b *bin.Buffer) error {
|
||||
if g == nil {
|
||||
return fmt.Errorf("can't encode account.getAutoSaveSettings#adcbbcda as nil")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Decode implements bin.Decoder.
|
||||
func (g *AccountGetAutoSaveSettingsRequest) Decode(b *bin.Buffer) error {
|
||||
if g == nil {
|
||||
return fmt.Errorf("can't decode account.getAutoSaveSettings#adcbbcda to nil")
|
||||
}
|
||||
if err := b.ConsumeID(AccountGetAutoSaveSettingsRequestTypeID); err != nil {
|
||||
return fmt.Errorf("unable to decode account.getAutoSaveSettings#adcbbcda: %w", err)
|
||||
}
|
||||
return g.DecodeBare(b)
|
||||
}
|
||||
|
||||
// DecodeBare implements bin.BareDecoder.
|
||||
func (g *AccountGetAutoSaveSettingsRequest) DecodeBare(b *bin.Buffer) error {
|
||||
if g == nil {
|
||||
return fmt.Errorf("can't decode account.getAutoSaveSettings#adcbbcda to nil")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// AccountGetAutoSaveSettings invokes method account.getAutoSaveSettings#adcbbcda returning error if any.
|
||||
// Get autosave settings
|
||||
//
|
||||
// See https://core.telegram.org/method/account.getAutoSaveSettings for reference.
|
||||
func (c *Client) AccountGetAutoSaveSettings(ctx context.Context) (*AccountAutoSaveSettings, error) {
|
||||
var result AccountAutoSaveSettings
|
||||
|
||||
request := &AccountGetAutoSaveSettingsRequest{}
|
||||
if err := c.rpc.Invoke(ctx, request, &result); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &result, nil
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
//go:build !no_gotd_slices
|
||||
// +build !no_gotd_slices
|
||||
|
||||
// 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{}
|
||||
)
|
||||
@@ -0,0 +1,228 @@
|
||||
// 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{}
|
||||
)
|
||||
|
||||
// AccountGetBotBusinessConnectionRequest represents TL type `account.getBotBusinessConnection#76a86270`.
|
||||
// Bots may invoke this method to re-fetch the updateBotBusinessConnect¹ constructor
|
||||
// associated with a specific business connection_id, see here »² for more info on
|
||||
// connected business bots.
|
||||
// This is needed for example for freshly logged in bots that are receiving some
|
||||
// updateBotNewBusinessMessage³, etc. updates because some users have already connected
|
||||
// to the bot before it could login.
|
||||
// In this case, the bot is receiving messages from the business connection, but it
|
||||
// hasn't cached the associated updateBotBusinessConnect⁴ with info about the
|
||||
// connection (can it reply to messages? etc.) yet, and cannot receive the old ones
|
||||
// because they were sent when the bot wasn't logged into the session yet.
|
||||
// This method can be used to fetch info about a not-yet-cached business connection, and
|
||||
// should not be invoked if the info is already cached or to fetch changes, as eventual
|
||||
// changes will automatically be sent as new updateBotBusinessConnect⁵ updates to the
|
||||
// bot using the usual update delivery methods »⁶.
|
||||
//
|
||||
// Links:
|
||||
// 1. https://core.telegram.org/constructor/updateBotBusinessConnect
|
||||
// 2. https://core.telegram.org/api/business#connected-bots
|
||||
// 3. https://core.telegram.org/constructor/updateBotNewBusinessMessage
|
||||
// 4. https://core.telegram.org/constructor/updateBotBusinessConnect
|
||||
// 5. https://core.telegram.org/constructor/updateBotBusinessConnect
|
||||
// 6. https://core.telegram.org/api/updates
|
||||
//
|
||||
// See https://core.telegram.org/method/account.getBotBusinessConnection for reference.
|
||||
type AccountGetBotBusinessConnectionRequest struct {
|
||||
// Business connection ID »¹.
|
||||
//
|
||||
// Links:
|
||||
// 1) https://core.telegram.org/api/business#connected-bots
|
||||
ConnectionID string
|
||||
}
|
||||
|
||||
// AccountGetBotBusinessConnectionRequestTypeID is TL type id of AccountGetBotBusinessConnectionRequest.
|
||||
const AccountGetBotBusinessConnectionRequestTypeID = 0x76a86270
|
||||
|
||||
// Ensuring interfaces in compile-time for AccountGetBotBusinessConnectionRequest.
|
||||
var (
|
||||
_ bin.Encoder = &AccountGetBotBusinessConnectionRequest{}
|
||||
_ bin.Decoder = &AccountGetBotBusinessConnectionRequest{}
|
||||
_ bin.BareEncoder = &AccountGetBotBusinessConnectionRequest{}
|
||||
_ bin.BareDecoder = &AccountGetBotBusinessConnectionRequest{}
|
||||
)
|
||||
|
||||
func (g *AccountGetBotBusinessConnectionRequest) Zero() bool {
|
||||
if g == nil {
|
||||
return true
|
||||
}
|
||||
if !(g.ConnectionID == "") {
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
// String implements fmt.Stringer.
|
||||
func (g *AccountGetBotBusinessConnectionRequest) String() string {
|
||||
if g == nil {
|
||||
return "AccountGetBotBusinessConnectionRequest(nil)"
|
||||
}
|
||||
type Alias AccountGetBotBusinessConnectionRequest
|
||||
return fmt.Sprintf("AccountGetBotBusinessConnectionRequest%+v", Alias(*g))
|
||||
}
|
||||
|
||||
// FillFrom fills AccountGetBotBusinessConnectionRequest from given interface.
|
||||
func (g *AccountGetBotBusinessConnectionRequest) FillFrom(from interface {
|
||||
GetConnectionID() (value string)
|
||||
}) {
|
||||
g.ConnectionID = from.GetConnectionID()
|
||||
}
|
||||
|
||||
// TypeID returns type id in TL schema.
|
||||
//
|
||||
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
||||
func (*AccountGetBotBusinessConnectionRequest) TypeID() uint32 {
|
||||
return AccountGetBotBusinessConnectionRequestTypeID
|
||||
}
|
||||
|
||||
// TypeName returns name of type in TL schema.
|
||||
func (*AccountGetBotBusinessConnectionRequest) TypeName() string {
|
||||
return "account.getBotBusinessConnection"
|
||||
}
|
||||
|
||||
// TypeInfo returns info about TL type.
|
||||
func (g *AccountGetBotBusinessConnectionRequest) TypeInfo() tdp.Type {
|
||||
typ := tdp.Type{
|
||||
Name: "account.getBotBusinessConnection",
|
||||
ID: AccountGetBotBusinessConnectionRequestTypeID,
|
||||
}
|
||||
if g == nil {
|
||||
typ.Null = true
|
||||
return typ
|
||||
}
|
||||
typ.Fields = []tdp.Field{
|
||||
{
|
||||
Name: "ConnectionID",
|
||||
SchemaName: "connection_id",
|
||||
},
|
||||
}
|
||||
return typ
|
||||
}
|
||||
|
||||
// Encode implements bin.Encoder.
|
||||
func (g *AccountGetBotBusinessConnectionRequest) Encode(b *bin.Buffer) error {
|
||||
if g == nil {
|
||||
return fmt.Errorf("can't encode account.getBotBusinessConnection#76a86270 as nil")
|
||||
}
|
||||
b.PutID(AccountGetBotBusinessConnectionRequestTypeID)
|
||||
return g.EncodeBare(b)
|
||||
}
|
||||
|
||||
// EncodeBare implements bin.BareEncoder.
|
||||
func (g *AccountGetBotBusinessConnectionRequest) EncodeBare(b *bin.Buffer) error {
|
||||
if g == nil {
|
||||
return fmt.Errorf("can't encode account.getBotBusinessConnection#76a86270 as nil")
|
||||
}
|
||||
b.PutString(g.ConnectionID)
|
||||
return nil
|
||||
}
|
||||
|
||||
// Decode implements bin.Decoder.
|
||||
func (g *AccountGetBotBusinessConnectionRequest) Decode(b *bin.Buffer) error {
|
||||
if g == nil {
|
||||
return fmt.Errorf("can't decode account.getBotBusinessConnection#76a86270 to nil")
|
||||
}
|
||||
if err := b.ConsumeID(AccountGetBotBusinessConnectionRequestTypeID); err != nil {
|
||||
return fmt.Errorf("unable to decode account.getBotBusinessConnection#76a86270: %w", err)
|
||||
}
|
||||
return g.DecodeBare(b)
|
||||
}
|
||||
|
||||
// DecodeBare implements bin.BareDecoder.
|
||||
func (g *AccountGetBotBusinessConnectionRequest) DecodeBare(b *bin.Buffer) error {
|
||||
if g == nil {
|
||||
return fmt.Errorf("can't decode account.getBotBusinessConnection#76a86270 to nil")
|
||||
}
|
||||
{
|
||||
value, err := b.String()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode account.getBotBusinessConnection#76a86270: field connection_id: %w", err)
|
||||
}
|
||||
g.ConnectionID = value
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// GetConnectionID returns value of ConnectionID field.
|
||||
func (g *AccountGetBotBusinessConnectionRequest) GetConnectionID() (value string) {
|
||||
if g == nil {
|
||||
return
|
||||
}
|
||||
return g.ConnectionID
|
||||
}
|
||||
|
||||
// AccountGetBotBusinessConnection invokes method account.getBotBusinessConnection#76a86270 returning error if any.
|
||||
// Bots may invoke this method to re-fetch the updateBotBusinessConnect¹ constructor
|
||||
// associated with a specific business connection_id, see here »² for more info on
|
||||
// connected business bots.
|
||||
// This is needed for example for freshly logged in bots that are receiving some
|
||||
// updateBotNewBusinessMessage³, etc. updates because some users have already connected
|
||||
// to the bot before it could login.
|
||||
// In this case, the bot is receiving messages from the business connection, but it
|
||||
// hasn't cached the associated updateBotBusinessConnect⁴ with info about the
|
||||
// connection (can it reply to messages? etc.) yet, and cannot receive the old ones
|
||||
// because they were sent when the bot wasn't logged into the session yet.
|
||||
// This method can be used to fetch info about a not-yet-cached business connection, and
|
||||
// should not be invoked if the info is already cached or to fetch changes, as eventual
|
||||
// changes will automatically be sent as new updateBotBusinessConnect⁵ updates to the
|
||||
// bot using the usual update delivery methods »⁶.
|
||||
//
|
||||
// Links:
|
||||
// 1. https://core.telegram.org/constructor/updateBotBusinessConnect
|
||||
// 2. https://core.telegram.org/api/business#connected-bots
|
||||
// 3. https://core.telegram.org/constructor/updateBotNewBusinessMessage
|
||||
// 4. https://core.telegram.org/constructor/updateBotBusinessConnect
|
||||
// 5. https://core.telegram.org/constructor/updateBotBusinessConnect
|
||||
// 6. https://core.telegram.org/api/updates
|
||||
//
|
||||
// Possible errors:
|
||||
//
|
||||
// 400 CONNECTION_ID_INVALID: The specified connection ID is invalid.
|
||||
//
|
||||
// See https://core.telegram.org/method/account.getBotBusinessConnection for reference.
|
||||
// Can be used by bots.
|
||||
func (c *Client) AccountGetBotBusinessConnection(ctx context.Context, connectionid string) (UpdatesClass, error) {
|
||||
var result UpdatesBox
|
||||
|
||||
request := &AccountGetBotBusinessConnectionRequest{
|
||||
ConnectionID: connectionid,
|
||||
}
|
||||
if err := c.rpc.Invoke(ctx, request, &result); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return result.Updates, nil
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
//go:build !no_gotd_slices
|
||||
// +build !no_gotd_slices
|
||||
|
||||
// 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{}
|
||||
)
|
||||
@@ -0,0 +1,149 @@
|
||||
// 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{}
|
||||
)
|
||||
|
||||
// AccountGetBusinessChatLinksRequest represents TL type `account.getBusinessChatLinks#6f70dde1`.
|
||||
// List all created business chat deep links »¹.
|
||||
//
|
||||
// Links:
|
||||
// 1. https://core.telegram.org/api/business#business-chat-links
|
||||
//
|
||||
// See https://core.telegram.org/method/account.getBusinessChatLinks for reference.
|
||||
type AccountGetBusinessChatLinksRequest struct {
|
||||
}
|
||||
|
||||
// AccountGetBusinessChatLinksRequestTypeID is TL type id of AccountGetBusinessChatLinksRequest.
|
||||
const AccountGetBusinessChatLinksRequestTypeID = 0x6f70dde1
|
||||
|
||||
// Ensuring interfaces in compile-time for AccountGetBusinessChatLinksRequest.
|
||||
var (
|
||||
_ bin.Encoder = &AccountGetBusinessChatLinksRequest{}
|
||||
_ bin.Decoder = &AccountGetBusinessChatLinksRequest{}
|
||||
_ bin.BareEncoder = &AccountGetBusinessChatLinksRequest{}
|
||||
_ bin.BareDecoder = &AccountGetBusinessChatLinksRequest{}
|
||||
)
|
||||
|
||||
func (g *AccountGetBusinessChatLinksRequest) Zero() bool {
|
||||
if g == nil {
|
||||
return true
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
// String implements fmt.Stringer.
|
||||
func (g *AccountGetBusinessChatLinksRequest) String() string {
|
||||
if g == nil {
|
||||
return "AccountGetBusinessChatLinksRequest(nil)"
|
||||
}
|
||||
type Alias AccountGetBusinessChatLinksRequest
|
||||
return fmt.Sprintf("AccountGetBusinessChatLinksRequest%+v", Alias(*g))
|
||||
}
|
||||
|
||||
// TypeID returns type id in TL schema.
|
||||
//
|
||||
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
||||
func (*AccountGetBusinessChatLinksRequest) TypeID() uint32 {
|
||||
return AccountGetBusinessChatLinksRequestTypeID
|
||||
}
|
||||
|
||||
// TypeName returns name of type in TL schema.
|
||||
func (*AccountGetBusinessChatLinksRequest) TypeName() string {
|
||||
return "account.getBusinessChatLinks"
|
||||
}
|
||||
|
||||
// TypeInfo returns info about TL type.
|
||||
func (g *AccountGetBusinessChatLinksRequest) TypeInfo() tdp.Type {
|
||||
typ := tdp.Type{
|
||||
Name: "account.getBusinessChatLinks",
|
||||
ID: AccountGetBusinessChatLinksRequestTypeID,
|
||||
}
|
||||
if g == nil {
|
||||
typ.Null = true
|
||||
return typ
|
||||
}
|
||||
typ.Fields = []tdp.Field{}
|
||||
return typ
|
||||
}
|
||||
|
||||
// Encode implements bin.Encoder.
|
||||
func (g *AccountGetBusinessChatLinksRequest) Encode(b *bin.Buffer) error {
|
||||
if g == nil {
|
||||
return fmt.Errorf("can't encode account.getBusinessChatLinks#6f70dde1 as nil")
|
||||
}
|
||||
b.PutID(AccountGetBusinessChatLinksRequestTypeID)
|
||||
return g.EncodeBare(b)
|
||||
}
|
||||
|
||||
// EncodeBare implements bin.BareEncoder.
|
||||
func (g *AccountGetBusinessChatLinksRequest) EncodeBare(b *bin.Buffer) error {
|
||||
if g == nil {
|
||||
return fmt.Errorf("can't encode account.getBusinessChatLinks#6f70dde1 as nil")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Decode implements bin.Decoder.
|
||||
func (g *AccountGetBusinessChatLinksRequest) Decode(b *bin.Buffer) error {
|
||||
if g == nil {
|
||||
return fmt.Errorf("can't decode account.getBusinessChatLinks#6f70dde1 to nil")
|
||||
}
|
||||
if err := b.ConsumeID(AccountGetBusinessChatLinksRequestTypeID); err != nil {
|
||||
return fmt.Errorf("unable to decode account.getBusinessChatLinks#6f70dde1: %w", err)
|
||||
}
|
||||
return g.DecodeBare(b)
|
||||
}
|
||||
|
||||
// DecodeBare implements bin.BareDecoder.
|
||||
func (g *AccountGetBusinessChatLinksRequest) DecodeBare(b *bin.Buffer) error {
|
||||
if g == nil {
|
||||
return fmt.Errorf("can't decode account.getBusinessChatLinks#6f70dde1 to nil")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// AccountGetBusinessChatLinks invokes method account.getBusinessChatLinks#6f70dde1 returning error if any.
|
||||
// List all created business chat deep links »¹.
|
||||
//
|
||||
// Links:
|
||||
// 1. https://core.telegram.org/api/business#business-chat-links
|
||||
//
|
||||
// See https://core.telegram.org/method/account.getBusinessChatLinks for reference.
|
||||
func (c *Client) AccountGetBusinessChatLinks(ctx context.Context) (*AccountBusinessChatLinks, error) {
|
||||
var result AccountBusinessChatLinks
|
||||
|
||||
request := &AccountGetBusinessChatLinksRequest{}
|
||||
if err := c.rpc.Invoke(ctx, request, &result); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &result, nil
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
//go:build !no_gotd_slices
|
||||
// +build !no_gotd_slices
|
||||
|
||||
// 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{}
|
||||
)
|
||||
@@ -0,0 +1,187 @@
|
||||
// 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{}
|
||||
)
|
||||
|
||||
// AccountGetChannelDefaultEmojiStatusesRequest represents TL type `account.getChannelDefaultEmojiStatuses#7727a7d5`.
|
||||
// Get a list of default suggested channel emoji statuses¹.
|
||||
//
|
||||
// Links:
|
||||
// 1. https://core.telegram.org/api/emoji-status
|
||||
//
|
||||
// See https://core.telegram.org/method/account.getChannelDefaultEmojiStatuses for reference.
|
||||
type AccountGetChannelDefaultEmojiStatusesRequest struct {
|
||||
// Hash used for caching, for more info click here¹.
|
||||
//
|
||||
// Links:
|
||||
// 1) https://core.telegram.org/api/offsets#hash-generation
|
||||
Hash int64
|
||||
}
|
||||
|
||||
// AccountGetChannelDefaultEmojiStatusesRequestTypeID is TL type id of AccountGetChannelDefaultEmojiStatusesRequest.
|
||||
const AccountGetChannelDefaultEmojiStatusesRequestTypeID = 0x7727a7d5
|
||||
|
||||
// Ensuring interfaces in compile-time for AccountGetChannelDefaultEmojiStatusesRequest.
|
||||
var (
|
||||
_ bin.Encoder = &AccountGetChannelDefaultEmojiStatusesRequest{}
|
||||
_ bin.Decoder = &AccountGetChannelDefaultEmojiStatusesRequest{}
|
||||
_ bin.BareEncoder = &AccountGetChannelDefaultEmojiStatusesRequest{}
|
||||
_ bin.BareDecoder = &AccountGetChannelDefaultEmojiStatusesRequest{}
|
||||
)
|
||||
|
||||
func (g *AccountGetChannelDefaultEmojiStatusesRequest) Zero() bool {
|
||||
if g == nil {
|
||||
return true
|
||||
}
|
||||
if !(g.Hash == 0) {
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
// String implements fmt.Stringer.
|
||||
func (g *AccountGetChannelDefaultEmojiStatusesRequest) String() string {
|
||||
if g == nil {
|
||||
return "AccountGetChannelDefaultEmojiStatusesRequest(nil)"
|
||||
}
|
||||
type Alias AccountGetChannelDefaultEmojiStatusesRequest
|
||||
return fmt.Sprintf("AccountGetChannelDefaultEmojiStatusesRequest%+v", Alias(*g))
|
||||
}
|
||||
|
||||
// FillFrom fills AccountGetChannelDefaultEmojiStatusesRequest from given interface.
|
||||
func (g *AccountGetChannelDefaultEmojiStatusesRequest) FillFrom(from interface {
|
||||
GetHash() (value int64)
|
||||
}) {
|
||||
g.Hash = from.GetHash()
|
||||
}
|
||||
|
||||
// TypeID returns type id in TL schema.
|
||||
//
|
||||
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
||||
func (*AccountGetChannelDefaultEmojiStatusesRequest) TypeID() uint32 {
|
||||
return AccountGetChannelDefaultEmojiStatusesRequestTypeID
|
||||
}
|
||||
|
||||
// TypeName returns name of type in TL schema.
|
||||
func (*AccountGetChannelDefaultEmojiStatusesRequest) TypeName() string {
|
||||
return "account.getChannelDefaultEmojiStatuses"
|
||||
}
|
||||
|
||||
// TypeInfo returns info about TL type.
|
||||
func (g *AccountGetChannelDefaultEmojiStatusesRequest) TypeInfo() tdp.Type {
|
||||
typ := tdp.Type{
|
||||
Name: "account.getChannelDefaultEmojiStatuses",
|
||||
ID: AccountGetChannelDefaultEmojiStatusesRequestTypeID,
|
||||
}
|
||||
if g == nil {
|
||||
typ.Null = true
|
||||
return typ
|
||||
}
|
||||
typ.Fields = []tdp.Field{
|
||||
{
|
||||
Name: "Hash",
|
||||
SchemaName: "hash",
|
||||
},
|
||||
}
|
||||
return typ
|
||||
}
|
||||
|
||||
// Encode implements bin.Encoder.
|
||||
func (g *AccountGetChannelDefaultEmojiStatusesRequest) Encode(b *bin.Buffer) error {
|
||||
if g == nil {
|
||||
return fmt.Errorf("can't encode account.getChannelDefaultEmojiStatuses#7727a7d5 as nil")
|
||||
}
|
||||
b.PutID(AccountGetChannelDefaultEmojiStatusesRequestTypeID)
|
||||
return g.EncodeBare(b)
|
||||
}
|
||||
|
||||
// EncodeBare implements bin.BareEncoder.
|
||||
func (g *AccountGetChannelDefaultEmojiStatusesRequest) EncodeBare(b *bin.Buffer) error {
|
||||
if g == nil {
|
||||
return fmt.Errorf("can't encode account.getChannelDefaultEmojiStatuses#7727a7d5 as nil")
|
||||
}
|
||||
b.PutLong(g.Hash)
|
||||
return nil
|
||||
}
|
||||
|
||||
// Decode implements bin.Decoder.
|
||||
func (g *AccountGetChannelDefaultEmojiStatusesRequest) Decode(b *bin.Buffer) error {
|
||||
if g == nil {
|
||||
return fmt.Errorf("can't decode account.getChannelDefaultEmojiStatuses#7727a7d5 to nil")
|
||||
}
|
||||
if err := b.ConsumeID(AccountGetChannelDefaultEmojiStatusesRequestTypeID); err != nil {
|
||||
return fmt.Errorf("unable to decode account.getChannelDefaultEmojiStatuses#7727a7d5: %w", err)
|
||||
}
|
||||
return g.DecodeBare(b)
|
||||
}
|
||||
|
||||
// DecodeBare implements bin.BareDecoder.
|
||||
func (g *AccountGetChannelDefaultEmojiStatusesRequest) DecodeBare(b *bin.Buffer) error {
|
||||
if g == nil {
|
||||
return fmt.Errorf("can't decode account.getChannelDefaultEmojiStatuses#7727a7d5 to nil")
|
||||
}
|
||||
{
|
||||
value, err := b.Long()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode account.getChannelDefaultEmojiStatuses#7727a7d5: field hash: %w", err)
|
||||
}
|
||||
g.Hash = value
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// GetHash returns value of Hash field.
|
||||
func (g *AccountGetChannelDefaultEmojiStatusesRequest) GetHash() (value int64) {
|
||||
if g == nil {
|
||||
return
|
||||
}
|
||||
return g.Hash
|
||||
}
|
||||
|
||||
// AccountGetChannelDefaultEmojiStatuses invokes method account.getChannelDefaultEmojiStatuses#7727a7d5 returning error if any.
|
||||
// Get a list of default suggested channel emoji statuses¹.
|
||||
//
|
||||
// Links:
|
||||
// 1. https://core.telegram.org/api/emoji-status
|
||||
//
|
||||
// See https://core.telegram.org/method/account.getChannelDefaultEmojiStatuses for reference.
|
||||
func (c *Client) AccountGetChannelDefaultEmojiStatuses(ctx context.Context, hash int64) (AccountEmojiStatusesClass, error) {
|
||||
var result AccountEmojiStatusesBox
|
||||
|
||||
request := &AccountGetChannelDefaultEmojiStatusesRequest{
|
||||
Hash: hash,
|
||||
}
|
||||
if err := c.rpc.Invoke(ctx, request, &result); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return result.EmojiStatuses, nil
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
//go:build !no_gotd_slices
|
||||
// +build !no_gotd_slices
|
||||
|
||||
// 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{}
|
||||
)
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user