gotd: update to layer 223
This commit is contained in:
+177
@@ -0,0 +1,177 @@
|
||||
// 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{}
|
||||
)
|
||||
|
||||
// AccountDeletePasskeyRequest represents TL type `account.deletePasskey#f5b5563f`.
|
||||
//
|
||||
// See https://core.telegram.org/method/account.deletePasskey for reference.
|
||||
type AccountDeletePasskeyRequest struct {
|
||||
// ID field of AccountDeletePasskeyRequest.
|
||||
ID string
|
||||
}
|
||||
|
||||
// AccountDeletePasskeyRequestTypeID is TL type id of AccountDeletePasskeyRequest.
|
||||
const AccountDeletePasskeyRequestTypeID = 0xf5b5563f
|
||||
|
||||
// Ensuring interfaces in compile-time for AccountDeletePasskeyRequest.
|
||||
var (
|
||||
_ bin.Encoder = &AccountDeletePasskeyRequest{}
|
||||
_ bin.Decoder = &AccountDeletePasskeyRequest{}
|
||||
_ bin.BareEncoder = &AccountDeletePasskeyRequest{}
|
||||
_ bin.BareDecoder = &AccountDeletePasskeyRequest{}
|
||||
)
|
||||
|
||||
func (d *AccountDeletePasskeyRequest) Zero() bool {
|
||||
if d == nil {
|
||||
return true
|
||||
}
|
||||
if !(d.ID == "") {
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
// String implements fmt.Stringer.
|
||||
func (d *AccountDeletePasskeyRequest) String() string {
|
||||
if d == nil {
|
||||
return "AccountDeletePasskeyRequest(nil)"
|
||||
}
|
||||
type Alias AccountDeletePasskeyRequest
|
||||
return fmt.Sprintf("AccountDeletePasskeyRequest%+v", Alias(*d))
|
||||
}
|
||||
|
||||
// FillFrom fills AccountDeletePasskeyRequest from given interface.
|
||||
func (d *AccountDeletePasskeyRequest) FillFrom(from interface {
|
||||
GetID() (value string)
|
||||
}) {
|
||||
d.ID = from.GetID()
|
||||
}
|
||||
|
||||
// TypeID returns type id in TL schema.
|
||||
//
|
||||
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
||||
func (*AccountDeletePasskeyRequest) TypeID() uint32 {
|
||||
return AccountDeletePasskeyRequestTypeID
|
||||
}
|
||||
|
||||
// TypeName returns name of type in TL schema.
|
||||
func (*AccountDeletePasskeyRequest) TypeName() string {
|
||||
return "account.deletePasskey"
|
||||
}
|
||||
|
||||
// TypeInfo returns info about TL type.
|
||||
func (d *AccountDeletePasskeyRequest) TypeInfo() tdp.Type {
|
||||
typ := tdp.Type{
|
||||
Name: "account.deletePasskey",
|
||||
ID: AccountDeletePasskeyRequestTypeID,
|
||||
}
|
||||
if d == nil {
|
||||
typ.Null = true
|
||||
return typ
|
||||
}
|
||||
typ.Fields = []tdp.Field{
|
||||
{
|
||||
Name: "ID",
|
||||
SchemaName: "id",
|
||||
},
|
||||
}
|
||||
return typ
|
||||
}
|
||||
|
||||
// Encode implements bin.Encoder.
|
||||
func (d *AccountDeletePasskeyRequest) Encode(b *bin.Buffer) error {
|
||||
if d == nil {
|
||||
return fmt.Errorf("can't encode account.deletePasskey#f5b5563f as nil")
|
||||
}
|
||||
b.PutID(AccountDeletePasskeyRequestTypeID)
|
||||
return d.EncodeBare(b)
|
||||
}
|
||||
|
||||
// EncodeBare implements bin.BareEncoder.
|
||||
func (d *AccountDeletePasskeyRequest) EncodeBare(b *bin.Buffer) error {
|
||||
if d == nil {
|
||||
return fmt.Errorf("can't encode account.deletePasskey#f5b5563f as nil")
|
||||
}
|
||||
b.PutString(d.ID)
|
||||
return nil
|
||||
}
|
||||
|
||||
// Decode implements bin.Decoder.
|
||||
func (d *AccountDeletePasskeyRequest) Decode(b *bin.Buffer) error {
|
||||
if d == nil {
|
||||
return fmt.Errorf("can't decode account.deletePasskey#f5b5563f to nil")
|
||||
}
|
||||
if err := b.ConsumeID(AccountDeletePasskeyRequestTypeID); err != nil {
|
||||
return fmt.Errorf("unable to decode account.deletePasskey#f5b5563f: %w", err)
|
||||
}
|
||||
return d.DecodeBare(b)
|
||||
}
|
||||
|
||||
// DecodeBare implements bin.BareDecoder.
|
||||
func (d *AccountDeletePasskeyRequest) DecodeBare(b *bin.Buffer) error {
|
||||
if d == nil {
|
||||
return fmt.Errorf("can't decode account.deletePasskey#f5b5563f to nil")
|
||||
}
|
||||
{
|
||||
value, err := b.String()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode account.deletePasskey#f5b5563f: field id: %w", err)
|
||||
}
|
||||
d.ID = value
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// GetID returns value of ID field.
|
||||
func (d *AccountDeletePasskeyRequest) GetID() (value string) {
|
||||
if d == nil {
|
||||
return
|
||||
}
|
||||
return d.ID
|
||||
}
|
||||
|
||||
// AccountDeletePasskey invokes method account.deletePasskey#f5b5563f returning error if any.
|
||||
//
|
||||
// See https://core.telegram.org/method/account.deletePasskey for reference.
|
||||
func (c *Client) AccountDeletePasskey(ctx context.Context, id string) (bool, error) {
|
||||
var result BoolBox
|
||||
|
||||
request := &AccountDeletePasskeyRequest{
|
||||
ID: id,
|
||||
}
|
||||
if err := c.rpc.Invoke(ctx, request, &result); err != nil {
|
||||
return false, err
|
||||
}
|
||||
_, ok := result.Bool.(*BoolTrue)
|
||||
return ok, nil
|
||||
}
|
||||
+141
@@ -0,0 +1,141 @@
|
||||
// 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{}
|
||||
)
|
||||
|
||||
// AccountGetPasskeysRequest represents TL type `account.getPasskeys#ea1f0c52`.
|
||||
//
|
||||
// See https://core.telegram.org/method/account.getPasskeys for reference.
|
||||
type AccountGetPasskeysRequest struct {
|
||||
}
|
||||
|
||||
// AccountGetPasskeysRequestTypeID is TL type id of AccountGetPasskeysRequest.
|
||||
const AccountGetPasskeysRequestTypeID = 0xea1f0c52
|
||||
|
||||
// Ensuring interfaces in compile-time for AccountGetPasskeysRequest.
|
||||
var (
|
||||
_ bin.Encoder = &AccountGetPasskeysRequest{}
|
||||
_ bin.Decoder = &AccountGetPasskeysRequest{}
|
||||
_ bin.BareEncoder = &AccountGetPasskeysRequest{}
|
||||
_ bin.BareDecoder = &AccountGetPasskeysRequest{}
|
||||
)
|
||||
|
||||
func (g *AccountGetPasskeysRequest) Zero() bool {
|
||||
if g == nil {
|
||||
return true
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
// String implements fmt.Stringer.
|
||||
func (g *AccountGetPasskeysRequest) String() string {
|
||||
if g == nil {
|
||||
return "AccountGetPasskeysRequest(nil)"
|
||||
}
|
||||
type Alias AccountGetPasskeysRequest
|
||||
return fmt.Sprintf("AccountGetPasskeysRequest%+v", Alias(*g))
|
||||
}
|
||||
|
||||
// TypeID returns type id in TL schema.
|
||||
//
|
||||
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
||||
func (*AccountGetPasskeysRequest) TypeID() uint32 {
|
||||
return AccountGetPasskeysRequestTypeID
|
||||
}
|
||||
|
||||
// TypeName returns name of type in TL schema.
|
||||
func (*AccountGetPasskeysRequest) TypeName() string {
|
||||
return "account.getPasskeys"
|
||||
}
|
||||
|
||||
// TypeInfo returns info about TL type.
|
||||
func (g *AccountGetPasskeysRequest) TypeInfo() tdp.Type {
|
||||
typ := tdp.Type{
|
||||
Name: "account.getPasskeys",
|
||||
ID: AccountGetPasskeysRequestTypeID,
|
||||
}
|
||||
if g == nil {
|
||||
typ.Null = true
|
||||
return typ
|
||||
}
|
||||
typ.Fields = []tdp.Field{}
|
||||
return typ
|
||||
}
|
||||
|
||||
// Encode implements bin.Encoder.
|
||||
func (g *AccountGetPasskeysRequest) Encode(b *bin.Buffer) error {
|
||||
if g == nil {
|
||||
return fmt.Errorf("can't encode account.getPasskeys#ea1f0c52 as nil")
|
||||
}
|
||||
b.PutID(AccountGetPasskeysRequestTypeID)
|
||||
return g.EncodeBare(b)
|
||||
}
|
||||
|
||||
// EncodeBare implements bin.BareEncoder.
|
||||
func (g *AccountGetPasskeysRequest) EncodeBare(b *bin.Buffer) error {
|
||||
if g == nil {
|
||||
return fmt.Errorf("can't encode account.getPasskeys#ea1f0c52 as nil")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Decode implements bin.Decoder.
|
||||
func (g *AccountGetPasskeysRequest) Decode(b *bin.Buffer) error {
|
||||
if g == nil {
|
||||
return fmt.Errorf("can't decode account.getPasskeys#ea1f0c52 to nil")
|
||||
}
|
||||
if err := b.ConsumeID(AccountGetPasskeysRequestTypeID); err != nil {
|
||||
return fmt.Errorf("unable to decode account.getPasskeys#ea1f0c52: %w", err)
|
||||
}
|
||||
return g.DecodeBare(b)
|
||||
}
|
||||
|
||||
// DecodeBare implements bin.BareDecoder.
|
||||
func (g *AccountGetPasskeysRequest) DecodeBare(b *bin.Buffer) error {
|
||||
if g == nil {
|
||||
return fmt.Errorf("can't decode account.getPasskeys#ea1f0c52 to nil")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// AccountGetPasskeys invokes method account.getPasskeys#ea1f0c52 returning error if any.
|
||||
//
|
||||
// See https://core.telegram.org/method/account.getPasskeys for reference.
|
||||
func (c *Client) AccountGetPasskeys(ctx context.Context) (*AccountPasskeys, error) {
|
||||
var result AccountPasskeys
|
||||
|
||||
request := &AccountGetPasskeysRequest{}
|
||||
if err := c.rpc.Invoke(ctx, request, &result); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &result, nil
|
||||
}
|
||||
+35
@@ -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{}
|
||||
)
|
||||
+141
@@ -0,0 +1,141 @@
|
||||
// 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{}
|
||||
)
|
||||
|
||||
// AccountInitPasskeyRegistrationRequest represents TL type `account.initPasskeyRegistration#429547e8`.
|
||||
//
|
||||
// See https://core.telegram.org/method/account.initPasskeyRegistration for reference.
|
||||
type AccountInitPasskeyRegistrationRequest struct {
|
||||
}
|
||||
|
||||
// AccountInitPasskeyRegistrationRequestTypeID is TL type id of AccountInitPasskeyRegistrationRequest.
|
||||
const AccountInitPasskeyRegistrationRequestTypeID = 0x429547e8
|
||||
|
||||
// Ensuring interfaces in compile-time for AccountInitPasskeyRegistrationRequest.
|
||||
var (
|
||||
_ bin.Encoder = &AccountInitPasskeyRegistrationRequest{}
|
||||
_ bin.Decoder = &AccountInitPasskeyRegistrationRequest{}
|
||||
_ bin.BareEncoder = &AccountInitPasskeyRegistrationRequest{}
|
||||
_ bin.BareDecoder = &AccountInitPasskeyRegistrationRequest{}
|
||||
)
|
||||
|
||||
func (i *AccountInitPasskeyRegistrationRequest) Zero() bool {
|
||||
if i == nil {
|
||||
return true
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
// String implements fmt.Stringer.
|
||||
func (i *AccountInitPasskeyRegistrationRequest) String() string {
|
||||
if i == nil {
|
||||
return "AccountInitPasskeyRegistrationRequest(nil)"
|
||||
}
|
||||
type Alias AccountInitPasskeyRegistrationRequest
|
||||
return fmt.Sprintf("AccountInitPasskeyRegistrationRequest%+v", Alias(*i))
|
||||
}
|
||||
|
||||
// TypeID returns type id in TL schema.
|
||||
//
|
||||
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
||||
func (*AccountInitPasskeyRegistrationRequest) TypeID() uint32 {
|
||||
return AccountInitPasskeyRegistrationRequestTypeID
|
||||
}
|
||||
|
||||
// TypeName returns name of type in TL schema.
|
||||
func (*AccountInitPasskeyRegistrationRequest) TypeName() string {
|
||||
return "account.initPasskeyRegistration"
|
||||
}
|
||||
|
||||
// TypeInfo returns info about TL type.
|
||||
func (i *AccountInitPasskeyRegistrationRequest) TypeInfo() tdp.Type {
|
||||
typ := tdp.Type{
|
||||
Name: "account.initPasskeyRegistration",
|
||||
ID: AccountInitPasskeyRegistrationRequestTypeID,
|
||||
}
|
||||
if i == nil {
|
||||
typ.Null = true
|
||||
return typ
|
||||
}
|
||||
typ.Fields = []tdp.Field{}
|
||||
return typ
|
||||
}
|
||||
|
||||
// Encode implements bin.Encoder.
|
||||
func (i *AccountInitPasskeyRegistrationRequest) Encode(b *bin.Buffer) error {
|
||||
if i == nil {
|
||||
return fmt.Errorf("can't encode account.initPasskeyRegistration#429547e8 as nil")
|
||||
}
|
||||
b.PutID(AccountInitPasskeyRegistrationRequestTypeID)
|
||||
return i.EncodeBare(b)
|
||||
}
|
||||
|
||||
// EncodeBare implements bin.BareEncoder.
|
||||
func (i *AccountInitPasskeyRegistrationRequest) EncodeBare(b *bin.Buffer) error {
|
||||
if i == nil {
|
||||
return fmt.Errorf("can't encode account.initPasskeyRegistration#429547e8 as nil")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Decode implements bin.Decoder.
|
||||
func (i *AccountInitPasskeyRegistrationRequest) Decode(b *bin.Buffer) error {
|
||||
if i == nil {
|
||||
return fmt.Errorf("can't decode account.initPasskeyRegistration#429547e8 to nil")
|
||||
}
|
||||
if err := b.ConsumeID(AccountInitPasskeyRegistrationRequestTypeID); err != nil {
|
||||
return fmt.Errorf("unable to decode account.initPasskeyRegistration#429547e8: %w", err)
|
||||
}
|
||||
return i.DecodeBare(b)
|
||||
}
|
||||
|
||||
// DecodeBare implements bin.BareDecoder.
|
||||
func (i *AccountInitPasskeyRegistrationRequest) DecodeBare(b *bin.Buffer) error {
|
||||
if i == nil {
|
||||
return fmt.Errorf("can't decode account.initPasskeyRegistration#429547e8 to nil")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// AccountInitPasskeyRegistration invokes method account.initPasskeyRegistration#429547e8 returning error if any.
|
||||
//
|
||||
// See https://core.telegram.org/method/account.initPasskeyRegistration for reference.
|
||||
func (c *Client) AccountInitPasskeyRegistration(ctx context.Context) (*AccountPasskeyRegistrationOptions, error) {
|
||||
var result AccountPasskeyRegistrationOptions
|
||||
|
||||
request := &AccountInitPasskeyRegistrationRequest{}
|
||||
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,161 @@
|
||||
// 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{}
|
||||
)
|
||||
|
||||
// AccountPasskeyRegistrationOptions represents TL type `account.passkeyRegistrationOptions#e16b5ce1`.
|
||||
//
|
||||
// See https://core.telegram.org/constructor/account.passkeyRegistrationOptions for reference.
|
||||
type AccountPasskeyRegistrationOptions struct {
|
||||
// Options field of AccountPasskeyRegistrationOptions.
|
||||
Options DataJSON
|
||||
}
|
||||
|
||||
// AccountPasskeyRegistrationOptionsTypeID is TL type id of AccountPasskeyRegistrationOptions.
|
||||
const AccountPasskeyRegistrationOptionsTypeID = 0xe16b5ce1
|
||||
|
||||
// Ensuring interfaces in compile-time for AccountPasskeyRegistrationOptions.
|
||||
var (
|
||||
_ bin.Encoder = &AccountPasskeyRegistrationOptions{}
|
||||
_ bin.Decoder = &AccountPasskeyRegistrationOptions{}
|
||||
_ bin.BareEncoder = &AccountPasskeyRegistrationOptions{}
|
||||
_ bin.BareDecoder = &AccountPasskeyRegistrationOptions{}
|
||||
)
|
||||
|
||||
func (p *AccountPasskeyRegistrationOptions) Zero() bool {
|
||||
if p == nil {
|
||||
return true
|
||||
}
|
||||
if !(p.Options.Zero()) {
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
// String implements fmt.Stringer.
|
||||
func (p *AccountPasskeyRegistrationOptions) String() string {
|
||||
if p == nil {
|
||||
return "AccountPasskeyRegistrationOptions(nil)"
|
||||
}
|
||||
type Alias AccountPasskeyRegistrationOptions
|
||||
return fmt.Sprintf("AccountPasskeyRegistrationOptions%+v", Alias(*p))
|
||||
}
|
||||
|
||||
// FillFrom fills AccountPasskeyRegistrationOptions from given interface.
|
||||
func (p *AccountPasskeyRegistrationOptions) FillFrom(from interface {
|
||||
GetOptions() (value DataJSON)
|
||||
}) {
|
||||
p.Options = from.GetOptions()
|
||||
}
|
||||
|
||||
// TypeID returns type id in TL schema.
|
||||
//
|
||||
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
||||
func (*AccountPasskeyRegistrationOptions) TypeID() uint32 {
|
||||
return AccountPasskeyRegistrationOptionsTypeID
|
||||
}
|
||||
|
||||
// TypeName returns name of type in TL schema.
|
||||
func (*AccountPasskeyRegistrationOptions) TypeName() string {
|
||||
return "account.passkeyRegistrationOptions"
|
||||
}
|
||||
|
||||
// TypeInfo returns info about TL type.
|
||||
func (p *AccountPasskeyRegistrationOptions) TypeInfo() tdp.Type {
|
||||
typ := tdp.Type{
|
||||
Name: "account.passkeyRegistrationOptions",
|
||||
ID: AccountPasskeyRegistrationOptionsTypeID,
|
||||
}
|
||||
if p == nil {
|
||||
typ.Null = true
|
||||
return typ
|
||||
}
|
||||
typ.Fields = []tdp.Field{
|
||||
{
|
||||
Name: "Options",
|
||||
SchemaName: "options",
|
||||
},
|
||||
}
|
||||
return typ
|
||||
}
|
||||
|
||||
// Encode implements bin.Encoder.
|
||||
func (p *AccountPasskeyRegistrationOptions) Encode(b *bin.Buffer) error {
|
||||
if p == nil {
|
||||
return fmt.Errorf("can't encode account.passkeyRegistrationOptions#e16b5ce1 as nil")
|
||||
}
|
||||
b.PutID(AccountPasskeyRegistrationOptionsTypeID)
|
||||
return p.EncodeBare(b)
|
||||
}
|
||||
|
||||
// EncodeBare implements bin.BareEncoder.
|
||||
func (p *AccountPasskeyRegistrationOptions) EncodeBare(b *bin.Buffer) error {
|
||||
if p == nil {
|
||||
return fmt.Errorf("can't encode account.passkeyRegistrationOptions#e16b5ce1 as nil")
|
||||
}
|
||||
if err := p.Options.Encode(b); err != nil {
|
||||
return fmt.Errorf("unable to encode account.passkeyRegistrationOptions#e16b5ce1: field options: %w", err)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Decode implements bin.Decoder.
|
||||
func (p *AccountPasskeyRegistrationOptions) Decode(b *bin.Buffer) error {
|
||||
if p == nil {
|
||||
return fmt.Errorf("can't decode account.passkeyRegistrationOptions#e16b5ce1 to nil")
|
||||
}
|
||||
if err := b.ConsumeID(AccountPasskeyRegistrationOptionsTypeID); err != nil {
|
||||
return fmt.Errorf("unable to decode account.passkeyRegistrationOptions#e16b5ce1: %w", err)
|
||||
}
|
||||
return p.DecodeBare(b)
|
||||
}
|
||||
|
||||
// DecodeBare implements bin.BareDecoder.
|
||||
func (p *AccountPasskeyRegistrationOptions) DecodeBare(b *bin.Buffer) error {
|
||||
if p == nil {
|
||||
return fmt.Errorf("can't decode account.passkeyRegistrationOptions#e16b5ce1 to nil")
|
||||
}
|
||||
{
|
||||
if err := p.Options.Decode(b); err != nil {
|
||||
return fmt.Errorf("unable to decode account.passkeyRegistrationOptions#e16b5ce1: field options: %w", err)
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// GetOptions returns value of Options field.
|
||||
func (p *AccountPasskeyRegistrationOptions) GetOptions() (value DataJSON) {
|
||||
if p == nil {
|
||||
return
|
||||
}
|
||||
return p.Options
|
||||
}
|
||||
@@ -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{}
|
||||
)
|
||||
Generated
+176
@@ -0,0 +1,176 @@
|
||||
// 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{}
|
||||
)
|
||||
|
||||
// AccountPasskeys represents TL type `account.passkeys#f8e0aa1c`.
|
||||
//
|
||||
// See https://core.telegram.org/constructor/account.passkeys for reference.
|
||||
type AccountPasskeys struct {
|
||||
// Passkeys field of AccountPasskeys.
|
||||
Passkeys []Passkey
|
||||
}
|
||||
|
||||
// AccountPasskeysTypeID is TL type id of AccountPasskeys.
|
||||
const AccountPasskeysTypeID = 0xf8e0aa1c
|
||||
|
||||
// Ensuring interfaces in compile-time for AccountPasskeys.
|
||||
var (
|
||||
_ bin.Encoder = &AccountPasskeys{}
|
||||
_ bin.Decoder = &AccountPasskeys{}
|
||||
_ bin.BareEncoder = &AccountPasskeys{}
|
||||
_ bin.BareDecoder = &AccountPasskeys{}
|
||||
)
|
||||
|
||||
func (p *AccountPasskeys) Zero() bool {
|
||||
if p == nil {
|
||||
return true
|
||||
}
|
||||
if !(p.Passkeys == nil) {
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
// String implements fmt.Stringer.
|
||||
func (p *AccountPasskeys) String() string {
|
||||
if p == nil {
|
||||
return "AccountPasskeys(nil)"
|
||||
}
|
||||
type Alias AccountPasskeys
|
||||
return fmt.Sprintf("AccountPasskeys%+v", Alias(*p))
|
||||
}
|
||||
|
||||
// FillFrom fills AccountPasskeys from given interface.
|
||||
func (p *AccountPasskeys) FillFrom(from interface {
|
||||
GetPasskeys() (value []Passkey)
|
||||
}) {
|
||||
p.Passkeys = from.GetPasskeys()
|
||||
}
|
||||
|
||||
// TypeID returns type id in TL schema.
|
||||
//
|
||||
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
||||
func (*AccountPasskeys) TypeID() uint32 {
|
||||
return AccountPasskeysTypeID
|
||||
}
|
||||
|
||||
// TypeName returns name of type in TL schema.
|
||||
func (*AccountPasskeys) TypeName() string {
|
||||
return "account.passkeys"
|
||||
}
|
||||
|
||||
// TypeInfo returns info about TL type.
|
||||
func (p *AccountPasskeys) TypeInfo() tdp.Type {
|
||||
typ := tdp.Type{
|
||||
Name: "account.passkeys",
|
||||
ID: AccountPasskeysTypeID,
|
||||
}
|
||||
if p == nil {
|
||||
typ.Null = true
|
||||
return typ
|
||||
}
|
||||
typ.Fields = []tdp.Field{
|
||||
{
|
||||
Name: "Passkeys",
|
||||
SchemaName: "passkeys",
|
||||
},
|
||||
}
|
||||
return typ
|
||||
}
|
||||
|
||||
// Encode implements bin.Encoder.
|
||||
func (p *AccountPasskeys) Encode(b *bin.Buffer) error {
|
||||
if p == nil {
|
||||
return fmt.Errorf("can't encode account.passkeys#f8e0aa1c as nil")
|
||||
}
|
||||
b.PutID(AccountPasskeysTypeID)
|
||||
return p.EncodeBare(b)
|
||||
}
|
||||
|
||||
// EncodeBare implements bin.BareEncoder.
|
||||
func (p *AccountPasskeys) EncodeBare(b *bin.Buffer) error {
|
||||
if p == nil {
|
||||
return fmt.Errorf("can't encode account.passkeys#f8e0aa1c as nil")
|
||||
}
|
||||
b.PutVectorHeader(len(p.Passkeys))
|
||||
for idx, v := range p.Passkeys {
|
||||
if err := v.Encode(b); err != nil {
|
||||
return fmt.Errorf("unable to encode account.passkeys#f8e0aa1c: field passkeys element with index %d: %w", idx, err)
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Decode implements bin.Decoder.
|
||||
func (p *AccountPasskeys) Decode(b *bin.Buffer) error {
|
||||
if p == nil {
|
||||
return fmt.Errorf("can't decode account.passkeys#f8e0aa1c to nil")
|
||||
}
|
||||
if err := b.ConsumeID(AccountPasskeysTypeID); err != nil {
|
||||
return fmt.Errorf("unable to decode account.passkeys#f8e0aa1c: %w", err)
|
||||
}
|
||||
return p.DecodeBare(b)
|
||||
}
|
||||
|
||||
// DecodeBare implements bin.BareDecoder.
|
||||
func (p *AccountPasskeys) DecodeBare(b *bin.Buffer) error {
|
||||
if p == nil {
|
||||
return fmt.Errorf("can't decode account.passkeys#f8e0aa1c to nil")
|
||||
}
|
||||
{
|
||||
headerLen, err := b.VectorHeader()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode account.passkeys#f8e0aa1c: field passkeys: %w", err)
|
||||
}
|
||||
|
||||
if headerLen > 0 {
|
||||
p.Passkeys = make([]Passkey, 0, headerLen%bin.PreallocateLimit)
|
||||
}
|
||||
for idx := 0; idx < headerLen; idx++ {
|
||||
var value Passkey
|
||||
if err := value.Decode(b); err != nil {
|
||||
return fmt.Errorf("unable to decode account.passkeys#f8e0aa1c: field passkeys: %w", err)
|
||||
}
|
||||
p.Passkeys = append(p.Passkeys, value)
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// GetPasskeys returns value of Passkeys field.
|
||||
func (p *AccountPasskeys) GetPasskeys() (value []Passkey) {
|
||||
if p == nil {
|
||||
return
|
||||
}
|
||||
return p.Passkeys
|
||||
}
|
||||
+35
@@ -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{}
|
||||
)
|
||||
+181
@@ -0,0 +1,181 @@
|
||||
// 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{}
|
||||
)
|
||||
|
||||
// AccountRegisterPasskeyRequest represents TL type `account.registerPasskey#55b41fd6`.
|
||||
//
|
||||
// See https://core.telegram.org/method/account.registerPasskey for reference.
|
||||
type AccountRegisterPasskeyRequest struct {
|
||||
// Credential field of AccountRegisterPasskeyRequest.
|
||||
Credential InputPasskeyCredentialClass
|
||||
}
|
||||
|
||||
// AccountRegisterPasskeyRequestTypeID is TL type id of AccountRegisterPasskeyRequest.
|
||||
const AccountRegisterPasskeyRequestTypeID = 0x55b41fd6
|
||||
|
||||
// Ensuring interfaces in compile-time for AccountRegisterPasskeyRequest.
|
||||
var (
|
||||
_ bin.Encoder = &AccountRegisterPasskeyRequest{}
|
||||
_ bin.Decoder = &AccountRegisterPasskeyRequest{}
|
||||
_ bin.BareEncoder = &AccountRegisterPasskeyRequest{}
|
||||
_ bin.BareDecoder = &AccountRegisterPasskeyRequest{}
|
||||
)
|
||||
|
||||
func (r *AccountRegisterPasskeyRequest) Zero() bool {
|
||||
if r == nil {
|
||||
return true
|
||||
}
|
||||
if !(r.Credential == nil) {
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
// String implements fmt.Stringer.
|
||||
func (r *AccountRegisterPasskeyRequest) String() string {
|
||||
if r == nil {
|
||||
return "AccountRegisterPasskeyRequest(nil)"
|
||||
}
|
||||
type Alias AccountRegisterPasskeyRequest
|
||||
return fmt.Sprintf("AccountRegisterPasskeyRequest%+v", Alias(*r))
|
||||
}
|
||||
|
||||
// FillFrom fills AccountRegisterPasskeyRequest from given interface.
|
||||
func (r *AccountRegisterPasskeyRequest) FillFrom(from interface {
|
||||
GetCredential() (value InputPasskeyCredentialClass)
|
||||
}) {
|
||||
r.Credential = from.GetCredential()
|
||||
}
|
||||
|
||||
// TypeID returns type id in TL schema.
|
||||
//
|
||||
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
||||
func (*AccountRegisterPasskeyRequest) TypeID() uint32 {
|
||||
return AccountRegisterPasskeyRequestTypeID
|
||||
}
|
||||
|
||||
// TypeName returns name of type in TL schema.
|
||||
func (*AccountRegisterPasskeyRequest) TypeName() string {
|
||||
return "account.registerPasskey"
|
||||
}
|
||||
|
||||
// TypeInfo returns info about TL type.
|
||||
func (r *AccountRegisterPasskeyRequest) TypeInfo() tdp.Type {
|
||||
typ := tdp.Type{
|
||||
Name: "account.registerPasskey",
|
||||
ID: AccountRegisterPasskeyRequestTypeID,
|
||||
}
|
||||
if r == nil {
|
||||
typ.Null = true
|
||||
return typ
|
||||
}
|
||||
typ.Fields = []tdp.Field{
|
||||
{
|
||||
Name: "Credential",
|
||||
SchemaName: "credential",
|
||||
},
|
||||
}
|
||||
return typ
|
||||
}
|
||||
|
||||
// Encode implements bin.Encoder.
|
||||
func (r *AccountRegisterPasskeyRequest) Encode(b *bin.Buffer) error {
|
||||
if r == nil {
|
||||
return fmt.Errorf("can't encode account.registerPasskey#55b41fd6 as nil")
|
||||
}
|
||||
b.PutID(AccountRegisterPasskeyRequestTypeID)
|
||||
return r.EncodeBare(b)
|
||||
}
|
||||
|
||||
// EncodeBare implements bin.BareEncoder.
|
||||
func (r *AccountRegisterPasskeyRequest) EncodeBare(b *bin.Buffer) error {
|
||||
if r == nil {
|
||||
return fmt.Errorf("can't encode account.registerPasskey#55b41fd6 as nil")
|
||||
}
|
||||
if r.Credential == nil {
|
||||
return fmt.Errorf("unable to encode account.registerPasskey#55b41fd6: field credential is nil")
|
||||
}
|
||||
if err := r.Credential.Encode(b); err != nil {
|
||||
return fmt.Errorf("unable to encode account.registerPasskey#55b41fd6: field credential: %w", err)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Decode implements bin.Decoder.
|
||||
func (r *AccountRegisterPasskeyRequest) Decode(b *bin.Buffer) error {
|
||||
if r == nil {
|
||||
return fmt.Errorf("can't decode account.registerPasskey#55b41fd6 to nil")
|
||||
}
|
||||
if err := b.ConsumeID(AccountRegisterPasskeyRequestTypeID); err != nil {
|
||||
return fmt.Errorf("unable to decode account.registerPasskey#55b41fd6: %w", err)
|
||||
}
|
||||
return r.DecodeBare(b)
|
||||
}
|
||||
|
||||
// DecodeBare implements bin.BareDecoder.
|
||||
func (r *AccountRegisterPasskeyRequest) DecodeBare(b *bin.Buffer) error {
|
||||
if r == nil {
|
||||
return fmt.Errorf("can't decode account.registerPasskey#55b41fd6 to nil")
|
||||
}
|
||||
{
|
||||
value, err := DecodeInputPasskeyCredential(b)
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode account.registerPasskey#55b41fd6: field credential: %w", err)
|
||||
}
|
||||
r.Credential = value
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// GetCredential returns value of Credential field.
|
||||
func (r *AccountRegisterPasskeyRequest) GetCredential() (value InputPasskeyCredentialClass) {
|
||||
if r == nil {
|
||||
return
|
||||
}
|
||||
return r.Credential
|
||||
}
|
||||
|
||||
// AccountRegisterPasskey invokes method account.registerPasskey#55b41fd6 returning error if any.
|
||||
//
|
||||
// See https://core.telegram.org/method/account.registerPasskey for reference.
|
||||
func (c *Client) AccountRegisterPasskey(ctx context.Context, credential InputPasskeyCredentialClass) (*Passkey, error) {
|
||||
var result Passkey
|
||||
|
||||
request := &AccountRegisterPasskeyRequest{
|
||||
Credential: credential,
|
||||
}
|
||||
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{}
|
||||
)
|
||||
+292
@@ -0,0 +1,292 @@
|
||||
// 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{}
|
||||
)
|
||||
|
||||
// AuthFinishPasskeyLoginRequest represents TL type `auth.finishPasskeyLogin#9857ad07`.
|
||||
//
|
||||
// See https://core.telegram.org/method/auth.finishPasskeyLogin for reference.
|
||||
type AuthFinishPasskeyLoginRequest struct {
|
||||
// Flags field of AuthFinishPasskeyLoginRequest.
|
||||
Flags bin.Fields
|
||||
// Credential field of AuthFinishPasskeyLoginRequest.
|
||||
Credential InputPasskeyCredentialClass
|
||||
// FromDCID field of AuthFinishPasskeyLoginRequest.
|
||||
//
|
||||
// Use SetFromDCID and GetFromDCID helpers.
|
||||
FromDCID int
|
||||
// FromAuthKeyID field of AuthFinishPasskeyLoginRequest.
|
||||
//
|
||||
// Use SetFromAuthKeyID and GetFromAuthKeyID helpers.
|
||||
FromAuthKeyID int64
|
||||
}
|
||||
|
||||
// AuthFinishPasskeyLoginRequestTypeID is TL type id of AuthFinishPasskeyLoginRequest.
|
||||
const AuthFinishPasskeyLoginRequestTypeID = 0x9857ad07
|
||||
|
||||
// Ensuring interfaces in compile-time for AuthFinishPasskeyLoginRequest.
|
||||
var (
|
||||
_ bin.Encoder = &AuthFinishPasskeyLoginRequest{}
|
||||
_ bin.Decoder = &AuthFinishPasskeyLoginRequest{}
|
||||
_ bin.BareEncoder = &AuthFinishPasskeyLoginRequest{}
|
||||
_ bin.BareDecoder = &AuthFinishPasskeyLoginRequest{}
|
||||
)
|
||||
|
||||
func (f *AuthFinishPasskeyLoginRequest) Zero() bool {
|
||||
if f == nil {
|
||||
return true
|
||||
}
|
||||
if !(f.Flags.Zero()) {
|
||||
return false
|
||||
}
|
||||
if !(f.Credential == nil) {
|
||||
return false
|
||||
}
|
||||
if !(f.FromDCID == 0) {
|
||||
return false
|
||||
}
|
||||
if !(f.FromAuthKeyID == 0) {
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
// String implements fmt.Stringer.
|
||||
func (f *AuthFinishPasskeyLoginRequest) String() string {
|
||||
if f == nil {
|
||||
return "AuthFinishPasskeyLoginRequest(nil)"
|
||||
}
|
||||
type Alias AuthFinishPasskeyLoginRequest
|
||||
return fmt.Sprintf("AuthFinishPasskeyLoginRequest%+v", Alias(*f))
|
||||
}
|
||||
|
||||
// FillFrom fills AuthFinishPasskeyLoginRequest from given interface.
|
||||
func (f *AuthFinishPasskeyLoginRequest) FillFrom(from interface {
|
||||
GetCredential() (value InputPasskeyCredentialClass)
|
||||
GetFromDCID() (value int, ok bool)
|
||||
GetFromAuthKeyID() (value int64, ok bool)
|
||||
}) {
|
||||
f.Credential = from.GetCredential()
|
||||
if val, ok := from.GetFromDCID(); ok {
|
||||
f.FromDCID = val
|
||||
}
|
||||
|
||||
if val, ok := from.GetFromAuthKeyID(); ok {
|
||||
f.FromAuthKeyID = val
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// TypeID returns type id in TL schema.
|
||||
//
|
||||
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
||||
func (*AuthFinishPasskeyLoginRequest) TypeID() uint32 {
|
||||
return AuthFinishPasskeyLoginRequestTypeID
|
||||
}
|
||||
|
||||
// TypeName returns name of type in TL schema.
|
||||
func (*AuthFinishPasskeyLoginRequest) TypeName() string {
|
||||
return "auth.finishPasskeyLogin"
|
||||
}
|
||||
|
||||
// TypeInfo returns info about TL type.
|
||||
func (f *AuthFinishPasskeyLoginRequest) TypeInfo() tdp.Type {
|
||||
typ := tdp.Type{
|
||||
Name: "auth.finishPasskeyLogin",
|
||||
ID: AuthFinishPasskeyLoginRequestTypeID,
|
||||
}
|
||||
if f == nil {
|
||||
typ.Null = true
|
||||
return typ
|
||||
}
|
||||
typ.Fields = []tdp.Field{
|
||||
{
|
||||
Name: "Credential",
|
||||
SchemaName: "credential",
|
||||
},
|
||||
{
|
||||
Name: "FromDCID",
|
||||
SchemaName: "from_dc_id",
|
||||
Null: !f.Flags.Has(0),
|
||||
},
|
||||
{
|
||||
Name: "FromAuthKeyID",
|
||||
SchemaName: "from_auth_key_id",
|
||||
Null: !f.Flags.Has(0),
|
||||
},
|
||||
}
|
||||
return typ
|
||||
}
|
||||
|
||||
// SetFlags sets flags for non-zero fields.
|
||||
func (f *AuthFinishPasskeyLoginRequest) SetFlags() {
|
||||
if !(f.FromDCID == 0) {
|
||||
f.Flags.Set(0)
|
||||
}
|
||||
if !(f.FromAuthKeyID == 0) {
|
||||
f.Flags.Set(0)
|
||||
}
|
||||
}
|
||||
|
||||
// Encode implements bin.Encoder.
|
||||
func (f *AuthFinishPasskeyLoginRequest) Encode(b *bin.Buffer) error {
|
||||
if f == nil {
|
||||
return fmt.Errorf("can't encode auth.finishPasskeyLogin#9857ad07 as nil")
|
||||
}
|
||||
b.PutID(AuthFinishPasskeyLoginRequestTypeID)
|
||||
return f.EncodeBare(b)
|
||||
}
|
||||
|
||||
// EncodeBare implements bin.BareEncoder.
|
||||
func (f *AuthFinishPasskeyLoginRequest) EncodeBare(b *bin.Buffer) error {
|
||||
if f == nil {
|
||||
return fmt.Errorf("can't encode auth.finishPasskeyLogin#9857ad07 as nil")
|
||||
}
|
||||
f.SetFlags()
|
||||
if err := f.Flags.Encode(b); err != nil {
|
||||
return fmt.Errorf("unable to encode auth.finishPasskeyLogin#9857ad07: field flags: %w", err)
|
||||
}
|
||||
if f.Credential == nil {
|
||||
return fmt.Errorf("unable to encode auth.finishPasskeyLogin#9857ad07: field credential is nil")
|
||||
}
|
||||
if err := f.Credential.Encode(b); err != nil {
|
||||
return fmt.Errorf("unable to encode auth.finishPasskeyLogin#9857ad07: field credential: %w", err)
|
||||
}
|
||||
if f.Flags.Has(0) {
|
||||
b.PutInt(f.FromDCID)
|
||||
}
|
||||
if f.Flags.Has(0) {
|
||||
b.PutLong(f.FromAuthKeyID)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Decode implements bin.Decoder.
|
||||
func (f *AuthFinishPasskeyLoginRequest) Decode(b *bin.Buffer) error {
|
||||
if f == nil {
|
||||
return fmt.Errorf("can't decode auth.finishPasskeyLogin#9857ad07 to nil")
|
||||
}
|
||||
if err := b.ConsumeID(AuthFinishPasskeyLoginRequestTypeID); err != nil {
|
||||
return fmt.Errorf("unable to decode auth.finishPasskeyLogin#9857ad07: %w", err)
|
||||
}
|
||||
return f.DecodeBare(b)
|
||||
}
|
||||
|
||||
// DecodeBare implements bin.BareDecoder.
|
||||
func (f *AuthFinishPasskeyLoginRequest) DecodeBare(b *bin.Buffer) error {
|
||||
if f == nil {
|
||||
return fmt.Errorf("can't decode auth.finishPasskeyLogin#9857ad07 to nil")
|
||||
}
|
||||
{
|
||||
if err := f.Flags.Decode(b); err != nil {
|
||||
return fmt.Errorf("unable to decode auth.finishPasskeyLogin#9857ad07: field flags: %w", err)
|
||||
}
|
||||
}
|
||||
{
|
||||
value, err := DecodeInputPasskeyCredential(b)
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode auth.finishPasskeyLogin#9857ad07: field credential: %w", err)
|
||||
}
|
||||
f.Credential = value
|
||||
}
|
||||
if f.Flags.Has(0) {
|
||||
value, err := b.Int()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode auth.finishPasskeyLogin#9857ad07: field from_dc_id: %w", err)
|
||||
}
|
||||
f.FromDCID = value
|
||||
}
|
||||
if f.Flags.Has(0) {
|
||||
value, err := b.Long()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode auth.finishPasskeyLogin#9857ad07: field from_auth_key_id: %w", err)
|
||||
}
|
||||
f.FromAuthKeyID = value
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// GetCredential returns value of Credential field.
|
||||
func (f *AuthFinishPasskeyLoginRequest) GetCredential() (value InputPasskeyCredentialClass) {
|
||||
if f == nil {
|
||||
return
|
||||
}
|
||||
return f.Credential
|
||||
}
|
||||
|
||||
// SetFromDCID sets value of FromDCID conditional field.
|
||||
func (f *AuthFinishPasskeyLoginRequest) SetFromDCID(value int) {
|
||||
f.Flags.Set(0)
|
||||
f.FromDCID = value
|
||||
}
|
||||
|
||||
// GetFromDCID returns value of FromDCID conditional field and
|
||||
// boolean which is true if field was set.
|
||||
func (f *AuthFinishPasskeyLoginRequest) GetFromDCID() (value int, ok bool) {
|
||||
if f == nil {
|
||||
return
|
||||
}
|
||||
if !f.Flags.Has(0) {
|
||||
return value, false
|
||||
}
|
||||
return f.FromDCID, true
|
||||
}
|
||||
|
||||
// SetFromAuthKeyID sets value of FromAuthKeyID conditional field.
|
||||
func (f *AuthFinishPasskeyLoginRequest) SetFromAuthKeyID(value int64) {
|
||||
f.Flags.Set(0)
|
||||
f.FromAuthKeyID = value
|
||||
}
|
||||
|
||||
// GetFromAuthKeyID returns value of FromAuthKeyID conditional field and
|
||||
// boolean which is true if field was set.
|
||||
func (f *AuthFinishPasskeyLoginRequest) GetFromAuthKeyID() (value int64, ok bool) {
|
||||
if f == nil {
|
||||
return
|
||||
}
|
||||
if !f.Flags.Has(0) {
|
||||
return value, false
|
||||
}
|
||||
return f.FromAuthKeyID, true
|
||||
}
|
||||
|
||||
// AuthFinishPasskeyLogin invokes method auth.finishPasskeyLogin#9857ad07 returning error if any.
|
||||
//
|
||||
// See https://core.telegram.org/method/auth.finishPasskeyLogin for reference.
|
||||
func (c *Client) AuthFinishPasskeyLogin(ctx context.Context, request *AuthFinishPasskeyLoginRequest) (AuthAuthorizationClass, error) {
|
||||
var result AuthAuthorizationBox
|
||||
|
||||
if err := c.rpc.Invoke(ctx, request, &result); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return result.Authorization, 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{}
|
||||
)
|
||||
+200
@@ -0,0 +1,200 @@
|
||||
// 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{}
|
||||
)
|
||||
|
||||
// AuthInitPasskeyLoginRequest represents TL type `auth.initPasskeyLogin#518ad0b7`.
|
||||
//
|
||||
// See https://core.telegram.org/method/auth.initPasskeyLogin for reference.
|
||||
type AuthInitPasskeyLoginRequest struct {
|
||||
// APIID field of AuthInitPasskeyLoginRequest.
|
||||
APIID int
|
||||
// APIHash field of AuthInitPasskeyLoginRequest.
|
||||
APIHash string
|
||||
}
|
||||
|
||||
// AuthInitPasskeyLoginRequestTypeID is TL type id of AuthInitPasskeyLoginRequest.
|
||||
const AuthInitPasskeyLoginRequestTypeID = 0x518ad0b7
|
||||
|
||||
// Ensuring interfaces in compile-time for AuthInitPasskeyLoginRequest.
|
||||
var (
|
||||
_ bin.Encoder = &AuthInitPasskeyLoginRequest{}
|
||||
_ bin.Decoder = &AuthInitPasskeyLoginRequest{}
|
||||
_ bin.BareEncoder = &AuthInitPasskeyLoginRequest{}
|
||||
_ bin.BareDecoder = &AuthInitPasskeyLoginRequest{}
|
||||
)
|
||||
|
||||
func (i *AuthInitPasskeyLoginRequest) Zero() bool {
|
||||
if i == nil {
|
||||
return true
|
||||
}
|
||||
if !(i.APIID == 0) {
|
||||
return false
|
||||
}
|
||||
if !(i.APIHash == "") {
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
// String implements fmt.Stringer.
|
||||
func (i *AuthInitPasskeyLoginRequest) String() string {
|
||||
if i == nil {
|
||||
return "AuthInitPasskeyLoginRequest(nil)"
|
||||
}
|
||||
type Alias AuthInitPasskeyLoginRequest
|
||||
return fmt.Sprintf("AuthInitPasskeyLoginRequest%+v", Alias(*i))
|
||||
}
|
||||
|
||||
// FillFrom fills AuthInitPasskeyLoginRequest from given interface.
|
||||
func (i *AuthInitPasskeyLoginRequest) FillFrom(from interface {
|
||||
GetAPIID() (value int)
|
||||
GetAPIHash() (value string)
|
||||
}) {
|
||||
i.APIID = from.GetAPIID()
|
||||
i.APIHash = from.GetAPIHash()
|
||||
}
|
||||
|
||||
// TypeID returns type id in TL schema.
|
||||
//
|
||||
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
||||
func (*AuthInitPasskeyLoginRequest) TypeID() uint32 {
|
||||
return AuthInitPasskeyLoginRequestTypeID
|
||||
}
|
||||
|
||||
// TypeName returns name of type in TL schema.
|
||||
func (*AuthInitPasskeyLoginRequest) TypeName() string {
|
||||
return "auth.initPasskeyLogin"
|
||||
}
|
||||
|
||||
// TypeInfo returns info about TL type.
|
||||
func (i *AuthInitPasskeyLoginRequest) TypeInfo() tdp.Type {
|
||||
typ := tdp.Type{
|
||||
Name: "auth.initPasskeyLogin",
|
||||
ID: AuthInitPasskeyLoginRequestTypeID,
|
||||
}
|
||||
if i == nil {
|
||||
typ.Null = true
|
||||
return typ
|
||||
}
|
||||
typ.Fields = []tdp.Field{
|
||||
{
|
||||
Name: "APIID",
|
||||
SchemaName: "api_id",
|
||||
},
|
||||
{
|
||||
Name: "APIHash",
|
||||
SchemaName: "api_hash",
|
||||
},
|
||||
}
|
||||
return typ
|
||||
}
|
||||
|
||||
// Encode implements bin.Encoder.
|
||||
func (i *AuthInitPasskeyLoginRequest) Encode(b *bin.Buffer) error {
|
||||
if i == nil {
|
||||
return fmt.Errorf("can't encode auth.initPasskeyLogin#518ad0b7 as nil")
|
||||
}
|
||||
b.PutID(AuthInitPasskeyLoginRequestTypeID)
|
||||
return i.EncodeBare(b)
|
||||
}
|
||||
|
||||
// EncodeBare implements bin.BareEncoder.
|
||||
func (i *AuthInitPasskeyLoginRequest) EncodeBare(b *bin.Buffer) error {
|
||||
if i == nil {
|
||||
return fmt.Errorf("can't encode auth.initPasskeyLogin#518ad0b7 as nil")
|
||||
}
|
||||
b.PutInt(i.APIID)
|
||||
b.PutString(i.APIHash)
|
||||
return nil
|
||||
}
|
||||
|
||||
// Decode implements bin.Decoder.
|
||||
func (i *AuthInitPasskeyLoginRequest) Decode(b *bin.Buffer) error {
|
||||
if i == nil {
|
||||
return fmt.Errorf("can't decode auth.initPasskeyLogin#518ad0b7 to nil")
|
||||
}
|
||||
if err := b.ConsumeID(AuthInitPasskeyLoginRequestTypeID); err != nil {
|
||||
return fmt.Errorf("unable to decode auth.initPasskeyLogin#518ad0b7: %w", err)
|
||||
}
|
||||
return i.DecodeBare(b)
|
||||
}
|
||||
|
||||
// DecodeBare implements bin.BareDecoder.
|
||||
func (i *AuthInitPasskeyLoginRequest) DecodeBare(b *bin.Buffer) error {
|
||||
if i == nil {
|
||||
return fmt.Errorf("can't decode auth.initPasskeyLogin#518ad0b7 to nil")
|
||||
}
|
||||
{
|
||||
value, err := b.Int()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode auth.initPasskeyLogin#518ad0b7: field api_id: %w", err)
|
||||
}
|
||||
i.APIID = value
|
||||
}
|
||||
{
|
||||
value, err := b.String()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode auth.initPasskeyLogin#518ad0b7: field api_hash: %w", err)
|
||||
}
|
||||
i.APIHash = value
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// GetAPIID returns value of APIID field.
|
||||
func (i *AuthInitPasskeyLoginRequest) GetAPIID() (value int) {
|
||||
if i == nil {
|
||||
return
|
||||
}
|
||||
return i.APIID
|
||||
}
|
||||
|
||||
// GetAPIHash returns value of APIHash field.
|
||||
func (i *AuthInitPasskeyLoginRequest) GetAPIHash() (value string) {
|
||||
if i == nil {
|
||||
return
|
||||
}
|
||||
return i.APIHash
|
||||
}
|
||||
|
||||
// AuthInitPasskeyLogin invokes method auth.initPasskeyLogin#518ad0b7 returning error if any.
|
||||
//
|
||||
// See https://core.telegram.org/method/auth.initPasskeyLogin for reference.
|
||||
func (c *Client) AuthInitPasskeyLogin(ctx context.Context, request *AuthInitPasskeyLoginRequest) (*AuthPasskeyLoginOptions, error) {
|
||||
var result AuthPasskeyLoginOptions
|
||||
|
||||
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{}
|
||||
)
|
||||
+161
@@ -0,0 +1,161 @@
|
||||
// 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{}
|
||||
)
|
||||
|
||||
// AuthPasskeyLoginOptions represents TL type `auth.passkeyLoginOptions#e2037789`.
|
||||
//
|
||||
// See https://core.telegram.org/constructor/auth.passkeyLoginOptions for reference.
|
||||
type AuthPasskeyLoginOptions struct {
|
||||
// Options field of AuthPasskeyLoginOptions.
|
||||
Options DataJSON
|
||||
}
|
||||
|
||||
// AuthPasskeyLoginOptionsTypeID is TL type id of AuthPasskeyLoginOptions.
|
||||
const AuthPasskeyLoginOptionsTypeID = 0xe2037789
|
||||
|
||||
// Ensuring interfaces in compile-time for AuthPasskeyLoginOptions.
|
||||
var (
|
||||
_ bin.Encoder = &AuthPasskeyLoginOptions{}
|
||||
_ bin.Decoder = &AuthPasskeyLoginOptions{}
|
||||
_ bin.BareEncoder = &AuthPasskeyLoginOptions{}
|
||||
_ bin.BareDecoder = &AuthPasskeyLoginOptions{}
|
||||
)
|
||||
|
||||
func (p *AuthPasskeyLoginOptions) Zero() bool {
|
||||
if p == nil {
|
||||
return true
|
||||
}
|
||||
if !(p.Options.Zero()) {
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
// String implements fmt.Stringer.
|
||||
func (p *AuthPasskeyLoginOptions) String() string {
|
||||
if p == nil {
|
||||
return "AuthPasskeyLoginOptions(nil)"
|
||||
}
|
||||
type Alias AuthPasskeyLoginOptions
|
||||
return fmt.Sprintf("AuthPasskeyLoginOptions%+v", Alias(*p))
|
||||
}
|
||||
|
||||
// FillFrom fills AuthPasskeyLoginOptions from given interface.
|
||||
func (p *AuthPasskeyLoginOptions) FillFrom(from interface {
|
||||
GetOptions() (value DataJSON)
|
||||
}) {
|
||||
p.Options = from.GetOptions()
|
||||
}
|
||||
|
||||
// TypeID returns type id in TL schema.
|
||||
//
|
||||
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
||||
func (*AuthPasskeyLoginOptions) TypeID() uint32 {
|
||||
return AuthPasskeyLoginOptionsTypeID
|
||||
}
|
||||
|
||||
// TypeName returns name of type in TL schema.
|
||||
func (*AuthPasskeyLoginOptions) TypeName() string {
|
||||
return "auth.passkeyLoginOptions"
|
||||
}
|
||||
|
||||
// TypeInfo returns info about TL type.
|
||||
func (p *AuthPasskeyLoginOptions) TypeInfo() tdp.Type {
|
||||
typ := tdp.Type{
|
||||
Name: "auth.passkeyLoginOptions",
|
||||
ID: AuthPasskeyLoginOptionsTypeID,
|
||||
}
|
||||
if p == nil {
|
||||
typ.Null = true
|
||||
return typ
|
||||
}
|
||||
typ.Fields = []tdp.Field{
|
||||
{
|
||||
Name: "Options",
|
||||
SchemaName: "options",
|
||||
},
|
||||
}
|
||||
return typ
|
||||
}
|
||||
|
||||
// Encode implements bin.Encoder.
|
||||
func (p *AuthPasskeyLoginOptions) Encode(b *bin.Buffer) error {
|
||||
if p == nil {
|
||||
return fmt.Errorf("can't encode auth.passkeyLoginOptions#e2037789 as nil")
|
||||
}
|
||||
b.PutID(AuthPasskeyLoginOptionsTypeID)
|
||||
return p.EncodeBare(b)
|
||||
}
|
||||
|
||||
// EncodeBare implements bin.BareEncoder.
|
||||
func (p *AuthPasskeyLoginOptions) EncodeBare(b *bin.Buffer) error {
|
||||
if p == nil {
|
||||
return fmt.Errorf("can't encode auth.passkeyLoginOptions#e2037789 as nil")
|
||||
}
|
||||
if err := p.Options.Encode(b); err != nil {
|
||||
return fmt.Errorf("unable to encode auth.passkeyLoginOptions#e2037789: field options: %w", err)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Decode implements bin.Decoder.
|
||||
func (p *AuthPasskeyLoginOptions) Decode(b *bin.Buffer) error {
|
||||
if p == nil {
|
||||
return fmt.Errorf("can't decode auth.passkeyLoginOptions#e2037789 to nil")
|
||||
}
|
||||
if err := b.ConsumeID(AuthPasskeyLoginOptionsTypeID); err != nil {
|
||||
return fmt.Errorf("unable to decode auth.passkeyLoginOptions#e2037789: %w", err)
|
||||
}
|
||||
return p.DecodeBare(b)
|
||||
}
|
||||
|
||||
// DecodeBare implements bin.BareDecoder.
|
||||
func (p *AuthPasskeyLoginOptions) DecodeBare(b *bin.Buffer) error {
|
||||
if p == nil {
|
||||
return fmt.Errorf("can't decode auth.passkeyLoginOptions#e2037789 to nil")
|
||||
}
|
||||
{
|
||||
if err := p.Options.Decode(b); err != nil {
|
||||
return fmt.Errorf("unable to decode auth.passkeyLoginOptions#e2037789: field options: %w", err)
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// GetOptions returns value of Options field.
|
||||
func (p *AuthPasskeyLoginOptions) GetOptions() (value DataJSON) {
|
||||
if p == nil {
|
||||
return
|
||||
}
|
||||
return p.Options
|
||||
}
|
||||
@@ -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{}
|
||||
)
|
||||
+198
@@ -8056,6 +8056,196 @@ func (c *ChannelAdminLogEventActionToggleAutotranslation) GetNewValue() (value b
|
||||
return c.NewValue
|
||||
}
|
||||
|
||||
// ChannelAdminLogEventActionParticipantEditRank represents TL type `channelAdminLogEventActionParticipantEditRank#5806b4ec`.
|
||||
//
|
||||
// See https://core.telegram.org/constructor/channelAdminLogEventActionParticipantEditRank for reference.
|
||||
type ChannelAdminLogEventActionParticipantEditRank struct {
|
||||
// UserID field of ChannelAdminLogEventActionParticipantEditRank.
|
||||
UserID int64
|
||||
// PrevRank field of ChannelAdminLogEventActionParticipantEditRank.
|
||||
PrevRank string
|
||||
// NewRank field of ChannelAdminLogEventActionParticipantEditRank.
|
||||
NewRank string
|
||||
}
|
||||
|
||||
// ChannelAdminLogEventActionParticipantEditRankTypeID is TL type id of ChannelAdminLogEventActionParticipantEditRank.
|
||||
const ChannelAdminLogEventActionParticipantEditRankTypeID = 0x5806b4ec
|
||||
|
||||
// construct implements constructor of ChannelAdminLogEventActionClass.
|
||||
func (c ChannelAdminLogEventActionParticipantEditRank) construct() ChannelAdminLogEventActionClass {
|
||||
return &c
|
||||
}
|
||||
|
||||
// Ensuring interfaces in compile-time for ChannelAdminLogEventActionParticipantEditRank.
|
||||
var (
|
||||
_ bin.Encoder = &ChannelAdminLogEventActionParticipantEditRank{}
|
||||
_ bin.Decoder = &ChannelAdminLogEventActionParticipantEditRank{}
|
||||
_ bin.BareEncoder = &ChannelAdminLogEventActionParticipantEditRank{}
|
||||
_ bin.BareDecoder = &ChannelAdminLogEventActionParticipantEditRank{}
|
||||
|
||||
_ ChannelAdminLogEventActionClass = &ChannelAdminLogEventActionParticipantEditRank{}
|
||||
)
|
||||
|
||||
func (c *ChannelAdminLogEventActionParticipantEditRank) Zero() bool {
|
||||
if c == nil {
|
||||
return true
|
||||
}
|
||||
if !(c.UserID == 0) {
|
||||
return false
|
||||
}
|
||||
if !(c.PrevRank == "") {
|
||||
return false
|
||||
}
|
||||
if !(c.NewRank == "") {
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
// String implements fmt.Stringer.
|
||||
func (c *ChannelAdminLogEventActionParticipantEditRank) String() string {
|
||||
if c == nil {
|
||||
return "ChannelAdminLogEventActionParticipantEditRank(nil)"
|
||||
}
|
||||
type Alias ChannelAdminLogEventActionParticipantEditRank
|
||||
return fmt.Sprintf("ChannelAdminLogEventActionParticipantEditRank%+v", Alias(*c))
|
||||
}
|
||||
|
||||
// FillFrom fills ChannelAdminLogEventActionParticipantEditRank from given interface.
|
||||
func (c *ChannelAdminLogEventActionParticipantEditRank) FillFrom(from interface {
|
||||
GetUserID() (value int64)
|
||||
GetPrevRank() (value string)
|
||||
GetNewRank() (value string)
|
||||
}) {
|
||||
c.UserID = from.GetUserID()
|
||||
c.PrevRank = from.GetPrevRank()
|
||||
c.NewRank = from.GetNewRank()
|
||||
}
|
||||
|
||||
// TypeID returns type id in TL schema.
|
||||
//
|
||||
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
||||
func (*ChannelAdminLogEventActionParticipantEditRank) TypeID() uint32 {
|
||||
return ChannelAdminLogEventActionParticipantEditRankTypeID
|
||||
}
|
||||
|
||||
// TypeName returns name of type in TL schema.
|
||||
func (*ChannelAdminLogEventActionParticipantEditRank) TypeName() string {
|
||||
return "channelAdminLogEventActionParticipantEditRank"
|
||||
}
|
||||
|
||||
// TypeInfo returns info about TL type.
|
||||
func (c *ChannelAdminLogEventActionParticipantEditRank) TypeInfo() tdp.Type {
|
||||
typ := tdp.Type{
|
||||
Name: "channelAdminLogEventActionParticipantEditRank",
|
||||
ID: ChannelAdminLogEventActionParticipantEditRankTypeID,
|
||||
}
|
||||
if c == nil {
|
||||
typ.Null = true
|
||||
return typ
|
||||
}
|
||||
typ.Fields = []tdp.Field{
|
||||
{
|
||||
Name: "UserID",
|
||||
SchemaName: "user_id",
|
||||
},
|
||||
{
|
||||
Name: "PrevRank",
|
||||
SchemaName: "prev_rank",
|
||||
},
|
||||
{
|
||||
Name: "NewRank",
|
||||
SchemaName: "new_rank",
|
||||
},
|
||||
}
|
||||
return typ
|
||||
}
|
||||
|
||||
// Encode implements bin.Encoder.
|
||||
func (c *ChannelAdminLogEventActionParticipantEditRank) Encode(b *bin.Buffer) error {
|
||||
if c == nil {
|
||||
return fmt.Errorf("can't encode channelAdminLogEventActionParticipantEditRank#5806b4ec as nil")
|
||||
}
|
||||
b.PutID(ChannelAdminLogEventActionParticipantEditRankTypeID)
|
||||
return c.EncodeBare(b)
|
||||
}
|
||||
|
||||
// EncodeBare implements bin.BareEncoder.
|
||||
func (c *ChannelAdminLogEventActionParticipantEditRank) EncodeBare(b *bin.Buffer) error {
|
||||
if c == nil {
|
||||
return fmt.Errorf("can't encode channelAdminLogEventActionParticipantEditRank#5806b4ec as nil")
|
||||
}
|
||||
b.PutLong(c.UserID)
|
||||
b.PutString(c.PrevRank)
|
||||
b.PutString(c.NewRank)
|
||||
return nil
|
||||
}
|
||||
|
||||
// Decode implements bin.Decoder.
|
||||
func (c *ChannelAdminLogEventActionParticipantEditRank) Decode(b *bin.Buffer) error {
|
||||
if c == nil {
|
||||
return fmt.Errorf("can't decode channelAdminLogEventActionParticipantEditRank#5806b4ec to nil")
|
||||
}
|
||||
if err := b.ConsumeID(ChannelAdminLogEventActionParticipantEditRankTypeID); err != nil {
|
||||
return fmt.Errorf("unable to decode channelAdminLogEventActionParticipantEditRank#5806b4ec: %w", err)
|
||||
}
|
||||
return c.DecodeBare(b)
|
||||
}
|
||||
|
||||
// DecodeBare implements bin.BareDecoder.
|
||||
func (c *ChannelAdminLogEventActionParticipantEditRank) DecodeBare(b *bin.Buffer) error {
|
||||
if c == nil {
|
||||
return fmt.Errorf("can't decode channelAdminLogEventActionParticipantEditRank#5806b4ec to nil")
|
||||
}
|
||||
{
|
||||
value, err := b.Long()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode channelAdminLogEventActionParticipantEditRank#5806b4ec: field user_id: %w", err)
|
||||
}
|
||||
c.UserID = value
|
||||
}
|
||||
{
|
||||
value, err := b.String()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode channelAdminLogEventActionParticipantEditRank#5806b4ec: field prev_rank: %w", err)
|
||||
}
|
||||
c.PrevRank = value
|
||||
}
|
||||
{
|
||||
value, err := b.String()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode channelAdminLogEventActionParticipantEditRank#5806b4ec: field new_rank: %w", err)
|
||||
}
|
||||
c.NewRank = value
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// GetUserID returns value of UserID field.
|
||||
func (c *ChannelAdminLogEventActionParticipantEditRank) GetUserID() (value int64) {
|
||||
if c == nil {
|
||||
return
|
||||
}
|
||||
return c.UserID
|
||||
}
|
||||
|
||||
// GetPrevRank returns value of PrevRank field.
|
||||
func (c *ChannelAdminLogEventActionParticipantEditRank) GetPrevRank() (value string) {
|
||||
if c == nil {
|
||||
return
|
||||
}
|
||||
return c.PrevRank
|
||||
}
|
||||
|
||||
// GetNewRank returns value of NewRank field.
|
||||
func (c *ChannelAdminLogEventActionParticipantEditRank) GetNewRank() (value string) {
|
||||
if c == nil {
|
||||
return
|
||||
}
|
||||
return c.NewRank
|
||||
}
|
||||
|
||||
// ChannelAdminLogEventActionClassName is schema name of ChannelAdminLogEventActionClass.
|
||||
const ChannelAdminLogEventActionClassName = "ChannelAdminLogEventAction"
|
||||
|
||||
@@ -8121,6 +8311,7 @@ const ChannelAdminLogEventActionClassName = "ChannelAdminLogEventAction"
|
||||
// case *tg.ChannelAdminLogEventActionToggleSignatureProfiles: // channelAdminLogEventActionToggleSignatureProfiles#60a79c79
|
||||
// case *tg.ChannelAdminLogEventActionParticipantSubExtend: // channelAdminLogEventActionParticipantSubExtend#64642db3
|
||||
// case *tg.ChannelAdminLogEventActionToggleAutotranslation: // channelAdminLogEventActionToggleAutotranslation#c517f77e
|
||||
// case *tg.ChannelAdminLogEventActionParticipantEditRank: // channelAdminLogEventActionParticipantEditRank#5806b4ec
|
||||
// default: panic(v)
|
||||
// }
|
||||
type ChannelAdminLogEventActionClass interface {
|
||||
@@ -8506,6 +8697,13 @@ func DecodeChannelAdminLogEventAction(buf *bin.Buffer) (ChannelAdminLogEventActi
|
||||
return nil, fmt.Errorf("unable to decode ChannelAdminLogEventActionClass: %w", err)
|
||||
}
|
||||
return &v, nil
|
||||
case ChannelAdminLogEventActionParticipantEditRankTypeID:
|
||||
// Decoding channelAdminLogEventActionParticipantEditRank#5806b4ec.
|
||||
v := ChannelAdminLogEventActionParticipantEditRank{}
|
||||
if err := v.Decode(buf); err != nil {
|
||||
return nil, fmt.Errorf("unable to decode ChannelAdminLogEventActionClass: %w", err)
|
||||
}
|
||||
return &v, nil
|
||||
default:
|
||||
return nil, fmt.Errorf("unable to decode ChannelAdminLogEventActionClass: %w", bin.NewUnexpectedID(id))
|
||||
}
|
||||
|
||||
@@ -753,6 +753,19 @@ func (s ChannelAdminLogEventActionClassArray) AsChannelAdminLogEventActionToggle
|
||||
return to
|
||||
}
|
||||
|
||||
// AsChannelAdminLogEventActionParticipantEditRank returns copy with only ChannelAdminLogEventActionParticipantEditRank constructors.
|
||||
func (s ChannelAdminLogEventActionClassArray) AsChannelAdminLogEventActionParticipantEditRank() (to ChannelAdminLogEventActionParticipantEditRankArray) {
|
||||
for _, elem := range s {
|
||||
value, ok := elem.(*ChannelAdminLogEventActionParticipantEditRank)
|
||||
if !ok {
|
||||
continue
|
||||
}
|
||||
to = append(to, *value)
|
||||
}
|
||||
|
||||
return to
|
||||
}
|
||||
|
||||
// ChannelAdminLogEventActionChangeTitleArray is adapter for slice of ChannelAdminLogEventActionChangeTitle.
|
||||
type ChannelAdminLogEventActionChangeTitleArray []ChannelAdminLogEventActionChangeTitle
|
||||
|
||||
@@ -4770,3 +4783,85 @@ func (s *ChannelAdminLogEventActionToggleAutotranslationArray) Pop() (v ChannelA
|
||||
|
||||
return v, true
|
||||
}
|
||||
|
||||
// ChannelAdminLogEventActionParticipantEditRankArray is adapter for slice of ChannelAdminLogEventActionParticipantEditRank.
|
||||
type ChannelAdminLogEventActionParticipantEditRankArray []ChannelAdminLogEventActionParticipantEditRank
|
||||
|
||||
// Sort sorts slice of ChannelAdminLogEventActionParticipantEditRank.
|
||||
func (s ChannelAdminLogEventActionParticipantEditRankArray) Sort(less func(a, b ChannelAdminLogEventActionParticipantEditRank) bool) ChannelAdminLogEventActionParticipantEditRankArray {
|
||||
sort.Slice(s, func(i, j int) bool {
|
||||
return less(s[i], s[j])
|
||||
})
|
||||
return s
|
||||
}
|
||||
|
||||
// SortStable sorts slice of ChannelAdminLogEventActionParticipantEditRank.
|
||||
func (s ChannelAdminLogEventActionParticipantEditRankArray) SortStable(less func(a, b ChannelAdminLogEventActionParticipantEditRank) bool) ChannelAdminLogEventActionParticipantEditRankArray {
|
||||
sort.SliceStable(s, func(i, j int) bool {
|
||||
return less(s[i], s[j])
|
||||
})
|
||||
return s
|
||||
}
|
||||
|
||||
// Retain filters in-place slice of ChannelAdminLogEventActionParticipantEditRank.
|
||||
func (s ChannelAdminLogEventActionParticipantEditRankArray) Retain(keep func(x ChannelAdminLogEventActionParticipantEditRank) bool) ChannelAdminLogEventActionParticipantEditRankArray {
|
||||
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 ChannelAdminLogEventActionParticipantEditRankArray) First() (v ChannelAdminLogEventActionParticipantEditRank, ok bool) {
|
||||
if len(s) < 1 {
|
||||
return
|
||||
}
|
||||
return s[0], true
|
||||
}
|
||||
|
||||
// Last returns last element of slice (if exists).
|
||||
func (s ChannelAdminLogEventActionParticipantEditRankArray) Last() (v ChannelAdminLogEventActionParticipantEditRank, 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 *ChannelAdminLogEventActionParticipantEditRankArray) PopFirst() (v ChannelAdminLogEventActionParticipantEditRank, 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 ChannelAdminLogEventActionParticipantEditRank
|
||||
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 *ChannelAdminLogEventActionParticipantEditRankArray) Pop() (v ChannelAdminLogEventActionParticipantEditRank, 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
|
||||
}
|
||||
|
||||
@@ -144,6 +144,8 @@ type ChannelAdminLogEventsFilter struct {
|
||||
// Links:
|
||||
// 1) https://core.telegram.org/constructor/channelAdminLogEventActionParticipantSubExtend
|
||||
SubExtend bool
|
||||
// EditRank field of ChannelAdminLogEventsFilter.
|
||||
EditRank bool
|
||||
}
|
||||
|
||||
// ChannelAdminLogEventsFilterTypeID is TL type id of ChannelAdminLogEventsFilter.
|
||||
@@ -221,6 +223,9 @@ func (c *ChannelAdminLogEventsFilter) Zero() bool {
|
||||
if !(c.SubExtend == false) {
|
||||
return false
|
||||
}
|
||||
if !(c.EditRank == false) {
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
@@ -255,6 +260,7 @@ func (c *ChannelAdminLogEventsFilter) FillFrom(from interface {
|
||||
GetSend() (value bool)
|
||||
GetForums() (value bool)
|
||||
GetSubExtend() (value bool)
|
||||
GetEditRank() (value bool)
|
||||
}) {
|
||||
c.Join = from.GetJoin()
|
||||
c.Leave = from.GetLeave()
|
||||
@@ -275,6 +281,7 @@ func (c *ChannelAdminLogEventsFilter) FillFrom(from interface {
|
||||
c.Send = from.GetSend()
|
||||
c.Forums = from.GetForums()
|
||||
c.SubExtend = from.GetSubExtend()
|
||||
c.EditRank = from.GetEditRank()
|
||||
}
|
||||
|
||||
// TypeID returns type id in TL schema.
|
||||
@@ -395,6 +402,11 @@ func (c *ChannelAdminLogEventsFilter) TypeInfo() tdp.Type {
|
||||
SchemaName: "sub_extend",
|
||||
Null: !c.Flags.Has(18),
|
||||
},
|
||||
{
|
||||
Name: "EditRank",
|
||||
SchemaName: "edit_rank",
|
||||
Null: !c.Flags.Has(19),
|
||||
},
|
||||
}
|
||||
return typ
|
||||
}
|
||||
@@ -458,6 +470,9 @@ func (c *ChannelAdminLogEventsFilter) SetFlags() {
|
||||
if !(c.SubExtend == false) {
|
||||
c.Flags.Set(18)
|
||||
}
|
||||
if !(c.EditRank == false) {
|
||||
c.Flags.Set(19)
|
||||
}
|
||||
}
|
||||
|
||||
// Encode implements bin.Encoder.
|
||||
@@ -521,6 +536,7 @@ func (c *ChannelAdminLogEventsFilter) DecodeBare(b *bin.Buffer) error {
|
||||
c.Send = c.Flags.Has(16)
|
||||
c.Forums = c.Flags.Has(17)
|
||||
c.SubExtend = c.Flags.Has(18)
|
||||
c.EditRank = c.Flags.Has(19)
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -884,3 +900,22 @@ func (c *ChannelAdminLogEventsFilter) GetSubExtend() (value bool) {
|
||||
}
|
||||
return c.Flags.Has(18)
|
||||
}
|
||||
|
||||
// SetEditRank sets value of EditRank conditional field.
|
||||
func (c *ChannelAdminLogEventsFilter) SetEditRank(value bool) {
|
||||
if value {
|
||||
c.Flags.Set(19)
|
||||
c.EditRank = true
|
||||
} else {
|
||||
c.Flags.Unset(19)
|
||||
c.EditRank = false
|
||||
}
|
||||
}
|
||||
|
||||
// GetEditRank returns value of EditRank conditional field.
|
||||
func (c *ChannelAdminLogEventsFilter) GetEditRank() (value bool) {
|
||||
if c == nil {
|
||||
return
|
||||
}
|
||||
return c.Flags.Has(19)
|
||||
}
|
||||
|
||||
+191
-47
@@ -31,7 +31,7 @@ var (
|
||||
_ = tdjson.Encoder{}
|
||||
)
|
||||
|
||||
// ChannelParticipant represents TL type `channelParticipant#cb397619`.
|
||||
// ChannelParticipant represents TL type `channelParticipant#1bd54456`.
|
||||
// Channel/supergroup participant
|
||||
//
|
||||
// See https://core.telegram.org/constructor/channelParticipant for reference.
|
||||
@@ -53,10 +53,14 @@ type ChannelParticipant struct {
|
||||
//
|
||||
// Use SetSubscriptionUntilDate and GetSubscriptionUntilDate helpers.
|
||||
SubscriptionUntilDate int
|
||||
// Rank field of ChannelParticipant.
|
||||
//
|
||||
// Use SetRank and GetRank helpers.
|
||||
Rank string
|
||||
}
|
||||
|
||||
// ChannelParticipantTypeID is TL type id of ChannelParticipant.
|
||||
const ChannelParticipantTypeID = 0xcb397619
|
||||
const ChannelParticipantTypeID = 0x1bd54456
|
||||
|
||||
// construct implements constructor of ChannelParticipantClass.
|
||||
func (c ChannelParticipant) construct() ChannelParticipantClass { return &c }
|
||||
@@ -87,6 +91,9 @@ func (c *ChannelParticipant) Zero() bool {
|
||||
if !(c.SubscriptionUntilDate == 0) {
|
||||
return false
|
||||
}
|
||||
if !(c.Rank == "") {
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
@@ -105,6 +112,7 @@ func (c *ChannelParticipant) FillFrom(from interface {
|
||||
GetUserID() (value int64)
|
||||
GetDate() (value int)
|
||||
GetSubscriptionUntilDate() (value int, ok bool)
|
||||
GetRank() (value string, ok bool)
|
||||
}) {
|
||||
c.UserID = from.GetUserID()
|
||||
c.Date = from.GetDate()
|
||||
@@ -112,6 +120,10 @@ func (c *ChannelParticipant) FillFrom(from interface {
|
||||
c.SubscriptionUntilDate = val
|
||||
}
|
||||
|
||||
if val, ok := from.GetRank(); ok {
|
||||
c.Rank = val
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// TypeID returns type id in TL schema.
|
||||
@@ -150,6 +162,11 @@ func (c *ChannelParticipant) TypeInfo() tdp.Type {
|
||||
SchemaName: "subscription_until_date",
|
||||
Null: !c.Flags.Has(0),
|
||||
},
|
||||
{
|
||||
Name: "Rank",
|
||||
SchemaName: "rank",
|
||||
Null: !c.Flags.Has(2),
|
||||
},
|
||||
}
|
||||
return typ
|
||||
}
|
||||
@@ -159,12 +176,15 @@ func (c *ChannelParticipant) SetFlags() {
|
||||
if !(c.SubscriptionUntilDate == 0) {
|
||||
c.Flags.Set(0)
|
||||
}
|
||||
if !(c.Rank == "") {
|
||||
c.Flags.Set(2)
|
||||
}
|
||||
}
|
||||
|
||||
// Encode implements bin.Encoder.
|
||||
func (c *ChannelParticipant) Encode(b *bin.Buffer) error {
|
||||
if c == nil {
|
||||
return fmt.Errorf("can't encode channelParticipant#cb397619 as nil")
|
||||
return fmt.Errorf("can't encode channelParticipant#1bd54456 as nil")
|
||||
}
|
||||
b.PutID(ChannelParticipantTypeID)
|
||||
return c.EncodeBare(b)
|
||||
@@ -173,27 +193,30 @@ func (c *ChannelParticipant) Encode(b *bin.Buffer) error {
|
||||
// EncodeBare implements bin.BareEncoder.
|
||||
func (c *ChannelParticipant) EncodeBare(b *bin.Buffer) error {
|
||||
if c == nil {
|
||||
return fmt.Errorf("can't encode channelParticipant#cb397619 as nil")
|
||||
return fmt.Errorf("can't encode channelParticipant#1bd54456 as nil")
|
||||
}
|
||||
c.SetFlags()
|
||||
if err := c.Flags.Encode(b); err != nil {
|
||||
return fmt.Errorf("unable to encode channelParticipant#cb397619: field flags: %w", err)
|
||||
return fmt.Errorf("unable to encode channelParticipant#1bd54456: field flags: %w", err)
|
||||
}
|
||||
b.PutLong(c.UserID)
|
||||
b.PutInt(c.Date)
|
||||
if c.Flags.Has(0) {
|
||||
b.PutInt(c.SubscriptionUntilDate)
|
||||
}
|
||||
if c.Flags.Has(2) {
|
||||
b.PutString(c.Rank)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Decode implements bin.Decoder.
|
||||
func (c *ChannelParticipant) Decode(b *bin.Buffer) error {
|
||||
if c == nil {
|
||||
return fmt.Errorf("can't decode channelParticipant#cb397619 to nil")
|
||||
return fmt.Errorf("can't decode channelParticipant#1bd54456 to nil")
|
||||
}
|
||||
if err := b.ConsumeID(ChannelParticipantTypeID); err != nil {
|
||||
return fmt.Errorf("unable to decode channelParticipant#cb397619: %w", err)
|
||||
return fmt.Errorf("unable to decode channelParticipant#1bd54456: %w", err)
|
||||
}
|
||||
return c.DecodeBare(b)
|
||||
}
|
||||
@@ -201,34 +224,41 @@ func (c *ChannelParticipant) Decode(b *bin.Buffer) error {
|
||||
// DecodeBare implements bin.BareDecoder.
|
||||
func (c *ChannelParticipant) DecodeBare(b *bin.Buffer) error {
|
||||
if c == nil {
|
||||
return fmt.Errorf("can't decode channelParticipant#cb397619 to nil")
|
||||
return fmt.Errorf("can't decode channelParticipant#1bd54456 to nil")
|
||||
}
|
||||
{
|
||||
if err := c.Flags.Decode(b); err != nil {
|
||||
return fmt.Errorf("unable to decode channelParticipant#cb397619: field flags: %w", err)
|
||||
return fmt.Errorf("unable to decode channelParticipant#1bd54456: field flags: %w", err)
|
||||
}
|
||||
}
|
||||
{
|
||||
value, err := b.Long()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode channelParticipant#cb397619: field user_id: %w", err)
|
||||
return fmt.Errorf("unable to decode channelParticipant#1bd54456: field user_id: %w", err)
|
||||
}
|
||||
c.UserID = value
|
||||
}
|
||||
{
|
||||
value, err := b.Int()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode channelParticipant#cb397619: field date: %w", err)
|
||||
return fmt.Errorf("unable to decode channelParticipant#1bd54456: field date: %w", err)
|
||||
}
|
||||
c.Date = value
|
||||
}
|
||||
if c.Flags.Has(0) {
|
||||
value, err := b.Int()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode channelParticipant#cb397619: field subscription_until_date: %w", err)
|
||||
return fmt.Errorf("unable to decode channelParticipant#1bd54456: field subscription_until_date: %w", err)
|
||||
}
|
||||
c.SubscriptionUntilDate = value
|
||||
}
|
||||
if c.Flags.Has(2) {
|
||||
value, err := b.String()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode channelParticipant#1bd54456: field rank: %w", err)
|
||||
}
|
||||
c.Rank = value
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -266,7 +296,25 @@ func (c *ChannelParticipant) GetSubscriptionUntilDate() (value int, ok bool) {
|
||||
return c.SubscriptionUntilDate, true
|
||||
}
|
||||
|
||||
// ChannelParticipantSelf represents TL type `channelParticipantSelf#4f607bef`.
|
||||
// SetRank sets value of Rank conditional field.
|
||||
func (c *ChannelParticipant) SetRank(value string) {
|
||||
c.Flags.Set(2)
|
||||
c.Rank = value
|
||||
}
|
||||
|
||||
// GetRank returns value of Rank conditional field and
|
||||
// boolean which is true if field was set.
|
||||
func (c *ChannelParticipant) GetRank() (value string, ok bool) {
|
||||
if c == nil {
|
||||
return
|
||||
}
|
||||
if !c.Flags.Has(2) {
|
||||
return value, false
|
||||
}
|
||||
return c.Rank, true
|
||||
}
|
||||
|
||||
// ChannelParticipantSelf represents TL type `channelParticipantSelf#a9478a1a`.
|
||||
// Myself
|
||||
//
|
||||
// See https://core.telegram.org/constructor/channelParticipantSelf for reference.
|
||||
@@ -292,10 +340,14 @@ type ChannelParticipantSelf struct {
|
||||
//
|
||||
// Use SetSubscriptionUntilDate and GetSubscriptionUntilDate helpers.
|
||||
SubscriptionUntilDate int
|
||||
// Rank field of ChannelParticipantSelf.
|
||||
//
|
||||
// Use SetRank and GetRank helpers.
|
||||
Rank string
|
||||
}
|
||||
|
||||
// ChannelParticipantSelfTypeID is TL type id of ChannelParticipantSelf.
|
||||
const ChannelParticipantSelfTypeID = 0x4f607bef
|
||||
const ChannelParticipantSelfTypeID = 0xa9478a1a
|
||||
|
||||
// construct implements constructor of ChannelParticipantClass.
|
||||
func (c ChannelParticipantSelf) construct() ChannelParticipantClass { return &c }
|
||||
@@ -332,6 +384,9 @@ func (c *ChannelParticipantSelf) Zero() bool {
|
||||
if !(c.SubscriptionUntilDate == 0) {
|
||||
return false
|
||||
}
|
||||
if !(c.Rank == "") {
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
@@ -352,6 +407,7 @@ func (c *ChannelParticipantSelf) FillFrom(from interface {
|
||||
GetInviterID() (value int64)
|
||||
GetDate() (value int)
|
||||
GetSubscriptionUntilDate() (value int, ok bool)
|
||||
GetRank() (value string, ok bool)
|
||||
}) {
|
||||
c.ViaRequest = from.GetViaRequest()
|
||||
c.UserID = from.GetUserID()
|
||||
@@ -361,6 +417,10 @@ func (c *ChannelParticipantSelf) FillFrom(from interface {
|
||||
c.SubscriptionUntilDate = val
|
||||
}
|
||||
|
||||
if val, ok := from.GetRank(); ok {
|
||||
c.Rank = val
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// TypeID returns type id in TL schema.
|
||||
@@ -408,6 +468,11 @@ func (c *ChannelParticipantSelf) TypeInfo() tdp.Type {
|
||||
SchemaName: "subscription_until_date",
|
||||
Null: !c.Flags.Has(1),
|
||||
},
|
||||
{
|
||||
Name: "Rank",
|
||||
SchemaName: "rank",
|
||||
Null: !c.Flags.Has(2),
|
||||
},
|
||||
}
|
||||
return typ
|
||||
}
|
||||
@@ -420,12 +485,15 @@ func (c *ChannelParticipantSelf) SetFlags() {
|
||||
if !(c.SubscriptionUntilDate == 0) {
|
||||
c.Flags.Set(1)
|
||||
}
|
||||
if !(c.Rank == "") {
|
||||
c.Flags.Set(2)
|
||||
}
|
||||
}
|
||||
|
||||
// Encode implements bin.Encoder.
|
||||
func (c *ChannelParticipantSelf) Encode(b *bin.Buffer) error {
|
||||
if c == nil {
|
||||
return fmt.Errorf("can't encode channelParticipantSelf#4f607bef as nil")
|
||||
return fmt.Errorf("can't encode channelParticipantSelf#a9478a1a as nil")
|
||||
}
|
||||
b.PutID(ChannelParticipantSelfTypeID)
|
||||
return c.EncodeBare(b)
|
||||
@@ -434,11 +502,11 @@ func (c *ChannelParticipantSelf) Encode(b *bin.Buffer) error {
|
||||
// EncodeBare implements bin.BareEncoder.
|
||||
func (c *ChannelParticipantSelf) EncodeBare(b *bin.Buffer) error {
|
||||
if c == nil {
|
||||
return fmt.Errorf("can't encode channelParticipantSelf#4f607bef as nil")
|
||||
return fmt.Errorf("can't encode channelParticipantSelf#a9478a1a as nil")
|
||||
}
|
||||
c.SetFlags()
|
||||
if err := c.Flags.Encode(b); err != nil {
|
||||
return fmt.Errorf("unable to encode channelParticipantSelf#4f607bef: field flags: %w", err)
|
||||
return fmt.Errorf("unable to encode channelParticipantSelf#a9478a1a: field flags: %w", err)
|
||||
}
|
||||
b.PutLong(c.UserID)
|
||||
b.PutLong(c.InviterID)
|
||||
@@ -446,16 +514,19 @@ func (c *ChannelParticipantSelf) EncodeBare(b *bin.Buffer) error {
|
||||
if c.Flags.Has(1) {
|
||||
b.PutInt(c.SubscriptionUntilDate)
|
||||
}
|
||||
if c.Flags.Has(2) {
|
||||
b.PutString(c.Rank)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Decode implements bin.Decoder.
|
||||
func (c *ChannelParticipantSelf) Decode(b *bin.Buffer) error {
|
||||
if c == nil {
|
||||
return fmt.Errorf("can't decode channelParticipantSelf#4f607bef to nil")
|
||||
return fmt.Errorf("can't decode channelParticipantSelf#a9478a1a to nil")
|
||||
}
|
||||
if err := b.ConsumeID(ChannelParticipantSelfTypeID); err != nil {
|
||||
return fmt.Errorf("unable to decode channelParticipantSelf#4f607bef: %w", err)
|
||||
return fmt.Errorf("unable to decode channelParticipantSelf#a9478a1a: %w", err)
|
||||
}
|
||||
return c.DecodeBare(b)
|
||||
}
|
||||
@@ -463,42 +534,49 @@ func (c *ChannelParticipantSelf) Decode(b *bin.Buffer) error {
|
||||
// DecodeBare implements bin.BareDecoder.
|
||||
func (c *ChannelParticipantSelf) DecodeBare(b *bin.Buffer) error {
|
||||
if c == nil {
|
||||
return fmt.Errorf("can't decode channelParticipantSelf#4f607bef to nil")
|
||||
return fmt.Errorf("can't decode channelParticipantSelf#a9478a1a to nil")
|
||||
}
|
||||
{
|
||||
if err := c.Flags.Decode(b); err != nil {
|
||||
return fmt.Errorf("unable to decode channelParticipantSelf#4f607bef: field flags: %w", err)
|
||||
return fmt.Errorf("unable to decode channelParticipantSelf#a9478a1a: field flags: %w", err)
|
||||
}
|
||||
}
|
||||
c.ViaRequest = c.Flags.Has(0)
|
||||
{
|
||||
value, err := b.Long()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode channelParticipantSelf#4f607bef: field user_id: %w", err)
|
||||
return fmt.Errorf("unable to decode channelParticipantSelf#a9478a1a: field user_id: %w", err)
|
||||
}
|
||||
c.UserID = value
|
||||
}
|
||||
{
|
||||
value, err := b.Long()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode channelParticipantSelf#4f607bef: field inviter_id: %w", err)
|
||||
return fmt.Errorf("unable to decode channelParticipantSelf#a9478a1a: field inviter_id: %w", err)
|
||||
}
|
||||
c.InviterID = value
|
||||
}
|
||||
{
|
||||
value, err := b.Int()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode channelParticipantSelf#4f607bef: field date: %w", err)
|
||||
return fmt.Errorf("unable to decode channelParticipantSelf#a9478a1a: field date: %w", err)
|
||||
}
|
||||
c.Date = value
|
||||
}
|
||||
if c.Flags.Has(1) {
|
||||
value, err := b.Int()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode channelParticipantSelf#4f607bef: field subscription_until_date: %w", err)
|
||||
return fmt.Errorf("unable to decode channelParticipantSelf#a9478a1a: field subscription_until_date: %w", err)
|
||||
}
|
||||
c.SubscriptionUntilDate = value
|
||||
}
|
||||
if c.Flags.Has(2) {
|
||||
value, err := b.String()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode channelParticipantSelf#a9478a1a: field rank: %w", err)
|
||||
}
|
||||
c.Rank = value
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -563,6 +641,24 @@ func (c *ChannelParticipantSelf) GetSubscriptionUntilDate() (value int, ok bool)
|
||||
return c.SubscriptionUntilDate, true
|
||||
}
|
||||
|
||||
// SetRank sets value of Rank conditional field.
|
||||
func (c *ChannelParticipantSelf) SetRank(value string) {
|
||||
c.Flags.Set(2)
|
||||
c.Rank = value
|
||||
}
|
||||
|
||||
// GetRank returns value of Rank conditional field and
|
||||
// boolean which is true if field was set.
|
||||
func (c *ChannelParticipantSelf) GetRank() (value string, ok bool) {
|
||||
if c == nil {
|
||||
return
|
||||
}
|
||||
if !c.Flags.Has(2) {
|
||||
return value, false
|
||||
}
|
||||
return c.Rank, true
|
||||
}
|
||||
|
||||
// ChannelParticipantCreator represents TL type `channelParticipantCreator#2fe601d3`.
|
||||
// Channel/supergroup creator
|
||||
//
|
||||
@@ -1201,7 +1297,7 @@ func (c *ChannelParticipantAdmin) GetRank() (value string, ok bool) {
|
||||
return c.Rank, true
|
||||
}
|
||||
|
||||
// ChannelParticipantBanned represents TL type `channelParticipantBanned#6df8014e`.
|
||||
// ChannelParticipantBanned represents TL type `channelParticipantBanned#d5f0ad91`.
|
||||
// Banned/kicked user
|
||||
//
|
||||
// See https://core.telegram.org/constructor/channelParticipantBanned for reference.
|
||||
@@ -1224,10 +1320,14 @@ type ChannelParticipantBanned struct {
|
||||
// Links:
|
||||
// 1) https://core.telegram.org/api/rights
|
||||
BannedRights ChatBannedRights
|
||||
// Rank field of ChannelParticipantBanned.
|
||||
//
|
||||
// Use SetRank and GetRank helpers.
|
||||
Rank string
|
||||
}
|
||||
|
||||
// ChannelParticipantBannedTypeID is TL type id of ChannelParticipantBanned.
|
||||
const ChannelParticipantBannedTypeID = 0x6df8014e
|
||||
const ChannelParticipantBannedTypeID = 0xd5f0ad91
|
||||
|
||||
// construct implements constructor of ChannelParticipantClass.
|
||||
func (c ChannelParticipantBanned) construct() ChannelParticipantClass { return &c }
|
||||
@@ -1264,6 +1364,9 @@ func (c *ChannelParticipantBanned) Zero() bool {
|
||||
if !(c.BannedRights.Zero()) {
|
||||
return false
|
||||
}
|
||||
if !(c.Rank == "") {
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
@@ -1284,12 +1387,17 @@ func (c *ChannelParticipantBanned) FillFrom(from interface {
|
||||
GetKickedBy() (value int64)
|
||||
GetDate() (value int)
|
||||
GetBannedRights() (value ChatBannedRights)
|
||||
GetRank() (value string, ok bool)
|
||||
}) {
|
||||
c.Left = from.GetLeft()
|
||||
c.Peer = from.GetPeer()
|
||||
c.KickedBy = from.GetKickedBy()
|
||||
c.Date = from.GetDate()
|
||||
c.BannedRights = from.GetBannedRights()
|
||||
if val, ok := from.GetRank(); ok {
|
||||
c.Rank = val
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// TypeID returns type id in TL schema.
|
||||
@@ -1336,6 +1444,11 @@ func (c *ChannelParticipantBanned) TypeInfo() tdp.Type {
|
||||
Name: "BannedRights",
|
||||
SchemaName: "banned_rights",
|
||||
},
|
||||
{
|
||||
Name: "Rank",
|
||||
SchemaName: "rank",
|
||||
Null: !c.Flags.Has(2),
|
||||
},
|
||||
}
|
||||
return typ
|
||||
}
|
||||
@@ -1345,12 +1458,15 @@ func (c *ChannelParticipantBanned) SetFlags() {
|
||||
if !(c.Left == false) {
|
||||
c.Flags.Set(0)
|
||||
}
|
||||
if !(c.Rank == "") {
|
||||
c.Flags.Set(2)
|
||||
}
|
||||
}
|
||||
|
||||
// Encode implements bin.Encoder.
|
||||
func (c *ChannelParticipantBanned) Encode(b *bin.Buffer) error {
|
||||
if c == nil {
|
||||
return fmt.Errorf("can't encode channelParticipantBanned#6df8014e as nil")
|
||||
return fmt.Errorf("can't encode channelParticipantBanned#d5f0ad91 as nil")
|
||||
}
|
||||
b.PutID(ChannelParticipantBannedTypeID)
|
||||
return c.EncodeBare(b)
|
||||
@@ -1359,22 +1475,25 @@ func (c *ChannelParticipantBanned) Encode(b *bin.Buffer) error {
|
||||
// EncodeBare implements bin.BareEncoder.
|
||||
func (c *ChannelParticipantBanned) EncodeBare(b *bin.Buffer) error {
|
||||
if c == nil {
|
||||
return fmt.Errorf("can't encode channelParticipantBanned#6df8014e as nil")
|
||||
return fmt.Errorf("can't encode channelParticipantBanned#d5f0ad91 as nil")
|
||||
}
|
||||
c.SetFlags()
|
||||
if err := c.Flags.Encode(b); err != nil {
|
||||
return fmt.Errorf("unable to encode channelParticipantBanned#6df8014e: field flags: %w", err)
|
||||
return fmt.Errorf("unable to encode channelParticipantBanned#d5f0ad91: field flags: %w", err)
|
||||
}
|
||||
if c.Peer == nil {
|
||||
return fmt.Errorf("unable to encode channelParticipantBanned#6df8014e: field peer is nil")
|
||||
return fmt.Errorf("unable to encode channelParticipantBanned#d5f0ad91: field peer is nil")
|
||||
}
|
||||
if err := c.Peer.Encode(b); err != nil {
|
||||
return fmt.Errorf("unable to encode channelParticipantBanned#6df8014e: field peer: %w", err)
|
||||
return fmt.Errorf("unable to encode channelParticipantBanned#d5f0ad91: field peer: %w", err)
|
||||
}
|
||||
b.PutLong(c.KickedBy)
|
||||
b.PutInt(c.Date)
|
||||
if err := c.BannedRights.Encode(b); err != nil {
|
||||
return fmt.Errorf("unable to encode channelParticipantBanned#6df8014e: field banned_rights: %w", err)
|
||||
return fmt.Errorf("unable to encode channelParticipantBanned#d5f0ad91: field banned_rights: %w", err)
|
||||
}
|
||||
if c.Flags.Has(2) {
|
||||
b.PutString(c.Rank)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
@@ -1382,10 +1501,10 @@ func (c *ChannelParticipantBanned) EncodeBare(b *bin.Buffer) error {
|
||||
// Decode implements bin.Decoder.
|
||||
func (c *ChannelParticipantBanned) Decode(b *bin.Buffer) error {
|
||||
if c == nil {
|
||||
return fmt.Errorf("can't decode channelParticipantBanned#6df8014e to nil")
|
||||
return fmt.Errorf("can't decode channelParticipantBanned#d5f0ad91 to nil")
|
||||
}
|
||||
if err := b.ConsumeID(ChannelParticipantBannedTypeID); err != nil {
|
||||
return fmt.Errorf("unable to decode channelParticipantBanned#6df8014e: %w", err)
|
||||
return fmt.Errorf("unable to decode channelParticipantBanned#d5f0ad91: %w", err)
|
||||
}
|
||||
return c.DecodeBare(b)
|
||||
}
|
||||
@@ -1393,40 +1512,47 @@ func (c *ChannelParticipantBanned) Decode(b *bin.Buffer) error {
|
||||
// DecodeBare implements bin.BareDecoder.
|
||||
func (c *ChannelParticipantBanned) DecodeBare(b *bin.Buffer) error {
|
||||
if c == nil {
|
||||
return fmt.Errorf("can't decode channelParticipantBanned#6df8014e to nil")
|
||||
return fmt.Errorf("can't decode channelParticipantBanned#d5f0ad91 to nil")
|
||||
}
|
||||
{
|
||||
if err := c.Flags.Decode(b); err != nil {
|
||||
return fmt.Errorf("unable to decode channelParticipantBanned#6df8014e: field flags: %w", err)
|
||||
return fmt.Errorf("unable to decode channelParticipantBanned#d5f0ad91: field flags: %w", err)
|
||||
}
|
||||
}
|
||||
c.Left = c.Flags.Has(0)
|
||||
{
|
||||
value, err := DecodePeer(b)
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode channelParticipantBanned#6df8014e: field peer: %w", err)
|
||||
return fmt.Errorf("unable to decode channelParticipantBanned#d5f0ad91: field peer: %w", err)
|
||||
}
|
||||
c.Peer = value
|
||||
}
|
||||
{
|
||||
value, err := b.Long()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode channelParticipantBanned#6df8014e: field kicked_by: %w", err)
|
||||
return fmt.Errorf("unable to decode channelParticipantBanned#d5f0ad91: field kicked_by: %w", err)
|
||||
}
|
||||
c.KickedBy = value
|
||||
}
|
||||
{
|
||||
value, err := b.Int()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode channelParticipantBanned#6df8014e: field date: %w", err)
|
||||
return fmt.Errorf("unable to decode channelParticipantBanned#d5f0ad91: field date: %w", err)
|
||||
}
|
||||
c.Date = value
|
||||
}
|
||||
{
|
||||
if err := c.BannedRights.Decode(b); err != nil {
|
||||
return fmt.Errorf("unable to decode channelParticipantBanned#6df8014e: field banned_rights: %w", err)
|
||||
return fmt.Errorf("unable to decode channelParticipantBanned#d5f0ad91: field banned_rights: %w", err)
|
||||
}
|
||||
}
|
||||
if c.Flags.Has(2) {
|
||||
value, err := b.String()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode channelParticipantBanned#d5f0ad91: field rank: %w", err)
|
||||
}
|
||||
c.Rank = value
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -1481,6 +1607,24 @@ func (c *ChannelParticipantBanned) GetBannedRights() (value ChatBannedRights) {
|
||||
return c.BannedRights
|
||||
}
|
||||
|
||||
// SetRank sets value of Rank conditional field.
|
||||
func (c *ChannelParticipantBanned) SetRank(value string) {
|
||||
c.Flags.Set(2)
|
||||
c.Rank = value
|
||||
}
|
||||
|
||||
// GetRank returns value of Rank conditional field and
|
||||
// boolean which is true if field was set.
|
||||
func (c *ChannelParticipantBanned) GetRank() (value string, ok bool) {
|
||||
if c == nil {
|
||||
return
|
||||
}
|
||||
if !c.Flags.Has(2) {
|
||||
return value, false
|
||||
}
|
||||
return c.Rank, true
|
||||
}
|
||||
|
||||
// ChannelParticipantLeft represents TL type `channelParticipantLeft#1b03f006`.
|
||||
// A participant that left the channel/supergroup
|
||||
//
|
||||
@@ -1635,11 +1779,11 @@ const ChannelParticipantClassName = "ChannelParticipant"
|
||||
// panic(err)
|
||||
// }
|
||||
// switch v := g.(type) {
|
||||
// case *tg.ChannelParticipant: // channelParticipant#cb397619
|
||||
// case *tg.ChannelParticipantSelf: // channelParticipantSelf#4f607bef
|
||||
// case *tg.ChannelParticipant: // channelParticipant#1bd54456
|
||||
// case *tg.ChannelParticipantSelf: // channelParticipantSelf#a9478a1a
|
||||
// case *tg.ChannelParticipantCreator: // channelParticipantCreator#2fe601d3
|
||||
// case *tg.ChannelParticipantAdmin: // channelParticipantAdmin#34c3bb53
|
||||
// case *tg.ChannelParticipantBanned: // channelParticipantBanned#6df8014e
|
||||
// case *tg.ChannelParticipantBanned: // channelParticipantBanned#d5f0ad91
|
||||
// case *tg.ChannelParticipantLeft: // channelParticipantLeft#1b03f006
|
||||
// default: panic(v)
|
||||
// }
|
||||
@@ -1670,14 +1814,14 @@ func DecodeChannelParticipant(buf *bin.Buffer) (ChannelParticipantClass, error)
|
||||
}
|
||||
switch id {
|
||||
case ChannelParticipantTypeID:
|
||||
// Decoding channelParticipant#cb397619.
|
||||
// Decoding channelParticipant#1bd54456.
|
||||
v := ChannelParticipant{}
|
||||
if err := v.Decode(buf); err != nil {
|
||||
return nil, fmt.Errorf("unable to decode ChannelParticipantClass: %w", err)
|
||||
}
|
||||
return &v, nil
|
||||
case ChannelParticipantSelfTypeID:
|
||||
// Decoding channelParticipantSelf#4f607bef.
|
||||
// Decoding channelParticipantSelf#a9478a1a.
|
||||
v := ChannelParticipantSelf{}
|
||||
if err := v.Decode(buf); err != nil {
|
||||
return nil, fmt.Errorf("unable to decode ChannelParticipantClass: %w", err)
|
||||
@@ -1698,7 +1842,7 @@ func DecodeChannelParticipant(buf *bin.Buffer) (ChannelParticipantClass, error)
|
||||
}
|
||||
return &v, nil
|
||||
case ChannelParticipantBannedTypeID:
|
||||
// Decoding channelParticipantBanned#6df8014e.
|
||||
// Decoding channelParticipantBanned#d5f0ad91.
|
||||
v := ChannelParticipantBanned{}
|
||||
if err := v.Decode(buf); err != nil {
|
||||
return nil, fmt.Errorf("unable to decode ChannelParticipantClass: %w", err)
|
||||
|
||||
+63
-24
@@ -31,7 +31,7 @@ var (
|
||||
_ = tdjson.Encoder{}
|
||||
)
|
||||
|
||||
// ChannelsEditAdminRequest represents TL type `channels.editAdmin#d33c8902`.
|
||||
// ChannelsEditAdminRequest represents TL type `channels.editAdmin#9a98ad68`.
|
||||
// Modify the admin rights of a user in a supergroup/channel¹.
|
||||
//
|
||||
// Links:
|
||||
@@ -39,6 +39,8 @@ var (
|
||||
//
|
||||
// See https://core.telegram.org/method/channels.editAdmin for reference.
|
||||
type ChannelsEditAdminRequest struct {
|
||||
// Flags field of ChannelsEditAdminRequest.
|
||||
Flags bin.Fields
|
||||
// The supergroup/channel¹.
|
||||
//
|
||||
// Links:
|
||||
@@ -49,11 +51,13 @@ type ChannelsEditAdminRequest struct {
|
||||
// The admin rights
|
||||
AdminRights ChatAdminRights
|
||||
// Indicates the role (rank) of the admin in the group: just an arbitrary string
|
||||
//
|
||||
// Use SetRank and GetRank helpers.
|
||||
Rank string
|
||||
}
|
||||
|
||||
// ChannelsEditAdminRequestTypeID is TL type id of ChannelsEditAdminRequest.
|
||||
const ChannelsEditAdminRequestTypeID = 0xd33c8902
|
||||
const ChannelsEditAdminRequestTypeID = 0x9a98ad68
|
||||
|
||||
// Ensuring interfaces in compile-time for ChannelsEditAdminRequest.
|
||||
var (
|
||||
@@ -67,6 +71,9 @@ func (e *ChannelsEditAdminRequest) Zero() bool {
|
||||
if e == nil {
|
||||
return true
|
||||
}
|
||||
if !(e.Flags.Zero()) {
|
||||
return false
|
||||
}
|
||||
if !(e.Channel == nil) {
|
||||
return false
|
||||
}
|
||||
@@ -97,12 +104,15 @@ func (e *ChannelsEditAdminRequest) FillFrom(from interface {
|
||||
GetChannel() (value InputChannelClass)
|
||||
GetUserID() (value InputUserClass)
|
||||
GetAdminRights() (value ChatAdminRights)
|
||||
GetRank() (value string)
|
||||
GetRank() (value string, ok bool)
|
||||
}) {
|
||||
e.Channel = from.GetChannel()
|
||||
e.UserID = from.GetUserID()
|
||||
e.AdminRights = from.GetAdminRights()
|
||||
e.Rank = from.GetRank()
|
||||
if val, ok := from.GetRank(); ok {
|
||||
e.Rank = val
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// TypeID returns type id in TL schema.
|
||||
@@ -143,15 +153,23 @@ func (e *ChannelsEditAdminRequest) TypeInfo() tdp.Type {
|
||||
{
|
||||
Name: "Rank",
|
||||
SchemaName: "rank",
|
||||
Null: !e.Flags.Has(0),
|
||||
},
|
||||
}
|
||||
return typ
|
||||
}
|
||||
|
||||
// SetFlags sets flags for non-zero fields.
|
||||
func (e *ChannelsEditAdminRequest) SetFlags() {
|
||||
if !(e.Rank == "") {
|
||||
e.Flags.Set(0)
|
||||
}
|
||||
}
|
||||
|
||||
// Encode implements bin.Encoder.
|
||||
func (e *ChannelsEditAdminRequest) Encode(b *bin.Buffer) error {
|
||||
if e == nil {
|
||||
return fmt.Errorf("can't encode channels.editAdmin#d33c8902 as nil")
|
||||
return fmt.Errorf("can't encode channels.editAdmin#9a98ad68 as nil")
|
||||
}
|
||||
b.PutID(ChannelsEditAdminRequestTypeID)
|
||||
return e.EncodeBare(b)
|
||||
@@ -160,34 +178,40 @@ func (e *ChannelsEditAdminRequest) Encode(b *bin.Buffer) error {
|
||||
// EncodeBare implements bin.BareEncoder.
|
||||
func (e *ChannelsEditAdminRequest) EncodeBare(b *bin.Buffer) error {
|
||||
if e == nil {
|
||||
return fmt.Errorf("can't encode channels.editAdmin#d33c8902 as nil")
|
||||
return fmt.Errorf("can't encode channels.editAdmin#9a98ad68 as nil")
|
||||
}
|
||||
e.SetFlags()
|
||||
if err := e.Flags.Encode(b); err != nil {
|
||||
return fmt.Errorf("unable to encode channels.editAdmin#9a98ad68: field flags: %w", err)
|
||||
}
|
||||
if e.Channel == nil {
|
||||
return fmt.Errorf("unable to encode channels.editAdmin#d33c8902: field channel is nil")
|
||||
return fmt.Errorf("unable to encode channels.editAdmin#9a98ad68: field channel is nil")
|
||||
}
|
||||
if err := e.Channel.Encode(b); err != nil {
|
||||
return fmt.Errorf("unable to encode channels.editAdmin#d33c8902: field channel: %w", err)
|
||||
return fmt.Errorf("unable to encode channels.editAdmin#9a98ad68: field channel: %w", err)
|
||||
}
|
||||
if e.UserID == nil {
|
||||
return fmt.Errorf("unable to encode channels.editAdmin#d33c8902: field user_id is nil")
|
||||
return fmt.Errorf("unable to encode channels.editAdmin#9a98ad68: field user_id is nil")
|
||||
}
|
||||
if err := e.UserID.Encode(b); err != nil {
|
||||
return fmt.Errorf("unable to encode channels.editAdmin#d33c8902: field user_id: %w", err)
|
||||
return fmt.Errorf("unable to encode channels.editAdmin#9a98ad68: field user_id: %w", err)
|
||||
}
|
||||
if err := e.AdminRights.Encode(b); err != nil {
|
||||
return fmt.Errorf("unable to encode channels.editAdmin#d33c8902: field admin_rights: %w", err)
|
||||
return fmt.Errorf("unable to encode channels.editAdmin#9a98ad68: field admin_rights: %w", err)
|
||||
}
|
||||
if e.Flags.Has(0) {
|
||||
b.PutString(e.Rank)
|
||||
}
|
||||
b.PutString(e.Rank)
|
||||
return nil
|
||||
}
|
||||
|
||||
// Decode implements bin.Decoder.
|
||||
func (e *ChannelsEditAdminRequest) Decode(b *bin.Buffer) error {
|
||||
if e == nil {
|
||||
return fmt.Errorf("can't decode channels.editAdmin#d33c8902 to nil")
|
||||
return fmt.Errorf("can't decode channels.editAdmin#9a98ad68 to nil")
|
||||
}
|
||||
if err := b.ConsumeID(ChannelsEditAdminRequestTypeID); err != nil {
|
||||
return fmt.Errorf("unable to decode channels.editAdmin#d33c8902: %w", err)
|
||||
return fmt.Errorf("unable to decode channels.editAdmin#9a98ad68: %w", err)
|
||||
}
|
||||
return e.DecodeBare(b)
|
||||
}
|
||||
@@ -195,31 +219,36 @@ func (e *ChannelsEditAdminRequest) Decode(b *bin.Buffer) error {
|
||||
// DecodeBare implements bin.BareDecoder.
|
||||
func (e *ChannelsEditAdminRequest) DecodeBare(b *bin.Buffer) error {
|
||||
if e == nil {
|
||||
return fmt.Errorf("can't decode channels.editAdmin#d33c8902 to nil")
|
||||
return fmt.Errorf("can't decode channels.editAdmin#9a98ad68 to nil")
|
||||
}
|
||||
{
|
||||
if err := e.Flags.Decode(b); err != nil {
|
||||
return fmt.Errorf("unable to decode channels.editAdmin#9a98ad68: field flags: %w", err)
|
||||
}
|
||||
}
|
||||
{
|
||||
value, err := DecodeInputChannel(b)
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode channels.editAdmin#d33c8902: field channel: %w", err)
|
||||
return fmt.Errorf("unable to decode channels.editAdmin#9a98ad68: field channel: %w", err)
|
||||
}
|
||||
e.Channel = value
|
||||
}
|
||||
{
|
||||
value, err := DecodeInputUser(b)
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode channels.editAdmin#d33c8902: field user_id: %w", err)
|
||||
return fmt.Errorf("unable to decode channels.editAdmin#9a98ad68: field user_id: %w", err)
|
||||
}
|
||||
e.UserID = value
|
||||
}
|
||||
{
|
||||
if err := e.AdminRights.Decode(b); err != nil {
|
||||
return fmt.Errorf("unable to decode channels.editAdmin#d33c8902: field admin_rights: %w", err)
|
||||
return fmt.Errorf("unable to decode channels.editAdmin#9a98ad68: field admin_rights: %w", err)
|
||||
}
|
||||
}
|
||||
{
|
||||
if e.Flags.Has(0) {
|
||||
value, err := b.String()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode channels.editAdmin#d33c8902: field rank: %w", err)
|
||||
return fmt.Errorf("unable to decode channels.editAdmin#9a98ad68: field rank: %w", err)
|
||||
}
|
||||
e.Rank = value
|
||||
}
|
||||
@@ -250,12 +279,22 @@ func (e *ChannelsEditAdminRequest) GetAdminRights() (value ChatAdminRights) {
|
||||
return e.AdminRights
|
||||
}
|
||||
|
||||
// GetRank returns value of Rank field.
|
||||
func (e *ChannelsEditAdminRequest) GetRank() (value string) {
|
||||
// SetRank sets value of Rank conditional field.
|
||||
func (e *ChannelsEditAdminRequest) SetRank(value string) {
|
||||
e.Flags.Set(0)
|
||||
e.Rank = value
|
||||
}
|
||||
|
||||
// GetRank returns value of Rank conditional field and
|
||||
// boolean which is true if field was set.
|
||||
func (e *ChannelsEditAdminRequest) GetRank() (value string, ok bool) {
|
||||
if e == nil {
|
||||
return
|
||||
}
|
||||
return e.Rank
|
||||
if !e.Flags.Has(0) {
|
||||
return value, false
|
||||
}
|
||||
return e.Rank, true
|
||||
}
|
||||
|
||||
// GetChannelAsNotEmpty returns mapped value of Channel field.
|
||||
@@ -263,7 +302,7 @@ func (e *ChannelsEditAdminRequest) GetChannelAsNotEmpty() (NotEmptyInputChannel,
|
||||
return e.Channel.AsNotEmpty()
|
||||
}
|
||||
|
||||
// ChannelsEditAdmin invokes method channels.editAdmin#d33c8902 returning error if any.
|
||||
// ChannelsEditAdmin invokes method channels.editAdmin#9a98ad68 returning error if any.
|
||||
// Modify the admin rights of a user in a supergroup/channel¹.
|
||||
//
|
||||
// Links:
|
||||
|
||||
-274
@@ -1,274 +0,0 @@
|
||||
// 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{}
|
||||
)
|
||||
|
||||
// ChannelsEditCreatorRequest represents TL type `channels.editCreator#8f38cd1f`.
|
||||
// Transfer channel ownership
|
||||
//
|
||||
// See https://core.telegram.org/method/channels.editCreator for reference.
|
||||
type ChannelsEditCreatorRequest struct {
|
||||
// Channel
|
||||
Channel InputChannelClass
|
||||
// New channel owner
|
||||
UserID InputUserClass
|
||||
// 2FA password¹ of account
|
||||
//
|
||||
// Links:
|
||||
// 1) https://core.telegram.org/api/srp
|
||||
Password InputCheckPasswordSRPClass
|
||||
}
|
||||
|
||||
// ChannelsEditCreatorRequestTypeID is TL type id of ChannelsEditCreatorRequest.
|
||||
const ChannelsEditCreatorRequestTypeID = 0x8f38cd1f
|
||||
|
||||
// Ensuring interfaces in compile-time for ChannelsEditCreatorRequest.
|
||||
var (
|
||||
_ bin.Encoder = &ChannelsEditCreatorRequest{}
|
||||
_ bin.Decoder = &ChannelsEditCreatorRequest{}
|
||||
_ bin.BareEncoder = &ChannelsEditCreatorRequest{}
|
||||
_ bin.BareDecoder = &ChannelsEditCreatorRequest{}
|
||||
)
|
||||
|
||||
func (e *ChannelsEditCreatorRequest) Zero() bool {
|
||||
if e == nil {
|
||||
return true
|
||||
}
|
||||
if !(e.Channel == nil) {
|
||||
return false
|
||||
}
|
||||
if !(e.UserID == nil) {
|
||||
return false
|
||||
}
|
||||
if !(e.Password == nil) {
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
// String implements fmt.Stringer.
|
||||
func (e *ChannelsEditCreatorRequest) String() string {
|
||||
if e == nil {
|
||||
return "ChannelsEditCreatorRequest(nil)"
|
||||
}
|
||||
type Alias ChannelsEditCreatorRequest
|
||||
return fmt.Sprintf("ChannelsEditCreatorRequest%+v", Alias(*e))
|
||||
}
|
||||
|
||||
// FillFrom fills ChannelsEditCreatorRequest from given interface.
|
||||
func (e *ChannelsEditCreatorRequest) FillFrom(from interface {
|
||||
GetChannel() (value InputChannelClass)
|
||||
GetUserID() (value InputUserClass)
|
||||
GetPassword() (value InputCheckPasswordSRPClass)
|
||||
}) {
|
||||
e.Channel = from.GetChannel()
|
||||
e.UserID = from.GetUserID()
|
||||
e.Password = from.GetPassword()
|
||||
}
|
||||
|
||||
// TypeID returns type id in TL schema.
|
||||
//
|
||||
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
||||
func (*ChannelsEditCreatorRequest) TypeID() uint32 {
|
||||
return ChannelsEditCreatorRequestTypeID
|
||||
}
|
||||
|
||||
// TypeName returns name of type in TL schema.
|
||||
func (*ChannelsEditCreatorRequest) TypeName() string {
|
||||
return "channels.editCreator"
|
||||
}
|
||||
|
||||
// TypeInfo returns info about TL type.
|
||||
func (e *ChannelsEditCreatorRequest) TypeInfo() tdp.Type {
|
||||
typ := tdp.Type{
|
||||
Name: "channels.editCreator",
|
||||
ID: ChannelsEditCreatorRequestTypeID,
|
||||
}
|
||||
if e == nil {
|
||||
typ.Null = true
|
||||
return typ
|
||||
}
|
||||
typ.Fields = []tdp.Field{
|
||||
{
|
||||
Name: "Channel",
|
||||
SchemaName: "channel",
|
||||
},
|
||||
{
|
||||
Name: "UserID",
|
||||
SchemaName: "user_id",
|
||||
},
|
||||
{
|
||||
Name: "Password",
|
||||
SchemaName: "password",
|
||||
},
|
||||
}
|
||||
return typ
|
||||
}
|
||||
|
||||
// Encode implements bin.Encoder.
|
||||
func (e *ChannelsEditCreatorRequest) Encode(b *bin.Buffer) error {
|
||||
if e == nil {
|
||||
return fmt.Errorf("can't encode channels.editCreator#8f38cd1f as nil")
|
||||
}
|
||||
b.PutID(ChannelsEditCreatorRequestTypeID)
|
||||
return e.EncodeBare(b)
|
||||
}
|
||||
|
||||
// EncodeBare implements bin.BareEncoder.
|
||||
func (e *ChannelsEditCreatorRequest) EncodeBare(b *bin.Buffer) error {
|
||||
if e == nil {
|
||||
return fmt.Errorf("can't encode channels.editCreator#8f38cd1f as nil")
|
||||
}
|
||||
if e.Channel == nil {
|
||||
return fmt.Errorf("unable to encode channels.editCreator#8f38cd1f: field channel is nil")
|
||||
}
|
||||
if err := e.Channel.Encode(b); err != nil {
|
||||
return fmt.Errorf("unable to encode channels.editCreator#8f38cd1f: field channel: %w", err)
|
||||
}
|
||||
if e.UserID == nil {
|
||||
return fmt.Errorf("unable to encode channels.editCreator#8f38cd1f: field user_id is nil")
|
||||
}
|
||||
if err := e.UserID.Encode(b); err != nil {
|
||||
return fmt.Errorf("unable to encode channels.editCreator#8f38cd1f: field user_id: %w", err)
|
||||
}
|
||||
if e.Password == nil {
|
||||
return fmt.Errorf("unable to encode channels.editCreator#8f38cd1f: field password is nil")
|
||||
}
|
||||
if err := e.Password.Encode(b); err != nil {
|
||||
return fmt.Errorf("unable to encode channels.editCreator#8f38cd1f: field password: %w", err)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Decode implements bin.Decoder.
|
||||
func (e *ChannelsEditCreatorRequest) Decode(b *bin.Buffer) error {
|
||||
if e == nil {
|
||||
return fmt.Errorf("can't decode channels.editCreator#8f38cd1f to nil")
|
||||
}
|
||||
if err := b.ConsumeID(ChannelsEditCreatorRequestTypeID); err != nil {
|
||||
return fmt.Errorf("unable to decode channels.editCreator#8f38cd1f: %w", err)
|
||||
}
|
||||
return e.DecodeBare(b)
|
||||
}
|
||||
|
||||
// DecodeBare implements bin.BareDecoder.
|
||||
func (e *ChannelsEditCreatorRequest) DecodeBare(b *bin.Buffer) error {
|
||||
if e == nil {
|
||||
return fmt.Errorf("can't decode channels.editCreator#8f38cd1f to nil")
|
||||
}
|
||||
{
|
||||
value, err := DecodeInputChannel(b)
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode channels.editCreator#8f38cd1f: field channel: %w", err)
|
||||
}
|
||||
e.Channel = value
|
||||
}
|
||||
{
|
||||
value, err := DecodeInputUser(b)
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode channels.editCreator#8f38cd1f: field user_id: %w", err)
|
||||
}
|
||||
e.UserID = value
|
||||
}
|
||||
{
|
||||
value, err := DecodeInputCheckPasswordSRP(b)
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode channels.editCreator#8f38cd1f: field password: %w", err)
|
||||
}
|
||||
e.Password = value
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// GetChannel returns value of Channel field.
|
||||
func (e *ChannelsEditCreatorRequest) GetChannel() (value InputChannelClass) {
|
||||
if e == nil {
|
||||
return
|
||||
}
|
||||
return e.Channel
|
||||
}
|
||||
|
||||
// GetUserID returns value of UserID field.
|
||||
func (e *ChannelsEditCreatorRequest) GetUserID() (value InputUserClass) {
|
||||
if e == nil {
|
||||
return
|
||||
}
|
||||
return e.UserID
|
||||
}
|
||||
|
||||
// GetPassword returns value of Password field.
|
||||
func (e *ChannelsEditCreatorRequest) GetPassword() (value InputCheckPasswordSRPClass) {
|
||||
if e == nil {
|
||||
return
|
||||
}
|
||||
return e.Password
|
||||
}
|
||||
|
||||
// GetChannelAsNotEmpty returns mapped value of Channel field.
|
||||
func (e *ChannelsEditCreatorRequest) GetChannelAsNotEmpty() (NotEmptyInputChannel, bool) {
|
||||
return e.Channel.AsNotEmpty()
|
||||
}
|
||||
|
||||
// GetPasswordAsNotEmpty returns mapped value of Password field.
|
||||
func (e *ChannelsEditCreatorRequest) GetPasswordAsNotEmpty() (*InputCheckPasswordSRP, bool) {
|
||||
return e.Password.AsNotEmpty()
|
||||
}
|
||||
|
||||
// ChannelsEditCreator invokes method channels.editCreator#8f38cd1f returning error if any.
|
||||
// Transfer channel ownership
|
||||
//
|
||||
// Possible errors:
|
||||
//
|
||||
// 400 CHANNELS_ADMIN_PUBLIC_TOO_MUCH: You're admin of too many public channels, make some channels private to change the username of this channel.
|
||||
// 400 CHANNEL_MONOFORUM_UNSUPPORTED: Monoforums do not support this feature.
|
||||
// 400 CHANNEL_PRIVATE: You haven't joined this channel/supergroup.
|
||||
// 400 CHAT_ADMIN_REQUIRED: You must be an admin in this chat to do this.
|
||||
// 400 CHAT_MEMBER_ADD_FAILED: Could not add participants.
|
||||
// 400 CHAT_NOT_MODIFIED: No changes were made to chat information because the new information you passed is identical to the current information.
|
||||
// 403 CHAT_WRITE_FORBIDDEN: You can't write in this chat.
|
||||
// 400 PASSWORD_HASH_INVALID: The provided password hash is invalid.
|
||||
// 400 PASSWORD_MISSING: You must enable 2FA before executing this operation.
|
||||
// 400 PASSWORD_TOO_FRESH_%d: The password was modified less than 24 hours ago, try again in %d seconds.
|
||||
// 400 SESSION_TOO_FRESH_%d: This session was created less than 24 hours ago, try again in %d seconds.
|
||||
// 400 SRP_ID_INVALID: Invalid SRP ID provided.
|
||||
// 400 USER_ID_INVALID: The provided user ID is invalid.
|
||||
// 403 USER_PRIVACY_RESTRICTED: The user's privacy settings do not allow you to do this.
|
||||
//
|
||||
// See https://core.telegram.org/method/channels.editCreator for reference.
|
||||
func (c *Client) ChannelsEditCreator(ctx context.Context, request *ChannelsEditCreatorRequest) (UpdatesClass, error) {
|
||||
var result UpdatesBox
|
||||
|
||||
if err := c.rpc.Invoke(ctx, request, &result); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return result.Updates, nil
|
||||
}
|
||||
Generated
+35
@@ -130,6 +130,8 @@ type ChatAdminRights struct {
|
||||
// 1) https://core.telegram.org/api/monoforum
|
||||
// 2) https://core.telegram.org/api/suggested-posts
|
||||
ManageDirectMessages bool
|
||||
// ManageRanks field of ChatAdminRights.
|
||||
ManageRanks bool
|
||||
}
|
||||
|
||||
// ChatAdminRightsTypeID is TL type id of ChatAdminRights.
|
||||
@@ -198,6 +200,9 @@ func (c *ChatAdminRights) Zero() bool {
|
||||
if !(c.ManageDirectMessages == false) {
|
||||
return false
|
||||
}
|
||||
if !(c.ManageRanks == false) {
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
@@ -229,6 +234,7 @@ func (c *ChatAdminRights) FillFrom(from interface {
|
||||
GetEditStories() (value bool)
|
||||
GetDeleteStories() (value bool)
|
||||
GetManageDirectMessages() (value bool)
|
||||
GetManageRanks() (value bool)
|
||||
}) {
|
||||
c.ChangeInfo = from.GetChangeInfo()
|
||||
c.PostMessages = from.GetPostMessages()
|
||||
@@ -246,6 +252,7 @@ func (c *ChatAdminRights) FillFrom(from interface {
|
||||
c.EditStories = from.GetEditStories()
|
||||
c.DeleteStories = from.GetDeleteStories()
|
||||
c.ManageDirectMessages = from.GetManageDirectMessages()
|
||||
c.ManageRanks = from.GetManageRanks()
|
||||
}
|
||||
|
||||
// TypeID returns type id in TL schema.
|
||||
@@ -351,6 +358,11 @@ func (c *ChatAdminRights) TypeInfo() tdp.Type {
|
||||
SchemaName: "manage_direct_messages",
|
||||
Null: !c.Flags.Has(17),
|
||||
},
|
||||
{
|
||||
Name: "ManageRanks",
|
||||
SchemaName: "manage_ranks",
|
||||
Null: !c.Flags.Has(18),
|
||||
},
|
||||
}
|
||||
return typ
|
||||
}
|
||||
@@ -405,6 +417,9 @@ func (c *ChatAdminRights) SetFlags() {
|
||||
if !(c.ManageDirectMessages == false) {
|
||||
c.Flags.Set(17)
|
||||
}
|
||||
if !(c.ManageRanks == false) {
|
||||
c.Flags.Set(18)
|
||||
}
|
||||
}
|
||||
|
||||
// Encode implements bin.Encoder.
|
||||
@@ -465,6 +480,7 @@ func (c *ChatAdminRights) DecodeBare(b *bin.Buffer) error {
|
||||
c.EditStories = c.Flags.Has(15)
|
||||
c.DeleteStories = c.Flags.Has(16)
|
||||
c.ManageDirectMessages = c.Flags.Has(17)
|
||||
c.ManageRanks = c.Flags.Has(18)
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -771,3 +787,22 @@ func (c *ChatAdminRights) GetManageDirectMessages() (value bool) {
|
||||
}
|
||||
return c.Flags.Has(17)
|
||||
}
|
||||
|
||||
// SetManageRanks sets value of ManageRanks conditional field.
|
||||
func (c *ChatAdminRights) SetManageRanks(value bool) {
|
||||
if value {
|
||||
c.Flags.Set(18)
|
||||
c.ManageRanks = true
|
||||
} else {
|
||||
c.Flags.Unset(18)
|
||||
c.ManageRanks = false
|
||||
}
|
||||
}
|
||||
|
||||
// GetManageRanks returns value of ManageRanks conditional field.
|
||||
func (c *ChatAdminRights) GetManageRanks() (value bool) {
|
||||
if c == nil {
|
||||
return
|
||||
}
|
||||
return c.Flags.Has(18)
|
||||
}
|
||||
|
||||
Generated
+35
@@ -145,6 +145,8 @@ type ChatBannedRights struct {
|
||||
// Links:
|
||||
// 1) https://core.telegram.org/api/channel
|
||||
SendPlain bool
|
||||
// EditRank field of ChatBannedRights.
|
||||
EditRank bool
|
||||
// Validity of said permissions (it is considered forever any value less then 30 seconds
|
||||
// or more then 366 days).
|
||||
UntilDate int
|
||||
@@ -228,6 +230,9 @@ func (c *ChatBannedRights) Zero() bool {
|
||||
if !(c.SendPlain == false) {
|
||||
return false
|
||||
}
|
||||
if !(c.EditRank == false) {
|
||||
return false
|
||||
}
|
||||
if !(c.UntilDate == 0) {
|
||||
return false
|
||||
}
|
||||
@@ -266,6 +271,7 @@ func (c *ChatBannedRights) FillFrom(from interface {
|
||||
GetSendVoices() (value bool)
|
||||
GetSendDocs() (value bool)
|
||||
GetSendPlain() (value bool)
|
||||
GetEditRank() (value bool)
|
||||
GetUntilDate() (value int)
|
||||
}) {
|
||||
c.ViewMessages = from.GetViewMessages()
|
||||
@@ -288,6 +294,7 @@ func (c *ChatBannedRights) FillFrom(from interface {
|
||||
c.SendVoices = from.GetSendVoices()
|
||||
c.SendDocs = from.GetSendDocs()
|
||||
c.SendPlain = from.GetSendPlain()
|
||||
c.EditRank = from.GetEditRank()
|
||||
c.UntilDate = from.GetUntilDate()
|
||||
}
|
||||
|
||||
@@ -414,6 +421,11 @@ func (c *ChatBannedRights) TypeInfo() tdp.Type {
|
||||
SchemaName: "send_plain",
|
||||
Null: !c.Flags.Has(25),
|
||||
},
|
||||
{
|
||||
Name: "EditRank",
|
||||
SchemaName: "edit_rank",
|
||||
Null: !c.Flags.Has(26),
|
||||
},
|
||||
{
|
||||
Name: "UntilDate",
|
||||
SchemaName: "until_date",
|
||||
@@ -484,6 +496,9 @@ func (c *ChatBannedRights) SetFlags() {
|
||||
if !(c.SendPlain == false) {
|
||||
c.Flags.Set(25)
|
||||
}
|
||||
if !(c.EditRank == false) {
|
||||
c.Flags.Set(26)
|
||||
}
|
||||
}
|
||||
|
||||
// Encode implements bin.Encoder.
|
||||
@@ -549,6 +564,7 @@ func (c *ChatBannedRights) DecodeBare(b *bin.Buffer) error {
|
||||
c.SendVoices = c.Flags.Has(23)
|
||||
c.SendDocs = c.Flags.Has(24)
|
||||
c.SendPlain = c.Flags.Has(25)
|
||||
c.EditRank = c.Flags.Has(26)
|
||||
{
|
||||
value, err := b.Int()
|
||||
if err != nil {
|
||||
@@ -939,6 +955,25 @@ func (c *ChatBannedRights) GetSendPlain() (value bool) {
|
||||
return c.Flags.Has(25)
|
||||
}
|
||||
|
||||
// SetEditRank sets value of EditRank conditional field.
|
||||
func (c *ChatBannedRights) SetEditRank(value bool) {
|
||||
if value {
|
||||
c.Flags.Set(26)
|
||||
c.EditRank = true
|
||||
} else {
|
||||
c.Flags.Unset(26)
|
||||
c.EditRank = false
|
||||
}
|
||||
}
|
||||
|
||||
// GetEditRank returns value of EditRank conditional field.
|
||||
func (c *ChatBannedRights) GetEditRank() (value bool) {
|
||||
if c == nil {
|
||||
return
|
||||
}
|
||||
return c.Flags.Has(26)
|
||||
}
|
||||
|
||||
// GetUntilDate returns value of UntilDate field.
|
||||
func (c *ChatBannedRights) GetUntilDate() (value int) {
|
||||
if c == nil {
|
||||
|
||||
Generated
+35
@@ -3295,6 +3295,8 @@ type ChannelForbidden struct {
|
||||
Broadcast bool
|
||||
// Is this a supergroup
|
||||
Megagroup bool
|
||||
// Monoforum field of ChannelForbidden.
|
||||
Monoforum bool
|
||||
// Channel ID
|
||||
ID int64
|
||||
// Access hash
|
||||
@@ -3336,6 +3338,9 @@ func (c *ChannelForbidden) Zero() bool {
|
||||
if !(c.Megagroup == false) {
|
||||
return false
|
||||
}
|
||||
if !(c.Monoforum == false) {
|
||||
return false
|
||||
}
|
||||
if !(c.ID == 0) {
|
||||
return false
|
||||
}
|
||||
@@ -3365,6 +3370,7 @@ func (c *ChannelForbidden) String() string {
|
||||
func (c *ChannelForbidden) FillFrom(from interface {
|
||||
GetBroadcast() (value bool)
|
||||
GetMegagroup() (value bool)
|
||||
GetMonoforum() (value bool)
|
||||
GetID() (value int64)
|
||||
GetAccessHash() (value int64)
|
||||
GetTitle() (value string)
|
||||
@@ -3372,6 +3378,7 @@ func (c *ChannelForbidden) FillFrom(from interface {
|
||||
}) {
|
||||
c.Broadcast = from.GetBroadcast()
|
||||
c.Megagroup = from.GetMegagroup()
|
||||
c.Monoforum = from.GetMonoforum()
|
||||
c.ID = from.GetID()
|
||||
c.AccessHash = from.GetAccessHash()
|
||||
c.Title = from.GetTitle()
|
||||
@@ -3414,6 +3421,11 @@ func (c *ChannelForbidden) TypeInfo() tdp.Type {
|
||||
SchemaName: "megagroup",
|
||||
Null: !c.Flags.Has(8),
|
||||
},
|
||||
{
|
||||
Name: "Monoforum",
|
||||
SchemaName: "monoforum",
|
||||
Null: !c.Flags.Has(10),
|
||||
},
|
||||
{
|
||||
Name: "ID",
|
||||
SchemaName: "id",
|
||||
@@ -3443,6 +3455,9 @@ func (c *ChannelForbidden) SetFlags() {
|
||||
if !(c.Megagroup == false) {
|
||||
c.Flags.Set(8)
|
||||
}
|
||||
if !(c.Monoforum == false) {
|
||||
c.Flags.Set(10)
|
||||
}
|
||||
if !(c.UntilDate == 0) {
|
||||
c.Flags.Set(16)
|
||||
}
|
||||
@@ -3498,6 +3513,7 @@ func (c *ChannelForbidden) DecodeBare(b *bin.Buffer) error {
|
||||
}
|
||||
c.Broadcast = c.Flags.Has(5)
|
||||
c.Megagroup = c.Flags.Has(8)
|
||||
c.Monoforum = c.Flags.Has(10)
|
||||
{
|
||||
value, err := b.Long()
|
||||
if err != nil {
|
||||
@@ -3567,6 +3583,25 @@ func (c *ChannelForbidden) GetMegagroup() (value bool) {
|
||||
return c.Flags.Has(8)
|
||||
}
|
||||
|
||||
// SetMonoforum sets value of Monoforum conditional field.
|
||||
func (c *ChannelForbidden) SetMonoforum(value bool) {
|
||||
if value {
|
||||
c.Flags.Set(10)
|
||||
c.Monoforum = true
|
||||
} else {
|
||||
c.Flags.Unset(10)
|
||||
c.Monoforum = false
|
||||
}
|
||||
}
|
||||
|
||||
// GetMonoforum returns value of Monoforum conditional field.
|
||||
func (c *ChannelForbidden) GetMonoforum() (value bool) {
|
||||
if c == nil {
|
||||
return
|
||||
}
|
||||
return c.Flags.Has(10)
|
||||
}
|
||||
|
||||
// GetID returns value of ID field.
|
||||
func (c *ChannelForbidden) GetID() (value int64) {
|
||||
if c == nil {
|
||||
|
||||
Generated
+235
-34
@@ -31,21 +31,27 @@ var (
|
||||
_ = tdjson.Encoder{}
|
||||
)
|
||||
|
||||
// ChatParticipant represents TL type `chatParticipant#c02d4007`.
|
||||
// ChatParticipant represents TL type `chatParticipant#38e79fde`.
|
||||
// Group member.
|
||||
//
|
||||
// See https://core.telegram.org/constructor/chatParticipant for reference.
|
||||
type ChatParticipant struct {
|
||||
// Flags field of ChatParticipant.
|
||||
Flags bin.Fields
|
||||
// Member user ID
|
||||
UserID int64
|
||||
// ID of the user that added the member to the group
|
||||
InviterID int64
|
||||
// Date added to the group
|
||||
Date int
|
||||
// Rank field of ChatParticipant.
|
||||
//
|
||||
// Use SetRank and GetRank helpers.
|
||||
Rank string
|
||||
}
|
||||
|
||||
// ChatParticipantTypeID is TL type id of ChatParticipant.
|
||||
const ChatParticipantTypeID = 0xc02d4007
|
||||
const ChatParticipantTypeID = 0x38e79fde
|
||||
|
||||
// construct implements constructor of ChatParticipantClass.
|
||||
func (c ChatParticipant) construct() ChatParticipantClass { return &c }
|
||||
@@ -64,6 +70,9 @@ func (c *ChatParticipant) Zero() bool {
|
||||
if c == nil {
|
||||
return true
|
||||
}
|
||||
if !(c.Flags.Zero()) {
|
||||
return false
|
||||
}
|
||||
if !(c.UserID == 0) {
|
||||
return false
|
||||
}
|
||||
@@ -73,6 +82,9 @@ func (c *ChatParticipant) Zero() bool {
|
||||
if !(c.Date == 0) {
|
||||
return false
|
||||
}
|
||||
if !(c.Rank == "") {
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
@@ -91,10 +103,15 @@ func (c *ChatParticipant) FillFrom(from interface {
|
||||
GetUserID() (value int64)
|
||||
GetInviterID() (value int64)
|
||||
GetDate() (value int)
|
||||
GetRank() (value string, ok bool)
|
||||
}) {
|
||||
c.UserID = from.GetUserID()
|
||||
c.InviterID = from.GetInviterID()
|
||||
c.Date = from.GetDate()
|
||||
if val, ok := from.GetRank(); ok {
|
||||
c.Rank = val
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// TypeID returns type id in TL schema.
|
||||
@@ -132,14 +149,26 @@ func (c *ChatParticipant) TypeInfo() tdp.Type {
|
||||
Name: "Date",
|
||||
SchemaName: "date",
|
||||
},
|
||||
{
|
||||
Name: "Rank",
|
||||
SchemaName: "rank",
|
||||
Null: !c.Flags.Has(0),
|
||||
},
|
||||
}
|
||||
return typ
|
||||
}
|
||||
|
||||
// SetFlags sets flags for non-zero fields.
|
||||
func (c *ChatParticipant) SetFlags() {
|
||||
if !(c.Rank == "") {
|
||||
c.Flags.Set(0)
|
||||
}
|
||||
}
|
||||
|
||||
// Encode implements bin.Encoder.
|
||||
func (c *ChatParticipant) Encode(b *bin.Buffer) error {
|
||||
if c == nil {
|
||||
return fmt.Errorf("can't encode chatParticipant#c02d4007 as nil")
|
||||
return fmt.Errorf("can't encode chatParticipant#38e79fde as nil")
|
||||
}
|
||||
b.PutID(ChatParticipantTypeID)
|
||||
return c.EncodeBare(b)
|
||||
@@ -148,21 +177,28 @@ func (c *ChatParticipant) Encode(b *bin.Buffer) error {
|
||||
// EncodeBare implements bin.BareEncoder.
|
||||
func (c *ChatParticipant) EncodeBare(b *bin.Buffer) error {
|
||||
if c == nil {
|
||||
return fmt.Errorf("can't encode chatParticipant#c02d4007 as nil")
|
||||
return fmt.Errorf("can't encode chatParticipant#38e79fde as nil")
|
||||
}
|
||||
c.SetFlags()
|
||||
if err := c.Flags.Encode(b); err != nil {
|
||||
return fmt.Errorf("unable to encode chatParticipant#38e79fde: field flags: %w", err)
|
||||
}
|
||||
b.PutLong(c.UserID)
|
||||
b.PutLong(c.InviterID)
|
||||
b.PutInt(c.Date)
|
||||
if c.Flags.Has(0) {
|
||||
b.PutString(c.Rank)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Decode implements bin.Decoder.
|
||||
func (c *ChatParticipant) Decode(b *bin.Buffer) error {
|
||||
if c == nil {
|
||||
return fmt.Errorf("can't decode chatParticipant#c02d4007 to nil")
|
||||
return fmt.Errorf("can't decode chatParticipant#38e79fde to nil")
|
||||
}
|
||||
if err := b.ConsumeID(ChatParticipantTypeID); err != nil {
|
||||
return fmt.Errorf("unable to decode chatParticipant#c02d4007: %w", err)
|
||||
return fmt.Errorf("unable to decode chatParticipant#38e79fde: %w", err)
|
||||
}
|
||||
return c.DecodeBare(b)
|
||||
}
|
||||
@@ -170,29 +206,41 @@ func (c *ChatParticipant) Decode(b *bin.Buffer) error {
|
||||
// DecodeBare implements bin.BareDecoder.
|
||||
func (c *ChatParticipant) DecodeBare(b *bin.Buffer) error {
|
||||
if c == nil {
|
||||
return fmt.Errorf("can't decode chatParticipant#c02d4007 to nil")
|
||||
return fmt.Errorf("can't decode chatParticipant#38e79fde to nil")
|
||||
}
|
||||
{
|
||||
if err := c.Flags.Decode(b); err != nil {
|
||||
return fmt.Errorf("unable to decode chatParticipant#38e79fde: field flags: %w", err)
|
||||
}
|
||||
}
|
||||
{
|
||||
value, err := b.Long()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode chatParticipant#c02d4007: field user_id: %w", err)
|
||||
return fmt.Errorf("unable to decode chatParticipant#38e79fde: field user_id: %w", err)
|
||||
}
|
||||
c.UserID = value
|
||||
}
|
||||
{
|
||||
value, err := b.Long()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode chatParticipant#c02d4007: field inviter_id: %w", err)
|
||||
return fmt.Errorf("unable to decode chatParticipant#38e79fde: field inviter_id: %w", err)
|
||||
}
|
||||
c.InviterID = value
|
||||
}
|
||||
{
|
||||
value, err := b.Int()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode chatParticipant#c02d4007: field date: %w", err)
|
||||
return fmt.Errorf("unable to decode chatParticipant#38e79fde: field date: %w", err)
|
||||
}
|
||||
c.Date = value
|
||||
}
|
||||
if c.Flags.Has(0) {
|
||||
value, err := b.String()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode chatParticipant#38e79fde: field rank: %w", err)
|
||||
}
|
||||
c.Rank = value
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -220,17 +268,41 @@ func (c *ChatParticipant) GetDate() (value int) {
|
||||
return c.Date
|
||||
}
|
||||
|
||||
// ChatParticipantCreator represents TL type `chatParticipantCreator#e46bcee4`.
|
||||
// SetRank sets value of Rank conditional field.
|
||||
func (c *ChatParticipant) SetRank(value string) {
|
||||
c.Flags.Set(0)
|
||||
c.Rank = value
|
||||
}
|
||||
|
||||
// GetRank returns value of Rank conditional field and
|
||||
// boolean which is true if field was set.
|
||||
func (c *ChatParticipant) GetRank() (value string, ok bool) {
|
||||
if c == nil {
|
||||
return
|
||||
}
|
||||
if !c.Flags.Has(0) {
|
||||
return value, false
|
||||
}
|
||||
return c.Rank, true
|
||||
}
|
||||
|
||||
// ChatParticipantCreator represents TL type `chatParticipantCreator#e1f867b8`.
|
||||
// Represents the creator of the group
|
||||
//
|
||||
// See https://core.telegram.org/constructor/chatParticipantCreator for reference.
|
||||
type ChatParticipantCreator struct {
|
||||
// Flags field of ChatParticipantCreator.
|
||||
Flags bin.Fields
|
||||
// ID of the user that created the group
|
||||
UserID int64
|
||||
// Rank field of ChatParticipantCreator.
|
||||
//
|
||||
// Use SetRank and GetRank helpers.
|
||||
Rank string
|
||||
}
|
||||
|
||||
// ChatParticipantCreatorTypeID is TL type id of ChatParticipantCreator.
|
||||
const ChatParticipantCreatorTypeID = 0xe46bcee4
|
||||
const ChatParticipantCreatorTypeID = 0xe1f867b8
|
||||
|
||||
// construct implements constructor of ChatParticipantClass.
|
||||
func (c ChatParticipantCreator) construct() ChatParticipantClass { return &c }
|
||||
@@ -249,9 +321,15 @@ func (c *ChatParticipantCreator) Zero() bool {
|
||||
if c == nil {
|
||||
return true
|
||||
}
|
||||
if !(c.Flags.Zero()) {
|
||||
return false
|
||||
}
|
||||
if !(c.UserID == 0) {
|
||||
return false
|
||||
}
|
||||
if !(c.Rank == "") {
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
@@ -268,8 +346,13 @@ func (c *ChatParticipantCreator) String() string {
|
||||
// FillFrom fills ChatParticipantCreator from given interface.
|
||||
func (c *ChatParticipantCreator) FillFrom(from interface {
|
||||
GetUserID() (value int64)
|
||||
GetRank() (value string, ok bool)
|
||||
}) {
|
||||
c.UserID = from.GetUserID()
|
||||
if val, ok := from.GetRank(); ok {
|
||||
c.Rank = val
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// TypeID returns type id in TL schema.
|
||||
@@ -299,14 +382,26 @@ func (c *ChatParticipantCreator) TypeInfo() tdp.Type {
|
||||
Name: "UserID",
|
||||
SchemaName: "user_id",
|
||||
},
|
||||
{
|
||||
Name: "Rank",
|
||||
SchemaName: "rank",
|
||||
Null: !c.Flags.Has(0),
|
||||
},
|
||||
}
|
||||
return typ
|
||||
}
|
||||
|
||||
// SetFlags sets flags for non-zero fields.
|
||||
func (c *ChatParticipantCreator) SetFlags() {
|
||||
if !(c.Rank == "") {
|
||||
c.Flags.Set(0)
|
||||
}
|
||||
}
|
||||
|
||||
// Encode implements bin.Encoder.
|
||||
func (c *ChatParticipantCreator) Encode(b *bin.Buffer) error {
|
||||
if c == nil {
|
||||
return fmt.Errorf("can't encode chatParticipantCreator#e46bcee4 as nil")
|
||||
return fmt.Errorf("can't encode chatParticipantCreator#e1f867b8 as nil")
|
||||
}
|
||||
b.PutID(ChatParticipantCreatorTypeID)
|
||||
return c.EncodeBare(b)
|
||||
@@ -315,19 +410,26 @@ func (c *ChatParticipantCreator) Encode(b *bin.Buffer) error {
|
||||
// EncodeBare implements bin.BareEncoder.
|
||||
func (c *ChatParticipantCreator) EncodeBare(b *bin.Buffer) error {
|
||||
if c == nil {
|
||||
return fmt.Errorf("can't encode chatParticipantCreator#e46bcee4 as nil")
|
||||
return fmt.Errorf("can't encode chatParticipantCreator#e1f867b8 as nil")
|
||||
}
|
||||
c.SetFlags()
|
||||
if err := c.Flags.Encode(b); err != nil {
|
||||
return fmt.Errorf("unable to encode chatParticipantCreator#e1f867b8: field flags: %w", err)
|
||||
}
|
||||
b.PutLong(c.UserID)
|
||||
if c.Flags.Has(0) {
|
||||
b.PutString(c.Rank)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Decode implements bin.Decoder.
|
||||
func (c *ChatParticipantCreator) Decode(b *bin.Buffer) error {
|
||||
if c == nil {
|
||||
return fmt.Errorf("can't decode chatParticipantCreator#e46bcee4 to nil")
|
||||
return fmt.Errorf("can't decode chatParticipantCreator#e1f867b8 to nil")
|
||||
}
|
||||
if err := b.ConsumeID(ChatParticipantCreatorTypeID); err != nil {
|
||||
return fmt.Errorf("unable to decode chatParticipantCreator#e46bcee4: %w", err)
|
||||
return fmt.Errorf("unable to decode chatParticipantCreator#e1f867b8: %w", err)
|
||||
}
|
||||
return c.DecodeBare(b)
|
||||
}
|
||||
@@ -335,15 +437,27 @@ func (c *ChatParticipantCreator) Decode(b *bin.Buffer) error {
|
||||
// DecodeBare implements bin.BareDecoder.
|
||||
func (c *ChatParticipantCreator) DecodeBare(b *bin.Buffer) error {
|
||||
if c == nil {
|
||||
return fmt.Errorf("can't decode chatParticipantCreator#e46bcee4 to nil")
|
||||
return fmt.Errorf("can't decode chatParticipantCreator#e1f867b8 to nil")
|
||||
}
|
||||
{
|
||||
if err := c.Flags.Decode(b); err != nil {
|
||||
return fmt.Errorf("unable to decode chatParticipantCreator#e1f867b8: field flags: %w", err)
|
||||
}
|
||||
}
|
||||
{
|
||||
value, err := b.Long()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode chatParticipantCreator#e46bcee4: field user_id: %w", err)
|
||||
return fmt.Errorf("unable to decode chatParticipantCreator#e1f867b8: field user_id: %w", err)
|
||||
}
|
||||
c.UserID = value
|
||||
}
|
||||
if c.Flags.Has(0) {
|
||||
value, err := b.String()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode chatParticipantCreator#e1f867b8: field rank: %w", err)
|
||||
}
|
||||
c.Rank = value
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -355,21 +469,45 @@ func (c *ChatParticipantCreator) GetUserID() (value int64) {
|
||||
return c.UserID
|
||||
}
|
||||
|
||||
// ChatParticipantAdmin represents TL type `chatParticipantAdmin#a0933f5b`.
|
||||
// SetRank sets value of Rank conditional field.
|
||||
func (c *ChatParticipantCreator) SetRank(value string) {
|
||||
c.Flags.Set(0)
|
||||
c.Rank = value
|
||||
}
|
||||
|
||||
// GetRank returns value of Rank conditional field and
|
||||
// boolean which is true if field was set.
|
||||
func (c *ChatParticipantCreator) GetRank() (value string, ok bool) {
|
||||
if c == nil {
|
||||
return
|
||||
}
|
||||
if !c.Flags.Has(0) {
|
||||
return value, false
|
||||
}
|
||||
return c.Rank, true
|
||||
}
|
||||
|
||||
// ChatParticipantAdmin represents TL type `chatParticipantAdmin#360d5d2`.
|
||||
// Chat admin
|
||||
//
|
||||
// See https://core.telegram.org/constructor/chatParticipantAdmin for reference.
|
||||
type ChatParticipantAdmin struct {
|
||||
// Flags field of ChatParticipantAdmin.
|
||||
Flags bin.Fields
|
||||
// ID of a group member that is admin
|
||||
UserID int64
|
||||
// ID of the user that added the member to the group
|
||||
InviterID int64
|
||||
// Date when the user was added
|
||||
Date int
|
||||
// Rank field of ChatParticipantAdmin.
|
||||
//
|
||||
// Use SetRank and GetRank helpers.
|
||||
Rank string
|
||||
}
|
||||
|
||||
// ChatParticipantAdminTypeID is TL type id of ChatParticipantAdmin.
|
||||
const ChatParticipantAdminTypeID = 0xa0933f5b
|
||||
const ChatParticipantAdminTypeID = 0x360d5d2
|
||||
|
||||
// construct implements constructor of ChatParticipantClass.
|
||||
func (c ChatParticipantAdmin) construct() ChatParticipantClass { return &c }
|
||||
@@ -388,6 +526,9 @@ func (c *ChatParticipantAdmin) Zero() bool {
|
||||
if c == nil {
|
||||
return true
|
||||
}
|
||||
if !(c.Flags.Zero()) {
|
||||
return false
|
||||
}
|
||||
if !(c.UserID == 0) {
|
||||
return false
|
||||
}
|
||||
@@ -397,6 +538,9 @@ func (c *ChatParticipantAdmin) Zero() bool {
|
||||
if !(c.Date == 0) {
|
||||
return false
|
||||
}
|
||||
if !(c.Rank == "") {
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
@@ -415,10 +559,15 @@ func (c *ChatParticipantAdmin) FillFrom(from interface {
|
||||
GetUserID() (value int64)
|
||||
GetInviterID() (value int64)
|
||||
GetDate() (value int)
|
||||
GetRank() (value string, ok bool)
|
||||
}) {
|
||||
c.UserID = from.GetUserID()
|
||||
c.InviterID = from.GetInviterID()
|
||||
c.Date = from.GetDate()
|
||||
if val, ok := from.GetRank(); ok {
|
||||
c.Rank = val
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// TypeID returns type id in TL schema.
|
||||
@@ -456,14 +605,26 @@ func (c *ChatParticipantAdmin) TypeInfo() tdp.Type {
|
||||
Name: "Date",
|
||||
SchemaName: "date",
|
||||
},
|
||||
{
|
||||
Name: "Rank",
|
||||
SchemaName: "rank",
|
||||
Null: !c.Flags.Has(0),
|
||||
},
|
||||
}
|
||||
return typ
|
||||
}
|
||||
|
||||
// SetFlags sets flags for non-zero fields.
|
||||
func (c *ChatParticipantAdmin) SetFlags() {
|
||||
if !(c.Rank == "") {
|
||||
c.Flags.Set(0)
|
||||
}
|
||||
}
|
||||
|
||||
// Encode implements bin.Encoder.
|
||||
func (c *ChatParticipantAdmin) Encode(b *bin.Buffer) error {
|
||||
if c == nil {
|
||||
return fmt.Errorf("can't encode chatParticipantAdmin#a0933f5b as nil")
|
||||
return fmt.Errorf("can't encode chatParticipantAdmin#360d5d2 as nil")
|
||||
}
|
||||
b.PutID(ChatParticipantAdminTypeID)
|
||||
return c.EncodeBare(b)
|
||||
@@ -472,21 +633,28 @@ func (c *ChatParticipantAdmin) Encode(b *bin.Buffer) error {
|
||||
// EncodeBare implements bin.BareEncoder.
|
||||
func (c *ChatParticipantAdmin) EncodeBare(b *bin.Buffer) error {
|
||||
if c == nil {
|
||||
return fmt.Errorf("can't encode chatParticipantAdmin#a0933f5b as nil")
|
||||
return fmt.Errorf("can't encode chatParticipantAdmin#360d5d2 as nil")
|
||||
}
|
||||
c.SetFlags()
|
||||
if err := c.Flags.Encode(b); err != nil {
|
||||
return fmt.Errorf("unable to encode chatParticipantAdmin#360d5d2: field flags: %w", err)
|
||||
}
|
||||
b.PutLong(c.UserID)
|
||||
b.PutLong(c.InviterID)
|
||||
b.PutInt(c.Date)
|
||||
if c.Flags.Has(0) {
|
||||
b.PutString(c.Rank)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Decode implements bin.Decoder.
|
||||
func (c *ChatParticipantAdmin) Decode(b *bin.Buffer) error {
|
||||
if c == nil {
|
||||
return fmt.Errorf("can't decode chatParticipantAdmin#a0933f5b to nil")
|
||||
return fmt.Errorf("can't decode chatParticipantAdmin#360d5d2 to nil")
|
||||
}
|
||||
if err := b.ConsumeID(ChatParticipantAdminTypeID); err != nil {
|
||||
return fmt.Errorf("unable to decode chatParticipantAdmin#a0933f5b: %w", err)
|
||||
return fmt.Errorf("unable to decode chatParticipantAdmin#360d5d2: %w", err)
|
||||
}
|
||||
return c.DecodeBare(b)
|
||||
}
|
||||
@@ -494,29 +662,41 @@ func (c *ChatParticipantAdmin) Decode(b *bin.Buffer) error {
|
||||
// DecodeBare implements bin.BareDecoder.
|
||||
func (c *ChatParticipantAdmin) DecodeBare(b *bin.Buffer) error {
|
||||
if c == nil {
|
||||
return fmt.Errorf("can't decode chatParticipantAdmin#a0933f5b to nil")
|
||||
return fmt.Errorf("can't decode chatParticipantAdmin#360d5d2 to nil")
|
||||
}
|
||||
{
|
||||
if err := c.Flags.Decode(b); err != nil {
|
||||
return fmt.Errorf("unable to decode chatParticipantAdmin#360d5d2: field flags: %w", err)
|
||||
}
|
||||
}
|
||||
{
|
||||
value, err := b.Long()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode chatParticipantAdmin#a0933f5b: field user_id: %w", err)
|
||||
return fmt.Errorf("unable to decode chatParticipantAdmin#360d5d2: field user_id: %w", err)
|
||||
}
|
||||
c.UserID = value
|
||||
}
|
||||
{
|
||||
value, err := b.Long()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode chatParticipantAdmin#a0933f5b: field inviter_id: %w", err)
|
||||
return fmt.Errorf("unable to decode chatParticipantAdmin#360d5d2: field inviter_id: %w", err)
|
||||
}
|
||||
c.InviterID = value
|
||||
}
|
||||
{
|
||||
value, err := b.Int()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode chatParticipantAdmin#a0933f5b: field date: %w", err)
|
||||
return fmt.Errorf("unable to decode chatParticipantAdmin#360d5d2: field date: %w", err)
|
||||
}
|
||||
c.Date = value
|
||||
}
|
||||
if c.Flags.Has(0) {
|
||||
value, err := b.String()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode chatParticipantAdmin#360d5d2: field rank: %w", err)
|
||||
}
|
||||
c.Rank = value
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -544,6 +724,24 @@ func (c *ChatParticipantAdmin) GetDate() (value int) {
|
||||
return c.Date
|
||||
}
|
||||
|
||||
// SetRank sets value of Rank conditional field.
|
||||
func (c *ChatParticipantAdmin) SetRank(value string) {
|
||||
c.Flags.Set(0)
|
||||
c.Rank = value
|
||||
}
|
||||
|
||||
// GetRank returns value of Rank conditional field and
|
||||
// boolean which is true if field was set.
|
||||
func (c *ChatParticipantAdmin) GetRank() (value string, ok bool) {
|
||||
if c == nil {
|
||||
return
|
||||
}
|
||||
if !c.Flags.Has(0) {
|
||||
return value, false
|
||||
}
|
||||
return c.Rank, true
|
||||
}
|
||||
|
||||
// ChatParticipantClassName is schema name of ChatParticipantClass.
|
||||
const ChatParticipantClassName = "ChatParticipant"
|
||||
|
||||
@@ -558,9 +756,9 @@ const ChatParticipantClassName = "ChatParticipant"
|
||||
// panic(err)
|
||||
// }
|
||||
// switch v := g.(type) {
|
||||
// case *tg.ChatParticipant: // chatParticipant#c02d4007
|
||||
// case *tg.ChatParticipantCreator: // chatParticipantCreator#e46bcee4
|
||||
// case *tg.ChatParticipantAdmin: // chatParticipantAdmin#a0933f5b
|
||||
// case *tg.ChatParticipant: // chatParticipant#38e79fde
|
||||
// case *tg.ChatParticipantCreator: // chatParticipantCreator#e1f867b8
|
||||
// case *tg.ChatParticipantAdmin: // chatParticipantAdmin#360d5d2
|
||||
// default: panic(v)
|
||||
// }
|
||||
type ChatParticipantClass interface {
|
||||
@@ -583,6 +781,9 @@ type ChatParticipantClass interface {
|
||||
|
||||
// Member user ID
|
||||
GetUserID() (value int64)
|
||||
|
||||
// Rank field of ChatParticipant.
|
||||
GetRank() (value string, ok bool)
|
||||
}
|
||||
|
||||
// DecodeChatParticipant implements binary de-serialization for ChatParticipantClass.
|
||||
@@ -593,21 +794,21 @@ func DecodeChatParticipant(buf *bin.Buffer) (ChatParticipantClass, error) {
|
||||
}
|
||||
switch id {
|
||||
case ChatParticipantTypeID:
|
||||
// Decoding chatParticipant#c02d4007.
|
||||
// Decoding chatParticipant#38e79fde.
|
||||
v := ChatParticipant{}
|
||||
if err := v.Decode(buf); err != nil {
|
||||
return nil, fmt.Errorf("unable to decode ChatParticipantClass: %w", err)
|
||||
}
|
||||
return &v, nil
|
||||
case ChatParticipantCreatorTypeID:
|
||||
// Decoding chatParticipantCreator#e46bcee4.
|
||||
// Decoding chatParticipantCreator#e1f867b8.
|
||||
v := ChatParticipantCreator{}
|
||||
if err := v.Decode(buf); err != nil {
|
||||
return nil, fmt.Errorf("unable to decode ChatParticipantClass: %w", err)
|
||||
}
|
||||
return &v, nil
|
||||
case ChatParticipantAdminTypeID:
|
||||
// Decoding chatParticipantAdmin#a0933f5b.
|
||||
// Decoding chatParticipantAdmin#360d5d2.
|
||||
v := ChatParticipantAdmin{}
|
||||
if err := v.Decode(buf); err != nil {
|
||||
return nil, fmt.Errorf("unable to decode ChatParticipantClass: %w", err)
|
||||
|
||||
Generated
-35
@@ -41,8 +41,6 @@ type GroupCallDonor struct {
|
||||
Top bool
|
||||
// My field of GroupCallDonor.
|
||||
My bool
|
||||
// Anonymous field of GroupCallDonor.
|
||||
Anonymous bool
|
||||
// PeerID field of GroupCallDonor.
|
||||
//
|
||||
// Use SetPeerID and GetPeerID helpers.
|
||||
@@ -75,9 +73,6 @@ func (g *GroupCallDonor) Zero() bool {
|
||||
if !(g.My == false) {
|
||||
return false
|
||||
}
|
||||
if !(g.Anonymous == false) {
|
||||
return false
|
||||
}
|
||||
if !(g.PeerID == nil) {
|
||||
return false
|
||||
}
|
||||
@@ -101,13 +96,11 @@ func (g *GroupCallDonor) String() string {
|
||||
func (g *GroupCallDonor) FillFrom(from interface {
|
||||
GetTop() (value bool)
|
||||
GetMy() (value bool)
|
||||
GetAnonymous() (value bool)
|
||||
GetPeerID() (value PeerClass, ok bool)
|
||||
GetStars() (value int64)
|
||||
}) {
|
||||
g.Top = from.GetTop()
|
||||
g.My = from.GetMy()
|
||||
g.Anonymous = from.GetAnonymous()
|
||||
if val, ok := from.GetPeerID(); ok {
|
||||
g.PeerID = val
|
||||
}
|
||||
@@ -148,11 +141,6 @@ func (g *GroupCallDonor) TypeInfo() tdp.Type {
|
||||
SchemaName: "my",
|
||||
Null: !g.Flags.Has(1),
|
||||
},
|
||||
{
|
||||
Name: "Anonymous",
|
||||
SchemaName: "anonymous",
|
||||
Null: !g.Flags.Has(2),
|
||||
},
|
||||
{
|
||||
Name: "PeerID",
|
||||
SchemaName: "peer_id",
|
||||
@@ -174,9 +162,6 @@ func (g *GroupCallDonor) SetFlags() {
|
||||
if !(g.My == false) {
|
||||
g.Flags.Set(1)
|
||||
}
|
||||
if !(g.Anonymous == false) {
|
||||
g.Flags.Set(2)
|
||||
}
|
||||
if !(g.PeerID == nil) {
|
||||
g.Flags.Set(3)
|
||||
}
|
||||
@@ -235,7 +220,6 @@ func (g *GroupCallDonor) DecodeBare(b *bin.Buffer) error {
|
||||
}
|
||||
g.Top = g.Flags.Has(0)
|
||||
g.My = g.Flags.Has(1)
|
||||
g.Anonymous = g.Flags.Has(2)
|
||||
if g.Flags.Has(3) {
|
||||
value, err := DecodePeer(b)
|
||||
if err != nil {
|
||||
@@ -291,25 +275,6 @@ func (g *GroupCallDonor) GetMy() (value bool) {
|
||||
return g.Flags.Has(1)
|
||||
}
|
||||
|
||||
// SetAnonymous sets value of Anonymous conditional field.
|
||||
func (g *GroupCallDonor) SetAnonymous(value bool) {
|
||||
if value {
|
||||
g.Flags.Set(2)
|
||||
g.Anonymous = true
|
||||
} else {
|
||||
g.Flags.Unset(2)
|
||||
g.Anonymous = false
|
||||
}
|
||||
}
|
||||
|
||||
// GetAnonymous returns value of Anonymous conditional field.
|
||||
func (g *GroupCallDonor) GetAnonymous() (value bool) {
|
||||
if g == nil {
|
||||
return
|
||||
}
|
||||
return g.Flags.Has(2)
|
||||
}
|
||||
|
||||
// SetPeerID sets value of PeerID conditional field.
|
||||
func (g *GroupCallDonor) SetPeerID(value PeerClass) {
|
||||
g.Flags.Set(3)
|
||||
|
||||
Generated
+30
@@ -1531,6 +1531,36 @@ func (u UpdateDispatcher) OnStarGiftAuctionUserState(handler StarGiftAuctionUser
|
||||
}
|
||||
}
|
||||
|
||||
// EmojiGameInfoHandler is a EmojiGameInfo event handler.
|
||||
type EmojiGameInfoHandler func(ctx context.Context, e Entities, update *UpdateEmojiGameInfo) error
|
||||
|
||||
// OnEmojiGameInfo sets EmojiGameInfo handler.
|
||||
func (u UpdateDispatcher) OnEmojiGameInfo(handler EmojiGameInfoHandler) {
|
||||
u.handlers[UpdateEmojiGameInfoTypeID] = func(ctx context.Context, e Entities, update UpdateClass) error {
|
||||
return handler(ctx, e, update.(*UpdateEmojiGameInfo))
|
||||
}
|
||||
}
|
||||
|
||||
// StarGiftCraftFailHandler is a StarGiftCraftFail event handler.
|
||||
type StarGiftCraftFailHandler func(ctx context.Context, e Entities, update *UpdateStarGiftCraftFail) error
|
||||
|
||||
// OnStarGiftCraftFail sets StarGiftCraftFail handler.
|
||||
func (u UpdateDispatcher) OnStarGiftCraftFail(handler StarGiftCraftFailHandler) {
|
||||
u.handlers[UpdateStarGiftCraftFailTypeID] = func(ctx context.Context, e Entities, update UpdateClass) error {
|
||||
return handler(ctx, e, update.(*UpdateStarGiftCraftFail))
|
||||
}
|
||||
}
|
||||
|
||||
// ChatParticipantRankHandler is a ChatParticipantRank event handler.
|
||||
type ChatParticipantRankHandler func(ctx context.Context, e Entities, update *UpdateChatParticipantRank) error
|
||||
|
||||
// OnChatParticipantRank sets ChatParticipantRank handler.
|
||||
func (u UpdateDispatcher) OnChatParticipantRank(handler ChatParticipantRankHandler) {
|
||||
u.handlers[UpdateChatParticipantRankTypeID] = func(ctx context.Context, e Entities, update UpdateClass) error {
|
||||
return handler(ctx, e, update.(*UpdateChatParticipantRank))
|
||||
}
|
||||
}
|
||||
|
||||
// OnFallback sets fallback handler.
|
||||
func (u *UpdateDispatcher) OnFallback(handler Handler) {
|
||||
u.fallback = handler
|
||||
|
||||
Generated
+196
@@ -5213,6 +5213,194 @@ func (i *InputMediaTodo) GetTodo() (value TodoList) {
|
||||
return i.Todo
|
||||
}
|
||||
|
||||
// InputMediaStakeDice represents TL type `inputMediaStakeDice#f3a9244a`.
|
||||
//
|
||||
// See https://core.telegram.org/constructor/inputMediaStakeDice for reference.
|
||||
type InputMediaStakeDice struct {
|
||||
// GameHash field of InputMediaStakeDice.
|
||||
GameHash string
|
||||
// TonAmount field of InputMediaStakeDice.
|
||||
TonAmount int64
|
||||
// ClientSeed field of InputMediaStakeDice.
|
||||
ClientSeed []byte
|
||||
}
|
||||
|
||||
// InputMediaStakeDiceTypeID is TL type id of InputMediaStakeDice.
|
||||
const InputMediaStakeDiceTypeID = 0xf3a9244a
|
||||
|
||||
// construct implements constructor of InputMediaClass.
|
||||
func (i InputMediaStakeDice) construct() InputMediaClass { return &i }
|
||||
|
||||
// Ensuring interfaces in compile-time for InputMediaStakeDice.
|
||||
var (
|
||||
_ bin.Encoder = &InputMediaStakeDice{}
|
||||
_ bin.Decoder = &InputMediaStakeDice{}
|
||||
_ bin.BareEncoder = &InputMediaStakeDice{}
|
||||
_ bin.BareDecoder = &InputMediaStakeDice{}
|
||||
|
||||
_ InputMediaClass = &InputMediaStakeDice{}
|
||||
)
|
||||
|
||||
func (i *InputMediaStakeDice) Zero() bool {
|
||||
if i == nil {
|
||||
return true
|
||||
}
|
||||
if !(i.GameHash == "") {
|
||||
return false
|
||||
}
|
||||
if !(i.TonAmount == 0) {
|
||||
return false
|
||||
}
|
||||
if !(i.ClientSeed == nil) {
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
// String implements fmt.Stringer.
|
||||
func (i *InputMediaStakeDice) String() string {
|
||||
if i == nil {
|
||||
return "InputMediaStakeDice(nil)"
|
||||
}
|
||||
type Alias InputMediaStakeDice
|
||||
return fmt.Sprintf("InputMediaStakeDice%+v", Alias(*i))
|
||||
}
|
||||
|
||||
// FillFrom fills InputMediaStakeDice from given interface.
|
||||
func (i *InputMediaStakeDice) FillFrom(from interface {
|
||||
GetGameHash() (value string)
|
||||
GetTonAmount() (value int64)
|
||||
GetClientSeed() (value []byte)
|
||||
}) {
|
||||
i.GameHash = from.GetGameHash()
|
||||
i.TonAmount = from.GetTonAmount()
|
||||
i.ClientSeed = from.GetClientSeed()
|
||||
}
|
||||
|
||||
// TypeID returns type id in TL schema.
|
||||
//
|
||||
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
||||
func (*InputMediaStakeDice) TypeID() uint32 {
|
||||
return InputMediaStakeDiceTypeID
|
||||
}
|
||||
|
||||
// TypeName returns name of type in TL schema.
|
||||
func (*InputMediaStakeDice) TypeName() string {
|
||||
return "inputMediaStakeDice"
|
||||
}
|
||||
|
||||
// TypeInfo returns info about TL type.
|
||||
func (i *InputMediaStakeDice) TypeInfo() tdp.Type {
|
||||
typ := tdp.Type{
|
||||
Name: "inputMediaStakeDice",
|
||||
ID: InputMediaStakeDiceTypeID,
|
||||
}
|
||||
if i == nil {
|
||||
typ.Null = true
|
||||
return typ
|
||||
}
|
||||
typ.Fields = []tdp.Field{
|
||||
{
|
||||
Name: "GameHash",
|
||||
SchemaName: "game_hash",
|
||||
},
|
||||
{
|
||||
Name: "TonAmount",
|
||||
SchemaName: "ton_amount",
|
||||
},
|
||||
{
|
||||
Name: "ClientSeed",
|
||||
SchemaName: "client_seed",
|
||||
},
|
||||
}
|
||||
return typ
|
||||
}
|
||||
|
||||
// Encode implements bin.Encoder.
|
||||
func (i *InputMediaStakeDice) Encode(b *bin.Buffer) error {
|
||||
if i == nil {
|
||||
return fmt.Errorf("can't encode inputMediaStakeDice#f3a9244a as nil")
|
||||
}
|
||||
b.PutID(InputMediaStakeDiceTypeID)
|
||||
return i.EncodeBare(b)
|
||||
}
|
||||
|
||||
// EncodeBare implements bin.BareEncoder.
|
||||
func (i *InputMediaStakeDice) EncodeBare(b *bin.Buffer) error {
|
||||
if i == nil {
|
||||
return fmt.Errorf("can't encode inputMediaStakeDice#f3a9244a as nil")
|
||||
}
|
||||
b.PutString(i.GameHash)
|
||||
b.PutLong(i.TonAmount)
|
||||
b.PutBytes(i.ClientSeed)
|
||||
return nil
|
||||
}
|
||||
|
||||
// Decode implements bin.Decoder.
|
||||
func (i *InputMediaStakeDice) Decode(b *bin.Buffer) error {
|
||||
if i == nil {
|
||||
return fmt.Errorf("can't decode inputMediaStakeDice#f3a9244a to nil")
|
||||
}
|
||||
if err := b.ConsumeID(InputMediaStakeDiceTypeID); err != nil {
|
||||
return fmt.Errorf("unable to decode inputMediaStakeDice#f3a9244a: %w", err)
|
||||
}
|
||||
return i.DecodeBare(b)
|
||||
}
|
||||
|
||||
// DecodeBare implements bin.BareDecoder.
|
||||
func (i *InputMediaStakeDice) DecodeBare(b *bin.Buffer) error {
|
||||
if i == nil {
|
||||
return fmt.Errorf("can't decode inputMediaStakeDice#f3a9244a to nil")
|
||||
}
|
||||
{
|
||||
value, err := b.String()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode inputMediaStakeDice#f3a9244a: field game_hash: %w", err)
|
||||
}
|
||||
i.GameHash = value
|
||||
}
|
||||
{
|
||||
value, err := b.Long()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode inputMediaStakeDice#f3a9244a: field ton_amount: %w", err)
|
||||
}
|
||||
i.TonAmount = value
|
||||
}
|
||||
{
|
||||
value, err := b.Bytes()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode inputMediaStakeDice#f3a9244a: field client_seed: %w", err)
|
||||
}
|
||||
i.ClientSeed = value
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// GetGameHash returns value of GameHash field.
|
||||
func (i *InputMediaStakeDice) GetGameHash() (value string) {
|
||||
if i == nil {
|
||||
return
|
||||
}
|
||||
return i.GameHash
|
||||
}
|
||||
|
||||
// GetTonAmount returns value of TonAmount field.
|
||||
func (i *InputMediaStakeDice) GetTonAmount() (value int64) {
|
||||
if i == nil {
|
||||
return
|
||||
}
|
||||
return i.TonAmount
|
||||
}
|
||||
|
||||
// GetClientSeed returns value of ClientSeed field.
|
||||
func (i *InputMediaStakeDice) GetClientSeed() (value []byte) {
|
||||
if i == nil {
|
||||
return
|
||||
}
|
||||
return i.ClientSeed
|
||||
}
|
||||
|
||||
// InputMediaClassName is schema name of InputMediaClass.
|
||||
const InputMediaClassName = "InputMedia"
|
||||
|
||||
@@ -5246,6 +5434,7 @@ const InputMediaClassName = "InputMedia"
|
||||
// case *tg.InputMediaWebPage: // inputMediaWebPage#c21b8849
|
||||
// case *tg.InputMediaPaidMedia: // inputMediaPaidMedia#c4103386
|
||||
// case *tg.InputMediaTodo: // inputMediaTodo#9fc55fde
|
||||
// case *tg.InputMediaStakeDice: // inputMediaStakeDice#f3a9244a
|
||||
// default: panic(v)
|
||||
// }
|
||||
type InputMediaClass interface {
|
||||
@@ -5407,6 +5596,13 @@ func DecodeInputMedia(buf *bin.Buffer) (InputMediaClass, error) {
|
||||
return nil, fmt.Errorf("unable to decode InputMediaClass: %w", err)
|
||||
}
|
||||
return &v, nil
|
||||
case InputMediaStakeDiceTypeID:
|
||||
// Decoding inputMediaStakeDice#f3a9244a.
|
||||
v := InputMediaStakeDice{}
|
||||
if err := v.Decode(buf); err != nil {
|
||||
return nil, fmt.Errorf("unable to decode InputMediaClass: %w", err)
|
||||
}
|
||||
return &v, nil
|
||||
default:
|
||||
return nil, fmt.Errorf("unable to decode InputMediaClass: %w", bin.NewUnexpectedID(id))
|
||||
}
|
||||
|
||||
Generated
+95
@@ -350,6 +350,19 @@ func (s InputMediaClassArray) AsInputMediaTodo() (to InputMediaTodoArray) {
|
||||
return to
|
||||
}
|
||||
|
||||
// AsInputMediaStakeDice returns copy with only InputMediaStakeDice constructors.
|
||||
func (s InputMediaClassArray) AsInputMediaStakeDice() (to InputMediaStakeDiceArray) {
|
||||
for _, elem := range s {
|
||||
value, ok := elem.(*InputMediaStakeDice)
|
||||
if !ok {
|
||||
continue
|
||||
}
|
||||
to = append(to, *value)
|
||||
}
|
||||
|
||||
return to
|
||||
}
|
||||
|
||||
// InputMediaUploadedPhotoArray is adapter for slice of InputMediaUploadedPhoto.
|
||||
type InputMediaUploadedPhotoArray []InputMediaUploadedPhoto
|
||||
|
||||
@@ -1853,3 +1866,85 @@ func (s *InputMediaTodoArray) Pop() (v InputMediaTodo, ok bool) {
|
||||
|
||||
return v, true
|
||||
}
|
||||
|
||||
// InputMediaStakeDiceArray is adapter for slice of InputMediaStakeDice.
|
||||
type InputMediaStakeDiceArray []InputMediaStakeDice
|
||||
|
||||
// Sort sorts slice of InputMediaStakeDice.
|
||||
func (s InputMediaStakeDiceArray) Sort(less func(a, b InputMediaStakeDice) bool) InputMediaStakeDiceArray {
|
||||
sort.Slice(s, func(i, j int) bool {
|
||||
return less(s[i], s[j])
|
||||
})
|
||||
return s
|
||||
}
|
||||
|
||||
// SortStable sorts slice of InputMediaStakeDice.
|
||||
func (s InputMediaStakeDiceArray) SortStable(less func(a, b InputMediaStakeDice) bool) InputMediaStakeDiceArray {
|
||||
sort.SliceStable(s, func(i, j int) bool {
|
||||
return less(s[i], s[j])
|
||||
})
|
||||
return s
|
||||
}
|
||||
|
||||
// Retain filters in-place slice of InputMediaStakeDice.
|
||||
func (s InputMediaStakeDiceArray) Retain(keep func(x InputMediaStakeDice) bool) InputMediaStakeDiceArray {
|
||||
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 InputMediaStakeDiceArray) First() (v InputMediaStakeDice, ok bool) {
|
||||
if len(s) < 1 {
|
||||
return
|
||||
}
|
||||
return s[0], true
|
||||
}
|
||||
|
||||
// Last returns last element of slice (if exists).
|
||||
func (s InputMediaStakeDiceArray) Last() (v InputMediaStakeDice, 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 *InputMediaStakeDiceArray) PopFirst() (v InputMediaStakeDice, 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 InputMediaStakeDice
|
||||
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 *InputMediaStakeDiceArray) Pop() (v InputMediaStakeDice, 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
|
||||
}
|
||||
|
||||
+448
@@ -0,0 +1,448 @@
|
||||
// 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{}
|
||||
)
|
||||
|
||||
// InputPasskeyCredentialPublicKey represents TL type `inputPasskeyCredentialPublicKey#3c27b78f`.
|
||||
//
|
||||
// See https://core.telegram.org/constructor/inputPasskeyCredentialPublicKey for reference.
|
||||
type InputPasskeyCredentialPublicKey struct {
|
||||
// ID field of InputPasskeyCredentialPublicKey.
|
||||
ID string
|
||||
// RawID field of InputPasskeyCredentialPublicKey.
|
||||
RawID string
|
||||
// Response field of InputPasskeyCredentialPublicKey.
|
||||
Response InputPasskeyResponseClass
|
||||
}
|
||||
|
||||
// InputPasskeyCredentialPublicKeyTypeID is TL type id of InputPasskeyCredentialPublicKey.
|
||||
const InputPasskeyCredentialPublicKeyTypeID = 0x3c27b78f
|
||||
|
||||
// construct implements constructor of InputPasskeyCredentialClass.
|
||||
func (i InputPasskeyCredentialPublicKey) construct() InputPasskeyCredentialClass { return &i }
|
||||
|
||||
// Ensuring interfaces in compile-time for InputPasskeyCredentialPublicKey.
|
||||
var (
|
||||
_ bin.Encoder = &InputPasskeyCredentialPublicKey{}
|
||||
_ bin.Decoder = &InputPasskeyCredentialPublicKey{}
|
||||
_ bin.BareEncoder = &InputPasskeyCredentialPublicKey{}
|
||||
_ bin.BareDecoder = &InputPasskeyCredentialPublicKey{}
|
||||
|
||||
_ InputPasskeyCredentialClass = &InputPasskeyCredentialPublicKey{}
|
||||
)
|
||||
|
||||
func (i *InputPasskeyCredentialPublicKey) Zero() bool {
|
||||
if i == nil {
|
||||
return true
|
||||
}
|
||||
if !(i.ID == "") {
|
||||
return false
|
||||
}
|
||||
if !(i.RawID == "") {
|
||||
return false
|
||||
}
|
||||
if !(i.Response == nil) {
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
// String implements fmt.Stringer.
|
||||
func (i *InputPasskeyCredentialPublicKey) String() string {
|
||||
if i == nil {
|
||||
return "InputPasskeyCredentialPublicKey(nil)"
|
||||
}
|
||||
type Alias InputPasskeyCredentialPublicKey
|
||||
return fmt.Sprintf("InputPasskeyCredentialPublicKey%+v", Alias(*i))
|
||||
}
|
||||
|
||||
// FillFrom fills InputPasskeyCredentialPublicKey from given interface.
|
||||
func (i *InputPasskeyCredentialPublicKey) FillFrom(from interface {
|
||||
GetID() (value string)
|
||||
GetRawID() (value string)
|
||||
GetResponse() (value InputPasskeyResponseClass)
|
||||
}) {
|
||||
i.ID = from.GetID()
|
||||
i.RawID = from.GetRawID()
|
||||
i.Response = from.GetResponse()
|
||||
}
|
||||
|
||||
// TypeID returns type id in TL schema.
|
||||
//
|
||||
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
||||
func (*InputPasskeyCredentialPublicKey) TypeID() uint32 {
|
||||
return InputPasskeyCredentialPublicKeyTypeID
|
||||
}
|
||||
|
||||
// TypeName returns name of type in TL schema.
|
||||
func (*InputPasskeyCredentialPublicKey) TypeName() string {
|
||||
return "inputPasskeyCredentialPublicKey"
|
||||
}
|
||||
|
||||
// TypeInfo returns info about TL type.
|
||||
func (i *InputPasskeyCredentialPublicKey) TypeInfo() tdp.Type {
|
||||
typ := tdp.Type{
|
||||
Name: "inputPasskeyCredentialPublicKey",
|
||||
ID: InputPasskeyCredentialPublicKeyTypeID,
|
||||
}
|
||||
if i == nil {
|
||||
typ.Null = true
|
||||
return typ
|
||||
}
|
||||
typ.Fields = []tdp.Field{
|
||||
{
|
||||
Name: "ID",
|
||||
SchemaName: "id",
|
||||
},
|
||||
{
|
||||
Name: "RawID",
|
||||
SchemaName: "raw_id",
|
||||
},
|
||||
{
|
||||
Name: "Response",
|
||||
SchemaName: "response",
|
||||
},
|
||||
}
|
||||
return typ
|
||||
}
|
||||
|
||||
// Encode implements bin.Encoder.
|
||||
func (i *InputPasskeyCredentialPublicKey) Encode(b *bin.Buffer) error {
|
||||
if i == nil {
|
||||
return fmt.Errorf("can't encode inputPasskeyCredentialPublicKey#3c27b78f as nil")
|
||||
}
|
||||
b.PutID(InputPasskeyCredentialPublicKeyTypeID)
|
||||
return i.EncodeBare(b)
|
||||
}
|
||||
|
||||
// EncodeBare implements bin.BareEncoder.
|
||||
func (i *InputPasskeyCredentialPublicKey) EncodeBare(b *bin.Buffer) error {
|
||||
if i == nil {
|
||||
return fmt.Errorf("can't encode inputPasskeyCredentialPublicKey#3c27b78f as nil")
|
||||
}
|
||||
b.PutString(i.ID)
|
||||
b.PutString(i.RawID)
|
||||
if i.Response == nil {
|
||||
return fmt.Errorf("unable to encode inputPasskeyCredentialPublicKey#3c27b78f: field response is nil")
|
||||
}
|
||||
if err := i.Response.Encode(b); err != nil {
|
||||
return fmt.Errorf("unable to encode inputPasskeyCredentialPublicKey#3c27b78f: field response: %w", err)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Decode implements bin.Decoder.
|
||||
func (i *InputPasskeyCredentialPublicKey) Decode(b *bin.Buffer) error {
|
||||
if i == nil {
|
||||
return fmt.Errorf("can't decode inputPasskeyCredentialPublicKey#3c27b78f to nil")
|
||||
}
|
||||
if err := b.ConsumeID(InputPasskeyCredentialPublicKeyTypeID); err != nil {
|
||||
return fmt.Errorf("unable to decode inputPasskeyCredentialPublicKey#3c27b78f: %w", err)
|
||||
}
|
||||
return i.DecodeBare(b)
|
||||
}
|
||||
|
||||
// DecodeBare implements bin.BareDecoder.
|
||||
func (i *InputPasskeyCredentialPublicKey) DecodeBare(b *bin.Buffer) error {
|
||||
if i == nil {
|
||||
return fmt.Errorf("can't decode inputPasskeyCredentialPublicKey#3c27b78f to nil")
|
||||
}
|
||||
{
|
||||
value, err := b.String()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode inputPasskeyCredentialPublicKey#3c27b78f: field id: %w", err)
|
||||
}
|
||||
i.ID = value
|
||||
}
|
||||
{
|
||||
value, err := b.String()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode inputPasskeyCredentialPublicKey#3c27b78f: field raw_id: %w", err)
|
||||
}
|
||||
i.RawID = value
|
||||
}
|
||||
{
|
||||
value, err := DecodeInputPasskeyResponse(b)
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode inputPasskeyCredentialPublicKey#3c27b78f: field response: %w", err)
|
||||
}
|
||||
i.Response = value
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// GetID returns value of ID field.
|
||||
func (i *InputPasskeyCredentialPublicKey) GetID() (value string) {
|
||||
if i == nil {
|
||||
return
|
||||
}
|
||||
return i.ID
|
||||
}
|
||||
|
||||
// GetRawID returns value of RawID field.
|
||||
func (i *InputPasskeyCredentialPublicKey) GetRawID() (value string) {
|
||||
if i == nil {
|
||||
return
|
||||
}
|
||||
return i.RawID
|
||||
}
|
||||
|
||||
// GetResponse returns value of Response field.
|
||||
func (i *InputPasskeyCredentialPublicKey) GetResponse() (value InputPasskeyResponseClass) {
|
||||
if i == nil {
|
||||
return
|
||||
}
|
||||
return i.Response
|
||||
}
|
||||
|
||||
// InputPasskeyCredentialFirebasePNV represents TL type `inputPasskeyCredentialFirebasePNV#5b1ccb28`.
|
||||
//
|
||||
// See https://core.telegram.org/constructor/inputPasskeyCredentialFirebasePNV for reference.
|
||||
type InputPasskeyCredentialFirebasePNV struct {
|
||||
// PnvToken field of InputPasskeyCredentialFirebasePNV.
|
||||
PnvToken string
|
||||
}
|
||||
|
||||
// InputPasskeyCredentialFirebasePNVTypeID is TL type id of InputPasskeyCredentialFirebasePNV.
|
||||
const InputPasskeyCredentialFirebasePNVTypeID = 0x5b1ccb28
|
||||
|
||||
// construct implements constructor of InputPasskeyCredentialClass.
|
||||
func (i InputPasskeyCredentialFirebasePNV) construct() InputPasskeyCredentialClass { return &i }
|
||||
|
||||
// Ensuring interfaces in compile-time for InputPasskeyCredentialFirebasePNV.
|
||||
var (
|
||||
_ bin.Encoder = &InputPasskeyCredentialFirebasePNV{}
|
||||
_ bin.Decoder = &InputPasskeyCredentialFirebasePNV{}
|
||||
_ bin.BareEncoder = &InputPasskeyCredentialFirebasePNV{}
|
||||
_ bin.BareDecoder = &InputPasskeyCredentialFirebasePNV{}
|
||||
|
||||
_ InputPasskeyCredentialClass = &InputPasskeyCredentialFirebasePNV{}
|
||||
)
|
||||
|
||||
func (i *InputPasskeyCredentialFirebasePNV) Zero() bool {
|
||||
if i == nil {
|
||||
return true
|
||||
}
|
||||
if !(i.PnvToken == "") {
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
// String implements fmt.Stringer.
|
||||
func (i *InputPasskeyCredentialFirebasePNV) String() string {
|
||||
if i == nil {
|
||||
return "InputPasskeyCredentialFirebasePNV(nil)"
|
||||
}
|
||||
type Alias InputPasskeyCredentialFirebasePNV
|
||||
return fmt.Sprintf("InputPasskeyCredentialFirebasePNV%+v", Alias(*i))
|
||||
}
|
||||
|
||||
// FillFrom fills InputPasskeyCredentialFirebasePNV from given interface.
|
||||
func (i *InputPasskeyCredentialFirebasePNV) FillFrom(from interface {
|
||||
GetPnvToken() (value string)
|
||||
}) {
|
||||
i.PnvToken = from.GetPnvToken()
|
||||
}
|
||||
|
||||
// TypeID returns type id in TL schema.
|
||||
//
|
||||
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
||||
func (*InputPasskeyCredentialFirebasePNV) TypeID() uint32 {
|
||||
return InputPasskeyCredentialFirebasePNVTypeID
|
||||
}
|
||||
|
||||
// TypeName returns name of type in TL schema.
|
||||
func (*InputPasskeyCredentialFirebasePNV) TypeName() string {
|
||||
return "inputPasskeyCredentialFirebasePNV"
|
||||
}
|
||||
|
||||
// TypeInfo returns info about TL type.
|
||||
func (i *InputPasskeyCredentialFirebasePNV) TypeInfo() tdp.Type {
|
||||
typ := tdp.Type{
|
||||
Name: "inputPasskeyCredentialFirebasePNV",
|
||||
ID: InputPasskeyCredentialFirebasePNVTypeID,
|
||||
}
|
||||
if i == nil {
|
||||
typ.Null = true
|
||||
return typ
|
||||
}
|
||||
typ.Fields = []tdp.Field{
|
||||
{
|
||||
Name: "PnvToken",
|
||||
SchemaName: "pnv_token",
|
||||
},
|
||||
}
|
||||
return typ
|
||||
}
|
||||
|
||||
// Encode implements bin.Encoder.
|
||||
func (i *InputPasskeyCredentialFirebasePNV) Encode(b *bin.Buffer) error {
|
||||
if i == nil {
|
||||
return fmt.Errorf("can't encode inputPasskeyCredentialFirebasePNV#5b1ccb28 as nil")
|
||||
}
|
||||
b.PutID(InputPasskeyCredentialFirebasePNVTypeID)
|
||||
return i.EncodeBare(b)
|
||||
}
|
||||
|
||||
// EncodeBare implements bin.BareEncoder.
|
||||
func (i *InputPasskeyCredentialFirebasePNV) EncodeBare(b *bin.Buffer) error {
|
||||
if i == nil {
|
||||
return fmt.Errorf("can't encode inputPasskeyCredentialFirebasePNV#5b1ccb28 as nil")
|
||||
}
|
||||
b.PutString(i.PnvToken)
|
||||
return nil
|
||||
}
|
||||
|
||||
// Decode implements bin.Decoder.
|
||||
func (i *InputPasskeyCredentialFirebasePNV) Decode(b *bin.Buffer) error {
|
||||
if i == nil {
|
||||
return fmt.Errorf("can't decode inputPasskeyCredentialFirebasePNV#5b1ccb28 to nil")
|
||||
}
|
||||
if err := b.ConsumeID(InputPasskeyCredentialFirebasePNVTypeID); err != nil {
|
||||
return fmt.Errorf("unable to decode inputPasskeyCredentialFirebasePNV#5b1ccb28: %w", err)
|
||||
}
|
||||
return i.DecodeBare(b)
|
||||
}
|
||||
|
||||
// DecodeBare implements bin.BareDecoder.
|
||||
func (i *InputPasskeyCredentialFirebasePNV) DecodeBare(b *bin.Buffer) error {
|
||||
if i == nil {
|
||||
return fmt.Errorf("can't decode inputPasskeyCredentialFirebasePNV#5b1ccb28 to nil")
|
||||
}
|
||||
{
|
||||
value, err := b.String()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode inputPasskeyCredentialFirebasePNV#5b1ccb28: field pnv_token: %w", err)
|
||||
}
|
||||
i.PnvToken = value
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// GetPnvToken returns value of PnvToken field.
|
||||
func (i *InputPasskeyCredentialFirebasePNV) GetPnvToken() (value string) {
|
||||
if i == nil {
|
||||
return
|
||||
}
|
||||
return i.PnvToken
|
||||
}
|
||||
|
||||
// InputPasskeyCredentialClassName is schema name of InputPasskeyCredentialClass.
|
||||
const InputPasskeyCredentialClassName = "InputPasskeyCredential"
|
||||
|
||||
// InputPasskeyCredentialClass represents InputPasskeyCredential generic type.
|
||||
//
|
||||
// See https://core.telegram.org/type/InputPasskeyCredential for reference.
|
||||
//
|
||||
// Example:
|
||||
//
|
||||
// g, err := tg.DecodeInputPasskeyCredential(buf)
|
||||
// if err != nil {
|
||||
// panic(err)
|
||||
// }
|
||||
// switch v := g.(type) {
|
||||
// case *tg.InputPasskeyCredentialPublicKey: // inputPasskeyCredentialPublicKey#3c27b78f
|
||||
// case *tg.InputPasskeyCredentialFirebasePNV: // inputPasskeyCredentialFirebasePNV#5b1ccb28
|
||||
// default: panic(v)
|
||||
// }
|
||||
type InputPasskeyCredentialClass interface {
|
||||
bin.Encoder
|
||||
bin.Decoder
|
||||
bin.BareEncoder
|
||||
bin.BareDecoder
|
||||
construct() InputPasskeyCredentialClass
|
||||
|
||||
// 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
|
||||
}
|
||||
|
||||
// DecodeInputPasskeyCredential implements binary de-serialization for InputPasskeyCredentialClass.
|
||||
func DecodeInputPasskeyCredential(buf *bin.Buffer) (InputPasskeyCredentialClass, error) {
|
||||
id, err := buf.PeekID()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
switch id {
|
||||
case InputPasskeyCredentialPublicKeyTypeID:
|
||||
// Decoding inputPasskeyCredentialPublicKey#3c27b78f.
|
||||
v := InputPasskeyCredentialPublicKey{}
|
||||
if err := v.Decode(buf); err != nil {
|
||||
return nil, fmt.Errorf("unable to decode InputPasskeyCredentialClass: %w", err)
|
||||
}
|
||||
return &v, nil
|
||||
case InputPasskeyCredentialFirebasePNVTypeID:
|
||||
// Decoding inputPasskeyCredentialFirebasePNV#5b1ccb28.
|
||||
v := InputPasskeyCredentialFirebasePNV{}
|
||||
if err := v.Decode(buf); err != nil {
|
||||
return nil, fmt.Errorf("unable to decode InputPasskeyCredentialClass: %w", err)
|
||||
}
|
||||
return &v, nil
|
||||
default:
|
||||
return nil, fmt.Errorf("unable to decode InputPasskeyCredentialClass: %w", bin.NewUnexpectedID(id))
|
||||
}
|
||||
}
|
||||
|
||||
// InputPasskeyCredential boxes the InputPasskeyCredentialClass providing a helper.
|
||||
type InputPasskeyCredentialBox struct {
|
||||
InputPasskeyCredential InputPasskeyCredentialClass
|
||||
}
|
||||
|
||||
// Decode implements bin.Decoder for InputPasskeyCredentialBox.
|
||||
func (b *InputPasskeyCredentialBox) Decode(buf *bin.Buffer) error {
|
||||
if b == nil {
|
||||
return fmt.Errorf("unable to decode InputPasskeyCredentialBox to nil")
|
||||
}
|
||||
v, err := DecodeInputPasskeyCredential(buf)
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode boxed value: %w", err)
|
||||
}
|
||||
b.InputPasskeyCredential = v
|
||||
return nil
|
||||
}
|
||||
|
||||
// Encode implements bin.Encode for InputPasskeyCredentialBox.
|
||||
func (b *InputPasskeyCredentialBox) Encode(buf *bin.Buffer) error {
|
||||
if b == nil || b.InputPasskeyCredential == nil {
|
||||
return fmt.Errorf("unable to encode InputPasskeyCredentialClass as nil")
|
||||
}
|
||||
return b.InputPasskeyCredential.Encode(buf)
|
||||
}
|
||||
+307
@@ -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{}
|
||||
)
|
||||
|
||||
// InputPasskeyCredentialClassArray is adapter for slice of InputPasskeyCredentialClass.
|
||||
type InputPasskeyCredentialClassArray []InputPasskeyCredentialClass
|
||||
|
||||
// Sort sorts slice of InputPasskeyCredentialClass.
|
||||
func (s InputPasskeyCredentialClassArray) Sort(less func(a, b InputPasskeyCredentialClass) bool) InputPasskeyCredentialClassArray {
|
||||
sort.Slice(s, func(i, j int) bool {
|
||||
return less(s[i], s[j])
|
||||
})
|
||||
return s
|
||||
}
|
||||
|
||||
// SortStable sorts slice of InputPasskeyCredentialClass.
|
||||
func (s InputPasskeyCredentialClassArray) SortStable(less func(a, b InputPasskeyCredentialClass) bool) InputPasskeyCredentialClassArray {
|
||||
sort.SliceStable(s, func(i, j int) bool {
|
||||
return less(s[i], s[j])
|
||||
})
|
||||
return s
|
||||
}
|
||||
|
||||
// Retain filters in-place slice of InputPasskeyCredentialClass.
|
||||
func (s InputPasskeyCredentialClassArray) Retain(keep func(x InputPasskeyCredentialClass) bool) InputPasskeyCredentialClassArray {
|
||||
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 InputPasskeyCredentialClassArray) First() (v InputPasskeyCredentialClass, ok bool) {
|
||||
if len(s) < 1 {
|
||||
return
|
||||
}
|
||||
return s[0], true
|
||||
}
|
||||
|
||||
// Last returns last element of slice (if exists).
|
||||
func (s InputPasskeyCredentialClassArray) Last() (v InputPasskeyCredentialClass, 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 *InputPasskeyCredentialClassArray) PopFirst() (v InputPasskeyCredentialClass, 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 InputPasskeyCredentialClass
|
||||
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 *InputPasskeyCredentialClassArray) Pop() (v InputPasskeyCredentialClass, 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
|
||||
}
|
||||
|
||||
// AsInputPasskeyCredentialPublicKey returns copy with only InputPasskeyCredentialPublicKey constructors.
|
||||
func (s InputPasskeyCredentialClassArray) AsInputPasskeyCredentialPublicKey() (to InputPasskeyCredentialPublicKeyArray) {
|
||||
for _, elem := range s {
|
||||
value, ok := elem.(*InputPasskeyCredentialPublicKey)
|
||||
if !ok {
|
||||
continue
|
||||
}
|
||||
to = append(to, *value)
|
||||
}
|
||||
|
||||
return to
|
||||
}
|
||||
|
||||
// AsInputPasskeyCredentialFirebasePNV returns copy with only InputPasskeyCredentialFirebasePNV constructors.
|
||||
func (s InputPasskeyCredentialClassArray) AsInputPasskeyCredentialFirebasePNV() (to InputPasskeyCredentialFirebasePNVArray) {
|
||||
for _, elem := range s {
|
||||
value, ok := elem.(*InputPasskeyCredentialFirebasePNV)
|
||||
if !ok {
|
||||
continue
|
||||
}
|
||||
to = append(to, *value)
|
||||
}
|
||||
|
||||
return to
|
||||
}
|
||||
|
||||
// InputPasskeyCredentialPublicKeyArray is adapter for slice of InputPasskeyCredentialPublicKey.
|
||||
type InputPasskeyCredentialPublicKeyArray []InputPasskeyCredentialPublicKey
|
||||
|
||||
// Sort sorts slice of InputPasskeyCredentialPublicKey.
|
||||
func (s InputPasskeyCredentialPublicKeyArray) Sort(less func(a, b InputPasskeyCredentialPublicKey) bool) InputPasskeyCredentialPublicKeyArray {
|
||||
sort.Slice(s, func(i, j int) bool {
|
||||
return less(s[i], s[j])
|
||||
})
|
||||
return s
|
||||
}
|
||||
|
||||
// SortStable sorts slice of InputPasskeyCredentialPublicKey.
|
||||
func (s InputPasskeyCredentialPublicKeyArray) SortStable(less func(a, b InputPasskeyCredentialPublicKey) bool) InputPasskeyCredentialPublicKeyArray {
|
||||
sort.SliceStable(s, func(i, j int) bool {
|
||||
return less(s[i], s[j])
|
||||
})
|
||||
return s
|
||||
}
|
||||
|
||||
// Retain filters in-place slice of InputPasskeyCredentialPublicKey.
|
||||
func (s InputPasskeyCredentialPublicKeyArray) Retain(keep func(x InputPasskeyCredentialPublicKey) bool) InputPasskeyCredentialPublicKeyArray {
|
||||
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 InputPasskeyCredentialPublicKeyArray) First() (v InputPasskeyCredentialPublicKey, ok bool) {
|
||||
if len(s) < 1 {
|
||||
return
|
||||
}
|
||||
return s[0], true
|
||||
}
|
||||
|
||||
// Last returns last element of slice (if exists).
|
||||
func (s InputPasskeyCredentialPublicKeyArray) Last() (v InputPasskeyCredentialPublicKey, 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 *InputPasskeyCredentialPublicKeyArray) PopFirst() (v InputPasskeyCredentialPublicKey, 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 InputPasskeyCredentialPublicKey
|
||||
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 *InputPasskeyCredentialPublicKeyArray) Pop() (v InputPasskeyCredentialPublicKey, 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
|
||||
}
|
||||
|
||||
// InputPasskeyCredentialFirebasePNVArray is adapter for slice of InputPasskeyCredentialFirebasePNV.
|
||||
type InputPasskeyCredentialFirebasePNVArray []InputPasskeyCredentialFirebasePNV
|
||||
|
||||
// Sort sorts slice of InputPasskeyCredentialFirebasePNV.
|
||||
func (s InputPasskeyCredentialFirebasePNVArray) Sort(less func(a, b InputPasskeyCredentialFirebasePNV) bool) InputPasskeyCredentialFirebasePNVArray {
|
||||
sort.Slice(s, func(i, j int) bool {
|
||||
return less(s[i], s[j])
|
||||
})
|
||||
return s
|
||||
}
|
||||
|
||||
// SortStable sorts slice of InputPasskeyCredentialFirebasePNV.
|
||||
func (s InputPasskeyCredentialFirebasePNVArray) SortStable(less func(a, b InputPasskeyCredentialFirebasePNV) bool) InputPasskeyCredentialFirebasePNVArray {
|
||||
sort.SliceStable(s, func(i, j int) bool {
|
||||
return less(s[i], s[j])
|
||||
})
|
||||
return s
|
||||
}
|
||||
|
||||
// Retain filters in-place slice of InputPasskeyCredentialFirebasePNV.
|
||||
func (s InputPasskeyCredentialFirebasePNVArray) Retain(keep func(x InputPasskeyCredentialFirebasePNV) bool) InputPasskeyCredentialFirebasePNVArray {
|
||||
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 InputPasskeyCredentialFirebasePNVArray) First() (v InputPasskeyCredentialFirebasePNV, ok bool) {
|
||||
if len(s) < 1 {
|
||||
return
|
||||
}
|
||||
return s[0], true
|
||||
}
|
||||
|
||||
// Last returns last element of slice (if exists).
|
||||
func (s InputPasskeyCredentialFirebasePNVArray) Last() (v InputPasskeyCredentialFirebasePNV, 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 *InputPasskeyCredentialFirebasePNVArray) PopFirst() (v InputPasskeyCredentialFirebasePNV, 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 InputPasskeyCredentialFirebasePNV
|
||||
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 *InputPasskeyCredentialFirebasePNVArray) Pop() (v InputPasskeyCredentialFirebasePNV, 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
|
||||
}
|
||||
+500
@@ -0,0 +1,500 @@
|
||||
// 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{}
|
||||
)
|
||||
|
||||
// InputPasskeyResponseRegister represents TL type `inputPasskeyResponseRegister#3e63935c`.
|
||||
//
|
||||
// See https://core.telegram.org/constructor/inputPasskeyResponseRegister for reference.
|
||||
type InputPasskeyResponseRegister struct {
|
||||
// ClientData field of InputPasskeyResponseRegister.
|
||||
ClientData DataJSON
|
||||
// AttestationData field of InputPasskeyResponseRegister.
|
||||
AttestationData []byte
|
||||
}
|
||||
|
||||
// InputPasskeyResponseRegisterTypeID is TL type id of InputPasskeyResponseRegister.
|
||||
const InputPasskeyResponseRegisterTypeID = 0x3e63935c
|
||||
|
||||
// construct implements constructor of InputPasskeyResponseClass.
|
||||
func (i InputPasskeyResponseRegister) construct() InputPasskeyResponseClass { return &i }
|
||||
|
||||
// Ensuring interfaces in compile-time for InputPasskeyResponseRegister.
|
||||
var (
|
||||
_ bin.Encoder = &InputPasskeyResponseRegister{}
|
||||
_ bin.Decoder = &InputPasskeyResponseRegister{}
|
||||
_ bin.BareEncoder = &InputPasskeyResponseRegister{}
|
||||
_ bin.BareDecoder = &InputPasskeyResponseRegister{}
|
||||
|
||||
_ InputPasskeyResponseClass = &InputPasskeyResponseRegister{}
|
||||
)
|
||||
|
||||
func (i *InputPasskeyResponseRegister) Zero() bool {
|
||||
if i == nil {
|
||||
return true
|
||||
}
|
||||
if !(i.ClientData.Zero()) {
|
||||
return false
|
||||
}
|
||||
if !(i.AttestationData == nil) {
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
// String implements fmt.Stringer.
|
||||
func (i *InputPasskeyResponseRegister) String() string {
|
||||
if i == nil {
|
||||
return "InputPasskeyResponseRegister(nil)"
|
||||
}
|
||||
type Alias InputPasskeyResponseRegister
|
||||
return fmt.Sprintf("InputPasskeyResponseRegister%+v", Alias(*i))
|
||||
}
|
||||
|
||||
// FillFrom fills InputPasskeyResponseRegister from given interface.
|
||||
func (i *InputPasskeyResponseRegister) FillFrom(from interface {
|
||||
GetClientData() (value DataJSON)
|
||||
GetAttestationData() (value []byte)
|
||||
}) {
|
||||
i.ClientData = from.GetClientData()
|
||||
i.AttestationData = from.GetAttestationData()
|
||||
}
|
||||
|
||||
// TypeID returns type id in TL schema.
|
||||
//
|
||||
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
||||
func (*InputPasskeyResponseRegister) TypeID() uint32 {
|
||||
return InputPasskeyResponseRegisterTypeID
|
||||
}
|
||||
|
||||
// TypeName returns name of type in TL schema.
|
||||
func (*InputPasskeyResponseRegister) TypeName() string {
|
||||
return "inputPasskeyResponseRegister"
|
||||
}
|
||||
|
||||
// TypeInfo returns info about TL type.
|
||||
func (i *InputPasskeyResponseRegister) TypeInfo() tdp.Type {
|
||||
typ := tdp.Type{
|
||||
Name: "inputPasskeyResponseRegister",
|
||||
ID: InputPasskeyResponseRegisterTypeID,
|
||||
}
|
||||
if i == nil {
|
||||
typ.Null = true
|
||||
return typ
|
||||
}
|
||||
typ.Fields = []tdp.Field{
|
||||
{
|
||||
Name: "ClientData",
|
||||
SchemaName: "client_data",
|
||||
},
|
||||
{
|
||||
Name: "AttestationData",
|
||||
SchemaName: "attestation_data",
|
||||
},
|
||||
}
|
||||
return typ
|
||||
}
|
||||
|
||||
// Encode implements bin.Encoder.
|
||||
func (i *InputPasskeyResponseRegister) Encode(b *bin.Buffer) error {
|
||||
if i == nil {
|
||||
return fmt.Errorf("can't encode inputPasskeyResponseRegister#3e63935c as nil")
|
||||
}
|
||||
b.PutID(InputPasskeyResponseRegisterTypeID)
|
||||
return i.EncodeBare(b)
|
||||
}
|
||||
|
||||
// EncodeBare implements bin.BareEncoder.
|
||||
func (i *InputPasskeyResponseRegister) EncodeBare(b *bin.Buffer) error {
|
||||
if i == nil {
|
||||
return fmt.Errorf("can't encode inputPasskeyResponseRegister#3e63935c as nil")
|
||||
}
|
||||
if err := i.ClientData.Encode(b); err != nil {
|
||||
return fmt.Errorf("unable to encode inputPasskeyResponseRegister#3e63935c: field client_data: %w", err)
|
||||
}
|
||||
b.PutBytes(i.AttestationData)
|
||||
return nil
|
||||
}
|
||||
|
||||
// Decode implements bin.Decoder.
|
||||
func (i *InputPasskeyResponseRegister) Decode(b *bin.Buffer) error {
|
||||
if i == nil {
|
||||
return fmt.Errorf("can't decode inputPasskeyResponseRegister#3e63935c to nil")
|
||||
}
|
||||
if err := b.ConsumeID(InputPasskeyResponseRegisterTypeID); err != nil {
|
||||
return fmt.Errorf("unable to decode inputPasskeyResponseRegister#3e63935c: %w", err)
|
||||
}
|
||||
return i.DecodeBare(b)
|
||||
}
|
||||
|
||||
// DecodeBare implements bin.BareDecoder.
|
||||
func (i *InputPasskeyResponseRegister) DecodeBare(b *bin.Buffer) error {
|
||||
if i == nil {
|
||||
return fmt.Errorf("can't decode inputPasskeyResponseRegister#3e63935c to nil")
|
||||
}
|
||||
{
|
||||
if err := i.ClientData.Decode(b); err != nil {
|
||||
return fmt.Errorf("unable to decode inputPasskeyResponseRegister#3e63935c: field client_data: %w", err)
|
||||
}
|
||||
}
|
||||
{
|
||||
value, err := b.Bytes()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode inputPasskeyResponseRegister#3e63935c: field attestation_data: %w", err)
|
||||
}
|
||||
i.AttestationData = value
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// GetClientData returns value of ClientData field.
|
||||
func (i *InputPasskeyResponseRegister) GetClientData() (value DataJSON) {
|
||||
if i == nil {
|
||||
return
|
||||
}
|
||||
return i.ClientData
|
||||
}
|
||||
|
||||
// GetAttestationData returns value of AttestationData field.
|
||||
func (i *InputPasskeyResponseRegister) GetAttestationData() (value []byte) {
|
||||
if i == nil {
|
||||
return
|
||||
}
|
||||
return i.AttestationData
|
||||
}
|
||||
|
||||
// InputPasskeyResponseLogin represents TL type `inputPasskeyResponseLogin#c31fc14a`.
|
||||
//
|
||||
// See https://core.telegram.org/constructor/inputPasskeyResponseLogin for reference.
|
||||
type InputPasskeyResponseLogin struct {
|
||||
// ClientData field of InputPasskeyResponseLogin.
|
||||
ClientData DataJSON
|
||||
// AuthenticatorData field of InputPasskeyResponseLogin.
|
||||
AuthenticatorData []byte
|
||||
// Signature field of InputPasskeyResponseLogin.
|
||||
Signature []byte
|
||||
// UserHandle field of InputPasskeyResponseLogin.
|
||||
UserHandle string
|
||||
}
|
||||
|
||||
// InputPasskeyResponseLoginTypeID is TL type id of InputPasskeyResponseLogin.
|
||||
const InputPasskeyResponseLoginTypeID = 0xc31fc14a
|
||||
|
||||
// construct implements constructor of InputPasskeyResponseClass.
|
||||
func (i InputPasskeyResponseLogin) construct() InputPasskeyResponseClass { return &i }
|
||||
|
||||
// Ensuring interfaces in compile-time for InputPasskeyResponseLogin.
|
||||
var (
|
||||
_ bin.Encoder = &InputPasskeyResponseLogin{}
|
||||
_ bin.Decoder = &InputPasskeyResponseLogin{}
|
||||
_ bin.BareEncoder = &InputPasskeyResponseLogin{}
|
||||
_ bin.BareDecoder = &InputPasskeyResponseLogin{}
|
||||
|
||||
_ InputPasskeyResponseClass = &InputPasskeyResponseLogin{}
|
||||
)
|
||||
|
||||
func (i *InputPasskeyResponseLogin) Zero() bool {
|
||||
if i == nil {
|
||||
return true
|
||||
}
|
||||
if !(i.ClientData.Zero()) {
|
||||
return false
|
||||
}
|
||||
if !(i.AuthenticatorData == nil) {
|
||||
return false
|
||||
}
|
||||
if !(i.Signature == nil) {
|
||||
return false
|
||||
}
|
||||
if !(i.UserHandle == "") {
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
// String implements fmt.Stringer.
|
||||
func (i *InputPasskeyResponseLogin) String() string {
|
||||
if i == nil {
|
||||
return "InputPasskeyResponseLogin(nil)"
|
||||
}
|
||||
type Alias InputPasskeyResponseLogin
|
||||
return fmt.Sprintf("InputPasskeyResponseLogin%+v", Alias(*i))
|
||||
}
|
||||
|
||||
// FillFrom fills InputPasskeyResponseLogin from given interface.
|
||||
func (i *InputPasskeyResponseLogin) FillFrom(from interface {
|
||||
GetClientData() (value DataJSON)
|
||||
GetAuthenticatorData() (value []byte)
|
||||
GetSignature() (value []byte)
|
||||
GetUserHandle() (value string)
|
||||
}) {
|
||||
i.ClientData = from.GetClientData()
|
||||
i.AuthenticatorData = from.GetAuthenticatorData()
|
||||
i.Signature = from.GetSignature()
|
||||
i.UserHandle = from.GetUserHandle()
|
||||
}
|
||||
|
||||
// TypeID returns type id in TL schema.
|
||||
//
|
||||
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
||||
func (*InputPasskeyResponseLogin) TypeID() uint32 {
|
||||
return InputPasskeyResponseLoginTypeID
|
||||
}
|
||||
|
||||
// TypeName returns name of type in TL schema.
|
||||
func (*InputPasskeyResponseLogin) TypeName() string {
|
||||
return "inputPasskeyResponseLogin"
|
||||
}
|
||||
|
||||
// TypeInfo returns info about TL type.
|
||||
func (i *InputPasskeyResponseLogin) TypeInfo() tdp.Type {
|
||||
typ := tdp.Type{
|
||||
Name: "inputPasskeyResponseLogin",
|
||||
ID: InputPasskeyResponseLoginTypeID,
|
||||
}
|
||||
if i == nil {
|
||||
typ.Null = true
|
||||
return typ
|
||||
}
|
||||
typ.Fields = []tdp.Field{
|
||||
{
|
||||
Name: "ClientData",
|
||||
SchemaName: "client_data",
|
||||
},
|
||||
{
|
||||
Name: "AuthenticatorData",
|
||||
SchemaName: "authenticator_data",
|
||||
},
|
||||
{
|
||||
Name: "Signature",
|
||||
SchemaName: "signature",
|
||||
},
|
||||
{
|
||||
Name: "UserHandle",
|
||||
SchemaName: "user_handle",
|
||||
},
|
||||
}
|
||||
return typ
|
||||
}
|
||||
|
||||
// Encode implements bin.Encoder.
|
||||
func (i *InputPasskeyResponseLogin) Encode(b *bin.Buffer) error {
|
||||
if i == nil {
|
||||
return fmt.Errorf("can't encode inputPasskeyResponseLogin#c31fc14a as nil")
|
||||
}
|
||||
b.PutID(InputPasskeyResponseLoginTypeID)
|
||||
return i.EncodeBare(b)
|
||||
}
|
||||
|
||||
// EncodeBare implements bin.BareEncoder.
|
||||
func (i *InputPasskeyResponseLogin) EncodeBare(b *bin.Buffer) error {
|
||||
if i == nil {
|
||||
return fmt.Errorf("can't encode inputPasskeyResponseLogin#c31fc14a as nil")
|
||||
}
|
||||
if err := i.ClientData.Encode(b); err != nil {
|
||||
return fmt.Errorf("unable to encode inputPasskeyResponseLogin#c31fc14a: field client_data: %w", err)
|
||||
}
|
||||
b.PutBytes(i.AuthenticatorData)
|
||||
b.PutBytes(i.Signature)
|
||||
b.PutString(i.UserHandle)
|
||||
return nil
|
||||
}
|
||||
|
||||
// Decode implements bin.Decoder.
|
||||
func (i *InputPasskeyResponseLogin) Decode(b *bin.Buffer) error {
|
||||
if i == nil {
|
||||
return fmt.Errorf("can't decode inputPasskeyResponseLogin#c31fc14a to nil")
|
||||
}
|
||||
if err := b.ConsumeID(InputPasskeyResponseLoginTypeID); err != nil {
|
||||
return fmt.Errorf("unable to decode inputPasskeyResponseLogin#c31fc14a: %w", err)
|
||||
}
|
||||
return i.DecodeBare(b)
|
||||
}
|
||||
|
||||
// DecodeBare implements bin.BareDecoder.
|
||||
func (i *InputPasskeyResponseLogin) DecodeBare(b *bin.Buffer) error {
|
||||
if i == nil {
|
||||
return fmt.Errorf("can't decode inputPasskeyResponseLogin#c31fc14a to nil")
|
||||
}
|
||||
{
|
||||
if err := i.ClientData.Decode(b); err != nil {
|
||||
return fmt.Errorf("unable to decode inputPasskeyResponseLogin#c31fc14a: field client_data: %w", err)
|
||||
}
|
||||
}
|
||||
{
|
||||
value, err := b.Bytes()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode inputPasskeyResponseLogin#c31fc14a: field authenticator_data: %w", err)
|
||||
}
|
||||
i.AuthenticatorData = value
|
||||
}
|
||||
{
|
||||
value, err := b.Bytes()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode inputPasskeyResponseLogin#c31fc14a: field signature: %w", err)
|
||||
}
|
||||
i.Signature = value
|
||||
}
|
||||
{
|
||||
value, err := b.String()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode inputPasskeyResponseLogin#c31fc14a: field user_handle: %w", err)
|
||||
}
|
||||
i.UserHandle = value
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// GetClientData returns value of ClientData field.
|
||||
func (i *InputPasskeyResponseLogin) GetClientData() (value DataJSON) {
|
||||
if i == nil {
|
||||
return
|
||||
}
|
||||
return i.ClientData
|
||||
}
|
||||
|
||||
// GetAuthenticatorData returns value of AuthenticatorData field.
|
||||
func (i *InputPasskeyResponseLogin) GetAuthenticatorData() (value []byte) {
|
||||
if i == nil {
|
||||
return
|
||||
}
|
||||
return i.AuthenticatorData
|
||||
}
|
||||
|
||||
// GetSignature returns value of Signature field.
|
||||
func (i *InputPasskeyResponseLogin) GetSignature() (value []byte) {
|
||||
if i == nil {
|
||||
return
|
||||
}
|
||||
return i.Signature
|
||||
}
|
||||
|
||||
// GetUserHandle returns value of UserHandle field.
|
||||
func (i *InputPasskeyResponseLogin) GetUserHandle() (value string) {
|
||||
if i == nil {
|
||||
return
|
||||
}
|
||||
return i.UserHandle
|
||||
}
|
||||
|
||||
// InputPasskeyResponseClassName is schema name of InputPasskeyResponseClass.
|
||||
const InputPasskeyResponseClassName = "InputPasskeyResponse"
|
||||
|
||||
// InputPasskeyResponseClass represents InputPasskeyResponse generic type.
|
||||
//
|
||||
// See https://core.telegram.org/type/InputPasskeyResponse for reference.
|
||||
//
|
||||
// Example:
|
||||
//
|
||||
// g, err := tg.DecodeInputPasskeyResponse(buf)
|
||||
// if err != nil {
|
||||
// panic(err)
|
||||
// }
|
||||
// switch v := g.(type) {
|
||||
// case *tg.InputPasskeyResponseRegister: // inputPasskeyResponseRegister#3e63935c
|
||||
// case *tg.InputPasskeyResponseLogin: // inputPasskeyResponseLogin#c31fc14a
|
||||
// default: panic(v)
|
||||
// }
|
||||
type InputPasskeyResponseClass interface {
|
||||
bin.Encoder
|
||||
bin.Decoder
|
||||
bin.BareEncoder
|
||||
bin.BareDecoder
|
||||
construct() InputPasskeyResponseClass
|
||||
|
||||
// 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
|
||||
|
||||
// ClientData field of InputPasskeyResponseRegister.
|
||||
GetClientData() (value DataJSON)
|
||||
}
|
||||
|
||||
// DecodeInputPasskeyResponse implements binary de-serialization for InputPasskeyResponseClass.
|
||||
func DecodeInputPasskeyResponse(buf *bin.Buffer) (InputPasskeyResponseClass, error) {
|
||||
id, err := buf.PeekID()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
switch id {
|
||||
case InputPasskeyResponseRegisterTypeID:
|
||||
// Decoding inputPasskeyResponseRegister#3e63935c.
|
||||
v := InputPasskeyResponseRegister{}
|
||||
if err := v.Decode(buf); err != nil {
|
||||
return nil, fmt.Errorf("unable to decode InputPasskeyResponseClass: %w", err)
|
||||
}
|
||||
return &v, nil
|
||||
case InputPasskeyResponseLoginTypeID:
|
||||
// Decoding inputPasskeyResponseLogin#c31fc14a.
|
||||
v := InputPasskeyResponseLogin{}
|
||||
if err := v.Decode(buf); err != nil {
|
||||
return nil, fmt.Errorf("unable to decode InputPasskeyResponseClass: %w", err)
|
||||
}
|
||||
return &v, nil
|
||||
default:
|
||||
return nil, fmt.Errorf("unable to decode InputPasskeyResponseClass: %w", bin.NewUnexpectedID(id))
|
||||
}
|
||||
}
|
||||
|
||||
// InputPasskeyResponse boxes the InputPasskeyResponseClass providing a helper.
|
||||
type InputPasskeyResponseBox struct {
|
||||
InputPasskeyResponse InputPasskeyResponseClass
|
||||
}
|
||||
|
||||
// Decode implements bin.Decoder for InputPasskeyResponseBox.
|
||||
func (b *InputPasskeyResponseBox) Decode(buf *bin.Buffer) error {
|
||||
if b == nil {
|
||||
return fmt.Errorf("unable to decode InputPasskeyResponseBox to nil")
|
||||
}
|
||||
v, err := DecodeInputPasskeyResponse(buf)
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode boxed value: %w", err)
|
||||
}
|
||||
b.InputPasskeyResponse = v
|
||||
return nil
|
||||
}
|
||||
|
||||
// Encode implements bin.Encode for InputPasskeyResponseBox.
|
||||
func (b *InputPasskeyResponseBox) Encode(buf *bin.Buffer) error {
|
||||
if b == nil || b.InputPasskeyResponse == nil {
|
||||
return fmt.Errorf("unable to encode InputPasskeyResponseClass as nil")
|
||||
}
|
||||
return b.InputPasskeyResponse.Encode(buf)
|
||||
}
|
||||
+307
@@ -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{}
|
||||
)
|
||||
|
||||
// InputPasskeyResponseClassArray is adapter for slice of InputPasskeyResponseClass.
|
||||
type InputPasskeyResponseClassArray []InputPasskeyResponseClass
|
||||
|
||||
// Sort sorts slice of InputPasskeyResponseClass.
|
||||
func (s InputPasskeyResponseClassArray) Sort(less func(a, b InputPasskeyResponseClass) bool) InputPasskeyResponseClassArray {
|
||||
sort.Slice(s, func(i, j int) bool {
|
||||
return less(s[i], s[j])
|
||||
})
|
||||
return s
|
||||
}
|
||||
|
||||
// SortStable sorts slice of InputPasskeyResponseClass.
|
||||
func (s InputPasskeyResponseClassArray) SortStable(less func(a, b InputPasskeyResponseClass) bool) InputPasskeyResponseClassArray {
|
||||
sort.SliceStable(s, func(i, j int) bool {
|
||||
return less(s[i], s[j])
|
||||
})
|
||||
return s
|
||||
}
|
||||
|
||||
// Retain filters in-place slice of InputPasskeyResponseClass.
|
||||
func (s InputPasskeyResponseClassArray) Retain(keep func(x InputPasskeyResponseClass) bool) InputPasskeyResponseClassArray {
|
||||
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 InputPasskeyResponseClassArray) First() (v InputPasskeyResponseClass, ok bool) {
|
||||
if len(s) < 1 {
|
||||
return
|
||||
}
|
||||
return s[0], true
|
||||
}
|
||||
|
||||
// Last returns last element of slice (if exists).
|
||||
func (s InputPasskeyResponseClassArray) Last() (v InputPasskeyResponseClass, 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 *InputPasskeyResponseClassArray) PopFirst() (v InputPasskeyResponseClass, 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 InputPasskeyResponseClass
|
||||
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 *InputPasskeyResponseClassArray) Pop() (v InputPasskeyResponseClass, 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
|
||||
}
|
||||
|
||||
// AsInputPasskeyResponseRegister returns copy with only InputPasskeyResponseRegister constructors.
|
||||
func (s InputPasskeyResponseClassArray) AsInputPasskeyResponseRegister() (to InputPasskeyResponseRegisterArray) {
|
||||
for _, elem := range s {
|
||||
value, ok := elem.(*InputPasskeyResponseRegister)
|
||||
if !ok {
|
||||
continue
|
||||
}
|
||||
to = append(to, *value)
|
||||
}
|
||||
|
||||
return to
|
||||
}
|
||||
|
||||
// AsInputPasskeyResponseLogin returns copy with only InputPasskeyResponseLogin constructors.
|
||||
func (s InputPasskeyResponseClassArray) AsInputPasskeyResponseLogin() (to InputPasskeyResponseLoginArray) {
|
||||
for _, elem := range s {
|
||||
value, ok := elem.(*InputPasskeyResponseLogin)
|
||||
if !ok {
|
||||
continue
|
||||
}
|
||||
to = append(to, *value)
|
||||
}
|
||||
|
||||
return to
|
||||
}
|
||||
|
||||
// InputPasskeyResponseRegisterArray is adapter for slice of InputPasskeyResponseRegister.
|
||||
type InputPasskeyResponseRegisterArray []InputPasskeyResponseRegister
|
||||
|
||||
// Sort sorts slice of InputPasskeyResponseRegister.
|
||||
func (s InputPasskeyResponseRegisterArray) Sort(less func(a, b InputPasskeyResponseRegister) bool) InputPasskeyResponseRegisterArray {
|
||||
sort.Slice(s, func(i, j int) bool {
|
||||
return less(s[i], s[j])
|
||||
})
|
||||
return s
|
||||
}
|
||||
|
||||
// SortStable sorts slice of InputPasskeyResponseRegister.
|
||||
func (s InputPasskeyResponseRegisterArray) SortStable(less func(a, b InputPasskeyResponseRegister) bool) InputPasskeyResponseRegisterArray {
|
||||
sort.SliceStable(s, func(i, j int) bool {
|
||||
return less(s[i], s[j])
|
||||
})
|
||||
return s
|
||||
}
|
||||
|
||||
// Retain filters in-place slice of InputPasskeyResponseRegister.
|
||||
func (s InputPasskeyResponseRegisterArray) Retain(keep func(x InputPasskeyResponseRegister) bool) InputPasskeyResponseRegisterArray {
|
||||
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 InputPasskeyResponseRegisterArray) First() (v InputPasskeyResponseRegister, ok bool) {
|
||||
if len(s) < 1 {
|
||||
return
|
||||
}
|
||||
return s[0], true
|
||||
}
|
||||
|
||||
// Last returns last element of slice (if exists).
|
||||
func (s InputPasskeyResponseRegisterArray) Last() (v InputPasskeyResponseRegister, 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 *InputPasskeyResponseRegisterArray) PopFirst() (v InputPasskeyResponseRegister, 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 InputPasskeyResponseRegister
|
||||
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 *InputPasskeyResponseRegisterArray) Pop() (v InputPasskeyResponseRegister, 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
|
||||
}
|
||||
|
||||
// InputPasskeyResponseLoginArray is adapter for slice of InputPasskeyResponseLogin.
|
||||
type InputPasskeyResponseLoginArray []InputPasskeyResponseLogin
|
||||
|
||||
// Sort sorts slice of InputPasskeyResponseLogin.
|
||||
func (s InputPasskeyResponseLoginArray) Sort(less func(a, b InputPasskeyResponseLogin) bool) InputPasskeyResponseLoginArray {
|
||||
sort.Slice(s, func(i, j int) bool {
|
||||
return less(s[i], s[j])
|
||||
})
|
||||
return s
|
||||
}
|
||||
|
||||
// SortStable sorts slice of InputPasskeyResponseLogin.
|
||||
func (s InputPasskeyResponseLoginArray) SortStable(less func(a, b InputPasskeyResponseLogin) bool) InputPasskeyResponseLoginArray {
|
||||
sort.SliceStable(s, func(i, j int) bool {
|
||||
return less(s[i], s[j])
|
||||
})
|
||||
return s
|
||||
}
|
||||
|
||||
// Retain filters in-place slice of InputPasskeyResponseLogin.
|
||||
func (s InputPasskeyResponseLoginArray) Retain(keep func(x InputPasskeyResponseLogin) bool) InputPasskeyResponseLoginArray {
|
||||
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 InputPasskeyResponseLoginArray) First() (v InputPasskeyResponseLogin, ok bool) {
|
||||
if len(s) < 1 {
|
||||
return
|
||||
}
|
||||
return s[0], true
|
||||
}
|
||||
|
||||
// Last returns last element of slice (if exists).
|
||||
func (s InputPasskeyResponseLoginArray) Last() (v InputPasskeyResponseLogin, 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 *InputPasskeyResponseLoginArray) PopFirst() (v InputPasskeyResponseLogin, 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 InputPasskeyResponseLogin
|
||||
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 *InputPasskeyResponseLoginArray) Pop() (v InputPasskeyResponseLogin, 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
|
||||
}
|
||||
Generated
+1308
-225
File diff suppressed because it is too large
Load Diff
+305
@@ -0,0 +1,305 @@
|
||||
// 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{}
|
||||
)
|
||||
|
||||
// KeyboardButtonStyle represents TL type `keyboardButtonStyle#4fdd3430`.
|
||||
//
|
||||
// See https://core.telegram.org/constructor/keyboardButtonStyle for reference.
|
||||
type KeyboardButtonStyle struct {
|
||||
// Flags field of KeyboardButtonStyle.
|
||||
Flags bin.Fields
|
||||
// BgPrimary field of KeyboardButtonStyle.
|
||||
BgPrimary bool
|
||||
// BgDanger field of KeyboardButtonStyle.
|
||||
BgDanger bool
|
||||
// BgSuccess field of KeyboardButtonStyle.
|
||||
BgSuccess bool
|
||||
// Icon field of KeyboardButtonStyle.
|
||||
//
|
||||
// Use SetIcon and GetIcon helpers.
|
||||
Icon int64
|
||||
}
|
||||
|
||||
// KeyboardButtonStyleTypeID is TL type id of KeyboardButtonStyle.
|
||||
const KeyboardButtonStyleTypeID = 0x4fdd3430
|
||||
|
||||
// Ensuring interfaces in compile-time for KeyboardButtonStyle.
|
||||
var (
|
||||
_ bin.Encoder = &KeyboardButtonStyle{}
|
||||
_ bin.Decoder = &KeyboardButtonStyle{}
|
||||
_ bin.BareEncoder = &KeyboardButtonStyle{}
|
||||
_ bin.BareDecoder = &KeyboardButtonStyle{}
|
||||
)
|
||||
|
||||
func (k *KeyboardButtonStyle) Zero() bool {
|
||||
if k == nil {
|
||||
return true
|
||||
}
|
||||
if !(k.Flags.Zero()) {
|
||||
return false
|
||||
}
|
||||
if !(k.BgPrimary == false) {
|
||||
return false
|
||||
}
|
||||
if !(k.BgDanger == false) {
|
||||
return false
|
||||
}
|
||||
if !(k.BgSuccess == false) {
|
||||
return false
|
||||
}
|
||||
if !(k.Icon == 0) {
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
// String implements fmt.Stringer.
|
||||
func (k *KeyboardButtonStyle) String() string {
|
||||
if k == nil {
|
||||
return "KeyboardButtonStyle(nil)"
|
||||
}
|
||||
type Alias KeyboardButtonStyle
|
||||
return fmt.Sprintf("KeyboardButtonStyle%+v", Alias(*k))
|
||||
}
|
||||
|
||||
// FillFrom fills KeyboardButtonStyle from given interface.
|
||||
func (k *KeyboardButtonStyle) FillFrom(from interface {
|
||||
GetBgPrimary() (value bool)
|
||||
GetBgDanger() (value bool)
|
||||
GetBgSuccess() (value bool)
|
||||
GetIcon() (value int64, ok bool)
|
||||
}) {
|
||||
k.BgPrimary = from.GetBgPrimary()
|
||||
k.BgDanger = from.GetBgDanger()
|
||||
k.BgSuccess = from.GetBgSuccess()
|
||||
if val, ok := from.GetIcon(); ok {
|
||||
k.Icon = val
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// TypeID returns type id in TL schema.
|
||||
//
|
||||
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
||||
func (*KeyboardButtonStyle) TypeID() uint32 {
|
||||
return KeyboardButtonStyleTypeID
|
||||
}
|
||||
|
||||
// TypeName returns name of type in TL schema.
|
||||
func (*KeyboardButtonStyle) TypeName() string {
|
||||
return "keyboardButtonStyle"
|
||||
}
|
||||
|
||||
// TypeInfo returns info about TL type.
|
||||
func (k *KeyboardButtonStyle) TypeInfo() tdp.Type {
|
||||
typ := tdp.Type{
|
||||
Name: "keyboardButtonStyle",
|
||||
ID: KeyboardButtonStyleTypeID,
|
||||
}
|
||||
if k == nil {
|
||||
typ.Null = true
|
||||
return typ
|
||||
}
|
||||
typ.Fields = []tdp.Field{
|
||||
{
|
||||
Name: "BgPrimary",
|
||||
SchemaName: "bg_primary",
|
||||
Null: !k.Flags.Has(0),
|
||||
},
|
||||
{
|
||||
Name: "BgDanger",
|
||||
SchemaName: "bg_danger",
|
||||
Null: !k.Flags.Has(1),
|
||||
},
|
||||
{
|
||||
Name: "BgSuccess",
|
||||
SchemaName: "bg_success",
|
||||
Null: !k.Flags.Has(2),
|
||||
},
|
||||
{
|
||||
Name: "Icon",
|
||||
SchemaName: "icon",
|
||||
Null: !k.Flags.Has(3),
|
||||
},
|
||||
}
|
||||
return typ
|
||||
}
|
||||
|
||||
// SetFlags sets flags for non-zero fields.
|
||||
func (k *KeyboardButtonStyle) SetFlags() {
|
||||
if !(k.BgPrimary == false) {
|
||||
k.Flags.Set(0)
|
||||
}
|
||||
if !(k.BgDanger == false) {
|
||||
k.Flags.Set(1)
|
||||
}
|
||||
if !(k.BgSuccess == false) {
|
||||
k.Flags.Set(2)
|
||||
}
|
||||
if !(k.Icon == 0) {
|
||||
k.Flags.Set(3)
|
||||
}
|
||||
}
|
||||
|
||||
// Encode implements bin.Encoder.
|
||||
func (k *KeyboardButtonStyle) Encode(b *bin.Buffer) error {
|
||||
if k == nil {
|
||||
return fmt.Errorf("can't encode keyboardButtonStyle#4fdd3430 as nil")
|
||||
}
|
||||
b.PutID(KeyboardButtonStyleTypeID)
|
||||
return k.EncodeBare(b)
|
||||
}
|
||||
|
||||
// EncodeBare implements bin.BareEncoder.
|
||||
func (k *KeyboardButtonStyle) EncodeBare(b *bin.Buffer) error {
|
||||
if k == nil {
|
||||
return fmt.Errorf("can't encode keyboardButtonStyle#4fdd3430 as nil")
|
||||
}
|
||||
k.SetFlags()
|
||||
if err := k.Flags.Encode(b); err != nil {
|
||||
return fmt.Errorf("unable to encode keyboardButtonStyle#4fdd3430: field flags: %w", err)
|
||||
}
|
||||
if k.Flags.Has(3) {
|
||||
b.PutLong(k.Icon)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Decode implements bin.Decoder.
|
||||
func (k *KeyboardButtonStyle) Decode(b *bin.Buffer) error {
|
||||
if k == nil {
|
||||
return fmt.Errorf("can't decode keyboardButtonStyle#4fdd3430 to nil")
|
||||
}
|
||||
if err := b.ConsumeID(KeyboardButtonStyleTypeID); err != nil {
|
||||
return fmt.Errorf("unable to decode keyboardButtonStyle#4fdd3430: %w", err)
|
||||
}
|
||||
return k.DecodeBare(b)
|
||||
}
|
||||
|
||||
// DecodeBare implements bin.BareDecoder.
|
||||
func (k *KeyboardButtonStyle) DecodeBare(b *bin.Buffer) error {
|
||||
if k == nil {
|
||||
return fmt.Errorf("can't decode keyboardButtonStyle#4fdd3430 to nil")
|
||||
}
|
||||
{
|
||||
if err := k.Flags.Decode(b); err != nil {
|
||||
return fmt.Errorf("unable to decode keyboardButtonStyle#4fdd3430: field flags: %w", err)
|
||||
}
|
||||
}
|
||||
k.BgPrimary = k.Flags.Has(0)
|
||||
k.BgDanger = k.Flags.Has(1)
|
||||
k.BgSuccess = k.Flags.Has(2)
|
||||
if k.Flags.Has(3) {
|
||||
value, err := b.Long()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode keyboardButtonStyle#4fdd3430: field icon: %w", err)
|
||||
}
|
||||
k.Icon = value
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// SetBgPrimary sets value of BgPrimary conditional field.
|
||||
func (k *KeyboardButtonStyle) SetBgPrimary(value bool) {
|
||||
if value {
|
||||
k.Flags.Set(0)
|
||||
k.BgPrimary = true
|
||||
} else {
|
||||
k.Flags.Unset(0)
|
||||
k.BgPrimary = false
|
||||
}
|
||||
}
|
||||
|
||||
// GetBgPrimary returns value of BgPrimary conditional field.
|
||||
func (k *KeyboardButtonStyle) GetBgPrimary() (value bool) {
|
||||
if k == nil {
|
||||
return
|
||||
}
|
||||
return k.Flags.Has(0)
|
||||
}
|
||||
|
||||
// SetBgDanger sets value of BgDanger conditional field.
|
||||
func (k *KeyboardButtonStyle) SetBgDanger(value bool) {
|
||||
if value {
|
||||
k.Flags.Set(1)
|
||||
k.BgDanger = true
|
||||
} else {
|
||||
k.Flags.Unset(1)
|
||||
k.BgDanger = false
|
||||
}
|
||||
}
|
||||
|
||||
// GetBgDanger returns value of BgDanger conditional field.
|
||||
func (k *KeyboardButtonStyle) GetBgDanger() (value bool) {
|
||||
if k == nil {
|
||||
return
|
||||
}
|
||||
return k.Flags.Has(1)
|
||||
}
|
||||
|
||||
// SetBgSuccess sets value of BgSuccess conditional field.
|
||||
func (k *KeyboardButtonStyle) SetBgSuccess(value bool) {
|
||||
if value {
|
||||
k.Flags.Set(2)
|
||||
k.BgSuccess = true
|
||||
} else {
|
||||
k.Flags.Unset(2)
|
||||
k.BgSuccess = false
|
||||
}
|
||||
}
|
||||
|
||||
// GetBgSuccess returns value of BgSuccess conditional field.
|
||||
func (k *KeyboardButtonStyle) GetBgSuccess() (value bool) {
|
||||
if k == nil {
|
||||
return
|
||||
}
|
||||
return k.Flags.Has(2)
|
||||
}
|
||||
|
||||
// SetIcon sets value of Icon conditional field.
|
||||
func (k *KeyboardButtonStyle) SetIcon(value int64) {
|
||||
k.Flags.Set(3)
|
||||
k.Icon = value
|
||||
}
|
||||
|
||||
// GetIcon returns value of Icon conditional field and
|
||||
// boolean which is true if field was set.
|
||||
func (k *KeyboardButtonStyle) GetIcon() (value int64, ok bool) {
|
||||
if k == nil {
|
||||
return
|
||||
}
|
||||
if !k.Flags.Has(3) {
|
||||
return value, false
|
||||
}
|
||||
return k.Icon, true
|
||||
}
|
||||
+35
@@ -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{}
|
||||
)
|
||||
Generated
+1427
-60
File diff suppressed because it is too large
Load Diff
+570
@@ -779,6 +779,84 @@ func (s MessageActionClassArray) AsMessageActionSuggestBirthday() (to MessageAct
|
||||
return to
|
||||
}
|
||||
|
||||
// AsMessageActionStarGiftPurchaseOffer returns copy with only MessageActionStarGiftPurchaseOffer constructors.
|
||||
func (s MessageActionClassArray) AsMessageActionStarGiftPurchaseOffer() (to MessageActionStarGiftPurchaseOfferArray) {
|
||||
for _, elem := range s {
|
||||
value, ok := elem.(*MessageActionStarGiftPurchaseOffer)
|
||||
if !ok {
|
||||
continue
|
||||
}
|
||||
to = append(to, *value)
|
||||
}
|
||||
|
||||
return to
|
||||
}
|
||||
|
||||
// AsMessageActionStarGiftPurchaseOfferDeclined returns copy with only MessageActionStarGiftPurchaseOfferDeclined constructors.
|
||||
func (s MessageActionClassArray) AsMessageActionStarGiftPurchaseOfferDeclined() (to MessageActionStarGiftPurchaseOfferDeclinedArray) {
|
||||
for _, elem := range s {
|
||||
value, ok := elem.(*MessageActionStarGiftPurchaseOfferDeclined)
|
||||
if !ok {
|
||||
continue
|
||||
}
|
||||
to = append(to, *value)
|
||||
}
|
||||
|
||||
return to
|
||||
}
|
||||
|
||||
// AsMessageActionNewCreatorPending returns copy with only MessageActionNewCreatorPending constructors.
|
||||
func (s MessageActionClassArray) AsMessageActionNewCreatorPending() (to MessageActionNewCreatorPendingArray) {
|
||||
for _, elem := range s {
|
||||
value, ok := elem.(*MessageActionNewCreatorPending)
|
||||
if !ok {
|
||||
continue
|
||||
}
|
||||
to = append(to, *value)
|
||||
}
|
||||
|
||||
return to
|
||||
}
|
||||
|
||||
// AsMessageActionChangeCreator returns copy with only MessageActionChangeCreator constructors.
|
||||
func (s MessageActionClassArray) AsMessageActionChangeCreator() (to MessageActionChangeCreatorArray) {
|
||||
for _, elem := range s {
|
||||
value, ok := elem.(*MessageActionChangeCreator)
|
||||
if !ok {
|
||||
continue
|
||||
}
|
||||
to = append(to, *value)
|
||||
}
|
||||
|
||||
return to
|
||||
}
|
||||
|
||||
// AsMessageActionNoForwardsToggle returns copy with only MessageActionNoForwardsToggle constructors.
|
||||
func (s MessageActionClassArray) AsMessageActionNoForwardsToggle() (to MessageActionNoForwardsToggleArray) {
|
||||
for _, elem := range s {
|
||||
value, ok := elem.(*MessageActionNoForwardsToggle)
|
||||
if !ok {
|
||||
continue
|
||||
}
|
||||
to = append(to, *value)
|
||||
}
|
||||
|
||||
return to
|
||||
}
|
||||
|
||||
// AsMessageActionNoForwardsRequest returns copy with only MessageActionNoForwardsRequest constructors.
|
||||
func (s MessageActionClassArray) AsMessageActionNoForwardsRequest() (to MessageActionNoForwardsRequestArray) {
|
||||
for _, elem := range s {
|
||||
value, ok := elem.(*MessageActionNoForwardsRequest)
|
||||
if !ok {
|
||||
continue
|
||||
}
|
||||
to = append(to, *value)
|
||||
}
|
||||
|
||||
return to
|
||||
}
|
||||
|
||||
// MessageActionChatCreateArray is adapter for slice of MessageActionChatCreate.
|
||||
type MessageActionChatCreateArray []MessageActionChatCreate
|
||||
|
||||
@@ -4960,3 +5038,495 @@ func (s *MessageActionSuggestBirthdayArray) Pop() (v MessageActionSuggestBirthda
|
||||
|
||||
return v, true
|
||||
}
|
||||
|
||||
// MessageActionStarGiftPurchaseOfferArray is adapter for slice of MessageActionStarGiftPurchaseOffer.
|
||||
type MessageActionStarGiftPurchaseOfferArray []MessageActionStarGiftPurchaseOffer
|
||||
|
||||
// Sort sorts slice of MessageActionStarGiftPurchaseOffer.
|
||||
func (s MessageActionStarGiftPurchaseOfferArray) Sort(less func(a, b MessageActionStarGiftPurchaseOffer) bool) MessageActionStarGiftPurchaseOfferArray {
|
||||
sort.Slice(s, func(i, j int) bool {
|
||||
return less(s[i], s[j])
|
||||
})
|
||||
return s
|
||||
}
|
||||
|
||||
// SortStable sorts slice of MessageActionStarGiftPurchaseOffer.
|
||||
func (s MessageActionStarGiftPurchaseOfferArray) SortStable(less func(a, b MessageActionStarGiftPurchaseOffer) bool) MessageActionStarGiftPurchaseOfferArray {
|
||||
sort.SliceStable(s, func(i, j int) bool {
|
||||
return less(s[i], s[j])
|
||||
})
|
||||
return s
|
||||
}
|
||||
|
||||
// Retain filters in-place slice of MessageActionStarGiftPurchaseOffer.
|
||||
func (s MessageActionStarGiftPurchaseOfferArray) Retain(keep func(x MessageActionStarGiftPurchaseOffer) bool) MessageActionStarGiftPurchaseOfferArray {
|
||||
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 MessageActionStarGiftPurchaseOfferArray) First() (v MessageActionStarGiftPurchaseOffer, ok bool) {
|
||||
if len(s) < 1 {
|
||||
return
|
||||
}
|
||||
return s[0], true
|
||||
}
|
||||
|
||||
// Last returns last element of slice (if exists).
|
||||
func (s MessageActionStarGiftPurchaseOfferArray) Last() (v MessageActionStarGiftPurchaseOffer, 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 *MessageActionStarGiftPurchaseOfferArray) PopFirst() (v MessageActionStarGiftPurchaseOffer, 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 MessageActionStarGiftPurchaseOffer
|
||||
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 *MessageActionStarGiftPurchaseOfferArray) Pop() (v MessageActionStarGiftPurchaseOffer, 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
|
||||
}
|
||||
|
||||
// MessageActionStarGiftPurchaseOfferDeclinedArray is adapter for slice of MessageActionStarGiftPurchaseOfferDeclined.
|
||||
type MessageActionStarGiftPurchaseOfferDeclinedArray []MessageActionStarGiftPurchaseOfferDeclined
|
||||
|
||||
// Sort sorts slice of MessageActionStarGiftPurchaseOfferDeclined.
|
||||
func (s MessageActionStarGiftPurchaseOfferDeclinedArray) Sort(less func(a, b MessageActionStarGiftPurchaseOfferDeclined) bool) MessageActionStarGiftPurchaseOfferDeclinedArray {
|
||||
sort.Slice(s, func(i, j int) bool {
|
||||
return less(s[i], s[j])
|
||||
})
|
||||
return s
|
||||
}
|
||||
|
||||
// SortStable sorts slice of MessageActionStarGiftPurchaseOfferDeclined.
|
||||
func (s MessageActionStarGiftPurchaseOfferDeclinedArray) SortStable(less func(a, b MessageActionStarGiftPurchaseOfferDeclined) bool) MessageActionStarGiftPurchaseOfferDeclinedArray {
|
||||
sort.SliceStable(s, func(i, j int) bool {
|
||||
return less(s[i], s[j])
|
||||
})
|
||||
return s
|
||||
}
|
||||
|
||||
// Retain filters in-place slice of MessageActionStarGiftPurchaseOfferDeclined.
|
||||
func (s MessageActionStarGiftPurchaseOfferDeclinedArray) Retain(keep func(x MessageActionStarGiftPurchaseOfferDeclined) bool) MessageActionStarGiftPurchaseOfferDeclinedArray {
|
||||
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 MessageActionStarGiftPurchaseOfferDeclinedArray) First() (v MessageActionStarGiftPurchaseOfferDeclined, ok bool) {
|
||||
if len(s) < 1 {
|
||||
return
|
||||
}
|
||||
return s[0], true
|
||||
}
|
||||
|
||||
// Last returns last element of slice (if exists).
|
||||
func (s MessageActionStarGiftPurchaseOfferDeclinedArray) Last() (v MessageActionStarGiftPurchaseOfferDeclined, 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 *MessageActionStarGiftPurchaseOfferDeclinedArray) PopFirst() (v MessageActionStarGiftPurchaseOfferDeclined, 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 MessageActionStarGiftPurchaseOfferDeclined
|
||||
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 *MessageActionStarGiftPurchaseOfferDeclinedArray) Pop() (v MessageActionStarGiftPurchaseOfferDeclined, 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
|
||||
}
|
||||
|
||||
// MessageActionNewCreatorPendingArray is adapter for slice of MessageActionNewCreatorPending.
|
||||
type MessageActionNewCreatorPendingArray []MessageActionNewCreatorPending
|
||||
|
||||
// Sort sorts slice of MessageActionNewCreatorPending.
|
||||
func (s MessageActionNewCreatorPendingArray) Sort(less func(a, b MessageActionNewCreatorPending) bool) MessageActionNewCreatorPendingArray {
|
||||
sort.Slice(s, func(i, j int) bool {
|
||||
return less(s[i], s[j])
|
||||
})
|
||||
return s
|
||||
}
|
||||
|
||||
// SortStable sorts slice of MessageActionNewCreatorPending.
|
||||
func (s MessageActionNewCreatorPendingArray) SortStable(less func(a, b MessageActionNewCreatorPending) bool) MessageActionNewCreatorPendingArray {
|
||||
sort.SliceStable(s, func(i, j int) bool {
|
||||
return less(s[i], s[j])
|
||||
})
|
||||
return s
|
||||
}
|
||||
|
||||
// Retain filters in-place slice of MessageActionNewCreatorPending.
|
||||
func (s MessageActionNewCreatorPendingArray) Retain(keep func(x MessageActionNewCreatorPending) bool) MessageActionNewCreatorPendingArray {
|
||||
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 MessageActionNewCreatorPendingArray) First() (v MessageActionNewCreatorPending, ok bool) {
|
||||
if len(s) < 1 {
|
||||
return
|
||||
}
|
||||
return s[0], true
|
||||
}
|
||||
|
||||
// Last returns last element of slice (if exists).
|
||||
func (s MessageActionNewCreatorPendingArray) Last() (v MessageActionNewCreatorPending, 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 *MessageActionNewCreatorPendingArray) PopFirst() (v MessageActionNewCreatorPending, 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 MessageActionNewCreatorPending
|
||||
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 *MessageActionNewCreatorPendingArray) Pop() (v MessageActionNewCreatorPending, 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
|
||||
}
|
||||
|
||||
// MessageActionChangeCreatorArray is adapter for slice of MessageActionChangeCreator.
|
||||
type MessageActionChangeCreatorArray []MessageActionChangeCreator
|
||||
|
||||
// Sort sorts slice of MessageActionChangeCreator.
|
||||
func (s MessageActionChangeCreatorArray) Sort(less func(a, b MessageActionChangeCreator) bool) MessageActionChangeCreatorArray {
|
||||
sort.Slice(s, func(i, j int) bool {
|
||||
return less(s[i], s[j])
|
||||
})
|
||||
return s
|
||||
}
|
||||
|
||||
// SortStable sorts slice of MessageActionChangeCreator.
|
||||
func (s MessageActionChangeCreatorArray) SortStable(less func(a, b MessageActionChangeCreator) bool) MessageActionChangeCreatorArray {
|
||||
sort.SliceStable(s, func(i, j int) bool {
|
||||
return less(s[i], s[j])
|
||||
})
|
||||
return s
|
||||
}
|
||||
|
||||
// Retain filters in-place slice of MessageActionChangeCreator.
|
||||
func (s MessageActionChangeCreatorArray) Retain(keep func(x MessageActionChangeCreator) bool) MessageActionChangeCreatorArray {
|
||||
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 MessageActionChangeCreatorArray) First() (v MessageActionChangeCreator, ok bool) {
|
||||
if len(s) < 1 {
|
||||
return
|
||||
}
|
||||
return s[0], true
|
||||
}
|
||||
|
||||
// Last returns last element of slice (if exists).
|
||||
func (s MessageActionChangeCreatorArray) Last() (v MessageActionChangeCreator, 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 *MessageActionChangeCreatorArray) PopFirst() (v MessageActionChangeCreator, 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 MessageActionChangeCreator
|
||||
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 *MessageActionChangeCreatorArray) Pop() (v MessageActionChangeCreator, 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
|
||||
}
|
||||
|
||||
// MessageActionNoForwardsToggleArray is adapter for slice of MessageActionNoForwardsToggle.
|
||||
type MessageActionNoForwardsToggleArray []MessageActionNoForwardsToggle
|
||||
|
||||
// Sort sorts slice of MessageActionNoForwardsToggle.
|
||||
func (s MessageActionNoForwardsToggleArray) Sort(less func(a, b MessageActionNoForwardsToggle) bool) MessageActionNoForwardsToggleArray {
|
||||
sort.Slice(s, func(i, j int) bool {
|
||||
return less(s[i], s[j])
|
||||
})
|
||||
return s
|
||||
}
|
||||
|
||||
// SortStable sorts slice of MessageActionNoForwardsToggle.
|
||||
func (s MessageActionNoForwardsToggleArray) SortStable(less func(a, b MessageActionNoForwardsToggle) bool) MessageActionNoForwardsToggleArray {
|
||||
sort.SliceStable(s, func(i, j int) bool {
|
||||
return less(s[i], s[j])
|
||||
})
|
||||
return s
|
||||
}
|
||||
|
||||
// Retain filters in-place slice of MessageActionNoForwardsToggle.
|
||||
func (s MessageActionNoForwardsToggleArray) Retain(keep func(x MessageActionNoForwardsToggle) bool) MessageActionNoForwardsToggleArray {
|
||||
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 MessageActionNoForwardsToggleArray) First() (v MessageActionNoForwardsToggle, ok bool) {
|
||||
if len(s) < 1 {
|
||||
return
|
||||
}
|
||||
return s[0], true
|
||||
}
|
||||
|
||||
// Last returns last element of slice (if exists).
|
||||
func (s MessageActionNoForwardsToggleArray) Last() (v MessageActionNoForwardsToggle, 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 *MessageActionNoForwardsToggleArray) PopFirst() (v MessageActionNoForwardsToggle, 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 MessageActionNoForwardsToggle
|
||||
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 *MessageActionNoForwardsToggleArray) Pop() (v MessageActionNoForwardsToggle, 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
|
||||
}
|
||||
|
||||
// MessageActionNoForwardsRequestArray is adapter for slice of MessageActionNoForwardsRequest.
|
||||
type MessageActionNoForwardsRequestArray []MessageActionNoForwardsRequest
|
||||
|
||||
// Sort sorts slice of MessageActionNoForwardsRequest.
|
||||
func (s MessageActionNoForwardsRequestArray) Sort(less func(a, b MessageActionNoForwardsRequest) bool) MessageActionNoForwardsRequestArray {
|
||||
sort.Slice(s, func(i, j int) bool {
|
||||
return less(s[i], s[j])
|
||||
})
|
||||
return s
|
||||
}
|
||||
|
||||
// SortStable sorts slice of MessageActionNoForwardsRequest.
|
||||
func (s MessageActionNoForwardsRequestArray) SortStable(less func(a, b MessageActionNoForwardsRequest) bool) MessageActionNoForwardsRequestArray {
|
||||
sort.SliceStable(s, func(i, j int) bool {
|
||||
return less(s[i], s[j])
|
||||
})
|
||||
return s
|
||||
}
|
||||
|
||||
// Retain filters in-place slice of MessageActionNoForwardsRequest.
|
||||
func (s MessageActionNoForwardsRequestArray) Retain(keep func(x MessageActionNoForwardsRequest) bool) MessageActionNoForwardsRequestArray {
|
||||
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 MessageActionNoForwardsRequestArray) First() (v MessageActionNoForwardsRequest, ok bool) {
|
||||
if len(s) < 1 {
|
||||
return
|
||||
}
|
||||
return s[0], true
|
||||
}
|
||||
|
||||
// Last returns last element of slice (if exists).
|
||||
func (s MessageActionNoForwardsRequestArray) Last() (v MessageActionNoForwardsRequest, 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 *MessageActionNoForwardsRequestArray) PopFirst() (v MessageActionNoForwardsRequest, 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 MessageActionNoForwardsRequest
|
||||
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 *MessageActionNoForwardsRequestArray) Pop() (v MessageActionNoForwardsRequest, 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
|
||||
}
|
||||
|
||||
Generated
+424
@@ -3801,6 +3801,422 @@ func (m *MessageEntityBlockquote) GetLength() (value int) {
|
||||
return m.Length
|
||||
}
|
||||
|
||||
// MessageEntityFormattedDate represents TL type `messageEntityFormattedDate#904ac7c7`.
|
||||
//
|
||||
// See https://core.telegram.org/constructor/messageEntityFormattedDate for reference.
|
||||
type MessageEntityFormattedDate struct {
|
||||
// Flags field of MessageEntityFormattedDate.
|
||||
Flags bin.Fields
|
||||
// Relative field of MessageEntityFormattedDate.
|
||||
Relative bool
|
||||
// ShortTime field of MessageEntityFormattedDate.
|
||||
ShortTime bool
|
||||
// LongTime field of MessageEntityFormattedDate.
|
||||
LongTime bool
|
||||
// ShortDate field of MessageEntityFormattedDate.
|
||||
ShortDate bool
|
||||
// LongDate field of MessageEntityFormattedDate.
|
||||
LongDate bool
|
||||
// DayOfWeek field of MessageEntityFormattedDate.
|
||||
DayOfWeek bool
|
||||
// Offset field of MessageEntityFormattedDate.
|
||||
Offset int
|
||||
// Length field of MessageEntityFormattedDate.
|
||||
Length int
|
||||
// Date field of MessageEntityFormattedDate.
|
||||
Date int
|
||||
}
|
||||
|
||||
// MessageEntityFormattedDateTypeID is TL type id of MessageEntityFormattedDate.
|
||||
const MessageEntityFormattedDateTypeID = 0x904ac7c7
|
||||
|
||||
// construct implements constructor of MessageEntityClass.
|
||||
func (m MessageEntityFormattedDate) construct() MessageEntityClass { return &m }
|
||||
|
||||
// Ensuring interfaces in compile-time for MessageEntityFormattedDate.
|
||||
var (
|
||||
_ bin.Encoder = &MessageEntityFormattedDate{}
|
||||
_ bin.Decoder = &MessageEntityFormattedDate{}
|
||||
_ bin.BareEncoder = &MessageEntityFormattedDate{}
|
||||
_ bin.BareDecoder = &MessageEntityFormattedDate{}
|
||||
|
||||
_ MessageEntityClass = &MessageEntityFormattedDate{}
|
||||
)
|
||||
|
||||
func (m *MessageEntityFormattedDate) Zero() bool {
|
||||
if m == nil {
|
||||
return true
|
||||
}
|
||||
if !(m.Flags.Zero()) {
|
||||
return false
|
||||
}
|
||||
if !(m.Relative == false) {
|
||||
return false
|
||||
}
|
||||
if !(m.ShortTime == false) {
|
||||
return false
|
||||
}
|
||||
if !(m.LongTime == false) {
|
||||
return false
|
||||
}
|
||||
if !(m.ShortDate == false) {
|
||||
return false
|
||||
}
|
||||
if !(m.LongDate == false) {
|
||||
return false
|
||||
}
|
||||
if !(m.DayOfWeek == false) {
|
||||
return false
|
||||
}
|
||||
if !(m.Offset == 0) {
|
||||
return false
|
||||
}
|
||||
if !(m.Length == 0) {
|
||||
return false
|
||||
}
|
||||
if !(m.Date == 0) {
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
// String implements fmt.Stringer.
|
||||
func (m *MessageEntityFormattedDate) String() string {
|
||||
if m == nil {
|
||||
return "MessageEntityFormattedDate(nil)"
|
||||
}
|
||||
type Alias MessageEntityFormattedDate
|
||||
return fmt.Sprintf("MessageEntityFormattedDate%+v", Alias(*m))
|
||||
}
|
||||
|
||||
// FillFrom fills MessageEntityFormattedDate from given interface.
|
||||
func (m *MessageEntityFormattedDate) FillFrom(from interface {
|
||||
GetRelative() (value bool)
|
||||
GetShortTime() (value bool)
|
||||
GetLongTime() (value bool)
|
||||
GetShortDate() (value bool)
|
||||
GetLongDate() (value bool)
|
||||
GetDayOfWeek() (value bool)
|
||||
GetOffset() (value int)
|
||||
GetLength() (value int)
|
||||
GetDate() (value int)
|
||||
}) {
|
||||
m.Relative = from.GetRelative()
|
||||
m.ShortTime = from.GetShortTime()
|
||||
m.LongTime = from.GetLongTime()
|
||||
m.ShortDate = from.GetShortDate()
|
||||
m.LongDate = from.GetLongDate()
|
||||
m.DayOfWeek = from.GetDayOfWeek()
|
||||
m.Offset = from.GetOffset()
|
||||
m.Length = from.GetLength()
|
||||
m.Date = from.GetDate()
|
||||
}
|
||||
|
||||
// TypeID returns type id in TL schema.
|
||||
//
|
||||
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
||||
func (*MessageEntityFormattedDate) TypeID() uint32 {
|
||||
return MessageEntityFormattedDateTypeID
|
||||
}
|
||||
|
||||
// TypeName returns name of type in TL schema.
|
||||
func (*MessageEntityFormattedDate) TypeName() string {
|
||||
return "messageEntityFormattedDate"
|
||||
}
|
||||
|
||||
// TypeInfo returns info about TL type.
|
||||
func (m *MessageEntityFormattedDate) TypeInfo() tdp.Type {
|
||||
typ := tdp.Type{
|
||||
Name: "messageEntityFormattedDate",
|
||||
ID: MessageEntityFormattedDateTypeID,
|
||||
}
|
||||
if m == nil {
|
||||
typ.Null = true
|
||||
return typ
|
||||
}
|
||||
typ.Fields = []tdp.Field{
|
||||
{
|
||||
Name: "Relative",
|
||||
SchemaName: "relative",
|
||||
Null: !m.Flags.Has(0),
|
||||
},
|
||||
{
|
||||
Name: "ShortTime",
|
||||
SchemaName: "short_time",
|
||||
Null: !m.Flags.Has(1),
|
||||
},
|
||||
{
|
||||
Name: "LongTime",
|
||||
SchemaName: "long_time",
|
||||
Null: !m.Flags.Has(2),
|
||||
},
|
||||
{
|
||||
Name: "ShortDate",
|
||||
SchemaName: "short_date",
|
||||
Null: !m.Flags.Has(3),
|
||||
},
|
||||
{
|
||||
Name: "LongDate",
|
||||
SchemaName: "long_date",
|
||||
Null: !m.Flags.Has(4),
|
||||
},
|
||||
{
|
||||
Name: "DayOfWeek",
|
||||
SchemaName: "day_of_week",
|
||||
Null: !m.Flags.Has(5),
|
||||
},
|
||||
{
|
||||
Name: "Offset",
|
||||
SchemaName: "offset",
|
||||
},
|
||||
{
|
||||
Name: "Length",
|
||||
SchemaName: "length",
|
||||
},
|
||||
{
|
||||
Name: "Date",
|
||||
SchemaName: "date",
|
||||
},
|
||||
}
|
||||
return typ
|
||||
}
|
||||
|
||||
// SetFlags sets flags for non-zero fields.
|
||||
func (m *MessageEntityFormattedDate) SetFlags() {
|
||||
if !(m.Relative == false) {
|
||||
m.Flags.Set(0)
|
||||
}
|
||||
if !(m.ShortTime == false) {
|
||||
m.Flags.Set(1)
|
||||
}
|
||||
if !(m.LongTime == false) {
|
||||
m.Flags.Set(2)
|
||||
}
|
||||
if !(m.ShortDate == false) {
|
||||
m.Flags.Set(3)
|
||||
}
|
||||
if !(m.LongDate == false) {
|
||||
m.Flags.Set(4)
|
||||
}
|
||||
if !(m.DayOfWeek == false) {
|
||||
m.Flags.Set(5)
|
||||
}
|
||||
}
|
||||
|
||||
// Encode implements bin.Encoder.
|
||||
func (m *MessageEntityFormattedDate) Encode(b *bin.Buffer) error {
|
||||
if m == nil {
|
||||
return fmt.Errorf("can't encode messageEntityFormattedDate#904ac7c7 as nil")
|
||||
}
|
||||
b.PutID(MessageEntityFormattedDateTypeID)
|
||||
return m.EncodeBare(b)
|
||||
}
|
||||
|
||||
// EncodeBare implements bin.BareEncoder.
|
||||
func (m *MessageEntityFormattedDate) EncodeBare(b *bin.Buffer) error {
|
||||
if m == nil {
|
||||
return fmt.Errorf("can't encode messageEntityFormattedDate#904ac7c7 as nil")
|
||||
}
|
||||
m.SetFlags()
|
||||
if err := m.Flags.Encode(b); err != nil {
|
||||
return fmt.Errorf("unable to encode messageEntityFormattedDate#904ac7c7: field flags: %w", err)
|
||||
}
|
||||
b.PutInt(m.Offset)
|
||||
b.PutInt(m.Length)
|
||||
b.PutInt(m.Date)
|
||||
return nil
|
||||
}
|
||||
|
||||
// Decode implements bin.Decoder.
|
||||
func (m *MessageEntityFormattedDate) Decode(b *bin.Buffer) error {
|
||||
if m == nil {
|
||||
return fmt.Errorf("can't decode messageEntityFormattedDate#904ac7c7 to nil")
|
||||
}
|
||||
if err := b.ConsumeID(MessageEntityFormattedDateTypeID); err != nil {
|
||||
return fmt.Errorf("unable to decode messageEntityFormattedDate#904ac7c7: %w", err)
|
||||
}
|
||||
return m.DecodeBare(b)
|
||||
}
|
||||
|
||||
// DecodeBare implements bin.BareDecoder.
|
||||
func (m *MessageEntityFormattedDate) DecodeBare(b *bin.Buffer) error {
|
||||
if m == nil {
|
||||
return fmt.Errorf("can't decode messageEntityFormattedDate#904ac7c7 to nil")
|
||||
}
|
||||
{
|
||||
if err := m.Flags.Decode(b); err != nil {
|
||||
return fmt.Errorf("unable to decode messageEntityFormattedDate#904ac7c7: field flags: %w", err)
|
||||
}
|
||||
}
|
||||
m.Relative = m.Flags.Has(0)
|
||||
m.ShortTime = m.Flags.Has(1)
|
||||
m.LongTime = m.Flags.Has(2)
|
||||
m.ShortDate = m.Flags.Has(3)
|
||||
m.LongDate = m.Flags.Has(4)
|
||||
m.DayOfWeek = m.Flags.Has(5)
|
||||
{
|
||||
value, err := b.Int()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode messageEntityFormattedDate#904ac7c7: field offset: %w", err)
|
||||
}
|
||||
m.Offset = value
|
||||
}
|
||||
{
|
||||
value, err := b.Int()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode messageEntityFormattedDate#904ac7c7: field length: %w", err)
|
||||
}
|
||||
m.Length = value
|
||||
}
|
||||
{
|
||||
value, err := b.Int()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode messageEntityFormattedDate#904ac7c7: field date: %w", err)
|
||||
}
|
||||
m.Date = value
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// SetRelative sets value of Relative conditional field.
|
||||
func (m *MessageEntityFormattedDate) SetRelative(value bool) {
|
||||
if value {
|
||||
m.Flags.Set(0)
|
||||
m.Relative = true
|
||||
} else {
|
||||
m.Flags.Unset(0)
|
||||
m.Relative = false
|
||||
}
|
||||
}
|
||||
|
||||
// GetRelative returns value of Relative conditional field.
|
||||
func (m *MessageEntityFormattedDate) GetRelative() (value bool) {
|
||||
if m == nil {
|
||||
return
|
||||
}
|
||||
return m.Flags.Has(0)
|
||||
}
|
||||
|
||||
// SetShortTime sets value of ShortTime conditional field.
|
||||
func (m *MessageEntityFormattedDate) SetShortTime(value bool) {
|
||||
if value {
|
||||
m.Flags.Set(1)
|
||||
m.ShortTime = true
|
||||
} else {
|
||||
m.Flags.Unset(1)
|
||||
m.ShortTime = false
|
||||
}
|
||||
}
|
||||
|
||||
// GetShortTime returns value of ShortTime conditional field.
|
||||
func (m *MessageEntityFormattedDate) GetShortTime() (value bool) {
|
||||
if m == nil {
|
||||
return
|
||||
}
|
||||
return m.Flags.Has(1)
|
||||
}
|
||||
|
||||
// SetLongTime sets value of LongTime conditional field.
|
||||
func (m *MessageEntityFormattedDate) SetLongTime(value bool) {
|
||||
if value {
|
||||
m.Flags.Set(2)
|
||||
m.LongTime = true
|
||||
} else {
|
||||
m.Flags.Unset(2)
|
||||
m.LongTime = false
|
||||
}
|
||||
}
|
||||
|
||||
// GetLongTime returns value of LongTime conditional field.
|
||||
func (m *MessageEntityFormattedDate) GetLongTime() (value bool) {
|
||||
if m == nil {
|
||||
return
|
||||
}
|
||||
return m.Flags.Has(2)
|
||||
}
|
||||
|
||||
// SetShortDate sets value of ShortDate conditional field.
|
||||
func (m *MessageEntityFormattedDate) SetShortDate(value bool) {
|
||||
if value {
|
||||
m.Flags.Set(3)
|
||||
m.ShortDate = true
|
||||
} else {
|
||||
m.Flags.Unset(3)
|
||||
m.ShortDate = false
|
||||
}
|
||||
}
|
||||
|
||||
// GetShortDate returns value of ShortDate conditional field.
|
||||
func (m *MessageEntityFormattedDate) GetShortDate() (value bool) {
|
||||
if m == nil {
|
||||
return
|
||||
}
|
||||
return m.Flags.Has(3)
|
||||
}
|
||||
|
||||
// SetLongDate sets value of LongDate conditional field.
|
||||
func (m *MessageEntityFormattedDate) SetLongDate(value bool) {
|
||||
if value {
|
||||
m.Flags.Set(4)
|
||||
m.LongDate = true
|
||||
} else {
|
||||
m.Flags.Unset(4)
|
||||
m.LongDate = false
|
||||
}
|
||||
}
|
||||
|
||||
// GetLongDate returns value of LongDate conditional field.
|
||||
func (m *MessageEntityFormattedDate) GetLongDate() (value bool) {
|
||||
if m == nil {
|
||||
return
|
||||
}
|
||||
return m.Flags.Has(4)
|
||||
}
|
||||
|
||||
// SetDayOfWeek sets value of DayOfWeek conditional field.
|
||||
func (m *MessageEntityFormattedDate) SetDayOfWeek(value bool) {
|
||||
if value {
|
||||
m.Flags.Set(5)
|
||||
m.DayOfWeek = true
|
||||
} else {
|
||||
m.Flags.Unset(5)
|
||||
m.DayOfWeek = false
|
||||
}
|
||||
}
|
||||
|
||||
// GetDayOfWeek returns value of DayOfWeek conditional field.
|
||||
func (m *MessageEntityFormattedDate) GetDayOfWeek() (value bool) {
|
||||
if m == nil {
|
||||
return
|
||||
}
|
||||
return m.Flags.Has(5)
|
||||
}
|
||||
|
||||
// GetOffset returns value of Offset field.
|
||||
func (m *MessageEntityFormattedDate) GetOffset() (value int) {
|
||||
if m == nil {
|
||||
return
|
||||
}
|
||||
return m.Offset
|
||||
}
|
||||
|
||||
// GetLength returns value of Length field.
|
||||
func (m *MessageEntityFormattedDate) GetLength() (value int) {
|
||||
if m == nil {
|
||||
return
|
||||
}
|
||||
return m.Length
|
||||
}
|
||||
|
||||
// GetDate returns value of Date field.
|
||||
func (m *MessageEntityFormattedDate) GetDate() (value int) {
|
||||
if m == nil {
|
||||
return
|
||||
}
|
||||
return m.Date
|
||||
}
|
||||
|
||||
// MessageEntityClassName is schema name of MessageEntityClass.
|
||||
const MessageEntityClassName = "MessageEntity"
|
||||
|
||||
@@ -3836,6 +4252,7 @@ const MessageEntityClassName = "MessageEntity"
|
||||
// case *tg.MessageEntitySpoiler: // messageEntitySpoiler#32ca960f
|
||||
// case *tg.MessageEntityCustomEmoji: // messageEntityCustomEmoji#c8cf05f8
|
||||
// case *tg.MessageEntityBlockquote: // messageEntityBlockquote#f1ccaaac
|
||||
// case *tg.MessageEntityFormattedDate: // messageEntityFormattedDate#904ac7c7
|
||||
// default: panic(v)
|
||||
// }
|
||||
type MessageEntityClass interface {
|
||||
@@ -4023,6 +4440,13 @@ func DecodeMessageEntity(buf *bin.Buffer) (MessageEntityClass, error) {
|
||||
return nil, fmt.Errorf("unable to decode MessageEntityClass: %w", err)
|
||||
}
|
||||
return &v, nil
|
||||
case MessageEntityFormattedDateTypeID:
|
||||
// Decoding messageEntityFormattedDate#904ac7c7.
|
||||
v := MessageEntityFormattedDate{}
|
||||
if err := v.Decode(buf); err != nil {
|
||||
return nil, fmt.Errorf("unable to decode MessageEntityClass: %w", err)
|
||||
}
|
||||
return &v, nil
|
||||
default:
|
||||
return nil, fmt.Errorf("unable to decode MessageEntityClass: %w", bin.NewUnexpectedID(id))
|
||||
}
|
||||
|
||||
+109
@@ -389,6 +389,19 @@ func (s MessageEntityClassArray) AsMessageEntityBlockquote() (to MessageEntityBl
|
||||
return to
|
||||
}
|
||||
|
||||
// AsMessageEntityFormattedDate returns copy with only MessageEntityFormattedDate constructors.
|
||||
func (s MessageEntityClassArray) AsMessageEntityFormattedDate() (to MessageEntityFormattedDateArray) {
|
||||
for _, elem := range s {
|
||||
value, ok := elem.(*MessageEntityFormattedDate)
|
||||
if !ok {
|
||||
continue
|
||||
}
|
||||
to = append(to, *value)
|
||||
}
|
||||
|
||||
return to
|
||||
}
|
||||
|
||||
// MessageEntityUnknownArray is adapter for slice of MessageEntityUnknown.
|
||||
type MessageEntityUnknownArray []MessageEntityUnknown
|
||||
|
||||
@@ -2110,3 +2123,99 @@ func (s *MessageEntityBlockquoteArray) Pop() (v MessageEntityBlockquote, ok bool
|
||||
|
||||
return v, true
|
||||
}
|
||||
|
||||
// MessageEntityFormattedDateArray is adapter for slice of MessageEntityFormattedDate.
|
||||
type MessageEntityFormattedDateArray []MessageEntityFormattedDate
|
||||
|
||||
// Sort sorts slice of MessageEntityFormattedDate.
|
||||
func (s MessageEntityFormattedDateArray) Sort(less func(a, b MessageEntityFormattedDate) bool) MessageEntityFormattedDateArray {
|
||||
sort.Slice(s, func(i, j int) bool {
|
||||
return less(s[i], s[j])
|
||||
})
|
||||
return s
|
||||
}
|
||||
|
||||
// SortStable sorts slice of MessageEntityFormattedDate.
|
||||
func (s MessageEntityFormattedDateArray) SortStable(less func(a, b MessageEntityFormattedDate) bool) MessageEntityFormattedDateArray {
|
||||
sort.SliceStable(s, func(i, j int) bool {
|
||||
return less(s[i], s[j])
|
||||
})
|
||||
return s
|
||||
}
|
||||
|
||||
// Retain filters in-place slice of MessageEntityFormattedDate.
|
||||
func (s MessageEntityFormattedDateArray) Retain(keep func(x MessageEntityFormattedDate) bool) MessageEntityFormattedDateArray {
|
||||
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 MessageEntityFormattedDateArray) First() (v MessageEntityFormattedDate, ok bool) {
|
||||
if len(s) < 1 {
|
||||
return
|
||||
}
|
||||
return s[0], true
|
||||
}
|
||||
|
||||
// Last returns last element of slice (if exists).
|
||||
func (s MessageEntityFormattedDateArray) Last() (v MessageEntityFormattedDate, 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 *MessageEntityFormattedDateArray) PopFirst() (v MessageEntityFormattedDate, 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 MessageEntityFormattedDate
|
||||
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 *MessageEntityFormattedDateArray) Pop() (v MessageEntityFormattedDate, 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
|
||||
}
|
||||
|
||||
// SortByDate sorts slice of MessageEntityFormattedDate by Date.
|
||||
func (s MessageEntityFormattedDateArray) SortByDate() MessageEntityFormattedDateArray {
|
||||
return s.Sort(func(a, b MessageEntityFormattedDate) bool {
|
||||
return a.GetDate() < b.GetDate()
|
||||
})
|
||||
}
|
||||
|
||||
// SortStableByDate sorts slice of MessageEntityFormattedDate by Date.
|
||||
func (s MessageEntityFormattedDateArray) SortStableByDate() MessageEntityFormattedDateArray {
|
||||
return s.SortStable(func(a, b MessageEntityFormattedDate) bool {
|
||||
return a.GetDate() < b.GetDate()
|
||||
})
|
||||
}
|
||||
|
||||
Generated
+161
-65
@@ -240,7 +240,7 @@ func (m *MessageEmpty) GetPeerID() (value PeerClass, ok bool) {
|
||||
return m.PeerID, true
|
||||
}
|
||||
|
||||
// Message represents TL type `message#b92f76cf`.
|
||||
// Message represents TL type `message#3ae56482`.
|
||||
// A message
|
||||
//
|
||||
// See https://core.telegram.org/constructor/message for reference.
|
||||
@@ -341,6 +341,10 @@ type Message struct {
|
||||
//
|
||||
// Use SetFromBoostsApplied and GetFromBoostsApplied helpers.
|
||||
FromBoostsApplied int
|
||||
// FromRank field of Message.
|
||||
//
|
||||
// Use SetFromRank and GetFromRank helpers.
|
||||
FromRank string
|
||||
// Peer ID, the chat where this message was sent
|
||||
PeerID PeerClass
|
||||
// Messages from a saved messages dialog »¹ will have peer=inputPeerSelf² and the
|
||||
@@ -490,10 +494,14 @@ type Message struct {
|
||||
//
|
||||
// Use SetScheduleRepeatPeriod and GetScheduleRepeatPeriod helpers.
|
||||
ScheduleRepeatPeriod int
|
||||
// SummaryFromLanguage field of Message.
|
||||
//
|
||||
// Use SetSummaryFromLanguage and GetSummaryFromLanguage helpers.
|
||||
SummaryFromLanguage string
|
||||
}
|
||||
|
||||
// MessageTypeID is TL type id of Message.
|
||||
const MessageTypeID = 0xb92f76cf
|
||||
const MessageTypeID = 0x3ae56482
|
||||
|
||||
// construct implements constructor of MessageClass.
|
||||
func (m Message) construct() MessageClass { return &m }
|
||||
@@ -572,6 +580,9 @@ func (m *Message) Zero() bool {
|
||||
if !(m.FromBoostsApplied == 0) {
|
||||
return false
|
||||
}
|
||||
if !(m.FromRank == "") {
|
||||
return false
|
||||
}
|
||||
if !(m.PeerID == nil) {
|
||||
return false
|
||||
}
|
||||
@@ -653,6 +664,9 @@ func (m *Message) Zero() bool {
|
||||
if !(m.ScheduleRepeatPeriod == 0) {
|
||||
return false
|
||||
}
|
||||
if !(m.SummaryFromLanguage == "") {
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
@@ -686,6 +700,7 @@ func (m *Message) FillFrom(from interface {
|
||||
GetID() (value int)
|
||||
GetFromID() (value PeerClass, ok bool)
|
||||
GetFromBoostsApplied() (value int, ok bool)
|
||||
GetFromRank() (value string, ok bool)
|
||||
GetPeerID() (value PeerClass)
|
||||
GetSavedPeerID() (value PeerClass, ok bool)
|
||||
GetFwdFrom() (value MessageFwdHeader, ok bool)
|
||||
@@ -713,6 +728,7 @@ func (m *Message) FillFrom(from interface {
|
||||
GetPaidMessageStars() (value int64, ok bool)
|
||||
GetSuggestedPost() (value SuggestedPost, ok bool)
|
||||
GetScheduleRepeatPeriod() (value int, ok bool)
|
||||
GetSummaryFromLanguage() (value string, ok bool)
|
||||
}) {
|
||||
m.Out = from.GetOut()
|
||||
m.Mentioned = from.GetMentioned()
|
||||
@@ -738,6 +754,10 @@ func (m *Message) FillFrom(from interface {
|
||||
m.FromBoostsApplied = val
|
||||
}
|
||||
|
||||
if val, ok := from.GetFromRank(); ok {
|
||||
m.FromRank = val
|
||||
}
|
||||
|
||||
m.PeerID = from.GetPeerID()
|
||||
if val, ok := from.GetSavedPeerID(); ok {
|
||||
m.SavedPeerID = val
|
||||
@@ -837,6 +857,10 @@ func (m *Message) FillFrom(from interface {
|
||||
m.ScheduleRepeatPeriod = val
|
||||
}
|
||||
|
||||
if val, ok := from.GetSummaryFromLanguage(); ok {
|
||||
m.SummaryFromLanguage = val
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// TypeID returns type id in TL schema.
|
||||
@@ -951,6 +975,11 @@ func (m *Message) TypeInfo() tdp.Type {
|
||||
SchemaName: "from_boosts_applied",
|
||||
Null: !m.Flags.Has(29),
|
||||
},
|
||||
{
|
||||
Name: "FromRank",
|
||||
SchemaName: "from_rank",
|
||||
Null: !m.Flags2.Has(12),
|
||||
},
|
||||
{
|
||||
Name: "PeerID",
|
||||
SchemaName: "peer_id",
|
||||
@@ -1083,6 +1112,11 @@ func (m *Message) TypeInfo() tdp.Type {
|
||||
SchemaName: "schedule_repeat_period",
|
||||
Null: !m.Flags2.Has(10),
|
||||
},
|
||||
{
|
||||
Name: "SummaryFromLanguage",
|
||||
SchemaName: "summary_from_language",
|
||||
Null: !m.Flags2.Has(11),
|
||||
},
|
||||
}
|
||||
return typ
|
||||
}
|
||||
@@ -1140,6 +1174,9 @@ func (m *Message) SetFlags() {
|
||||
if !(m.FromBoostsApplied == 0) {
|
||||
m.Flags.Set(29)
|
||||
}
|
||||
if !(m.FromRank == "") {
|
||||
m.Flags2.Set(12)
|
||||
}
|
||||
if !(m.SavedPeerID == nil) {
|
||||
m.Flags.Set(28)
|
||||
}
|
||||
@@ -1212,12 +1249,15 @@ func (m *Message) SetFlags() {
|
||||
if !(m.ScheduleRepeatPeriod == 0) {
|
||||
m.Flags2.Set(10)
|
||||
}
|
||||
if !(m.SummaryFromLanguage == "") {
|
||||
m.Flags2.Set(11)
|
||||
}
|
||||
}
|
||||
|
||||
// Encode implements bin.Encoder.
|
||||
func (m *Message) Encode(b *bin.Buffer) error {
|
||||
if m == nil {
|
||||
return fmt.Errorf("can't encode message#b92f76cf as nil")
|
||||
return fmt.Errorf("can't encode message#3ae56482 as nil")
|
||||
}
|
||||
b.PutID(MessageTypeID)
|
||||
return m.EncodeBare(b)
|
||||
@@ -1226,44 +1266,47 @@ func (m *Message) Encode(b *bin.Buffer) error {
|
||||
// EncodeBare implements bin.BareEncoder.
|
||||
func (m *Message) EncodeBare(b *bin.Buffer) error {
|
||||
if m == nil {
|
||||
return fmt.Errorf("can't encode message#b92f76cf as nil")
|
||||
return fmt.Errorf("can't encode message#3ae56482 as nil")
|
||||
}
|
||||
m.SetFlags()
|
||||
if err := m.Flags.Encode(b); err != nil {
|
||||
return fmt.Errorf("unable to encode message#b92f76cf: field flags: %w", err)
|
||||
return fmt.Errorf("unable to encode message#3ae56482: field flags: %w", err)
|
||||
}
|
||||
if err := m.Flags2.Encode(b); err != nil {
|
||||
return fmt.Errorf("unable to encode message#b92f76cf: field flags2: %w", err)
|
||||
return fmt.Errorf("unable to encode message#3ae56482: field flags2: %w", err)
|
||||
}
|
||||
b.PutInt(m.ID)
|
||||
if m.Flags.Has(8) {
|
||||
if m.FromID == nil {
|
||||
return fmt.Errorf("unable to encode message#b92f76cf: field from_id is nil")
|
||||
return fmt.Errorf("unable to encode message#3ae56482: field from_id is nil")
|
||||
}
|
||||
if err := m.FromID.Encode(b); err != nil {
|
||||
return fmt.Errorf("unable to encode message#b92f76cf: field from_id: %w", err)
|
||||
return fmt.Errorf("unable to encode message#3ae56482: field from_id: %w", err)
|
||||
}
|
||||
}
|
||||
if m.Flags.Has(29) {
|
||||
b.PutInt(m.FromBoostsApplied)
|
||||
}
|
||||
if m.Flags2.Has(12) {
|
||||
b.PutString(m.FromRank)
|
||||
}
|
||||
if m.PeerID == nil {
|
||||
return fmt.Errorf("unable to encode message#b92f76cf: field peer_id is nil")
|
||||
return fmt.Errorf("unable to encode message#3ae56482: field peer_id is nil")
|
||||
}
|
||||
if err := m.PeerID.Encode(b); err != nil {
|
||||
return fmt.Errorf("unable to encode message#b92f76cf: field peer_id: %w", err)
|
||||
return fmt.Errorf("unable to encode message#3ae56482: field peer_id: %w", err)
|
||||
}
|
||||
if m.Flags.Has(28) {
|
||||
if m.SavedPeerID == nil {
|
||||
return fmt.Errorf("unable to encode message#b92f76cf: field saved_peer_id is nil")
|
||||
return fmt.Errorf("unable to encode message#3ae56482: field saved_peer_id is nil")
|
||||
}
|
||||
if err := m.SavedPeerID.Encode(b); err != nil {
|
||||
return fmt.Errorf("unable to encode message#b92f76cf: field saved_peer_id: %w", err)
|
||||
return fmt.Errorf("unable to encode message#3ae56482: field saved_peer_id: %w", err)
|
||||
}
|
||||
}
|
||||
if m.Flags.Has(2) {
|
||||
if err := m.FwdFrom.Encode(b); err != nil {
|
||||
return fmt.Errorf("unable to encode message#b92f76cf: field fwd_from: %w", err)
|
||||
return fmt.Errorf("unable to encode message#3ae56482: field fwd_from: %w", err)
|
||||
}
|
||||
}
|
||||
if m.Flags.Has(11) {
|
||||
@@ -1274,38 +1317,38 @@ func (m *Message) EncodeBare(b *bin.Buffer) error {
|
||||
}
|
||||
if m.Flags.Has(3) {
|
||||
if m.ReplyTo == nil {
|
||||
return fmt.Errorf("unable to encode message#b92f76cf: field reply_to is nil")
|
||||
return fmt.Errorf("unable to encode message#3ae56482: field reply_to is nil")
|
||||
}
|
||||
if err := m.ReplyTo.Encode(b); err != nil {
|
||||
return fmt.Errorf("unable to encode message#b92f76cf: field reply_to: %w", err)
|
||||
return fmt.Errorf("unable to encode message#3ae56482: field reply_to: %w", err)
|
||||
}
|
||||
}
|
||||
b.PutInt(m.Date)
|
||||
b.PutString(m.Message)
|
||||
if m.Flags.Has(9) {
|
||||
if m.Media == nil {
|
||||
return fmt.Errorf("unable to encode message#b92f76cf: field media is nil")
|
||||
return fmt.Errorf("unable to encode message#3ae56482: field media is nil")
|
||||
}
|
||||
if err := m.Media.Encode(b); err != nil {
|
||||
return fmt.Errorf("unable to encode message#b92f76cf: field media: %w", err)
|
||||
return fmt.Errorf("unable to encode message#3ae56482: field media: %w", err)
|
||||
}
|
||||
}
|
||||
if m.Flags.Has(6) {
|
||||
if m.ReplyMarkup == nil {
|
||||
return fmt.Errorf("unable to encode message#b92f76cf: field reply_markup is nil")
|
||||
return fmt.Errorf("unable to encode message#3ae56482: field reply_markup is nil")
|
||||
}
|
||||
if err := m.ReplyMarkup.Encode(b); err != nil {
|
||||
return fmt.Errorf("unable to encode message#b92f76cf: field reply_markup: %w", err)
|
||||
return fmt.Errorf("unable to encode message#3ae56482: field reply_markup: %w", err)
|
||||
}
|
||||
}
|
||||
if m.Flags.Has(7) {
|
||||
b.PutVectorHeader(len(m.Entities))
|
||||
for idx, v := range m.Entities {
|
||||
if v == nil {
|
||||
return fmt.Errorf("unable to encode message#b92f76cf: field entities element with index %d is nil", idx)
|
||||
return fmt.Errorf("unable to encode message#3ae56482: field entities element with index %d is nil", idx)
|
||||
}
|
||||
if err := v.Encode(b); err != nil {
|
||||
return fmt.Errorf("unable to encode message#b92f76cf: field entities element with index %d: %w", idx, err)
|
||||
return fmt.Errorf("unable to encode message#3ae56482: field entities element with index %d: %w", idx, err)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1317,7 +1360,7 @@ func (m *Message) EncodeBare(b *bin.Buffer) error {
|
||||
}
|
||||
if m.Flags.Has(23) {
|
||||
if err := m.Replies.Encode(b); err != nil {
|
||||
return fmt.Errorf("unable to encode message#b92f76cf: field replies: %w", err)
|
||||
return fmt.Errorf("unable to encode message#3ae56482: field replies: %w", err)
|
||||
}
|
||||
}
|
||||
if m.Flags.Has(15) {
|
||||
@@ -1331,14 +1374,14 @@ func (m *Message) EncodeBare(b *bin.Buffer) error {
|
||||
}
|
||||
if m.Flags.Has(20) {
|
||||
if err := m.Reactions.Encode(b); err != nil {
|
||||
return fmt.Errorf("unable to encode message#b92f76cf: field reactions: %w", err)
|
||||
return fmt.Errorf("unable to encode message#3ae56482: field reactions: %w", err)
|
||||
}
|
||||
}
|
||||
if m.Flags.Has(22) {
|
||||
b.PutVectorHeader(len(m.RestrictionReason))
|
||||
for idx, v := range m.RestrictionReason {
|
||||
if err := v.Encode(b); err != nil {
|
||||
return fmt.Errorf("unable to encode message#b92f76cf: field restriction_reason element with index %d: %w", idx, err)
|
||||
return fmt.Errorf("unable to encode message#3ae56482: field restriction_reason element with index %d: %w", idx, err)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1353,7 +1396,7 @@ func (m *Message) EncodeBare(b *bin.Buffer) error {
|
||||
}
|
||||
if m.Flags2.Has(3) {
|
||||
if err := m.Factcheck.Encode(b); err != nil {
|
||||
return fmt.Errorf("unable to encode message#b92f76cf: field factcheck: %w", err)
|
||||
return fmt.Errorf("unable to encode message#3ae56482: field factcheck: %w", err)
|
||||
}
|
||||
}
|
||||
if m.Flags2.Has(5) {
|
||||
@@ -1364,22 +1407,25 @@ func (m *Message) EncodeBare(b *bin.Buffer) error {
|
||||
}
|
||||
if m.Flags2.Has(7) {
|
||||
if err := m.SuggestedPost.Encode(b); err != nil {
|
||||
return fmt.Errorf("unable to encode message#b92f76cf: field suggested_post: %w", err)
|
||||
return fmt.Errorf("unable to encode message#3ae56482: field suggested_post: %w", err)
|
||||
}
|
||||
}
|
||||
if m.Flags2.Has(10) {
|
||||
b.PutInt(m.ScheduleRepeatPeriod)
|
||||
}
|
||||
if m.Flags2.Has(11) {
|
||||
b.PutString(m.SummaryFromLanguage)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Decode implements bin.Decoder.
|
||||
func (m *Message) Decode(b *bin.Buffer) error {
|
||||
if m == nil {
|
||||
return fmt.Errorf("can't decode message#b92f76cf to nil")
|
||||
return fmt.Errorf("can't decode message#3ae56482 to nil")
|
||||
}
|
||||
if err := b.ConsumeID(MessageTypeID); err != nil {
|
||||
return fmt.Errorf("unable to decode message#b92f76cf: %w", err)
|
||||
return fmt.Errorf("unable to decode message#3ae56482: %w", err)
|
||||
}
|
||||
return m.DecodeBare(b)
|
||||
}
|
||||
@@ -1387,11 +1433,11 @@ func (m *Message) Decode(b *bin.Buffer) error {
|
||||
// DecodeBare implements bin.BareDecoder.
|
||||
func (m *Message) DecodeBare(b *bin.Buffer) error {
|
||||
if m == nil {
|
||||
return fmt.Errorf("can't decode message#b92f76cf to nil")
|
||||
return fmt.Errorf("can't decode message#3ae56482 to nil")
|
||||
}
|
||||
{
|
||||
if err := m.Flags.Decode(b); err != nil {
|
||||
return fmt.Errorf("unable to decode message#b92f76cf: field flags: %w", err)
|
||||
return fmt.Errorf("unable to decode message#3ae56482: field flags: %w", err)
|
||||
}
|
||||
}
|
||||
m.Out = m.Flags.Has(1)
|
||||
@@ -1407,7 +1453,7 @@ func (m *Message) DecodeBare(b *bin.Buffer) error {
|
||||
m.InvertMedia = m.Flags.Has(27)
|
||||
{
|
||||
if err := m.Flags2.Decode(b); err != nil {
|
||||
return fmt.Errorf("unable to decode message#b92f76cf: field flags2: %w", err)
|
||||
return fmt.Errorf("unable to decode message#3ae56482: field flags2: %w", err)
|
||||
}
|
||||
}
|
||||
m.Offline = m.Flags2.Has(1)
|
||||
@@ -1417,96 +1463,103 @@ func (m *Message) DecodeBare(b *bin.Buffer) error {
|
||||
{
|
||||
value, err := b.Int()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode message#b92f76cf: field id: %w", err)
|
||||
return fmt.Errorf("unable to decode message#3ae56482: field id: %w", err)
|
||||
}
|
||||
m.ID = value
|
||||
}
|
||||
if m.Flags.Has(8) {
|
||||
value, err := DecodePeer(b)
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode message#b92f76cf: field from_id: %w", err)
|
||||
return fmt.Errorf("unable to decode message#3ae56482: field from_id: %w", err)
|
||||
}
|
||||
m.FromID = value
|
||||
}
|
||||
if m.Flags.Has(29) {
|
||||
value, err := b.Int()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode message#b92f76cf: field from_boosts_applied: %w", err)
|
||||
return fmt.Errorf("unable to decode message#3ae56482: field from_boosts_applied: %w", err)
|
||||
}
|
||||
m.FromBoostsApplied = value
|
||||
}
|
||||
if m.Flags2.Has(12) {
|
||||
value, err := b.String()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode message#3ae56482: field from_rank: %w", err)
|
||||
}
|
||||
m.FromRank = value
|
||||
}
|
||||
{
|
||||
value, err := DecodePeer(b)
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode message#b92f76cf: field peer_id: %w", err)
|
||||
return fmt.Errorf("unable to decode message#3ae56482: field peer_id: %w", err)
|
||||
}
|
||||
m.PeerID = value
|
||||
}
|
||||
if m.Flags.Has(28) {
|
||||
value, err := DecodePeer(b)
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode message#b92f76cf: field saved_peer_id: %w", err)
|
||||
return fmt.Errorf("unable to decode message#3ae56482: field saved_peer_id: %w", err)
|
||||
}
|
||||
m.SavedPeerID = value
|
||||
}
|
||||
if m.Flags.Has(2) {
|
||||
if err := m.FwdFrom.Decode(b); err != nil {
|
||||
return fmt.Errorf("unable to decode message#b92f76cf: field fwd_from: %w", err)
|
||||
return fmt.Errorf("unable to decode message#3ae56482: field fwd_from: %w", err)
|
||||
}
|
||||
}
|
||||
if m.Flags.Has(11) {
|
||||
value, err := b.Long()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode message#b92f76cf: field via_bot_id: %w", err)
|
||||
return fmt.Errorf("unable to decode message#3ae56482: field via_bot_id: %w", err)
|
||||
}
|
||||
m.ViaBotID = value
|
||||
}
|
||||
if m.Flags2.Has(0) {
|
||||
value, err := b.Long()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode message#b92f76cf: field via_business_bot_id: %w", err)
|
||||
return fmt.Errorf("unable to decode message#3ae56482: field via_business_bot_id: %w", err)
|
||||
}
|
||||
m.ViaBusinessBotID = value
|
||||
}
|
||||
if m.Flags.Has(3) {
|
||||
value, err := DecodeMessageReplyHeader(b)
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode message#b92f76cf: field reply_to: %w", err)
|
||||
return fmt.Errorf("unable to decode message#3ae56482: field reply_to: %w", err)
|
||||
}
|
||||
m.ReplyTo = value
|
||||
}
|
||||
{
|
||||
value, err := b.Int()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode message#b92f76cf: field date: %w", err)
|
||||
return fmt.Errorf("unable to decode message#3ae56482: field date: %w", err)
|
||||
}
|
||||
m.Date = value
|
||||
}
|
||||
{
|
||||
value, err := b.String()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode message#b92f76cf: field message: %w", err)
|
||||
return fmt.Errorf("unable to decode message#3ae56482: field message: %w", err)
|
||||
}
|
||||
m.Message = value
|
||||
}
|
||||
if m.Flags.Has(9) {
|
||||
value, err := DecodeMessageMedia(b)
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode message#b92f76cf: field media: %w", err)
|
||||
return fmt.Errorf("unable to decode message#3ae56482: field media: %w", err)
|
||||
}
|
||||
m.Media = value
|
||||
}
|
||||
if m.Flags.Has(6) {
|
||||
value, err := DecodeReplyMarkup(b)
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode message#b92f76cf: field reply_markup: %w", err)
|
||||
return fmt.Errorf("unable to decode message#3ae56482: field reply_markup: %w", err)
|
||||
}
|
||||
m.ReplyMarkup = value
|
||||
}
|
||||
if m.Flags.Has(7) {
|
||||
headerLen, err := b.VectorHeader()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode message#b92f76cf: field entities: %w", err)
|
||||
return fmt.Errorf("unable to decode message#3ae56482: field entities: %w", err)
|
||||
}
|
||||
|
||||
if headerLen > 0 {
|
||||
@@ -1515,7 +1568,7 @@ func (m *Message) DecodeBare(b *bin.Buffer) error {
|
||||
for idx := 0; idx < headerLen; idx++ {
|
||||
value, err := DecodeMessageEntity(b)
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode message#b92f76cf: field entities: %w", err)
|
||||
return fmt.Errorf("unable to decode message#3ae56482: field entities: %w", err)
|
||||
}
|
||||
m.Entities = append(m.Entities, value)
|
||||
}
|
||||
@@ -1523,52 +1576,52 @@ func (m *Message) DecodeBare(b *bin.Buffer) error {
|
||||
if m.Flags.Has(10) {
|
||||
value, err := b.Int()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode message#b92f76cf: field views: %w", err)
|
||||
return fmt.Errorf("unable to decode message#3ae56482: field views: %w", err)
|
||||
}
|
||||
m.Views = value
|
||||
}
|
||||
if m.Flags.Has(10) {
|
||||
value, err := b.Int()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode message#b92f76cf: field forwards: %w", err)
|
||||
return fmt.Errorf("unable to decode message#3ae56482: field forwards: %w", err)
|
||||
}
|
||||
m.Forwards = value
|
||||
}
|
||||
if m.Flags.Has(23) {
|
||||
if err := m.Replies.Decode(b); err != nil {
|
||||
return fmt.Errorf("unable to decode message#b92f76cf: field replies: %w", err)
|
||||
return fmt.Errorf("unable to decode message#3ae56482: field replies: %w", err)
|
||||
}
|
||||
}
|
||||
if m.Flags.Has(15) {
|
||||
value, err := b.Int()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode message#b92f76cf: field edit_date: %w", err)
|
||||
return fmt.Errorf("unable to decode message#3ae56482: field edit_date: %w", err)
|
||||
}
|
||||
m.EditDate = value
|
||||
}
|
||||
if m.Flags.Has(16) {
|
||||
value, err := b.String()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode message#b92f76cf: field post_author: %w", err)
|
||||
return fmt.Errorf("unable to decode message#3ae56482: field post_author: %w", err)
|
||||
}
|
||||
m.PostAuthor = value
|
||||
}
|
||||
if m.Flags.Has(17) {
|
||||
value, err := b.Long()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode message#b92f76cf: field grouped_id: %w", err)
|
||||
return fmt.Errorf("unable to decode message#3ae56482: field grouped_id: %w", err)
|
||||
}
|
||||
m.GroupedID = value
|
||||
}
|
||||
if m.Flags.Has(20) {
|
||||
if err := m.Reactions.Decode(b); err != nil {
|
||||
return fmt.Errorf("unable to decode message#b92f76cf: field reactions: %w", err)
|
||||
return fmt.Errorf("unable to decode message#3ae56482: field reactions: %w", err)
|
||||
}
|
||||
}
|
||||
if m.Flags.Has(22) {
|
||||
headerLen, err := b.VectorHeader()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode message#b92f76cf: field restriction_reason: %w", err)
|
||||
return fmt.Errorf("unable to decode message#3ae56482: field restriction_reason: %w", err)
|
||||
}
|
||||
|
||||
if headerLen > 0 {
|
||||
@@ -1577,7 +1630,7 @@ func (m *Message) DecodeBare(b *bin.Buffer) error {
|
||||
for idx := 0; idx < headerLen; idx++ {
|
||||
var value RestrictionReason
|
||||
if err := value.Decode(b); err != nil {
|
||||
return fmt.Errorf("unable to decode message#b92f76cf: field restriction_reason: %w", err)
|
||||
return fmt.Errorf("unable to decode message#3ae56482: field restriction_reason: %w", err)
|
||||
}
|
||||
m.RestrictionReason = append(m.RestrictionReason, value)
|
||||
}
|
||||
@@ -1585,55 +1638,62 @@ func (m *Message) DecodeBare(b *bin.Buffer) error {
|
||||
if m.Flags.Has(25) {
|
||||
value, err := b.Int()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode message#b92f76cf: field ttl_period: %w", err)
|
||||
return fmt.Errorf("unable to decode message#3ae56482: field ttl_period: %w", err)
|
||||
}
|
||||
m.TTLPeriod = value
|
||||
}
|
||||
if m.Flags.Has(30) {
|
||||
value, err := b.Int()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode message#b92f76cf: field quick_reply_shortcut_id: %w", err)
|
||||
return fmt.Errorf("unable to decode message#3ae56482: field quick_reply_shortcut_id: %w", err)
|
||||
}
|
||||
m.QuickReplyShortcutID = value
|
||||
}
|
||||
if m.Flags2.Has(2) {
|
||||
value, err := b.Long()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode message#b92f76cf: field effect: %w", err)
|
||||
return fmt.Errorf("unable to decode message#3ae56482: field effect: %w", err)
|
||||
}
|
||||
m.Effect = value
|
||||
}
|
||||
if m.Flags2.Has(3) {
|
||||
if err := m.Factcheck.Decode(b); err != nil {
|
||||
return fmt.Errorf("unable to decode message#b92f76cf: field factcheck: %w", err)
|
||||
return fmt.Errorf("unable to decode message#3ae56482: field factcheck: %w", err)
|
||||
}
|
||||
}
|
||||
if m.Flags2.Has(5) {
|
||||
value, err := b.Int()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode message#b92f76cf: field report_delivery_until_date: %w", err)
|
||||
return fmt.Errorf("unable to decode message#3ae56482: field report_delivery_until_date: %w", err)
|
||||
}
|
||||
m.ReportDeliveryUntilDate = value
|
||||
}
|
||||
if m.Flags2.Has(6) {
|
||||
value, err := b.Long()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode message#b92f76cf: field paid_message_stars: %w", err)
|
||||
return fmt.Errorf("unable to decode message#3ae56482: field paid_message_stars: %w", err)
|
||||
}
|
||||
m.PaidMessageStars = value
|
||||
}
|
||||
if m.Flags2.Has(7) {
|
||||
if err := m.SuggestedPost.Decode(b); err != nil {
|
||||
return fmt.Errorf("unable to decode message#b92f76cf: field suggested_post: %w", err)
|
||||
return fmt.Errorf("unable to decode message#3ae56482: field suggested_post: %w", err)
|
||||
}
|
||||
}
|
||||
if m.Flags2.Has(10) {
|
||||
value, err := b.Int()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode message#b92f76cf: field schedule_repeat_period: %w", err)
|
||||
return fmt.Errorf("unable to decode message#3ae56482: field schedule_repeat_period: %w", err)
|
||||
}
|
||||
m.ScheduleRepeatPeriod = value
|
||||
}
|
||||
if m.Flags2.Has(11) {
|
||||
value, err := b.String()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode message#3ae56482: field summary_from_language: %w", err)
|
||||
}
|
||||
m.SummaryFromLanguage = value
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -1966,6 +2026,24 @@ func (m *Message) GetFromBoostsApplied() (value int, ok bool) {
|
||||
return m.FromBoostsApplied, true
|
||||
}
|
||||
|
||||
// SetFromRank sets value of FromRank conditional field.
|
||||
func (m *Message) SetFromRank(value string) {
|
||||
m.Flags2.Set(12)
|
||||
m.FromRank = value
|
||||
}
|
||||
|
||||
// GetFromRank returns value of FromRank conditional field and
|
||||
// boolean which is true if field was set.
|
||||
func (m *Message) GetFromRank() (value string, ok bool) {
|
||||
if m == nil {
|
||||
return
|
||||
}
|
||||
if !m.Flags2.Has(12) {
|
||||
return value, false
|
||||
}
|
||||
return m.FromRank, true
|
||||
}
|
||||
|
||||
// GetPeerID returns value of PeerID field.
|
||||
func (m *Message) GetPeerID() (value PeerClass) {
|
||||
if m == nil {
|
||||
@@ -2422,6 +2500,24 @@ func (m *Message) GetScheduleRepeatPeriod() (value int, ok bool) {
|
||||
return m.ScheduleRepeatPeriod, true
|
||||
}
|
||||
|
||||
// SetSummaryFromLanguage sets value of SummaryFromLanguage conditional field.
|
||||
func (m *Message) SetSummaryFromLanguage(value string) {
|
||||
m.Flags2.Set(11)
|
||||
m.SummaryFromLanguage = value
|
||||
}
|
||||
|
||||
// GetSummaryFromLanguage returns value of SummaryFromLanguage conditional field and
|
||||
// boolean which is true if field was set.
|
||||
func (m *Message) GetSummaryFromLanguage() (value string, ok bool) {
|
||||
if m == nil {
|
||||
return
|
||||
}
|
||||
if !m.Flags2.Has(11) {
|
||||
return value, false
|
||||
}
|
||||
return m.SummaryFromLanguage, true
|
||||
}
|
||||
|
||||
// MapEntities returns field Entities wrapped in MessageEntityClassArray helper.
|
||||
func (m *Message) MapEntities() (value MessageEntityClassArray, ok bool) {
|
||||
if !m.Flags.Has(7) {
|
||||
@@ -3204,7 +3300,7 @@ const MessageClassName = "Message"
|
||||
// }
|
||||
// switch v := g.(type) {
|
||||
// case *tg.MessageEmpty: // messageEmpty#90a6ca84
|
||||
// case *tg.Message: // message#b92f76cf
|
||||
// case *tg.Message: // message#3ae56482
|
||||
// case *tg.MessageService: // messageService#7a800e0a
|
||||
// default: panic(v)
|
||||
// }
|
||||
@@ -3363,7 +3459,7 @@ func DecodeMessage(buf *bin.Buffer) (MessageClass, error) {
|
||||
}
|
||||
return &v, nil
|
||||
case MessageTypeID:
|
||||
// Decoding message#b92f76cf.
|
||||
// Decoding message#3ae56482.
|
||||
v := Message{}
|
||||
if err := v.Decode(buf); err != nil {
|
||||
return nil, fmt.Errorf("unable to decode MessageClass: %w", err)
|
||||
|
||||
Generated
+77
-11
@@ -3143,7 +3143,7 @@ func (m *MessageMediaPoll) GetResults() (value PollResults) {
|
||||
return m.Results
|
||||
}
|
||||
|
||||
// MessageMediaDice represents TL type `messageMediaDice#3f7ee58b`.
|
||||
// MessageMediaDice represents TL type `messageMediaDice#8cbec07`.
|
||||
// Dice-based animated sticker¹
|
||||
//
|
||||
// Links:
|
||||
@@ -3151,6 +3151,8 @@ func (m *MessageMediaPoll) GetResults() (value PollResults) {
|
||||
//
|
||||
// See https://core.telegram.org/constructor/messageMediaDice for reference.
|
||||
type MessageMediaDice struct {
|
||||
// Flags field of MessageMediaDice.
|
||||
Flags bin.Fields
|
||||
// Dice value¹
|
||||
//
|
||||
// Links:
|
||||
@@ -3158,10 +3160,14 @@ type MessageMediaDice struct {
|
||||
Value int
|
||||
// The emoji, for now , and are supported
|
||||
Emoticon string
|
||||
// GameOutcome field of MessageMediaDice.
|
||||
//
|
||||
// Use SetGameOutcome and GetGameOutcome helpers.
|
||||
GameOutcome MessagesEmojiGameOutcome
|
||||
}
|
||||
|
||||
// MessageMediaDiceTypeID is TL type id of MessageMediaDice.
|
||||
const MessageMediaDiceTypeID = 0x3f7ee58b
|
||||
const MessageMediaDiceTypeID = 0x8cbec07
|
||||
|
||||
// construct implements constructor of MessageMediaClass.
|
||||
func (m MessageMediaDice) construct() MessageMediaClass { return &m }
|
||||
@@ -3180,12 +3186,18 @@ func (m *MessageMediaDice) Zero() bool {
|
||||
if m == nil {
|
||||
return true
|
||||
}
|
||||
if !(m.Flags.Zero()) {
|
||||
return false
|
||||
}
|
||||
if !(m.Value == 0) {
|
||||
return false
|
||||
}
|
||||
if !(m.Emoticon == "") {
|
||||
return false
|
||||
}
|
||||
if !(m.GameOutcome.Zero()) {
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
@@ -3203,9 +3215,14 @@ func (m *MessageMediaDice) String() string {
|
||||
func (m *MessageMediaDice) FillFrom(from interface {
|
||||
GetValue() (value int)
|
||||
GetEmoticon() (value string)
|
||||
GetGameOutcome() (value MessagesEmojiGameOutcome, ok bool)
|
||||
}) {
|
||||
m.Value = from.GetValue()
|
||||
m.Emoticon = from.GetEmoticon()
|
||||
if val, ok := from.GetGameOutcome(); ok {
|
||||
m.GameOutcome = val
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// TypeID returns type id in TL schema.
|
||||
@@ -3239,14 +3256,26 @@ func (m *MessageMediaDice) TypeInfo() tdp.Type {
|
||||
Name: "Emoticon",
|
||||
SchemaName: "emoticon",
|
||||
},
|
||||
{
|
||||
Name: "GameOutcome",
|
||||
SchemaName: "game_outcome",
|
||||
Null: !m.Flags.Has(0),
|
||||
},
|
||||
}
|
||||
return typ
|
||||
}
|
||||
|
||||
// SetFlags sets flags for non-zero fields.
|
||||
func (m *MessageMediaDice) SetFlags() {
|
||||
if !(m.GameOutcome.Zero()) {
|
||||
m.Flags.Set(0)
|
||||
}
|
||||
}
|
||||
|
||||
// Encode implements bin.Encoder.
|
||||
func (m *MessageMediaDice) Encode(b *bin.Buffer) error {
|
||||
if m == nil {
|
||||
return fmt.Errorf("can't encode messageMediaDice#3f7ee58b as nil")
|
||||
return fmt.Errorf("can't encode messageMediaDice#8cbec07 as nil")
|
||||
}
|
||||
b.PutID(MessageMediaDiceTypeID)
|
||||
return m.EncodeBare(b)
|
||||
@@ -3255,20 +3284,29 @@ func (m *MessageMediaDice) Encode(b *bin.Buffer) error {
|
||||
// EncodeBare implements bin.BareEncoder.
|
||||
func (m *MessageMediaDice) EncodeBare(b *bin.Buffer) error {
|
||||
if m == nil {
|
||||
return fmt.Errorf("can't encode messageMediaDice#3f7ee58b as nil")
|
||||
return fmt.Errorf("can't encode messageMediaDice#8cbec07 as nil")
|
||||
}
|
||||
m.SetFlags()
|
||||
if err := m.Flags.Encode(b); err != nil {
|
||||
return fmt.Errorf("unable to encode messageMediaDice#8cbec07: field flags: %w", err)
|
||||
}
|
||||
b.PutInt(m.Value)
|
||||
b.PutString(m.Emoticon)
|
||||
if m.Flags.Has(0) {
|
||||
if err := m.GameOutcome.Encode(b); err != nil {
|
||||
return fmt.Errorf("unable to encode messageMediaDice#8cbec07: field game_outcome: %w", err)
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Decode implements bin.Decoder.
|
||||
func (m *MessageMediaDice) Decode(b *bin.Buffer) error {
|
||||
if m == nil {
|
||||
return fmt.Errorf("can't decode messageMediaDice#3f7ee58b to nil")
|
||||
return fmt.Errorf("can't decode messageMediaDice#8cbec07 to nil")
|
||||
}
|
||||
if err := b.ConsumeID(MessageMediaDiceTypeID); err != nil {
|
||||
return fmt.Errorf("unable to decode messageMediaDice#3f7ee58b: %w", err)
|
||||
return fmt.Errorf("unable to decode messageMediaDice#8cbec07: %w", err)
|
||||
}
|
||||
return m.DecodeBare(b)
|
||||
}
|
||||
@@ -3276,22 +3314,32 @@ func (m *MessageMediaDice) Decode(b *bin.Buffer) error {
|
||||
// DecodeBare implements bin.BareDecoder.
|
||||
func (m *MessageMediaDice) DecodeBare(b *bin.Buffer) error {
|
||||
if m == nil {
|
||||
return fmt.Errorf("can't decode messageMediaDice#3f7ee58b to nil")
|
||||
return fmt.Errorf("can't decode messageMediaDice#8cbec07 to nil")
|
||||
}
|
||||
{
|
||||
if err := m.Flags.Decode(b); err != nil {
|
||||
return fmt.Errorf("unable to decode messageMediaDice#8cbec07: field flags: %w", err)
|
||||
}
|
||||
}
|
||||
{
|
||||
value, err := b.Int()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode messageMediaDice#3f7ee58b: field value: %w", err)
|
||||
return fmt.Errorf("unable to decode messageMediaDice#8cbec07: field value: %w", err)
|
||||
}
|
||||
m.Value = value
|
||||
}
|
||||
{
|
||||
value, err := b.String()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode messageMediaDice#3f7ee58b: field emoticon: %w", err)
|
||||
return fmt.Errorf("unable to decode messageMediaDice#8cbec07: field emoticon: %w", err)
|
||||
}
|
||||
m.Emoticon = value
|
||||
}
|
||||
if m.Flags.Has(0) {
|
||||
if err := m.GameOutcome.Decode(b); err != nil {
|
||||
return fmt.Errorf("unable to decode messageMediaDice#8cbec07: field game_outcome: %w", err)
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -3311,6 +3359,24 @@ func (m *MessageMediaDice) GetEmoticon() (value string) {
|
||||
return m.Emoticon
|
||||
}
|
||||
|
||||
// SetGameOutcome sets value of GameOutcome conditional field.
|
||||
func (m *MessageMediaDice) SetGameOutcome(value MessagesEmojiGameOutcome) {
|
||||
m.Flags.Set(0)
|
||||
m.GameOutcome = value
|
||||
}
|
||||
|
||||
// GetGameOutcome returns value of GameOutcome conditional field and
|
||||
// boolean which is true if field was set.
|
||||
func (m *MessageMediaDice) GetGameOutcome() (value MessagesEmojiGameOutcome, ok bool) {
|
||||
if m == nil {
|
||||
return
|
||||
}
|
||||
if !m.Flags.Has(0) {
|
||||
return value, false
|
||||
}
|
||||
return m.GameOutcome, true
|
||||
}
|
||||
|
||||
// MessageMediaStory represents TL type `messageMediaStory#68cb6283`.
|
||||
// Represents a forwarded story¹ or a story mention.
|
||||
//
|
||||
@@ -5331,7 +5397,7 @@ const MessageMediaClassName = "MessageMedia"
|
||||
// case *tg.MessageMediaInvoice: // messageMediaInvoice#f6a548d3
|
||||
// case *tg.MessageMediaGeoLive: // messageMediaGeoLive#b940c666
|
||||
// case *tg.MessageMediaPoll: // messageMediaPoll#4bd6e798
|
||||
// case *tg.MessageMediaDice: // messageMediaDice#3f7ee58b
|
||||
// case *tg.MessageMediaDice: // messageMediaDice#8cbec07
|
||||
// case *tg.MessageMediaStory: // messageMediaStory#68cb6283
|
||||
// case *tg.MessageMediaGiveaway: // messageMediaGiveaway#aa073beb
|
||||
// case *tg.MessageMediaGiveawayResults: // messageMediaGiveawayResults#ceaa3ea1
|
||||
@@ -5451,7 +5517,7 @@ func DecodeMessageMedia(buf *bin.Buffer) (MessageMediaClass, error) {
|
||||
}
|
||||
return &v, nil
|
||||
case MessageMediaDiceTypeID:
|
||||
// Decoding messageMediaDice#3f7ee58b.
|
||||
// Decoding messageMediaDice#8cbec07.
|
||||
v := MessageMediaDice{}
|
||||
if err := v.Decode(buf); err != nil {
|
||||
return nil, fmt.Errorf("unable to decode MessageMediaClass: %w", err)
|
||||
|
||||
+99
-16
@@ -31,7 +31,7 @@ var (
|
||||
_ = tdjson.Encoder{}
|
||||
)
|
||||
|
||||
// MessagesAcceptURLAuthRequest represents TL type `messages.acceptUrlAuth#b12c7125`.
|
||||
// MessagesAcceptURLAuthRequest represents TL type `messages.acceptUrlAuth#67a3f0de`.
|
||||
// Use this to accept a Seamless Telegram Login authorization request, for more info
|
||||
// click here »¹
|
||||
//
|
||||
@@ -47,6 +47,8 @@ type MessagesAcceptURLAuthRequest struct {
|
||||
Flags bin.Fields
|
||||
// Set this flag to allow the bot to send messages to you (if requested)
|
||||
WriteAllowed bool
|
||||
// SharePhoneNumber field of MessagesAcceptURLAuthRequest.
|
||||
SharePhoneNumber bool
|
||||
// The location of the message
|
||||
//
|
||||
// Use SetPeer and GetPeer helpers.
|
||||
@@ -66,10 +68,14 @@ type MessagesAcceptURLAuthRequest struct {
|
||||
//
|
||||
// Use SetURL and GetURL helpers.
|
||||
URL string
|
||||
// MatchCode field of MessagesAcceptURLAuthRequest.
|
||||
//
|
||||
// Use SetMatchCode and GetMatchCode helpers.
|
||||
MatchCode string
|
||||
}
|
||||
|
||||
// MessagesAcceptURLAuthRequestTypeID is TL type id of MessagesAcceptURLAuthRequest.
|
||||
const MessagesAcceptURLAuthRequestTypeID = 0xb12c7125
|
||||
const MessagesAcceptURLAuthRequestTypeID = 0x67a3f0de
|
||||
|
||||
// Ensuring interfaces in compile-time for MessagesAcceptURLAuthRequest.
|
||||
var (
|
||||
@@ -89,6 +95,9 @@ func (a *MessagesAcceptURLAuthRequest) Zero() bool {
|
||||
if !(a.WriteAllowed == false) {
|
||||
return false
|
||||
}
|
||||
if !(a.SharePhoneNumber == false) {
|
||||
return false
|
||||
}
|
||||
if !(a.Peer == nil) {
|
||||
return false
|
||||
}
|
||||
@@ -101,6 +110,9 @@ func (a *MessagesAcceptURLAuthRequest) Zero() bool {
|
||||
if !(a.URL == "") {
|
||||
return false
|
||||
}
|
||||
if !(a.MatchCode == "") {
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
@@ -117,12 +129,15 @@ func (a *MessagesAcceptURLAuthRequest) String() string {
|
||||
// FillFrom fills MessagesAcceptURLAuthRequest from given interface.
|
||||
func (a *MessagesAcceptURLAuthRequest) FillFrom(from interface {
|
||||
GetWriteAllowed() (value bool)
|
||||
GetSharePhoneNumber() (value bool)
|
||||
GetPeer() (value InputPeerClass, ok bool)
|
||||
GetMsgID() (value int, ok bool)
|
||||
GetButtonID() (value int, ok bool)
|
||||
GetURL() (value string, ok bool)
|
||||
GetMatchCode() (value string, ok bool)
|
||||
}) {
|
||||
a.WriteAllowed = from.GetWriteAllowed()
|
||||
a.SharePhoneNumber = from.GetSharePhoneNumber()
|
||||
if val, ok := from.GetPeer(); ok {
|
||||
a.Peer = val
|
||||
}
|
||||
@@ -139,6 +154,10 @@ func (a *MessagesAcceptURLAuthRequest) FillFrom(from interface {
|
||||
a.URL = val
|
||||
}
|
||||
|
||||
if val, ok := from.GetMatchCode(); ok {
|
||||
a.MatchCode = val
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// TypeID returns type id in TL schema.
|
||||
@@ -169,6 +188,11 @@ func (a *MessagesAcceptURLAuthRequest) TypeInfo() tdp.Type {
|
||||
SchemaName: "write_allowed",
|
||||
Null: !a.Flags.Has(0),
|
||||
},
|
||||
{
|
||||
Name: "SharePhoneNumber",
|
||||
SchemaName: "share_phone_number",
|
||||
Null: !a.Flags.Has(3),
|
||||
},
|
||||
{
|
||||
Name: "Peer",
|
||||
SchemaName: "peer",
|
||||
@@ -189,6 +213,11 @@ func (a *MessagesAcceptURLAuthRequest) TypeInfo() tdp.Type {
|
||||
SchemaName: "url",
|
||||
Null: !a.Flags.Has(2),
|
||||
},
|
||||
{
|
||||
Name: "MatchCode",
|
||||
SchemaName: "match_code",
|
||||
Null: !a.Flags.Has(4),
|
||||
},
|
||||
}
|
||||
return typ
|
||||
}
|
||||
@@ -198,6 +227,9 @@ func (a *MessagesAcceptURLAuthRequest) SetFlags() {
|
||||
if !(a.WriteAllowed == false) {
|
||||
a.Flags.Set(0)
|
||||
}
|
||||
if !(a.SharePhoneNumber == false) {
|
||||
a.Flags.Set(3)
|
||||
}
|
||||
if !(a.Peer == nil) {
|
||||
a.Flags.Set(1)
|
||||
}
|
||||
@@ -210,12 +242,15 @@ func (a *MessagesAcceptURLAuthRequest) SetFlags() {
|
||||
if !(a.URL == "") {
|
||||
a.Flags.Set(2)
|
||||
}
|
||||
if !(a.MatchCode == "") {
|
||||
a.Flags.Set(4)
|
||||
}
|
||||
}
|
||||
|
||||
// Encode implements bin.Encoder.
|
||||
func (a *MessagesAcceptURLAuthRequest) Encode(b *bin.Buffer) error {
|
||||
if a == nil {
|
||||
return fmt.Errorf("can't encode messages.acceptUrlAuth#b12c7125 as nil")
|
||||
return fmt.Errorf("can't encode messages.acceptUrlAuth#67a3f0de as nil")
|
||||
}
|
||||
b.PutID(MessagesAcceptURLAuthRequestTypeID)
|
||||
return a.EncodeBare(b)
|
||||
@@ -224,18 +259,18 @@ func (a *MessagesAcceptURLAuthRequest) Encode(b *bin.Buffer) error {
|
||||
// EncodeBare implements bin.BareEncoder.
|
||||
func (a *MessagesAcceptURLAuthRequest) EncodeBare(b *bin.Buffer) error {
|
||||
if a == nil {
|
||||
return fmt.Errorf("can't encode messages.acceptUrlAuth#b12c7125 as nil")
|
||||
return fmt.Errorf("can't encode messages.acceptUrlAuth#67a3f0de as nil")
|
||||
}
|
||||
a.SetFlags()
|
||||
if err := a.Flags.Encode(b); err != nil {
|
||||
return fmt.Errorf("unable to encode messages.acceptUrlAuth#b12c7125: field flags: %w", err)
|
||||
return fmt.Errorf("unable to encode messages.acceptUrlAuth#67a3f0de: field flags: %w", err)
|
||||
}
|
||||
if a.Flags.Has(1) {
|
||||
if a.Peer == nil {
|
||||
return fmt.Errorf("unable to encode messages.acceptUrlAuth#b12c7125: field peer is nil")
|
||||
return fmt.Errorf("unable to encode messages.acceptUrlAuth#67a3f0de: field peer is nil")
|
||||
}
|
||||
if err := a.Peer.Encode(b); err != nil {
|
||||
return fmt.Errorf("unable to encode messages.acceptUrlAuth#b12c7125: field peer: %w", err)
|
||||
return fmt.Errorf("unable to encode messages.acceptUrlAuth#67a3f0de: field peer: %w", err)
|
||||
}
|
||||
}
|
||||
if a.Flags.Has(1) {
|
||||
@@ -247,16 +282,19 @@ func (a *MessagesAcceptURLAuthRequest) EncodeBare(b *bin.Buffer) error {
|
||||
if a.Flags.Has(2) {
|
||||
b.PutString(a.URL)
|
||||
}
|
||||
if a.Flags.Has(4) {
|
||||
b.PutString(a.MatchCode)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Decode implements bin.Decoder.
|
||||
func (a *MessagesAcceptURLAuthRequest) Decode(b *bin.Buffer) error {
|
||||
if a == nil {
|
||||
return fmt.Errorf("can't decode messages.acceptUrlAuth#b12c7125 to nil")
|
||||
return fmt.Errorf("can't decode messages.acceptUrlAuth#67a3f0de to nil")
|
||||
}
|
||||
if err := b.ConsumeID(MessagesAcceptURLAuthRequestTypeID); err != nil {
|
||||
return fmt.Errorf("unable to decode messages.acceptUrlAuth#b12c7125: %w", err)
|
||||
return fmt.Errorf("unable to decode messages.acceptUrlAuth#67a3f0de: %w", err)
|
||||
}
|
||||
return a.DecodeBare(b)
|
||||
}
|
||||
@@ -264,42 +302,50 @@ func (a *MessagesAcceptURLAuthRequest) Decode(b *bin.Buffer) error {
|
||||
// DecodeBare implements bin.BareDecoder.
|
||||
func (a *MessagesAcceptURLAuthRequest) DecodeBare(b *bin.Buffer) error {
|
||||
if a == nil {
|
||||
return fmt.Errorf("can't decode messages.acceptUrlAuth#b12c7125 to nil")
|
||||
return fmt.Errorf("can't decode messages.acceptUrlAuth#67a3f0de to nil")
|
||||
}
|
||||
{
|
||||
if err := a.Flags.Decode(b); err != nil {
|
||||
return fmt.Errorf("unable to decode messages.acceptUrlAuth#b12c7125: field flags: %w", err)
|
||||
return fmt.Errorf("unable to decode messages.acceptUrlAuth#67a3f0de: field flags: %w", err)
|
||||
}
|
||||
}
|
||||
a.WriteAllowed = a.Flags.Has(0)
|
||||
a.SharePhoneNumber = a.Flags.Has(3)
|
||||
if a.Flags.Has(1) {
|
||||
value, err := DecodeInputPeer(b)
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode messages.acceptUrlAuth#b12c7125: field peer: %w", err)
|
||||
return fmt.Errorf("unable to decode messages.acceptUrlAuth#67a3f0de: field peer: %w", err)
|
||||
}
|
||||
a.Peer = value
|
||||
}
|
||||
if a.Flags.Has(1) {
|
||||
value, err := b.Int()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode messages.acceptUrlAuth#b12c7125: field msg_id: %w", err)
|
||||
return fmt.Errorf("unable to decode messages.acceptUrlAuth#67a3f0de: field msg_id: %w", err)
|
||||
}
|
||||
a.MsgID = value
|
||||
}
|
||||
if a.Flags.Has(1) {
|
||||
value, err := b.Int()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode messages.acceptUrlAuth#b12c7125: field button_id: %w", err)
|
||||
return fmt.Errorf("unable to decode messages.acceptUrlAuth#67a3f0de: field button_id: %w", err)
|
||||
}
|
||||
a.ButtonID = value
|
||||
}
|
||||
if a.Flags.Has(2) {
|
||||
value, err := b.String()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode messages.acceptUrlAuth#b12c7125: field url: %w", err)
|
||||
return fmt.Errorf("unable to decode messages.acceptUrlAuth#67a3f0de: field url: %w", err)
|
||||
}
|
||||
a.URL = value
|
||||
}
|
||||
if a.Flags.Has(4) {
|
||||
value, err := b.String()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode messages.acceptUrlAuth#67a3f0de: field match_code: %w", err)
|
||||
}
|
||||
a.MatchCode = value
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -322,6 +368,25 @@ func (a *MessagesAcceptURLAuthRequest) GetWriteAllowed() (value bool) {
|
||||
return a.Flags.Has(0)
|
||||
}
|
||||
|
||||
// SetSharePhoneNumber sets value of SharePhoneNumber conditional field.
|
||||
func (a *MessagesAcceptURLAuthRequest) SetSharePhoneNumber(value bool) {
|
||||
if value {
|
||||
a.Flags.Set(3)
|
||||
a.SharePhoneNumber = true
|
||||
} else {
|
||||
a.Flags.Unset(3)
|
||||
a.SharePhoneNumber = false
|
||||
}
|
||||
}
|
||||
|
||||
// GetSharePhoneNumber returns value of SharePhoneNumber conditional field.
|
||||
func (a *MessagesAcceptURLAuthRequest) GetSharePhoneNumber() (value bool) {
|
||||
if a == nil {
|
||||
return
|
||||
}
|
||||
return a.Flags.Has(3)
|
||||
}
|
||||
|
||||
// SetPeer sets value of Peer conditional field.
|
||||
func (a *MessagesAcceptURLAuthRequest) SetPeer(value InputPeerClass) {
|
||||
a.Flags.Set(1)
|
||||
@@ -394,7 +459,25 @@ func (a *MessagesAcceptURLAuthRequest) GetURL() (value string, ok bool) {
|
||||
return a.URL, true
|
||||
}
|
||||
|
||||
// MessagesAcceptURLAuth invokes method messages.acceptUrlAuth#b12c7125 returning error if any.
|
||||
// SetMatchCode sets value of MatchCode conditional field.
|
||||
func (a *MessagesAcceptURLAuthRequest) SetMatchCode(value string) {
|
||||
a.Flags.Set(4)
|
||||
a.MatchCode = value
|
||||
}
|
||||
|
||||
// GetMatchCode returns value of MatchCode conditional field and
|
||||
// boolean which is true if field was set.
|
||||
func (a *MessagesAcceptURLAuthRequest) GetMatchCode() (value string, ok bool) {
|
||||
if a == nil {
|
||||
return
|
||||
}
|
||||
if !a.Flags.Has(4) {
|
||||
return value, false
|
||||
}
|
||||
return a.MatchCode, true
|
||||
}
|
||||
|
||||
// MessagesAcceptURLAuth invokes method messages.acceptUrlAuth#67a3f0de returning error if any.
|
||||
// Use this to accept a Seamless Telegram Login authorization request, for more info
|
||||
// click here »¹
|
||||
//
|
||||
|
||||
@@ -0,0 +1,201 @@
|
||||
// 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{}
|
||||
)
|
||||
|
||||
// MessagesCheckURLAuthMatchCodeRequest represents TL type `messages.checkUrlAuthMatchCode#c9a47b0b`.
|
||||
//
|
||||
// See https://core.telegram.org/method/messages.checkUrlAuthMatchCode for reference.
|
||||
type MessagesCheckURLAuthMatchCodeRequest struct {
|
||||
// URL field of MessagesCheckURLAuthMatchCodeRequest.
|
||||
URL string
|
||||
// MatchCode field of MessagesCheckURLAuthMatchCodeRequest.
|
||||
MatchCode string
|
||||
}
|
||||
|
||||
// MessagesCheckURLAuthMatchCodeRequestTypeID is TL type id of MessagesCheckURLAuthMatchCodeRequest.
|
||||
const MessagesCheckURLAuthMatchCodeRequestTypeID = 0xc9a47b0b
|
||||
|
||||
// Ensuring interfaces in compile-time for MessagesCheckURLAuthMatchCodeRequest.
|
||||
var (
|
||||
_ bin.Encoder = &MessagesCheckURLAuthMatchCodeRequest{}
|
||||
_ bin.Decoder = &MessagesCheckURLAuthMatchCodeRequest{}
|
||||
_ bin.BareEncoder = &MessagesCheckURLAuthMatchCodeRequest{}
|
||||
_ bin.BareDecoder = &MessagesCheckURLAuthMatchCodeRequest{}
|
||||
)
|
||||
|
||||
func (c *MessagesCheckURLAuthMatchCodeRequest) Zero() bool {
|
||||
if c == nil {
|
||||
return true
|
||||
}
|
||||
if !(c.URL == "") {
|
||||
return false
|
||||
}
|
||||
if !(c.MatchCode == "") {
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
// String implements fmt.Stringer.
|
||||
func (c *MessagesCheckURLAuthMatchCodeRequest) String() string {
|
||||
if c == nil {
|
||||
return "MessagesCheckURLAuthMatchCodeRequest(nil)"
|
||||
}
|
||||
type Alias MessagesCheckURLAuthMatchCodeRequest
|
||||
return fmt.Sprintf("MessagesCheckURLAuthMatchCodeRequest%+v", Alias(*c))
|
||||
}
|
||||
|
||||
// FillFrom fills MessagesCheckURLAuthMatchCodeRequest from given interface.
|
||||
func (c *MessagesCheckURLAuthMatchCodeRequest) FillFrom(from interface {
|
||||
GetURL() (value string)
|
||||
GetMatchCode() (value string)
|
||||
}) {
|
||||
c.URL = from.GetURL()
|
||||
c.MatchCode = from.GetMatchCode()
|
||||
}
|
||||
|
||||
// TypeID returns type id in TL schema.
|
||||
//
|
||||
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
||||
func (*MessagesCheckURLAuthMatchCodeRequest) TypeID() uint32 {
|
||||
return MessagesCheckURLAuthMatchCodeRequestTypeID
|
||||
}
|
||||
|
||||
// TypeName returns name of type in TL schema.
|
||||
func (*MessagesCheckURLAuthMatchCodeRequest) TypeName() string {
|
||||
return "messages.checkUrlAuthMatchCode"
|
||||
}
|
||||
|
||||
// TypeInfo returns info about TL type.
|
||||
func (c *MessagesCheckURLAuthMatchCodeRequest) TypeInfo() tdp.Type {
|
||||
typ := tdp.Type{
|
||||
Name: "messages.checkUrlAuthMatchCode",
|
||||
ID: MessagesCheckURLAuthMatchCodeRequestTypeID,
|
||||
}
|
||||
if c == nil {
|
||||
typ.Null = true
|
||||
return typ
|
||||
}
|
||||
typ.Fields = []tdp.Field{
|
||||
{
|
||||
Name: "URL",
|
||||
SchemaName: "url",
|
||||
},
|
||||
{
|
||||
Name: "MatchCode",
|
||||
SchemaName: "match_code",
|
||||
},
|
||||
}
|
||||
return typ
|
||||
}
|
||||
|
||||
// Encode implements bin.Encoder.
|
||||
func (c *MessagesCheckURLAuthMatchCodeRequest) Encode(b *bin.Buffer) error {
|
||||
if c == nil {
|
||||
return fmt.Errorf("can't encode messages.checkUrlAuthMatchCode#c9a47b0b as nil")
|
||||
}
|
||||
b.PutID(MessagesCheckURLAuthMatchCodeRequestTypeID)
|
||||
return c.EncodeBare(b)
|
||||
}
|
||||
|
||||
// EncodeBare implements bin.BareEncoder.
|
||||
func (c *MessagesCheckURLAuthMatchCodeRequest) EncodeBare(b *bin.Buffer) error {
|
||||
if c == nil {
|
||||
return fmt.Errorf("can't encode messages.checkUrlAuthMatchCode#c9a47b0b as nil")
|
||||
}
|
||||
b.PutString(c.URL)
|
||||
b.PutString(c.MatchCode)
|
||||
return nil
|
||||
}
|
||||
|
||||
// Decode implements bin.Decoder.
|
||||
func (c *MessagesCheckURLAuthMatchCodeRequest) Decode(b *bin.Buffer) error {
|
||||
if c == nil {
|
||||
return fmt.Errorf("can't decode messages.checkUrlAuthMatchCode#c9a47b0b to nil")
|
||||
}
|
||||
if err := b.ConsumeID(MessagesCheckURLAuthMatchCodeRequestTypeID); err != nil {
|
||||
return fmt.Errorf("unable to decode messages.checkUrlAuthMatchCode#c9a47b0b: %w", err)
|
||||
}
|
||||
return c.DecodeBare(b)
|
||||
}
|
||||
|
||||
// DecodeBare implements bin.BareDecoder.
|
||||
func (c *MessagesCheckURLAuthMatchCodeRequest) DecodeBare(b *bin.Buffer) error {
|
||||
if c == nil {
|
||||
return fmt.Errorf("can't decode messages.checkUrlAuthMatchCode#c9a47b0b to nil")
|
||||
}
|
||||
{
|
||||
value, err := b.String()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode messages.checkUrlAuthMatchCode#c9a47b0b: field url: %w", err)
|
||||
}
|
||||
c.URL = value
|
||||
}
|
||||
{
|
||||
value, err := b.String()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode messages.checkUrlAuthMatchCode#c9a47b0b: field match_code: %w", err)
|
||||
}
|
||||
c.MatchCode = value
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// GetURL returns value of URL field.
|
||||
func (c *MessagesCheckURLAuthMatchCodeRequest) GetURL() (value string) {
|
||||
if c == nil {
|
||||
return
|
||||
}
|
||||
return c.URL
|
||||
}
|
||||
|
||||
// GetMatchCode returns value of MatchCode field.
|
||||
func (c *MessagesCheckURLAuthMatchCodeRequest) GetMatchCode() (value string) {
|
||||
if c == nil {
|
||||
return
|
||||
}
|
||||
return c.MatchCode
|
||||
}
|
||||
|
||||
// MessagesCheckURLAuthMatchCode invokes method messages.checkUrlAuthMatchCode#c9a47b0b returning error if any.
|
||||
//
|
||||
// See https://core.telegram.org/method/messages.checkUrlAuthMatchCode for reference.
|
||||
func (c *Client) MessagesCheckURLAuthMatchCode(ctx context.Context, request *MessagesCheckURLAuthMatchCodeRequest) (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{}
|
||||
)
|
||||
+177
@@ -0,0 +1,177 @@
|
||||
// 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{}
|
||||
)
|
||||
|
||||
// MessagesDeclineURLAuthRequest represents TL type `messages.declineUrlAuth#35436bbc`.
|
||||
//
|
||||
// See https://core.telegram.org/method/messages.declineUrlAuth for reference.
|
||||
type MessagesDeclineURLAuthRequest struct {
|
||||
// URL field of MessagesDeclineURLAuthRequest.
|
||||
URL string
|
||||
}
|
||||
|
||||
// MessagesDeclineURLAuthRequestTypeID is TL type id of MessagesDeclineURLAuthRequest.
|
||||
const MessagesDeclineURLAuthRequestTypeID = 0x35436bbc
|
||||
|
||||
// Ensuring interfaces in compile-time for MessagesDeclineURLAuthRequest.
|
||||
var (
|
||||
_ bin.Encoder = &MessagesDeclineURLAuthRequest{}
|
||||
_ bin.Decoder = &MessagesDeclineURLAuthRequest{}
|
||||
_ bin.BareEncoder = &MessagesDeclineURLAuthRequest{}
|
||||
_ bin.BareDecoder = &MessagesDeclineURLAuthRequest{}
|
||||
)
|
||||
|
||||
func (d *MessagesDeclineURLAuthRequest) Zero() bool {
|
||||
if d == nil {
|
||||
return true
|
||||
}
|
||||
if !(d.URL == "") {
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
// String implements fmt.Stringer.
|
||||
func (d *MessagesDeclineURLAuthRequest) String() string {
|
||||
if d == nil {
|
||||
return "MessagesDeclineURLAuthRequest(nil)"
|
||||
}
|
||||
type Alias MessagesDeclineURLAuthRequest
|
||||
return fmt.Sprintf("MessagesDeclineURLAuthRequest%+v", Alias(*d))
|
||||
}
|
||||
|
||||
// FillFrom fills MessagesDeclineURLAuthRequest from given interface.
|
||||
func (d *MessagesDeclineURLAuthRequest) FillFrom(from interface {
|
||||
GetURL() (value string)
|
||||
}) {
|
||||
d.URL = from.GetURL()
|
||||
}
|
||||
|
||||
// TypeID returns type id in TL schema.
|
||||
//
|
||||
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
||||
func (*MessagesDeclineURLAuthRequest) TypeID() uint32 {
|
||||
return MessagesDeclineURLAuthRequestTypeID
|
||||
}
|
||||
|
||||
// TypeName returns name of type in TL schema.
|
||||
func (*MessagesDeclineURLAuthRequest) TypeName() string {
|
||||
return "messages.declineUrlAuth"
|
||||
}
|
||||
|
||||
// TypeInfo returns info about TL type.
|
||||
func (d *MessagesDeclineURLAuthRequest) TypeInfo() tdp.Type {
|
||||
typ := tdp.Type{
|
||||
Name: "messages.declineUrlAuth",
|
||||
ID: MessagesDeclineURLAuthRequestTypeID,
|
||||
}
|
||||
if d == nil {
|
||||
typ.Null = true
|
||||
return typ
|
||||
}
|
||||
typ.Fields = []tdp.Field{
|
||||
{
|
||||
Name: "URL",
|
||||
SchemaName: "url",
|
||||
},
|
||||
}
|
||||
return typ
|
||||
}
|
||||
|
||||
// Encode implements bin.Encoder.
|
||||
func (d *MessagesDeclineURLAuthRequest) Encode(b *bin.Buffer) error {
|
||||
if d == nil {
|
||||
return fmt.Errorf("can't encode messages.declineUrlAuth#35436bbc as nil")
|
||||
}
|
||||
b.PutID(MessagesDeclineURLAuthRequestTypeID)
|
||||
return d.EncodeBare(b)
|
||||
}
|
||||
|
||||
// EncodeBare implements bin.BareEncoder.
|
||||
func (d *MessagesDeclineURLAuthRequest) EncodeBare(b *bin.Buffer) error {
|
||||
if d == nil {
|
||||
return fmt.Errorf("can't encode messages.declineUrlAuth#35436bbc as nil")
|
||||
}
|
||||
b.PutString(d.URL)
|
||||
return nil
|
||||
}
|
||||
|
||||
// Decode implements bin.Decoder.
|
||||
func (d *MessagesDeclineURLAuthRequest) Decode(b *bin.Buffer) error {
|
||||
if d == nil {
|
||||
return fmt.Errorf("can't decode messages.declineUrlAuth#35436bbc to nil")
|
||||
}
|
||||
if err := b.ConsumeID(MessagesDeclineURLAuthRequestTypeID); err != nil {
|
||||
return fmt.Errorf("unable to decode messages.declineUrlAuth#35436bbc: %w", err)
|
||||
}
|
||||
return d.DecodeBare(b)
|
||||
}
|
||||
|
||||
// DecodeBare implements bin.BareDecoder.
|
||||
func (d *MessagesDeclineURLAuthRequest) DecodeBare(b *bin.Buffer) error {
|
||||
if d == nil {
|
||||
return fmt.Errorf("can't decode messages.declineUrlAuth#35436bbc to nil")
|
||||
}
|
||||
{
|
||||
value, err := b.String()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode messages.declineUrlAuth#35436bbc: field url: %w", err)
|
||||
}
|
||||
d.URL = value
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// GetURL returns value of URL field.
|
||||
func (d *MessagesDeclineURLAuthRequest) GetURL() (value string) {
|
||||
if d == nil {
|
||||
return
|
||||
}
|
||||
return d.URL
|
||||
}
|
||||
|
||||
// MessagesDeclineURLAuth invokes method messages.declineUrlAuth#35436bbc returning error if any.
|
||||
//
|
||||
// See https://core.telegram.org/method/messages.declineUrlAuth for reference.
|
||||
func (c *Client) MessagesDeclineURLAuth(ctx context.Context, url string) (bool, error) {
|
||||
var result BoolBox
|
||||
|
||||
request := &MessagesDeclineURLAuthRequest{
|
||||
URL: url,
|
||||
}
|
||||
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{}
|
||||
)
|
||||
+247
@@ -0,0 +1,247 @@
|
||||
// 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{}
|
||||
)
|
||||
|
||||
// MessagesEditChatCreatorRequest represents TL type `messages.editChatCreator#f743b857`.
|
||||
//
|
||||
// See https://core.telegram.org/method/messages.editChatCreator for reference.
|
||||
type MessagesEditChatCreatorRequest struct {
|
||||
// Peer field of MessagesEditChatCreatorRequest.
|
||||
Peer InputPeerClass
|
||||
// UserID field of MessagesEditChatCreatorRequest.
|
||||
UserID InputUserClass
|
||||
// Password field of MessagesEditChatCreatorRequest.
|
||||
Password InputCheckPasswordSRPClass
|
||||
}
|
||||
|
||||
// MessagesEditChatCreatorRequestTypeID is TL type id of MessagesEditChatCreatorRequest.
|
||||
const MessagesEditChatCreatorRequestTypeID = 0xf743b857
|
||||
|
||||
// Ensuring interfaces in compile-time for MessagesEditChatCreatorRequest.
|
||||
var (
|
||||
_ bin.Encoder = &MessagesEditChatCreatorRequest{}
|
||||
_ bin.Decoder = &MessagesEditChatCreatorRequest{}
|
||||
_ bin.BareEncoder = &MessagesEditChatCreatorRequest{}
|
||||
_ bin.BareDecoder = &MessagesEditChatCreatorRequest{}
|
||||
)
|
||||
|
||||
func (e *MessagesEditChatCreatorRequest) Zero() bool {
|
||||
if e == nil {
|
||||
return true
|
||||
}
|
||||
if !(e.Peer == nil) {
|
||||
return false
|
||||
}
|
||||
if !(e.UserID == nil) {
|
||||
return false
|
||||
}
|
||||
if !(e.Password == nil) {
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
// String implements fmt.Stringer.
|
||||
func (e *MessagesEditChatCreatorRequest) String() string {
|
||||
if e == nil {
|
||||
return "MessagesEditChatCreatorRequest(nil)"
|
||||
}
|
||||
type Alias MessagesEditChatCreatorRequest
|
||||
return fmt.Sprintf("MessagesEditChatCreatorRequest%+v", Alias(*e))
|
||||
}
|
||||
|
||||
// FillFrom fills MessagesEditChatCreatorRequest from given interface.
|
||||
func (e *MessagesEditChatCreatorRequest) FillFrom(from interface {
|
||||
GetPeer() (value InputPeerClass)
|
||||
GetUserID() (value InputUserClass)
|
||||
GetPassword() (value InputCheckPasswordSRPClass)
|
||||
}) {
|
||||
e.Peer = from.GetPeer()
|
||||
e.UserID = from.GetUserID()
|
||||
e.Password = from.GetPassword()
|
||||
}
|
||||
|
||||
// TypeID returns type id in TL schema.
|
||||
//
|
||||
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
||||
func (*MessagesEditChatCreatorRequest) TypeID() uint32 {
|
||||
return MessagesEditChatCreatorRequestTypeID
|
||||
}
|
||||
|
||||
// TypeName returns name of type in TL schema.
|
||||
func (*MessagesEditChatCreatorRequest) TypeName() string {
|
||||
return "messages.editChatCreator"
|
||||
}
|
||||
|
||||
// TypeInfo returns info about TL type.
|
||||
func (e *MessagesEditChatCreatorRequest) TypeInfo() tdp.Type {
|
||||
typ := tdp.Type{
|
||||
Name: "messages.editChatCreator",
|
||||
ID: MessagesEditChatCreatorRequestTypeID,
|
||||
}
|
||||
if e == nil {
|
||||
typ.Null = true
|
||||
return typ
|
||||
}
|
||||
typ.Fields = []tdp.Field{
|
||||
{
|
||||
Name: "Peer",
|
||||
SchemaName: "peer",
|
||||
},
|
||||
{
|
||||
Name: "UserID",
|
||||
SchemaName: "user_id",
|
||||
},
|
||||
{
|
||||
Name: "Password",
|
||||
SchemaName: "password",
|
||||
},
|
||||
}
|
||||
return typ
|
||||
}
|
||||
|
||||
// Encode implements bin.Encoder.
|
||||
func (e *MessagesEditChatCreatorRequest) Encode(b *bin.Buffer) error {
|
||||
if e == nil {
|
||||
return fmt.Errorf("can't encode messages.editChatCreator#f743b857 as nil")
|
||||
}
|
||||
b.PutID(MessagesEditChatCreatorRequestTypeID)
|
||||
return e.EncodeBare(b)
|
||||
}
|
||||
|
||||
// EncodeBare implements bin.BareEncoder.
|
||||
func (e *MessagesEditChatCreatorRequest) EncodeBare(b *bin.Buffer) error {
|
||||
if e == nil {
|
||||
return fmt.Errorf("can't encode messages.editChatCreator#f743b857 as nil")
|
||||
}
|
||||
if e.Peer == nil {
|
||||
return fmt.Errorf("unable to encode messages.editChatCreator#f743b857: field peer is nil")
|
||||
}
|
||||
if err := e.Peer.Encode(b); err != nil {
|
||||
return fmt.Errorf("unable to encode messages.editChatCreator#f743b857: field peer: %w", err)
|
||||
}
|
||||
if e.UserID == nil {
|
||||
return fmt.Errorf("unable to encode messages.editChatCreator#f743b857: field user_id is nil")
|
||||
}
|
||||
if err := e.UserID.Encode(b); err != nil {
|
||||
return fmt.Errorf("unable to encode messages.editChatCreator#f743b857: field user_id: %w", err)
|
||||
}
|
||||
if e.Password == nil {
|
||||
return fmt.Errorf("unable to encode messages.editChatCreator#f743b857: field password is nil")
|
||||
}
|
||||
if err := e.Password.Encode(b); err != nil {
|
||||
return fmt.Errorf("unable to encode messages.editChatCreator#f743b857: field password: %w", err)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Decode implements bin.Decoder.
|
||||
func (e *MessagesEditChatCreatorRequest) Decode(b *bin.Buffer) error {
|
||||
if e == nil {
|
||||
return fmt.Errorf("can't decode messages.editChatCreator#f743b857 to nil")
|
||||
}
|
||||
if err := b.ConsumeID(MessagesEditChatCreatorRequestTypeID); err != nil {
|
||||
return fmt.Errorf("unable to decode messages.editChatCreator#f743b857: %w", err)
|
||||
}
|
||||
return e.DecodeBare(b)
|
||||
}
|
||||
|
||||
// DecodeBare implements bin.BareDecoder.
|
||||
func (e *MessagesEditChatCreatorRequest) DecodeBare(b *bin.Buffer) error {
|
||||
if e == nil {
|
||||
return fmt.Errorf("can't decode messages.editChatCreator#f743b857 to nil")
|
||||
}
|
||||
{
|
||||
value, err := DecodeInputPeer(b)
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode messages.editChatCreator#f743b857: field peer: %w", err)
|
||||
}
|
||||
e.Peer = value
|
||||
}
|
||||
{
|
||||
value, err := DecodeInputUser(b)
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode messages.editChatCreator#f743b857: field user_id: %w", err)
|
||||
}
|
||||
e.UserID = value
|
||||
}
|
||||
{
|
||||
value, err := DecodeInputCheckPasswordSRP(b)
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode messages.editChatCreator#f743b857: field password: %w", err)
|
||||
}
|
||||
e.Password = value
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// GetPeer returns value of Peer field.
|
||||
func (e *MessagesEditChatCreatorRequest) GetPeer() (value InputPeerClass) {
|
||||
if e == nil {
|
||||
return
|
||||
}
|
||||
return e.Peer
|
||||
}
|
||||
|
||||
// GetUserID returns value of UserID field.
|
||||
func (e *MessagesEditChatCreatorRequest) GetUserID() (value InputUserClass) {
|
||||
if e == nil {
|
||||
return
|
||||
}
|
||||
return e.UserID
|
||||
}
|
||||
|
||||
// GetPassword returns value of Password field.
|
||||
func (e *MessagesEditChatCreatorRequest) GetPassword() (value InputCheckPasswordSRPClass) {
|
||||
if e == nil {
|
||||
return
|
||||
}
|
||||
return e.Password
|
||||
}
|
||||
|
||||
// GetPasswordAsNotEmpty returns mapped value of Password field.
|
||||
func (e *MessagesEditChatCreatorRequest) GetPasswordAsNotEmpty() (*InputCheckPasswordSRP, bool) {
|
||||
return e.Password.AsNotEmpty()
|
||||
}
|
||||
|
||||
// MessagesEditChatCreator invokes method messages.editChatCreator#f743b857 returning error if any.
|
||||
//
|
||||
// See https://core.telegram.org/method/messages.editChatCreator for reference.
|
||||
func (c *Client) MessagesEditChatCreator(ctx context.Context, request *MessagesEditChatCreatorRequest) (UpdatesClass, error) {
|
||||
var result UpdatesBox
|
||||
|
||||
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,237 @@
|
||||
// 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{}
|
||||
)
|
||||
|
||||
// MessagesEditChatParticipantRankRequest represents TL type `messages.editChatParticipantRank#a00f32b0`.
|
||||
//
|
||||
// See https://core.telegram.org/method/messages.editChatParticipantRank for reference.
|
||||
type MessagesEditChatParticipantRankRequest struct {
|
||||
// Peer field of MessagesEditChatParticipantRankRequest.
|
||||
Peer InputPeerClass
|
||||
// Participant field of MessagesEditChatParticipantRankRequest.
|
||||
Participant InputPeerClass
|
||||
// Rank field of MessagesEditChatParticipantRankRequest.
|
||||
Rank string
|
||||
}
|
||||
|
||||
// MessagesEditChatParticipantRankRequestTypeID is TL type id of MessagesEditChatParticipantRankRequest.
|
||||
const MessagesEditChatParticipantRankRequestTypeID = 0xa00f32b0
|
||||
|
||||
// Ensuring interfaces in compile-time for MessagesEditChatParticipantRankRequest.
|
||||
var (
|
||||
_ bin.Encoder = &MessagesEditChatParticipantRankRequest{}
|
||||
_ bin.Decoder = &MessagesEditChatParticipantRankRequest{}
|
||||
_ bin.BareEncoder = &MessagesEditChatParticipantRankRequest{}
|
||||
_ bin.BareDecoder = &MessagesEditChatParticipantRankRequest{}
|
||||
)
|
||||
|
||||
func (e *MessagesEditChatParticipantRankRequest) Zero() bool {
|
||||
if e == nil {
|
||||
return true
|
||||
}
|
||||
if !(e.Peer == nil) {
|
||||
return false
|
||||
}
|
||||
if !(e.Participant == nil) {
|
||||
return false
|
||||
}
|
||||
if !(e.Rank == "") {
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
// String implements fmt.Stringer.
|
||||
func (e *MessagesEditChatParticipantRankRequest) String() string {
|
||||
if e == nil {
|
||||
return "MessagesEditChatParticipantRankRequest(nil)"
|
||||
}
|
||||
type Alias MessagesEditChatParticipantRankRequest
|
||||
return fmt.Sprintf("MessagesEditChatParticipantRankRequest%+v", Alias(*e))
|
||||
}
|
||||
|
||||
// FillFrom fills MessagesEditChatParticipantRankRequest from given interface.
|
||||
func (e *MessagesEditChatParticipantRankRequest) FillFrom(from interface {
|
||||
GetPeer() (value InputPeerClass)
|
||||
GetParticipant() (value InputPeerClass)
|
||||
GetRank() (value string)
|
||||
}) {
|
||||
e.Peer = from.GetPeer()
|
||||
e.Participant = from.GetParticipant()
|
||||
e.Rank = from.GetRank()
|
||||
}
|
||||
|
||||
// TypeID returns type id in TL schema.
|
||||
//
|
||||
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
||||
func (*MessagesEditChatParticipantRankRequest) TypeID() uint32 {
|
||||
return MessagesEditChatParticipantRankRequestTypeID
|
||||
}
|
||||
|
||||
// TypeName returns name of type in TL schema.
|
||||
func (*MessagesEditChatParticipantRankRequest) TypeName() string {
|
||||
return "messages.editChatParticipantRank"
|
||||
}
|
||||
|
||||
// TypeInfo returns info about TL type.
|
||||
func (e *MessagesEditChatParticipantRankRequest) TypeInfo() tdp.Type {
|
||||
typ := tdp.Type{
|
||||
Name: "messages.editChatParticipantRank",
|
||||
ID: MessagesEditChatParticipantRankRequestTypeID,
|
||||
}
|
||||
if e == nil {
|
||||
typ.Null = true
|
||||
return typ
|
||||
}
|
||||
typ.Fields = []tdp.Field{
|
||||
{
|
||||
Name: "Peer",
|
||||
SchemaName: "peer",
|
||||
},
|
||||
{
|
||||
Name: "Participant",
|
||||
SchemaName: "participant",
|
||||
},
|
||||
{
|
||||
Name: "Rank",
|
||||
SchemaName: "rank",
|
||||
},
|
||||
}
|
||||
return typ
|
||||
}
|
||||
|
||||
// Encode implements bin.Encoder.
|
||||
func (e *MessagesEditChatParticipantRankRequest) Encode(b *bin.Buffer) error {
|
||||
if e == nil {
|
||||
return fmt.Errorf("can't encode messages.editChatParticipantRank#a00f32b0 as nil")
|
||||
}
|
||||
b.PutID(MessagesEditChatParticipantRankRequestTypeID)
|
||||
return e.EncodeBare(b)
|
||||
}
|
||||
|
||||
// EncodeBare implements bin.BareEncoder.
|
||||
func (e *MessagesEditChatParticipantRankRequest) EncodeBare(b *bin.Buffer) error {
|
||||
if e == nil {
|
||||
return fmt.Errorf("can't encode messages.editChatParticipantRank#a00f32b0 as nil")
|
||||
}
|
||||
if e.Peer == nil {
|
||||
return fmt.Errorf("unable to encode messages.editChatParticipantRank#a00f32b0: field peer is nil")
|
||||
}
|
||||
if err := e.Peer.Encode(b); err != nil {
|
||||
return fmt.Errorf("unable to encode messages.editChatParticipantRank#a00f32b0: field peer: %w", err)
|
||||
}
|
||||
if e.Participant == nil {
|
||||
return fmt.Errorf("unable to encode messages.editChatParticipantRank#a00f32b0: field participant is nil")
|
||||
}
|
||||
if err := e.Participant.Encode(b); err != nil {
|
||||
return fmt.Errorf("unable to encode messages.editChatParticipantRank#a00f32b0: field participant: %w", err)
|
||||
}
|
||||
b.PutString(e.Rank)
|
||||
return nil
|
||||
}
|
||||
|
||||
// Decode implements bin.Decoder.
|
||||
func (e *MessagesEditChatParticipantRankRequest) Decode(b *bin.Buffer) error {
|
||||
if e == nil {
|
||||
return fmt.Errorf("can't decode messages.editChatParticipantRank#a00f32b0 to nil")
|
||||
}
|
||||
if err := b.ConsumeID(MessagesEditChatParticipantRankRequestTypeID); err != nil {
|
||||
return fmt.Errorf("unable to decode messages.editChatParticipantRank#a00f32b0: %w", err)
|
||||
}
|
||||
return e.DecodeBare(b)
|
||||
}
|
||||
|
||||
// DecodeBare implements bin.BareDecoder.
|
||||
func (e *MessagesEditChatParticipantRankRequest) DecodeBare(b *bin.Buffer) error {
|
||||
if e == nil {
|
||||
return fmt.Errorf("can't decode messages.editChatParticipantRank#a00f32b0 to nil")
|
||||
}
|
||||
{
|
||||
value, err := DecodeInputPeer(b)
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode messages.editChatParticipantRank#a00f32b0: field peer: %w", err)
|
||||
}
|
||||
e.Peer = value
|
||||
}
|
||||
{
|
||||
value, err := DecodeInputPeer(b)
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode messages.editChatParticipantRank#a00f32b0: field participant: %w", err)
|
||||
}
|
||||
e.Participant = value
|
||||
}
|
||||
{
|
||||
value, err := b.String()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode messages.editChatParticipantRank#a00f32b0: field rank: %w", err)
|
||||
}
|
||||
e.Rank = value
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// GetPeer returns value of Peer field.
|
||||
func (e *MessagesEditChatParticipantRankRequest) GetPeer() (value InputPeerClass) {
|
||||
if e == nil {
|
||||
return
|
||||
}
|
||||
return e.Peer
|
||||
}
|
||||
|
||||
// GetParticipant returns value of Participant field.
|
||||
func (e *MessagesEditChatParticipantRankRequest) GetParticipant() (value InputPeerClass) {
|
||||
if e == nil {
|
||||
return
|
||||
}
|
||||
return e.Participant
|
||||
}
|
||||
|
||||
// GetRank returns value of Rank field.
|
||||
func (e *MessagesEditChatParticipantRankRequest) GetRank() (value string) {
|
||||
if e == nil {
|
||||
return
|
||||
}
|
||||
return e.Rank
|
||||
}
|
||||
|
||||
// MessagesEditChatParticipantRank invokes method messages.editChatParticipantRank#a00f32b0 returning error if any.
|
||||
//
|
||||
// See https://core.telegram.org/method/messages.editChatParticipantRank for reference.
|
||||
func (c *Client) MessagesEditChatParticipantRank(ctx context.Context, request *MessagesEditChatParticipantRankRequest) (UpdatesClass, error) {
|
||||
var result UpdatesBox
|
||||
|
||||
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{}
|
||||
)
|
||||
+529
@@ -0,0 +1,529 @@
|
||||
// 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{}
|
||||
)
|
||||
|
||||
// MessagesEmojiGameUnavailable represents TL type `messages.emojiGameUnavailable#59e65335`.
|
||||
//
|
||||
// See https://core.telegram.org/constructor/messages.emojiGameUnavailable for reference.
|
||||
type MessagesEmojiGameUnavailable struct {
|
||||
}
|
||||
|
||||
// MessagesEmojiGameUnavailableTypeID is TL type id of MessagesEmojiGameUnavailable.
|
||||
const MessagesEmojiGameUnavailableTypeID = 0x59e65335
|
||||
|
||||
// construct implements constructor of MessagesEmojiGameInfoClass.
|
||||
func (e MessagesEmojiGameUnavailable) construct() MessagesEmojiGameInfoClass { return &e }
|
||||
|
||||
// Ensuring interfaces in compile-time for MessagesEmojiGameUnavailable.
|
||||
var (
|
||||
_ bin.Encoder = &MessagesEmojiGameUnavailable{}
|
||||
_ bin.Decoder = &MessagesEmojiGameUnavailable{}
|
||||
_ bin.BareEncoder = &MessagesEmojiGameUnavailable{}
|
||||
_ bin.BareDecoder = &MessagesEmojiGameUnavailable{}
|
||||
|
||||
_ MessagesEmojiGameInfoClass = &MessagesEmojiGameUnavailable{}
|
||||
)
|
||||
|
||||
func (e *MessagesEmojiGameUnavailable) Zero() bool {
|
||||
if e == nil {
|
||||
return true
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
// String implements fmt.Stringer.
|
||||
func (e *MessagesEmojiGameUnavailable) String() string {
|
||||
if e == nil {
|
||||
return "MessagesEmojiGameUnavailable(nil)"
|
||||
}
|
||||
type Alias MessagesEmojiGameUnavailable
|
||||
return fmt.Sprintf("MessagesEmojiGameUnavailable%+v", Alias(*e))
|
||||
}
|
||||
|
||||
// TypeID returns type id in TL schema.
|
||||
//
|
||||
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
||||
func (*MessagesEmojiGameUnavailable) TypeID() uint32 {
|
||||
return MessagesEmojiGameUnavailableTypeID
|
||||
}
|
||||
|
||||
// TypeName returns name of type in TL schema.
|
||||
func (*MessagesEmojiGameUnavailable) TypeName() string {
|
||||
return "messages.emojiGameUnavailable"
|
||||
}
|
||||
|
||||
// TypeInfo returns info about TL type.
|
||||
func (e *MessagesEmojiGameUnavailable) TypeInfo() tdp.Type {
|
||||
typ := tdp.Type{
|
||||
Name: "messages.emojiGameUnavailable",
|
||||
ID: MessagesEmojiGameUnavailableTypeID,
|
||||
}
|
||||
if e == nil {
|
||||
typ.Null = true
|
||||
return typ
|
||||
}
|
||||
typ.Fields = []tdp.Field{}
|
||||
return typ
|
||||
}
|
||||
|
||||
// Encode implements bin.Encoder.
|
||||
func (e *MessagesEmojiGameUnavailable) Encode(b *bin.Buffer) error {
|
||||
if e == nil {
|
||||
return fmt.Errorf("can't encode messages.emojiGameUnavailable#59e65335 as nil")
|
||||
}
|
||||
b.PutID(MessagesEmojiGameUnavailableTypeID)
|
||||
return e.EncodeBare(b)
|
||||
}
|
||||
|
||||
// EncodeBare implements bin.BareEncoder.
|
||||
func (e *MessagesEmojiGameUnavailable) EncodeBare(b *bin.Buffer) error {
|
||||
if e == nil {
|
||||
return fmt.Errorf("can't encode messages.emojiGameUnavailable#59e65335 as nil")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Decode implements bin.Decoder.
|
||||
func (e *MessagesEmojiGameUnavailable) Decode(b *bin.Buffer) error {
|
||||
if e == nil {
|
||||
return fmt.Errorf("can't decode messages.emojiGameUnavailable#59e65335 to nil")
|
||||
}
|
||||
if err := b.ConsumeID(MessagesEmojiGameUnavailableTypeID); err != nil {
|
||||
return fmt.Errorf("unable to decode messages.emojiGameUnavailable#59e65335: %w", err)
|
||||
}
|
||||
return e.DecodeBare(b)
|
||||
}
|
||||
|
||||
// DecodeBare implements bin.BareDecoder.
|
||||
func (e *MessagesEmojiGameUnavailable) DecodeBare(b *bin.Buffer) error {
|
||||
if e == nil {
|
||||
return fmt.Errorf("can't decode messages.emojiGameUnavailable#59e65335 to nil")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// MessagesEmojiGameDiceInfo represents TL type `messages.emojiGameDiceInfo#44e56023`.
|
||||
//
|
||||
// See https://core.telegram.org/constructor/messages.emojiGameDiceInfo for reference.
|
||||
type MessagesEmojiGameDiceInfo struct {
|
||||
// Flags field of MessagesEmojiGameDiceInfo.
|
||||
Flags bin.Fields
|
||||
// GameHash field of MessagesEmojiGameDiceInfo.
|
||||
GameHash string
|
||||
// PrevStake field of MessagesEmojiGameDiceInfo.
|
||||
PrevStake int64
|
||||
// CurrentStreak field of MessagesEmojiGameDiceInfo.
|
||||
CurrentStreak int
|
||||
// Params field of MessagesEmojiGameDiceInfo.
|
||||
Params []int
|
||||
// PlaysLeft field of MessagesEmojiGameDiceInfo.
|
||||
//
|
||||
// Use SetPlaysLeft and GetPlaysLeft helpers.
|
||||
PlaysLeft int
|
||||
}
|
||||
|
||||
// MessagesEmojiGameDiceInfoTypeID is TL type id of MessagesEmojiGameDiceInfo.
|
||||
const MessagesEmojiGameDiceInfoTypeID = 0x44e56023
|
||||
|
||||
// construct implements constructor of MessagesEmojiGameInfoClass.
|
||||
func (e MessagesEmojiGameDiceInfo) construct() MessagesEmojiGameInfoClass { return &e }
|
||||
|
||||
// Ensuring interfaces in compile-time for MessagesEmojiGameDiceInfo.
|
||||
var (
|
||||
_ bin.Encoder = &MessagesEmojiGameDiceInfo{}
|
||||
_ bin.Decoder = &MessagesEmojiGameDiceInfo{}
|
||||
_ bin.BareEncoder = &MessagesEmojiGameDiceInfo{}
|
||||
_ bin.BareDecoder = &MessagesEmojiGameDiceInfo{}
|
||||
|
||||
_ MessagesEmojiGameInfoClass = &MessagesEmojiGameDiceInfo{}
|
||||
)
|
||||
|
||||
func (e *MessagesEmojiGameDiceInfo) Zero() bool {
|
||||
if e == nil {
|
||||
return true
|
||||
}
|
||||
if !(e.Flags.Zero()) {
|
||||
return false
|
||||
}
|
||||
if !(e.GameHash == "") {
|
||||
return false
|
||||
}
|
||||
if !(e.PrevStake == 0) {
|
||||
return false
|
||||
}
|
||||
if !(e.CurrentStreak == 0) {
|
||||
return false
|
||||
}
|
||||
if !(e.Params == nil) {
|
||||
return false
|
||||
}
|
||||
if !(e.PlaysLeft == 0) {
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
// String implements fmt.Stringer.
|
||||
func (e *MessagesEmojiGameDiceInfo) String() string {
|
||||
if e == nil {
|
||||
return "MessagesEmojiGameDiceInfo(nil)"
|
||||
}
|
||||
type Alias MessagesEmojiGameDiceInfo
|
||||
return fmt.Sprintf("MessagesEmojiGameDiceInfo%+v", Alias(*e))
|
||||
}
|
||||
|
||||
// FillFrom fills MessagesEmojiGameDiceInfo from given interface.
|
||||
func (e *MessagesEmojiGameDiceInfo) FillFrom(from interface {
|
||||
GetGameHash() (value string)
|
||||
GetPrevStake() (value int64)
|
||||
GetCurrentStreak() (value int)
|
||||
GetParams() (value []int)
|
||||
GetPlaysLeft() (value int, ok bool)
|
||||
}) {
|
||||
e.GameHash = from.GetGameHash()
|
||||
e.PrevStake = from.GetPrevStake()
|
||||
e.CurrentStreak = from.GetCurrentStreak()
|
||||
e.Params = from.GetParams()
|
||||
if val, ok := from.GetPlaysLeft(); ok {
|
||||
e.PlaysLeft = val
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// TypeID returns type id in TL schema.
|
||||
//
|
||||
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
||||
func (*MessagesEmojiGameDiceInfo) TypeID() uint32 {
|
||||
return MessagesEmojiGameDiceInfoTypeID
|
||||
}
|
||||
|
||||
// TypeName returns name of type in TL schema.
|
||||
func (*MessagesEmojiGameDiceInfo) TypeName() string {
|
||||
return "messages.emojiGameDiceInfo"
|
||||
}
|
||||
|
||||
// TypeInfo returns info about TL type.
|
||||
func (e *MessagesEmojiGameDiceInfo) TypeInfo() tdp.Type {
|
||||
typ := tdp.Type{
|
||||
Name: "messages.emojiGameDiceInfo",
|
||||
ID: MessagesEmojiGameDiceInfoTypeID,
|
||||
}
|
||||
if e == nil {
|
||||
typ.Null = true
|
||||
return typ
|
||||
}
|
||||
typ.Fields = []tdp.Field{
|
||||
{
|
||||
Name: "GameHash",
|
||||
SchemaName: "game_hash",
|
||||
},
|
||||
{
|
||||
Name: "PrevStake",
|
||||
SchemaName: "prev_stake",
|
||||
},
|
||||
{
|
||||
Name: "CurrentStreak",
|
||||
SchemaName: "current_streak",
|
||||
},
|
||||
{
|
||||
Name: "Params",
|
||||
SchemaName: "params",
|
||||
},
|
||||
{
|
||||
Name: "PlaysLeft",
|
||||
SchemaName: "plays_left",
|
||||
Null: !e.Flags.Has(0),
|
||||
},
|
||||
}
|
||||
return typ
|
||||
}
|
||||
|
||||
// SetFlags sets flags for non-zero fields.
|
||||
func (e *MessagesEmojiGameDiceInfo) SetFlags() {
|
||||
if !(e.PlaysLeft == 0) {
|
||||
e.Flags.Set(0)
|
||||
}
|
||||
}
|
||||
|
||||
// Encode implements bin.Encoder.
|
||||
func (e *MessagesEmojiGameDiceInfo) Encode(b *bin.Buffer) error {
|
||||
if e == nil {
|
||||
return fmt.Errorf("can't encode messages.emojiGameDiceInfo#44e56023 as nil")
|
||||
}
|
||||
b.PutID(MessagesEmojiGameDiceInfoTypeID)
|
||||
return e.EncodeBare(b)
|
||||
}
|
||||
|
||||
// EncodeBare implements bin.BareEncoder.
|
||||
func (e *MessagesEmojiGameDiceInfo) EncodeBare(b *bin.Buffer) error {
|
||||
if e == nil {
|
||||
return fmt.Errorf("can't encode messages.emojiGameDiceInfo#44e56023 as nil")
|
||||
}
|
||||
e.SetFlags()
|
||||
if err := e.Flags.Encode(b); err != nil {
|
||||
return fmt.Errorf("unable to encode messages.emojiGameDiceInfo#44e56023: field flags: %w", err)
|
||||
}
|
||||
b.PutString(e.GameHash)
|
||||
b.PutLong(e.PrevStake)
|
||||
b.PutInt(e.CurrentStreak)
|
||||
b.PutVectorHeader(len(e.Params))
|
||||
for _, v := range e.Params {
|
||||
b.PutInt(v)
|
||||
}
|
||||
if e.Flags.Has(0) {
|
||||
b.PutInt(e.PlaysLeft)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Decode implements bin.Decoder.
|
||||
func (e *MessagesEmojiGameDiceInfo) Decode(b *bin.Buffer) error {
|
||||
if e == nil {
|
||||
return fmt.Errorf("can't decode messages.emojiGameDiceInfo#44e56023 to nil")
|
||||
}
|
||||
if err := b.ConsumeID(MessagesEmojiGameDiceInfoTypeID); err != nil {
|
||||
return fmt.Errorf("unable to decode messages.emojiGameDiceInfo#44e56023: %w", err)
|
||||
}
|
||||
return e.DecodeBare(b)
|
||||
}
|
||||
|
||||
// DecodeBare implements bin.BareDecoder.
|
||||
func (e *MessagesEmojiGameDiceInfo) DecodeBare(b *bin.Buffer) error {
|
||||
if e == nil {
|
||||
return fmt.Errorf("can't decode messages.emojiGameDiceInfo#44e56023 to nil")
|
||||
}
|
||||
{
|
||||
if err := e.Flags.Decode(b); err != nil {
|
||||
return fmt.Errorf("unable to decode messages.emojiGameDiceInfo#44e56023: field flags: %w", err)
|
||||
}
|
||||
}
|
||||
{
|
||||
value, err := b.String()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode messages.emojiGameDiceInfo#44e56023: field game_hash: %w", err)
|
||||
}
|
||||
e.GameHash = value
|
||||
}
|
||||
{
|
||||
value, err := b.Long()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode messages.emojiGameDiceInfo#44e56023: field prev_stake: %w", err)
|
||||
}
|
||||
e.PrevStake = value
|
||||
}
|
||||
{
|
||||
value, err := b.Int()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode messages.emojiGameDiceInfo#44e56023: field current_streak: %w", err)
|
||||
}
|
||||
e.CurrentStreak = value
|
||||
}
|
||||
{
|
||||
headerLen, err := b.VectorHeader()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode messages.emojiGameDiceInfo#44e56023: field params: %w", err)
|
||||
}
|
||||
|
||||
if headerLen > 0 {
|
||||
e.Params = make([]int, 0, headerLen%bin.PreallocateLimit)
|
||||
}
|
||||
for idx := 0; idx < headerLen; idx++ {
|
||||
value, err := b.Int()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode messages.emojiGameDiceInfo#44e56023: field params: %w", err)
|
||||
}
|
||||
e.Params = append(e.Params, value)
|
||||
}
|
||||
}
|
||||
if e.Flags.Has(0) {
|
||||
value, err := b.Int()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode messages.emojiGameDiceInfo#44e56023: field plays_left: %w", err)
|
||||
}
|
||||
e.PlaysLeft = value
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// GetGameHash returns value of GameHash field.
|
||||
func (e *MessagesEmojiGameDiceInfo) GetGameHash() (value string) {
|
||||
if e == nil {
|
||||
return
|
||||
}
|
||||
return e.GameHash
|
||||
}
|
||||
|
||||
// GetPrevStake returns value of PrevStake field.
|
||||
func (e *MessagesEmojiGameDiceInfo) GetPrevStake() (value int64) {
|
||||
if e == nil {
|
||||
return
|
||||
}
|
||||
return e.PrevStake
|
||||
}
|
||||
|
||||
// GetCurrentStreak returns value of CurrentStreak field.
|
||||
func (e *MessagesEmojiGameDiceInfo) GetCurrentStreak() (value int) {
|
||||
if e == nil {
|
||||
return
|
||||
}
|
||||
return e.CurrentStreak
|
||||
}
|
||||
|
||||
// GetParams returns value of Params field.
|
||||
func (e *MessagesEmojiGameDiceInfo) GetParams() (value []int) {
|
||||
if e == nil {
|
||||
return
|
||||
}
|
||||
return e.Params
|
||||
}
|
||||
|
||||
// SetPlaysLeft sets value of PlaysLeft conditional field.
|
||||
func (e *MessagesEmojiGameDiceInfo) SetPlaysLeft(value int) {
|
||||
e.Flags.Set(0)
|
||||
e.PlaysLeft = value
|
||||
}
|
||||
|
||||
// GetPlaysLeft returns value of PlaysLeft conditional field and
|
||||
// boolean which is true if field was set.
|
||||
func (e *MessagesEmojiGameDiceInfo) GetPlaysLeft() (value int, ok bool) {
|
||||
if e == nil {
|
||||
return
|
||||
}
|
||||
if !e.Flags.Has(0) {
|
||||
return value, false
|
||||
}
|
||||
return e.PlaysLeft, true
|
||||
}
|
||||
|
||||
// MessagesEmojiGameInfoClassName is schema name of MessagesEmojiGameInfoClass.
|
||||
const MessagesEmojiGameInfoClassName = "messages.EmojiGameInfo"
|
||||
|
||||
// MessagesEmojiGameInfoClass represents messages.EmojiGameInfo generic type.
|
||||
//
|
||||
// See https://core.telegram.org/type/messages.EmojiGameInfo for reference.
|
||||
//
|
||||
// Example:
|
||||
//
|
||||
// g, err := tg.DecodeMessagesEmojiGameInfo(buf)
|
||||
// if err != nil {
|
||||
// panic(err)
|
||||
// }
|
||||
// switch v := g.(type) {
|
||||
// case *tg.MessagesEmojiGameUnavailable: // messages.emojiGameUnavailable#59e65335
|
||||
// case *tg.MessagesEmojiGameDiceInfo: // messages.emojiGameDiceInfo#44e56023
|
||||
// default: panic(v)
|
||||
// }
|
||||
type MessagesEmojiGameInfoClass interface {
|
||||
bin.Encoder
|
||||
bin.Decoder
|
||||
bin.BareEncoder
|
||||
bin.BareDecoder
|
||||
construct() MessagesEmojiGameInfoClass
|
||||
|
||||
// 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
|
||||
|
||||
// AsAvailable tries to map MessagesEmojiGameInfoClass to MessagesEmojiGameDiceInfo.
|
||||
AsAvailable() (*MessagesEmojiGameDiceInfo, bool)
|
||||
}
|
||||
|
||||
// AsAvailable tries to map MessagesEmojiGameUnavailable to MessagesEmojiGameDiceInfo.
|
||||
func (e *MessagesEmojiGameUnavailable) AsAvailable() (*MessagesEmojiGameDiceInfo, bool) {
|
||||
return nil, false
|
||||
}
|
||||
|
||||
// AsAvailable tries to map MessagesEmojiGameDiceInfo to MessagesEmojiGameDiceInfo.
|
||||
func (e *MessagesEmojiGameDiceInfo) AsAvailable() (*MessagesEmojiGameDiceInfo, bool) {
|
||||
return e, true
|
||||
}
|
||||
|
||||
// DecodeMessagesEmojiGameInfo implements binary de-serialization for MessagesEmojiGameInfoClass.
|
||||
func DecodeMessagesEmojiGameInfo(buf *bin.Buffer) (MessagesEmojiGameInfoClass, error) {
|
||||
id, err := buf.PeekID()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
switch id {
|
||||
case MessagesEmojiGameUnavailableTypeID:
|
||||
// Decoding messages.emojiGameUnavailable#59e65335.
|
||||
v := MessagesEmojiGameUnavailable{}
|
||||
if err := v.Decode(buf); err != nil {
|
||||
return nil, fmt.Errorf("unable to decode MessagesEmojiGameInfoClass: %w", err)
|
||||
}
|
||||
return &v, nil
|
||||
case MessagesEmojiGameDiceInfoTypeID:
|
||||
// Decoding messages.emojiGameDiceInfo#44e56023.
|
||||
v := MessagesEmojiGameDiceInfo{}
|
||||
if err := v.Decode(buf); err != nil {
|
||||
return nil, fmt.Errorf("unable to decode MessagesEmojiGameInfoClass: %w", err)
|
||||
}
|
||||
return &v, nil
|
||||
default:
|
||||
return nil, fmt.Errorf("unable to decode MessagesEmojiGameInfoClass: %w", bin.NewUnexpectedID(id))
|
||||
}
|
||||
}
|
||||
|
||||
// MessagesEmojiGameInfo boxes the MessagesEmojiGameInfoClass providing a helper.
|
||||
type MessagesEmojiGameInfoBox struct {
|
||||
EmojiGameInfo MessagesEmojiGameInfoClass
|
||||
}
|
||||
|
||||
// Decode implements bin.Decoder for MessagesEmojiGameInfoBox.
|
||||
func (b *MessagesEmojiGameInfoBox) Decode(buf *bin.Buffer) error {
|
||||
if b == nil {
|
||||
return fmt.Errorf("unable to decode MessagesEmojiGameInfoBox to nil")
|
||||
}
|
||||
v, err := DecodeMessagesEmojiGameInfo(buf)
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode boxed value: %w", err)
|
||||
}
|
||||
b.EmojiGameInfo = v
|
||||
return nil
|
||||
}
|
||||
|
||||
// Encode implements bin.Encode for MessagesEmojiGameInfoBox.
|
||||
func (b *MessagesEmojiGameInfoBox) Encode(buf *bin.Buffer) error {
|
||||
if b == nil || b.EmojiGameInfo == nil {
|
||||
return fmt.Errorf("unable to encode MessagesEmojiGameInfoClass as nil")
|
||||
}
|
||||
return b.EmojiGameInfo.Encode(buf)
|
||||
}
|
||||
+267
@@ -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{}
|
||||
)
|
||||
|
||||
// MessagesEmojiGameInfoClassArray is adapter for slice of MessagesEmojiGameInfoClass.
|
||||
type MessagesEmojiGameInfoClassArray []MessagesEmojiGameInfoClass
|
||||
|
||||
// Sort sorts slice of MessagesEmojiGameInfoClass.
|
||||
func (s MessagesEmojiGameInfoClassArray) Sort(less func(a, b MessagesEmojiGameInfoClass) bool) MessagesEmojiGameInfoClassArray {
|
||||
sort.Slice(s, func(i, j int) bool {
|
||||
return less(s[i], s[j])
|
||||
})
|
||||
return s
|
||||
}
|
||||
|
||||
// SortStable sorts slice of MessagesEmojiGameInfoClass.
|
||||
func (s MessagesEmojiGameInfoClassArray) SortStable(less func(a, b MessagesEmojiGameInfoClass) bool) MessagesEmojiGameInfoClassArray {
|
||||
sort.SliceStable(s, func(i, j int) bool {
|
||||
return less(s[i], s[j])
|
||||
})
|
||||
return s
|
||||
}
|
||||
|
||||
// Retain filters in-place slice of MessagesEmojiGameInfoClass.
|
||||
func (s MessagesEmojiGameInfoClassArray) Retain(keep func(x MessagesEmojiGameInfoClass) bool) MessagesEmojiGameInfoClassArray {
|
||||
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 MessagesEmojiGameInfoClassArray) First() (v MessagesEmojiGameInfoClass, ok bool) {
|
||||
if len(s) < 1 {
|
||||
return
|
||||
}
|
||||
return s[0], true
|
||||
}
|
||||
|
||||
// Last returns last element of slice (if exists).
|
||||
func (s MessagesEmojiGameInfoClassArray) Last() (v MessagesEmojiGameInfoClass, 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 *MessagesEmojiGameInfoClassArray) PopFirst() (v MessagesEmojiGameInfoClass, 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 MessagesEmojiGameInfoClass
|
||||
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 *MessagesEmojiGameInfoClassArray) Pop() (v MessagesEmojiGameInfoClass, 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
|
||||
}
|
||||
|
||||
// AsMessagesEmojiGameDiceInfo returns copy with only MessagesEmojiGameDiceInfo constructors.
|
||||
func (s MessagesEmojiGameInfoClassArray) AsMessagesEmojiGameDiceInfo() (to MessagesEmojiGameDiceInfoArray) {
|
||||
for _, elem := range s {
|
||||
value, ok := elem.(*MessagesEmojiGameDiceInfo)
|
||||
if !ok {
|
||||
continue
|
||||
}
|
||||
to = append(to, *value)
|
||||
}
|
||||
|
||||
return to
|
||||
}
|
||||
|
||||
// AppendOnlyAvailable appends only Available constructors to
|
||||
// given slice.
|
||||
func (s MessagesEmojiGameInfoClassArray) AppendOnlyAvailable(to []*MessagesEmojiGameDiceInfo) []*MessagesEmojiGameDiceInfo {
|
||||
for _, elem := range s {
|
||||
value, ok := elem.AsAvailable()
|
||||
if !ok {
|
||||
continue
|
||||
}
|
||||
to = append(to, value)
|
||||
}
|
||||
|
||||
return to
|
||||
}
|
||||
|
||||
// AsAvailable returns copy with only Available constructors.
|
||||
func (s MessagesEmojiGameInfoClassArray) AsAvailable() (to []*MessagesEmojiGameDiceInfo) {
|
||||
return s.AppendOnlyAvailable(to)
|
||||
}
|
||||
|
||||
// FirstAsAvailable returns first element of slice (if exists).
|
||||
func (s MessagesEmojiGameInfoClassArray) FirstAsAvailable() (v *MessagesEmojiGameDiceInfo, ok bool) {
|
||||
value, ok := s.First()
|
||||
if !ok {
|
||||
return
|
||||
}
|
||||
return value.AsAvailable()
|
||||
}
|
||||
|
||||
// LastAsAvailable returns last element of slice (if exists).
|
||||
func (s MessagesEmojiGameInfoClassArray) LastAsAvailable() (v *MessagesEmojiGameDiceInfo, ok bool) {
|
||||
value, ok := s.Last()
|
||||
if !ok {
|
||||
return
|
||||
}
|
||||
return value.AsAvailable()
|
||||
}
|
||||
|
||||
// PopFirstAsAvailable returns element of slice (if exists).
|
||||
func (s *MessagesEmojiGameInfoClassArray) PopFirstAsAvailable() (v *MessagesEmojiGameDiceInfo, ok bool) {
|
||||
value, ok := s.PopFirst()
|
||||
if !ok {
|
||||
return
|
||||
}
|
||||
return value.AsAvailable()
|
||||
}
|
||||
|
||||
// PopAsAvailable returns element of slice (if exists).
|
||||
func (s *MessagesEmojiGameInfoClassArray) PopAsAvailable() (v *MessagesEmojiGameDiceInfo, ok bool) {
|
||||
value, ok := s.Pop()
|
||||
if !ok {
|
||||
return
|
||||
}
|
||||
return value.AsAvailable()
|
||||
}
|
||||
|
||||
// MessagesEmojiGameDiceInfoArray is adapter for slice of MessagesEmojiGameDiceInfo.
|
||||
type MessagesEmojiGameDiceInfoArray []MessagesEmojiGameDiceInfo
|
||||
|
||||
// Sort sorts slice of MessagesEmojiGameDiceInfo.
|
||||
func (s MessagesEmojiGameDiceInfoArray) Sort(less func(a, b MessagesEmojiGameDiceInfo) bool) MessagesEmojiGameDiceInfoArray {
|
||||
sort.Slice(s, func(i, j int) bool {
|
||||
return less(s[i], s[j])
|
||||
})
|
||||
return s
|
||||
}
|
||||
|
||||
// SortStable sorts slice of MessagesEmojiGameDiceInfo.
|
||||
func (s MessagesEmojiGameDiceInfoArray) SortStable(less func(a, b MessagesEmojiGameDiceInfo) bool) MessagesEmojiGameDiceInfoArray {
|
||||
sort.SliceStable(s, func(i, j int) bool {
|
||||
return less(s[i], s[j])
|
||||
})
|
||||
return s
|
||||
}
|
||||
|
||||
// Retain filters in-place slice of MessagesEmojiGameDiceInfo.
|
||||
func (s MessagesEmojiGameDiceInfoArray) Retain(keep func(x MessagesEmojiGameDiceInfo) bool) MessagesEmojiGameDiceInfoArray {
|
||||
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 MessagesEmojiGameDiceInfoArray) First() (v MessagesEmojiGameDiceInfo, ok bool) {
|
||||
if len(s) < 1 {
|
||||
return
|
||||
}
|
||||
return s[0], true
|
||||
}
|
||||
|
||||
// Last returns last element of slice (if exists).
|
||||
func (s MessagesEmojiGameDiceInfoArray) Last() (v MessagesEmojiGameDiceInfo, 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 *MessagesEmojiGameDiceInfoArray) PopFirst() (v MessagesEmojiGameDiceInfo, 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 MessagesEmojiGameDiceInfo
|
||||
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 *MessagesEmojiGameDiceInfoArray) Pop() (v MessagesEmojiGameDiceInfo, 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
|
||||
}
|
||||
+215
@@ -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{}
|
||||
)
|
||||
|
||||
// MessagesEmojiGameOutcome represents TL type `messages.emojiGameOutcome#da2ad647`.
|
||||
//
|
||||
// See https://core.telegram.org/constructor/messages.emojiGameOutcome for reference.
|
||||
type MessagesEmojiGameOutcome struct {
|
||||
// Seed field of MessagesEmojiGameOutcome.
|
||||
Seed []byte
|
||||
// StakeTonAmount field of MessagesEmojiGameOutcome.
|
||||
StakeTonAmount int64
|
||||
// TonAmount field of MessagesEmojiGameOutcome.
|
||||
TonAmount int64
|
||||
}
|
||||
|
||||
// MessagesEmojiGameOutcomeTypeID is TL type id of MessagesEmojiGameOutcome.
|
||||
const MessagesEmojiGameOutcomeTypeID = 0xda2ad647
|
||||
|
||||
// Ensuring interfaces in compile-time for MessagesEmojiGameOutcome.
|
||||
var (
|
||||
_ bin.Encoder = &MessagesEmojiGameOutcome{}
|
||||
_ bin.Decoder = &MessagesEmojiGameOutcome{}
|
||||
_ bin.BareEncoder = &MessagesEmojiGameOutcome{}
|
||||
_ bin.BareDecoder = &MessagesEmojiGameOutcome{}
|
||||
)
|
||||
|
||||
func (e *MessagesEmojiGameOutcome) Zero() bool {
|
||||
if e == nil {
|
||||
return true
|
||||
}
|
||||
if !(e.Seed == nil) {
|
||||
return false
|
||||
}
|
||||
if !(e.StakeTonAmount == 0) {
|
||||
return false
|
||||
}
|
||||
if !(e.TonAmount == 0) {
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
// String implements fmt.Stringer.
|
||||
func (e *MessagesEmojiGameOutcome) String() string {
|
||||
if e == nil {
|
||||
return "MessagesEmojiGameOutcome(nil)"
|
||||
}
|
||||
type Alias MessagesEmojiGameOutcome
|
||||
return fmt.Sprintf("MessagesEmojiGameOutcome%+v", Alias(*e))
|
||||
}
|
||||
|
||||
// FillFrom fills MessagesEmojiGameOutcome from given interface.
|
||||
func (e *MessagesEmojiGameOutcome) FillFrom(from interface {
|
||||
GetSeed() (value []byte)
|
||||
GetStakeTonAmount() (value int64)
|
||||
GetTonAmount() (value int64)
|
||||
}) {
|
||||
e.Seed = from.GetSeed()
|
||||
e.StakeTonAmount = from.GetStakeTonAmount()
|
||||
e.TonAmount = from.GetTonAmount()
|
||||
}
|
||||
|
||||
// TypeID returns type id in TL schema.
|
||||
//
|
||||
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
||||
func (*MessagesEmojiGameOutcome) TypeID() uint32 {
|
||||
return MessagesEmojiGameOutcomeTypeID
|
||||
}
|
||||
|
||||
// TypeName returns name of type in TL schema.
|
||||
func (*MessagesEmojiGameOutcome) TypeName() string {
|
||||
return "messages.emojiGameOutcome"
|
||||
}
|
||||
|
||||
// TypeInfo returns info about TL type.
|
||||
func (e *MessagesEmojiGameOutcome) TypeInfo() tdp.Type {
|
||||
typ := tdp.Type{
|
||||
Name: "messages.emojiGameOutcome",
|
||||
ID: MessagesEmojiGameOutcomeTypeID,
|
||||
}
|
||||
if e == nil {
|
||||
typ.Null = true
|
||||
return typ
|
||||
}
|
||||
typ.Fields = []tdp.Field{
|
||||
{
|
||||
Name: "Seed",
|
||||
SchemaName: "seed",
|
||||
},
|
||||
{
|
||||
Name: "StakeTonAmount",
|
||||
SchemaName: "stake_ton_amount",
|
||||
},
|
||||
{
|
||||
Name: "TonAmount",
|
||||
SchemaName: "ton_amount",
|
||||
},
|
||||
}
|
||||
return typ
|
||||
}
|
||||
|
||||
// Encode implements bin.Encoder.
|
||||
func (e *MessagesEmojiGameOutcome) Encode(b *bin.Buffer) error {
|
||||
if e == nil {
|
||||
return fmt.Errorf("can't encode messages.emojiGameOutcome#da2ad647 as nil")
|
||||
}
|
||||
b.PutID(MessagesEmojiGameOutcomeTypeID)
|
||||
return e.EncodeBare(b)
|
||||
}
|
||||
|
||||
// EncodeBare implements bin.BareEncoder.
|
||||
func (e *MessagesEmojiGameOutcome) EncodeBare(b *bin.Buffer) error {
|
||||
if e == nil {
|
||||
return fmt.Errorf("can't encode messages.emojiGameOutcome#da2ad647 as nil")
|
||||
}
|
||||
b.PutBytes(e.Seed)
|
||||
b.PutLong(e.StakeTonAmount)
|
||||
b.PutLong(e.TonAmount)
|
||||
return nil
|
||||
}
|
||||
|
||||
// Decode implements bin.Decoder.
|
||||
func (e *MessagesEmojiGameOutcome) Decode(b *bin.Buffer) error {
|
||||
if e == nil {
|
||||
return fmt.Errorf("can't decode messages.emojiGameOutcome#da2ad647 to nil")
|
||||
}
|
||||
if err := b.ConsumeID(MessagesEmojiGameOutcomeTypeID); err != nil {
|
||||
return fmt.Errorf("unable to decode messages.emojiGameOutcome#da2ad647: %w", err)
|
||||
}
|
||||
return e.DecodeBare(b)
|
||||
}
|
||||
|
||||
// DecodeBare implements bin.BareDecoder.
|
||||
func (e *MessagesEmojiGameOutcome) DecodeBare(b *bin.Buffer) error {
|
||||
if e == nil {
|
||||
return fmt.Errorf("can't decode messages.emojiGameOutcome#da2ad647 to nil")
|
||||
}
|
||||
{
|
||||
value, err := b.Bytes()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode messages.emojiGameOutcome#da2ad647: field seed: %w", err)
|
||||
}
|
||||
e.Seed = value
|
||||
}
|
||||
{
|
||||
value, err := b.Long()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode messages.emojiGameOutcome#da2ad647: field stake_ton_amount: %w", err)
|
||||
}
|
||||
e.StakeTonAmount = value
|
||||
}
|
||||
{
|
||||
value, err := b.Long()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode messages.emojiGameOutcome#da2ad647: field ton_amount: %w", err)
|
||||
}
|
||||
e.TonAmount = value
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// GetSeed returns value of Seed field.
|
||||
func (e *MessagesEmojiGameOutcome) GetSeed() (value []byte) {
|
||||
if e == nil {
|
||||
return
|
||||
}
|
||||
return e.Seed
|
||||
}
|
||||
|
||||
// GetStakeTonAmount returns value of StakeTonAmount field.
|
||||
func (e *MessagesEmojiGameOutcome) GetStakeTonAmount() (value int64) {
|
||||
if e == nil {
|
||||
return
|
||||
}
|
||||
return e.StakeTonAmount
|
||||
}
|
||||
|
||||
// GetTonAmount returns value of TonAmount field.
|
||||
func (e *MessagesEmojiGameOutcome) GetTonAmount() (value int64) {
|
||||
if e == nil {
|
||||
return
|
||||
}
|
||||
return e.TonAmount
|
||||
}
|
||||
@@ -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{}
|
||||
)
|
||||
+84
-36
@@ -31,7 +31,7 @@ var (
|
||||
_ = tdjson.Encoder{}
|
||||
)
|
||||
|
||||
// MessagesForwardMessagesRequest represents TL type `messages.forwardMessages#41d41ade`.
|
||||
// MessagesForwardMessagesRequest represents TL type `messages.forwardMessages#13704a7c`.
|
||||
// Forwards messages by their IDs.
|
||||
//
|
||||
// See https://core.telegram.org/method/messages.forwardMessages for reference.
|
||||
@@ -108,6 +108,10 @@ type MessagesForwardMessagesRequest struct {
|
||||
//
|
||||
// Use SetQuickReplyShortcut and GetQuickReplyShortcut helpers.
|
||||
QuickReplyShortcut InputQuickReplyShortcutClass
|
||||
// Effect field of MessagesForwardMessagesRequest.
|
||||
//
|
||||
// Use SetEffect and GetEffect helpers.
|
||||
Effect int64
|
||||
// Start playing the video at the specified timestamp (seconds).
|
||||
//
|
||||
// Use SetVideoTimestamp and GetVideoTimestamp helpers.
|
||||
@@ -131,7 +135,7 @@ type MessagesForwardMessagesRequest struct {
|
||||
}
|
||||
|
||||
// MessagesForwardMessagesRequestTypeID is TL type id of MessagesForwardMessagesRequest.
|
||||
const MessagesForwardMessagesRequestTypeID = 0x41d41ade
|
||||
const MessagesForwardMessagesRequestTypeID = 0x13704a7c
|
||||
|
||||
// Ensuring interfaces in compile-time for MessagesForwardMessagesRequest.
|
||||
var (
|
||||
@@ -199,6 +203,9 @@ func (f *MessagesForwardMessagesRequest) Zero() bool {
|
||||
if !(f.QuickReplyShortcut == nil) {
|
||||
return false
|
||||
}
|
||||
if !(f.Effect == 0) {
|
||||
return false
|
||||
}
|
||||
if !(f.VideoTimestamp == 0) {
|
||||
return false
|
||||
}
|
||||
@@ -240,6 +247,7 @@ func (f *MessagesForwardMessagesRequest) FillFrom(from interface {
|
||||
GetScheduleRepeatPeriod() (value int, ok bool)
|
||||
GetSendAs() (value InputPeerClass, ok bool)
|
||||
GetQuickReplyShortcut() (value InputQuickReplyShortcutClass, ok bool)
|
||||
GetEffect() (value int64, ok bool)
|
||||
GetVideoTimestamp() (value int, ok bool)
|
||||
GetAllowPaidStars() (value int64, ok bool)
|
||||
GetSuggestedPost() (value SuggestedPost, ok bool)
|
||||
@@ -279,6 +287,10 @@ func (f *MessagesForwardMessagesRequest) FillFrom(from interface {
|
||||
f.QuickReplyShortcut = val
|
||||
}
|
||||
|
||||
if val, ok := from.GetEffect(); ok {
|
||||
f.Effect = val
|
||||
}
|
||||
|
||||
if val, ok := from.GetVideoTimestamp(); ok {
|
||||
f.VideoTimestamp = val
|
||||
}
|
||||
@@ -397,6 +409,11 @@ func (f *MessagesForwardMessagesRequest) TypeInfo() tdp.Type {
|
||||
SchemaName: "quick_reply_shortcut",
|
||||
Null: !f.Flags.Has(17),
|
||||
},
|
||||
{
|
||||
Name: "Effect",
|
||||
SchemaName: "effect",
|
||||
Null: !f.Flags.Has(18),
|
||||
},
|
||||
{
|
||||
Name: "VideoTimestamp",
|
||||
SchemaName: "video_timestamp",
|
||||
@@ -457,6 +474,9 @@ func (f *MessagesForwardMessagesRequest) SetFlags() {
|
||||
if !(f.QuickReplyShortcut == nil) {
|
||||
f.Flags.Set(17)
|
||||
}
|
||||
if !(f.Effect == 0) {
|
||||
f.Flags.Set(18)
|
||||
}
|
||||
if !(f.VideoTimestamp == 0) {
|
||||
f.Flags.Set(20)
|
||||
}
|
||||
@@ -471,7 +491,7 @@ func (f *MessagesForwardMessagesRequest) SetFlags() {
|
||||
// Encode implements bin.Encoder.
|
||||
func (f *MessagesForwardMessagesRequest) Encode(b *bin.Buffer) error {
|
||||
if f == nil {
|
||||
return fmt.Errorf("can't encode messages.forwardMessages#41d41ade as nil")
|
||||
return fmt.Errorf("can't encode messages.forwardMessages#13704a7c as nil")
|
||||
}
|
||||
b.PutID(MessagesForwardMessagesRequestTypeID)
|
||||
return f.EncodeBare(b)
|
||||
@@ -480,17 +500,17 @@ func (f *MessagesForwardMessagesRequest) Encode(b *bin.Buffer) error {
|
||||
// EncodeBare implements bin.BareEncoder.
|
||||
func (f *MessagesForwardMessagesRequest) EncodeBare(b *bin.Buffer) error {
|
||||
if f == nil {
|
||||
return fmt.Errorf("can't encode messages.forwardMessages#41d41ade as nil")
|
||||
return fmt.Errorf("can't encode messages.forwardMessages#13704a7c as nil")
|
||||
}
|
||||
f.SetFlags()
|
||||
if err := f.Flags.Encode(b); err != nil {
|
||||
return fmt.Errorf("unable to encode messages.forwardMessages#41d41ade: field flags: %w", err)
|
||||
return fmt.Errorf("unable to encode messages.forwardMessages#13704a7c: field flags: %w", err)
|
||||
}
|
||||
if f.FromPeer == nil {
|
||||
return fmt.Errorf("unable to encode messages.forwardMessages#41d41ade: field from_peer is nil")
|
||||
return fmt.Errorf("unable to encode messages.forwardMessages#13704a7c: field from_peer is nil")
|
||||
}
|
||||
if err := f.FromPeer.Encode(b); err != nil {
|
||||
return fmt.Errorf("unable to encode messages.forwardMessages#41d41ade: field from_peer: %w", err)
|
||||
return fmt.Errorf("unable to encode messages.forwardMessages#13704a7c: field from_peer: %w", err)
|
||||
}
|
||||
b.PutVectorHeader(len(f.ID))
|
||||
for _, v := range f.ID {
|
||||
@@ -501,20 +521,20 @@ func (f *MessagesForwardMessagesRequest) EncodeBare(b *bin.Buffer) error {
|
||||
b.PutLong(v)
|
||||
}
|
||||
if f.ToPeer == nil {
|
||||
return fmt.Errorf("unable to encode messages.forwardMessages#41d41ade: field to_peer is nil")
|
||||
return fmt.Errorf("unable to encode messages.forwardMessages#13704a7c: field to_peer is nil")
|
||||
}
|
||||
if err := f.ToPeer.Encode(b); err != nil {
|
||||
return fmt.Errorf("unable to encode messages.forwardMessages#41d41ade: field to_peer: %w", err)
|
||||
return fmt.Errorf("unable to encode messages.forwardMessages#13704a7c: field to_peer: %w", err)
|
||||
}
|
||||
if f.Flags.Has(9) {
|
||||
b.PutInt(f.TopMsgID)
|
||||
}
|
||||
if f.Flags.Has(22) {
|
||||
if f.ReplyTo == nil {
|
||||
return fmt.Errorf("unable to encode messages.forwardMessages#41d41ade: field reply_to is nil")
|
||||
return fmt.Errorf("unable to encode messages.forwardMessages#13704a7c: field reply_to is nil")
|
||||
}
|
||||
if err := f.ReplyTo.Encode(b); err != nil {
|
||||
return fmt.Errorf("unable to encode messages.forwardMessages#41d41ade: field reply_to: %w", err)
|
||||
return fmt.Errorf("unable to encode messages.forwardMessages#13704a7c: field reply_to: %w", err)
|
||||
}
|
||||
}
|
||||
if f.Flags.Has(10) {
|
||||
@@ -525,20 +545,23 @@ func (f *MessagesForwardMessagesRequest) EncodeBare(b *bin.Buffer) error {
|
||||
}
|
||||
if f.Flags.Has(13) {
|
||||
if f.SendAs == nil {
|
||||
return fmt.Errorf("unable to encode messages.forwardMessages#41d41ade: field send_as is nil")
|
||||
return fmt.Errorf("unable to encode messages.forwardMessages#13704a7c: field send_as is nil")
|
||||
}
|
||||
if err := f.SendAs.Encode(b); err != nil {
|
||||
return fmt.Errorf("unable to encode messages.forwardMessages#41d41ade: field send_as: %w", err)
|
||||
return fmt.Errorf("unable to encode messages.forwardMessages#13704a7c: field send_as: %w", err)
|
||||
}
|
||||
}
|
||||
if f.Flags.Has(17) {
|
||||
if f.QuickReplyShortcut == nil {
|
||||
return fmt.Errorf("unable to encode messages.forwardMessages#41d41ade: field quick_reply_shortcut is nil")
|
||||
return fmt.Errorf("unable to encode messages.forwardMessages#13704a7c: field quick_reply_shortcut is nil")
|
||||
}
|
||||
if err := f.QuickReplyShortcut.Encode(b); err != nil {
|
||||
return fmt.Errorf("unable to encode messages.forwardMessages#41d41ade: field quick_reply_shortcut: %w", err)
|
||||
return fmt.Errorf("unable to encode messages.forwardMessages#13704a7c: field quick_reply_shortcut: %w", err)
|
||||
}
|
||||
}
|
||||
if f.Flags.Has(18) {
|
||||
b.PutLong(f.Effect)
|
||||
}
|
||||
if f.Flags.Has(20) {
|
||||
b.PutInt(f.VideoTimestamp)
|
||||
}
|
||||
@@ -547,7 +570,7 @@ func (f *MessagesForwardMessagesRequest) EncodeBare(b *bin.Buffer) error {
|
||||
}
|
||||
if f.Flags.Has(23) {
|
||||
if err := f.SuggestedPost.Encode(b); err != nil {
|
||||
return fmt.Errorf("unable to encode messages.forwardMessages#41d41ade: field suggested_post: %w", err)
|
||||
return fmt.Errorf("unable to encode messages.forwardMessages#13704a7c: field suggested_post: %w", err)
|
||||
}
|
||||
}
|
||||
return nil
|
||||
@@ -556,10 +579,10 @@ func (f *MessagesForwardMessagesRequest) EncodeBare(b *bin.Buffer) error {
|
||||
// Decode implements bin.Decoder.
|
||||
func (f *MessagesForwardMessagesRequest) Decode(b *bin.Buffer) error {
|
||||
if f == nil {
|
||||
return fmt.Errorf("can't decode messages.forwardMessages#41d41ade to nil")
|
||||
return fmt.Errorf("can't decode messages.forwardMessages#13704a7c to nil")
|
||||
}
|
||||
if err := b.ConsumeID(MessagesForwardMessagesRequestTypeID); err != nil {
|
||||
return fmt.Errorf("unable to decode messages.forwardMessages#41d41ade: %w", err)
|
||||
return fmt.Errorf("unable to decode messages.forwardMessages#13704a7c: %w", err)
|
||||
}
|
||||
return f.DecodeBare(b)
|
||||
}
|
||||
@@ -567,11 +590,11 @@ func (f *MessagesForwardMessagesRequest) Decode(b *bin.Buffer) error {
|
||||
// DecodeBare implements bin.BareDecoder.
|
||||
func (f *MessagesForwardMessagesRequest) DecodeBare(b *bin.Buffer) error {
|
||||
if f == nil {
|
||||
return fmt.Errorf("can't decode messages.forwardMessages#41d41ade to nil")
|
||||
return fmt.Errorf("can't decode messages.forwardMessages#13704a7c to nil")
|
||||
}
|
||||
{
|
||||
if err := f.Flags.Decode(b); err != nil {
|
||||
return fmt.Errorf("unable to decode messages.forwardMessages#41d41ade: field flags: %w", err)
|
||||
return fmt.Errorf("unable to decode messages.forwardMessages#13704a7c: field flags: %w", err)
|
||||
}
|
||||
}
|
||||
f.Silent = f.Flags.Has(5)
|
||||
@@ -584,14 +607,14 @@ func (f *MessagesForwardMessagesRequest) DecodeBare(b *bin.Buffer) error {
|
||||
{
|
||||
value, err := DecodeInputPeer(b)
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode messages.forwardMessages#41d41ade: field from_peer: %w", err)
|
||||
return fmt.Errorf("unable to decode messages.forwardMessages#13704a7c: field from_peer: %w", err)
|
||||
}
|
||||
f.FromPeer = value
|
||||
}
|
||||
{
|
||||
headerLen, err := b.VectorHeader()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode messages.forwardMessages#41d41ade: field id: %w", err)
|
||||
return fmt.Errorf("unable to decode messages.forwardMessages#13704a7c: field id: %w", err)
|
||||
}
|
||||
|
||||
if headerLen > 0 {
|
||||
@@ -600,7 +623,7 @@ func (f *MessagesForwardMessagesRequest) DecodeBare(b *bin.Buffer) error {
|
||||
for idx := 0; idx < headerLen; idx++ {
|
||||
value, err := b.Int()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode messages.forwardMessages#41d41ade: field id: %w", err)
|
||||
return fmt.Errorf("unable to decode messages.forwardMessages#13704a7c: field id: %w", err)
|
||||
}
|
||||
f.ID = append(f.ID, value)
|
||||
}
|
||||
@@ -608,7 +631,7 @@ func (f *MessagesForwardMessagesRequest) DecodeBare(b *bin.Buffer) error {
|
||||
{
|
||||
headerLen, err := b.VectorHeader()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode messages.forwardMessages#41d41ade: field random_id: %w", err)
|
||||
return fmt.Errorf("unable to decode messages.forwardMessages#13704a7c: field random_id: %w", err)
|
||||
}
|
||||
|
||||
if headerLen > 0 {
|
||||
@@ -617,7 +640,7 @@ func (f *MessagesForwardMessagesRequest) DecodeBare(b *bin.Buffer) error {
|
||||
for idx := 0; idx < headerLen; idx++ {
|
||||
value, err := b.Long()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode messages.forwardMessages#41d41ade: field random_id: %w", err)
|
||||
return fmt.Errorf("unable to decode messages.forwardMessages#13704a7c: field random_id: %w", err)
|
||||
}
|
||||
f.RandomID = append(f.RandomID, value)
|
||||
}
|
||||
@@ -625,69 +648,76 @@ func (f *MessagesForwardMessagesRequest) DecodeBare(b *bin.Buffer) error {
|
||||
{
|
||||
value, err := DecodeInputPeer(b)
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode messages.forwardMessages#41d41ade: field to_peer: %w", err)
|
||||
return fmt.Errorf("unable to decode messages.forwardMessages#13704a7c: field to_peer: %w", err)
|
||||
}
|
||||
f.ToPeer = value
|
||||
}
|
||||
if f.Flags.Has(9) {
|
||||
value, err := b.Int()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode messages.forwardMessages#41d41ade: field top_msg_id: %w", err)
|
||||
return fmt.Errorf("unable to decode messages.forwardMessages#13704a7c: field top_msg_id: %w", err)
|
||||
}
|
||||
f.TopMsgID = value
|
||||
}
|
||||
if f.Flags.Has(22) {
|
||||
value, err := DecodeInputReplyTo(b)
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode messages.forwardMessages#41d41ade: field reply_to: %w", err)
|
||||
return fmt.Errorf("unable to decode messages.forwardMessages#13704a7c: field reply_to: %w", err)
|
||||
}
|
||||
f.ReplyTo = value
|
||||
}
|
||||
if f.Flags.Has(10) {
|
||||
value, err := b.Int()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode messages.forwardMessages#41d41ade: field schedule_date: %w", err)
|
||||
return fmt.Errorf("unable to decode messages.forwardMessages#13704a7c: field schedule_date: %w", err)
|
||||
}
|
||||
f.ScheduleDate = value
|
||||
}
|
||||
if f.Flags.Has(24) {
|
||||
value, err := b.Int()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode messages.forwardMessages#41d41ade: field schedule_repeat_period: %w", err)
|
||||
return fmt.Errorf("unable to decode messages.forwardMessages#13704a7c: field schedule_repeat_period: %w", err)
|
||||
}
|
||||
f.ScheduleRepeatPeriod = value
|
||||
}
|
||||
if f.Flags.Has(13) {
|
||||
value, err := DecodeInputPeer(b)
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode messages.forwardMessages#41d41ade: field send_as: %w", err)
|
||||
return fmt.Errorf("unable to decode messages.forwardMessages#13704a7c: field send_as: %w", err)
|
||||
}
|
||||
f.SendAs = value
|
||||
}
|
||||
if f.Flags.Has(17) {
|
||||
value, err := DecodeInputQuickReplyShortcut(b)
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode messages.forwardMessages#41d41ade: field quick_reply_shortcut: %w", err)
|
||||
return fmt.Errorf("unable to decode messages.forwardMessages#13704a7c: field quick_reply_shortcut: %w", err)
|
||||
}
|
||||
f.QuickReplyShortcut = value
|
||||
}
|
||||
if f.Flags.Has(18) {
|
||||
value, err := b.Long()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode messages.forwardMessages#13704a7c: field effect: %w", err)
|
||||
}
|
||||
f.Effect = value
|
||||
}
|
||||
if f.Flags.Has(20) {
|
||||
value, err := b.Int()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode messages.forwardMessages#41d41ade: field video_timestamp: %w", err)
|
||||
return fmt.Errorf("unable to decode messages.forwardMessages#13704a7c: field video_timestamp: %w", err)
|
||||
}
|
||||
f.VideoTimestamp = value
|
||||
}
|
||||
if f.Flags.Has(21) {
|
||||
value, err := b.Long()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode messages.forwardMessages#41d41ade: field allow_paid_stars: %w", err)
|
||||
return fmt.Errorf("unable to decode messages.forwardMessages#13704a7c: field allow_paid_stars: %w", err)
|
||||
}
|
||||
f.AllowPaidStars = value
|
||||
}
|
||||
if f.Flags.Has(23) {
|
||||
if err := f.SuggestedPost.Decode(b); err != nil {
|
||||
return fmt.Errorf("unable to decode messages.forwardMessages#41d41ade: field suggested_post: %w", err)
|
||||
return fmt.Errorf("unable to decode messages.forwardMessages#13704a7c: field suggested_post: %w", err)
|
||||
}
|
||||
}
|
||||
return nil
|
||||
@@ -966,6 +996,24 @@ func (f *MessagesForwardMessagesRequest) GetQuickReplyShortcut() (value InputQui
|
||||
return f.QuickReplyShortcut, true
|
||||
}
|
||||
|
||||
// SetEffect sets value of Effect conditional field.
|
||||
func (f *MessagesForwardMessagesRequest) SetEffect(value int64) {
|
||||
f.Flags.Set(18)
|
||||
f.Effect = value
|
||||
}
|
||||
|
||||
// GetEffect returns value of Effect conditional field and
|
||||
// boolean which is true if field was set.
|
||||
func (f *MessagesForwardMessagesRequest) GetEffect() (value int64, ok bool) {
|
||||
if f == nil {
|
||||
return
|
||||
}
|
||||
if !f.Flags.Has(18) {
|
||||
return value, false
|
||||
}
|
||||
return f.Effect, true
|
||||
}
|
||||
|
||||
// SetVideoTimestamp sets value of VideoTimestamp conditional field.
|
||||
func (f *MessagesForwardMessagesRequest) SetVideoTimestamp(value int) {
|
||||
f.Flags.Set(20)
|
||||
@@ -1020,7 +1068,7 @@ func (f *MessagesForwardMessagesRequest) GetSuggestedPost() (value SuggestedPost
|
||||
return f.SuggestedPost, true
|
||||
}
|
||||
|
||||
// MessagesForwardMessages invokes method messages.forwardMessages#41d41ade returning error if any.
|
||||
// MessagesForwardMessages invokes method messages.forwardMessages#13704a7c returning error if any.
|
||||
// Forwards messages by their IDs.
|
||||
//
|
||||
// Possible errors:
|
||||
|
||||
+141
@@ -0,0 +1,141 @@
|
||||
// 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{}
|
||||
)
|
||||
|
||||
// MessagesGetEmojiGameInfoRequest represents TL type `messages.getEmojiGameInfo#fb7e8ca7`.
|
||||
//
|
||||
// See https://core.telegram.org/method/messages.getEmojiGameInfo for reference.
|
||||
type MessagesGetEmojiGameInfoRequest struct {
|
||||
}
|
||||
|
||||
// MessagesGetEmojiGameInfoRequestTypeID is TL type id of MessagesGetEmojiGameInfoRequest.
|
||||
const MessagesGetEmojiGameInfoRequestTypeID = 0xfb7e8ca7
|
||||
|
||||
// Ensuring interfaces in compile-time for MessagesGetEmojiGameInfoRequest.
|
||||
var (
|
||||
_ bin.Encoder = &MessagesGetEmojiGameInfoRequest{}
|
||||
_ bin.Decoder = &MessagesGetEmojiGameInfoRequest{}
|
||||
_ bin.BareEncoder = &MessagesGetEmojiGameInfoRequest{}
|
||||
_ bin.BareDecoder = &MessagesGetEmojiGameInfoRequest{}
|
||||
)
|
||||
|
||||
func (g *MessagesGetEmojiGameInfoRequest) Zero() bool {
|
||||
if g == nil {
|
||||
return true
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
// String implements fmt.Stringer.
|
||||
func (g *MessagesGetEmojiGameInfoRequest) String() string {
|
||||
if g == nil {
|
||||
return "MessagesGetEmojiGameInfoRequest(nil)"
|
||||
}
|
||||
type Alias MessagesGetEmojiGameInfoRequest
|
||||
return fmt.Sprintf("MessagesGetEmojiGameInfoRequest%+v", Alias(*g))
|
||||
}
|
||||
|
||||
// TypeID returns type id in TL schema.
|
||||
//
|
||||
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
||||
func (*MessagesGetEmojiGameInfoRequest) TypeID() uint32 {
|
||||
return MessagesGetEmojiGameInfoRequestTypeID
|
||||
}
|
||||
|
||||
// TypeName returns name of type in TL schema.
|
||||
func (*MessagesGetEmojiGameInfoRequest) TypeName() string {
|
||||
return "messages.getEmojiGameInfo"
|
||||
}
|
||||
|
||||
// TypeInfo returns info about TL type.
|
||||
func (g *MessagesGetEmojiGameInfoRequest) TypeInfo() tdp.Type {
|
||||
typ := tdp.Type{
|
||||
Name: "messages.getEmojiGameInfo",
|
||||
ID: MessagesGetEmojiGameInfoRequestTypeID,
|
||||
}
|
||||
if g == nil {
|
||||
typ.Null = true
|
||||
return typ
|
||||
}
|
||||
typ.Fields = []tdp.Field{}
|
||||
return typ
|
||||
}
|
||||
|
||||
// Encode implements bin.Encoder.
|
||||
func (g *MessagesGetEmojiGameInfoRequest) Encode(b *bin.Buffer) error {
|
||||
if g == nil {
|
||||
return fmt.Errorf("can't encode messages.getEmojiGameInfo#fb7e8ca7 as nil")
|
||||
}
|
||||
b.PutID(MessagesGetEmojiGameInfoRequestTypeID)
|
||||
return g.EncodeBare(b)
|
||||
}
|
||||
|
||||
// EncodeBare implements bin.BareEncoder.
|
||||
func (g *MessagesGetEmojiGameInfoRequest) EncodeBare(b *bin.Buffer) error {
|
||||
if g == nil {
|
||||
return fmt.Errorf("can't encode messages.getEmojiGameInfo#fb7e8ca7 as nil")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Decode implements bin.Decoder.
|
||||
func (g *MessagesGetEmojiGameInfoRequest) Decode(b *bin.Buffer) error {
|
||||
if g == nil {
|
||||
return fmt.Errorf("can't decode messages.getEmojiGameInfo#fb7e8ca7 to nil")
|
||||
}
|
||||
if err := b.ConsumeID(MessagesGetEmojiGameInfoRequestTypeID); err != nil {
|
||||
return fmt.Errorf("unable to decode messages.getEmojiGameInfo#fb7e8ca7: %w", err)
|
||||
}
|
||||
return g.DecodeBare(b)
|
||||
}
|
||||
|
||||
// DecodeBare implements bin.BareDecoder.
|
||||
func (g *MessagesGetEmojiGameInfoRequest) DecodeBare(b *bin.Buffer) error {
|
||||
if g == nil {
|
||||
return fmt.Errorf("can't decode messages.getEmojiGameInfo#fb7e8ca7 to nil")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// MessagesGetEmojiGameInfo invokes method messages.getEmojiGameInfo#fb7e8ca7 returning error if any.
|
||||
//
|
||||
// See https://core.telegram.org/method/messages.getEmojiGameInfo for reference.
|
||||
func (c *Client) MessagesGetEmojiGameInfo(ctx context.Context) (MessagesEmojiGameInfoClass, error) {
|
||||
var result MessagesEmojiGameInfoBox
|
||||
|
||||
request := &MessagesGetEmojiGameInfoRequest{}
|
||||
if err := c.rpc.Invoke(ctx, request, &result); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return result.EmojiGameInfo, 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,181 @@
|
||||
// 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{}
|
||||
)
|
||||
|
||||
// MessagesGetFutureChatCreatorAfterLeaveRequest represents TL type `messages.getFutureChatCreatorAfterLeave#3b7d0ea6`.
|
||||
//
|
||||
// See https://core.telegram.org/method/messages.getFutureChatCreatorAfterLeave for reference.
|
||||
type MessagesGetFutureChatCreatorAfterLeaveRequest struct {
|
||||
// Peer field of MessagesGetFutureChatCreatorAfterLeaveRequest.
|
||||
Peer InputPeerClass
|
||||
}
|
||||
|
||||
// MessagesGetFutureChatCreatorAfterLeaveRequestTypeID is TL type id of MessagesGetFutureChatCreatorAfterLeaveRequest.
|
||||
const MessagesGetFutureChatCreatorAfterLeaveRequestTypeID = 0x3b7d0ea6
|
||||
|
||||
// Ensuring interfaces in compile-time for MessagesGetFutureChatCreatorAfterLeaveRequest.
|
||||
var (
|
||||
_ bin.Encoder = &MessagesGetFutureChatCreatorAfterLeaveRequest{}
|
||||
_ bin.Decoder = &MessagesGetFutureChatCreatorAfterLeaveRequest{}
|
||||
_ bin.BareEncoder = &MessagesGetFutureChatCreatorAfterLeaveRequest{}
|
||||
_ bin.BareDecoder = &MessagesGetFutureChatCreatorAfterLeaveRequest{}
|
||||
)
|
||||
|
||||
func (g *MessagesGetFutureChatCreatorAfterLeaveRequest) Zero() bool {
|
||||
if g == nil {
|
||||
return true
|
||||
}
|
||||
if !(g.Peer == nil) {
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
// String implements fmt.Stringer.
|
||||
func (g *MessagesGetFutureChatCreatorAfterLeaveRequest) String() string {
|
||||
if g == nil {
|
||||
return "MessagesGetFutureChatCreatorAfterLeaveRequest(nil)"
|
||||
}
|
||||
type Alias MessagesGetFutureChatCreatorAfterLeaveRequest
|
||||
return fmt.Sprintf("MessagesGetFutureChatCreatorAfterLeaveRequest%+v", Alias(*g))
|
||||
}
|
||||
|
||||
// FillFrom fills MessagesGetFutureChatCreatorAfterLeaveRequest from given interface.
|
||||
func (g *MessagesGetFutureChatCreatorAfterLeaveRequest) FillFrom(from interface {
|
||||
GetPeer() (value InputPeerClass)
|
||||
}) {
|
||||
g.Peer = from.GetPeer()
|
||||
}
|
||||
|
||||
// TypeID returns type id in TL schema.
|
||||
//
|
||||
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
||||
func (*MessagesGetFutureChatCreatorAfterLeaveRequest) TypeID() uint32 {
|
||||
return MessagesGetFutureChatCreatorAfterLeaveRequestTypeID
|
||||
}
|
||||
|
||||
// TypeName returns name of type in TL schema.
|
||||
func (*MessagesGetFutureChatCreatorAfterLeaveRequest) TypeName() string {
|
||||
return "messages.getFutureChatCreatorAfterLeave"
|
||||
}
|
||||
|
||||
// TypeInfo returns info about TL type.
|
||||
func (g *MessagesGetFutureChatCreatorAfterLeaveRequest) TypeInfo() tdp.Type {
|
||||
typ := tdp.Type{
|
||||
Name: "messages.getFutureChatCreatorAfterLeave",
|
||||
ID: MessagesGetFutureChatCreatorAfterLeaveRequestTypeID,
|
||||
}
|
||||
if g == nil {
|
||||
typ.Null = true
|
||||
return typ
|
||||
}
|
||||
typ.Fields = []tdp.Field{
|
||||
{
|
||||
Name: "Peer",
|
||||
SchemaName: "peer",
|
||||
},
|
||||
}
|
||||
return typ
|
||||
}
|
||||
|
||||
// Encode implements bin.Encoder.
|
||||
func (g *MessagesGetFutureChatCreatorAfterLeaveRequest) Encode(b *bin.Buffer) error {
|
||||
if g == nil {
|
||||
return fmt.Errorf("can't encode messages.getFutureChatCreatorAfterLeave#3b7d0ea6 as nil")
|
||||
}
|
||||
b.PutID(MessagesGetFutureChatCreatorAfterLeaveRequestTypeID)
|
||||
return g.EncodeBare(b)
|
||||
}
|
||||
|
||||
// EncodeBare implements bin.BareEncoder.
|
||||
func (g *MessagesGetFutureChatCreatorAfterLeaveRequest) EncodeBare(b *bin.Buffer) error {
|
||||
if g == nil {
|
||||
return fmt.Errorf("can't encode messages.getFutureChatCreatorAfterLeave#3b7d0ea6 as nil")
|
||||
}
|
||||
if g.Peer == nil {
|
||||
return fmt.Errorf("unable to encode messages.getFutureChatCreatorAfterLeave#3b7d0ea6: field peer is nil")
|
||||
}
|
||||
if err := g.Peer.Encode(b); err != nil {
|
||||
return fmt.Errorf("unable to encode messages.getFutureChatCreatorAfterLeave#3b7d0ea6: field peer: %w", err)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Decode implements bin.Decoder.
|
||||
func (g *MessagesGetFutureChatCreatorAfterLeaveRequest) Decode(b *bin.Buffer) error {
|
||||
if g == nil {
|
||||
return fmt.Errorf("can't decode messages.getFutureChatCreatorAfterLeave#3b7d0ea6 to nil")
|
||||
}
|
||||
if err := b.ConsumeID(MessagesGetFutureChatCreatorAfterLeaveRequestTypeID); err != nil {
|
||||
return fmt.Errorf("unable to decode messages.getFutureChatCreatorAfterLeave#3b7d0ea6: %w", err)
|
||||
}
|
||||
return g.DecodeBare(b)
|
||||
}
|
||||
|
||||
// DecodeBare implements bin.BareDecoder.
|
||||
func (g *MessagesGetFutureChatCreatorAfterLeaveRequest) DecodeBare(b *bin.Buffer) error {
|
||||
if g == nil {
|
||||
return fmt.Errorf("can't decode messages.getFutureChatCreatorAfterLeave#3b7d0ea6 to nil")
|
||||
}
|
||||
{
|
||||
value, err := DecodeInputPeer(b)
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode messages.getFutureChatCreatorAfterLeave#3b7d0ea6: field peer: %w", err)
|
||||
}
|
||||
g.Peer = value
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// GetPeer returns value of Peer field.
|
||||
func (g *MessagesGetFutureChatCreatorAfterLeaveRequest) GetPeer() (value InputPeerClass) {
|
||||
if g == nil {
|
||||
return
|
||||
}
|
||||
return g.Peer
|
||||
}
|
||||
|
||||
// MessagesGetFutureChatCreatorAfterLeave invokes method messages.getFutureChatCreatorAfterLeave#3b7d0ea6 returning error if any.
|
||||
//
|
||||
// See https://core.telegram.org/method/messages.getFutureChatCreatorAfterLeave for reference.
|
||||
func (c *Client) MessagesGetFutureChatCreatorAfterLeave(ctx context.Context, peer InputPeerClass) (UserClass, error) {
|
||||
var result UserBox
|
||||
|
||||
request := &MessagesGetFutureChatCreatorAfterLeaveRequest{
|
||||
Peer: peer,
|
||||
}
|
||||
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{}
|
||||
)
|
||||
+64
-16
@@ -31,7 +31,7 @@ var (
|
||||
_ = tdjson.Encoder{}
|
||||
)
|
||||
|
||||
// MessagesRequestURLAuthRequest represents TL type `messages.requestUrlAuth#198fb446`.
|
||||
// MessagesRequestURLAuthRequest represents TL type `messages.requestUrlAuth#894cc99c`.
|
||||
// Get more info about a Seamless Telegram Login authorization request, for more info
|
||||
// click here »¹
|
||||
//
|
||||
@@ -64,10 +64,14 @@ type MessagesRequestURLAuthRequest struct {
|
||||
//
|
||||
// Use SetURL and GetURL helpers.
|
||||
URL string
|
||||
// InAppOrigin field of MessagesRequestURLAuthRequest.
|
||||
//
|
||||
// Use SetInAppOrigin and GetInAppOrigin helpers.
|
||||
InAppOrigin string
|
||||
}
|
||||
|
||||
// MessagesRequestURLAuthRequestTypeID is TL type id of MessagesRequestURLAuthRequest.
|
||||
const MessagesRequestURLAuthRequestTypeID = 0x198fb446
|
||||
const MessagesRequestURLAuthRequestTypeID = 0x894cc99c
|
||||
|
||||
// Ensuring interfaces in compile-time for MessagesRequestURLAuthRequest.
|
||||
var (
|
||||
@@ -96,6 +100,9 @@ func (r *MessagesRequestURLAuthRequest) Zero() bool {
|
||||
if !(r.URL == "") {
|
||||
return false
|
||||
}
|
||||
if !(r.InAppOrigin == "") {
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
@@ -115,6 +122,7 @@ func (r *MessagesRequestURLAuthRequest) FillFrom(from interface {
|
||||
GetMsgID() (value int, ok bool)
|
||||
GetButtonID() (value int, ok bool)
|
||||
GetURL() (value string, ok bool)
|
||||
GetInAppOrigin() (value string, ok bool)
|
||||
}) {
|
||||
if val, ok := from.GetPeer(); ok {
|
||||
r.Peer = val
|
||||
@@ -132,6 +140,10 @@ func (r *MessagesRequestURLAuthRequest) FillFrom(from interface {
|
||||
r.URL = val
|
||||
}
|
||||
|
||||
if val, ok := from.GetInAppOrigin(); ok {
|
||||
r.InAppOrigin = val
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// TypeID returns type id in TL schema.
|
||||
@@ -177,6 +189,11 @@ func (r *MessagesRequestURLAuthRequest) TypeInfo() tdp.Type {
|
||||
SchemaName: "url",
|
||||
Null: !r.Flags.Has(2),
|
||||
},
|
||||
{
|
||||
Name: "InAppOrigin",
|
||||
SchemaName: "in_app_origin",
|
||||
Null: !r.Flags.Has(3),
|
||||
},
|
||||
}
|
||||
return typ
|
||||
}
|
||||
@@ -195,12 +212,15 @@ func (r *MessagesRequestURLAuthRequest) SetFlags() {
|
||||
if !(r.URL == "") {
|
||||
r.Flags.Set(2)
|
||||
}
|
||||
if !(r.InAppOrigin == "") {
|
||||
r.Flags.Set(3)
|
||||
}
|
||||
}
|
||||
|
||||
// Encode implements bin.Encoder.
|
||||
func (r *MessagesRequestURLAuthRequest) Encode(b *bin.Buffer) error {
|
||||
if r == nil {
|
||||
return fmt.Errorf("can't encode messages.requestUrlAuth#198fb446 as nil")
|
||||
return fmt.Errorf("can't encode messages.requestUrlAuth#894cc99c as nil")
|
||||
}
|
||||
b.PutID(MessagesRequestURLAuthRequestTypeID)
|
||||
return r.EncodeBare(b)
|
||||
@@ -209,18 +229,18 @@ func (r *MessagesRequestURLAuthRequest) Encode(b *bin.Buffer) error {
|
||||
// EncodeBare implements bin.BareEncoder.
|
||||
func (r *MessagesRequestURLAuthRequest) EncodeBare(b *bin.Buffer) error {
|
||||
if r == nil {
|
||||
return fmt.Errorf("can't encode messages.requestUrlAuth#198fb446 as nil")
|
||||
return fmt.Errorf("can't encode messages.requestUrlAuth#894cc99c as nil")
|
||||
}
|
||||
r.SetFlags()
|
||||
if err := r.Flags.Encode(b); err != nil {
|
||||
return fmt.Errorf("unable to encode messages.requestUrlAuth#198fb446: field flags: %w", err)
|
||||
return fmt.Errorf("unable to encode messages.requestUrlAuth#894cc99c: field flags: %w", err)
|
||||
}
|
||||
if r.Flags.Has(1) {
|
||||
if r.Peer == nil {
|
||||
return fmt.Errorf("unable to encode messages.requestUrlAuth#198fb446: field peer is nil")
|
||||
return fmt.Errorf("unable to encode messages.requestUrlAuth#894cc99c: field peer is nil")
|
||||
}
|
||||
if err := r.Peer.Encode(b); err != nil {
|
||||
return fmt.Errorf("unable to encode messages.requestUrlAuth#198fb446: field peer: %w", err)
|
||||
return fmt.Errorf("unable to encode messages.requestUrlAuth#894cc99c: field peer: %w", err)
|
||||
}
|
||||
}
|
||||
if r.Flags.Has(1) {
|
||||
@@ -232,16 +252,19 @@ func (r *MessagesRequestURLAuthRequest) EncodeBare(b *bin.Buffer) error {
|
||||
if r.Flags.Has(2) {
|
||||
b.PutString(r.URL)
|
||||
}
|
||||
if r.Flags.Has(3) {
|
||||
b.PutString(r.InAppOrigin)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Decode implements bin.Decoder.
|
||||
func (r *MessagesRequestURLAuthRequest) Decode(b *bin.Buffer) error {
|
||||
if r == nil {
|
||||
return fmt.Errorf("can't decode messages.requestUrlAuth#198fb446 to nil")
|
||||
return fmt.Errorf("can't decode messages.requestUrlAuth#894cc99c to nil")
|
||||
}
|
||||
if err := b.ConsumeID(MessagesRequestURLAuthRequestTypeID); err != nil {
|
||||
return fmt.Errorf("unable to decode messages.requestUrlAuth#198fb446: %w", err)
|
||||
return fmt.Errorf("unable to decode messages.requestUrlAuth#894cc99c: %w", err)
|
||||
}
|
||||
return r.DecodeBare(b)
|
||||
}
|
||||
@@ -249,41 +272,48 @@ func (r *MessagesRequestURLAuthRequest) Decode(b *bin.Buffer) error {
|
||||
// DecodeBare implements bin.BareDecoder.
|
||||
func (r *MessagesRequestURLAuthRequest) DecodeBare(b *bin.Buffer) error {
|
||||
if r == nil {
|
||||
return fmt.Errorf("can't decode messages.requestUrlAuth#198fb446 to nil")
|
||||
return fmt.Errorf("can't decode messages.requestUrlAuth#894cc99c to nil")
|
||||
}
|
||||
{
|
||||
if err := r.Flags.Decode(b); err != nil {
|
||||
return fmt.Errorf("unable to decode messages.requestUrlAuth#198fb446: field flags: %w", err)
|
||||
return fmt.Errorf("unable to decode messages.requestUrlAuth#894cc99c: field flags: %w", err)
|
||||
}
|
||||
}
|
||||
if r.Flags.Has(1) {
|
||||
value, err := DecodeInputPeer(b)
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode messages.requestUrlAuth#198fb446: field peer: %w", err)
|
||||
return fmt.Errorf("unable to decode messages.requestUrlAuth#894cc99c: field peer: %w", err)
|
||||
}
|
||||
r.Peer = value
|
||||
}
|
||||
if r.Flags.Has(1) {
|
||||
value, err := b.Int()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode messages.requestUrlAuth#198fb446: field msg_id: %w", err)
|
||||
return fmt.Errorf("unable to decode messages.requestUrlAuth#894cc99c: field msg_id: %w", err)
|
||||
}
|
||||
r.MsgID = value
|
||||
}
|
||||
if r.Flags.Has(1) {
|
||||
value, err := b.Int()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode messages.requestUrlAuth#198fb446: field button_id: %w", err)
|
||||
return fmt.Errorf("unable to decode messages.requestUrlAuth#894cc99c: field button_id: %w", err)
|
||||
}
|
||||
r.ButtonID = value
|
||||
}
|
||||
if r.Flags.Has(2) {
|
||||
value, err := b.String()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode messages.requestUrlAuth#198fb446: field url: %w", err)
|
||||
return fmt.Errorf("unable to decode messages.requestUrlAuth#894cc99c: field url: %w", err)
|
||||
}
|
||||
r.URL = value
|
||||
}
|
||||
if r.Flags.Has(3) {
|
||||
value, err := b.String()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode messages.requestUrlAuth#894cc99c: field in_app_origin: %w", err)
|
||||
}
|
||||
r.InAppOrigin = value
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -359,7 +389,25 @@ func (r *MessagesRequestURLAuthRequest) GetURL() (value string, ok bool) {
|
||||
return r.URL, true
|
||||
}
|
||||
|
||||
// MessagesRequestURLAuth invokes method messages.requestUrlAuth#198fb446 returning error if any.
|
||||
// SetInAppOrigin sets value of InAppOrigin conditional field.
|
||||
func (r *MessagesRequestURLAuthRequest) SetInAppOrigin(value string) {
|
||||
r.Flags.Set(3)
|
||||
r.InAppOrigin = value
|
||||
}
|
||||
|
||||
// GetInAppOrigin returns value of InAppOrigin conditional field and
|
||||
// boolean which is true if field was set.
|
||||
func (r *MessagesRequestURLAuthRequest) GetInAppOrigin() (value string, ok bool) {
|
||||
if r == nil {
|
||||
return
|
||||
}
|
||||
if !r.Flags.Has(3) {
|
||||
return value, false
|
||||
}
|
||||
return r.InAppOrigin, true
|
||||
}
|
||||
|
||||
// MessagesRequestURLAuth invokes method messages.requestUrlAuth#894cc99c returning error if any.
|
||||
// Get more info about a Seamless Telegram Login authorization request, for more info
|
||||
// click here »¹
|
||||
//
|
||||
|
||||
+271
@@ -0,0 +1,271 @@
|
||||
// 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{}
|
||||
)
|
||||
|
||||
// MessagesSummarizeTextRequest represents TL type `messages.summarizeText#9d4104e2`.
|
||||
//
|
||||
// See https://core.telegram.org/method/messages.summarizeText for reference.
|
||||
type MessagesSummarizeTextRequest struct {
|
||||
// Flags field of MessagesSummarizeTextRequest.
|
||||
Flags bin.Fields
|
||||
// Peer field of MessagesSummarizeTextRequest.
|
||||
Peer InputPeerClass
|
||||
// ID field of MessagesSummarizeTextRequest.
|
||||
ID int
|
||||
// ToLang field of MessagesSummarizeTextRequest.
|
||||
//
|
||||
// Use SetToLang and GetToLang helpers.
|
||||
ToLang string
|
||||
}
|
||||
|
||||
// MessagesSummarizeTextRequestTypeID is TL type id of MessagesSummarizeTextRequest.
|
||||
const MessagesSummarizeTextRequestTypeID = 0x9d4104e2
|
||||
|
||||
// Ensuring interfaces in compile-time for MessagesSummarizeTextRequest.
|
||||
var (
|
||||
_ bin.Encoder = &MessagesSummarizeTextRequest{}
|
||||
_ bin.Decoder = &MessagesSummarizeTextRequest{}
|
||||
_ bin.BareEncoder = &MessagesSummarizeTextRequest{}
|
||||
_ bin.BareDecoder = &MessagesSummarizeTextRequest{}
|
||||
)
|
||||
|
||||
func (s *MessagesSummarizeTextRequest) Zero() bool {
|
||||
if s == nil {
|
||||
return true
|
||||
}
|
||||
if !(s.Flags.Zero()) {
|
||||
return false
|
||||
}
|
||||
if !(s.Peer == nil) {
|
||||
return false
|
||||
}
|
||||
if !(s.ID == 0) {
|
||||
return false
|
||||
}
|
||||
if !(s.ToLang == "") {
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
// String implements fmt.Stringer.
|
||||
func (s *MessagesSummarizeTextRequest) String() string {
|
||||
if s == nil {
|
||||
return "MessagesSummarizeTextRequest(nil)"
|
||||
}
|
||||
type Alias MessagesSummarizeTextRequest
|
||||
return fmt.Sprintf("MessagesSummarizeTextRequest%+v", Alias(*s))
|
||||
}
|
||||
|
||||
// FillFrom fills MessagesSummarizeTextRequest from given interface.
|
||||
func (s *MessagesSummarizeTextRequest) FillFrom(from interface {
|
||||
GetPeer() (value InputPeerClass)
|
||||
GetID() (value int)
|
||||
GetToLang() (value string, ok bool)
|
||||
}) {
|
||||
s.Peer = from.GetPeer()
|
||||
s.ID = from.GetID()
|
||||
if val, ok := from.GetToLang(); ok {
|
||||
s.ToLang = val
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// TypeID returns type id in TL schema.
|
||||
//
|
||||
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
||||
func (*MessagesSummarizeTextRequest) TypeID() uint32 {
|
||||
return MessagesSummarizeTextRequestTypeID
|
||||
}
|
||||
|
||||
// TypeName returns name of type in TL schema.
|
||||
func (*MessagesSummarizeTextRequest) TypeName() string {
|
||||
return "messages.summarizeText"
|
||||
}
|
||||
|
||||
// TypeInfo returns info about TL type.
|
||||
func (s *MessagesSummarizeTextRequest) TypeInfo() tdp.Type {
|
||||
typ := tdp.Type{
|
||||
Name: "messages.summarizeText",
|
||||
ID: MessagesSummarizeTextRequestTypeID,
|
||||
}
|
||||
if s == nil {
|
||||
typ.Null = true
|
||||
return typ
|
||||
}
|
||||
typ.Fields = []tdp.Field{
|
||||
{
|
||||
Name: "Peer",
|
||||
SchemaName: "peer",
|
||||
},
|
||||
{
|
||||
Name: "ID",
|
||||
SchemaName: "id",
|
||||
},
|
||||
{
|
||||
Name: "ToLang",
|
||||
SchemaName: "to_lang",
|
||||
Null: !s.Flags.Has(0),
|
||||
},
|
||||
}
|
||||
return typ
|
||||
}
|
||||
|
||||
// SetFlags sets flags for non-zero fields.
|
||||
func (s *MessagesSummarizeTextRequest) SetFlags() {
|
||||
if !(s.ToLang == "") {
|
||||
s.Flags.Set(0)
|
||||
}
|
||||
}
|
||||
|
||||
// Encode implements bin.Encoder.
|
||||
func (s *MessagesSummarizeTextRequest) Encode(b *bin.Buffer) error {
|
||||
if s == nil {
|
||||
return fmt.Errorf("can't encode messages.summarizeText#9d4104e2 as nil")
|
||||
}
|
||||
b.PutID(MessagesSummarizeTextRequestTypeID)
|
||||
return s.EncodeBare(b)
|
||||
}
|
||||
|
||||
// EncodeBare implements bin.BareEncoder.
|
||||
func (s *MessagesSummarizeTextRequest) EncodeBare(b *bin.Buffer) error {
|
||||
if s == nil {
|
||||
return fmt.Errorf("can't encode messages.summarizeText#9d4104e2 as nil")
|
||||
}
|
||||
s.SetFlags()
|
||||
if err := s.Flags.Encode(b); err != nil {
|
||||
return fmt.Errorf("unable to encode messages.summarizeText#9d4104e2: field flags: %w", err)
|
||||
}
|
||||
if s.Peer == nil {
|
||||
return fmt.Errorf("unable to encode messages.summarizeText#9d4104e2: field peer is nil")
|
||||
}
|
||||
if err := s.Peer.Encode(b); err != nil {
|
||||
return fmt.Errorf("unable to encode messages.summarizeText#9d4104e2: field peer: %w", err)
|
||||
}
|
||||
b.PutInt(s.ID)
|
||||
if s.Flags.Has(0) {
|
||||
b.PutString(s.ToLang)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Decode implements bin.Decoder.
|
||||
func (s *MessagesSummarizeTextRequest) Decode(b *bin.Buffer) error {
|
||||
if s == nil {
|
||||
return fmt.Errorf("can't decode messages.summarizeText#9d4104e2 to nil")
|
||||
}
|
||||
if err := b.ConsumeID(MessagesSummarizeTextRequestTypeID); err != nil {
|
||||
return fmt.Errorf("unable to decode messages.summarizeText#9d4104e2: %w", err)
|
||||
}
|
||||
return s.DecodeBare(b)
|
||||
}
|
||||
|
||||
// DecodeBare implements bin.BareDecoder.
|
||||
func (s *MessagesSummarizeTextRequest) DecodeBare(b *bin.Buffer) error {
|
||||
if s == nil {
|
||||
return fmt.Errorf("can't decode messages.summarizeText#9d4104e2 to nil")
|
||||
}
|
||||
{
|
||||
if err := s.Flags.Decode(b); err != nil {
|
||||
return fmt.Errorf("unable to decode messages.summarizeText#9d4104e2: field flags: %w", err)
|
||||
}
|
||||
}
|
||||
{
|
||||
value, err := DecodeInputPeer(b)
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode messages.summarizeText#9d4104e2: field peer: %w", err)
|
||||
}
|
||||
s.Peer = value
|
||||
}
|
||||
{
|
||||
value, err := b.Int()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode messages.summarizeText#9d4104e2: field id: %w", err)
|
||||
}
|
||||
s.ID = value
|
||||
}
|
||||
if s.Flags.Has(0) {
|
||||
value, err := b.String()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode messages.summarizeText#9d4104e2: field to_lang: %w", err)
|
||||
}
|
||||
s.ToLang = value
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// GetPeer returns value of Peer field.
|
||||
func (s *MessagesSummarizeTextRequest) GetPeer() (value InputPeerClass) {
|
||||
if s == nil {
|
||||
return
|
||||
}
|
||||
return s.Peer
|
||||
}
|
||||
|
||||
// GetID returns value of ID field.
|
||||
func (s *MessagesSummarizeTextRequest) GetID() (value int) {
|
||||
if s == nil {
|
||||
return
|
||||
}
|
||||
return s.ID
|
||||
}
|
||||
|
||||
// SetToLang sets value of ToLang conditional field.
|
||||
func (s *MessagesSummarizeTextRequest) SetToLang(value string) {
|
||||
s.Flags.Set(0)
|
||||
s.ToLang = value
|
||||
}
|
||||
|
||||
// GetToLang returns value of ToLang conditional field and
|
||||
// boolean which is true if field was set.
|
||||
func (s *MessagesSummarizeTextRequest) GetToLang() (value string, ok bool) {
|
||||
if s == nil {
|
||||
return
|
||||
}
|
||||
if !s.Flags.Has(0) {
|
||||
return value, false
|
||||
}
|
||||
return s.ToLang, true
|
||||
}
|
||||
|
||||
// MessagesSummarizeText invokes method messages.summarizeText#9d4104e2 returning error if any.
|
||||
//
|
||||
// See https://core.telegram.org/method/messages.summarizeText for reference.
|
||||
func (c *Client) MessagesSummarizeText(ctx context.Context, request *MessagesSummarizeTextRequest) (*TextWithEntities, error) {
|
||||
var result TextWithEntities
|
||||
|
||||
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{}
|
||||
)
|
||||
+78
-12
@@ -31,7 +31,7 @@ var (
|
||||
_ = tdjson.Encoder{}
|
||||
)
|
||||
|
||||
// MessagesToggleNoForwardsRequest represents TL type `messages.toggleNoForwards#b11eafa2`.
|
||||
// MessagesToggleNoForwardsRequest represents TL type `messages.toggleNoForwards#b2081a35`.
|
||||
// Enable or disable content protection¹ on a channel or chat
|
||||
//
|
||||
// Links:
|
||||
@@ -39,14 +39,20 @@ var (
|
||||
//
|
||||
// See https://core.telegram.org/method/messages.toggleNoForwards for reference.
|
||||
type MessagesToggleNoForwardsRequest struct {
|
||||
// Flags field of MessagesToggleNoForwardsRequest.
|
||||
Flags bin.Fields
|
||||
// The chat or channel
|
||||
Peer InputPeerClass
|
||||
// Enable or disable content protection
|
||||
Enabled bool
|
||||
// RequestMsgID field of MessagesToggleNoForwardsRequest.
|
||||
//
|
||||
// Use SetRequestMsgID and GetRequestMsgID helpers.
|
||||
RequestMsgID int
|
||||
}
|
||||
|
||||
// MessagesToggleNoForwardsRequestTypeID is TL type id of MessagesToggleNoForwardsRequest.
|
||||
const MessagesToggleNoForwardsRequestTypeID = 0xb11eafa2
|
||||
const MessagesToggleNoForwardsRequestTypeID = 0xb2081a35
|
||||
|
||||
// Ensuring interfaces in compile-time for MessagesToggleNoForwardsRequest.
|
||||
var (
|
||||
@@ -60,12 +66,18 @@ func (t *MessagesToggleNoForwardsRequest) Zero() bool {
|
||||
if t == nil {
|
||||
return true
|
||||
}
|
||||
if !(t.Flags.Zero()) {
|
||||
return false
|
||||
}
|
||||
if !(t.Peer == nil) {
|
||||
return false
|
||||
}
|
||||
if !(t.Enabled == false) {
|
||||
return false
|
||||
}
|
||||
if !(t.RequestMsgID == 0) {
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
@@ -83,9 +95,14 @@ func (t *MessagesToggleNoForwardsRequest) String() string {
|
||||
func (t *MessagesToggleNoForwardsRequest) FillFrom(from interface {
|
||||
GetPeer() (value InputPeerClass)
|
||||
GetEnabled() (value bool)
|
||||
GetRequestMsgID() (value int, ok bool)
|
||||
}) {
|
||||
t.Peer = from.GetPeer()
|
||||
t.Enabled = from.GetEnabled()
|
||||
if val, ok := from.GetRequestMsgID(); ok {
|
||||
t.RequestMsgID = val
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// TypeID returns type id in TL schema.
|
||||
@@ -119,14 +136,26 @@ func (t *MessagesToggleNoForwardsRequest) TypeInfo() tdp.Type {
|
||||
Name: "Enabled",
|
||||
SchemaName: "enabled",
|
||||
},
|
||||
{
|
||||
Name: "RequestMsgID",
|
||||
SchemaName: "request_msg_id",
|
||||
Null: !t.Flags.Has(0),
|
||||
},
|
||||
}
|
||||
return typ
|
||||
}
|
||||
|
||||
// SetFlags sets flags for non-zero fields.
|
||||
func (t *MessagesToggleNoForwardsRequest) SetFlags() {
|
||||
if !(t.RequestMsgID == 0) {
|
||||
t.Flags.Set(0)
|
||||
}
|
||||
}
|
||||
|
||||
// Encode implements bin.Encoder.
|
||||
func (t *MessagesToggleNoForwardsRequest) Encode(b *bin.Buffer) error {
|
||||
if t == nil {
|
||||
return fmt.Errorf("can't encode messages.toggleNoForwards#b11eafa2 as nil")
|
||||
return fmt.Errorf("can't encode messages.toggleNoForwards#b2081a35 as nil")
|
||||
}
|
||||
b.PutID(MessagesToggleNoForwardsRequestTypeID)
|
||||
return t.EncodeBare(b)
|
||||
@@ -135,25 +164,32 @@ func (t *MessagesToggleNoForwardsRequest) Encode(b *bin.Buffer) error {
|
||||
// EncodeBare implements bin.BareEncoder.
|
||||
func (t *MessagesToggleNoForwardsRequest) EncodeBare(b *bin.Buffer) error {
|
||||
if t == nil {
|
||||
return fmt.Errorf("can't encode messages.toggleNoForwards#b11eafa2 as nil")
|
||||
return fmt.Errorf("can't encode messages.toggleNoForwards#b2081a35 as nil")
|
||||
}
|
||||
t.SetFlags()
|
||||
if err := t.Flags.Encode(b); err != nil {
|
||||
return fmt.Errorf("unable to encode messages.toggleNoForwards#b2081a35: field flags: %w", err)
|
||||
}
|
||||
if t.Peer == nil {
|
||||
return fmt.Errorf("unable to encode messages.toggleNoForwards#b11eafa2: field peer is nil")
|
||||
return fmt.Errorf("unable to encode messages.toggleNoForwards#b2081a35: field peer is nil")
|
||||
}
|
||||
if err := t.Peer.Encode(b); err != nil {
|
||||
return fmt.Errorf("unable to encode messages.toggleNoForwards#b11eafa2: field peer: %w", err)
|
||||
return fmt.Errorf("unable to encode messages.toggleNoForwards#b2081a35: field peer: %w", err)
|
||||
}
|
||||
b.PutBool(t.Enabled)
|
||||
if t.Flags.Has(0) {
|
||||
b.PutInt(t.RequestMsgID)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Decode implements bin.Decoder.
|
||||
func (t *MessagesToggleNoForwardsRequest) Decode(b *bin.Buffer) error {
|
||||
if t == nil {
|
||||
return fmt.Errorf("can't decode messages.toggleNoForwards#b11eafa2 to nil")
|
||||
return fmt.Errorf("can't decode messages.toggleNoForwards#b2081a35 to nil")
|
||||
}
|
||||
if err := b.ConsumeID(MessagesToggleNoForwardsRequestTypeID); err != nil {
|
||||
return fmt.Errorf("unable to decode messages.toggleNoForwards#b11eafa2: %w", err)
|
||||
return fmt.Errorf("unable to decode messages.toggleNoForwards#b2081a35: %w", err)
|
||||
}
|
||||
return t.DecodeBare(b)
|
||||
}
|
||||
@@ -161,22 +197,34 @@ func (t *MessagesToggleNoForwardsRequest) Decode(b *bin.Buffer) error {
|
||||
// DecodeBare implements bin.BareDecoder.
|
||||
func (t *MessagesToggleNoForwardsRequest) DecodeBare(b *bin.Buffer) error {
|
||||
if t == nil {
|
||||
return fmt.Errorf("can't decode messages.toggleNoForwards#b11eafa2 to nil")
|
||||
return fmt.Errorf("can't decode messages.toggleNoForwards#b2081a35 to nil")
|
||||
}
|
||||
{
|
||||
if err := t.Flags.Decode(b); err != nil {
|
||||
return fmt.Errorf("unable to decode messages.toggleNoForwards#b2081a35: field flags: %w", err)
|
||||
}
|
||||
}
|
||||
{
|
||||
value, err := DecodeInputPeer(b)
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode messages.toggleNoForwards#b11eafa2: field peer: %w", err)
|
||||
return fmt.Errorf("unable to decode messages.toggleNoForwards#b2081a35: field peer: %w", err)
|
||||
}
|
||||
t.Peer = value
|
||||
}
|
||||
{
|
||||
value, err := b.Bool()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode messages.toggleNoForwards#b11eafa2: field enabled: %w", err)
|
||||
return fmt.Errorf("unable to decode messages.toggleNoForwards#b2081a35: field enabled: %w", err)
|
||||
}
|
||||
t.Enabled = value
|
||||
}
|
||||
if t.Flags.Has(0) {
|
||||
value, err := b.Int()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode messages.toggleNoForwards#b2081a35: field request_msg_id: %w", err)
|
||||
}
|
||||
t.RequestMsgID = value
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -196,7 +244,25 @@ func (t *MessagesToggleNoForwardsRequest) GetEnabled() (value bool) {
|
||||
return t.Enabled
|
||||
}
|
||||
|
||||
// MessagesToggleNoForwards invokes method messages.toggleNoForwards#b11eafa2 returning error if any.
|
||||
// SetRequestMsgID sets value of RequestMsgID conditional field.
|
||||
func (t *MessagesToggleNoForwardsRequest) SetRequestMsgID(value int) {
|
||||
t.Flags.Set(0)
|
||||
t.RequestMsgID = value
|
||||
}
|
||||
|
||||
// GetRequestMsgID returns value of RequestMsgID conditional field and
|
||||
// boolean which is true if field was set.
|
||||
func (t *MessagesToggleNoForwardsRequest) GetRequestMsgID() (value int, ok bool) {
|
||||
if t == nil {
|
||||
return
|
||||
}
|
||||
if !t.Flags.Has(0) {
|
||||
return value, false
|
||||
}
|
||||
return t.RequestMsgID, true
|
||||
}
|
||||
|
||||
// MessagesToggleNoForwards invokes method messages.toggleNoForwards#b2081a35 returning error if any.
|
||||
// Enable or disable content protection¹ on a channel or chat
|
||||
//
|
||||
// Links:
|
||||
|
||||
Generated
+329
@@ -0,0 +1,329 @@
|
||||
// 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{}
|
||||
)
|
||||
|
||||
// Passkey represents TL type `passkey#98613ebf`.
|
||||
//
|
||||
// See https://core.telegram.org/constructor/passkey for reference.
|
||||
type Passkey struct {
|
||||
// Flags field of Passkey.
|
||||
Flags bin.Fields
|
||||
// ID field of Passkey.
|
||||
ID string
|
||||
// Name field of Passkey.
|
||||
Name string
|
||||
// Date field of Passkey.
|
||||
Date int
|
||||
// SoftwareEmojiID field of Passkey.
|
||||
//
|
||||
// Use SetSoftwareEmojiID and GetSoftwareEmojiID helpers.
|
||||
SoftwareEmojiID int64
|
||||
// LastUsageDate field of Passkey.
|
||||
//
|
||||
// Use SetLastUsageDate and GetLastUsageDate helpers.
|
||||
LastUsageDate int
|
||||
}
|
||||
|
||||
// PasskeyTypeID is TL type id of Passkey.
|
||||
const PasskeyTypeID = 0x98613ebf
|
||||
|
||||
// Ensuring interfaces in compile-time for Passkey.
|
||||
var (
|
||||
_ bin.Encoder = &Passkey{}
|
||||
_ bin.Decoder = &Passkey{}
|
||||
_ bin.BareEncoder = &Passkey{}
|
||||
_ bin.BareDecoder = &Passkey{}
|
||||
)
|
||||
|
||||
func (p *Passkey) Zero() bool {
|
||||
if p == nil {
|
||||
return true
|
||||
}
|
||||
if !(p.Flags.Zero()) {
|
||||
return false
|
||||
}
|
||||
if !(p.ID == "") {
|
||||
return false
|
||||
}
|
||||
if !(p.Name == "") {
|
||||
return false
|
||||
}
|
||||
if !(p.Date == 0) {
|
||||
return false
|
||||
}
|
||||
if !(p.SoftwareEmojiID == 0) {
|
||||
return false
|
||||
}
|
||||
if !(p.LastUsageDate == 0) {
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
// String implements fmt.Stringer.
|
||||
func (p *Passkey) String() string {
|
||||
if p == nil {
|
||||
return "Passkey(nil)"
|
||||
}
|
||||
type Alias Passkey
|
||||
return fmt.Sprintf("Passkey%+v", Alias(*p))
|
||||
}
|
||||
|
||||
// FillFrom fills Passkey from given interface.
|
||||
func (p *Passkey) FillFrom(from interface {
|
||||
GetID() (value string)
|
||||
GetName() (value string)
|
||||
GetDate() (value int)
|
||||
GetSoftwareEmojiID() (value int64, ok bool)
|
||||
GetLastUsageDate() (value int, ok bool)
|
||||
}) {
|
||||
p.ID = from.GetID()
|
||||
p.Name = from.GetName()
|
||||
p.Date = from.GetDate()
|
||||
if val, ok := from.GetSoftwareEmojiID(); ok {
|
||||
p.SoftwareEmojiID = val
|
||||
}
|
||||
|
||||
if val, ok := from.GetLastUsageDate(); ok {
|
||||
p.LastUsageDate = val
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// TypeID returns type id in TL schema.
|
||||
//
|
||||
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
||||
func (*Passkey) TypeID() uint32 {
|
||||
return PasskeyTypeID
|
||||
}
|
||||
|
||||
// TypeName returns name of type in TL schema.
|
||||
func (*Passkey) TypeName() string {
|
||||
return "passkey"
|
||||
}
|
||||
|
||||
// TypeInfo returns info about TL type.
|
||||
func (p *Passkey) TypeInfo() tdp.Type {
|
||||
typ := tdp.Type{
|
||||
Name: "passkey",
|
||||
ID: PasskeyTypeID,
|
||||
}
|
||||
if p == nil {
|
||||
typ.Null = true
|
||||
return typ
|
||||
}
|
||||
typ.Fields = []tdp.Field{
|
||||
{
|
||||
Name: "ID",
|
||||
SchemaName: "id",
|
||||
},
|
||||
{
|
||||
Name: "Name",
|
||||
SchemaName: "name",
|
||||
},
|
||||
{
|
||||
Name: "Date",
|
||||
SchemaName: "date",
|
||||
},
|
||||
{
|
||||
Name: "SoftwareEmojiID",
|
||||
SchemaName: "software_emoji_id",
|
||||
Null: !p.Flags.Has(0),
|
||||
},
|
||||
{
|
||||
Name: "LastUsageDate",
|
||||
SchemaName: "last_usage_date",
|
||||
Null: !p.Flags.Has(1),
|
||||
},
|
||||
}
|
||||
return typ
|
||||
}
|
||||
|
||||
// SetFlags sets flags for non-zero fields.
|
||||
func (p *Passkey) SetFlags() {
|
||||
if !(p.SoftwareEmojiID == 0) {
|
||||
p.Flags.Set(0)
|
||||
}
|
||||
if !(p.LastUsageDate == 0) {
|
||||
p.Flags.Set(1)
|
||||
}
|
||||
}
|
||||
|
||||
// Encode implements bin.Encoder.
|
||||
func (p *Passkey) Encode(b *bin.Buffer) error {
|
||||
if p == nil {
|
||||
return fmt.Errorf("can't encode passkey#98613ebf as nil")
|
||||
}
|
||||
b.PutID(PasskeyTypeID)
|
||||
return p.EncodeBare(b)
|
||||
}
|
||||
|
||||
// EncodeBare implements bin.BareEncoder.
|
||||
func (p *Passkey) EncodeBare(b *bin.Buffer) error {
|
||||
if p == nil {
|
||||
return fmt.Errorf("can't encode passkey#98613ebf as nil")
|
||||
}
|
||||
p.SetFlags()
|
||||
if err := p.Flags.Encode(b); err != nil {
|
||||
return fmt.Errorf("unable to encode passkey#98613ebf: field flags: %w", err)
|
||||
}
|
||||
b.PutString(p.ID)
|
||||
b.PutString(p.Name)
|
||||
b.PutInt(p.Date)
|
||||
if p.Flags.Has(0) {
|
||||
b.PutLong(p.SoftwareEmojiID)
|
||||
}
|
||||
if p.Flags.Has(1) {
|
||||
b.PutInt(p.LastUsageDate)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Decode implements bin.Decoder.
|
||||
func (p *Passkey) Decode(b *bin.Buffer) error {
|
||||
if p == nil {
|
||||
return fmt.Errorf("can't decode passkey#98613ebf to nil")
|
||||
}
|
||||
if err := b.ConsumeID(PasskeyTypeID); err != nil {
|
||||
return fmt.Errorf("unable to decode passkey#98613ebf: %w", err)
|
||||
}
|
||||
return p.DecodeBare(b)
|
||||
}
|
||||
|
||||
// DecodeBare implements bin.BareDecoder.
|
||||
func (p *Passkey) DecodeBare(b *bin.Buffer) error {
|
||||
if p == nil {
|
||||
return fmt.Errorf("can't decode passkey#98613ebf to nil")
|
||||
}
|
||||
{
|
||||
if err := p.Flags.Decode(b); err != nil {
|
||||
return fmt.Errorf("unable to decode passkey#98613ebf: field flags: %w", err)
|
||||
}
|
||||
}
|
||||
{
|
||||
value, err := b.String()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode passkey#98613ebf: field id: %w", err)
|
||||
}
|
||||
p.ID = value
|
||||
}
|
||||
{
|
||||
value, err := b.String()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode passkey#98613ebf: field name: %w", err)
|
||||
}
|
||||
p.Name = value
|
||||
}
|
||||
{
|
||||
value, err := b.Int()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode passkey#98613ebf: field date: %w", err)
|
||||
}
|
||||
p.Date = value
|
||||
}
|
||||
if p.Flags.Has(0) {
|
||||
value, err := b.Long()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode passkey#98613ebf: field software_emoji_id: %w", err)
|
||||
}
|
||||
p.SoftwareEmojiID = value
|
||||
}
|
||||
if p.Flags.Has(1) {
|
||||
value, err := b.Int()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode passkey#98613ebf: field last_usage_date: %w", err)
|
||||
}
|
||||
p.LastUsageDate = value
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// GetID returns value of ID field.
|
||||
func (p *Passkey) GetID() (value string) {
|
||||
if p == nil {
|
||||
return
|
||||
}
|
||||
return p.ID
|
||||
}
|
||||
|
||||
// GetName returns value of Name field.
|
||||
func (p *Passkey) GetName() (value string) {
|
||||
if p == nil {
|
||||
return
|
||||
}
|
||||
return p.Name
|
||||
}
|
||||
|
||||
// GetDate returns value of Date field.
|
||||
func (p *Passkey) GetDate() (value int) {
|
||||
if p == nil {
|
||||
return
|
||||
}
|
||||
return p.Date
|
||||
}
|
||||
|
||||
// SetSoftwareEmojiID sets value of SoftwareEmojiID conditional field.
|
||||
func (p *Passkey) SetSoftwareEmojiID(value int64) {
|
||||
p.Flags.Set(0)
|
||||
p.SoftwareEmojiID = value
|
||||
}
|
||||
|
||||
// GetSoftwareEmojiID returns value of SoftwareEmojiID conditional field and
|
||||
// boolean which is true if field was set.
|
||||
func (p *Passkey) GetSoftwareEmojiID() (value int64, ok bool) {
|
||||
if p == nil {
|
||||
return
|
||||
}
|
||||
if !p.Flags.Has(0) {
|
||||
return value, false
|
||||
}
|
||||
return p.SoftwareEmojiID, true
|
||||
}
|
||||
|
||||
// SetLastUsageDate sets value of LastUsageDate conditional field.
|
||||
func (p *Passkey) SetLastUsageDate(value int) {
|
||||
p.Flags.Set(1)
|
||||
p.LastUsageDate = value
|
||||
}
|
||||
|
||||
// GetLastUsageDate returns value of LastUsageDate conditional field and
|
||||
// boolean which is true if field was set.
|
||||
func (p *Passkey) GetLastUsageDate() (value int, ok bool) {
|
||||
if p == nil {
|
||||
return
|
||||
}
|
||||
if !p.Flags.Has(1) {
|
||||
return value, false
|
||||
}
|
||||
return p.LastUsageDate, true
|
||||
}
|
||||
Generated
+35
@@ -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{}
|
||||
)
|
||||
+199
@@ -0,0 +1,199 @@
|
||||
// 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{}
|
||||
)
|
||||
|
||||
// PaymentsCraftStarGiftRequest represents TL type `payments.craftStarGift#b0f9684f`.
|
||||
//
|
||||
// See https://core.telegram.org/method/payments.craftStarGift for reference.
|
||||
type PaymentsCraftStarGiftRequest struct {
|
||||
// Stargift field of PaymentsCraftStarGiftRequest.
|
||||
Stargift []InputSavedStarGiftClass
|
||||
}
|
||||
|
||||
// PaymentsCraftStarGiftRequestTypeID is TL type id of PaymentsCraftStarGiftRequest.
|
||||
const PaymentsCraftStarGiftRequestTypeID = 0xb0f9684f
|
||||
|
||||
// Ensuring interfaces in compile-time for PaymentsCraftStarGiftRequest.
|
||||
var (
|
||||
_ bin.Encoder = &PaymentsCraftStarGiftRequest{}
|
||||
_ bin.Decoder = &PaymentsCraftStarGiftRequest{}
|
||||
_ bin.BareEncoder = &PaymentsCraftStarGiftRequest{}
|
||||
_ bin.BareDecoder = &PaymentsCraftStarGiftRequest{}
|
||||
)
|
||||
|
||||
func (c *PaymentsCraftStarGiftRequest) Zero() bool {
|
||||
if c == nil {
|
||||
return true
|
||||
}
|
||||
if !(c.Stargift == nil) {
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
// String implements fmt.Stringer.
|
||||
func (c *PaymentsCraftStarGiftRequest) String() string {
|
||||
if c == nil {
|
||||
return "PaymentsCraftStarGiftRequest(nil)"
|
||||
}
|
||||
type Alias PaymentsCraftStarGiftRequest
|
||||
return fmt.Sprintf("PaymentsCraftStarGiftRequest%+v", Alias(*c))
|
||||
}
|
||||
|
||||
// FillFrom fills PaymentsCraftStarGiftRequest from given interface.
|
||||
func (c *PaymentsCraftStarGiftRequest) FillFrom(from interface {
|
||||
GetStargift() (value []InputSavedStarGiftClass)
|
||||
}) {
|
||||
c.Stargift = from.GetStargift()
|
||||
}
|
||||
|
||||
// TypeID returns type id in TL schema.
|
||||
//
|
||||
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
||||
func (*PaymentsCraftStarGiftRequest) TypeID() uint32 {
|
||||
return PaymentsCraftStarGiftRequestTypeID
|
||||
}
|
||||
|
||||
// TypeName returns name of type in TL schema.
|
||||
func (*PaymentsCraftStarGiftRequest) TypeName() string {
|
||||
return "payments.craftStarGift"
|
||||
}
|
||||
|
||||
// TypeInfo returns info about TL type.
|
||||
func (c *PaymentsCraftStarGiftRequest) TypeInfo() tdp.Type {
|
||||
typ := tdp.Type{
|
||||
Name: "payments.craftStarGift",
|
||||
ID: PaymentsCraftStarGiftRequestTypeID,
|
||||
}
|
||||
if c == nil {
|
||||
typ.Null = true
|
||||
return typ
|
||||
}
|
||||
typ.Fields = []tdp.Field{
|
||||
{
|
||||
Name: "Stargift",
|
||||
SchemaName: "stargift",
|
||||
},
|
||||
}
|
||||
return typ
|
||||
}
|
||||
|
||||
// Encode implements bin.Encoder.
|
||||
func (c *PaymentsCraftStarGiftRequest) Encode(b *bin.Buffer) error {
|
||||
if c == nil {
|
||||
return fmt.Errorf("can't encode payments.craftStarGift#b0f9684f as nil")
|
||||
}
|
||||
b.PutID(PaymentsCraftStarGiftRequestTypeID)
|
||||
return c.EncodeBare(b)
|
||||
}
|
||||
|
||||
// EncodeBare implements bin.BareEncoder.
|
||||
func (c *PaymentsCraftStarGiftRequest) EncodeBare(b *bin.Buffer) error {
|
||||
if c == nil {
|
||||
return fmt.Errorf("can't encode payments.craftStarGift#b0f9684f as nil")
|
||||
}
|
||||
b.PutVectorHeader(len(c.Stargift))
|
||||
for idx, v := range c.Stargift {
|
||||
if v == nil {
|
||||
return fmt.Errorf("unable to encode payments.craftStarGift#b0f9684f: field stargift element with index %d is nil", idx)
|
||||
}
|
||||
if err := v.Encode(b); err != nil {
|
||||
return fmt.Errorf("unable to encode payments.craftStarGift#b0f9684f: field stargift element with index %d: %w", idx, err)
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Decode implements bin.Decoder.
|
||||
func (c *PaymentsCraftStarGiftRequest) Decode(b *bin.Buffer) error {
|
||||
if c == nil {
|
||||
return fmt.Errorf("can't decode payments.craftStarGift#b0f9684f to nil")
|
||||
}
|
||||
if err := b.ConsumeID(PaymentsCraftStarGiftRequestTypeID); err != nil {
|
||||
return fmt.Errorf("unable to decode payments.craftStarGift#b0f9684f: %w", err)
|
||||
}
|
||||
return c.DecodeBare(b)
|
||||
}
|
||||
|
||||
// DecodeBare implements bin.BareDecoder.
|
||||
func (c *PaymentsCraftStarGiftRequest) DecodeBare(b *bin.Buffer) error {
|
||||
if c == nil {
|
||||
return fmt.Errorf("can't decode payments.craftStarGift#b0f9684f to nil")
|
||||
}
|
||||
{
|
||||
headerLen, err := b.VectorHeader()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode payments.craftStarGift#b0f9684f: field stargift: %w", err)
|
||||
}
|
||||
|
||||
if headerLen > 0 {
|
||||
c.Stargift = make([]InputSavedStarGiftClass, 0, headerLen%bin.PreallocateLimit)
|
||||
}
|
||||
for idx := 0; idx < headerLen; idx++ {
|
||||
value, err := DecodeInputSavedStarGift(b)
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode payments.craftStarGift#b0f9684f: field stargift: %w", err)
|
||||
}
|
||||
c.Stargift = append(c.Stargift, value)
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// GetStargift returns value of Stargift field.
|
||||
func (c *PaymentsCraftStarGiftRequest) GetStargift() (value []InputSavedStarGiftClass) {
|
||||
if c == nil {
|
||||
return
|
||||
}
|
||||
return c.Stargift
|
||||
}
|
||||
|
||||
// MapStargift returns field Stargift wrapped in InputSavedStarGiftClassArray helper.
|
||||
func (c *PaymentsCraftStarGiftRequest) MapStargift() (value InputSavedStarGiftClassArray) {
|
||||
return InputSavedStarGiftClassArray(c.Stargift)
|
||||
}
|
||||
|
||||
// PaymentsCraftStarGift invokes method payments.craftStarGift#b0f9684f returning error if any.
|
||||
//
|
||||
// See https://core.telegram.org/method/payments.craftStarGift for reference.
|
||||
func (c *Client) PaymentsCraftStarGift(ctx context.Context, stargift []InputSavedStarGiftClass) (UpdatesClass, error) {
|
||||
var result UpdatesBox
|
||||
|
||||
request := &PaymentsCraftStarGiftRequest{
|
||||
Stargift: stargift,
|
||||
}
|
||||
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{}
|
||||
)
|
||||
+227
@@ -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{}
|
||||
)
|
||||
|
||||
// PaymentsGetCraftStarGiftsRequest represents TL type `payments.getCraftStarGifts#fd05dd00`.
|
||||
//
|
||||
// See https://core.telegram.org/method/payments.getCraftStarGifts for reference.
|
||||
type PaymentsGetCraftStarGiftsRequest struct {
|
||||
// GiftID field of PaymentsGetCraftStarGiftsRequest.
|
||||
GiftID int64
|
||||
// Offset field of PaymentsGetCraftStarGiftsRequest.
|
||||
Offset string
|
||||
// Limit field of PaymentsGetCraftStarGiftsRequest.
|
||||
Limit int
|
||||
}
|
||||
|
||||
// PaymentsGetCraftStarGiftsRequestTypeID is TL type id of PaymentsGetCraftStarGiftsRequest.
|
||||
const PaymentsGetCraftStarGiftsRequestTypeID = 0xfd05dd00
|
||||
|
||||
// Ensuring interfaces in compile-time for PaymentsGetCraftStarGiftsRequest.
|
||||
var (
|
||||
_ bin.Encoder = &PaymentsGetCraftStarGiftsRequest{}
|
||||
_ bin.Decoder = &PaymentsGetCraftStarGiftsRequest{}
|
||||
_ bin.BareEncoder = &PaymentsGetCraftStarGiftsRequest{}
|
||||
_ bin.BareDecoder = &PaymentsGetCraftStarGiftsRequest{}
|
||||
)
|
||||
|
||||
func (g *PaymentsGetCraftStarGiftsRequest) Zero() bool {
|
||||
if g == nil {
|
||||
return true
|
||||
}
|
||||
if !(g.GiftID == 0) {
|
||||
return false
|
||||
}
|
||||
if !(g.Offset == "") {
|
||||
return false
|
||||
}
|
||||
if !(g.Limit == 0) {
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
// String implements fmt.Stringer.
|
||||
func (g *PaymentsGetCraftStarGiftsRequest) String() string {
|
||||
if g == nil {
|
||||
return "PaymentsGetCraftStarGiftsRequest(nil)"
|
||||
}
|
||||
type Alias PaymentsGetCraftStarGiftsRequest
|
||||
return fmt.Sprintf("PaymentsGetCraftStarGiftsRequest%+v", Alias(*g))
|
||||
}
|
||||
|
||||
// FillFrom fills PaymentsGetCraftStarGiftsRequest from given interface.
|
||||
func (g *PaymentsGetCraftStarGiftsRequest) FillFrom(from interface {
|
||||
GetGiftID() (value int64)
|
||||
GetOffset() (value string)
|
||||
GetLimit() (value int)
|
||||
}) {
|
||||
g.GiftID = from.GetGiftID()
|
||||
g.Offset = from.GetOffset()
|
||||
g.Limit = from.GetLimit()
|
||||
}
|
||||
|
||||
// TypeID returns type id in TL schema.
|
||||
//
|
||||
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
||||
func (*PaymentsGetCraftStarGiftsRequest) TypeID() uint32 {
|
||||
return PaymentsGetCraftStarGiftsRequestTypeID
|
||||
}
|
||||
|
||||
// TypeName returns name of type in TL schema.
|
||||
func (*PaymentsGetCraftStarGiftsRequest) TypeName() string {
|
||||
return "payments.getCraftStarGifts"
|
||||
}
|
||||
|
||||
// TypeInfo returns info about TL type.
|
||||
func (g *PaymentsGetCraftStarGiftsRequest) TypeInfo() tdp.Type {
|
||||
typ := tdp.Type{
|
||||
Name: "payments.getCraftStarGifts",
|
||||
ID: PaymentsGetCraftStarGiftsRequestTypeID,
|
||||
}
|
||||
if g == nil {
|
||||
typ.Null = true
|
||||
return typ
|
||||
}
|
||||
typ.Fields = []tdp.Field{
|
||||
{
|
||||
Name: "GiftID",
|
||||
SchemaName: "gift_id",
|
||||
},
|
||||
{
|
||||
Name: "Offset",
|
||||
SchemaName: "offset",
|
||||
},
|
||||
{
|
||||
Name: "Limit",
|
||||
SchemaName: "limit",
|
||||
},
|
||||
}
|
||||
return typ
|
||||
}
|
||||
|
||||
// Encode implements bin.Encoder.
|
||||
func (g *PaymentsGetCraftStarGiftsRequest) Encode(b *bin.Buffer) error {
|
||||
if g == nil {
|
||||
return fmt.Errorf("can't encode payments.getCraftStarGifts#fd05dd00 as nil")
|
||||
}
|
||||
b.PutID(PaymentsGetCraftStarGiftsRequestTypeID)
|
||||
return g.EncodeBare(b)
|
||||
}
|
||||
|
||||
// EncodeBare implements bin.BareEncoder.
|
||||
func (g *PaymentsGetCraftStarGiftsRequest) EncodeBare(b *bin.Buffer) error {
|
||||
if g == nil {
|
||||
return fmt.Errorf("can't encode payments.getCraftStarGifts#fd05dd00 as nil")
|
||||
}
|
||||
b.PutLong(g.GiftID)
|
||||
b.PutString(g.Offset)
|
||||
b.PutInt(g.Limit)
|
||||
return nil
|
||||
}
|
||||
|
||||
// Decode implements bin.Decoder.
|
||||
func (g *PaymentsGetCraftStarGiftsRequest) Decode(b *bin.Buffer) error {
|
||||
if g == nil {
|
||||
return fmt.Errorf("can't decode payments.getCraftStarGifts#fd05dd00 to nil")
|
||||
}
|
||||
if err := b.ConsumeID(PaymentsGetCraftStarGiftsRequestTypeID); err != nil {
|
||||
return fmt.Errorf("unable to decode payments.getCraftStarGifts#fd05dd00: %w", err)
|
||||
}
|
||||
return g.DecodeBare(b)
|
||||
}
|
||||
|
||||
// DecodeBare implements bin.BareDecoder.
|
||||
func (g *PaymentsGetCraftStarGiftsRequest) DecodeBare(b *bin.Buffer) error {
|
||||
if g == nil {
|
||||
return fmt.Errorf("can't decode payments.getCraftStarGifts#fd05dd00 to nil")
|
||||
}
|
||||
{
|
||||
value, err := b.Long()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode payments.getCraftStarGifts#fd05dd00: field gift_id: %w", err)
|
||||
}
|
||||
g.GiftID = value
|
||||
}
|
||||
{
|
||||
value, err := b.String()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode payments.getCraftStarGifts#fd05dd00: field offset: %w", err)
|
||||
}
|
||||
g.Offset = value
|
||||
}
|
||||
{
|
||||
value, err := b.Int()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode payments.getCraftStarGifts#fd05dd00: field limit: %w", err)
|
||||
}
|
||||
g.Limit = value
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// GetGiftID returns value of GiftID field.
|
||||
func (g *PaymentsGetCraftStarGiftsRequest) GetGiftID() (value int64) {
|
||||
if g == nil {
|
||||
return
|
||||
}
|
||||
return g.GiftID
|
||||
}
|
||||
|
||||
// GetOffset returns value of Offset field.
|
||||
func (g *PaymentsGetCraftStarGiftsRequest) GetOffset() (value string) {
|
||||
if g == nil {
|
||||
return
|
||||
}
|
||||
return g.Offset
|
||||
}
|
||||
|
||||
// GetLimit returns value of Limit field.
|
||||
func (g *PaymentsGetCraftStarGiftsRequest) GetLimit() (value int) {
|
||||
if g == nil {
|
||||
return
|
||||
}
|
||||
return g.Limit
|
||||
}
|
||||
|
||||
// PaymentsGetCraftStarGifts invokes method payments.getCraftStarGifts#fd05dd00 returning error if any.
|
||||
//
|
||||
// See https://core.telegram.org/method/payments.getCraftStarGifts for reference.
|
||||
func (c *Client) PaymentsGetCraftStarGifts(ctx context.Context, request *PaymentsGetCraftStarGiftsRequest) (*PaymentsSavedStarGifts, error) {
|
||||
var result PaymentsSavedStarGifts
|
||||
|
||||
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{}
|
||||
)
|
||||
@@ -54,6 +54,8 @@ type PaymentsGetResaleStarGiftsRequest struct {
|
||||
SortByPrice bool
|
||||
// Sort gifts by number (ascending).
|
||||
SortByNum bool
|
||||
// ForCraft field of PaymentsGetResaleStarGiftsRequest.
|
||||
ForCraft bool
|
||||
// If a previous call to the method was made and payments.resaleStarGifts¹
|
||||
// attributes_hash was set, pass it here to avoid returning any results if they haven't
|
||||
// changed. Otherwise, set this flag and pass 0 to return payments.resaleStarGifts²
|
||||
@@ -112,6 +114,9 @@ func (g *PaymentsGetResaleStarGiftsRequest) Zero() bool {
|
||||
if !(g.SortByNum == false) {
|
||||
return false
|
||||
}
|
||||
if !(g.ForCraft == false) {
|
||||
return false
|
||||
}
|
||||
if !(g.AttributesHash == 0) {
|
||||
return false
|
||||
}
|
||||
@@ -144,6 +149,7 @@ func (g *PaymentsGetResaleStarGiftsRequest) String() string {
|
||||
func (g *PaymentsGetResaleStarGiftsRequest) FillFrom(from interface {
|
||||
GetSortByPrice() (value bool)
|
||||
GetSortByNum() (value bool)
|
||||
GetForCraft() (value bool)
|
||||
GetAttributesHash() (value int64, ok bool)
|
||||
GetGiftID() (value int64)
|
||||
GetAttributes() (value []StarGiftAttributeIDClass, ok bool)
|
||||
@@ -152,6 +158,7 @@ func (g *PaymentsGetResaleStarGiftsRequest) FillFrom(from interface {
|
||||
}) {
|
||||
g.SortByPrice = from.GetSortByPrice()
|
||||
g.SortByNum = from.GetSortByNum()
|
||||
g.ForCraft = from.GetForCraft()
|
||||
if val, ok := from.GetAttributesHash(); ok {
|
||||
g.AttributesHash = val
|
||||
}
|
||||
@@ -198,6 +205,11 @@ func (g *PaymentsGetResaleStarGiftsRequest) TypeInfo() tdp.Type {
|
||||
SchemaName: "sort_by_num",
|
||||
Null: !g.Flags.Has(2),
|
||||
},
|
||||
{
|
||||
Name: "ForCraft",
|
||||
SchemaName: "for_craft",
|
||||
Null: !g.Flags.Has(4),
|
||||
},
|
||||
{
|
||||
Name: "AttributesHash",
|
||||
SchemaName: "attributes_hash",
|
||||
@@ -232,6 +244,9 @@ func (g *PaymentsGetResaleStarGiftsRequest) SetFlags() {
|
||||
if !(g.SortByNum == false) {
|
||||
g.Flags.Set(2)
|
||||
}
|
||||
if !(g.ForCraft == false) {
|
||||
g.Flags.Set(4)
|
||||
}
|
||||
if !(g.AttributesHash == 0) {
|
||||
g.Flags.Set(0)
|
||||
}
|
||||
@@ -301,6 +316,7 @@ func (g *PaymentsGetResaleStarGiftsRequest) DecodeBare(b *bin.Buffer) error {
|
||||
}
|
||||
g.SortByPrice = g.Flags.Has(1)
|
||||
g.SortByNum = g.Flags.Has(2)
|
||||
g.ForCraft = g.Flags.Has(4)
|
||||
if g.Flags.Has(0) {
|
||||
value, err := b.Long()
|
||||
if err != nil {
|
||||
@@ -387,6 +403,25 @@ func (g *PaymentsGetResaleStarGiftsRequest) GetSortByNum() (value bool) {
|
||||
return g.Flags.Has(2)
|
||||
}
|
||||
|
||||
// SetForCraft sets value of ForCraft conditional field.
|
||||
func (g *PaymentsGetResaleStarGiftsRequest) SetForCraft(value bool) {
|
||||
if value {
|
||||
g.Flags.Set(4)
|
||||
g.ForCraft = true
|
||||
} else {
|
||||
g.Flags.Unset(4)
|
||||
g.ForCraft = false
|
||||
}
|
||||
}
|
||||
|
||||
// GetForCraft returns value of ForCraft conditional field.
|
||||
func (g *PaymentsGetResaleStarGiftsRequest) GetForCraft() (value bool) {
|
||||
if g == nil {
|
||||
return
|
||||
}
|
||||
return g.Flags.Has(4)
|
||||
}
|
||||
|
||||
// SetAttributesHash sets value of AttributesHash conditional field.
|
||||
func (g *PaymentsGetResaleStarGiftsRequest) SetAttributesHash(value int64) {
|
||||
g.Flags.Set(0)
|
||||
|
||||
@@ -0,0 +1,176 @@
|
||||
// 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{}
|
||||
)
|
||||
|
||||
// PaymentsGetStarGiftUpgradeAttributesRequest represents TL type `payments.getStarGiftUpgradeAttributes#6d038b58`.
|
||||
//
|
||||
// See https://core.telegram.org/method/payments.getStarGiftUpgradeAttributes for reference.
|
||||
type PaymentsGetStarGiftUpgradeAttributesRequest struct {
|
||||
// GiftID field of PaymentsGetStarGiftUpgradeAttributesRequest.
|
||||
GiftID int64
|
||||
}
|
||||
|
||||
// PaymentsGetStarGiftUpgradeAttributesRequestTypeID is TL type id of PaymentsGetStarGiftUpgradeAttributesRequest.
|
||||
const PaymentsGetStarGiftUpgradeAttributesRequestTypeID = 0x6d038b58
|
||||
|
||||
// Ensuring interfaces in compile-time for PaymentsGetStarGiftUpgradeAttributesRequest.
|
||||
var (
|
||||
_ bin.Encoder = &PaymentsGetStarGiftUpgradeAttributesRequest{}
|
||||
_ bin.Decoder = &PaymentsGetStarGiftUpgradeAttributesRequest{}
|
||||
_ bin.BareEncoder = &PaymentsGetStarGiftUpgradeAttributesRequest{}
|
||||
_ bin.BareDecoder = &PaymentsGetStarGiftUpgradeAttributesRequest{}
|
||||
)
|
||||
|
||||
func (g *PaymentsGetStarGiftUpgradeAttributesRequest) Zero() bool {
|
||||
if g == nil {
|
||||
return true
|
||||
}
|
||||
if !(g.GiftID == 0) {
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
// String implements fmt.Stringer.
|
||||
func (g *PaymentsGetStarGiftUpgradeAttributesRequest) String() string {
|
||||
if g == nil {
|
||||
return "PaymentsGetStarGiftUpgradeAttributesRequest(nil)"
|
||||
}
|
||||
type Alias PaymentsGetStarGiftUpgradeAttributesRequest
|
||||
return fmt.Sprintf("PaymentsGetStarGiftUpgradeAttributesRequest%+v", Alias(*g))
|
||||
}
|
||||
|
||||
// FillFrom fills PaymentsGetStarGiftUpgradeAttributesRequest from given interface.
|
||||
func (g *PaymentsGetStarGiftUpgradeAttributesRequest) FillFrom(from interface {
|
||||
GetGiftID() (value int64)
|
||||
}) {
|
||||
g.GiftID = from.GetGiftID()
|
||||
}
|
||||
|
||||
// TypeID returns type id in TL schema.
|
||||
//
|
||||
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
||||
func (*PaymentsGetStarGiftUpgradeAttributesRequest) TypeID() uint32 {
|
||||
return PaymentsGetStarGiftUpgradeAttributesRequestTypeID
|
||||
}
|
||||
|
||||
// TypeName returns name of type in TL schema.
|
||||
func (*PaymentsGetStarGiftUpgradeAttributesRequest) TypeName() string {
|
||||
return "payments.getStarGiftUpgradeAttributes"
|
||||
}
|
||||
|
||||
// TypeInfo returns info about TL type.
|
||||
func (g *PaymentsGetStarGiftUpgradeAttributesRequest) TypeInfo() tdp.Type {
|
||||
typ := tdp.Type{
|
||||
Name: "payments.getStarGiftUpgradeAttributes",
|
||||
ID: PaymentsGetStarGiftUpgradeAttributesRequestTypeID,
|
||||
}
|
||||
if g == nil {
|
||||
typ.Null = true
|
||||
return typ
|
||||
}
|
||||
typ.Fields = []tdp.Field{
|
||||
{
|
||||
Name: "GiftID",
|
||||
SchemaName: "gift_id",
|
||||
},
|
||||
}
|
||||
return typ
|
||||
}
|
||||
|
||||
// Encode implements bin.Encoder.
|
||||
func (g *PaymentsGetStarGiftUpgradeAttributesRequest) Encode(b *bin.Buffer) error {
|
||||
if g == nil {
|
||||
return fmt.Errorf("can't encode payments.getStarGiftUpgradeAttributes#6d038b58 as nil")
|
||||
}
|
||||
b.PutID(PaymentsGetStarGiftUpgradeAttributesRequestTypeID)
|
||||
return g.EncodeBare(b)
|
||||
}
|
||||
|
||||
// EncodeBare implements bin.BareEncoder.
|
||||
func (g *PaymentsGetStarGiftUpgradeAttributesRequest) EncodeBare(b *bin.Buffer) error {
|
||||
if g == nil {
|
||||
return fmt.Errorf("can't encode payments.getStarGiftUpgradeAttributes#6d038b58 as nil")
|
||||
}
|
||||
b.PutLong(g.GiftID)
|
||||
return nil
|
||||
}
|
||||
|
||||
// Decode implements bin.Decoder.
|
||||
func (g *PaymentsGetStarGiftUpgradeAttributesRequest) Decode(b *bin.Buffer) error {
|
||||
if g == nil {
|
||||
return fmt.Errorf("can't decode payments.getStarGiftUpgradeAttributes#6d038b58 to nil")
|
||||
}
|
||||
if err := b.ConsumeID(PaymentsGetStarGiftUpgradeAttributesRequestTypeID); err != nil {
|
||||
return fmt.Errorf("unable to decode payments.getStarGiftUpgradeAttributes#6d038b58: %w", err)
|
||||
}
|
||||
return g.DecodeBare(b)
|
||||
}
|
||||
|
||||
// DecodeBare implements bin.BareDecoder.
|
||||
func (g *PaymentsGetStarGiftUpgradeAttributesRequest) DecodeBare(b *bin.Buffer) error {
|
||||
if g == nil {
|
||||
return fmt.Errorf("can't decode payments.getStarGiftUpgradeAttributes#6d038b58 to nil")
|
||||
}
|
||||
{
|
||||
value, err := b.Long()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode payments.getStarGiftUpgradeAttributes#6d038b58: field gift_id: %w", err)
|
||||
}
|
||||
g.GiftID = value
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// GetGiftID returns value of GiftID field.
|
||||
func (g *PaymentsGetStarGiftUpgradeAttributesRequest) GetGiftID() (value int64) {
|
||||
if g == nil {
|
||||
return
|
||||
}
|
||||
return g.GiftID
|
||||
}
|
||||
|
||||
// PaymentsGetStarGiftUpgradeAttributes invokes method payments.getStarGiftUpgradeAttributes#6d038b58 returning error if any.
|
||||
//
|
||||
// See https://core.telegram.org/method/payments.getStarGiftUpgradeAttributes for reference.
|
||||
func (c *Client) PaymentsGetStarGiftUpgradeAttributes(ctx context.Context, giftid int64) (*PaymentsStarGiftUpgradeAttributes, error) {
|
||||
var result PaymentsStarGiftUpgradeAttributes
|
||||
|
||||
request := &PaymentsGetStarGiftUpgradeAttributesRequest{
|
||||
GiftID: giftid,
|
||||
}
|
||||
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{}
|
||||
)
|
||||
+226
@@ -0,0 +1,226 @@
|
||||
// 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{}
|
||||
)
|
||||
|
||||
// PaymentsResolveStarGiftOfferRequest represents TL type `payments.resolveStarGiftOffer#e9ce781c`.
|
||||
//
|
||||
// See https://core.telegram.org/method/payments.resolveStarGiftOffer for reference.
|
||||
type PaymentsResolveStarGiftOfferRequest struct {
|
||||
// Flags field of PaymentsResolveStarGiftOfferRequest.
|
||||
Flags bin.Fields
|
||||
// Decline field of PaymentsResolveStarGiftOfferRequest.
|
||||
Decline bool
|
||||
// OfferMsgID field of PaymentsResolveStarGiftOfferRequest.
|
||||
OfferMsgID int
|
||||
}
|
||||
|
||||
// PaymentsResolveStarGiftOfferRequestTypeID is TL type id of PaymentsResolveStarGiftOfferRequest.
|
||||
const PaymentsResolveStarGiftOfferRequestTypeID = 0xe9ce781c
|
||||
|
||||
// Ensuring interfaces in compile-time for PaymentsResolveStarGiftOfferRequest.
|
||||
var (
|
||||
_ bin.Encoder = &PaymentsResolveStarGiftOfferRequest{}
|
||||
_ bin.Decoder = &PaymentsResolveStarGiftOfferRequest{}
|
||||
_ bin.BareEncoder = &PaymentsResolveStarGiftOfferRequest{}
|
||||
_ bin.BareDecoder = &PaymentsResolveStarGiftOfferRequest{}
|
||||
)
|
||||
|
||||
func (r *PaymentsResolveStarGiftOfferRequest) Zero() bool {
|
||||
if r == nil {
|
||||
return true
|
||||
}
|
||||
if !(r.Flags.Zero()) {
|
||||
return false
|
||||
}
|
||||
if !(r.Decline == false) {
|
||||
return false
|
||||
}
|
||||
if !(r.OfferMsgID == 0) {
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
// String implements fmt.Stringer.
|
||||
func (r *PaymentsResolveStarGiftOfferRequest) String() string {
|
||||
if r == nil {
|
||||
return "PaymentsResolveStarGiftOfferRequest(nil)"
|
||||
}
|
||||
type Alias PaymentsResolveStarGiftOfferRequest
|
||||
return fmt.Sprintf("PaymentsResolveStarGiftOfferRequest%+v", Alias(*r))
|
||||
}
|
||||
|
||||
// FillFrom fills PaymentsResolveStarGiftOfferRequest from given interface.
|
||||
func (r *PaymentsResolveStarGiftOfferRequest) FillFrom(from interface {
|
||||
GetDecline() (value bool)
|
||||
GetOfferMsgID() (value int)
|
||||
}) {
|
||||
r.Decline = from.GetDecline()
|
||||
r.OfferMsgID = from.GetOfferMsgID()
|
||||
}
|
||||
|
||||
// TypeID returns type id in TL schema.
|
||||
//
|
||||
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
||||
func (*PaymentsResolveStarGiftOfferRequest) TypeID() uint32 {
|
||||
return PaymentsResolveStarGiftOfferRequestTypeID
|
||||
}
|
||||
|
||||
// TypeName returns name of type in TL schema.
|
||||
func (*PaymentsResolveStarGiftOfferRequest) TypeName() string {
|
||||
return "payments.resolveStarGiftOffer"
|
||||
}
|
||||
|
||||
// TypeInfo returns info about TL type.
|
||||
func (r *PaymentsResolveStarGiftOfferRequest) TypeInfo() tdp.Type {
|
||||
typ := tdp.Type{
|
||||
Name: "payments.resolveStarGiftOffer",
|
||||
ID: PaymentsResolveStarGiftOfferRequestTypeID,
|
||||
}
|
||||
if r == nil {
|
||||
typ.Null = true
|
||||
return typ
|
||||
}
|
||||
typ.Fields = []tdp.Field{
|
||||
{
|
||||
Name: "Decline",
|
||||
SchemaName: "decline",
|
||||
Null: !r.Flags.Has(0),
|
||||
},
|
||||
{
|
||||
Name: "OfferMsgID",
|
||||
SchemaName: "offer_msg_id",
|
||||
},
|
||||
}
|
||||
return typ
|
||||
}
|
||||
|
||||
// SetFlags sets flags for non-zero fields.
|
||||
func (r *PaymentsResolveStarGiftOfferRequest) SetFlags() {
|
||||
if !(r.Decline == false) {
|
||||
r.Flags.Set(0)
|
||||
}
|
||||
}
|
||||
|
||||
// Encode implements bin.Encoder.
|
||||
func (r *PaymentsResolveStarGiftOfferRequest) Encode(b *bin.Buffer) error {
|
||||
if r == nil {
|
||||
return fmt.Errorf("can't encode payments.resolveStarGiftOffer#e9ce781c as nil")
|
||||
}
|
||||
b.PutID(PaymentsResolveStarGiftOfferRequestTypeID)
|
||||
return r.EncodeBare(b)
|
||||
}
|
||||
|
||||
// EncodeBare implements bin.BareEncoder.
|
||||
func (r *PaymentsResolveStarGiftOfferRequest) EncodeBare(b *bin.Buffer) error {
|
||||
if r == nil {
|
||||
return fmt.Errorf("can't encode payments.resolveStarGiftOffer#e9ce781c as nil")
|
||||
}
|
||||
r.SetFlags()
|
||||
if err := r.Flags.Encode(b); err != nil {
|
||||
return fmt.Errorf("unable to encode payments.resolveStarGiftOffer#e9ce781c: field flags: %w", err)
|
||||
}
|
||||
b.PutInt(r.OfferMsgID)
|
||||
return nil
|
||||
}
|
||||
|
||||
// Decode implements bin.Decoder.
|
||||
func (r *PaymentsResolveStarGiftOfferRequest) Decode(b *bin.Buffer) error {
|
||||
if r == nil {
|
||||
return fmt.Errorf("can't decode payments.resolveStarGiftOffer#e9ce781c to nil")
|
||||
}
|
||||
if err := b.ConsumeID(PaymentsResolveStarGiftOfferRequestTypeID); err != nil {
|
||||
return fmt.Errorf("unable to decode payments.resolveStarGiftOffer#e9ce781c: %w", err)
|
||||
}
|
||||
return r.DecodeBare(b)
|
||||
}
|
||||
|
||||
// DecodeBare implements bin.BareDecoder.
|
||||
func (r *PaymentsResolveStarGiftOfferRequest) DecodeBare(b *bin.Buffer) error {
|
||||
if r == nil {
|
||||
return fmt.Errorf("can't decode payments.resolveStarGiftOffer#e9ce781c to nil")
|
||||
}
|
||||
{
|
||||
if err := r.Flags.Decode(b); err != nil {
|
||||
return fmt.Errorf("unable to decode payments.resolveStarGiftOffer#e9ce781c: field flags: %w", err)
|
||||
}
|
||||
}
|
||||
r.Decline = r.Flags.Has(0)
|
||||
{
|
||||
value, err := b.Int()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode payments.resolveStarGiftOffer#e9ce781c: field offer_msg_id: %w", err)
|
||||
}
|
||||
r.OfferMsgID = value
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// SetDecline sets value of Decline conditional field.
|
||||
func (r *PaymentsResolveStarGiftOfferRequest) SetDecline(value bool) {
|
||||
if value {
|
||||
r.Flags.Set(0)
|
||||
r.Decline = true
|
||||
} else {
|
||||
r.Flags.Unset(0)
|
||||
r.Decline = false
|
||||
}
|
||||
}
|
||||
|
||||
// GetDecline returns value of Decline conditional field.
|
||||
func (r *PaymentsResolveStarGiftOfferRequest) GetDecline() (value bool) {
|
||||
if r == nil {
|
||||
return
|
||||
}
|
||||
return r.Flags.Has(0)
|
||||
}
|
||||
|
||||
// GetOfferMsgID returns value of OfferMsgID field.
|
||||
func (r *PaymentsResolveStarGiftOfferRequest) GetOfferMsgID() (value int) {
|
||||
if r == nil {
|
||||
return
|
||||
}
|
||||
return r.OfferMsgID
|
||||
}
|
||||
|
||||
// PaymentsResolveStarGiftOffer invokes method payments.resolveStarGiftOffer#e9ce781c returning error if any.
|
||||
//
|
||||
// See https://core.telegram.org/method/payments.resolveStarGiftOffer for reference.
|
||||
func (c *Client) PaymentsResolveStarGiftOffer(ctx context.Context, request *PaymentsResolveStarGiftOfferRequest) (UpdatesClass, error) {
|
||||
var result UpdatesBox
|
||||
|
||||
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{}
|
||||
)
|
||||
+357
@@ -0,0 +1,357 @@
|
||||
// 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{}
|
||||
)
|
||||
|
||||
// PaymentsSendStarGiftOfferRequest represents TL type `payments.sendStarGiftOffer#8fb86b41`.
|
||||
//
|
||||
// See https://core.telegram.org/method/payments.sendStarGiftOffer for reference.
|
||||
type PaymentsSendStarGiftOfferRequest struct {
|
||||
// Flags field of PaymentsSendStarGiftOfferRequest.
|
||||
Flags bin.Fields
|
||||
// Peer field of PaymentsSendStarGiftOfferRequest.
|
||||
Peer InputPeerClass
|
||||
// Slug field of PaymentsSendStarGiftOfferRequest.
|
||||
Slug string
|
||||
// Price field of PaymentsSendStarGiftOfferRequest.
|
||||
Price StarsAmountClass
|
||||
// Duration field of PaymentsSendStarGiftOfferRequest.
|
||||
Duration int
|
||||
// RandomID field of PaymentsSendStarGiftOfferRequest.
|
||||
RandomID int64
|
||||
// AllowPaidStars field of PaymentsSendStarGiftOfferRequest.
|
||||
//
|
||||
// Use SetAllowPaidStars and GetAllowPaidStars helpers.
|
||||
AllowPaidStars int64
|
||||
}
|
||||
|
||||
// PaymentsSendStarGiftOfferRequestTypeID is TL type id of PaymentsSendStarGiftOfferRequest.
|
||||
const PaymentsSendStarGiftOfferRequestTypeID = 0x8fb86b41
|
||||
|
||||
// Ensuring interfaces in compile-time for PaymentsSendStarGiftOfferRequest.
|
||||
var (
|
||||
_ bin.Encoder = &PaymentsSendStarGiftOfferRequest{}
|
||||
_ bin.Decoder = &PaymentsSendStarGiftOfferRequest{}
|
||||
_ bin.BareEncoder = &PaymentsSendStarGiftOfferRequest{}
|
||||
_ bin.BareDecoder = &PaymentsSendStarGiftOfferRequest{}
|
||||
)
|
||||
|
||||
func (s *PaymentsSendStarGiftOfferRequest) Zero() bool {
|
||||
if s == nil {
|
||||
return true
|
||||
}
|
||||
if !(s.Flags.Zero()) {
|
||||
return false
|
||||
}
|
||||
if !(s.Peer == nil) {
|
||||
return false
|
||||
}
|
||||
if !(s.Slug == "") {
|
||||
return false
|
||||
}
|
||||
if !(s.Price == nil) {
|
||||
return false
|
||||
}
|
||||
if !(s.Duration == 0) {
|
||||
return false
|
||||
}
|
||||
if !(s.RandomID == 0) {
|
||||
return false
|
||||
}
|
||||
if !(s.AllowPaidStars == 0) {
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
// String implements fmt.Stringer.
|
||||
func (s *PaymentsSendStarGiftOfferRequest) String() string {
|
||||
if s == nil {
|
||||
return "PaymentsSendStarGiftOfferRequest(nil)"
|
||||
}
|
||||
type Alias PaymentsSendStarGiftOfferRequest
|
||||
return fmt.Sprintf("PaymentsSendStarGiftOfferRequest%+v", Alias(*s))
|
||||
}
|
||||
|
||||
// FillFrom fills PaymentsSendStarGiftOfferRequest from given interface.
|
||||
func (s *PaymentsSendStarGiftOfferRequest) FillFrom(from interface {
|
||||
GetPeer() (value InputPeerClass)
|
||||
GetSlug() (value string)
|
||||
GetPrice() (value StarsAmountClass)
|
||||
GetDuration() (value int)
|
||||
GetRandomID() (value int64)
|
||||
GetAllowPaidStars() (value int64, ok bool)
|
||||
}) {
|
||||
s.Peer = from.GetPeer()
|
||||
s.Slug = from.GetSlug()
|
||||
s.Price = from.GetPrice()
|
||||
s.Duration = from.GetDuration()
|
||||
s.RandomID = from.GetRandomID()
|
||||
if val, ok := from.GetAllowPaidStars(); ok {
|
||||
s.AllowPaidStars = val
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// TypeID returns type id in TL schema.
|
||||
//
|
||||
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
||||
func (*PaymentsSendStarGiftOfferRequest) TypeID() uint32 {
|
||||
return PaymentsSendStarGiftOfferRequestTypeID
|
||||
}
|
||||
|
||||
// TypeName returns name of type in TL schema.
|
||||
func (*PaymentsSendStarGiftOfferRequest) TypeName() string {
|
||||
return "payments.sendStarGiftOffer"
|
||||
}
|
||||
|
||||
// TypeInfo returns info about TL type.
|
||||
func (s *PaymentsSendStarGiftOfferRequest) TypeInfo() tdp.Type {
|
||||
typ := tdp.Type{
|
||||
Name: "payments.sendStarGiftOffer",
|
||||
ID: PaymentsSendStarGiftOfferRequestTypeID,
|
||||
}
|
||||
if s == nil {
|
||||
typ.Null = true
|
||||
return typ
|
||||
}
|
||||
typ.Fields = []tdp.Field{
|
||||
{
|
||||
Name: "Peer",
|
||||
SchemaName: "peer",
|
||||
},
|
||||
{
|
||||
Name: "Slug",
|
||||
SchemaName: "slug",
|
||||
},
|
||||
{
|
||||
Name: "Price",
|
||||
SchemaName: "price",
|
||||
},
|
||||
{
|
||||
Name: "Duration",
|
||||
SchemaName: "duration",
|
||||
},
|
||||
{
|
||||
Name: "RandomID",
|
||||
SchemaName: "random_id",
|
||||
},
|
||||
{
|
||||
Name: "AllowPaidStars",
|
||||
SchemaName: "allow_paid_stars",
|
||||
Null: !s.Flags.Has(0),
|
||||
},
|
||||
}
|
||||
return typ
|
||||
}
|
||||
|
||||
// SetFlags sets flags for non-zero fields.
|
||||
func (s *PaymentsSendStarGiftOfferRequest) SetFlags() {
|
||||
if !(s.AllowPaidStars == 0) {
|
||||
s.Flags.Set(0)
|
||||
}
|
||||
}
|
||||
|
||||
// Encode implements bin.Encoder.
|
||||
func (s *PaymentsSendStarGiftOfferRequest) Encode(b *bin.Buffer) error {
|
||||
if s == nil {
|
||||
return fmt.Errorf("can't encode payments.sendStarGiftOffer#8fb86b41 as nil")
|
||||
}
|
||||
b.PutID(PaymentsSendStarGiftOfferRequestTypeID)
|
||||
return s.EncodeBare(b)
|
||||
}
|
||||
|
||||
// EncodeBare implements bin.BareEncoder.
|
||||
func (s *PaymentsSendStarGiftOfferRequest) EncodeBare(b *bin.Buffer) error {
|
||||
if s == nil {
|
||||
return fmt.Errorf("can't encode payments.sendStarGiftOffer#8fb86b41 as nil")
|
||||
}
|
||||
s.SetFlags()
|
||||
if err := s.Flags.Encode(b); err != nil {
|
||||
return fmt.Errorf("unable to encode payments.sendStarGiftOffer#8fb86b41: field flags: %w", err)
|
||||
}
|
||||
if s.Peer == nil {
|
||||
return fmt.Errorf("unable to encode payments.sendStarGiftOffer#8fb86b41: field peer is nil")
|
||||
}
|
||||
if err := s.Peer.Encode(b); err != nil {
|
||||
return fmt.Errorf("unable to encode payments.sendStarGiftOffer#8fb86b41: field peer: %w", err)
|
||||
}
|
||||
b.PutString(s.Slug)
|
||||
if s.Price == nil {
|
||||
return fmt.Errorf("unable to encode payments.sendStarGiftOffer#8fb86b41: field price is nil")
|
||||
}
|
||||
if err := s.Price.Encode(b); err != nil {
|
||||
return fmt.Errorf("unable to encode payments.sendStarGiftOffer#8fb86b41: field price: %w", err)
|
||||
}
|
||||
b.PutInt(s.Duration)
|
||||
b.PutLong(s.RandomID)
|
||||
if s.Flags.Has(0) {
|
||||
b.PutLong(s.AllowPaidStars)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Decode implements bin.Decoder.
|
||||
func (s *PaymentsSendStarGiftOfferRequest) Decode(b *bin.Buffer) error {
|
||||
if s == nil {
|
||||
return fmt.Errorf("can't decode payments.sendStarGiftOffer#8fb86b41 to nil")
|
||||
}
|
||||
if err := b.ConsumeID(PaymentsSendStarGiftOfferRequestTypeID); err != nil {
|
||||
return fmt.Errorf("unable to decode payments.sendStarGiftOffer#8fb86b41: %w", err)
|
||||
}
|
||||
return s.DecodeBare(b)
|
||||
}
|
||||
|
||||
// DecodeBare implements bin.BareDecoder.
|
||||
func (s *PaymentsSendStarGiftOfferRequest) DecodeBare(b *bin.Buffer) error {
|
||||
if s == nil {
|
||||
return fmt.Errorf("can't decode payments.sendStarGiftOffer#8fb86b41 to nil")
|
||||
}
|
||||
{
|
||||
if err := s.Flags.Decode(b); err != nil {
|
||||
return fmt.Errorf("unable to decode payments.sendStarGiftOffer#8fb86b41: field flags: %w", err)
|
||||
}
|
||||
}
|
||||
{
|
||||
value, err := DecodeInputPeer(b)
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode payments.sendStarGiftOffer#8fb86b41: field peer: %w", err)
|
||||
}
|
||||
s.Peer = value
|
||||
}
|
||||
{
|
||||
value, err := b.String()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode payments.sendStarGiftOffer#8fb86b41: field slug: %w", err)
|
||||
}
|
||||
s.Slug = value
|
||||
}
|
||||
{
|
||||
value, err := DecodeStarsAmount(b)
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode payments.sendStarGiftOffer#8fb86b41: field price: %w", err)
|
||||
}
|
||||
s.Price = value
|
||||
}
|
||||
{
|
||||
value, err := b.Int()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode payments.sendStarGiftOffer#8fb86b41: field duration: %w", err)
|
||||
}
|
||||
s.Duration = value
|
||||
}
|
||||
{
|
||||
value, err := b.Long()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode payments.sendStarGiftOffer#8fb86b41: field random_id: %w", err)
|
||||
}
|
||||
s.RandomID = value
|
||||
}
|
||||
if s.Flags.Has(0) {
|
||||
value, err := b.Long()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode payments.sendStarGiftOffer#8fb86b41: field allow_paid_stars: %w", err)
|
||||
}
|
||||
s.AllowPaidStars = value
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// GetPeer returns value of Peer field.
|
||||
func (s *PaymentsSendStarGiftOfferRequest) GetPeer() (value InputPeerClass) {
|
||||
if s == nil {
|
||||
return
|
||||
}
|
||||
return s.Peer
|
||||
}
|
||||
|
||||
// GetSlug returns value of Slug field.
|
||||
func (s *PaymentsSendStarGiftOfferRequest) GetSlug() (value string) {
|
||||
if s == nil {
|
||||
return
|
||||
}
|
||||
return s.Slug
|
||||
}
|
||||
|
||||
// GetPrice returns value of Price field.
|
||||
func (s *PaymentsSendStarGiftOfferRequest) GetPrice() (value StarsAmountClass) {
|
||||
if s == nil {
|
||||
return
|
||||
}
|
||||
return s.Price
|
||||
}
|
||||
|
||||
// GetDuration returns value of Duration field.
|
||||
func (s *PaymentsSendStarGiftOfferRequest) GetDuration() (value int) {
|
||||
if s == nil {
|
||||
return
|
||||
}
|
||||
return s.Duration
|
||||
}
|
||||
|
||||
// GetRandomID returns value of RandomID field.
|
||||
func (s *PaymentsSendStarGiftOfferRequest) GetRandomID() (value int64) {
|
||||
if s == nil {
|
||||
return
|
||||
}
|
||||
return s.RandomID
|
||||
}
|
||||
|
||||
// SetAllowPaidStars sets value of AllowPaidStars conditional field.
|
||||
func (s *PaymentsSendStarGiftOfferRequest) SetAllowPaidStars(value int64) {
|
||||
s.Flags.Set(0)
|
||||
s.AllowPaidStars = value
|
||||
}
|
||||
|
||||
// GetAllowPaidStars returns value of AllowPaidStars conditional field and
|
||||
// boolean which is true if field was set.
|
||||
func (s *PaymentsSendStarGiftOfferRequest) GetAllowPaidStars() (value int64, ok bool) {
|
||||
if s == nil {
|
||||
return
|
||||
}
|
||||
if !s.Flags.Has(0) {
|
||||
return value, false
|
||||
}
|
||||
return s.AllowPaidStars, true
|
||||
}
|
||||
|
||||
// PaymentsSendStarGiftOffer invokes method payments.sendStarGiftOffer#8fb86b41 returning error if any.
|
||||
//
|
||||
// See https://core.telegram.org/method/payments.sendStarGiftOffer for reference.
|
||||
func (c *Client) PaymentsSendStarGiftOffer(ctx context.Context, request *PaymentsSendStarGiftOfferRequest) (UpdatesClass, error) {
|
||||
var result UpdatesBox
|
||||
|
||||
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{}
|
||||
)
|
||||
+66
-16
@@ -134,7 +134,7 @@ func (s *PaymentsStarGiftActiveAuctionsNotModified) DecodeBare(b *bin.Buffer) er
|
||||
return nil
|
||||
}
|
||||
|
||||
// PaymentsStarGiftActiveAuctions represents TL type `payments.starGiftActiveAuctions#97f187d8`.
|
||||
// PaymentsStarGiftActiveAuctions represents TL type `payments.starGiftActiveAuctions#aef6abbc`.
|
||||
//
|
||||
// See https://core.telegram.org/constructor/payments.starGiftActiveAuctions for reference.
|
||||
type PaymentsStarGiftActiveAuctions struct {
|
||||
@@ -142,10 +142,12 @@ type PaymentsStarGiftActiveAuctions struct {
|
||||
Auctions []StarGiftActiveAuctionState
|
||||
// Users field of PaymentsStarGiftActiveAuctions.
|
||||
Users []UserClass
|
||||
// Chats field of PaymentsStarGiftActiveAuctions.
|
||||
Chats []ChatClass
|
||||
}
|
||||
|
||||
// PaymentsStarGiftActiveAuctionsTypeID is TL type id of PaymentsStarGiftActiveAuctions.
|
||||
const PaymentsStarGiftActiveAuctionsTypeID = 0x97f187d8
|
||||
const PaymentsStarGiftActiveAuctionsTypeID = 0xaef6abbc
|
||||
|
||||
// construct implements constructor of PaymentsStarGiftActiveAuctionsClass.
|
||||
func (s PaymentsStarGiftActiveAuctions) construct() PaymentsStarGiftActiveAuctionsClass { return &s }
|
||||
@@ -170,6 +172,9 @@ func (s *PaymentsStarGiftActiveAuctions) Zero() bool {
|
||||
if !(s.Users == nil) {
|
||||
return false
|
||||
}
|
||||
if !(s.Chats == nil) {
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
@@ -187,9 +192,11 @@ func (s *PaymentsStarGiftActiveAuctions) String() string {
|
||||
func (s *PaymentsStarGiftActiveAuctions) FillFrom(from interface {
|
||||
GetAuctions() (value []StarGiftActiveAuctionState)
|
||||
GetUsers() (value []UserClass)
|
||||
GetChats() (value []ChatClass)
|
||||
}) {
|
||||
s.Auctions = from.GetAuctions()
|
||||
s.Users = from.GetUsers()
|
||||
s.Chats = from.GetChats()
|
||||
}
|
||||
|
||||
// TypeID returns type id in TL schema.
|
||||
@@ -223,6 +230,10 @@ func (s *PaymentsStarGiftActiveAuctions) TypeInfo() tdp.Type {
|
||||
Name: "Users",
|
||||
SchemaName: "users",
|
||||
},
|
||||
{
|
||||
Name: "Chats",
|
||||
SchemaName: "chats",
|
||||
},
|
||||
}
|
||||
return typ
|
||||
}
|
||||
@@ -230,7 +241,7 @@ func (s *PaymentsStarGiftActiveAuctions) TypeInfo() tdp.Type {
|
||||
// Encode implements bin.Encoder.
|
||||
func (s *PaymentsStarGiftActiveAuctions) Encode(b *bin.Buffer) error {
|
||||
if s == nil {
|
||||
return fmt.Errorf("can't encode payments.starGiftActiveAuctions#97f187d8 as nil")
|
||||
return fmt.Errorf("can't encode payments.starGiftActiveAuctions#aef6abbc as nil")
|
||||
}
|
||||
b.PutID(PaymentsStarGiftActiveAuctionsTypeID)
|
||||
return s.EncodeBare(b)
|
||||
@@ -239,21 +250,30 @@ func (s *PaymentsStarGiftActiveAuctions) Encode(b *bin.Buffer) error {
|
||||
// EncodeBare implements bin.BareEncoder.
|
||||
func (s *PaymentsStarGiftActiveAuctions) EncodeBare(b *bin.Buffer) error {
|
||||
if s == nil {
|
||||
return fmt.Errorf("can't encode payments.starGiftActiveAuctions#97f187d8 as nil")
|
||||
return fmt.Errorf("can't encode payments.starGiftActiveAuctions#aef6abbc as nil")
|
||||
}
|
||||
b.PutVectorHeader(len(s.Auctions))
|
||||
for idx, v := range s.Auctions {
|
||||
if err := v.Encode(b); err != nil {
|
||||
return fmt.Errorf("unable to encode payments.starGiftActiveAuctions#97f187d8: field auctions element with index %d: %w", idx, err)
|
||||
return fmt.Errorf("unable to encode payments.starGiftActiveAuctions#aef6abbc: field auctions element with index %d: %w", idx, err)
|
||||
}
|
||||
}
|
||||
b.PutVectorHeader(len(s.Users))
|
||||
for idx, v := range s.Users {
|
||||
if v == nil {
|
||||
return fmt.Errorf("unable to encode payments.starGiftActiveAuctions#97f187d8: field users element with index %d is nil", idx)
|
||||
return fmt.Errorf("unable to encode payments.starGiftActiveAuctions#aef6abbc: field users element with index %d is nil", idx)
|
||||
}
|
||||
if err := v.Encode(b); err != nil {
|
||||
return fmt.Errorf("unable to encode payments.starGiftActiveAuctions#97f187d8: field users element with index %d: %w", idx, err)
|
||||
return fmt.Errorf("unable to encode payments.starGiftActiveAuctions#aef6abbc: field users element with index %d: %w", idx, err)
|
||||
}
|
||||
}
|
||||
b.PutVectorHeader(len(s.Chats))
|
||||
for idx, v := range s.Chats {
|
||||
if v == nil {
|
||||
return fmt.Errorf("unable to encode payments.starGiftActiveAuctions#aef6abbc: field chats element with index %d is nil", idx)
|
||||
}
|
||||
if err := v.Encode(b); err != nil {
|
||||
return fmt.Errorf("unable to encode payments.starGiftActiveAuctions#aef6abbc: field chats element with index %d: %w", idx, err)
|
||||
}
|
||||
}
|
||||
return nil
|
||||
@@ -262,10 +282,10 @@ func (s *PaymentsStarGiftActiveAuctions) EncodeBare(b *bin.Buffer) error {
|
||||
// Decode implements bin.Decoder.
|
||||
func (s *PaymentsStarGiftActiveAuctions) Decode(b *bin.Buffer) error {
|
||||
if s == nil {
|
||||
return fmt.Errorf("can't decode payments.starGiftActiveAuctions#97f187d8 to nil")
|
||||
return fmt.Errorf("can't decode payments.starGiftActiveAuctions#aef6abbc to nil")
|
||||
}
|
||||
if err := b.ConsumeID(PaymentsStarGiftActiveAuctionsTypeID); err != nil {
|
||||
return fmt.Errorf("unable to decode payments.starGiftActiveAuctions#97f187d8: %w", err)
|
||||
return fmt.Errorf("unable to decode payments.starGiftActiveAuctions#aef6abbc: %w", err)
|
||||
}
|
||||
return s.DecodeBare(b)
|
||||
}
|
||||
@@ -273,12 +293,12 @@ func (s *PaymentsStarGiftActiveAuctions) Decode(b *bin.Buffer) error {
|
||||
// DecodeBare implements bin.BareDecoder.
|
||||
func (s *PaymentsStarGiftActiveAuctions) DecodeBare(b *bin.Buffer) error {
|
||||
if s == nil {
|
||||
return fmt.Errorf("can't decode payments.starGiftActiveAuctions#97f187d8 to nil")
|
||||
return fmt.Errorf("can't decode payments.starGiftActiveAuctions#aef6abbc to nil")
|
||||
}
|
||||
{
|
||||
headerLen, err := b.VectorHeader()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode payments.starGiftActiveAuctions#97f187d8: field auctions: %w", err)
|
||||
return fmt.Errorf("unable to decode payments.starGiftActiveAuctions#aef6abbc: field auctions: %w", err)
|
||||
}
|
||||
|
||||
if headerLen > 0 {
|
||||
@@ -287,7 +307,7 @@ func (s *PaymentsStarGiftActiveAuctions) DecodeBare(b *bin.Buffer) error {
|
||||
for idx := 0; idx < headerLen; idx++ {
|
||||
var value StarGiftActiveAuctionState
|
||||
if err := value.Decode(b); err != nil {
|
||||
return fmt.Errorf("unable to decode payments.starGiftActiveAuctions#97f187d8: field auctions: %w", err)
|
||||
return fmt.Errorf("unable to decode payments.starGiftActiveAuctions#aef6abbc: field auctions: %w", err)
|
||||
}
|
||||
s.Auctions = append(s.Auctions, value)
|
||||
}
|
||||
@@ -295,7 +315,7 @@ func (s *PaymentsStarGiftActiveAuctions) DecodeBare(b *bin.Buffer) error {
|
||||
{
|
||||
headerLen, err := b.VectorHeader()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode payments.starGiftActiveAuctions#97f187d8: field users: %w", err)
|
||||
return fmt.Errorf("unable to decode payments.starGiftActiveAuctions#aef6abbc: field users: %w", err)
|
||||
}
|
||||
|
||||
if headerLen > 0 {
|
||||
@@ -304,11 +324,28 @@ func (s *PaymentsStarGiftActiveAuctions) DecodeBare(b *bin.Buffer) error {
|
||||
for idx := 0; idx < headerLen; idx++ {
|
||||
value, err := DecodeUser(b)
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode payments.starGiftActiveAuctions#97f187d8: field users: %w", err)
|
||||
return fmt.Errorf("unable to decode payments.starGiftActiveAuctions#aef6abbc: field users: %w", err)
|
||||
}
|
||||
s.Users = append(s.Users, value)
|
||||
}
|
||||
}
|
||||
{
|
||||
headerLen, err := b.VectorHeader()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode payments.starGiftActiveAuctions#aef6abbc: field chats: %w", err)
|
||||
}
|
||||
|
||||
if headerLen > 0 {
|
||||
s.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 payments.starGiftActiveAuctions#aef6abbc: field chats: %w", err)
|
||||
}
|
||||
s.Chats = append(s.Chats, value)
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -328,11 +365,24 @@ func (s *PaymentsStarGiftActiveAuctions) GetUsers() (value []UserClass) {
|
||||
return s.Users
|
||||
}
|
||||
|
||||
// GetChats returns value of Chats field.
|
||||
func (s *PaymentsStarGiftActiveAuctions) GetChats() (value []ChatClass) {
|
||||
if s == nil {
|
||||
return
|
||||
}
|
||||
return s.Chats
|
||||
}
|
||||
|
||||
// MapUsers returns field Users wrapped in UserClassArray helper.
|
||||
func (s *PaymentsStarGiftActiveAuctions) MapUsers() (value UserClassArray) {
|
||||
return UserClassArray(s.Users)
|
||||
}
|
||||
|
||||
// MapChats returns field Chats wrapped in ChatClassArray helper.
|
||||
func (s *PaymentsStarGiftActiveAuctions) MapChats() (value ChatClassArray) {
|
||||
return ChatClassArray(s.Chats)
|
||||
}
|
||||
|
||||
// PaymentsStarGiftActiveAuctionsClassName is schema name of PaymentsStarGiftActiveAuctionsClass.
|
||||
const PaymentsStarGiftActiveAuctionsClassName = "payments.StarGiftActiveAuctions"
|
||||
|
||||
@@ -348,7 +398,7 @@ const PaymentsStarGiftActiveAuctionsClassName = "payments.StarGiftActiveAuctions
|
||||
// }
|
||||
// switch v := g.(type) {
|
||||
// case *tg.PaymentsStarGiftActiveAuctionsNotModified: // payments.starGiftActiveAuctionsNotModified#db33dad0
|
||||
// case *tg.PaymentsStarGiftActiveAuctions: // payments.starGiftActiveAuctions#97f187d8
|
||||
// case *tg.PaymentsStarGiftActiveAuctions: // payments.starGiftActiveAuctions#aef6abbc
|
||||
// default: panic(v)
|
||||
// }
|
||||
type PaymentsStarGiftActiveAuctionsClass interface {
|
||||
@@ -398,7 +448,7 @@ func DecodePaymentsStarGiftActiveAuctions(buf *bin.Buffer) (PaymentsStarGiftActi
|
||||
}
|
||||
return &v, nil
|
||||
case PaymentsStarGiftActiveAuctionsTypeID:
|
||||
// Decoding payments.starGiftActiveAuctions#97f187d8.
|
||||
// Decoding payments.starGiftActiveAuctions#aef6abbc.
|
||||
v := PaymentsStarGiftActiveAuctions{}
|
||||
if err := v.Decode(buf); err != nil {
|
||||
return nil, fmt.Errorf("unable to decode PaymentsStarGiftActiveAuctionsClass: %w", err)
|
||||
|
||||
+70
-20
@@ -31,7 +31,7 @@ var (
|
||||
_ = tdjson.Encoder{}
|
||||
)
|
||||
|
||||
// PaymentsStarGiftAuctionState represents TL type `payments.starGiftAuctionState#e98e474`.
|
||||
// PaymentsStarGiftAuctionState represents TL type `payments.starGiftAuctionState#6b39f4ec`.
|
||||
//
|
||||
// See https://core.telegram.org/constructor/payments.starGiftAuctionState for reference.
|
||||
type PaymentsStarGiftAuctionState struct {
|
||||
@@ -45,10 +45,12 @@ type PaymentsStarGiftAuctionState struct {
|
||||
Timeout int
|
||||
// Users field of PaymentsStarGiftAuctionState.
|
||||
Users []UserClass
|
||||
// Chats field of PaymentsStarGiftAuctionState.
|
||||
Chats []ChatClass
|
||||
}
|
||||
|
||||
// PaymentsStarGiftAuctionStateTypeID is TL type id of PaymentsStarGiftAuctionState.
|
||||
const PaymentsStarGiftAuctionStateTypeID = 0xe98e474
|
||||
const PaymentsStarGiftAuctionStateTypeID = 0x6b39f4ec
|
||||
|
||||
// Ensuring interfaces in compile-time for PaymentsStarGiftAuctionState.
|
||||
var (
|
||||
@@ -77,6 +79,9 @@ func (s *PaymentsStarGiftAuctionState) Zero() bool {
|
||||
if !(s.Users == nil) {
|
||||
return false
|
||||
}
|
||||
if !(s.Chats == nil) {
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
@@ -97,12 +102,14 @@ func (s *PaymentsStarGiftAuctionState) FillFrom(from interface {
|
||||
GetUserState() (value StarGiftAuctionUserState)
|
||||
GetTimeout() (value int)
|
||||
GetUsers() (value []UserClass)
|
||||
GetChats() (value []ChatClass)
|
||||
}) {
|
||||
s.Gift = from.GetGift()
|
||||
s.State = from.GetState()
|
||||
s.UserState = from.GetUserState()
|
||||
s.Timeout = from.GetTimeout()
|
||||
s.Users = from.GetUsers()
|
||||
s.Chats = from.GetChats()
|
||||
}
|
||||
|
||||
// TypeID returns type id in TL schema.
|
||||
@@ -148,6 +155,10 @@ func (s *PaymentsStarGiftAuctionState) TypeInfo() tdp.Type {
|
||||
Name: "Users",
|
||||
SchemaName: "users",
|
||||
},
|
||||
{
|
||||
Name: "Chats",
|
||||
SchemaName: "chats",
|
||||
},
|
||||
}
|
||||
return typ
|
||||
}
|
||||
@@ -155,7 +166,7 @@ func (s *PaymentsStarGiftAuctionState) TypeInfo() tdp.Type {
|
||||
// Encode implements bin.Encoder.
|
||||
func (s *PaymentsStarGiftAuctionState) Encode(b *bin.Buffer) error {
|
||||
if s == nil {
|
||||
return fmt.Errorf("can't encode payments.starGiftAuctionState#e98e474 as nil")
|
||||
return fmt.Errorf("can't encode payments.starGiftAuctionState#6b39f4ec as nil")
|
||||
}
|
||||
b.PutID(PaymentsStarGiftAuctionStateTypeID)
|
||||
return s.EncodeBare(b)
|
||||
@@ -164,31 +175,40 @@ func (s *PaymentsStarGiftAuctionState) Encode(b *bin.Buffer) error {
|
||||
// EncodeBare implements bin.BareEncoder.
|
||||
func (s *PaymentsStarGiftAuctionState) EncodeBare(b *bin.Buffer) error {
|
||||
if s == nil {
|
||||
return fmt.Errorf("can't encode payments.starGiftAuctionState#e98e474 as nil")
|
||||
return fmt.Errorf("can't encode payments.starGiftAuctionState#6b39f4ec as nil")
|
||||
}
|
||||
if s.Gift == nil {
|
||||
return fmt.Errorf("unable to encode payments.starGiftAuctionState#e98e474: field gift is nil")
|
||||
return fmt.Errorf("unable to encode payments.starGiftAuctionState#6b39f4ec: field gift is nil")
|
||||
}
|
||||
if err := s.Gift.Encode(b); err != nil {
|
||||
return fmt.Errorf("unable to encode payments.starGiftAuctionState#e98e474: field gift: %w", err)
|
||||
return fmt.Errorf("unable to encode payments.starGiftAuctionState#6b39f4ec: field gift: %w", err)
|
||||
}
|
||||
if s.State == nil {
|
||||
return fmt.Errorf("unable to encode payments.starGiftAuctionState#e98e474: field state is nil")
|
||||
return fmt.Errorf("unable to encode payments.starGiftAuctionState#6b39f4ec: field state is nil")
|
||||
}
|
||||
if err := s.State.Encode(b); err != nil {
|
||||
return fmt.Errorf("unable to encode payments.starGiftAuctionState#e98e474: field state: %w", err)
|
||||
return fmt.Errorf("unable to encode payments.starGiftAuctionState#6b39f4ec: field state: %w", err)
|
||||
}
|
||||
if err := s.UserState.Encode(b); err != nil {
|
||||
return fmt.Errorf("unable to encode payments.starGiftAuctionState#e98e474: field user_state: %w", err)
|
||||
return fmt.Errorf("unable to encode payments.starGiftAuctionState#6b39f4ec: field user_state: %w", err)
|
||||
}
|
||||
b.PutInt(s.Timeout)
|
||||
b.PutVectorHeader(len(s.Users))
|
||||
for idx, v := range s.Users {
|
||||
if v == nil {
|
||||
return fmt.Errorf("unable to encode payments.starGiftAuctionState#e98e474: field users element with index %d is nil", idx)
|
||||
return fmt.Errorf("unable to encode payments.starGiftAuctionState#6b39f4ec: field users element with index %d is nil", idx)
|
||||
}
|
||||
if err := v.Encode(b); err != nil {
|
||||
return fmt.Errorf("unable to encode payments.starGiftAuctionState#e98e474: field users element with index %d: %w", idx, err)
|
||||
return fmt.Errorf("unable to encode payments.starGiftAuctionState#6b39f4ec: field users element with index %d: %w", idx, err)
|
||||
}
|
||||
}
|
||||
b.PutVectorHeader(len(s.Chats))
|
||||
for idx, v := range s.Chats {
|
||||
if v == nil {
|
||||
return fmt.Errorf("unable to encode payments.starGiftAuctionState#6b39f4ec: field chats element with index %d is nil", idx)
|
||||
}
|
||||
if err := v.Encode(b); err != nil {
|
||||
return fmt.Errorf("unable to encode payments.starGiftAuctionState#6b39f4ec: field chats element with index %d: %w", idx, err)
|
||||
}
|
||||
}
|
||||
return nil
|
||||
@@ -197,10 +217,10 @@ func (s *PaymentsStarGiftAuctionState) EncodeBare(b *bin.Buffer) error {
|
||||
// Decode implements bin.Decoder.
|
||||
func (s *PaymentsStarGiftAuctionState) Decode(b *bin.Buffer) error {
|
||||
if s == nil {
|
||||
return fmt.Errorf("can't decode payments.starGiftAuctionState#e98e474 to nil")
|
||||
return fmt.Errorf("can't decode payments.starGiftAuctionState#6b39f4ec to nil")
|
||||
}
|
||||
if err := b.ConsumeID(PaymentsStarGiftAuctionStateTypeID); err != nil {
|
||||
return fmt.Errorf("unable to decode payments.starGiftAuctionState#e98e474: %w", err)
|
||||
return fmt.Errorf("unable to decode payments.starGiftAuctionState#6b39f4ec: %w", err)
|
||||
}
|
||||
return s.DecodeBare(b)
|
||||
}
|
||||
@@ -208,38 +228,38 @@ func (s *PaymentsStarGiftAuctionState) Decode(b *bin.Buffer) error {
|
||||
// DecodeBare implements bin.BareDecoder.
|
||||
func (s *PaymentsStarGiftAuctionState) DecodeBare(b *bin.Buffer) error {
|
||||
if s == nil {
|
||||
return fmt.Errorf("can't decode payments.starGiftAuctionState#e98e474 to nil")
|
||||
return fmt.Errorf("can't decode payments.starGiftAuctionState#6b39f4ec to nil")
|
||||
}
|
||||
{
|
||||
value, err := DecodeStarGift(b)
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode payments.starGiftAuctionState#e98e474: field gift: %w", err)
|
||||
return fmt.Errorf("unable to decode payments.starGiftAuctionState#6b39f4ec: field gift: %w", err)
|
||||
}
|
||||
s.Gift = value
|
||||
}
|
||||
{
|
||||
value, err := DecodeStarGiftAuctionState(b)
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode payments.starGiftAuctionState#e98e474: field state: %w", err)
|
||||
return fmt.Errorf("unable to decode payments.starGiftAuctionState#6b39f4ec: field state: %w", err)
|
||||
}
|
||||
s.State = value
|
||||
}
|
||||
{
|
||||
if err := s.UserState.Decode(b); err != nil {
|
||||
return fmt.Errorf("unable to decode payments.starGiftAuctionState#e98e474: field user_state: %w", err)
|
||||
return fmt.Errorf("unable to decode payments.starGiftAuctionState#6b39f4ec: field user_state: %w", err)
|
||||
}
|
||||
}
|
||||
{
|
||||
value, err := b.Int()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode payments.starGiftAuctionState#e98e474: field timeout: %w", err)
|
||||
return fmt.Errorf("unable to decode payments.starGiftAuctionState#6b39f4ec: field timeout: %w", err)
|
||||
}
|
||||
s.Timeout = value
|
||||
}
|
||||
{
|
||||
headerLen, err := b.VectorHeader()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode payments.starGiftAuctionState#e98e474: field users: %w", err)
|
||||
return fmt.Errorf("unable to decode payments.starGiftAuctionState#6b39f4ec: field users: %w", err)
|
||||
}
|
||||
|
||||
if headerLen > 0 {
|
||||
@@ -248,11 +268,28 @@ func (s *PaymentsStarGiftAuctionState) DecodeBare(b *bin.Buffer) error {
|
||||
for idx := 0; idx < headerLen; idx++ {
|
||||
value, err := DecodeUser(b)
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode payments.starGiftAuctionState#e98e474: field users: %w", err)
|
||||
return fmt.Errorf("unable to decode payments.starGiftAuctionState#6b39f4ec: field users: %w", err)
|
||||
}
|
||||
s.Users = append(s.Users, value)
|
||||
}
|
||||
}
|
||||
{
|
||||
headerLen, err := b.VectorHeader()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode payments.starGiftAuctionState#6b39f4ec: field chats: %w", err)
|
||||
}
|
||||
|
||||
if headerLen > 0 {
|
||||
s.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 payments.starGiftAuctionState#6b39f4ec: field chats: %w", err)
|
||||
}
|
||||
s.Chats = append(s.Chats, value)
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -296,6 +333,14 @@ func (s *PaymentsStarGiftAuctionState) GetUsers() (value []UserClass) {
|
||||
return s.Users
|
||||
}
|
||||
|
||||
// GetChats returns value of Chats field.
|
||||
func (s *PaymentsStarGiftAuctionState) GetChats() (value []ChatClass) {
|
||||
if s == nil {
|
||||
return
|
||||
}
|
||||
return s.Chats
|
||||
}
|
||||
|
||||
// GetStateAsModified returns mapped value of State field.
|
||||
func (s *PaymentsStarGiftAuctionState) GetStateAsModified() (ModifiedStarGiftAuctionState, bool) {
|
||||
return s.State.AsModified()
|
||||
@@ -305,3 +350,8 @@ func (s *PaymentsStarGiftAuctionState) GetStateAsModified() (ModifiedStarGiftAuc
|
||||
func (s *PaymentsStarGiftAuctionState) MapUsers() (value UserClassArray) {
|
||||
return UserClassArray(s.Users)
|
||||
}
|
||||
|
||||
// MapChats returns field Chats wrapped in ChatClassArray helper.
|
||||
func (s *PaymentsStarGiftAuctionState) MapChats() (value ChatClassArray) {
|
||||
return ChatClassArray(s.Chats)
|
||||
}
|
||||
|
||||
@@ -0,0 +1,184 @@
|
||||
// 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{}
|
||||
)
|
||||
|
||||
// PaymentsStarGiftUpgradeAttributes represents TL type `payments.starGiftUpgradeAttributes#46c6e36f`.
|
||||
//
|
||||
// See https://core.telegram.org/constructor/payments.starGiftUpgradeAttributes for reference.
|
||||
type PaymentsStarGiftUpgradeAttributes struct {
|
||||
// Attributes field of PaymentsStarGiftUpgradeAttributes.
|
||||
Attributes []StarGiftAttributeClass
|
||||
}
|
||||
|
||||
// PaymentsStarGiftUpgradeAttributesTypeID is TL type id of PaymentsStarGiftUpgradeAttributes.
|
||||
const PaymentsStarGiftUpgradeAttributesTypeID = 0x46c6e36f
|
||||
|
||||
// Ensuring interfaces in compile-time for PaymentsStarGiftUpgradeAttributes.
|
||||
var (
|
||||
_ bin.Encoder = &PaymentsStarGiftUpgradeAttributes{}
|
||||
_ bin.Decoder = &PaymentsStarGiftUpgradeAttributes{}
|
||||
_ bin.BareEncoder = &PaymentsStarGiftUpgradeAttributes{}
|
||||
_ bin.BareDecoder = &PaymentsStarGiftUpgradeAttributes{}
|
||||
)
|
||||
|
||||
func (s *PaymentsStarGiftUpgradeAttributes) Zero() bool {
|
||||
if s == nil {
|
||||
return true
|
||||
}
|
||||
if !(s.Attributes == nil) {
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
// String implements fmt.Stringer.
|
||||
func (s *PaymentsStarGiftUpgradeAttributes) String() string {
|
||||
if s == nil {
|
||||
return "PaymentsStarGiftUpgradeAttributes(nil)"
|
||||
}
|
||||
type Alias PaymentsStarGiftUpgradeAttributes
|
||||
return fmt.Sprintf("PaymentsStarGiftUpgradeAttributes%+v", Alias(*s))
|
||||
}
|
||||
|
||||
// FillFrom fills PaymentsStarGiftUpgradeAttributes from given interface.
|
||||
func (s *PaymentsStarGiftUpgradeAttributes) FillFrom(from interface {
|
||||
GetAttributes() (value []StarGiftAttributeClass)
|
||||
}) {
|
||||
s.Attributes = from.GetAttributes()
|
||||
}
|
||||
|
||||
// TypeID returns type id in TL schema.
|
||||
//
|
||||
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
||||
func (*PaymentsStarGiftUpgradeAttributes) TypeID() uint32 {
|
||||
return PaymentsStarGiftUpgradeAttributesTypeID
|
||||
}
|
||||
|
||||
// TypeName returns name of type in TL schema.
|
||||
func (*PaymentsStarGiftUpgradeAttributes) TypeName() string {
|
||||
return "payments.starGiftUpgradeAttributes"
|
||||
}
|
||||
|
||||
// TypeInfo returns info about TL type.
|
||||
func (s *PaymentsStarGiftUpgradeAttributes) TypeInfo() tdp.Type {
|
||||
typ := tdp.Type{
|
||||
Name: "payments.starGiftUpgradeAttributes",
|
||||
ID: PaymentsStarGiftUpgradeAttributesTypeID,
|
||||
}
|
||||
if s == nil {
|
||||
typ.Null = true
|
||||
return typ
|
||||
}
|
||||
typ.Fields = []tdp.Field{
|
||||
{
|
||||
Name: "Attributes",
|
||||
SchemaName: "attributes",
|
||||
},
|
||||
}
|
||||
return typ
|
||||
}
|
||||
|
||||
// Encode implements bin.Encoder.
|
||||
func (s *PaymentsStarGiftUpgradeAttributes) Encode(b *bin.Buffer) error {
|
||||
if s == nil {
|
||||
return fmt.Errorf("can't encode payments.starGiftUpgradeAttributes#46c6e36f as nil")
|
||||
}
|
||||
b.PutID(PaymentsStarGiftUpgradeAttributesTypeID)
|
||||
return s.EncodeBare(b)
|
||||
}
|
||||
|
||||
// EncodeBare implements bin.BareEncoder.
|
||||
func (s *PaymentsStarGiftUpgradeAttributes) EncodeBare(b *bin.Buffer) error {
|
||||
if s == nil {
|
||||
return fmt.Errorf("can't encode payments.starGiftUpgradeAttributes#46c6e36f as nil")
|
||||
}
|
||||
b.PutVectorHeader(len(s.Attributes))
|
||||
for idx, v := range s.Attributes {
|
||||
if v == nil {
|
||||
return fmt.Errorf("unable to encode payments.starGiftUpgradeAttributes#46c6e36f: field attributes element with index %d is nil", idx)
|
||||
}
|
||||
if err := v.Encode(b); err != nil {
|
||||
return fmt.Errorf("unable to encode payments.starGiftUpgradeAttributes#46c6e36f: field attributes element with index %d: %w", idx, err)
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Decode implements bin.Decoder.
|
||||
func (s *PaymentsStarGiftUpgradeAttributes) Decode(b *bin.Buffer) error {
|
||||
if s == nil {
|
||||
return fmt.Errorf("can't decode payments.starGiftUpgradeAttributes#46c6e36f to nil")
|
||||
}
|
||||
if err := b.ConsumeID(PaymentsStarGiftUpgradeAttributesTypeID); err != nil {
|
||||
return fmt.Errorf("unable to decode payments.starGiftUpgradeAttributes#46c6e36f: %w", err)
|
||||
}
|
||||
return s.DecodeBare(b)
|
||||
}
|
||||
|
||||
// DecodeBare implements bin.BareDecoder.
|
||||
func (s *PaymentsStarGiftUpgradeAttributes) DecodeBare(b *bin.Buffer) error {
|
||||
if s == nil {
|
||||
return fmt.Errorf("can't decode payments.starGiftUpgradeAttributes#46c6e36f to nil")
|
||||
}
|
||||
{
|
||||
headerLen, err := b.VectorHeader()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode payments.starGiftUpgradeAttributes#46c6e36f: field attributes: %w", err)
|
||||
}
|
||||
|
||||
if headerLen > 0 {
|
||||
s.Attributes = make([]StarGiftAttributeClass, 0, headerLen%bin.PreallocateLimit)
|
||||
}
|
||||
for idx := 0; idx < headerLen; idx++ {
|
||||
value, err := DecodeStarGiftAttribute(b)
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode payments.starGiftUpgradeAttributes#46c6e36f: field attributes: %w", err)
|
||||
}
|
||||
s.Attributes = append(s.Attributes, value)
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// GetAttributes returns value of Attributes field.
|
||||
func (s *PaymentsStarGiftUpgradeAttributes) GetAttributes() (value []StarGiftAttributeClass) {
|
||||
if s == nil {
|
||||
return
|
||||
}
|
||||
return s.Attributes
|
||||
}
|
||||
|
||||
// MapAttributes returns field Attributes wrapped in StarGiftAttributeClassArray helper.
|
||||
func (s *PaymentsStarGiftUpgradeAttributes) MapAttributes() (value StarGiftAttributeClassArray) {
|
||||
return StarGiftAttributeClassArray(s.Attributes)
|
||||
}
|
||||
@@ -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{}
|
||||
)
|
||||
Generated
+236
-51
@@ -32,7 +32,7 @@ var (
|
||||
)
|
||||
|
||||
// Layer version of schema.
|
||||
const Layer = 218
|
||||
const Layer = 223
|
||||
|
||||
// TypesMap returns mapping from type ids to TL type names.
|
||||
func TypesMap() map[uint32]string {
|
||||
@@ -76,6 +76,7 @@ func TypesMap() map[uint32]string {
|
||||
InputMediaWebPageTypeID: "inputMediaWebPage#c21b8849",
|
||||
InputMediaPaidMediaTypeID: "inputMediaPaidMedia#c4103386",
|
||||
InputMediaTodoTypeID: "inputMediaTodo#9fc55fde",
|
||||
InputMediaStakeDiceTypeID: "inputMediaStakeDice#f3a9244a",
|
||||
InputChatPhotoEmptyTypeID: "inputChatPhotoEmpty#1ca48f57",
|
||||
InputChatUploadedPhotoTypeID: "inputChatUploadedPhoto#bdcdaec0",
|
||||
InputChatPhotoTypeID: "inputChatPhoto#8953ad37",
|
||||
@@ -123,15 +124,15 @@ func TypesMap() map[uint32]string {
|
||||
ChannelForbiddenTypeID: "channelForbidden#17d493d5",
|
||||
ChatFullTypeID: "chatFull#2633421b",
|
||||
ChannelFullTypeID: "channelFull#e4e0b29d",
|
||||
ChatParticipantTypeID: "chatParticipant#c02d4007",
|
||||
ChatParticipantCreatorTypeID: "chatParticipantCreator#e46bcee4",
|
||||
ChatParticipantAdminTypeID: "chatParticipantAdmin#a0933f5b",
|
||||
ChatParticipantTypeID: "chatParticipant#38e79fde",
|
||||
ChatParticipantCreatorTypeID: "chatParticipantCreator#e1f867b8",
|
||||
ChatParticipantAdminTypeID: "chatParticipantAdmin#360d5d2",
|
||||
ChatParticipantsForbiddenTypeID: "chatParticipantsForbidden#8763d3e1",
|
||||
ChatParticipantsTypeID: "chatParticipants#3cbc93f8",
|
||||
ChatPhotoEmptyTypeID: "chatPhotoEmpty#37c1011c",
|
||||
ChatPhotoTypeID: "chatPhoto#1c6e1c11",
|
||||
MessageEmptyTypeID: "messageEmpty#90a6ca84",
|
||||
MessageTypeID: "message#b92f76cf",
|
||||
MessageTypeID: "message#3ae56482",
|
||||
MessageServiceTypeID: "messageService#7a800e0a",
|
||||
MessageMediaEmptyTypeID: "messageMediaEmpty#3ded6320",
|
||||
MessageMediaPhotoTypeID: "messageMediaPhoto#695150d7",
|
||||
@@ -145,7 +146,7 @@ func TypesMap() map[uint32]string {
|
||||
MessageMediaInvoiceTypeID: "messageMediaInvoice#f6a548d3",
|
||||
MessageMediaGeoLiveTypeID: "messageMediaGeoLive#b940c666",
|
||||
MessageMediaPollTypeID: "messageMediaPoll#4bd6e798",
|
||||
MessageMediaDiceTypeID: "messageMediaDice#3f7ee58b",
|
||||
MessageMediaDiceTypeID: "messageMediaDice#8cbec07",
|
||||
MessageMediaStoryTypeID: "messageMediaStory#68cb6283",
|
||||
MessageMediaGiveawayTypeID: "messageMediaGiveaway#aa073beb",
|
||||
MessageMediaGiveawayResultsTypeID: "messageMediaGiveawayResults#ceaa3ea1",
|
||||
@@ -198,8 +199,8 @@ func TypesMap() map[uint32]string {
|
||||
MessageActionPaymentRefundedTypeID: "messageActionPaymentRefunded#41b3e202",
|
||||
MessageActionGiftStarsTypeID: "messageActionGiftStars#45d5b021",
|
||||
MessageActionPrizeStarsTypeID: "messageActionPrizeStars#b00c47a2",
|
||||
MessageActionStarGiftTypeID: "messageActionStarGift#db596550",
|
||||
MessageActionStarGiftUniqueTypeID: "messageActionStarGiftUnique#95728543",
|
||||
MessageActionStarGiftTypeID: "messageActionStarGift#ea2c31d3",
|
||||
MessageActionStarGiftUniqueTypeID: "messageActionStarGiftUnique#e6c31522",
|
||||
MessageActionPaidMessagesRefundedTypeID: "messageActionPaidMessagesRefunded#ac1f1fcd",
|
||||
MessageActionPaidMessagesPriceTypeID: "messageActionPaidMessagesPrice#84b88578",
|
||||
MessageActionConferenceCallTypeID: "messageActionConferenceCall#2ffe2f7a",
|
||||
@@ -210,6 +211,12 @@ func TypesMap() map[uint32]string {
|
||||
MessageActionSuggestedPostRefundTypeID: "messageActionSuggestedPostRefund#69f916f8",
|
||||
MessageActionGiftTonTypeID: "messageActionGiftTon#a8a3c699",
|
||||
MessageActionSuggestBirthdayTypeID: "messageActionSuggestBirthday#2c8f2a25",
|
||||
MessageActionStarGiftPurchaseOfferTypeID: "messageActionStarGiftPurchaseOffer#774278d4",
|
||||
MessageActionStarGiftPurchaseOfferDeclinedTypeID: "messageActionStarGiftPurchaseOfferDeclined#73ada76b",
|
||||
MessageActionNewCreatorPendingTypeID: "messageActionNewCreatorPending#b07ed085",
|
||||
MessageActionChangeCreatorTypeID: "messageActionChangeCreator#e188503b",
|
||||
MessageActionNoForwardsToggleTypeID: "messageActionNoForwardsToggle#bf7d6572",
|
||||
MessageActionNoForwardsRequestTypeID: "messageActionNoForwardsRequest#3e2793ba",
|
||||
DialogTypeID: "dialog#d58a08c6",
|
||||
DialogFolderTypeID: "dialogFolder#71bd134c",
|
||||
PhotoEmptyTypeID: "photoEmpty#2331b22d",
|
||||
@@ -435,6 +442,9 @@ func TypesMap() map[uint32]string {
|
||||
UpdateDeleteGroupCallMessagesTypeID: "updateDeleteGroupCallMessages#3e85e92c",
|
||||
UpdateStarGiftAuctionStateTypeID: "updateStarGiftAuctionState#48e246c2",
|
||||
UpdateStarGiftAuctionUserStateTypeID: "updateStarGiftAuctionUserState#dc58f31e",
|
||||
UpdateEmojiGameInfoTypeID: "updateEmojiGameInfo#fb9c547a",
|
||||
UpdateStarGiftCraftFailTypeID: "updateStarGiftCraftFail#ac072444",
|
||||
UpdateChatParticipantRankTypeID: "updateChatParticipantRank#bd8367b9",
|
||||
UpdatesStateTypeID: "updates.state#a56c2a3e",
|
||||
UpdatesDifferenceEmptyTypeID: "updates.differenceEmpty#5d75a138",
|
||||
UpdatesDifferenceTypeID: "updates.difference#f49ca0",
|
||||
@@ -607,24 +617,24 @@ func TypesMap() map[uint32]string {
|
||||
MessagesStickerSetNotModifiedTypeID: "messages.stickerSetNotModified#d3f924eb",
|
||||
BotCommandTypeID: "botCommand#c27ac8c7",
|
||||
BotInfoTypeID: "botInfo#4d8a0299",
|
||||
KeyboardButtonTypeID: "keyboardButton#a2fa4880",
|
||||
KeyboardButtonURLTypeID: "keyboardButtonUrl#258aff05",
|
||||
KeyboardButtonCallbackTypeID: "keyboardButtonCallback#35bbdb6b",
|
||||
KeyboardButtonRequestPhoneTypeID: "keyboardButtonRequestPhone#b16a6c29",
|
||||
KeyboardButtonRequestGeoLocationTypeID: "keyboardButtonRequestGeoLocation#fc796b3f",
|
||||
KeyboardButtonSwitchInlineTypeID: "keyboardButtonSwitchInline#93b9fbb5",
|
||||
KeyboardButtonGameTypeID: "keyboardButtonGame#50f41ccf",
|
||||
KeyboardButtonBuyTypeID: "keyboardButtonBuy#afd93fbb",
|
||||
KeyboardButtonURLAuthTypeID: "keyboardButtonUrlAuth#10b78d29",
|
||||
InputKeyboardButtonURLAuthTypeID: "inputKeyboardButtonUrlAuth#d02e7fd4",
|
||||
KeyboardButtonRequestPollTypeID: "keyboardButtonRequestPoll#bbc7515d",
|
||||
InputKeyboardButtonUserProfileTypeID: "inputKeyboardButtonUserProfile#e988037b",
|
||||
KeyboardButtonUserProfileTypeID: "keyboardButtonUserProfile#308660c1",
|
||||
KeyboardButtonWebViewTypeID: "keyboardButtonWebView#13767230",
|
||||
KeyboardButtonSimpleWebViewTypeID: "keyboardButtonSimpleWebView#a0c0505c",
|
||||
KeyboardButtonRequestPeerTypeID: "keyboardButtonRequestPeer#53d7bfd8",
|
||||
InputKeyboardButtonRequestPeerTypeID: "inputKeyboardButtonRequestPeer#c9662d05",
|
||||
KeyboardButtonCopyTypeID: "keyboardButtonCopy#75d2698e",
|
||||
KeyboardButtonTypeID: "keyboardButton#7d170cff",
|
||||
KeyboardButtonURLTypeID: "keyboardButtonUrl#d80c25ec",
|
||||
KeyboardButtonCallbackTypeID: "keyboardButtonCallback#e62bc960",
|
||||
KeyboardButtonRequestPhoneTypeID: "keyboardButtonRequestPhone#417efd8f",
|
||||
KeyboardButtonRequestGeoLocationTypeID: "keyboardButtonRequestGeoLocation#aa40f94d",
|
||||
KeyboardButtonSwitchInlineTypeID: "keyboardButtonSwitchInline#991399fc",
|
||||
KeyboardButtonGameTypeID: "keyboardButtonGame#89c590f9",
|
||||
KeyboardButtonBuyTypeID: "keyboardButtonBuy#3fa53905",
|
||||
KeyboardButtonURLAuthTypeID: "keyboardButtonUrlAuth#f51006f9",
|
||||
InputKeyboardButtonURLAuthTypeID: "inputKeyboardButtonUrlAuth#68013e72",
|
||||
KeyboardButtonRequestPollTypeID: "keyboardButtonRequestPoll#7a11d782",
|
||||
InputKeyboardButtonUserProfileTypeID: "inputKeyboardButtonUserProfile#7d5e07c7",
|
||||
KeyboardButtonUserProfileTypeID: "keyboardButtonUserProfile#c0fd5d09",
|
||||
KeyboardButtonWebViewTypeID: "keyboardButtonWebView#e846b1a0",
|
||||
KeyboardButtonSimpleWebViewTypeID: "keyboardButtonSimpleWebView#e15c4370",
|
||||
KeyboardButtonRequestPeerTypeID: "keyboardButtonRequestPeer#5b0f15f5",
|
||||
InputKeyboardButtonRequestPeerTypeID: "inputKeyboardButtonRequestPeer#2b78156",
|
||||
KeyboardButtonCopyTypeID: "keyboardButtonCopy#bcc4af10",
|
||||
KeyboardButtonRowTypeID: "keyboardButtonRow#77608b83",
|
||||
ReplyKeyboardHideTypeID: "replyKeyboardHide#a03e5b85",
|
||||
ReplyKeyboardForceReplyTypeID: "replyKeyboardForceReply#86b40b08",
|
||||
@@ -651,6 +661,7 @@ func TypesMap() map[uint32]string {
|
||||
MessageEntitySpoilerTypeID: "messageEntitySpoiler#32ca960f",
|
||||
MessageEntityCustomEmojiTypeID: "messageEntityCustomEmoji#c8cf05f8",
|
||||
MessageEntityBlockquoteTypeID: "messageEntityBlockquote#f1ccaaac",
|
||||
MessageEntityFormattedDateTypeID: "messageEntityFormattedDate#904ac7c7",
|
||||
InputChannelEmptyTypeID: "inputChannelEmpty#ee8c1e86",
|
||||
InputChannelTypeID: "inputChannel#f35aec28",
|
||||
InputChannelFromMessageTypeID: "inputChannelFromMessage#5b934f9d",
|
||||
@@ -661,11 +672,11 @@ func TypesMap() map[uint32]string {
|
||||
UpdatesChannelDifferenceTypeID: "updates.channelDifference#2064674e",
|
||||
ChannelMessagesFilterEmptyTypeID: "channelMessagesFilterEmpty#94d42ee7",
|
||||
ChannelMessagesFilterTypeID: "channelMessagesFilter#cd77d957",
|
||||
ChannelParticipantTypeID: "channelParticipant#cb397619",
|
||||
ChannelParticipantSelfTypeID: "channelParticipantSelf#4f607bef",
|
||||
ChannelParticipantTypeID: "channelParticipant#1bd54456",
|
||||
ChannelParticipantSelfTypeID: "channelParticipantSelf#a9478a1a",
|
||||
ChannelParticipantCreatorTypeID: "channelParticipantCreator#2fe601d3",
|
||||
ChannelParticipantAdminTypeID: "channelParticipantAdmin#34c3bb53",
|
||||
ChannelParticipantBannedTypeID: "channelParticipantBanned#6df8014e",
|
||||
ChannelParticipantBannedTypeID: "channelParticipantBanned#d5f0ad91",
|
||||
ChannelParticipantLeftTypeID: "channelParticipantLeft#1b03f006",
|
||||
ChannelParticipantsRecentTypeID: "channelParticipantsRecent#de3f3c79",
|
||||
ChannelParticipantsAdminsTypeID: "channelParticipantsAdmins#b4608969",
|
||||
@@ -913,6 +924,7 @@ func TypesMap() map[uint32]string {
|
||||
ChannelAdminLogEventActionToggleSignatureProfilesTypeID: "channelAdminLogEventActionToggleSignatureProfiles#60a79c79",
|
||||
ChannelAdminLogEventActionParticipantSubExtendTypeID: "channelAdminLogEventActionParticipantSubExtend#64642db3",
|
||||
ChannelAdminLogEventActionToggleAutotranslationTypeID: "channelAdminLogEventActionToggleAutotranslation#c517f77e",
|
||||
ChannelAdminLogEventActionParticipantEditRankTypeID: "channelAdminLogEventActionParticipantEditRank#5806b4ec",
|
||||
ChannelAdminLogEventTypeID: "channelAdminLogEvent#1fad68cd",
|
||||
ChannelsAdminLogResultsTypeID: "channels.adminLogResults#ed8af74d",
|
||||
ChannelAdminLogEventsFilterTypeID: "channelAdminLogEventsFilter#ea107ae4",
|
||||
@@ -1039,8 +1051,8 @@ func TypesMap() map[uint32]string {
|
||||
InputFolderPeerTypeID: "inputFolderPeer#fbd2c296",
|
||||
FolderPeerTypeID: "folderPeer#e9baa668",
|
||||
MessagesSearchCounterTypeID: "messages.searchCounter#e844ebff",
|
||||
URLAuthResultRequestTypeID: "urlAuthResultRequest#92d33a0e",
|
||||
URLAuthResultAcceptedTypeID: "urlAuthResultAccepted#8f8c0e4e",
|
||||
URLAuthResultRequestTypeID: "urlAuthResultRequest#f8f8eb1e",
|
||||
URLAuthResultAcceptedTypeID: "urlAuthResultAccepted#623a8fa0",
|
||||
URLAuthResultDefaultTypeID: "urlAuthResultDefault#a9d6db1f",
|
||||
ChannelLocationEmptyTypeID: "channelLocationEmpty#bfb5ad8b",
|
||||
ChannelLocationTypeID: "channelLocation#209b82db",
|
||||
@@ -1069,7 +1081,7 @@ func TypesMap() map[uint32]string {
|
||||
WebPageAttributeStickerSetTypeID: "webPageAttributeStickerSet#50cc03d3",
|
||||
WebPageAttributeUniqueStarGiftTypeID: "webPageAttributeUniqueStarGift#cf6f6db8",
|
||||
WebPageAttributeStarGiftCollectionTypeID: "webPageAttributeStarGiftCollection#31cad303",
|
||||
WebPageAttributeStarGiftAuctionTypeID: "webPageAttributeStarGiftAuction#34986ab",
|
||||
WebPageAttributeStarGiftAuctionTypeID: "webPageAttributeStarGiftAuction#1c641c2",
|
||||
MessagesVotesListTypeID: "messages.votesList#4899484e",
|
||||
BankCardOpenURLTypeID: "bankCardOpenUrl#f568028a",
|
||||
PaymentsBankCardDataTypeID: "payments.bankCardData#3e24e573",
|
||||
@@ -1446,8 +1458,8 @@ func TypesMap() map[uint32]string {
|
||||
MessageReactorTypeID: "messageReactor#4ba3a95a",
|
||||
StarsGiveawayOptionTypeID: "starsGiveawayOption#94ce852a",
|
||||
StarsGiveawayWinnersOptionTypeID: "starsGiveawayWinnersOption#54236209",
|
||||
StarGiftTypeID: "starGift#1b9a4d7f",
|
||||
StarGiftUniqueTypeID: "starGiftUnique#b0bf741b",
|
||||
StarGiftTypeID: "starGift#313a9547",
|
||||
StarGiftUniqueTypeID: "starGiftUnique#85f0a9cd",
|
||||
PaymentsStarGiftsNotModifiedTypeID: "payments.starGiftsNotModified#a388a368",
|
||||
PaymentsStarGiftsTypeID: "payments.starGifts#2ed82995",
|
||||
MessageReportOptionTypeID: "messageReportOption#7903e3d9",
|
||||
@@ -1467,16 +1479,16 @@ func TypesMap() map[uint32]string {
|
||||
MessagesFoundStickersTypeID: "messages.foundStickers#82c9e290",
|
||||
BotVerifierSettingsTypeID: "botVerifierSettings#b0cd6617",
|
||||
BotVerificationTypeID: "botVerification#f93cd45c",
|
||||
StarGiftAttributeModelTypeID: "starGiftAttributeModel#39d99013",
|
||||
StarGiftAttributePatternTypeID: "starGiftAttributePattern#13acff19",
|
||||
StarGiftAttributeBackdropTypeID: "starGiftAttributeBackdrop#d93d859c",
|
||||
StarGiftAttributeModelTypeID: "starGiftAttributeModel#565251e2",
|
||||
StarGiftAttributePatternTypeID: "starGiftAttributePattern#4e7085ea",
|
||||
StarGiftAttributeBackdropTypeID: "starGiftAttributeBackdrop#9f2504e4",
|
||||
StarGiftAttributeOriginalDetailsTypeID: "starGiftAttributeOriginalDetails#e0bff26c",
|
||||
PaymentsStarGiftUpgradePreviewTypeID: "payments.starGiftUpgradePreview#3de1dfed",
|
||||
UsersUsersTypeID: "users.users#62d706b8",
|
||||
UsersUsersSliceTypeID: "users.usersSlice#315a4974",
|
||||
PaymentsUniqueStarGiftTypeID: "payments.uniqueStarGift#416c56e8",
|
||||
MessagesWebPagePreviewTypeID: "messages.webPagePreview#8c9a88ac",
|
||||
SavedStarGiftTypeID: "savedStarGift#8983a452",
|
||||
SavedStarGiftTypeID: "savedStarGift#41df43fc",
|
||||
PaymentsSavedStarGiftsTypeID: "payments.savedStarGifts#95f389b1",
|
||||
InputSavedStarGiftUserTypeID: "inputSavedStarGiftUser#69279795",
|
||||
InputSavedStarGiftChatTypeID: "inputSavedStarGiftChat#f101aa7f",
|
||||
@@ -1538,17 +1550,38 @@ func TypesMap() map[uint32]string {
|
||||
RecentStoryTypeID: "recentStory#711d692d",
|
||||
AuctionBidLevelTypeID: "auctionBidLevel#310240cc",
|
||||
StarGiftAuctionStateNotModifiedTypeID: "starGiftAuctionStateNotModified#fe333952",
|
||||
StarGiftAuctionStateTypeID: "starGiftAuctionState#5db04f4b",
|
||||
StarGiftAuctionStateFinishedTypeID: "starGiftAuctionStateFinished#7d967c3a",
|
||||
StarGiftAuctionStateTypeID: "starGiftAuctionState#771a4e66",
|
||||
StarGiftAuctionStateFinishedTypeID: "starGiftAuctionStateFinished#972dabbf",
|
||||
StarGiftAuctionUserStateTypeID: "starGiftAuctionUserState#2eeed1c4",
|
||||
PaymentsStarGiftAuctionStateTypeID: "payments.starGiftAuctionState#e98e474",
|
||||
StarGiftAuctionAcquiredGiftTypeID: "starGiftAuctionAcquiredGift#ab60e20b",
|
||||
PaymentsStarGiftAuctionStateTypeID: "payments.starGiftAuctionState#6b39f4ec",
|
||||
StarGiftAuctionAcquiredGiftTypeID: "starGiftAuctionAcquiredGift#42b00348",
|
||||
PaymentsStarGiftAuctionAcquiredGiftsTypeID: "payments.starGiftAuctionAcquiredGifts#7d5bd1f0",
|
||||
StarGiftActiveAuctionStateTypeID: "starGiftActiveAuctionState#d31bc45d",
|
||||
PaymentsStarGiftActiveAuctionsNotModifiedTypeID: "payments.starGiftActiveAuctionsNotModified#db33dad0",
|
||||
PaymentsStarGiftActiveAuctionsTypeID: "payments.starGiftActiveAuctions#97f187d8",
|
||||
PaymentsStarGiftActiveAuctionsTypeID: "payments.starGiftActiveAuctions#aef6abbc",
|
||||
InputStarGiftAuctionTypeID: "inputStarGiftAuction#2e16c98",
|
||||
InputStarGiftAuctionSlugTypeID: "inputStarGiftAuctionSlug#7ab58308",
|
||||
PasskeyTypeID: "passkey#98613ebf",
|
||||
AccountPasskeysTypeID: "account.passkeys#f8e0aa1c",
|
||||
AccountPasskeyRegistrationOptionsTypeID: "account.passkeyRegistrationOptions#e16b5ce1",
|
||||
AuthPasskeyLoginOptionsTypeID: "auth.passkeyLoginOptions#e2037789",
|
||||
InputPasskeyResponseRegisterTypeID: "inputPasskeyResponseRegister#3e63935c",
|
||||
InputPasskeyResponseLoginTypeID: "inputPasskeyResponseLogin#c31fc14a",
|
||||
InputPasskeyCredentialPublicKeyTypeID: "inputPasskeyCredentialPublicKey#3c27b78f",
|
||||
InputPasskeyCredentialFirebasePNVTypeID: "inputPasskeyCredentialFirebasePNV#5b1ccb28",
|
||||
StarGiftBackgroundTypeID: "starGiftBackground#aff56398",
|
||||
StarGiftAuctionRoundTypeID: "starGiftAuctionRound#3aae0528",
|
||||
StarGiftAuctionRoundExtendableTypeID: "starGiftAuctionRoundExtendable#aa021e5",
|
||||
PaymentsStarGiftUpgradeAttributesTypeID: "payments.starGiftUpgradeAttributes#46c6e36f",
|
||||
MessagesEmojiGameOutcomeTypeID: "messages.emojiGameOutcome#da2ad647",
|
||||
MessagesEmojiGameUnavailableTypeID: "messages.emojiGameUnavailable#59e65335",
|
||||
MessagesEmojiGameDiceInfoTypeID: "messages.emojiGameDiceInfo#44e56023",
|
||||
StarGiftAttributeRarityTypeID: "starGiftAttributeRarity#36437737",
|
||||
StarGiftAttributeRarityUncommonTypeID: "starGiftAttributeRarityUncommon#dbce6389",
|
||||
StarGiftAttributeRarityRareTypeID: "starGiftAttributeRarityRare#f08d516b",
|
||||
StarGiftAttributeRarityEpicTypeID: "starGiftAttributeRarityEpic#78fbf3a8",
|
||||
StarGiftAttributeRarityLegendaryTypeID: "starGiftAttributeRarityLegendary#cef7e7a8",
|
||||
KeyboardButtonStyleTypeID: "keyboardButtonStyle#4fdd3430",
|
||||
InvokeAfterMsgRequestTypeID: "invokeAfterMsg#cb9f372d",
|
||||
InvokeAfterMsgsRequestTypeID: "invokeAfterMsgs#3dc4b4f0",
|
||||
InitConnectionRequestTypeID: "initConnection#c1cd5ea9",
|
||||
@@ -1584,6 +1617,8 @@ func TypesMap() map[uint32]string {
|
||||
AuthResetLoginEmailRequestTypeID: "auth.resetLoginEmail#7e960193",
|
||||
AuthReportMissingCodeRequestTypeID: "auth.reportMissingCode#cb9deff6",
|
||||
AuthCheckPaidAuthRequestTypeID: "auth.checkPaidAuth#56e59f9c",
|
||||
AuthInitPasskeyLoginRequestTypeID: "auth.initPasskeyLogin#518ad0b7",
|
||||
AuthFinishPasskeyLoginRequestTypeID: "auth.finishPasskeyLogin#9857ad07",
|
||||
AccountRegisterDeviceRequestTypeID: "account.registerDevice#ec86017a",
|
||||
AccountUnregisterDeviceRequestTypeID: "account.unregisterDevice#6a0d3206",
|
||||
AccountUpdateNotifySettingsRequestTypeID: "account.updateNotifySettings#84be5b93",
|
||||
@@ -1703,6 +1738,10 @@ func TypesMap() map[uint32]string {
|
||||
AccountSaveMusicRequestTypeID: "account.saveMusic#b26732a9",
|
||||
AccountGetSavedMusicIDsRequestTypeID: "account.getSavedMusicIds#e09d5faf",
|
||||
AccountGetUniqueGiftChatThemesRequestTypeID: "account.getUniqueGiftChatThemes#e42ce9c9",
|
||||
AccountInitPasskeyRegistrationRequestTypeID: "account.initPasskeyRegistration#429547e8",
|
||||
AccountRegisterPasskeyRequestTypeID: "account.registerPasskey#55b41fd6",
|
||||
AccountGetPasskeysRequestTypeID: "account.getPasskeys#ea1f0c52",
|
||||
AccountDeletePasskeyRequestTypeID: "account.deletePasskey#f5b5563f",
|
||||
UsersGetUsersRequestTypeID: "users.getUsers#d91a548",
|
||||
UsersGetFullUserRequestTypeID: "users.getFullUser#b60f5918",
|
||||
UsersSetSecureValueErrorsRequestTypeID: "users.setSecureValueErrors#90c894b5",
|
||||
@@ -1749,7 +1788,7 @@ func TypesMap() map[uint32]string {
|
||||
MessagesSetTypingRequestTypeID: "messages.setTyping#58943ee2",
|
||||
MessagesSendMessageRequestTypeID: "messages.sendMessage#545cd15a",
|
||||
MessagesSendMediaRequestTypeID: "messages.sendMedia#330e77f",
|
||||
MessagesForwardMessagesRequestTypeID: "messages.forwardMessages#41d41ade",
|
||||
MessagesForwardMessagesRequestTypeID: "messages.forwardMessages#13704a7c",
|
||||
MessagesReportSpamRequestTypeID: "messages.reportSpam#cf1592db",
|
||||
MessagesGetPeerSettingsRequestTypeID: "messages.getPeerSettings#efd9a6a2",
|
||||
MessagesReportRequestTypeID: "messages.report#fc78af9b",
|
||||
@@ -1845,8 +1884,8 @@ func TypesMap() map[uint32]string {
|
||||
MessagesGetEmojiKeywordsLanguagesRequestTypeID: "messages.getEmojiKeywordsLanguages#4e9963b2",
|
||||
MessagesGetEmojiURLRequestTypeID: "messages.getEmojiURL#d5b10c26",
|
||||
MessagesGetSearchCountersRequestTypeID: "messages.getSearchCounters#1bbcf300",
|
||||
MessagesRequestURLAuthRequestTypeID: "messages.requestUrlAuth#198fb446",
|
||||
MessagesAcceptURLAuthRequestTypeID: "messages.acceptUrlAuth#b12c7125",
|
||||
MessagesRequestURLAuthRequestTypeID: "messages.requestUrlAuth#894cc99c",
|
||||
MessagesAcceptURLAuthRequestTypeID: "messages.acceptUrlAuth#67a3f0de",
|
||||
MessagesHidePeerSettingsBarRequestTypeID: "messages.hidePeerSettingsBar#4facb138",
|
||||
MessagesGetScheduledHistoryRequestTypeID: "messages.getScheduledHistory#f516760b",
|
||||
MessagesGetScheduledMessagesRequestTypeID: "messages.getScheduledMessages#bdbb0464",
|
||||
@@ -1884,7 +1923,7 @@ func TypesMap() map[uint32]string {
|
||||
MessagesGetSearchResultsPositionsRequestTypeID: "messages.getSearchResultsPositions#9c7f2f10",
|
||||
MessagesHideChatJoinRequestRequestTypeID: "messages.hideChatJoinRequest#7fe7e815",
|
||||
MessagesHideAllChatJoinRequestsRequestTypeID: "messages.hideAllChatJoinRequests#e085f4ea",
|
||||
MessagesToggleNoForwardsRequestTypeID: "messages.toggleNoForwards#b11eafa2",
|
||||
MessagesToggleNoForwardsRequestTypeID: "messages.toggleNoForwards#b2081a35",
|
||||
MessagesSaveDefaultSendAsRequestTypeID: "messages.saveDefaultSendAs#ccfddf96",
|
||||
MessagesSendReactionRequestTypeID: "messages.sendReaction#d30d78d4",
|
||||
MessagesGetMessagesReactionsRequestTypeID: "messages.getMessagesReactions#8bba90e6",
|
||||
@@ -1975,6 +2014,13 @@ func TypesMap() map[uint32]string {
|
||||
MessagesReorderPinnedForumTopicsRequestTypeID: "messages.reorderPinnedForumTopics#e7841f0",
|
||||
MessagesCreateForumTopicRequestTypeID: "messages.createForumTopic#2f98c3d5",
|
||||
MessagesDeleteTopicHistoryRequestTypeID: "messages.deleteTopicHistory#d2816f10",
|
||||
MessagesGetEmojiGameInfoRequestTypeID: "messages.getEmojiGameInfo#fb7e8ca7",
|
||||
MessagesSummarizeTextRequestTypeID: "messages.summarizeText#9d4104e2",
|
||||
MessagesEditChatCreatorRequestTypeID: "messages.editChatCreator#f743b857",
|
||||
MessagesGetFutureChatCreatorAfterLeaveRequestTypeID: "messages.getFutureChatCreatorAfterLeave#3b7d0ea6",
|
||||
MessagesEditChatParticipantRankRequestTypeID: "messages.editChatParticipantRank#a00f32b0",
|
||||
MessagesDeclineURLAuthRequestTypeID: "messages.declineUrlAuth#35436bbc",
|
||||
MessagesCheckURLAuthMatchCodeRequestTypeID: "messages.checkUrlAuthMatchCode#c9a47b0b",
|
||||
UpdatesGetStateRequestTypeID: "updates.getState#edd4882a",
|
||||
UpdatesGetDifferenceRequestTypeID: "updates.getDifference#19c2f763",
|
||||
UpdatesGetChannelDifferenceRequestTypeID: "updates.getChannelDifference#3173d78",
|
||||
@@ -2025,7 +2071,7 @@ func TypesMap() map[uint32]string {
|
||||
ChannelsGetChannelsRequestTypeID: "channels.getChannels#a7f6bbb",
|
||||
ChannelsGetFullChannelRequestTypeID: "channels.getFullChannel#8736a09",
|
||||
ChannelsCreateChannelRequestTypeID: "channels.createChannel#91006707",
|
||||
ChannelsEditAdminRequestTypeID: "channels.editAdmin#d33c8902",
|
||||
ChannelsEditAdminRequestTypeID: "channels.editAdmin#9a98ad68",
|
||||
ChannelsEditTitleRequestTypeID: "channels.editTitle#566decd0",
|
||||
ChannelsEditPhotoRequestTypeID: "channels.editPhoto#f12e57c9",
|
||||
ChannelsCheckUsernameRequestTypeID: "channels.checkUsername#10e6bd2c",
|
||||
@@ -2046,7 +2092,6 @@ func TypesMap() map[uint32]string {
|
||||
ChannelsGetLeftChannelsRequestTypeID: "channels.getLeftChannels#8341ecc0",
|
||||
ChannelsGetGroupsForDiscussionRequestTypeID: "channels.getGroupsForDiscussion#f5dad378",
|
||||
ChannelsSetDiscussionGroupRequestTypeID: "channels.setDiscussionGroup#40582bb2",
|
||||
ChannelsEditCreatorRequestTypeID: "channels.editCreator#8f38cd1f",
|
||||
ChannelsEditLocationRequestTypeID: "channels.editLocation#58e63f6d",
|
||||
ChannelsToggleSlowModeRequestTypeID: "channels.toggleSlowMode#edd49ef0",
|
||||
ChannelsGetInactiveChannelsRequestTypeID: "channels.getInactiveChannels#11e831ee",
|
||||
@@ -2165,6 +2210,11 @@ func TypesMap() map[uint32]string {
|
||||
PaymentsGetStarGiftAuctionStateRequestTypeID: "payments.getStarGiftAuctionState#5c9ff4d6",
|
||||
PaymentsGetStarGiftAuctionAcquiredGiftsRequestTypeID: "payments.getStarGiftAuctionAcquiredGifts#6ba2cbec",
|
||||
PaymentsGetStarGiftActiveAuctionsRequestTypeID: "payments.getStarGiftActiveAuctions#a5d0514d",
|
||||
PaymentsResolveStarGiftOfferRequestTypeID: "payments.resolveStarGiftOffer#e9ce781c",
|
||||
PaymentsSendStarGiftOfferRequestTypeID: "payments.sendStarGiftOffer#8fb86b41",
|
||||
PaymentsGetStarGiftUpgradeAttributesRequestTypeID: "payments.getStarGiftUpgradeAttributes#6d038b58",
|
||||
PaymentsGetCraftStarGiftsRequestTypeID: "payments.getCraftStarGifts#fd05dd00",
|
||||
PaymentsCraftStarGiftRequestTypeID: "payments.craftStarGift#b0f9684f",
|
||||
StickersCreateStickerSetRequestTypeID: "stickers.createStickerSet#9021ab67",
|
||||
StickersRemoveStickerFromSetRequestTypeID: "stickers.removeStickerFromSet#f7760f51",
|
||||
StickersChangeStickerPositionRequestTypeID: "stickers.changeStickerPosition#ffb6d4ca",
|
||||
@@ -2347,6 +2397,7 @@ func NamesMap() map[string]uint32 {
|
||||
"inputMediaWebPage": InputMediaWebPageTypeID,
|
||||
"inputMediaPaidMedia": InputMediaPaidMediaTypeID,
|
||||
"inputMediaTodo": InputMediaTodoTypeID,
|
||||
"inputMediaStakeDice": InputMediaStakeDiceTypeID,
|
||||
"inputChatPhotoEmpty": InputChatPhotoEmptyTypeID,
|
||||
"inputChatUploadedPhoto": InputChatUploadedPhotoTypeID,
|
||||
"inputChatPhoto": InputChatPhotoTypeID,
|
||||
@@ -2481,6 +2532,12 @@ func NamesMap() map[string]uint32 {
|
||||
"messageActionSuggestedPostRefund": MessageActionSuggestedPostRefundTypeID,
|
||||
"messageActionGiftTon": MessageActionGiftTonTypeID,
|
||||
"messageActionSuggestBirthday": MessageActionSuggestBirthdayTypeID,
|
||||
"messageActionStarGiftPurchaseOffer": MessageActionStarGiftPurchaseOfferTypeID,
|
||||
"messageActionStarGiftPurchaseOfferDeclined": MessageActionStarGiftPurchaseOfferDeclinedTypeID,
|
||||
"messageActionNewCreatorPending": MessageActionNewCreatorPendingTypeID,
|
||||
"messageActionChangeCreator": MessageActionChangeCreatorTypeID,
|
||||
"messageActionNoForwardsToggle": MessageActionNoForwardsToggleTypeID,
|
||||
"messageActionNoForwardsRequest": MessageActionNoForwardsRequestTypeID,
|
||||
"dialog": DialogTypeID,
|
||||
"dialogFolder": DialogFolderTypeID,
|
||||
"photoEmpty": PhotoEmptyTypeID,
|
||||
@@ -2706,6 +2763,9 @@ func NamesMap() map[string]uint32 {
|
||||
"updateDeleteGroupCallMessages": UpdateDeleteGroupCallMessagesTypeID,
|
||||
"updateStarGiftAuctionState": UpdateStarGiftAuctionStateTypeID,
|
||||
"updateStarGiftAuctionUserState": UpdateStarGiftAuctionUserStateTypeID,
|
||||
"updateEmojiGameInfo": UpdateEmojiGameInfoTypeID,
|
||||
"updateStarGiftCraftFail": UpdateStarGiftCraftFailTypeID,
|
||||
"updateChatParticipantRank": UpdateChatParticipantRankTypeID,
|
||||
"updates.state": UpdatesStateTypeID,
|
||||
"updates.differenceEmpty": UpdatesDifferenceEmptyTypeID,
|
||||
"updates.difference": UpdatesDifferenceTypeID,
|
||||
@@ -2922,6 +2982,7 @@ func NamesMap() map[string]uint32 {
|
||||
"messageEntitySpoiler": MessageEntitySpoilerTypeID,
|
||||
"messageEntityCustomEmoji": MessageEntityCustomEmojiTypeID,
|
||||
"messageEntityBlockquote": MessageEntityBlockquoteTypeID,
|
||||
"messageEntityFormattedDate": MessageEntityFormattedDateTypeID,
|
||||
"inputChannelEmpty": InputChannelEmptyTypeID,
|
||||
"inputChannel": InputChannelTypeID,
|
||||
"inputChannelFromMessage": InputChannelFromMessageTypeID,
|
||||
@@ -3184,6 +3245,7 @@ func NamesMap() map[string]uint32 {
|
||||
"channelAdminLogEventActionToggleSignatureProfiles": ChannelAdminLogEventActionToggleSignatureProfilesTypeID,
|
||||
"channelAdminLogEventActionParticipantSubExtend": ChannelAdminLogEventActionParticipantSubExtendTypeID,
|
||||
"channelAdminLogEventActionToggleAutotranslation": ChannelAdminLogEventActionToggleAutotranslationTypeID,
|
||||
"channelAdminLogEventActionParticipantEditRank": ChannelAdminLogEventActionParticipantEditRankTypeID,
|
||||
"channelAdminLogEvent": ChannelAdminLogEventTypeID,
|
||||
"channels.adminLogResults": ChannelsAdminLogResultsTypeID,
|
||||
"channelAdminLogEventsFilter": ChannelAdminLogEventsFilterTypeID,
|
||||
@@ -3820,6 +3882,27 @@ func NamesMap() map[string]uint32 {
|
||||
"payments.starGiftActiveAuctions": PaymentsStarGiftActiveAuctionsTypeID,
|
||||
"inputStarGiftAuction": InputStarGiftAuctionTypeID,
|
||||
"inputStarGiftAuctionSlug": InputStarGiftAuctionSlugTypeID,
|
||||
"passkey": PasskeyTypeID,
|
||||
"account.passkeys": AccountPasskeysTypeID,
|
||||
"account.passkeyRegistrationOptions": AccountPasskeyRegistrationOptionsTypeID,
|
||||
"auth.passkeyLoginOptions": AuthPasskeyLoginOptionsTypeID,
|
||||
"inputPasskeyResponseRegister": InputPasskeyResponseRegisterTypeID,
|
||||
"inputPasskeyResponseLogin": InputPasskeyResponseLoginTypeID,
|
||||
"inputPasskeyCredentialPublicKey": InputPasskeyCredentialPublicKeyTypeID,
|
||||
"inputPasskeyCredentialFirebasePNV": InputPasskeyCredentialFirebasePNVTypeID,
|
||||
"starGiftBackground": StarGiftBackgroundTypeID,
|
||||
"starGiftAuctionRound": StarGiftAuctionRoundTypeID,
|
||||
"starGiftAuctionRoundExtendable": StarGiftAuctionRoundExtendableTypeID,
|
||||
"payments.starGiftUpgradeAttributes": PaymentsStarGiftUpgradeAttributesTypeID,
|
||||
"messages.emojiGameOutcome": MessagesEmojiGameOutcomeTypeID,
|
||||
"messages.emojiGameUnavailable": MessagesEmojiGameUnavailableTypeID,
|
||||
"messages.emojiGameDiceInfo": MessagesEmojiGameDiceInfoTypeID,
|
||||
"starGiftAttributeRarity": StarGiftAttributeRarityTypeID,
|
||||
"starGiftAttributeRarityUncommon": StarGiftAttributeRarityUncommonTypeID,
|
||||
"starGiftAttributeRarityRare": StarGiftAttributeRarityRareTypeID,
|
||||
"starGiftAttributeRarityEpic": StarGiftAttributeRarityEpicTypeID,
|
||||
"starGiftAttributeRarityLegendary": StarGiftAttributeRarityLegendaryTypeID,
|
||||
"keyboardButtonStyle": KeyboardButtonStyleTypeID,
|
||||
"invokeAfterMsg": InvokeAfterMsgRequestTypeID,
|
||||
"invokeAfterMsgs": InvokeAfterMsgsRequestTypeID,
|
||||
"initConnection": InitConnectionRequestTypeID,
|
||||
@@ -3855,6 +3938,8 @@ func NamesMap() map[string]uint32 {
|
||||
"auth.resetLoginEmail": AuthResetLoginEmailRequestTypeID,
|
||||
"auth.reportMissingCode": AuthReportMissingCodeRequestTypeID,
|
||||
"auth.checkPaidAuth": AuthCheckPaidAuthRequestTypeID,
|
||||
"auth.initPasskeyLogin": AuthInitPasskeyLoginRequestTypeID,
|
||||
"auth.finishPasskeyLogin": AuthFinishPasskeyLoginRequestTypeID,
|
||||
"account.registerDevice": AccountRegisterDeviceRequestTypeID,
|
||||
"account.unregisterDevice": AccountUnregisterDeviceRequestTypeID,
|
||||
"account.updateNotifySettings": AccountUpdateNotifySettingsRequestTypeID,
|
||||
@@ -3974,6 +4059,10 @@ func NamesMap() map[string]uint32 {
|
||||
"account.saveMusic": AccountSaveMusicRequestTypeID,
|
||||
"account.getSavedMusicIds": AccountGetSavedMusicIDsRequestTypeID,
|
||||
"account.getUniqueGiftChatThemes": AccountGetUniqueGiftChatThemesRequestTypeID,
|
||||
"account.initPasskeyRegistration": AccountInitPasskeyRegistrationRequestTypeID,
|
||||
"account.registerPasskey": AccountRegisterPasskeyRequestTypeID,
|
||||
"account.getPasskeys": AccountGetPasskeysRequestTypeID,
|
||||
"account.deletePasskey": AccountDeletePasskeyRequestTypeID,
|
||||
"users.getUsers": UsersGetUsersRequestTypeID,
|
||||
"users.getFullUser": UsersGetFullUserRequestTypeID,
|
||||
"users.setSecureValueErrors": UsersSetSecureValueErrorsRequestTypeID,
|
||||
@@ -4246,6 +4335,13 @@ func NamesMap() map[string]uint32 {
|
||||
"messages.reorderPinnedForumTopics": MessagesReorderPinnedForumTopicsRequestTypeID,
|
||||
"messages.createForumTopic": MessagesCreateForumTopicRequestTypeID,
|
||||
"messages.deleteTopicHistory": MessagesDeleteTopicHistoryRequestTypeID,
|
||||
"messages.getEmojiGameInfo": MessagesGetEmojiGameInfoRequestTypeID,
|
||||
"messages.summarizeText": MessagesSummarizeTextRequestTypeID,
|
||||
"messages.editChatCreator": MessagesEditChatCreatorRequestTypeID,
|
||||
"messages.getFutureChatCreatorAfterLeave": MessagesGetFutureChatCreatorAfterLeaveRequestTypeID,
|
||||
"messages.editChatParticipantRank": MessagesEditChatParticipantRankRequestTypeID,
|
||||
"messages.declineUrlAuth": MessagesDeclineURLAuthRequestTypeID,
|
||||
"messages.checkUrlAuthMatchCode": MessagesCheckURLAuthMatchCodeRequestTypeID,
|
||||
"updates.getState": UpdatesGetStateRequestTypeID,
|
||||
"updates.getDifference": UpdatesGetDifferenceRequestTypeID,
|
||||
"updates.getChannelDifference": UpdatesGetChannelDifferenceRequestTypeID,
|
||||
@@ -4317,7 +4413,6 @@ func NamesMap() map[string]uint32 {
|
||||
"channels.getLeftChannels": ChannelsGetLeftChannelsRequestTypeID,
|
||||
"channels.getGroupsForDiscussion": ChannelsGetGroupsForDiscussionRequestTypeID,
|
||||
"channels.setDiscussionGroup": ChannelsSetDiscussionGroupRequestTypeID,
|
||||
"channels.editCreator": ChannelsEditCreatorRequestTypeID,
|
||||
"channels.editLocation": ChannelsEditLocationRequestTypeID,
|
||||
"channels.toggleSlowMode": ChannelsToggleSlowModeRequestTypeID,
|
||||
"channels.getInactiveChannels": ChannelsGetInactiveChannelsRequestTypeID,
|
||||
@@ -4436,6 +4531,11 @@ func NamesMap() map[string]uint32 {
|
||||
"payments.getStarGiftAuctionState": PaymentsGetStarGiftAuctionStateRequestTypeID,
|
||||
"payments.getStarGiftAuctionAcquiredGifts": PaymentsGetStarGiftAuctionAcquiredGiftsRequestTypeID,
|
||||
"payments.getStarGiftActiveAuctions": PaymentsGetStarGiftActiveAuctionsRequestTypeID,
|
||||
"payments.resolveStarGiftOffer": PaymentsResolveStarGiftOfferRequestTypeID,
|
||||
"payments.sendStarGiftOffer": PaymentsSendStarGiftOfferRequestTypeID,
|
||||
"payments.getStarGiftUpgradeAttributes": PaymentsGetStarGiftUpgradeAttributesRequestTypeID,
|
||||
"payments.getCraftStarGifts": PaymentsGetCraftStarGiftsRequestTypeID,
|
||||
"payments.craftStarGift": PaymentsCraftStarGiftRequestTypeID,
|
||||
"stickers.createStickerSet": StickersCreateStickerSetRequestTypeID,
|
||||
"stickers.removeStickerFromSet": StickersRemoveStickerFromSetRequestTypeID,
|
||||
"stickers.changeStickerPosition": StickersChangeStickerPositionRequestTypeID,
|
||||
@@ -4618,6 +4718,7 @@ func TypesConstructorMap() map[uint32]func() bin.Object {
|
||||
InputMediaWebPageTypeID: func() bin.Object { return &InputMediaWebPage{} },
|
||||
InputMediaPaidMediaTypeID: func() bin.Object { return &InputMediaPaidMedia{} },
|
||||
InputMediaTodoTypeID: func() bin.Object { return &InputMediaTodo{} },
|
||||
InputMediaStakeDiceTypeID: func() bin.Object { return &InputMediaStakeDice{} },
|
||||
InputChatPhotoEmptyTypeID: func() bin.Object { return &InputChatPhotoEmpty{} },
|
||||
InputChatUploadedPhotoTypeID: func() bin.Object { return &InputChatUploadedPhoto{} },
|
||||
InputChatPhotoTypeID: func() bin.Object { return &InputChatPhoto{} },
|
||||
@@ -4752,6 +4853,12 @@ func TypesConstructorMap() map[uint32]func() bin.Object {
|
||||
MessageActionSuggestedPostRefundTypeID: func() bin.Object { return &MessageActionSuggestedPostRefund{} },
|
||||
MessageActionGiftTonTypeID: func() bin.Object { return &MessageActionGiftTon{} },
|
||||
MessageActionSuggestBirthdayTypeID: func() bin.Object { return &MessageActionSuggestBirthday{} },
|
||||
MessageActionStarGiftPurchaseOfferTypeID: func() bin.Object { return &MessageActionStarGiftPurchaseOffer{} },
|
||||
MessageActionStarGiftPurchaseOfferDeclinedTypeID: func() bin.Object { return &MessageActionStarGiftPurchaseOfferDeclined{} },
|
||||
MessageActionNewCreatorPendingTypeID: func() bin.Object { return &MessageActionNewCreatorPending{} },
|
||||
MessageActionChangeCreatorTypeID: func() bin.Object { return &MessageActionChangeCreator{} },
|
||||
MessageActionNoForwardsToggleTypeID: func() bin.Object { return &MessageActionNoForwardsToggle{} },
|
||||
MessageActionNoForwardsRequestTypeID: func() bin.Object { return &MessageActionNoForwardsRequest{} },
|
||||
DialogTypeID: func() bin.Object { return &Dialog{} },
|
||||
DialogFolderTypeID: func() bin.Object { return &DialogFolder{} },
|
||||
PhotoEmptyTypeID: func() bin.Object { return &PhotoEmpty{} },
|
||||
@@ -4977,6 +5084,9 @@ func TypesConstructorMap() map[uint32]func() bin.Object {
|
||||
UpdateDeleteGroupCallMessagesTypeID: func() bin.Object { return &UpdateDeleteGroupCallMessages{} },
|
||||
UpdateStarGiftAuctionStateTypeID: func() bin.Object { return &UpdateStarGiftAuctionState{} },
|
||||
UpdateStarGiftAuctionUserStateTypeID: func() bin.Object { return &UpdateStarGiftAuctionUserState{} },
|
||||
UpdateEmojiGameInfoTypeID: func() bin.Object { return &UpdateEmojiGameInfo{} },
|
||||
UpdateStarGiftCraftFailTypeID: func() bin.Object { return &UpdateStarGiftCraftFail{} },
|
||||
UpdateChatParticipantRankTypeID: func() bin.Object { return &UpdateChatParticipantRank{} },
|
||||
UpdatesStateTypeID: func() bin.Object { return &UpdatesState{} },
|
||||
UpdatesDifferenceEmptyTypeID: func() bin.Object { return &UpdatesDifferenceEmpty{} },
|
||||
UpdatesDifferenceTypeID: func() bin.Object { return &UpdatesDifference{} },
|
||||
@@ -5193,6 +5303,7 @@ func TypesConstructorMap() map[uint32]func() bin.Object {
|
||||
MessageEntitySpoilerTypeID: func() bin.Object { return &MessageEntitySpoiler{} },
|
||||
MessageEntityCustomEmojiTypeID: func() bin.Object { return &MessageEntityCustomEmoji{} },
|
||||
MessageEntityBlockquoteTypeID: func() bin.Object { return &MessageEntityBlockquote{} },
|
||||
MessageEntityFormattedDateTypeID: func() bin.Object { return &MessageEntityFormattedDate{} },
|
||||
InputChannelEmptyTypeID: func() bin.Object { return &InputChannelEmpty{} },
|
||||
InputChannelTypeID: func() bin.Object { return &InputChannel{} },
|
||||
InputChannelFromMessageTypeID: func() bin.Object { return &InputChannelFromMessage{} },
|
||||
@@ -5455,6 +5566,7 @@ func TypesConstructorMap() map[uint32]func() bin.Object {
|
||||
ChannelAdminLogEventActionToggleSignatureProfilesTypeID: func() bin.Object { return &ChannelAdminLogEventActionToggleSignatureProfiles{} },
|
||||
ChannelAdminLogEventActionParticipantSubExtendTypeID: func() bin.Object { return &ChannelAdminLogEventActionParticipantSubExtend{} },
|
||||
ChannelAdminLogEventActionToggleAutotranslationTypeID: func() bin.Object { return &ChannelAdminLogEventActionToggleAutotranslation{} },
|
||||
ChannelAdminLogEventActionParticipantEditRankTypeID: func() bin.Object { return &ChannelAdminLogEventActionParticipantEditRank{} },
|
||||
ChannelAdminLogEventTypeID: func() bin.Object { return &ChannelAdminLogEvent{} },
|
||||
ChannelsAdminLogResultsTypeID: func() bin.Object { return &ChannelsAdminLogResults{} },
|
||||
ChannelAdminLogEventsFilterTypeID: func() bin.Object { return &ChannelAdminLogEventsFilter{} },
|
||||
@@ -6091,6 +6203,27 @@ func TypesConstructorMap() map[uint32]func() bin.Object {
|
||||
PaymentsStarGiftActiveAuctionsTypeID: func() bin.Object { return &PaymentsStarGiftActiveAuctions{} },
|
||||
InputStarGiftAuctionTypeID: func() bin.Object { return &InputStarGiftAuction{} },
|
||||
InputStarGiftAuctionSlugTypeID: func() bin.Object { return &InputStarGiftAuctionSlug{} },
|
||||
PasskeyTypeID: func() bin.Object { return &Passkey{} },
|
||||
AccountPasskeysTypeID: func() bin.Object { return &AccountPasskeys{} },
|
||||
AccountPasskeyRegistrationOptionsTypeID: func() bin.Object { return &AccountPasskeyRegistrationOptions{} },
|
||||
AuthPasskeyLoginOptionsTypeID: func() bin.Object { return &AuthPasskeyLoginOptions{} },
|
||||
InputPasskeyResponseRegisterTypeID: func() bin.Object { return &InputPasskeyResponseRegister{} },
|
||||
InputPasskeyResponseLoginTypeID: func() bin.Object { return &InputPasskeyResponseLogin{} },
|
||||
InputPasskeyCredentialPublicKeyTypeID: func() bin.Object { return &InputPasskeyCredentialPublicKey{} },
|
||||
InputPasskeyCredentialFirebasePNVTypeID: func() bin.Object { return &InputPasskeyCredentialFirebasePNV{} },
|
||||
StarGiftBackgroundTypeID: func() bin.Object { return &StarGiftBackground{} },
|
||||
StarGiftAuctionRoundTypeID: func() bin.Object { return &StarGiftAuctionRound{} },
|
||||
StarGiftAuctionRoundExtendableTypeID: func() bin.Object { return &StarGiftAuctionRoundExtendable{} },
|
||||
PaymentsStarGiftUpgradeAttributesTypeID: func() bin.Object { return &PaymentsStarGiftUpgradeAttributes{} },
|
||||
MessagesEmojiGameOutcomeTypeID: func() bin.Object { return &MessagesEmojiGameOutcome{} },
|
||||
MessagesEmojiGameUnavailableTypeID: func() bin.Object { return &MessagesEmojiGameUnavailable{} },
|
||||
MessagesEmojiGameDiceInfoTypeID: func() bin.Object { return &MessagesEmojiGameDiceInfo{} },
|
||||
StarGiftAttributeRarityTypeID: func() bin.Object { return &StarGiftAttributeRarity{} },
|
||||
StarGiftAttributeRarityUncommonTypeID: func() bin.Object { return &StarGiftAttributeRarityUncommon{} },
|
||||
StarGiftAttributeRarityRareTypeID: func() bin.Object { return &StarGiftAttributeRarityRare{} },
|
||||
StarGiftAttributeRarityEpicTypeID: func() bin.Object { return &StarGiftAttributeRarityEpic{} },
|
||||
StarGiftAttributeRarityLegendaryTypeID: func() bin.Object { return &StarGiftAttributeRarityLegendary{} },
|
||||
KeyboardButtonStyleTypeID: func() bin.Object { return &KeyboardButtonStyle{} },
|
||||
InvokeAfterMsgRequestTypeID: func() bin.Object { return &InvokeAfterMsgRequest{} },
|
||||
InvokeAfterMsgsRequestTypeID: func() bin.Object { return &InvokeAfterMsgsRequest{} },
|
||||
InitConnectionRequestTypeID: func() bin.Object { return &InitConnectionRequest{} },
|
||||
@@ -6126,6 +6259,8 @@ func TypesConstructorMap() map[uint32]func() bin.Object {
|
||||
AuthResetLoginEmailRequestTypeID: func() bin.Object { return &AuthResetLoginEmailRequest{} },
|
||||
AuthReportMissingCodeRequestTypeID: func() bin.Object { return &AuthReportMissingCodeRequest{} },
|
||||
AuthCheckPaidAuthRequestTypeID: func() bin.Object { return &AuthCheckPaidAuthRequest{} },
|
||||
AuthInitPasskeyLoginRequestTypeID: func() bin.Object { return &AuthInitPasskeyLoginRequest{} },
|
||||
AuthFinishPasskeyLoginRequestTypeID: func() bin.Object { return &AuthFinishPasskeyLoginRequest{} },
|
||||
AccountRegisterDeviceRequestTypeID: func() bin.Object { return &AccountRegisterDeviceRequest{} },
|
||||
AccountUnregisterDeviceRequestTypeID: func() bin.Object { return &AccountUnregisterDeviceRequest{} },
|
||||
AccountUpdateNotifySettingsRequestTypeID: func() bin.Object { return &AccountUpdateNotifySettingsRequest{} },
|
||||
@@ -6245,6 +6380,10 @@ func TypesConstructorMap() map[uint32]func() bin.Object {
|
||||
AccountSaveMusicRequestTypeID: func() bin.Object { return &AccountSaveMusicRequest{} },
|
||||
AccountGetSavedMusicIDsRequestTypeID: func() bin.Object { return &AccountGetSavedMusicIDsRequest{} },
|
||||
AccountGetUniqueGiftChatThemesRequestTypeID: func() bin.Object { return &AccountGetUniqueGiftChatThemesRequest{} },
|
||||
AccountInitPasskeyRegistrationRequestTypeID: func() bin.Object { return &AccountInitPasskeyRegistrationRequest{} },
|
||||
AccountRegisterPasskeyRequestTypeID: func() bin.Object { return &AccountRegisterPasskeyRequest{} },
|
||||
AccountGetPasskeysRequestTypeID: func() bin.Object { return &AccountGetPasskeysRequest{} },
|
||||
AccountDeletePasskeyRequestTypeID: func() bin.Object { return &AccountDeletePasskeyRequest{} },
|
||||
UsersGetUsersRequestTypeID: func() bin.Object { return &UsersGetUsersRequest{} },
|
||||
UsersGetFullUserRequestTypeID: func() bin.Object { return &UsersGetFullUserRequest{} },
|
||||
UsersSetSecureValueErrorsRequestTypeID: func() bin.Object { return &UsersSetSecureValueErrorsRequest{} },
|
||||
@@ -6517,6 +6656,13 @@ func TypesConstructorMap() map[uint32]func() bin.Object {
|
||||
MessagesReorderPinnedForumTopicsRequestTypeID: func() bin.Object { return &MessagesReorderPinnedForumTopicsRequest{} },
|
||||
MessagesCreateForumTopicRequestTypeID: func() bin.Object { return &MessagesCreateForumTopicRequest{} },
|
||||
MessagesDeleteTopicHistoryRequestTypeID: func() bin.Object { return &MessagesDeleteTopicHistoryRequest{} },
|
||||
MessagesGetEmojiGameInfoRequestTypeID: func() bin.Object { return &MessagesGetEmojiGameInfoRequest{} },
|
||||
MessagesSummarizeTextRequestTypeID: func() bin.Object { return &MessagesSummarizeTextRequest{} },
|
||||
MessagesEditChatCreatorRequestTypeID: func() bin.Object { return &MessagesEditChatCreatorRequest{} },
|
||||
MessagesGetFutureChatCreatorAfterLeaveRequestTypeID: func() bin.Object { return &MessagesGetFutureChatCreatorAfterLeaveRequest{} },
|
||||
MessagesEditChatParticipantRankRequestTypeID: func() bin.Object { return &MessagesEditChatParticipantRankRequest{} },
|
||||
MessagesDeclineURLAuthRequestTypeID: func() bin.Object { return &MessagesDeclineURLAuthRequest{} },
|
||||
MessagesCheckURLAuthMatchCodeRequestTypeID: func() bin.Object { return &MessagesCheckURLAuthMatchCodeRequest{} },
|
||||
UpdatesGetStateRequestTypeID: func() bin.Object { return &UpdatesGetStateRequest{} },
|
||||
UpdatesGetDifferenceRequestTypeID: func() bin.Object { return &UpdatesGetDifferenceRequest{} },
|
||||
UpdatesGetChannelDifferenceRequestTypeID: func() bin.Object { return &UpdatesGetChannelDifferenceRequest{} },
|
||||
@@ -6588,7 +6734,6 @@ func TypesConstructorMap() map[uint32]func() bin.Object {
|
||||
ChannelsGetLeftChannelsRequestTypeID: func() bin.Object { return &ChannelsGetLeftChannelsRequest{} },
|
||||
ChannelsGetGroupsForDiscussionRequestTypeID: func() bin.Object { return &ChannelsGetGroupsForDiscussionRequest{} },
|
||||
ChannelsSetDiscussionGroupRequestTypeID: func() bin.Object { return &ChannelsSetDiscussionGroupRequest{} },
|
||||
ChannelsEditCreatorRequestTypeID: func() bin.Object { return &ChannelsEditCreatorRequest{} },
|
||||
ChannelsEditLocationRequestTypeID: func() bin.Object { return &ChannelsEditLocationRequest{} },
|
||||
ChannelsToggleSlowModeRequestTypeID: func() bin.Object { return &ChannelsToggleSlowModeRequest{} },
|
||||
ChannelsGetInactiveChannelsRequestTypeID: func() bin.Object { return &ChannelsGetInactiveChannelsRequest{} },
|
||||
@@ -6707,6 +6852,11 @@ func TypesConstructorMap() map[uint32]func() bin.Object {
|
||||
PaymentsGetStarGiftAuctionStateRequestTypeID: func() bin.Object { return &PaymentsGetStarGiftAuctionStateRequest{} },
|
||||
PaymentsGetStarGiftAuctionAcquiredGiftsRequestTypeID: func() bin.Object { return &PaymentsGetStarGiftAuctionAcquiredGiftsRequest{} },
|
||||
PaymentsGetStarGiftActiveAuctionsRequestTypeID: func() bin.Object { return &PaymentsGetStarGiftActiveAuctionsRequest{} },
|
||||
PaymentsResolveStarGiftOfferRequestTypeID: func() bin.Object { return &PaymentsResolveStarGiftOfferRequest{} },
|
||||
PaymentsSendStarGiftOfferRequestTypeID: func() bin.Object { return &PaymentsSendStarGiftOfferRequest{} },
|
||||
PaymentsGetStarGiftUpgradeAttributesRequestTypeID: func() bin.Object { return &PaymentsGetStarGiftUpgradeAttributesRequest{} },
|
||||
PaymentsGetCraftStarGiftsRequestTypeID: func() bin.Object { return &PaymentsGetCraftStarGiftsRequest{} },
|
||||
PaymentsCraftStarGiftRequestTypeID: func() bin.Object { return &PaymentsCraftStarGiftRequest{} },
|
||||
StickersCreateStickerSetRequestTypeID: func() bin.Object { return &StickersCreateStickerSetRequest{} },
|
||||
StickersRemoveStickerFromSetRequestTypeID: func() bin.Object { return &StickersRemoveStickerFromSetRequest{} },
|
||||
StickersChangeStickerPositionRequestTypeID: func() bin.Object { return &StickersChangeStickerPositionRequest{} },
|
||||
@@ -7031,6 +7181,7 @@ func ClassConstructorsMap() map[string][]uint32 {
|
||||
ChannelAdminLogEventActionToggleSignatureProfilesTypeID,
|
||||
ChannelAdminLogEventActionParticipantSubExtendTypeID,
|
||||
ChannelAdminLogEventActionToggleAutotranslationTypeID,
|
||||
ChannelAdminLogEventActionParticipantEditRankTypeID,
|
||||
},
|
||||
ChannelLocationClassName: {
|
||||
ChannelLocationEmptyTypeID,
|
||||
@@ -7403,6 +7554,7 @@ func ClassConstructorsMap() map[string][]uint32 {
|
||||
InputMediaWebPageTypeID,
|
||||
InputMediaPaidMediaTypeID,
|
||||
InputMediaTodoTypeID,
|
||||
InputMediaStakeDiceTypeID,
|
||||
},
|
||||
InputMessageClassName: {
|
||||
InputMessageIDTypeID,
|
||||
@@ -7417,6 +7569,14 @@ func ClassConstructorsMap() map[string][]uint32 {
|
||||
InputNotifyBroadcastsTypeID,
|
||||
InputNotifyForumTopicTypeID,
|
||||
},
|
||||
InputPasskeyCredentialClassName: {
|
||||
InputPasskeyCredentialPublicKeyTypeID,
|
||||
InputPasskeyCredentialFirebasePNVTypeID,
|
||||
},
|
||||
InputPasskeyResponseClassName: {
|
||||
InputPasskeyResponseRegisterTypeID,
|
||||
InputPasskeyResponseLoginTypeID,
|
||||
},
|
||||
InputPaymentCredentialsClassName: {
|
||||
InputPaymentCredentialsSavedTypeID,
|
||||
InputPaymentCredentialsTypeID,
|
||||
@@ -7639,6 +7799,12 @@ func ClassConstructorsMap() map[string][]uint32 {
|
||||
MessageActionSuggestedPostRefundTypeID,
|
||||
MessageActionGiftTonTypeID,
|
||||
MessageActionSuggestBirthdayTypeID,
|
||||
MessageActionStarGiftPurchaseOfferTypeID,
|
||||
MessageActionStarGiftPurchaseOfferDeclinedTypeID,
|
||||
MessageActionNewCreatorPendingTypeID,
|
||||
MessageActionChangeCreatorTypeID,
|
||||
MessageActionNoForwardsToggleTypeID,
|
||||
MessageActionNoForwardsRequestTypeID,
|
||||
},
|
||||
MessageClassName: {
|
||||
MessageEmptyTypeID,
|
||||
@@ -7667,6 +7833,7 @@ func ClassConstructorsMap() map[string][]uint32 {
|
||||
MessageEntitySpoilerTypeID,
|
||||
MessageEntityCustomEmojiTypeID,
|
||||
MessageEntityBlockquoteTypeID,
|
||||
MessageEntityFormattedDateTypeID,
|
||||
},
|
||||
MessageExtendedMediaClassName: {
|
||||
MessageExtendedMediaPreviewTypeID,
|
||||
@@ -7727,6 +7894,10 @@ func ClassConstructorsMap() map[string][]uint32 {
|
||||
MessagesDialogsSliceTypeID,
|
||||
MessagesDialogsNotModifiedTypeID,
|
||||
},
|
||||
MessagesEmojiGameInfoClassName: {
|
||||
MessagesEmojiGameUnavailableTypeID,
|
||||
MessagesEmojiGameDiceInfoTypeID,
|
||||
},
|
||||
MessagesEmojiGroupsClassName: {
|
||||
MessagesEmojiGroupsNotModifiedTypeID,
|
||||
MessagesEmojiGroupsTypeID,
|
||||
@@ -8168,6 +8339,17 @@ func ClassConstructorsMap() map[string][]uint32 {
|
||||
StarGiftAttributeIDPatternTypeID,
|
||||
StarGiftAttributeIDBackdropTypeID,
|
||||
},
|
||||
StarGiftAttributeRarityClassName: {
|
||||
StarGiftAttributeRarityTypeID,
|
||||
StarGiftAttributeRarityUncommonTypeID,
|
||||
StarGiftAttributeRarityRareTypeID,
|
||||
StarGiftAttributeRarityEpicTypeID,
|
||||
StarGiftAttributeRarityLegendaryTypeID,
|
||||
},
|
||||
StarGiftAuctionRoundClassName: {
|
||||
StarGiftAuctionRoundTypeID,
|
||||
StarGiftAuctionRoundExtendableTypeID,
|
||||
},
|
||||
StarGiftAuctionStateClassName: {
|
||||
StarGiftAuctionStateNotModifiedTypeID,
|
||||
StarGiftAuctionStateTypeID,
|
||||
@@ -8404,6 +8586,9 @@ func ClassConstructorsMap() map[string][]uint32 {
|
||||
UpdateDeleteGroupCallMessagesTypeID,
|
||||
UpdateStarGiftAuctionStateTypeID,
|
||||
UpdateStarGiftAuctionUserStateTypeID,
|
||||
UpdateEmojiGameInfoTypeID,
|
||||
UpdateStarGiftCraftFailTypeID,
|
||||
UpdateChatParticipantRankTypeID,
|
||||
},
|
||||
UpdatesChannelDifferenceClassName: {
|
||||
UpdatesChannelDifferenceEmptyTypeID,
|
||||
|
||||
Generated
+126
-30
@@ -31,7 +31,7 @@ var (
|
||||
_ = tdjson.Encoder{}
|
||||
)
|
||||
|
||||
// SavedStarGift represents TL type `savedStarGift#8983a452`.
|
||||
// SavedStarGift represents TL type `savedStarGift#41df43fc`.
|
||||
// Represents a gift¹ owned by a peer.
|
||||
//
|
||||
// Links:
|
||||
@@ -160,10 +160,18 @@ type SavedStarGift struct {
|
||||
//
|
||||
// Use SetDropOriginalDetailsStars and GetDropOriginalDetailsStars helpers.
|
||||
DropOriginalDetailsStars int64
|
||||
// GiftNum field of SavedStarGift.
|
||||
//
|
||||
// Use SetGiftNum and GetGiftNum helpers.
|
||||
GiftNum int
|
||||
// CanCraftAt field of SavedStarGift.
|
||||
//
|
||||
// Use SetCanCraftAt and GetCanCraftAt helpers.
|
||||
CanCraftAt int
|
||||
}
|
||||
|
||||
// SavedStarGiftTypeID is TL type id of SavedStarGift.
|
||||
const SavedStarGiftTypeID = 0x8983a452
|
||||
const SavedStarGiftTypeID = 0x41df43fc
|
||||
|
||||
// Ensuring interfaces in compile-time for SavedStarGift.
|
||||
var (
|
||||
@@ -243,6 +251,12 @@ func (s *SavedStarGift) Zero() bool {
|
||||
if !(s.DropOriginalDetailsStars == 0) {
|
||||
return false
|
||||
}
|
||||
if !(s.GiftNum == 0) {
|
||||
return false
|
||||
}
|
||||
if !(s.CanCraftAt == 0) {
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
@@ -279,6 +293,8 @@ func (s *SavedStarGift) FillFrom(from interface {
|
||||
GetCollectionID() (value []int, ok bool)
|
||||
GetPrepaidUpgradeHash() (value string, ok bool)
|
||||
GetDropOriginalDetailsStars() (value int64, ok bool)
|
||||
GetGiftNum() (value int, ok bool)
|
||||
GetCanCraftAt() (value int, ok bool)
|
||||
}) {
|
||||
s.NameHidden = from.GetNameHidden()
|
||||
s.Unsaved = from.GetUnsaved()
|
||||
@@ -340,6 +356,14 @@ func (s *SavedStarGift) FillFrom(from interface {
|
||||
s.DropOriginalDetailsStars = val
|
||||
}
|
||||
|
||||
if val, ok := from.GetGiftNum(); ok {
|
||||
s.GiftNum = val
|
||||
}
|
||||
|
||||
if val, ok := from.GetCanCraftAt(); ok {
|
||||
s.CanCraftAt = val
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// TypeID returns type id in TL schema.
|
||||
@@ -468,6 +492,16 @@ func (s *SavedStarGift) TypeInfo() tdp.Type {
|
||||
SchemaName: "drop_original_details_stars",
|
||||
Null: !s.Flags.Has(18),
|
||||
},
|
||||
{
|
||||
Name: "GiftNum",
|
||||
SchemaName: "gift_num",
|
||||
Null: !s.Flags.Has(19),
|
||||
},
|
||||
{
|
||||
Name: "CanCraftAt",
|
||||
SchemaName: "can_craft_at",
|
||||
Null: !s.Flags.Has(20),
|
||||
},
|
||||
}
|
||||
return typ
|
||||
}
|
||||
@@ -531,12 +565,18 @@ func (s *SavedStarGift) SetFlags() {
|
||||
if !(s.DropOriginalDetailsStars == 0) {
|
||||
s.Flags.Set(18)
|
||||
}
|
||||
if !(s.GiftNum == 0) {
|
||||
s.Flags.Set(19)
|
||||
}
|
||||
if !(s.CanCraftAt == 0) {
|
||||
s.Flags.Set(20)
|
||||
}
|
||||
}
|
||||
|
||||
// Encode implements bin.Encoder.
|
||||
func (s *SavedStarGift) Encode(b *bin.Buffer) error {
|
||||
if s == nil {
|
||||
return fmt.Errorf("can't encode savedStarGift#8983a452 as nil")
|
||||
return fmt.Errorf("can't encode savedStarGift#41df43fc as nil")
|
||||
}
|
||||
b.PutID(SavedStarGiftTypeID)
|
||||
return s.EncodeBare(b)
|
||||
@@ -545,30 +585,30 @@ func (s *SavedStarGift) Encode(b *bin.Buffer) error {
|
||||
// EncodeBare implements bin.BareEncoder.
|
||||
func (s *SavedStarGift) EncodeBare(b *bin.Buffer) error {
|
||||
if s == nil {
|
||||
return fmt.Errorf("can't encode savedStarGift#8983a452 as nil")
|
||||
return fmt.Errorf("can't encode savedStarGift#41df43fc as nil")
|
||||
}
|
||||
s.SetFlags()
|
||||
if err := s.Flags.Encode(b); err != nil {
|
||||
return fmt.Errorf("unable to encode savedStarGift#8983a452: field flags: %w", err)
|
||||
return fmt.Errorf("unable to encode savedStarGift#41df43fc: field flags: %w", err)
|
||||
}
|
||||
if s.Flags.Has(1) {
|
||||
if s.FromID == nil {
|
||||
return fmt.Errorf("unable to encode savedStarGift#8983a452: field from_id is nil")
|
||||
return fmt.Errorf("unable to encode savedStarGift#41df43fc: field from_id is nil")
|
||||
}
|
||||
if err := s.FromID.Encode(b); err != nil {
|
||||
return fmt.Errorf("unable to encode savedStarGift#8983a452: field from_id: %w", err)
|
||||
return fmt.Errorf("unable to encode savedStarGift#41df43fc: field from_id: %w", err)
|
||||
}
|
||||
}
|
||||
b.PutInt(s.Date)
|
||||
if s.Gift == nil {
|
||||
return fmt.Errorf("unable to encode savedStarGift#8983a452: field gift is nil")
|
||||
return fmt.Errorf("unable to encode savedStarGift#41df43fc: field gift is nil")
|
||||
}
|
||||
if err := s.Gift.Encode(b); err != nil {
|
||||
return fmt.Errorf("unable to encode savedStarGift#8983a452: field gift: %w", err)
|
||||
return fmt.Errorf("unable to encode savedStarGift#41df43fc: field gift: %w", err)
|
||||
}
|
||||
if s.Flags.Has(2) {
|
||||
if err := s.Message.Encode(b); err != nil {
|
||||
return fmt.Errorf("unable to encode savedStarGift#8983a452: field message: %w", err)
|
||||
return fmt.Errorf("unable to encode savedStarGift#41df43fc: field message: %w", err)
|
||||
}
|
||||
}
|
||||
if s.Flags.Has(3) {
|
||||
@@ -607,16 +647,22 @@ func (s *SavedStarGift) EncodeBare(b *bin.Buffer) error {
|
||||
if s.Flags.Has(18) {
|
||||
b.PutLong(s.DropOriginalDetailsStars)
|
||||
}
|
||||
if s.Flags.Has(19) {
|
||||
b.PutInt(s.GiftNum)
|
||||
}
|
||||
if s.Flags.Has(20) {
|
||||
b.PutInt(s.CanCraftAt)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Decode implements bin.Decoder.
|
||||
func (s *SavedStarGift) Decode(b *bin.Buffer) error {
|
||||
if s == nil {
|
||||
return fmt.Errorf("can't decode savedStarGift#8983a452 to nil")
|
||||
return fmt.Errorf("can't decode savedStarGift#41df43fc to nil")
|
||||
}
|
||||
if err := b.ConsumeID(SavedStarGiftTypeID); err != nil {
|
||||
return fmt.Errorf("unable to decode savedStarGift#8983a452: %w", err)
|
||||
return fmt.Errorf("unable to decode savedStarGift#41df43fc: %w", err)
|
||||
}
|
||||
return s.DecodeBare(b)
|
||||
}
|
||||
@@ -624,11 +670,11 @@ func (s *SavedStarGift) Decode(b *bin.Buffer) error {
|
||||
// DecodeBare implements bin.BareDecoder.
|
||||
func (s *SavedStarGift) DecodeBare(b *bin.Buffer) error {
|
||||
if s == nil {
|
||||
return fmt.Errorf("can't decode savedStarGift#8983a452 to nil")
|
||||
return fmt.Errorf("can't decode savedStarGift#41df43fc to nil")
|
||||
}
|
||||
{
|
||||
if err := s.Flags.Decode(b); err != nil {
|
||||
return fmt.Errorf("unable to decode savedStarGift#8983a452: field flags: %w", err)
|
||||
return fmt.Errorf("unable to decode savedStarGift#41df43fc: field flags: %w", err)
|
||||
}
|
||||
}
|
||||
s.NameHidden = s.Flags.Has(0)
|
||||
@@ -640,89 +686,89 @@ func (s *SavedStarGift) DecodeBare(b *bin.Buffer) error {
|
||||
if s.Flags.Has(1) {
|
||||
value, err := DecodePeer(b)
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode savedStarGift#8983a452: field from_id: %w", err)
|
||||
return fmt.Errorf("unable to decode savedStarGift#41df43fc: field from_id: %w", err)
|
||||
}
|
||||
s.FromID = value
|
||||
}
|
||||
{
|
||||
value, err := b.Int()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode savedStarGift#8983a452: field date: %w", err)
|
||||
return fmt.Errorf("unable to decode savedStarGift#41df43fc: field date: %w", err)
|
||||
}
|
||||
s.Date = value
|
||||
}
|
||||
{
|
||||
value, err := DecodeStarGift(b)
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode savedStarGift#8983a452: field gift: %w", err)
|
||||
return fmt.Errorf("unable to decode savedStarGift#41df43fc: field gift: %w", err)
|
||||
}
|
||||
s.Gift = value
|
||||
}
|
||||
if s.Flags.Has(2) {
|
||||
if err := s.Message.Decode(b); err != nil {
|
||||
return fmt.Errorf("unable to decode savedStarGift#8983a452: field message: %w", err)
|
||||
return fmt.Errorf("unable to decode savedStarGift#41df43fc: field message: %w", err)
|
||||
}
|
||||
}
|
||||
if s.Flags.Has(3) {
|
||||
value, err := b.Int()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode savedStarGift#8983a452: field msg_id: %w", err)
|
||||
return fmt.Errorf("unable to decode savedStarGift#41df43fc: field msg_id: %w", err)
|
||||
}
|
||||
s.MsgID = value
|
||||
}
|
||||
if s.Flags.Has(11) {
|
||||
value, err := b.Long()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode savedStarGift#8983a452: field saved_id: %w", err)
|
||||
return fmt.Errorf("unable to decode savedStarGift#41df43fc: field saved_id: %w", err)
|
||||
}
|
||||
s.SavedID = value
|
||||
}
|
||||
if s.Flags.Has(4) {
|
||||
value, err := b.Long()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode savedStarGift#8983a452: field convert_stars: %w", err)
|
||||
return fmt.Errorf("unable to decode savedStarGift#41df43fc: field convert_stars: %w", err)
|
||||
}
|
||||
s.ConvertStars = value
|
||||
}
|
||||
if s.Flags.Has(6) {
|
||||
value, err := b.Long()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode savedStarGift#8983a452: field upgrade_stars: %w", err)
|
||||
return fmt.Errorf("unable to decode savedStarGift#41df43fc: field upgrade_stars: %w", err)
|
||||
}
|
||||
s.UpgradeStars = value
|
||||
}
|
||||
if s.Flags.Has(7) {
|
||||
value, err := b.Int()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode savedStarGift#8983a452: field can_export_at: %w", err)
|
||||
return fmt.Errorf("unable to decode savedStarGift#41df43fc: field can_export_at: %w", err)
|
||||
}
|
||||
s.CanExportAt = value
|
||||
}
|
||||
if s.Flags.Has(8) {
|
||||
value, err := b.Long()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode savedStarGift#8983a452: field transfer_stars: %w", err)
|
||||
return fmt.Errorf("unable to decode savedStarGift#41df43fc: field transfer_stars: %w", err)
|
||||
}
|
||||
s.TransferStars = value
|
||||
}
|
||||
if s.Flags.Has(13) {
|
||||
value, err := b.Int()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode savedStarGift#8983a452: field can_transfer_at: %w", err)
|
||||
return fmt.Errorf("unable to decode savedStarGift#41df43fc: field can_transfer_at: %w", err)
|
||||
}
|
||||
s.CanTransferAt = value
|
||||
}
|
||||
if s.Flags.Has(14) {
|
||||
value, err := b.Int()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode savedStarGift#8983a452: field can_resell_at: %w", err)
|
||||
return fmt.Errorf("unable to decode savedStarGift#41df43fc: field can_resell_at: %w", err)
|
||||
}
|
||||
s.CanResellAt = value
|
||||
}
|
||||
if s.Flags.Has(15) {
|
||||
headerLen, err := b.VectorHeader()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode savedStarGift#8983a452: field collection_id: %w", err)
|
||||
return fmt.Errorf("unable to decode savedStarGift#41df43fc: field collection_id: %w", err)
|
||||
}
|
||||
|
||||
if headerLen > 0 {
|
||||
@@ -731,7 +777,7 @@ func (s *SavedStarGift) DecodeBare(b *bin.Buffer) error {
|
||||
for idx := 0; idx < headerLen; idx++ {
|
||||
value, err := b.Int()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode savedStarGift#8983a452: field collection_id: %w", err)
|
||||
return fmt.Errorf("unable to decode savedStarGift#41df43fc: field collection_id: %w", err)
|
||||
}
|
||||
s.CollectionID = append(s.CollectionID, value)
|
||||
}
|
||||
@@ -739,17 +785,31 @@ func (s *SavedStarGift) DecodeBare(b *bin.Buffer) error {
|
||||
if s.Flags.Has(16) {
|
||||
value, err := b.String()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode savedStarGift#8983a452: field prepaid_upgrade_hash: %w", err)
|
||||
return fmt.Errorf("unable to decode savedStarGift#41df43fc: field prepaid_upgrade_hash: %w", err)
|
||||
}
|
||||
s.PrepaidUpgradeHash = value
|
||||
}
|
||||
if s.Flags.Has(18) {
|
||||
value, err := b.Long()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode savedStarGift#8983a452: field drop_original_details_stars: %w", err)
|
||||
return fmt.Errorf("unable to decode savedStarGift#41df43fc: field drop_original_details_stars: %w", err)
|
||||
}
|
||||
s.DropOriginalDetailsStars = value
|
||||
}
|
||||
if s.Flags.Has(19) {
|
||||
value, err := b.Int()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode savedStarGift#41df43fc: field gift_num: %w", err)
|
||||
}
|
||||
s.GiftNum = value
|
||||
}
|
||||
if s.Flags.Has(20) {
|
||||
value, err := b.Int()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode savedStarGift#41df43fc: field can_craft_at: %w", err)
|
||||
}
|
||||
s.CanCraftAt = value
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -1116,3 +1176,39 @@ func (s *SavedStarGift) GetDropOriginalDetailsStars() (value int64, ok bool) {
|
||||
}
|
||||
return s.DropOriginalDetailsStars, true
|
||||
}
|
||||
|
||||
// SetGiftNum sets value of GiftNum conditional field.
|
||||
func (s *SavedStarGift) SetGiftNum(value int) {
|
||||
s.Flags.Set(19)
|
||||
s.GiftNum = value
|
||||
}
|
||||
|
||||
// GetGiftNum returns value of GiftNum conditional field and
|
||||
// boolean which is true if field was set.
|
||||
func (s *SavedStarGift) GetGiftNum() (value int, ok bool) {
|
||||
if s == nil {
|
||||
return
|
||||
}
|
||||
if !s.Flags.Has(19) {
|
||||
return value, false
|
||||
}
|
||||
return s.GiftNum, true
|
||||
}
|
||||
|
||||
// SetCanCraftAt sets value of CanCraftAt conditional field.
|
||||
func (s *SavedStarGift) SetCanCraftAt(value int) {
|
||||
s.Flags.Set(20)
|
||||
s.CanCraftAt = value
|
||||
}
|
||||
|
||||
// GetCanCraftAt returns value of CanCraftAt conditional field and
|
||||
// boolean which is true if field was set.
|
||||
func (s *SavedStarGift) GetCanCraftAt() (value int, ok bool) {
|
||||
if s == nil {
|
||||
return
|
||||
}
|
||||
if !s.Flags.Has(20) {
|
||||
return value, false
|
||||
}
|
||||
return s.CanCraftAt, true
|
||||
}
|
||||
|
||||
Generated
+318
-17
@@ -493,6 +493,40 @@ func (s *ServerDispatcher) OnAuthCheckPaidAuth(f func(ctx context.Context, reque
|
||||
s.handlers[AuthCheckPaidAuthRequestTypeID] = handler
|
||||
}
|
||||
|
||||
func (s *ServerDispatcher) OnAuthInitPasskeyLogin(f func(ctx context.Context, request *AuthInitPasskeyLoginRequest) (*AuthPasskeyLoginOptions, error)) {
|
||||
handler := func(ctx context.Context, b *bin.Buffer) (bin.Encoder, error) {
|
||||
var request AuthInitPasskeyLoginRequest
|
||||
if err := request.Decode(b); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
response, err := f(ctx, &request)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return response, nil
|
||||
}
|
||||
|
||||
s.handlers[AuthInitPasskeyLoginRequestTypeID] = handler
|
||||
}
|
||||
|
||||
func (s *ServerDispatcher) OnAuthFinishPasskeyLogin(f func(ctx context.Context, request *AuthFinishPasskeyLoginRequest) (AuthAuthorizationClass, error)) {
|
||||
handler := func(ctx context.Context, b *bin.Buffer) (bin.Encoder, error) {
|
||||
var request AuthFinishPasskeyLoginRequest
|
||||
if err := request.Decode(b); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
response, err := f(ctx, &request)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &AuthAuthorizationBox{Authorization: response}, nil
|
||||
}
|
||||
|
||||
s.handlers[AuthFinishPasskeyLoginRequestTypeID] = handler
|
||||
}
|
||||
|
||||
func (s *ServerDispatcher) OnAccountRegisterDevice(f func(ctx context.Context, request *AccountRegisterDeviceRequest) (bool, error)) {
|
||||
handler := func(ctx context.Context, b *bin.Buffer) (bin.Encoder, error) {
|
||||
var request AccountRegisterDeviceRequest
|
||||
@@ -2744,6 +2778,78 @@ func (s *ServerDispatcher) OnAccountGetUniqueGiftChatThemes(f func(ctx context.C
|
||||
s.handlers[AccountGetUniqueGiftChatThemesRequestTypeID] = handler
|
||||
}
|
||||
|
||||
func (s *ServerDispatcher) OnAccountInitPasskeyRegistration(f func(ctx context.Context) (*AccountPasskeyRegistrationOptions, error)) {
|
||||
handler := func(ctx context.Context, b *bin.Buffer) (bin.Encoder, error) {
|
||||
var request AccountInitPasskeyRegistrationRequest
|
||||
if err := request.Decode(b); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
response, err := f(ctx)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return response, nil
|
||||
}
|
||||
|
||||
s.handlers[AccountInitPasskeyRegistrationRequestTypeID] = handler
|
||||
}
|
||||
|
||||
func (s *ServerDispatcher) OnAccountRegisterPasskey(f func(ctx context.Context, credential InputPasskeyCredentialClass) (*Passkey, error)) {
|
||||
handler := func(ctx context.Context, b *bin.Buffer) (bin.Encoder, error) {
|
||||
var request AccountRegisterPasskeyRequest
|
||||
if err := request.Decode(b); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
response, err := f(ctx, request.Credential)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return response, nil
|
||||
}
|
||||
|
||||
s.handlers[AccountRegisterPasskeyRequestTypeID] = handler
|
||||
}
|
||||
|
||||
func (s *ServerDispatcher) OnAccountGetPasskeys(f func(ctx context.Context) (*AccountPasskeys, error)) {
|
||||
handler := func(ctx context.Context, b *bin.Buffer) (bin.Encoder, error) {
|
||||
var request AccountGetPasskeysRequest
|
||||
if err := request.Decode(b); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
response, err := f(ctx)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return response, nil
|
||||
}
|
||||
|
||||
s.handlers[AccountGetPasskeysRequestTypeID] = handler
|
||||
}
|
||||
|
||||
func (s *ServerDispatcher) OnAccountDeletePasskey(f func(ctx context.Context, id string) (bool, error)) {
|
||||
handler := func(ctx context.Context, b *bin.Buffer) (bin.Encoder, error) {
|
||||
var request AccountDeletePasskeyRequest
|
||||
if err := request.Decode(b); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
response, err := f(ctx, request.ID)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if response {
|
||||
return &BoolBox{Bool: &BoolTrue{}}, nil
|
||||
}
|
||||
|
||||
return &BoolBox{Bool: &BoolFalse{}}, nil
|
||||
}
|
||||
|
||||
s.handlers[AccountDeletePasskeyRequestTypeID] = handler
|
||||
}
|
||||
|
||||
func (s *ServerDispatcher) OnUsersGetUsers(f func(ctx context.Context, id []InputUserClass) ([]UserClass, error)) {
|
||||
handler := func(ctx context.Context, b *bin.Buffer) (bin.Encoder, error) {
|
||||
var request UsersGetUsersRequest
|
||||
@@ -7636,6 +7742,133 @@ func (s *ServerDispatcher) OnMessagesDeleteTopicHistory(f func(ctx context.Conte
|
||||
s.handlers[MessagesDeleteTopicHistoryRequestTypeID] = handler
|
||||
}
|
||||
|
||||
func (s *ServerDispatcher) OnMessagesGetEmojiGameInfo(f func(ctx context.Context) (MessagesEmojiGameInfoClass, error)) {
|
||||
handler := func(ctx context.Context, b *bin.Buffer) (bin.Encoder, error) {
|
||||
var request MessagesGetEmojiGameInfoRequest
|
||||
if err := request.Decode(b); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
response, err := f(ctx)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &MessagesEmojiGameInfoBox{EmojiGameInfo: response}, nil
|
||||
}
|
||||
|
||||
s.handlers[MessagesGetEmojiGameInfoRequestTypeID] = handler
|
||||
}
|
||||
|
||||
func (s *ServerDispatcher) OnMessagesSummarizeText(f func(ctx context.Context, request *MessagesSummarizeTextRequest) (*TextWithEntities, error)) {
|
||||
handler := func(ctx context.Context, b *bin.Buffer) (bin.Encoder, error) {
|
||||
var request MessagesSummarizeTextRequest
|
||||
if err := request.Decode(b); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
response, err := f(ctx, &request)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return response, nil
|
||||
}
|
||||
|
||||
s.handlers[MessagesSummarizeTextRequestTypeID] = handler
|
||||
}
|
||||
|
||||
func (s *ServerDispatcher) OnMessagesEditChatCreator(f func(ctx context.Context, request *MessagesEditChatCreatorRequest) (UpdatesClass, error)) {
|
||||
handler := func(ctx context.Context, b *bin.Buffer) (bin.Encoder, error) {
|
||||
var request MessagesEditChatCreatorRequest
|
||||
if err := request.Decode(b); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
response, err := f(ctx, &request)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &UpdatesBox{Updates: response}, nil
|
||||
}
|
||||
|
||||
s.handlers[MessagesEditChatCreatorRequestTypeID] = handler
|
||||
}
|
||||
|
||||
func (s *ServerDispatcher) OnMessagesGetFutureChatCreatorAfterLeave(f func(ctx context.Context, peer InputPeerClass) (UserClass, error)) {
|
||||
handler := func(ctx context.Context, b *bin.Buffer) (bin.Encoder, error) {
|
||||
var request MessagesGetFutureChatCreatorAfterLeaveRequest
|
||||
if err := request.Decode(b); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
response, err := f(ctx, request.Peer)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &UserBox{User: response}, nil
|
||||
}
|
||||
|
||||
s.handlers[MessagesGetFutureChatCreatorAfterLeaveRequestTypeID] = handler
|
||||
}
|
||||
|
||||
func (s *ServerDispatcher) OnMessagesEditChatParticipantRank(f func(ctx context.Context, request *MessagesEditChatParticipantRankRequest) (UpdatesClass, error)) {
|
||||
handler := func(ctx context.Context, b *bin.Buffer) (bin.Encoder, error) {
|
||||
var request MessagesEditChatParticipantRankRequest
|
||||
if err := request.Decode(b); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
response, err := f(ctx, &request)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &UpdatesBox{Updates: response}, nil
|
||||
}
|
||||
|
||||
s.handlers[MessagesEditChatParticipantRankRequestTypeID] = handler
|
||||
}
|
||||
|
||||
func (s *ServerDispatcher) OnMessagesDeclineURLAuth(f func(ctx context.Context, url string) (bool, error)) {
|
||||
handler := func(ctx context.Context, b *bin.Buffer) (bin.Encoder, error) {
|
||||
var request MessagesDeclineURLAuthRequest
|
||||
if err := request.Decode(b); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
response, err := f(ctx, request.URL)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if response {
|
||||
return &BoolBox{Bool: &BoolTrue{}}, nil
|
||||
}
|
||||
|
||||
return &BoolBox{Bool: &BoolFalse{}}, nil
|
||||
}
|
||||
|
||||
s.handlers[MessagesDeclineURLAuthRequestTypeID] = handler
|
||||
}
|
||||
|
||||
func (s *ServerDispatcher) OnMessagesCheckURLAuthMatchCode(f func(ctx context.Context, request *MessagesCheckURLAuthMatchCodeRequest) (bool, error)) {
|
||||
handler := func(ctx context.Context, b *bin.Buffer) (bin.Encoder, error) {
|
||||
var request MessagesCheckURLAuthMatchCodeRequest
|
||||
if err := request.Decode(b); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
response, err := f(ctx, &request)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if response {
|
||||
return &BoolBox{Bool: &BoolTrue{}}, nil
|
||||
}
|
||||
|
||||
return &BoolBox{Bool: &BoolFalse{}}, nil
|
||||
}
|
||||
|
||||
s.handlers[MessagesCheckURLAuthMatchCodeRequestTypeID] = handler
|
||||
}
|
||||
|
||||
func (s *ServerDispatcher) OnUpdatesGetState(f func(ctx context.Context) (*UpdatesState, error)) {
|
||||
handler := func(ctx context.Context, b *bin.Buffer) (bin.Encoder, error) {
|
||||
var request UpdatesGetStateRequest
|
||||
@@ -8899,23 +9132,6 @@ func (s *ServerDispatcher) OnChannelsSetDiscussionGroup(f func(ctx context.Conte
|
||||
s.handlers[ChannelsSetDiscussionGroupRequestTypeID] = handler
|
||||
}
|
||||
|
||||
func (s *ServerDispatcher) OnChannelsEditCreator(f func(ctx context.Context, request *ChannelsEditCreatorRequest) (UpdatesClass, error)) {
|
||||
handler := func(ctx context.Context, b *bin.Buffer) (bin.Encoder, error) {
|
||||
var request ChannelsEditCreatorRequest
|
||||
if err := request.Decode(b); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
response, err := f(ctx, &request)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &UpdatesBox{Updates: response}, nil
|
||||
}
|
||||
|
||||
s.handlers[ChannelsEditCreatorRequestTypeID] = handler
|
||||
}
|
||||
|
||||
func (s *ServerDispatcher) OnChannelsEditLocation(f func(ctx context.Context, request *ChannelsEditLocationRequest) (bool, error)) {
|
||||
handler := func(ctx context.Context, b *bin.Buffer) (bin.Encoder, error) {
|
||||
var request ChannelsEditLocationRequest
|
||||
@@ -11058,6 +11274,91 @@ func (s *ServerDispatcher) OnPaymentsGetStarGiftActiveAuctions(f func(ctx contex
|
||||
s.handlers[PaymentsGetStarGiftActiveAuctionsRequestTypeID] = handler
|
||||
}
|
||||
|
||||
func (s *ServerDispatcher) OnPaymentsResolveStarGiftOffer(f func(ctx context.Context, request *PaymentsResolveStarGiftOfferRequest) (UpdatesClass, error)) {
|
||||
handler := func(ctx context.Context, b *bin.Buffer) (bin.Encoder, error) {
|
||||
var request PaymentsResolveStarGiftOfferRequest
|
||||
if err := request.Decode(b); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
response, err := f(ctx, &request)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &UpdatesBox{Updates: response}, nil
|
||||
}
|
||||
|
||||
s.handlers[PaymentsResolveStarGiftOfferRequestTypeID] = handler
|
||||
}
|
||||
|
||||
func (s *ServerDispatcher) OnPaymentsSendStarGiftOffer(f func(ctx context.Context, request *PaymentsSendStarGiftOfferRequest) (UpdatesClass, error)) {
|
||||
handler := func(ctx context.Context, b *bin.Buffer) (bin.Encoder, error) {
|
||||
var request PaymentsSendStarGiftOfferRequest
|
||||
if err := request.Decode(b); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
response, err := f(ctx, &request)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &UpdatesBox{Updates: response}, nil
|
||||
}
|
||||
|
||||
s.handlers[PaymentsSendStarGiftOfferRequestTypeID] = handler
|
||||
}
|
||||
|
||||
func (s *ServerDispatcher) OnPaymentsGetStarGiftUpgradeAttributes(f func(ctx context.Context, giftid int64) (*PaymentsStarGiftUpgradeAttributes, error)) {
|
||||
handler := func(ctx context.Context, b *bin.Buffer) (bin.Encoder, error) {
|
||||
var request PaymentsGetStarGiftUpgradeAttributesRequest
|
||||
if err := request.Decode(b); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
response, err := f(ctx, request.GiftID)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return response, nil
|
||||
}
|
||||
|
||||
s.handlers[PaymentsGetStarGiftUpgradeAttributesRequestTypeID] = handler
|
||||
}
|
||||
|
||||
func (s *ServerDispatcher) OnPaymentsGetCraftStarGifts(f func(ctx context.Context, request *PaymentsGetCraftStarGiftsRequest) (*PaymentsSavedStarGifts, error)) {
|
||||
handler := func(ctx context.Context, b *bin.Buffer) (bin.Encoder, error) {
|
||||
var request PaymentsGetCraftStarGiftsRequest
|
||||
if err := request.Decode(b); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
response, err := f(ctx, &request)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return response, nil
|
||||
}
|
||||
|
||||
s.handlers[PaymentsGetCraftStarGiftsRequestTypeID] = handler
|
||||
}
|
||||
|
||||
func (s *ServerDispatcher) OnPaymentsCraftStarGift(f func(ctx context.Context, stargift []InputSavedStarGiftClass) (UpdatesClass, error)) {
|
||||
handler := func(ctx context.Context, b *bin.Buffer) (bin.Encoder, error) {
|
||||
var request PaymentsCraftStarGiftRequest
|
||||
if err := request.Decode(b); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
response, err := f(ctx, request.Stargift)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &UpdatesBox{Updates: response}, nil
|
||||
}
|
||||
|
||||
s.handlers[PaymentsCraftStarGiftRequestTypeID] = handler
|
||||
}
|
||||
|
||||
func (s *ServerDispatcher) OnStickersCreateStickerSet(f func(ctx context.Context, request *StickersCreateStickerSetRequest) (MessagesStickerSetClass, error)) {
|
||||
handler := func(ctx context.Context, b *bin.Buffer) (bin.Encoder, error) {
|
||||
var request StickersCreateStickerSetRequest
|
||||
|
||||
+151
-83
@@ -31,7 +31,7 @@ var (
|
||||
_ = tdjson.Encoder{}
|
||||
)
|
||||
|
||||
// StarGiftAttributeModel represents TL type `starGiftAttributeModel#39d99013`.
|
||||
// StarGiftAttributeModel represents TL type `starGiftAttributeModel#565251e2`.
|
||||
// The model of a collectible gift »¹.
|
||||
//
|
||||
// Links:
|
||||
@@ -39,6 +39,10 @@ var (
|
||||
//
|
||||
// See https://core.telegram.org/constructor/starGiftAttributeModel for reference.
|
||||
type StarGiftAttributeModel struct {
|
||||
// Flags field of StarGiftAttributeModel.
|
||||
Flags bin.Fields
|
||||
// Crafted field of StarGiftAttributeModel.
|
||||
Crafted bool
|
||||
// Name of the model
|
||||
Name string
|
||||
// The sticker¹ representing the upgraded gift
|
||||
@@ -46,12 +50,12 @@ type StarGiftAttributeModel struct {
|
||||
// Links:
|
||||
// 1) https://core.telegram.org/api/stickers
|
||||
Document DocumentClass
|
||||
// The number of upgraded gifts that receive this backdrop for each 1000 gifts upgraded.
|
||||
RarityPermille int
|
||||
// Rarity field of StarGiftAttributeModel.
|
||||
Rarity StarGiftAttributeRarityClass
|
||||
}
|
||||
|
||||
// StarGiftAttributeModelTypeID is TL type id of StarGiftAttributeModel.
|
||||
const StarGiftAttributeModelTypeID = 0x39d99013
|
||||
const StarGiftAttributeModelTypeID = 0x565251e2
|
||||
|
||||
// construct implements constructor of StarGiftAttributeClass.
|
||||
func (s StarGiftAttributeModel) construct() StarGiftAttributeClass { return &s }
|
||||
@@ -70,13 +74,19 @@ func (s *StarGiftAttributeModel) Zero() bool {
|
||||
if s == nil {
|
||||
return true
|
||||
}
|
||||
if !(s.Flags.Zero()) {
|
||||
return false
|
||||
}
|
||||
if !(s.Crafted == false) {
|
||||
return false
|
||||
}
|
||||
if !(s.Name == "") {
|
||||
return false
|
||||
}
|
||||
if !(s.Document == nil) {
|
||||
return false
|
||||
}
|
||||
if !(s.RarityPermille == 0) {
|
||||
if !(s.Rarity == nil) {
|
||||
return false
|
||||
}
|
||||
|
||||
@@ -94,13 +104,15 @@ func (s *StarGiftAttributeModel) String() string {
|
||||
|
||||
// FillFrom fills StarGiftAttributeModel from given interface.
|
||||
func (s *StarGiftAttributeModel) FillFrom(from interface {
|
||||
GetCrafted() (value bool)
|
||||
GetName() (value string)
|
||||
GetDocument() (value DocumentClass)
|
||||
GetRarityPermille() (value int)
|
||||
GetRarity() (value StarGiftAttributeRarityClass)
|
||||
}) {
|
||||
s.Crafted = from.GetCrafted()
|
||||
s.Name = from.GetName()
|
||||
s.Document = from.GetDocument()
|
||||
s.RarityPermille = from.GetRarityPermille()
|
||||
s.Rarity = from.GetRarity()
|
||||
}
|
||||
|
||||
// TypeID returns type id in TL schema.
|
||||
@@ -126,6 +138,11 @@ func (s *StarGiftAttributeModel) TypeInfo() tdp.Type {
|
||||
return typ
|
||||
}
|
||||
typ.Fields = []tdp.Field{
|
||||
{
|
||||
Name: "Crafted",
|
||||
SchemaName: "crafted",
|
||||
Null: !s.Flags.Has(0),
|
||||
},
|
||||
{
|
||||
Name: "Name",
|
||||
SchemaName: "name",
|
||||
@@ -135,17 +152,24 @@ func (s *StarGiftAttributeModel) TypeInfo() tdp.Type {
|
||||
SchemaName: "document",
|
||||
},
|
||||
{
|
||||
Name: "RarityPermille",
|
||||
SchemaName: "rarity_permille",
|
||||
Name: "Rarity",
|
||||
SchemaName: "rarity",
|
||||
},
|
||||
}
|
||||
return typ
|
||||
}
|
||||
|
||||
// SetFlags sets flags for non-zero fields.
|
||||
func (s *StarGiftAttributeModel) SetFlags() {
|
||||
if !(s.Crafted == false) {
|
||||
s.Flags.Set(0)
|
||||
}
|
||||
}
|
||||
|
||||
// Encode implements bin.Encoder.
|
||||
func (s *StarGiftAttributeModel) Encode(b *bin.Buffer) error {
|
||||
if s == nil {
|
||||
return fmt.Errorf("can't encode starGiftAttributeModel#39d99013 as nil")
|
||||
return fmt.Errorf("can't encode starGiftAttributeModel#565251e2 as nil")
|
||||
}
|
||||
b.PutID(StarGiftAttributeModelTypeID)
|
||||
return s.EncodeBare(b)
|
||||
@@ -154,26 +178,35 @@ func (s *StarGiftAttributeModel) Encode(b *bin.Buffer) error {
|
||||
// EncodeBare implements bin.BareEncoder.
|
||||
func (s *StarGiftAttributeModel) EncodeBare(b *bin.Buffer) error {
|
||||
if s == nil {
|
||||
return fmt.Errorf("can't encode starGiftAttributeModel#39d99013 as nil")
|
||||
return fmt.Errorf("can't encode starGiftAttributeModel#565251e2 as nil")
|
||||
}
|
||||
s.SetFlags()
|
||||
if err := s.Flags.Encode(b); err != nil {
|
||||
return fmt.Errorf("unable to encode starGiftAttributeModel#565251e2: field flags: %w", err)
|
||||
}
|
||||
b.PutString(s.Name)
|
||||
if s.Document == nil {
|
||||
return fmt.Errorf("unable to encode starGiftAttributeModel#39d99013: field document is nil")
|
||||
return fmt.Errorf("unable to encode starGiftAttributeModel#565251e2: field document is nil")
|
||||
}
|
||||
if err := s.Document.Encode(b); err != nil {
|
||||
return fmt.Errorf("unable to encode starGiftAttributeModel#39d99013: field document: %w", err)
|
||||
return fmt.Errorf("unable to encode starGiftAttributeModel#565251e2: field document: %w", err)
|
||||
}
|
||||
if s.Rarity == nil {
|
||||
return fmt.Errorf("unable to encode starGiftAttributeModel#565251e2: field rarity is nil")
|
||||
}
|
||||
if err := s.Rarity.Encode(b); err != nil {
|
||||
return fmt.Errorf("unable to encode starGiftAttributeModel#565251e2: field rarity: %w", err)
|
||||
}
|
||||
b.PutInt(s.RarityPermille)
|
||||
return nil
|
||||
}
|
||||
|
||||
// Decode implements bin.Decoder.
|
||||
func (s *StarGiftAttributeModel) Decode(b *bin.Buffer) error {
|
||||
if s == nil {
|
||||
return fmt.Errorf("can't decode starGiftAttributeModel#39d99013 to nil")
|
||||
return fmt.Errorf("can't decode starGiftAttributeModel#565251e2 to nil")
|
||||
}
|
||||
if err := b.ConsumeID(StarGiftAttributeModelTypeID); err != nil {
|
||||
return fmt.Errorf("unable to decode starGiftAttributeModel#39d99013: %w", err)
|
||||
return fmt.Errorf("unable to decode starGiftAttributeModel#565251e2: %w", err)
|
||||
}
|
||||
return s.DecodeBare(b)
|
||||
}
|
||||
@@ -181,32 +214,57 @@ func (s *StarGiftAttributeModel) Decode(b *bin.Buffer) error {
|
||||
// DecodeBare implements bin.BareDecoder.
|
||||
func (s *StarGiftAttributeModel) DecodeBare(b *bin.Buffer) error {
|
||||
if s == nil {
|
||||
return fmt.Errorf("can't decode starGiftAttributeModel#39d99013 to nil")
|
||||
return fmt.Errorf("can't decode starGiftAttributeModel#565251e2 to nil")
|
||||
}
|
||||
{
|
||||
if err := s.Flags.Decode(b); err != nil {
|
||||
return fmt.Errorf("unable to decode starGiftAttributeModel#565251e2: field flags: %w", err)
|
||||
}
|
||||
}
|
||||
s.Crafted = s.Flags.Has(0)
|
||||
{
|
||||
value, err := b.String()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode starGiftAttributeModel#39d99013: field name: %w", err)
|
||||
return fmt.Errorf("unable to decode starGiftAttributeModel#565251e2: field name: %w", err)
|
||||
}
|
||||
s.Name = value
|
||||
}
|
||||
{
|
||||
value, err := DecodeDocument(b)
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode starGiftAttributeModel#39d99013: field document: %w", err)
|
||||
return fmt.Errorf("unable to decode starGiftAttributeModel#565251e2: field document: %w", err)
|
||||
}
|
||||
s.Document = value
|
||||
}
|
||||
{
|
||||
value, err := b.Int()
|
||||
value, err := DecodeStarGiftAttributeRarity(b)
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode starGiftAttributeModel#39d99013: field rarity_permille: %w", err)
|
||||
return fmt.Errorf("unable to decode starGiftAttributeModel#565251e2: field rarity: %w", err)
|
||||
}
|
||||
s.RarityPermille = value
|
||||
s.Rarity = value
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// SetCrafted sets value of Crafted conditional field.
|
||||
func (s *StarGiftAttributeModel) SetCrafted(value bool) {
|
||||
if value {
|
||||
s.Flags.Set(0)
|
||||
s.Crafted = true
|
||||
} else {
|
||||
s.Flags.Unset(0)
|
||||
s.Crafted = false
|
||||
}
|
||||
}
|
||||
|
||||
// GetCrafted returns value of Crafted conditional field.
|
||||
func (s *StarGiftAttributeModel) GetCrafted() (value bool) {
|
||||
if s == nil {
|
||||
return
|
||||
}
|
||||
return s.Flags.Has(0)
|
||||
}
|
||||
|
||||
// GetName returns value of Name field.
|
||||
func (s *StarGiftAttributeModel) GetName() (value string) {
|
||||
if s == nil {
|
||||
@@ -223,15 +281,15 @@ func (s *StarGiftAttributeModel) GetDocument() (value DocumentClass) {
|
||||
return s.Document
|
||||
}
|
||||
|
||||
// GetRarityPermille returns value of RarityPermille field.
|
||||
func (s *StarGiftAttributeModel) GetRarityPermille() (value int) {
|
||||
// GetRarity returns value of Rarity field.
|
||||
func (s *StarGiftAttributeModel) GetRarity() (value StarGiftAttributeRarityClass) {
|
||||
if s == nil {
|
||||
return
|
||||
}
|
||||
return s.RarityPermille
|
||||
return s.Rarity
|
||||
}
|
||||
|
||||
// StarGiftAttributePattern represents TL type `starGiftAttributePattern#13acff19`.
|
||||
// StarGiftAttributePattern represents TL type `starGiftAttributePattern#4e7085ea`.
|
||||
// A sticker¹ applied on the backdrop of a collectible gift »² using a repeating
|
||||
// pattern.
|
||||
//
|
||||
@@ -245,12 +303,12 @@ type StarGiftAttributePattern struct {
|
||||
Name string
|
||||
// The symbol
|
||||
Document DocumentClass
|
||||
// The number of upgraded gifts that receive this backdrop for each 1000 gifts upgraded.
|
||||
RarityPermille int
|
||||
// Rarity field of StarGiftAttributePattern.
|
||||
Rarity StarGiftAttributeRarityClass
|
||||
}
|
||||
|
||||
// StarGiftAttributePatternTypeID is TL type id of StarGiftAttributePattern.
|
||||
const StarGiftAttributePatternTypeID = 0x13acff19
|
||||
const StarGiftAttributePatternTypeID = 0x4e7085ea
|
||||
|
||||
// construct implements constructor of StarGiftAttributeClass.
|
||||
func (s StarGiftAttributePattern) construct() StarGiftAttributeClass { return &s }
|
||||
@@ -275,7 +333,7 @@ func (s *StarGiftAttributePattern) Zero() bool {
|
||||
if !(s.Document == nil) {
|
||||
return false
|
||||
}
|
||||
if !(s.RarityPermille == 0) {
|
||||
if !(s.Rarity == nil) {
|
||||
return false
|
||||
}
|
||||
|
||||
@@ -295,11 +353,11 @@ func (s *StarGiftAttributePattern) String() string {
|
||||
func (s *StarGiftAttributePattern) FillFrom(from interface {
|
||||
GetName() (value string)
|
||||
GetDocument() (value DocumentClass)
|
||||
GetRarityPermille() (value int)
|
||||
GetRarity() (value StarGiftAttributeRarityClass)
|
||||
}) {
|
||||
s.Name = from.GetName()
|
||||
s.Document = from.GetDocument()
|
||||
s.RarityPermille = from.GetRarityPermille()
|
||||
s.Rarity = from.GetRarity()
|
||||
}
|
||||
|
||||
// TypeID returns type id in TL schema.
|
||||
@@ -334,8 +392,8 @@ func (s *StarGiftAttributePattern) TypeInfo() tdp.Type {
|
||||
SchemaName: "document",
|
||||
},
|
||||
{
|
||||
Name: "RarityPermille",
|
||||
SchemaName: "rarity_permille",
|
||||
Name: "Rarity",
|
||||
SchemaName: "rarity",
|
||||
},
|
||||
}
|
||||
return typ
|
||||
@@ -344,7 +402,7 @@ func (s *StarGiftAttributePattern) TypeInfo() tdp.Type {
|
||||
// Encode implements bin.Encoder.
|
||||
func (s *StarGiftAttributePattern) Encode(b *bin.Buffer) error {
|
||||
if s == nil {
|
||||
return fmt.Errorf("can't encode starGiftAttributePattern#13acff19 as nil")
|
||||
return fmt.Errorf("can't encode starGiftAttributePattern#4e7085ea as nil")
|
||||
}
|
||||
b.PutID(StarGiftAttributePatternTypeID)
|
||||
return s.EncodeBare(b)
|
||||
@@ -353,26 +411,31 @@ func (s *StarGiftAttributePattern) Encode(b *bin.Buffer) error {
|
||||
// EncodeBare implements bin.BareEncoder.
|
||||
func (s *StarGiftAttributePattern) EncodeBare(b *bin.Buffer) error {
|
||||
if s == nil {
|
||||
return fmt.Errorf("can't encode starGiftAttributePattern#13acff19 as nil")
|
||||
return fmt.Errorf("can't encode starGiftAttributePattern#4e7085ea as nil")
|
||||
}
|
||||
b.PutString(s.Name)
|
||||
if s.Document == nil {
|
||||
return fmt.Errorf("unable to encode starGiftAttributePattern#13acff19: field document is nil")
|
||||
return fmt.Errorf("unable to encode starGiftAttributePattern#4e7085ea: field document is nil")
|
||||
}
|
||||
if err := s.Document.Encode(b); err != nil {
|
||||
return fmt.Errorf("unable to encode starGiftAttributePattern#13acff19: field document: %w", err)
|
||||
return fmt.Errorf("unable to encode starGiftAttributePattern#4e7085ea: field document: %w", err)
|
||||
}
|
||||
if s.Rarity == nil {
|
||||
return fmt.Errorf("unable to encode starGiftAttributePattern#4e7085ea: field rarity is nil")
|
||||
}
|
||||
if err := s.Rarity.Encode(b); err != nil {
|
||||
return fmt.Errorf("unable to encode starGiftAttributePattern#4e7085ea: field rarity: %w", err)
|
||||
}
|
||||
b.PutInt(s.RarityPermille)
|
||||
return nil
|
||||
}
|
||||
|
||||
// Decode implements bin.Decoder.
|
||||
func (s *StarGiftAttributePattern) Decode(b *bin.Buffer) error {
|
||||
if s == nil {
|
||||
return fmt.Errorf("can't decode starGiftAttributePattern#13acff19 to nil")
|
||||
return fmt.Errorf("can't decode starGiftAttributePattern#4e7085ea to nil")
|
||||
}
|
||||
if err := b.ConsumeID(StarGiftAttributePatternTypeID); err != nil {
|
||||
return fmt.Errorf("unable to decode starGiftAttributePattern#13acff19: %w", err)
|
||||
return fmt.Errorf("unable to decode starGiftAttributePattern#4e7085ea: %w", err)
|
||||
}
|
||||
return s.DecodeBare(b)
|
||||
}
|
||||
@@ -380,28 +443,28 @@ func (s *StarGiftAttributePattern) Decode(b *bin.Buffer) error {
|
||||
// DecodeBare implements bin.BareDecoder.
|
||||
func (s *StarGiftAttributePattern) DecodeBare(b *bin.Buffer) error {
|
||||
if s == nil {
|
||||
return fmt.Errorf("can't decode starGiftAttributePattern#13acff19 to nil")
|
||||
return fmt.Errorf("can't decode starGiftAttributePattern#4e7085ea to nil")
|
||||
}
|
||||
{
|
||||
value, err := b.String()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode starGiftAttributePattern#13acff19: field name: %w", err)
|
||||
return fmt.Errorf("unable to decode starGiftAttributePattern#4e7085ea: field name: %w", err)
|
||||
}
|
||||
s.Name = value
|
||||
}
|
||||
{
|
||||
value, err := DecodeDocument(b)
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode starGiftAttributePattern#13acff19: field document: %w", err)
|
||||
return fmt.Errorf("unable to decode starGiftAttributePattern#4e7085ea: field document: %w", err)
|
||||
}
|
||||
s.Document = value
|
||||
}
|
||||
{
|
||||
value, err := b.Int()
|
||||
value, err := DecodeStarGiftAttributeRarity(b)
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode starGiftAttributePattern#13acff19: field rarity_permille: %w", err)
|
||||
return fmt.Errorf("unable to decode starGiftAttributePattern#4e7085ea: field rarity: %w", err)
|
||||
}
|
||||
s.RarityPermille = value
|
||||
s.Rarity = value
|
||||
}
|
||||
return nil
|
||||
}
|
||||
@@ -422,15 +485,15 @@ func (s *StarGiftAttributePattern) GetDocument() (value DocumentClass) {
|
||||
return s.Document
|
||||
}
|
||||
|
||||
// GetRarityPermille returns value of RarityPermille field.
|
||||
func (s *StarGiftAttributePattern) GetRarityPermille() (value int) {
|
||||
// GetRarity returns value of Rarity field.
|
||||
func (s *StarGiftAttributePattern) GetRarity() (value StarGiftAttributeRarityClass) {
|
||||
if s == nil {
|
||||
return
|
||||
}
|
||||
return s.RarityPermille
|
||||
return s.Rarity
|
||||
}
|
||||
|
||||
// StarGiftAttributeBackdrop represents TL type `starGiftAttributeBackdrop#d93d859c`.
|
||||
// StarGiftAttributeBackdrop represents TL type `starGiftAttributeBackdrop#9f2504e4`.
|
||||
// The backdrop of a collectible gift »¹.
|
||||
//
|
||||
// Links:
|
||||
@@ -453,12 +516,12 @@ type StarGiftAttributeBackdrop struct {
|
||||
PatternColor int
|
||||
// Color of the text on the backdrop in RGB24 format.
|
||||
TextColor int
|
||||
// The number of upgraded gifts that receive this backdrop for each 1000 gifts upgraded.
|
||||
RarityPermille int
|
||||
// Rarity field of StarGiftAttributeBackdrop.
|
||||
Rarity StarGiftAttributeRarityClass
|
||||
}
|
||||
|
||||
// StarGiftAttributeBackdropTypeID is TL type id of StarGiftAttributeBackdrop.
|
||||
const StarGiftAttributeBackdropTypeID = 0xd93d859c
|
||||
const StarGiftAttributeBackdropTypeID = 0x9f2504e4
|
||||
|
||||
// construct implements constructor of StarGiftAttributeClass.
|
||||
func (s StarGiftAttributeBackdrop) construct() StarGiftAttributeClass { return &s }
|
||||
@@ -495,7 +558,7 @@ func (s *StarGiftAttributeBackdrop) Zero() bool {
|
||||
if !(s.TextColor == 0) {
|
||||
return false
|
||||
}
|
||||
if !(s.RarityPermille == 0) {
|
||||
if !(s.Rarity == nil) {
|
||||
return false
|
||||
}
|
||||
|
||||
@@ -519,7 +582,7 @@ func (s *StarGiftAttributeBackdrop) FillFrom(from interface {
|
||||
GetEdgeColor() (value int)
|
||||
GetPatternColor() (value int)
|
||||
GetTextColor() (value int)
|
||||
GetRarityPermille() (value int)
|
||||
GetRarity() (value StarGiftAttributeRarityClass)
|
||||
}) {
|
||||
s.Name = from.GetName()
|
||||
s.BackdropID = from.GetBackdropID()
|
||||
@@ -527,7 +590,7 @@ func (s *StarGiftAttributeBackdrop) FillFrom(from interface {
|
||||
s.EdgeColor = from.GetEdgeColor()
|
||||
s.PatternColor = from.GetPatternColor()
|
||||
s.TextColor = from.GetTextColor()
|
||||
s.RarityPermille = from.GetRarityPermille()
|
||||
s.Rarity = from.GetRarity()
|
||||
}
|
||||
|
||||
// TypeID returns type id in TL schema.
|
||||
@@ -578,8 +641,8 @@ func (s *StarGiftAttributeBackdrop) TypeInfo() tdp.Type {
|
||||
SchemaName: "text_color",
|
||||
},
|
||||
{
|
||||
Name: "RarityPermille",
|
||||
SchemaName: "rarity_permille",
|
||||
Name: "Rarity",
|
||||
SchemaName: "rarity",
|
||||
},
|
||||
}
|
||||
return typ
|
||||
@@ -588,7 +651,7 @@ func (s *StarGiftAttributeBackdrop) TypeInfo() tdp.Type {
|
||||
// Encode implements bin.Encoder.
|
||||
func (s *StarGiftAttributeBackdrop) Encode(b *bin.Buffer) error {
|
||||
if s == nil {
|
||||
return fmt.Errorf("can't encode starGiftAttributeBackdrop#d93d859c as nil")
|
||||
return fmt.Errorf("can't encode starGiftAttributeBackdrop#9f2504e4 as nil")
|
||||
}
|
||||
b.PutID(StarGiftAttributeBackdropTypeID)
|
||||
return s.EncodeBare(b)
|
||||
@@ -597,7 +660,7 @@ func (s *StarGiftAttributeBackdrop) Encode(b *bin.Buffer) error {
|
||||
// EncodeBare implements bin.BareEncoder.
|
||||
func (s *StarGiftAttributeBackdrop) EncodeBare(b *bin.Buffer) error {
|
||||
if s == nil {
|
||||
return fmt.Errorf("can't encode starGiftAttributeBackdrop#d93d859c as nil")
|
||||
return fmt.Errorf("can't encode starGiftAttributeBackdrop#9f2504e4 as nil")
|
||||
}
|
||||
b.PutString(s.Name)
|
||||
b.PutInt(s.BackdropID)
|
||||
@@ -605,17 +668,22 @@ func (s *StarGiftAttributeBackdrop) EncodeBare(b *bin.Buffer) error {
|
||||
b.PutInt(s.EdgeColor)
|
||||
b.PutInt(s.PatternColor)
|
||||
b.PutInt(s.TextColor)
|
||||
b.PutInt(s.RarityPermille)
|
||||
if s.Rarity == nil {
|
||||
return fmt.Errorf("unable to encode starGiftAttributeBackdrop#9f2504e4: field rarity is nil")
|
||||
}
|
||||
if err := s.Rarity.Encode(b); err != nil {
|
||||
return fmt.Errorf("unable to encode starGiftAttributeBackdrop#9f2504e4: field rarity: %w", err)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Decode implements bin.Decoder.
|
||||
func (s *StarGiftAttributeBackdrop) Decode(b *bin.Buffer) error {
|
||||
if s == nil {
|
||||
return fmt.Errorf("can't decode starGiftAttributeBackdrop#d93d859c to nil")
|
||||
return fmt.Errorf("can't decode starGiftAttributeBackdrop#9f2504e4 to nil")
|
||||
}
|
||||
if err := b.ConsumeID(StarGiftAttributeBackdropTypeID); err != nil {
|
||||
return fmt.Errorf("unable to decode starGiftAttributeBackdrop#d93d859c: %w", err)
|
||||
return fmt.Errorf("unable to decode starGiftAttributeBackdrop#9f2504e4: %w", err)
|
||||
}
|
||||
return s.DecodeBare(b)
|
||||
}
|
||||
@@ -623,56 +691,56 @@ func (s *StarGiftAttributeBackdrop) Decode(b *bin.Buffer) error {
|
||||
// DecodeBare implements bin.BareDecoder.
|
||||
func (s *StarGiftAttributeBackdrop) DecodeBare(b *bin.Buffer) error {
|
||||
if s == nil {
|
||||
return fmt.Errorf("can't decode starGiftAttributeBackdrop#d93d859c to nil")
|
||||
return fmt.Errorf("can't decode starGiftAttributeBackdrop#9f2504e4 to nil")
|
||||
}
|
||||
{
|
||||
value, err := b.String()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode starGiftAttributeBackdrop#d93d859c: field name: %w", err)
|
||||
return fmt.Errorf("unable to decode starGiftAttributeBackdrop#9f2504e4: field name: %w", err)
|
||||
}
|
||||
s.Name = value
|
||||
}
|
||||
{
|
||||
value, err := b.Int()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode starGiftAttributeBackdrop#d93d859c: field backdrop_id: %w", err)
|
||||
return fmt.Errorf("unable to decode starGiftAttributeBackdrop#9f2504e4: field backdrop_id: %w", err)
|
||||
}
|
||||
s.BackdropID = value
|
||||
}
|
||||
{
|
||||
value, err := b.Int()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode starGiftAttributeBackdrop#d93d859c: field center_color: %w", err)
|
||||
return fmt.Errorf("unable to decode starGiftAttributeBackdrop#9f2504e4: field center_color: %w", err)
|
||||
}
|
||||
s.CenterColor = value
|
||||
}
|
||||
{
|
||||
value, err := b.Int()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode starGiftAttributeBackdrop#d93d859c: field edge_color: %w", err)
|
||||
return fmt.Errorf("unable to decode starGiftAttributeBackdrop#9f2504e4: field edge_color: %w", err)
|
||||
}
|
||||
s.EdgeColor = value
|
||||
}
|
||||
{
|
||||
value, err := b.Int()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode starGiftAttributeBackdrop#d93d859c: field pattern_color: %w", err)
|
||||
return fmt.Errorf("unable to decode starGiftAttributeBackdrop#9f2504e4: field pattern_color: %w", err)
|
||||
}
|
||||
s.PatternColor = value
|
||||
}
|
||||
{
|
||||
value, err := b.Int()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode starGiftAttributeBackdrop#d93d859c: field text_color: %w", err)
|
||||
return fmt.Errorf("unable to decode starGiftAttributeBackdrop#9f2504e4: field text_color: %w", err)
|
||||
}
|
||||
s.TextColor = value
|
||||
}
|
||||
{
|
||||
value, err := b.Int()
|
||||
value, err := DecodeStarGiftAttributeRarity(b)
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode starGiftAttributeBackdrop#d93d859c: field rarity_permille: %w", err)
|
||||
return fmt.Errorf("unable to decode starGiftAttributeBackdrop#9f2504e4: field rarity: %w", err)
|
||||
}
|
||||
s.RarityPermille = value
|
||||
s.Rarity = value
|
||||
}
|
||||
return nil
|
||||
}
|
||||
@@ -725,12 +793,12 @@ func (s *StarGiftAttributeBackdrop) GetTextColor() (value int) {
|
||||
return s.TextColor
|
||||
}
|
||||
|
||||
// GetRarityPermille returns value of RarityPermille field.
|
||||
func (s *StarGiftAttributeBackdrop) GetRarityPermille() (value int) {
|
||||
// GetRarity returns value of Rarity field.
|
||||
func (s *StarGiftAttributeBackdrop) GetRarity() (value StarGiftAttributeRarityClass) {
|
||||
if s == nil {
|
||||
return
|
||||
}
|
||||
return s.RarityPermille
|
||||
return s.Rarity
|
||||
}
|
||||
|
||||
// StarGiftAttributeOriginalDetails represents TL type `starGiftAttributeOriginalDetails#e0bff26c`.
|
||||
@@ -1041,9 +1109,9 @@ const StarGiftAttributeClassName = "StarGiftAttribute"
|
||||
// panic(err)
|
||||
// }
|
||||
// switch v := g.(type) {
|
||||
// case *tg.StarGiftAttributeModel: // starGiftAttributeModel#39d99013
|
||||
// case *tg.StarGiftAttributePattern: // starGiftAttributePattern#13acff19
|
||||
// case *tg.StarGiftAttributeBackdrop: // starGiftAttributeBackdrop#d93d859c
|
||||
// case *tg.StarGiftAttributeModel: // starGiftAttributeModel#565251e2
|
||||
// case *tg.StarGiftAttributePattern: // starGiftAttributePattern#4e7085ea
|
||||
// case *tg.StarGiftAttributeBackdrop: // starGiftAttributeBackdrop#9f2504e4
|
||||
// case *tg.StarGiftAttributeOriginalDetails: // starGiftAttributeOriginalDetails#e0bff26c
|
||||
// default: panic(v)
|
||||
// }
|
||||
@@ -1074,21 +1142,21 @@ func DecodeStarGiftAttribute(buf *bin.Buffer) (StarGiftAttributeClass, error) {
|
||||
}
|
||||
switch id {
|
||||
case StarGiftAttributeModelTypeID:
|
||||
// Decoding starGiftAttributeModel#39d99013.
|
||||
// Decoding starGiftAttributeModel#565251e2.
|
||||
v := StarGiftAttributeModel{}
|
||||
if err := v.Decode(buf); err != nil {
|
||||
return nil, fmt.Errorf("unable to decode StarGiftAttributeClass: %w", err)
|
||||
}
|
||||
return &v, nil
|
||||
case StarGiftAttributePatternTypeID:
|
||||
// Decoding starGiftAttributePattern#13acff19.
|
||||
// Decoding starGiftAttributePattern#4e7085ea.
|
||||
v := StarGiftAttributePattern{}
|
||||
if err := v.Decode(buf); err != nil {
|
||||
return nil, fmt.Errorf("unable to decode StarGiftAttributeClass: %w", err)
|
||||
}
|
||||
return &v, nil
|
||||
case StarGiftAttributeBackdropTypeID:
|
||||
// Decoding starGiftAttributeBackdrop#d93d859c.
|
||||
// Decoding starGiftAttributeBackdrop#9f2504e4.
|
||||
v := StarGiftAttributeBackdrop{}
|
||||
if err := v.Decode(buf); err != nil {
|
||||
return nil, fmt.Errorf("unable to decode StarGiftAttributeClass: %w", err)
|
||||
|
||||
+683
@@ -0,0 +1,683 @@
|
||||
// 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{}
|
||||
)
|
||||
|
||||
// StarGiftAttributeRarity represents TL type `starGiftAttributeRarity#36437737`.
|
||||
//
|
||||
// See https://core.telegram.org/constructor/starGiftAttributeRarity for reference.
|
||||
type StarGiftAttributeRarity struct {
|
||||
// Permille field of StarGiftAttributeRarity.
|
||||
Permille int
|
||||
}
|
||||
|
||||
// StarGiftAttributeRarityTypeID is TL type id of StarGiftAttributeRarity.
|
||||
const StarGiftAttributeRarityTypeID = 0x36437737
|
||||
|
||||
// construct implements constructor of StarGiftAttributeRarityClass.
|
||||
func (s StarGiftAttributeRarity) construct() StarGiftAttributeRarityClass { return &s }
|
||||
|
||||
// Ensuring interfaces in compile-time for StarGiftAttributeRarity.
|
||||
var (
|
||||
_ bin.Encoder = &StarGiftAttributeRarity{}
|
||||
_ bin.Decoder = &StarGiftAttributeRarity{}
|
||||
_ bin.BareEncoder = &StarGiftAttributeRarity{}
|
||||
_ bin.BareDecoder = &StarGiftAttributeRarity{}
|
||||
|
||||
_ StarGiftAttributeRarityClass = &StarGiftAttributeRarity{}
|
||||
)
|
||||
|
||||
func (s *StarGiftAttributeRarity) Zero() bool {
|
||||
if s == nil {
|
||||
return true
|
||||
}
|
||||
if !(s.Permille == 0) {
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
// String implements fmt.Stringer.
|
||||
func (s *StarGiftAttributeRarity) String() string {
|
||||
if s == nil {
|
||||
return "StarGiftAttributeRarity(nil)"
|
||||
}
|
||||
type Alias StarGiftAttributeRarity
|
||||
return fmt.Sprintf("StarGiftAttributeRarity%+v", Alias(*s))
|
||||
}
|
||||
|
||||
// FillFrom fills StarGiftAttributeRarity from given interface.
|
||||
func (s *StarGiftAttributeRarity) FillFrom(from interface {
|
||||
GetPermille() (value int)
|
||||
}) {
|
||||
s.Permille = from.GetPermille()
|
||||
}
|
||||
|
||||
// TypeID returns type id in TL schema.
|
||||
//
|
||||
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
||||
func (*StarGiftAttributeRarity) TypeID() uint32 {
|
||||
return StarGiftAttributeRarityTypeID
|
||||
}
|
||||
|
||||
// TypeName returns name of type in TL schema.
|
||||
func (*StarGiftAttributeRarity) TypeName() string {
|
||||
return "starGiftAttributeRarity"
|
||||
}
|
||||
|
||||
// TypeInfo returns info about TL type.
|
||||
func (s *StarGiftAttributeRarity) TypeInfo() tdp.Type {
|
||||
typ := tdp.Type{
|
||||
Name: "starGiftAttributeRarity",
|
||||
ID: StarGiftAttributeRarityTypeID,
|
||||
}
|
||||
if s == nil {
|
||||
typ.Null = true
|
||||
return typ
|
||||
}
|
||||
typ.Fields = []tdp.Field{
|
||||
{
|
||||
Name: "Permille",
|
||||
SchemaName: "permille",
|
||||
},
|
||||
}
|
||||
return typ
|
||||
}
|
||||
|
||||
// Encode implements bin.Encoder.
|
||||
func (s *StarGiftAttributeRarity) Encode(b *bin.Buffer) error {
|
||||
if s == nil {
|
||||
return fmt.Errorf("can't encode starGiftAttributeRarity#36437737 as nil")
|
||||
}
|
||||
b.PutID(StarGiftAttributeRarityTypeID)
|
||||
return s.EncodeBare(b)
|
||||
}
|
||||
|
||||
// EncodeBare implements bin.BareEncoder.
|
||||
func (s *StarGiftAttributeRarity) EncodeBare(b *bin.Buffer) error {
|
||||
if s == nil {
|
||||
return fmt.Errorf("can't encode starGiftAttributeRarity#36437737 as nil")
|
||||
}
|
||||
b.PutInt(s.Permille)
|
||||
return nil
|
||||
}
|
||||
|
||||
// Decode implements bin.Decoder.
|
||||
func (s *StarGiftAttributeRarity) Decode(b *bin.Buffer) error {
|
||||
if s == nil {
|
||||
return fmt.Errorf("can't decode starGiftAttributeRarity#36437737 to nil")
|
||||
}
|
||||
if err := b.ConsumeID(StarGiftAttributeRarityTypeID); err != nil {
|
||||
return fmt.Errorf("unable to decode starGiftAttributeRarity#36437737: %w", err)
|
||||
}
|
||||
return s.DecodeBare(b)
|
||||
}
|
||||
|
||||
// DecodeBare implements bin.BareDecoder.
|
||||
func (s *StarGiftAttributeRarity) DecodeBare(b *bin.Buffer) error {
|
||||
if s == nil {
|
||||
return fmt.Errorf("can't decode starGiftAttributeRarity#36437737 to nil")
|
||||
}
|
||||
{
|
||||
value, err := b.Int()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode starGiftAttributeRarity#36437737: field permille: %w", err)
|
||||
}
|
||||
s.Permille = value
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// GetPermille returns value of Permille field.
|
||||
func (s *StarGiftAttributeRarity) GetPermille() (value int) {
|
||||
if s == nil {
|
||||
return
|
||||
}
|
||||
return s.Permille
|
||||
}
|
||||
|
||||
// StarGiftAttributeRarityUncommon represents TL type `starGiftAttributeRarityUncommon#dbce6389`.
|
||||
//
|
||||
// See https://core.telegram.org/constructor/starGiftAttributeRarityUncommon for reference.
|
||||
type StarGiftAttributeRarityUncommon struct {
|
||||
}
|
||||
|
||||
// StarGiftAttributeRarityUncommonTypeID is TL type id of StarGiftAttributeRarityUncommon.
|
||||
const StarGiftAttributeRarityUncommonTypeID = 0xdbce6389
|
||||
|
||||
// construct implements constructor of StarGiftAttributeRarityClass.
|
||||
func (s StarGiftAttributeRarityUncommon) construct() StarGiftAttributeRarityClass { return &s }
|
||||
|
||||
// Ensuring interfaces in compile-time for StarGiftAttributeRarityUncommon.
|
||||
var (
|
||||
_ bin.Encoder = &StarGiftAttributeRarityUncommon{}
|
||||
_ bin.Decoder = &StarGiftAttributeRarityUncommon{}
|
||||
_ bin.BareEncoder = &StarGiftAttributeRarityUncommon{}
|
||||
_ bin.BareDecoder = &StarGiftAttributeRarityUncommon{}
|
||||
|
||||
_ StarGiftAttributeRarityClass = &StarGiftAttributeRarityUncommon{}
|
||||
)
|
||||
|
||||
func (s *StarGiftAttributeRarityUncommon) Zero() bool {
|
||||
if s == nil {
|
||||
return true
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
// String implements fmt.Stringer.
|
||||
func (s *StarGiftAttributeRarityUncommon) String() string {
|
||||
if s == nil {
|
||||
return "StarGiftAttributeRarityUncommon(nil)"
|
||||
}
|
||||
type Alias StarGiftAttributeRarityUncommon
|
||||
return fmt.Sprintf("StarGiftAttributeRarityUncommon%+v", Alias(*s))
|
||||
}
|
||||
|
||||
// TypeID returns type id in TL schema.
|
||||
//
|
||||
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
||||
func (*StarGiftAttributeRarityUncommon) TypeID() uint32 {
|
||||
return StarGiftAttributeRarityUncommonTypeID
|
||||
}
|
||||
|
||||
// TypeName returns name of type in TL schema.
|
||||
func (*StarGiftAttributeRarityUncommon) TypeName() string {
|
||||
return "starGiftAttributeRarityUncommon"
|
||||
}
|
||||
|
||||
// TypeInfo returns info about TL type.
|
||||
func (s *StarGiftAttributeRarityUncommon) TypeInfo() tdp.Type {
|
||||
typ := tdp.Type{
|
||||
Name: "starGiftAttributeRarityUncommon",
|
||||
ID: StarGiftAttributeRarityUncommonTypeID,
|
||||
}
|
||||
if s == nil {
|
||||
typ.Null = true
|
||||
return typ
|
||||
}
|
||||
typ.Fields = []tdp.Field{}
|
||||
return typ
|
||||
}
|
||||
|
||||
// Encode implements bin.Encoder.
|
||||
func (s *StarGiftAttributeRarityUncommon) Encode(b *bin.Buffer) error {
|
||||
if s == nil {
|
||||
return fmt.Errorf("can't encode starGiftAttributeRarityUncommon#dbce6389 as nil")
|
||||
}
|
||||
b.PutID(StarGiftAttributeRarityUncommonTypeID)
|
||||
return s.EncodeBare(b)
|
||||
}
|
||||
|
||||
// EncodeBare implements bin.BareEncoder.
|
||||
func (s *StarGiftAttributeRarityUncommon) EncodeBare(b *bin.Buffer) error {
|
||||
if s == nil {
|
||||
return fmt.Errorf("can't encode starGiftAttributeRarityUncommon#dbce6389 as nil")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Decode implements bin.Decoder.
|
||||
func (s *StarGiftAttributeRarityUncommon) Decode(b *bin.Buffer) error {
|
||||
if s == nil {
|
||||
return fmt.Errorf("can't decode starGiftAttributeRarityUncommon#dbce6389 to nil")
|
||||
}
|
||||
if err := b.ConsumeID(StarGiftAttributeRarityUncommonTypeID); err != nil {
|
||||
return fmt.Errorf("unable to decode starGiftAttributeRarityUncommon#dbce6389: %w", err)
|
||||
}
|
||||
return s.DecodeBare(b)
|
||||
}
|
||||
|
||||
// DecodeBare implements bin.BareDecoder.
|
||||
func (s *StarGiftAttributeRarityUncommon) DecodeBare(b *bin.Buffer) error {
|
||||
if s == nil {
|
||||
return fmt.Errorf("can't decode starGiftAttributeRarityUncommon#dbce6389 to nil")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// StarGiftAttributeRarityRare represents TL type `starGiftAttributeRarityRare#f08d516b`.
|
||||
//
|
||||
// See https://core.telegram.org/constructor/starGiftAttributeRarityRare for reference.
|
||||
type StarGiftAttributeRarityRare struct {
|
||||
}
|
||||
|
||||
// StarGiftAttributeRarityRareTypeID is TL type id of StarGiftAttributeRarityRare.
|
||||
const StarGiftAttributeRarityRareTypeID = 0xf08d516b
|
||||
|
||||
// construct implements constructor of StarGiftAttributeRarityClass.
|
||||
func (s StarGiftAttributeRarityRare) construct() StarGiftAttributeRarityClass { return &s }
|
||||
|
||||
// Ensuring interfaces in compile-time for StarGiftAttributeRarityRare.
|
||||
var (
|
||||
_ bin.Encoder = &StarGiftAttributeRarityRare{}
|
||||
_ bin.Decoder = &StarGiftAttributeRarityRare{}
|
||||
_ bin.BareEncoder = &StarGiftAttributeRarityRare{}
|
||||
_ bin.BareDecoder = &StarGiftAttributeRarityRare{}
|
||||
|
||||
_ StarGiftAttributeRarityClass = &StarGiftAttributeRarityRare{}
|
||||
)
|
||||
|
||||
func (s *StarGiftAttributeRarityRare) Zero() bool {
|
||||
if s == nil {
|
||||
return true
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
// String implements fmt.Stringer.
|
||||
func (s *StarGiftAttributeRarityRare) String() string {
|
||||
if s == nil {
|
||||
return "StarGiftAttributeRarityRare(nil)"
|
||||
}
|
||||
type Alias StarGiftAttributeRarityRare
|
||||
return fmt.Sprintf("StarGiftAttributeRarityRare%+v", Alias(*s))
|
||||
}
|
||||
|
||||
// TypeID returns type id in TL schema.
|
||||
//
|
||||
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
||||
func (*StarGiftAttributeRarityRare) TypeID() uint32 {
|
||||
return StarGiftAttributeRarityRareTypeID
|
||||
}
|
||||
|
||||
// TypeName returns name of type in TL schema.
|
||||
func (*StarGiftAttributeRarityRare) TypeName() string {
|
||||
return "starGiftAttributeRarityRare"
|
||||
}
|
||||
|
||||
// TypeInfo returns info about TL type.
|
||||
func (s *StarGiftAttributeRarityRare) TypeInfo() tdp.Type {
|
||||
typ := tdp.Type{
|
||||
Name: "starGiftAttributeRarityRare",
|
||||
ID: StarGiftAttributeRarityRareTypeID,
|
||||
}
|
||||
if s == nil {
|
||||
typ.Null = true
|
||||
return typ
|
||||
}
|
||||
typ.Fields = []tdp.Field{}
|
||||
return typ
|
||||
}
|
||||
|
||||
// Encode implements bin.Encoder.
|
||||
func (s *StarGiftAttributeRarityRare) Encode(b *bin.Buffer) error {
|
||||
if s == nil {
|
||||
return fmt.Errorf("can't encode starGiftAttributeRarityRare#f08d516b as nil")
|
||||
}
|
||||
b.PutID(StarGiftAttributeRarityRareTypeID)
|
||||
return s.EncodeBare(b)
|
||||
}
|
||||
|
||||
// EncodeBare implements bin.BareEncoder.
|
||||
func (s *StarGiftAttributeRarityRare) EncodeBare(b *bin.Buffer) error {
|
||||
if s == nil {
|
||||
return fmt.Errorf("can't encode starGiftAttributeRarityRare#f08d516b as nil")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Decode implements bin.Decoder.
|
||||
func (s *StarGiftAttributeRarityRare) Decode(b *bin.Buffer) error {
|
||||
if s == nil {
|
||||
return fmt.Errorf("can't decode starGiftAttributeRarityRare#f08d516b to nil")
|
||||
}
|
||||
if err := b.ConsumeID(StarGiftAttributeRarityRareTypeID); err != nil {
|
||||
return fmt.Errorf("unable to decode starGiftAttributeRarityRare#f08d516b: %w", err)
|
||||
}
|
||||
return s.DecodeBare(b)
|
||||
}
|
||||
|
||||
// DecodeBare implements bin.BareDecoder.
|
||||
func (s *StarGiftAttributeRarityRare) DecodeBare(b *bin.Buffer) error {
|
||||
if s == nil {
|
||||
return fmt.Errorf("can't decode starGiftAttributeRarityRare#f08d516b to nil")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// StarGiftAttributeRarityEpic represents TL type `starGiftAttributeRarityEpic#78fbf3a8`.
|
||||
//
|
||||
// See https://core.telegram.org/constructor/starGiftAttributeRarityEpic for reference.
|
||||
type StarGiftAttributeRarityEpic struct {
|
||||
}
|
||||
|
||||
// StarGiftAttributeRarityEpicTypeID is TL type id of StarGiftAttributeRarityEpic.
|
||||
const StarGiftAttributeRarityEpicTypeID = 0x78fbf3a8
|
||||
|
||||
// construct implements constructor of StarGiftAttributeRarityClass.
|
||||
func (s StarGiftAttributeRarityEpic) construct() StarGiftAttributeRarityClass { return &s }
|
||||
|
||||
// Ensuring interfaces in compile-time for StarGiftAttributeRarityEpic.
|
||||
var (
|
||||
_ bin.Encoder = &StarGiftAttributeRarityEpic{}
|
||||
_ bin.Decoder = &StarGiftAttributeRarityEpic{}
|
||||
_ bin.BareEncoder = &StarGiftAttributeRarityEpic{}
|
||||
_ bin.BareDecoder = &StarGiftAttributeRarityEpic{}
|
||||
|
||||
_ StarGiftAttributeRarityClass = &StarGiftAttributeRarityEpic{}
|
||||
)
|
||||
|
||||
func (s *StarGiftAttributeRarityEpic) Zero() bool {
|
||||
if s == nil {
|
||||
return true
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
// String implements fmt.Stringer.
|
||||
func (s *StarGiftAttributeRarityEpic) String() string {
|
||||
if s == nil {
|
||||
return "StarGiftAttributeRarityEpic(nil)"
|
||||
}
|
||||
type Alias StarGiftAttributeRarityEpic
|
||||
return fmt.Sprintf("StarGiftAttributeRarityEpic%+v", Alias(*s))
|
||||
}
|
||||
|
||||
// TypeID returns type id in TL schema.
|
||||
//
|
||||
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
||||
func (*StarGiftAttributeRarityEpic) TypeID() uint32 {
|
||||
return StarGiftAttributeRarityEpicTypeID
|
||||
}
|
||||
|
||||
// TypeName returns name of type in TL schema.
|
||||
func (*StarGiftAttributeRarityEpic) TypeName() string {
|
||||
return "starGiftAttributeRarityEpic"
|
||||
}
|
||||
|
||||
// TypeInfo returns info about TL type.
|
||||
func (s *StarGiftAttributeRarityEpic) TypeInfo() tdp.Type {
|
||||
typ := tdp.Type{
|
||||
Name: "starGiftAttributeRarityEpic",
|
||||
ID: StarGiftAttributeRarityEpicTypeID,
|
||||
}
|
||||
if s == nil {
|
||||
typ.Null = true
|
||||
return typ
|
||||
}
|
||||
typ.Fields = []tdp.Field{}
|
||||
return typ
|
||||
}
|
||||
|
||||
// Encode implements bin.Encoder.
|
||||
func (s *StarGiftAttributeRarityEpic) Encode(b *bin.Buffer) error {
|
||||
if s == nil {
|
||||
return fmt.Errorf("can't encode starGiftAttributeRarityEpic#78fbf3a8 as nil")
|
||||
}
|
||||
b.PutID(StarGiftAttributeRarityEpicTypeID)
|
||||
return s.EncodeBare(b)
|
||||
}
|
||||
|
||||
// EncodeBare implements bin.BareEncoder.
|
||||
func (s *StarGiftAttributeRarityEpic) EncodeBare(b *bin.Buffer) error {
|
||||
if s == nil {
|
||||
return fmt.Errorf("can't encode starGiftAttributeRarityEpic#78fbf3a8 as nil")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Decode implements bin.Decoder.
|
||||
func (s *StarGiftAttributeRarityEpic) Decode(b *bin.Buffer) error {
|
||||
if s == nil {
|
||||
return fmt.Errorf("can't decode starGiftAttributeRarityEpic#78fbf3a8 to nil")
|
||||
}
|
||||
if err := b.ConsumeID(StarGiftAttributeRarityEpicTypeID); err != nil {
|
||||
return fmt.Errorf("unable to decode starGiftAttributeRarityEpic#78fbf3a8: %w", err)
|
||||
}
|
||||
return s.DecodeBare(b)
|
||||
}
|
||||
|
||||
// DecodeBare implements bin.BareDecoder.
|
||||
func (s *StarGiftAttributeRarityEpic) DecodeBare(b *bin.Buffer) error {
|
||||
if s == nil {
|
||||
return fmt.Errorf("can't decode starGiftAttributeRarityEpic#78fbf3a8 to nil")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// StarGiftAttributeRarityLegendary represents TL type `starGiftAttributeRarityLegendary#cef7e7a8`.
|
||||
//
|
||||
// See https://core.telegram.org/constructor/starGiftAttributeRarityLegendary for reference.
|
||||
type StarGiftAttributeRarityLegendary struct {
|
||||
}
|
||||
|
||||
// StarGiftAttributeRarityLegendaryTypeID is TL type id of StarGiftAttributeRarityLegendary.
|
||||
const StarGiftAttributeRarityLegendaryTypeID = 0xcef7e7a8
|
||||
|
||||
// construct implements constructor of StarGiftAttributeRarityClass.
|
||||
func (s StarGiftAttributeRarityLegendary) construct() StarGiftAttributeRarityClass { return &s }
|
||||
|
||||
// Ensuring interfaces in compile-time for StarGiftAttributeRarityLegendary.
|
||||
var (
|
||||
_ bin.Encoder = &StarGiftAttributeRarityLegendary{}
|
||||
_ bin.Decoder = &StarGiftAttributeRarityLegendary{}
|
||||
_ bin.BareEncoder = &StarGiftAttributeRarityLegendary{}
|
||||
_ bin.BareDecoder = &StarGiftAttributeRarityLegendary{}
|
||||
|
||||
_ StarGiftAttributeRarityClass = &StarGiftAttributeRarityLegendary{}
|
||||
)
|
||||
|
||||
func (s *StarGiftAttributeRarityLegendary) Zero() bool {
|
||||
if s == nil {
|
||||
return true
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
// String implements fmt.Stringer.
|
||||
func (s *StarGiftAttributeRarityLegendary) String() string {
|
||||
if s == nil {
|
||||
return "StarGiftAttributeRarityLegendary(nil)"
|
||||
}
|
||||
type Alias StarGiftAttributeRarityLegendary
|
||||
return fmt.Sprintf("StarGiftAttributeRarityLegendary%+v", Alias(*s))
|
||||
}
|
||||
|
||||
// TypeID returns type id in TL schema.
|
||||
//
|
||||
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
||||
func (*StarGiftAttributeRarityLegendary) TypeID() uint32 {
|
||||
return StarGiftAttributeRarityLegendaryTypeID
|
||||
}
|
||||
|
||||
// TypeName returns name of type in TL schema.
|
||||
func (*StarGiftAttributeRarityLegendary) TypeName() string {
|
||||
return "starGiftAttributeRarityLegendary"
|
||||
}
|
||||
|
||||
// TypeInfo returns info about TL type.
|
||||
func (s *StarGiftAttributeRarityLegendary) TypeInfo() tdp.Type {
|
||||
typ := tdp.Type{
|
||||
Name: "starGiftAttributeRarityLegendary",
|
||||
ID: StarGiftAttributeRarityLegendaryTypeID,
|
||||
}
|
||||
if s == nil {
|
||||
typ.Null = true
|
||||
return typ
|
||||
}
|
||||
typ.Fields = []tdp.Field{}
|
||||
return typ
|
||||
}
|
||||
|
||||
// Encode implements bin.Encoder.
|
||||
func (s *StarGiftAttributeRarityLegendary) Encode(b *bin.Buffer) error {
|
||||
if s == nil {
|
||||
return fmt.Errorf("can't encode starGiftAttributeRarityLegendary#cef7e7a8 as nil")
|
||||
}
|
||||
b.PutID(StarGiftAttributeRarityLegendaryTypeID)
|
||||
return s.EncodeBare(b)
|
||||
}
|
||||
|
||||
// EncodeBare implements bin.BareEncoder.
|
||||
func (s *StarGiftAttributeRarityLegendary) EncodeBare(b *bin.Buffer) error {
|
||||
if s == nil {
|
||||
return fmt.Errorf("can't encode starGiftAttributeRarityLegendary#cef7e7a8 as nil")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Decode implements bin.Decoder.
|
||||
func (s *StarGiftAttributeRarityLegendary) Decode(b *bin.Buffer) error {
|
||||
if s == nil {
|
||||
return fmt.Errorf("can't decode starGiftAttributeRarityLegendary#cef7e7a8 to nil")
|
||||
}
|
||||
if err := b.ConsumeID(StarGiftAttributeRarityLegendaryTypeID); err != nil {
|
||||
return fmt.Errorf("unable to decode starGiftAttributeRarityLegendary#cef7e7a8: %w", err)
|
||||
}
|
||||
return s.DecodeBare(b)
|
||||
}
|
||||
|
||||
// DecodeBare implements bin.BareDecoder.
|
||||
func (s *StarGiftAttributeRarityLegendary) DecodeBare(b *bin.Buffer) error {
|
||||
if s == nil {
|
||||
return fmt.Errorf("can't decode starGiftAttributeRarityLegendary#cef7e7a8 to nil")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// StarGiftAttributeRarityClassName is schema name of StarGiftAttributeRarityClass.
|
||||
const StarGiftAttributeRarityClassName = "StarGiftAttributeRarity"
|
||||
|
||||
// StarGiftAttributeRarityClass represents StarGiftAttributeRarity generic type.
|
||||
//
|
||||
// See https://core.telegram.org/type/StarGiftAttributeRarity for reference.
|
||||
//
|
||||
// Example:
|
||||
//
|
||||
// g, err := tg.DecodeStarGiftAttributeRarity(buf)
|
||||
// if err != nil {
|
||||
// panic(err)
|
||||
// }
|
||||
// switch v := g.(type) {
|
||||
// case *tg.StarGiftAttributeRarity: // starGiftAttributeRarity#36437737
|
||||
// case *tg.StarGiftAttributeRarityUncommon: // starGiftAttributeRarityUncommon#dbce6389
|
||||
// case *tg.StarGiftAttributeRarityRare: // starGiftAttributeRarityRare#f08d516b
|
||||
// case *tg.StarGiftAttributeRarityEpic: // starGiftAttributeRarityEpic#78fbf3a8
|
||||
// case *tg.StarGiftAttributeRarityLegendary: // starGiftAttributeRarityLegendary#cef7e7a8
|
||||
// default: panic(v)
|
||||
// }
|
||||
type StarGiftAttributeRarityClass interface {
|
||||
bin.Encoder
|
||||
bin.Decoder
|
||||
bin.BareEncoder
|
||||
bin.BareDecoder
|
||||
construct() StarGiftAttributeRarityClass
|
||||
|
||||
// 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
|
||||
}
|
||||
|
||||
// DecodeStarGiftAttributeRarity implements binary de-serialization for StarGiftAttributeRarityClass.
|
||||
func DecodeStarGiftAttributeRarity(buf *bin.Buffer) (StarGiftAttributeRarityClass, error) {
|
||||
id, err := buf.PeekID()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
switch id {
|
||||
case StarGiftAttributeRarityTypeID:
|
||||
// Decoding starGiftAttributeRarity#36437737.
|
||||
v := StarGiftAttributeRarity{}
|
||||
if err := v.Decode(buf); err != nil {
|
||||
return nil, fmt.Errorf("unable to decode StarGiftAttributeRarityClass: %w", err)
|
||||
}
|
||||
return &v, nil
|
||||
case StarGiftAttributeRarityUncommonTypeID:
|
||||
// Decoding starGiftAttributeRarityUncommon#dbce6389.
|
||||
v := StarGiftAttributeRarityUncommon{}
|
||||
if err := v.Decode(buf); err != nil {
|
||||
return nil, fmt.Errorf("unable to decode StarGiftAttributeRarityClass: %w", err)
|
||||
}
|
||||
return &v, nil
|
||||
case StarGiftAttributeRarityRareTypeID:
|
||||
// Decoding starGiftAttributeRarityRare#f08d516b.
|
||||
v := StarGiftAttributeRarityRare{}
|
||||
if err := v.Decode(buf); err != nil {
|
||||
return nil, fmt.Errorf("unable to decode StarGiftAttributeRarityClass: %w", err)
|
||||
}
|
||||
return &v, nil
|
||||
case StarGiftAttributeRarityEpicTypeID:
|
||||
// Decoding starGiftAttributeRarityEpic#78fbf3a8.
|
||||
v := StarGiftAttributeRarityEpic{}
|
||||
if err := v.Decode(buf); err != nil {
|
||||
return nil, fmt.Errorf("unable to decode StarGiftAttributeRarityClass: %w", err)
|
||||
}
|
||||
return &v, nil
|
||||
case StarGiftAttributeRarityLegendaryTypeID:
|
||||
// Decoding starGiftAttributeRarityLegendary#cef7e7a8.
|
||||
v := StarGiftAttributeRarityLegendary{}
|
||||
if err := v.Decode(buf); err != nil {
|
||||
return nil, fmt.Errorf("unable to decode StarGiftAttributeRarityClass: %w", err)
|
||||
}
|
||||
return &v, nil
|
||||
default:
|
||||
return nil, fmt.Errorf("unable to decode StarGiftAttributeRarityClass: %w", bin.NewUnexpectedID(id))
|
||||
}
|
||||
}
|
||||
|
||||
// StarGiftAttributeRarity boxes the StarGiftAttributeRarityClass providing a helper.
|
||||
type StarGiftAttributeRarityBox struct {
|
||||
StarGiftAttributeRarity StarGiftAttributeRarityClass
|
||||
}
|
||||
|
||||
// Decode implements bin.Decoder for StarGiftAttributeRarityBox.
|
||||
func (b *StarGiftAttributeRarityBox) Decode(buf *bin.Buffer) error {
|
||||
if b == nil {
|
||||
return fmt.Errorf("unable to decode StarGiftAttributeRarityBox to nil")
|
||||
}
|
||||
v, err := DecodeStarGiftAttributeRarity(buf)
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode boxed value: %w", err)
|
||||
}
|
||||
b.StarGiftAttributeRarity = v
|
||||
return nil
|
||||
}
|
||||
|
||||
// Encode implements bin.Encode for StarGiftAttributeRarityBox.
|
||||
func (b *StarGiftAttributeRarityBox) Encode(buf *bin.Buffer) error {
|
||||
if b == nil || b.StarGiftAttributeRarity == nil {
|
||||
return fmt.Errorf("unable to encode StarGiftAttributeRarityClass as nil")
|
||||
}
|
||||
return b.StarGiftAttributeRarity.Encode(buf)
|
||||
}
|
||||
+212
@@ -0,0 +1,212 @@
|
||||
//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{}
|
||||
)
|
||||
|
||||
// StarGiftAttributeRarityClassArray is adapter for slice of StarGiftAttributeRarityClass.
|
||||
type StarGiftAttributeRarityClassArray []StarGiftAttributeRarityClass
|
||||
|
||||
// Sort sorts slice of StarGiftAttributeRarityClass.
|
||||
func (s StarGiftAttributeRarityClassArray) Sort(less func(a, b StarGiftAttributeRarityClass) bool) StarGiftAttributeRarityClassArray {
|
||||
sort.Slice(s, func(i, j int) bool {
|
||||
return less(s[i], s[j])
|
||||
})
|
||||
return s
|
||||
}
|
||||
|
||||
// SortStable sorts slice of StarGiftAttributeRarityClass.
|
||||
func (s StarGiftAttributeRarityClassArray) SortStable(less func(a, b StarGiftAttributeRarityClass) bool) StarGiftAttributeRarityClassArray {
|
||||
sort.SliceStable(s, func(i, j int) bool {
|
||||
return less(s[i], s[j])
|
||||
})
|
||||
return s
|
||||
}
|
||||
|
||||
// Retain filters in-place slice of StarGiftAttributeRarityClass.
|
||||
func (s StarGiftAttributeRarityClassArray) Retain(keep func(x StarGiftAttributeRarityClass) bool) StarGiftAttributeRarityClassArray {
|
||||
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 StarGiftAttributeRarityClassArray) First() (v StarGiftAttributeRarityClass, ok bool) {
|
||||
if len(s) < 1 {
|
||||
return
|
||||
}
|
||||
return s[0], true
|
||||
}
|
||||
|
||||
// Last returns last element of slice (if exists).
|
||||
func (s StarGiftAttributeRarityClassArray) Last() (v StarGiftAttributeRarityClass, 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 *StarGiftAttributeRarityClassArray) PopFirst() (v StarGiftAttributeRarityClass, 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 StarGiftAttributeRarityClass
|
||||
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 *StarGiftAttributeRarityClassArray) Pop() (v StarGiftAttributeRarityClass, 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
|
||||
}
|
||||
|
||||
// AsStarGiftAttributeRarity returns copy with only StarGiftAttributeRarity constructors.
|
||||
func (s StarGiftAttributeRarityClassArray) AsStarGiftAttributeRarity() (to StarGiftAttributeRarityArray) {
|
||||
for _, elem := range s {
|
||||
value, ok := elem.(*StarGiftAttributeRarity)
|
||||
if !ok {
|
||||
continue
|
||||
}
|
||||
to = append(to, *value)
|
||||
}
|
||||
|
||||
return to
|
||||
}
|
||||
|
||||
// StarGiftAttributeRarityArray is adapter for slice of StarGiftAttributeRarity.
|
||||
type StarGiftAttributeRarityArray []StarGiftAttributeRarity
|
||||
|
||||
// Sort sorts slice of StarGiftAttributeRarity.
|
||||
func (s StarGiftAttributeRarityArray) Sort(less func(a, b StarGiftAttributeRarity) bool) StarGiftAttributeRarityArray {
|
||||
sort.Slice(s, func(i, j int) bool {
|
||||
return less(s[i], s[j])
|
||||
})
|
||||
return s
|
||||
}
|
||||
|
||||
// SortStable sorts slice of StarGiftAttributeRarity.
|
||||
func (s StarGiftAttributeRarityArray) SortStable(less func(a, b StarGiftAttributeRarity) bool) StarGiftAttributeRarityArray {
|
||||
sort.SliceStable(s, func(i, j int) bool {
|
||||
return less(s[i], s[j])
|
||||
})
|
||||
return s
|
||||
}
|
||||
|
||||
// Retain filters in-place slice of StarGiftAttributeRarity.
|
||||
func (s StarGiftAttributeRarityArray) Retain(keep func(x StarGiftAttributeRarity) bool) StarGiftAttributeRarityArray {
|
||||
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 StarGiftAttributeRarityArray) First() (v StarGiftAttributeRarity, ok bool) {
|
||||
if len(s) < 1 {
|
||||
return
|
||||
}
|
||||
return s[0], true
|
||||
}
|
||||
|
||||
// Last returns last element of slice (if exists).
|
||||
func (s StarGiftAttributeRarityArray) Last() (v StarGiftAttributeRarity, 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 *StarGiftAttributeRarityArray) PopFirst() (v StarGiftAttributeRarity, 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 StarGiftAttributeRarity
|
||||
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 *StarGiftAttributeRarityArray) Pop() (v StarGiftAttributeRarity, 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
|
||||
}
|
||||
+66
-18
@@ -31,7 +31,7 @@ var (
|
||||
_ = tdjson.Encoder{}
|
||||
)
|
||||
|
||||
// StarGiftAuctionAcquiredGift represents TL type `starGiftAuctionAcquiredGift#ab60e20b`.
|
||||
// StarGiftAuctionAcquiredGift represents TL type `starGiftAuctionAcquiredGift#42b00348`.
|
||||
//
|
||||
// See https://core.telegram.org/constructor/starGiftAuctionAcquiredGift for reference.
|
||||
type StarGiftAuctionAcquiredGift struct {
|
||||
@@ -53,10 +53,14 @@ type StarGiftAuctionAcquiredGift struct {
|
||||
//
|
||||
// Use SetMessage and GetMessage helpers.
|
||||
Message TextWithEntities
|
||||
// GiftNum field of StarGiftAuctionAcquiredGift.
|
||||
//
|
||||
// Use SetGiftNum and GetGiftNum helpers.
|
||||
GiftNum int
|
||||
}
|
||||
|
||||
// StarGiftAuctionAcquiredGiftTypeID is TL type id of StarGiftAuctionAcquiredGift.
|
||||
const StarGiftAuctionAcquiredGiftTypeID = 0xab60e20b
|
||||
const StarGiftAuctionAcquiredGiftTypeID = 0x42b00348
|
||||
|
||||
// Ensuring interfaces in compile-time for StarGiftAuctionAcquiredGift.
|
||||
var (
|
||||
@@ -94,6 +98,9 @@ func (s *StarGiftAuctionAcquiredGift) Zero() bool {
|
||||
if !(s.Message.Zero()) {
|
||||
return false
|
||||
}
|
||||
if !(s.GiftNum == 0) {
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
@@ -116,6 +123,7 @@ func (s *StarGiftAuctionAcquiredGift) FillFrom(from interface {
|
||||
GetRound() (value int)
|
||||
GetPos() (value int)
|
||||
GetMessage() (value TextWithEntities, ok bool)
|
||||
GetGiftNum() (value int, ok bool)
|
||||
}) {
|
||||
s.NameHidden = from.GetNameHidden()
|
||||
s.Peer = from.GetPeer()
|
||||
@@ -127,6 +135,10 @@ func (s *StarGiftAuctionAcquiredGift) FillFrom(from interface {
|
||||
s.Message = val
|
||||
}
|
||||
|
||||
if val, ok := from.GetGiftNum(); ok {
|
||||
s.GiftNum = val
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// TypeID returns type id in TL schema.
|
||||
@@ -182,6 +194,11 @@ func (s *StarGiftAuctionAcquiredGift) TypeInfo() tdp.Type {
|
||||
SchemaName: "message",
|
||||
Null: !s.Flags.Has(1),
|
||||
},
|
||||
{
|
||||
Name: "GiftNum",
|
||||
SchemaName: "gift_num",
|
||||
Null: !s.Flags.Has(2),
|
||||
},
|
||||
}
|
||||
return typ
|
||||
}
|
||||
@@ -194,12 +211,15 @@ func (s *StarGiftAuctionAcquiredGift) SetFlags() {
|
||||
if !(s.Message.Zero()) {
|
||||
s.Flags.Set(1)
|
||||
}
|
||||
if !(s.GiftNum == 0) {
|
||||
s.Flags.Set(2)
|
||||
}
|
||||
}
|
||||
|
||||
// Encode implements bin.Encoder.
|
||||
func (s *StarGiftAuctionAcquiredGift) Encode(b *bin.Buffer) error {
|
||||
if s == nil {
|
||||
return fmt.Errorf("can't encode starGiftAuctionAcquiredGift#ab60e20b as nil")
|
||||
return fmt.Errorf("can't encode starGiftAuctionAcquiredGift#42b00348 as nil")
|
||||
}
|
||||
b.PutID(StarGiftAuctionAcquiredGiftTypeID)
|
||||
return s.EncodeBare(b)
|
||||
@@ -208,17 +228,17 @@ func (s *StarGiftAuctionAcquiredGift) Encode(b *bin.Buffer) error {
|
||||
// EncodeBare implements bin.BareEncoder.
|
||||
func (s *StarGiftAuctionAcquiredGift) EncodeBare(b *bin.Buffer) error {
|
||||
if s == nil {
|
||||
return fmt.Errorf("can't encode starGiftAuctionAcquiredGift#ab60e20b as nil")
|
||||
return fmt.Errorf("can't encode starGiftAuctionAcquiredGift#42b00348 as nil")
|
||||
}
|
||||
s.SetFlags()
|
||||
if err := s.Flags.Encode(b); err != nil {
|
||||
return fmt.Errorf("unable to encode starGiftAuctionAcquiredGift#ab60e20b: field flags: %w", err)
|
||||
return fmt.Errorf("unable to encode starGiftAuctionAcquiredGift#42b00348: field flags: %w", err)
|
||||
}
|
||||
if s.Peer == nil {
|
||||
return fmt.Errorf("unable to encode starGiftAuctionAcquiredGift#ab60e20b: field peer is nil")
|
||||
return fmt.Errorf("unable to encode starGiftAuctionAcquiredGift#42b00348: field peer is nil")
|
||||
}
|
||||
if err := s.Peer.Encode(b); err != nil {
|
||||
return fmt.Errorf("unable to encode starGiftAuctionAcquiredGift#ab60e20b: field peer: %w", err)
|
||||
return fmt.Errorf("unable to encode starGiftAuctionAcquiredGift#42b00348: field peer: %w", err)
|
||||
}
|
||||
b.PutInt(s.Date)
|
||||
b.PutLong(s.BidAmount)
|
||||
@@ -226,19 +246,22 @@ func (s *StarGiftAuctionAcquiredGift) EncodeBare(b *bin.Buffer) error {
|
||||
b.PutInt(s.Pos)
|
||||
if s.Flags.Has(1) {
|
||||
if err := s.Message.Encode(b); err != nil {
|
||||
return fmt.Errorf("unable to encode starGiftAuctionAcquiredGift#ab60e20b: field message: %w", err)
|
||||
return fmt.Errorf("unable to encode starGiftAuctionAcquiredGift#42b00348: field message: %w", err)
|
||||
}
|
||||
}
|
||||
if s.Flags.Has(2) {
|
||||
b.PutInt(s.GiftNum)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Decode implements bin.Decoder.
|
||||
func (s *StarGiftAuctionAcquiredGift) Decode(b *bin.Buffer) error {
|
||||
if s == nil {
|
||||
return fmt.Errorf("can't decode starGiftAuctionAcquiredGift#ab60e20b to nil")
|
||||
return fmt.Errorf("can't decode starGiftAuctionAcquiredGift#42b00348 to nil")
|
||||
}
|
||||
if err := b.ConsumeID(StarGiftAuctionAcquiredGiftTypeID); err != nil {
|
||||
return fmt.Errorf("unable to decode starGiftAuctionAcquiredGift#ab60e20b: %w", err)
|
||||
return fmt.Errorf("unable to decode starGiftAuctionAcquiredGift#42b00348: %w", err)
|
||||
}
|
||||
return s.DecodeBare(b)
|
||||
}
|
||||
@@ -246,54 +269,61 @@ func (s *StarGiftAuctionAcquiredGift) Decode(b *bin.Buffer) error {
|
||||
// DecodeBare implements bin.BareDecoder.
|
||||
func (s *StarGiftAuctionAcquiredGift) DecodeBare(b *bin.Buffer) error {
|
||||
if s == nil {
|
||||
return fmt.Errorf("can't decode starGiftAuctionAcquiredGift#ab60e20b to nil")
|
||||
return fmt.Errorf("can't decode starGiftAuctionAcquiredGift#42b00348 to nil")
|
||||
}
|
||||
{
|
||||
if err := s.Flags.Decode(b); err != nil {
|
||||
return fmt.Errorf("unable to decode starGiftAuctionAcquiredGift#ab60e20b: field flags: %w", err)
|
||||
return fmt.Errorf("unable to decode starGiftAuctionAcquiredGift#42b00348: field flags: %w", err)
|
||||
}
|
||||
}
|
||||
s.NameHidden = s.Flags.Has(0)
|
||||
{
|
||||
value, err := DecodePeer(b)
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode starGiftAuctionAcquiredGift#ab60e20b: field peer: %w", err)
|
||||
return fmt.Errorf("unable to decode starGiftAuctionAcquiredGift#42b00348: field peer: %w", err)
|
||||
}
|
||||
s.Peer = value
|
||||
}
|
||||
{
|
||||
value, err := b.Int()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode starGiftAuctionAcquiredGift#ab60e20b: field date: %w", err)
|
||||
return fmt.Errorf("unable to decode starGiftAuctionAcquiredGift#42b00348: field date: %w", err)
|
||||
}
|
||||
s.Date = value
|
||||
}
|
||||
{
|
||||
value, err := b.Long()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode starGiftAuctionAcquiredGift#ab60e20b: field bid_amount: %w", err)
|
||||
return fmt.Errorf("unable to decode starGiftAuctionAcquiredGift#42b00348: field bid_amount: %w", err)
|
||||
}
|
||||
s.BidAmount = value
|
||||
}
|
||||
{
|
||||
value, err := b.Int()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode starGiftAuctionAcquiredGift#ab60e20b: field round: %w", err)
|
||||
return fmt.Errorf("unable to decode starGiftAuctionAcquiredGift#42b00348: field round: %w", err)
|
||||
}
|
||||
s.Round = value
|
||||
}
|
||||
{
|
||||
value, err := b.Int()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode starGiftAuctionAcquiredGift#ab60e20b: field pos: %w", err)
|
||||
return fmt.Errorf("unable to decode starGiftAuctionAcquiredGift#42b00348: field pos: %w", err)
|
||||
}
|
||||
s.Pos = value
|
||||
}
|
||||
if s.Flags.Has(1) {
|
||||
if err := s.Message.Decode(b); err != nil {
|
||||
return fmt.Errorf("unable to decode starGiftAuctionAcquiredGift#ab60e20b: field message: %w", err)
|
||||
return fmt.Errorf("unable to decode starGiftAuctionAcquiredGift#42b00348: field message: %w", err)
|
||||
}
|
||||
}
|
||||
if s.Flags.Has(2) {
|
||||
value, err := b.Int()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode starGiftAuctionAcquiredGift#42b00348: field gift_num: %w", err)
|
||||
}
|
||||
s.GiftNum = value
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -373,3 +403,21 @@ func (s *StarGiftAuctionAcquiredGift) GetMessage() (value TextWithEntities, ok b
|
||||
}
|
||||
return s.Message, true
|
||||
}
|
||||
|
||||
// SetGiftNum sets value of GiftNum conditional field.
|
||||
func (s *StarGiftAuctionAcquiredGift) SetGiftNum(value int) {
|
||||
s.Flags.Set(2)
|
||||
s.GiftNum = value
|
||||
}
|
||||
|
||||
// GetGiftNum returns value of GiftNum conditional field and
|
||||
// boolean which is true if field was set.
|
||||
func (s *StarGiftAuctionAcquiredGift) GetGiftNum() (value int, ok bool) {
|
||||
if s == nil {
|
||||
return
|
||||
}
|
||||
if !s.Flags.Has(2) {
|
||||
return value, false
|
||||
}
|
||||
return s.GiftNum, true
|
||||
}
|
||||
|
||||
+503
@@ -0,0 +1,503 @@
|
||||
// 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{}
|
||||
)
|
||||
|
||||
// StarGiftAuctionRound represents TL type `starGiftAuctionRound#3aae0528`.
|
||||
//
|
||||
// See https://core.telegram.org/constructor/starGiftAuctionRound for reference.
|
||||
type StarGiftAuctionRound struct {
|
||||
// Num field of StarGiftAuctionRound.
|
||||
Num int
|
||||
// Duration field of StarGiftAuctionRound.
|
||||
Duration int
|
||||
}
|
||||
|
||||
// StarGiftAuctionRoundTypeID is TL type id of StarGiftAuctionRound.
|
||||
const StarGiftAuctionRoundTypeID = 0x3aae0528
|
||||
|
||||
// construct implements constructor of StarGiftAuctionRoundClass.
|
||||
func (s StarGiftAuctionRound) construct() StarGiftAuctionRoundClass { return &s }
|
||||
|
||||
// Ensuring interfaces in compile-time for StarGiftAuctionRound.
|
||||
var (
|
||||
_ bin.Encoder = &StarGiftAuctionRound{}
|
||||
_ bin.Decoder = &StarGiftAuctionRound{}
|
||||
_ bin.BareEncoder = &StarGiftAuctionRound{}
|
||||
_ bin.BareDecoder = &StarGiftAuctionRound{}
|
||||
|
||||
_ StarGiftAuctionRoundClass = &StarGiftAuctionRound{}
|
||||
)
|
||||
|
||||
func (s *StarGiftAuctionRound) Zero() bool {
|
||||
if s == nil {
|
||||
return true
|
||||
}
|
||||
if !(s.Num == 0) {
|
||||
return false
|
||||
}
|
||||
if !(s.Duration == 0) {
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
// String implements fmt.Stringer.
|
||||
func (s *StarGiftAuctionRound) String() string {
|
||||
if s == nil {
|
||||
return "StarGiftAuctionRound(nil)"
|
||||
}
|
||||
type Alias StarGiftAuctionRound
|
||||
return fmt.Sprintf("StarGiftAuctionRound%+v", Alias(*s))
|
||||
}
|
||||
|
||||
// FillFrom fills StarGiftAuctionRound from given interface.
|
||||
func (s *StarGiftAuctionRound) FillFrom(from interface {
|
||||
GetNum() (value int)
|
||||
GetDuration() (value int)
|
||||
}) {
|
||||
s.Num = from.GetNum()
|
||||
s.Duration = from.GetDuration()
|
||||
}
|
||||
|
||||
// TypeID returns type id in TL schema.
|
||||
//
|
||||
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
||||
func (*StarGiftAuctionRound) TypeID() uint32 {
|
||||
return StarGiftAuctionRoundTypeID
|
||||
}
|
||||
|
||||
// TypeName returns name of type in TL schema.
|
||||
func (*StarGiftAuctionRound) TypeName() string {
|
||||
return "starGiftAuctionRound"
|
||||
}
|
||||
|
||||
// TypeInfo returns info about TL type.
|
||||
func (s *StarGiftAuctionRound) TypeInfo() tdp.Type {
|
||||
typ := tdp.Type{
|
||||
Name: "starGiftAuctionRound",
|
||||
ID: StarGiftAuctionRoundTypeID,
|
||||
}
|
||||
if s == nil {
|
||||
typ.Null = true
|
||||
return typ
|
||||
}
|
||||
typ.Fields = []tdp.Field{
|
||||
{
|
||||
Name: "Num",
|
||||
SchemaName: "num",
|
||||
},
|
||||
{
|
||||
Name: "Duration",
|
||||
SchemaName: "duration",
|
||||
},
|
||||
}
|
||||
return typ
|
||||
}
|
||||
|
||||
// Encode implements bin.Encoder.
|
||||
func (s *StarGiftAuctionRound) Encode(b *bin.Buffer) error {
|
||||
if s == nil {
|
||||
return fmt.Errorf("can't encode starGiftAuctionRound#3aae0528 as nil")
|
||||
}
|
||||
b.PutID(StarGiftAuctionRoundTypeID)
|
||||
return s.EncodeBare(b)
|
||||
}
|
||||
|
||||
// EncodeBare implements bin.BareEncoder.
|
||||
func (s *StarGiftAuctionRound) EncodeBare(b *bin.Buffer) error {
|
||||
if s == nil {
|
||||
return fmt.Errorf("can't encode starGiftAuctionRound#3aae0528 as nil")
|
||||
}
|
||||
b.PutInt(s.Num)
|
||||
b.PutInt(s.Duration)
|
||||
return nil
|
||||
}
|
||||
|
||||
// Decode implements bin.Decoder.
|
||||
func (s *StarGiftAuctionRound) Decode(b *bin.Buffer) error {
|
||||
if s == nil {
|
||||
return fmt.Errorf("can't decode starGiftAuctionRound#3aae0528 to nil")
|
||||
}
|
||||
if err := b.ConsumeID(StarGiftAuctionRoundTypeID); err != nil {
|
||||
return fmt.Errorf("unable to decode starGiftAuctionRound#3aae0528: %w", err)
|
||||
}
|
||||
return s.DecodeBare(b)
|
||||
}
|
||||
|
||||
// DecodeBare implements bin.BareDecoder.
|
||||
func (s *StarGiftAuctionRound) DecodeBare(b *bin.Buffer) error {
|
||||
if s == nil {
|
||||
return fmt.Errorf("can't decode starGiftAuctionRound#3aae0528 to nil")
|
||||
}
|
||||
{
|
||||
value, err := b.Int()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode starGiftAuctionRound#3aae0528: field num: %w", err)
|
||||
}
|
||||
s.Num = value
|
||||
}
|
||||
{
|
||||
value, err := b.Int()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode starGiftAuctionRound#3aae0528: field duration: %w", err)
|
||||
}
|
||||
s.Duration = value
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// GetNum returns value of Num field.
|
||||
func (s *StarGiftAuctionRound) GetNum() (value int) {
|
||||
if s == nil {
|
||||
return
|
||||
}
|
||||
return s.Num
|
||||
}
|
||||
|
||||
// GetDuration returns value of Duration field.
|
||||
func (s *StarGiftAuctionRound) GetDuration() (value int) {
|
||||
if s == nil {
|
||||
return
|
||||
}
|
||||
return s.Duration
|
||||
}
|
||||
|
||||
// StarGiftAuctionRoundExtendable represents TL type `starGiftAuctionRoundExtendable#aa021e5`.
|
||||
//
|
||||
// See https://core.telegram.org/constructor/starGiftAuctionRoundExtendable for reference.
|
||||
type StarGiftAuctionRoundExtendable struct {
|
||||
// Num field of StarGiftAuctionRoundExtendable.
|
||||
Num int
|
||||
// Duration field of StarGiftAuctionRoundExtendable.
|
||||
Duration int
|
||||
// ExtendTop field of StarGiftAuctionRoundExtendable.
|
||||
ExtendTop int
|
||||
// ExtendWindow field of StarGiftAuctionRoundExtendable.
|
||||
ExtendWindow int
|
||||
}
|
||||
|
||||
// StarGiftAuctionRoundExtendableTypeID is TL type id of StarGiftAuctionRoundExtendable.
|
||||
const StarGiftAuctionRoundExtendableTypeID = 0xaa021e5
|
||||
|
||||
// construct implements constructor of StarGiftAuctionRoundClass.
|
||||
func (s StarGiftAuctionRoundExtendable) construct() StarGiftAuctionRoundClass { return &s }
|
||||
|
||||
// Ensuring interfaces in compile-time for StarGiftAuctionRoundExtendable.
|
||||
var (
|
||||
_ bin.Encoder = &StarGiftAuctionRoundExtendable{}
|
||||
_ bin.Decoder = &StarGiftAuctionRoundExtendable{}
|
||||
_ bin.BareEncoder = &StarGiftAuctionRoundExtendable{}
|
||||
_ bin.BareDecoder = &StarGiftAuctionRoundExtendable{}
|
||||
|
||||
_ StarGiftAuctionRoundClass = &StarGiftAuctionRoundExtendable{}
|
||||
)
|
||||
|
||||
func (s *StarGiftAuctionRoundExtendable) Zero() bool {
|
||||
if s == nil {
|
||||
return true
|
||||
}
|
||||
if !(s.Num == 0) {
|
||||
return false
|
||||
}
|
||||
if !(s.Duration == 0) {
|
||||
return false
|
||||
}
|
||||
if !(s.ExtendTop == 0) {
|
||||
return false
|
||||
}
|
||||
if !(s.ExtendWindow == 0) {
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
// String implements fmt.Stringer.
|
||||
func (s *StarGiftAuctionRoundExtendable) String() string {
|
||||
if s == nil {
|
||||
return "StarGiftAuctionRoundExtendable(nil)"
|
||||
}
|
||||
type Alias StarGiftAuctionRoundExtendable
|
||||
return fmt.Sprintf("StarGiftAuctionRoundExtendable%+v", Alias(*s))
|
||||
}
|
||||
|
||||
// FillFrom fills StarGiftAuctionRoundExtendable from given interface.
|
||||
func (s *StarGiftAuctionRoundExtendable) FillFrom(from interface {
|
||||
GetNum() (value int)
|
||||
GetDuration() (value int)
|
||||
GetExtendTop() (value int)
|
||||
GetExtendWindow() (value int)
|
||||
}) {
|
||||
s.Num = from.GetNum()
|
||||
s.Duration = from.GetDuration()
|
||||
s.ExtendTop = from.GetExtendTop()
|
||||
s.ExtendWindow = from.GetExtendWindow()
|
||||
}
|
||||
|
||||
// TypeID returns type id in TL schema.
|
||||
//
|
||||
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
||||
func (*StarGiftAuctionRoundExtendable) TypeID() uint32 {
|
||||
return StarGiftAuctionRoundExtendableTypeID
|
||||
}
|
||||
|
||||
// TypeName returns name of type in TL schema.
|
||||
func (*StarGiftAuctionRoundExtendable) TypeName() string {
|
||||
return "starGiftAuctionRoundExtendable"
|
||||
}
|
||||
|
||||
// TypeInfo returns info about TL type.
|
||||
func (s *StarGiftAuctionRoundExtendable) TypeInfo() tdp.Type {
|
||||
typ := tdp.Type{
|
||||
Name: "starGiftAuctionRoundExtendable",
|
||||
ID: StarGiftAuctionRoundExtendableTypeID,
|
||||
}
|
||||
if s == nil {
|
||||
typ.Null = true
|
||||
return typ
|
||||
}
|
||||
typ.Fields = []tdp.Field{
|
||||
{
|
||||
Name: "Num",
|
||||
SchemaName: "num",
|
||||
},
|
||||
{
|
||||
Name: "Duration",
|
||||
SchemaName: "duration",
|
||||
},
|
||||
{
|
||||
Name: "ExtendTop",
|
||||
SchemaName: "extend_top",
|
||||
},
|
||||
{
|
||||
Name: "ExtendWindow",
|
||||
SchemaName: "extend_window",
|
||||
},
|
||||
}
|
||||
return typ
|
||||
}
|
||||
|
||||
// Encode implements bin.Encoder.
|
||||
func (s *StarGiftAuctionRoundExtendable) Encode(b *bin.Buffer) error {
|
||||
if s == nil {
|
||||
return fmt.Errorf("can't encode starGiftAuctionRoundExtendable#aa021e5 as nil")
|
||||
}
|
||||
b.PutID(StarGiftAuctionRoundExtendableTypeID)
|
||||
return s.EncodeBare(b)
|
||||
}
|
||||
|
||||
// EncodeBare implements bin.BareEncoder.
|
||||
func (s *StarGiftAuctionRoundExtendable) EncodeBare(b *bin.Buffer) error {
|
||||
if s == nil {
|
||||
return fmt.Errorf("can't encode starGiftAuctionRoundExtendable#aa021e5 as nil")
|
||||
}
|
||||
b.PutInt(s.Num)
|
||||
b.PutInt(s.Duration)
|
||||
b.PutInt(s.ExtendTop)
|
||||
b.PutInt(s.ExtendWindow)
|
||||
return nil
|
||||
}
|
||||
|
||||
// Decode implements bin.Decoder.
|
||||
func (s *StarGiftAuctionRoundExtendable) Decode(b *bin.Buffer) error {
|
||||
if s == nil {
|
||||
return fmt.Errorf("can't decode starGiftAuctionRoundExtendable#aa021e5 to nil")
|
||||
}
|
||||
if err := b.ConsumeID(StarGiftAuctionRoundExtendableTypeID); err != nil {
|
||||
return fmt.Errorf("unable to decode starGiftAuctionRoundExtendable#aa021e5: %w", err)
|
||||
}
|
||||
return s.DecodeBare(b)
|
||||
}
|
||||
|
||||
// DecodeBare implements bin.BareDecoder.
|
||||
func (s *StarGiftAuctionRoundExtendable) DecodeBare(b *bin.Buffer) error {
|
||||
if s == nil {
|
||||
return fmt.Errorf("can't decode starGiftAuctionRoundExtendable#aa021e5 to nil")
|
||||
}
|
||||
{
|
||||
value, err := b.Int()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode starGiftAuctionRoundExtendable#aa021e5: field num: %w", err)
|
||||
}
|
||||
s.Num = value
|
||||
}
|
||||
{
|
||||
value, err := b.Int()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode starGiftAuctionRoundExtendable#aa021e5: field duration: %w", err)
|
||||
}
|
||||
s.Duration = value
|
||||
}
|
||||
{
|
||||
value, err := b.Int()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode starGiftAuctionRoundExtendable#aa021e5: field extend_top: %w", err)
|
||||
}
|
||||
s.ExtendTop = value
|
||||
}
|
||||
{
|
||||
value, err := b.Int()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode starGiftAuctionRoundExtendable#aa021e5: field extend_window: %w", err)
|
||||
}
|
||||
s.ExtendWindow = value
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// GetNum returns value of Num field.
|
||||
func (s *StarGiftAuctionRoundExtendable) GetNum() (value int) {
|
||||
if s == nil {
|
||||
return
|
||||
}
|
||||
return s.Num
|
||||
}
|
||||
|
||||
// GetDuration returns value of Duration field.
|
||||
func (s *StarGiftAuctionRoundExtendable) GetDuration() (value int) {
|
||||
if s == nil {
|
||||
return
|
||||
}
|
||||
return s.Duration
|
||||
}
|
||||
|
||||
// GetExtendTop returns value of ExtendTop field.
|
||||
func (s *StarGiftAuctionRoundExtendable) GetExtendTop() (value int) {
|
||||
if s == nil {
|
||||
return
|
||||
}
|
||||
return s.ExtendTop
|
||||
}
|
||||
|
||||
// GetExtendWindow returns value of ExtendWindow field.
|
||||
func (s *StarGiftAuctionRoundExtendable) GetExtendWindow() (value int) {
|
||||
if s == nil {
|
||||
return
|
||||
}
|
||||
return s.ExtendWindow
|
||||
}
|
||||
|
||||
// StarGiftAuctionRoundClassName is schema name of StarGiftAuctionRoundClass.
|
||||
const StarGiftAuctionRoundClassName = "StarGiftAuctionRound"
|
||||
|
||||
// StarGiftAuctionRoundClass represents StarGiftAuctionRound generic type.
|
||||
//
|
||||
// See https://core.telegram.org/type/StarGiftAuctionRound for reference.
|
||||
//
|
||||
// Example:
|
||||
//
|
||||
// g, err := tg.DecodeStarGiftAuctionRound(buf)
|
||||
// if err != nil {
|
||||
// panic(err)
|
||||
// }
|
||||
// switch v := g.(type) {
|
||||
// case *tg.StarGiftAuctionRound: // starGiftAuctionRound#3aae0528
|
||||
// case *tg.StarGiftAuctionRoundExtendable: // starGiftAuctionRoundExtendable#aa021e5
|
||||
// default: panic(v)
|
||||
// }
|
||||
type StarGiftAuctionRoundClass interface {
|
||||
bin.Encoder
|
||||
bin.Decoder
|
||||
bin.BareEncoder
|
||||
bin.BareDecoder
|
||||
construct() StarGiftAuctionRoundClass
|
||||
|
||||
// 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
|
||||
|
||||
// Num field of StarGiftAuctionRound.
|
||||
GetNum() (value int)
|
||||
|
||||
// Duration field of StarGiftAuctionRound.
|
||||
GetDuration() (value int)
|
||||
}
|
||||
|
||||
// DecodeStarGiftAuctionRound implements binary de-serialization for StarGiftAuctionRoundClass.
|
||||
func DecodeStarGiftAuctionRound(buf *bin.Buffer) (StarGiftAuctionRoundClass, error) {
|
||||
id, err := buf.PeekID()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
switch id {
|
||||
case StarGiftAuctionRoundTypeID:
|
||||
// Decoding starGiftAuctionRound#3aae0528.
|
||||
v := StarGiftAuctionRound{}
|
||||
if err := v.Decode(buf); err != nil {
|
||||
return nil, fmt.Errorf("unable to decode StarGiftAuctionRoundClass: %w", err)
|
||||
}
|
||||
return &v, nil
|
||||
case StarGiftAuctionRoundExtendableTypeID:
|
||||
// Decoding starGiftAuctionRoundExtendable#aa021e5.
|
||||
v := StarGiftAuctionRoundExtendable{}
|
||||
if err := v.Decode(buf); err != nil {
|
||||
return nil, fmt.Errorf("unable to decode StarGiftAuctionRoundClass: %w", err)
|
||||
}
|
||||
return &v, nil
|
||||
default:
|
||||
return nil, fmt.Errorf("unable to decode StarGiftAuctionRoundClass: %w", bin.NewUnexpectedID(id))
|
||||
}
|
||||
}
|
||||
|
||||
// StarGiftAuctionRound boxes the StarGiftAuctionRoundClass providing a helper.
|
||||
type StarGiftAuctionRoundBox struct {
|
||||
StarGiftAuctionRound StarGiftAuctionRoundClass
|
||||
}
|
||||
|
||||
// Decode implements bin.Decoder for StarGiftAuctionRoundBox.
|
||||
func (b *StarGiftAuctionRoundBox) Decode(buf *bin.Buffer) error {
|
||||
if b == nil {
|
||||
return fmt.Errorf("unable to decode StarGiftAuctionRoundBox to nil")
|
||||
}
|
||||
v, err := DecodeStarGiftAuctionRound(buf)
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode boxed value: %w", err)
|
||||
}
|
||||
b.StarGiftAuctionRound = v
|
||||
return nil
|
||||
}
|
||||
|
||||
// Encode implements bin.Encode for StarGiftAuctionRoundBox.
|
||||
func (b *StarGiftAuctionRoundBox) Encode(buf *bin.Buffer) error {
|
||||
if b == nil || b.StarGiftAuctionRound == nil {
|
||||
return fmt.Errorf("unable to encode StarGiftAuctionRoundClass as nil")
|
||||
}
|
||||
return b.StarGiftAuctionRound.Encode(buf)
|
||||
}
|
||||
+307
@@ -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{}
|
||||
)
|
||||
|
||||
// StarGiftAuctionRoundClassArray is adapter for slice of StarGiftAuctionRoundClass.
|
||||
type StarGiftAuctionRoundClassArray []StarGiftAuctionRoundClass
|
||||
|
||||
// Sort sorts slice of StarGiftAuctionRoundClass.
|
||||
func (s StarGiftAuctionRoundClassArray) Sort(less func(a, b StarGiftAuctionRoundClass) bool) StarGiftAuctionRoundClassArray {
|
||||
sort.Slice(s, func(i, j int) bool {
|
||||
return less(s[i], s[j])
|
||||
})
|
||||
return s
|
||||
}
|
||||
|
||||
// SortStable sorts slice of StarGiftAuctionRoundClass.
|
||||
func (s StarGiftAuctionRoundClassArray) SortStable(less func(a, b StarGiftAuctionRoundClass) bool) StarGiftAuctionRoundClassArray {
|
||||
sort.SliceStable(s, func(i, j int) bool {
|
||||
return less(s[i], s[j])
|
||||
})
|
||||
return s
|
||||
}
|
||||
|
||||
// Retain filters in-place slice of StarGiftAuctionRoundClass.
|
||||
func (s StarGiftAuctionRoundClassArray) Retain(keep func(x StarGiftAuctionRoundClass) bool) StarGiftAuctionRoundClassArray {
|
||||
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 StarGiftAuctionRoundClassArray) First() (v StarGiftAuctionRoundClass, ok bool) {
|
||||
if len(s) < 1 {
|
||||
return
|
||||
}
|
||||
return s[0], true
|
||||
}
|
||||
|
||||
// Last returns last element of slice (if exists).
|
||||
func (s StarGiftAuctionRoundClassArray) Last() (v StarGiftAuctionRoundClass, 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 *StarGiftAuctionRoundClassArray) PopFirst() (v StarGiftAuctionRoundClass, 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 StarGiftAuctionRoundClass
|
||||
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 *StarGiftAuctionRoundClassArray) Pop() (v StarGiftAuctionRoundClass, 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
|
||||
}
|
||||
|
||||
// AsStarGiftAuctionRound returns copy with only StarGiftAuctionRound constructors.
|
||||
func (s StarGiftAuctionRoundClassArray) AsStarGiftAuctionRound() (to StarGiftAuctionRoundArray) {
|
||||
for _, elem := range s {
|
||||
value, ok := elem.(*StarGiftAuctionRound)
|
||||
if !ok {
|
||||
continue
|
||||
}
|
||||
to = append(to, *value)
|
||||
}
|
||||
|
||||
return to
|
||||
}
|
||||
|
||||
// AsStarGiftAuctionRoundExtendable returns copy with only StarGiftAuctionRoundExtendable constructors.
|
||||
func (s StarGiftAuctionRoundClassArray) AsStarGiftAuctionRoundExtendable() (to StarGiftAuctionRoundExtendableArray) {
|
||||
for _, elem := range s {
|
||||
value, ok := elem.(*StarGiftAuctionRoundExtendable)
|
||||
if !ok {
|
||||
continue
|
||||
}
|
||||
to = append(to, *value)
|
||||
}
|
||||
|
||||
return to
|
||||
}
|
||||
|
||||
// StarGiftAuctionRoundArray is adapter for slice of StarGiftAuctionRound.
|
||||
type StarGiftAuctionRoundArray []StarGiftAuctionRound
|
||||
|
||||
// Sort sorts slice of StarGiftAuctionRound.
|
||||
func (s StarGiftAuctionRoundArray) Sort(less func(a, b StarGiftAuctionRound) bool) StarGiftAuctionRoundArray {
|
||||
sort.Slice(s, func(i, j int) bool {
|
||||
return less(s[i], s[j])
|
||||
})
|
||||
return s
|
||||
}
|
||||
|
||||
// SortStable sorts slice of StarGiftAuctionRound.
|
||||
func (s StarGiftAuctionRoundArray) SortStable(less func(a, b StarGiftAuctionRound) bool) StarGiftAuctionRoundArray {
|
||||
sort.SliceStable(s, func(i, j int) bool {
|
||||
return less(s[i], s[j])
|
||||
})
|
||||
return s
|
||||
}
|
||||
|
||||
// Retain filters in-place slice of StarGiftAuctionRound.
|
||||
func (s StarGiftAuctionRoundArray) Retain(keep func(x StarGiftAuctionRound) bool) StarGiftAuctionRoundArray {
|
||||
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 StarGiftAuctionRoundArray) First() (v StarGiftAuctionRound, ok bool) {
|
||||
if len(s) < 1 {
|
||||
return
|
||||
}
|
||||
return s[0], true
|
||||
}
|
||||
|
||||
// Last returns last element of slice (if exists).
|
||||
func (s StarGiftAuctionRoundArray) Last() (v StarGiftAuctionRound, 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 *StarGiftAuctionRoundArray) PopFirst() (v StarGiftAuctionRound, 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 StarGiftAuctionRound
|
||||
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 *StarGiftAuctionRoundArray) Pop() (v StarGiftAuctionRound, 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
|
||||
}
|
||||
|
||||
// StarGiftAuctionRoundExtendableArray is adapter for slice of StarGiftAuctionRoundExtendable.
|
||||
type StarGiftAuctionRoundExtendableArray []StarGiftAuctionRoundExtendable
|
||||
|
||||
// Sort sorts slice of StarGiftAuctionRoundExtendable.
|
||||
func (s StarGiftAuctionRoundExtendableArray) Sort(less func(a, b StarGiftAuctionRoundExtendable) bool) StarGiftAuctionRoundExtendableArray {
|
||||
sort.Slice(s, func(i, j int) bool {
|
||||
return less(s[i], s[j])
|
||||
})
|
||||
return s
|
||||
}
|
||||
|
||||
// SortStable sorts slice of StarGiftAuctionRoundExtendable.
|
||||
func (s StarGiftAuctionRoundExtendableArray) SortStable(less func(a, b StarGiftAuctionRoundExtendable) bool) StarGiftAuctionRoundExtendableArray {
|
||||
sort.SliceStable(s, func(i, j int) bool {
|
||||
return less(s[i], s[j])
|
||||
})
|
||||
return s
|
||||
}
|
||||
|
||||
// Retain filters in-place slice of StarGiftAuctionRoundExtendable.
|
||||
func (s StarGiftAuctionRoundExtendableArray) Retain(keep func(x StarGiftAuctionRoundExtendable) bool) StarGiftAuctionRoundExtendableArray {
|
||||
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 StarGiftAuctionRoundExtendableArray) First() (v StarGiftAuctionRoundExtendable, ok bool) {
|
||||
if len(s) < 1 {
|
||||
return
|
||||
}
|
||||
return s[0], true
|
||||
}
|
||||
|
||||
// Last returns last element of slice (if exists).
|
||||
func (s StarGiftAuctionRoundExtendableArray) Last() (v StarGiftAuctionRoundExtendable, 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 *StarGiftAuctionRoundExtendableArray) PopFirst() (v StarGiftAuctionRoundExtendable, 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 StarGiftAuctionRoundExtendable
|
||||
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 *StarGiftAuctionRoundExtendableArray) Pop() (v StarGiftAuctionRoundExtendable, 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
|
||||
}
|
||||
+273
-34
@@ -132,7 +132,7 @@ func (s *StarGiftAuctionStateNotModified) DecodeBare(b *bin.Buffer) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// StarGiftAuctionState represents TL type `starGiftAuctionState#5db04f4b`.
|
||||
// StarGiftAuctionState represents TL type `starGiftAuctionState#771a4e66`.
|
||||
//
|
||||
// See https://core.telegram.org/constructor/starGiftAuctionState for reference.
|
||||
type StarGiftAuctionState struct {
|
||||
@@ -150,16 +150,20 @@ type StarGiftAuctionState struct {
|
||||
TopBidders []int64
|
||||
// NextRoundAt field of StarGiftAuctionState.
|
||||
NextRoundAt int
|
||||
// LastGiftNum field of StarGiftAuctionState.
|
||||
LastGiftNum int
|
||||
// GiftsLeft field of StarGiftAuctionState.
|
||||
GiftsLeft int
|
||||
// CurrentRound field of StarGiftAuctionState.
|
||||
CurrentRound int
|
||||
// TotalRounds field of StarGiftAuctionState.
|
||||
TotalRounds int
|
||||
// Rounds field of StarGiftAuctionState.
|
||||
Rounds []StarGiftAuctionRoundClass
|
||||
}
|
||||
|
||||
// StarGiftAuctionStateTypeID is TL type id of StarGiftAuctionState.
|
||||
const StarGiftAuctionStateTypeID = 0x5db04f4b
|
||||
const StarGiftAuctionStateTypeID = 0x771a4e66
|
||||
|
||||
// construct implements constructor of StarGiftAuctionStateClass.
|
||||
func (s StarGiftAuctionState) construct() StarGiftAuctionStateClass { return &s }
|
||||
@@ -199,6 +203,9 @@ func (s *StarGiftAuctionState) Zero() bool {
|
||||
if !(s.NextRoundAt == 0) {
|
||||
return false
|
||||
}
|
||||
if !(s.LastGiftNum == 0) {
|
||||
return false
|
||||
}
|
||||
if !(s.GiftsLeft == 0) {
|
||||
return false
|
||||
}
|
||||
@@ -208,6 +215,9 @@ func (s *StarGiftAuctionState) Zero() bool {
|
||||
if !(s.TotalRounds == 0) {
|
||||
return false
|
||||
}
|
||||
if !(s.Rounds == nil) {
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
@@ -230,9 +240,11 @@ func (s *StarGiftAuctionState) FillFrom(from interface {
|
||||
GetBidLevels() (value []AuctionBidLevel)
|
||||
GetTopBidders() (value []int64)
|
||||
GetNextRoundAt() (value int)
|
||||
GetLastGiftNum() (value int)
|
||||
GetGiftsLeft() (value int)
|
||||
GetCurrentRound() (value int)
|
||||
GetTotalRounds() (value int)
|
||||
GetRounds() (value []StarGiftAuctionRoundClass)
|
||||
}) {
|
||||
s.Version = from.GetVersion()
|
||||
s.StartDate = from.GetStartDate()
|
||||
@@ -241,9 +253,11 @@ func (s *StarGiftAuctionState) FillFrom(from interface {
|
||||
s.BidLevels = from.GetBidLevels()
|
||||
s.TopBidders = from.GetTopBidders()
|
||||
s.NextRoundAt = from.GetNextRoundAt()
|
||||
s.LastGiftNum = from.GetLastGiftNum()
|
||||
s.GiftsLeft = from.GetGiftsLeft()
|
||||
s.CurrentRound = from.GetCurrentRound()
|
||||
s.TotalRounds = from.GetTotalRounds()
|
||||
s.Rounds = from.GetRounds()
|
||||
}
|
||||
|
||||
// TypeID returns type id in TL schema.
|
||||
@@ -297,6 +311,10 @@ func (s *StarGiftAuctionState) TypeInfo() tdp.Type {
|
||||
Name: "NextRoundAt",
|
||||
SchemaName: "next_round_at",
|
||||
},
|
||||
{
|
||||
Name: "LastGiftNum",
|
||||
SchemaName: "last_gift_num",
|
||||
},
|
||||
{
|
||||
Name: "GiftsLeft",
|
||||
SchemaName: "gifts_left",
|
||||
@@ -309,6 +327,10 @@ func (s *StarGiftAuctionState) TypeInfo() tdp.Type {
|
||||
Name: "TotalRounds",
|
||||
SchemaName: "total_rounds",
|
||||
},
|
||||
{
|
||||
Name: "Rounds",
|
||||
SchemaName: "rounds",
|
||||
},
|
||||
}
|
||||
return typ
|
||||
}
|
||||
@@ -316,7 +338,7 @@ func (s *StarGiftAuctionState) TypeInfo() tdp.Type {
|
||||
// Encode implements bin.Encoder.
|
||||
func (s *StarGiftAuctionState) Encode(b *bin.Buffer) error {
|
||||
if s == nil {
|
||||
return fmt.Errorf("can't encode starGiftAuctionState#5db04f4b as nil")
|
||||
return fmt.Errorf("can't encode starGiftAuctionState#771a4e66 as nil")
|
||||
}
|
||||
b.PutID(StarGiftAuctionStateTypeID)
|
||||
return s.EncodeBare(b)
|
||||
@@ -325,7 +347,7 @@ func (s *StarGiftAuctionState) Encode(b *bin.Buffer) error {
|
||||
// EncodeBare implements bin.BareEncoder.
|
||||
func (s *StarGiftAuctionState) EncodeBare(b *bin.Buffer) error {
|
||||
if s == nil {
|
||||
return fmt.Errorf("can't encode starGiftAuctionState#5db04f4b as nil")
|
||||
return fmt.Errorf("can't encode starGiftAuctionState#771a4e66 as nil")
|
||||
}
|
||||
b.PutInt(s.Version)
|
||||
b.PutInt(s.StartDate)
|
||||
@@ -334,7 +356,7 @@ func (s *StarGiftAuctionState) EncodeBare(b *bin.Buffer) error {
|
||||
b.PutVectorHeader(len(s.BidLevels))
|
||||
for idx, v := range s.BidLevels {
|
||||
if err := v.Encode(b); err != nil {
|
||||
return fmt.Errorf("unable to encode starGiftAuctionState#5db04f4b: field bid_levels element with index %d: %w", idx, err)
|
||||
return fmt.Errorf("unable to encode starGiftAuctionState#771a4e66: field bid_levels element with index %d: %w", idx, err)
|
||||
}
|
||||
}
|
||||
b.PutVectorHeader(len(s.TopBidders))
|
||||
@@ -342,19 +364,29 @@ func (s *StarGiftAuctionState) EncodeBare(b *bin.Buffer) error {
|
||||
b.PutLong(v)
|
||||
}
|
||||
b.PutInt(s.NextRoundAt)
|
||||
b.PutInt(s.LastGiftNum)
|
||||
b.PutInt(s.GiftsLeft)
|
||||
b.PutInt(s.CurrentRound)
|
||||
b.PutInt(s.TotalRounds)
|
||||
b.PutVectorHeader(len(s.Rounds))
|
||||
for idx, v := range s.Rounds {
|
||||
if v == nil {
|
||||
return fmt.Errorf("unable to encode starGiftAuctionState#771a4e66: field rounds element with index %d is nil", idx)
|
||||
}
|
||||
if err := v.Encode(b); err != nil {
|
||||
return fmt.Errorf("unable to encode starGiftAuctionState#771a4e66: field rounds element with index %d: %w", idx, err)
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Decode implements bin.Decoder.
|
||||
func (s *StarGiftAuctionState) Decode(b *bin.Buffer) error {
|
||||
if s == nil {
|
||||
return fmt.Errorf("can't decode starGiftAuctionState#5db04f4b to nil")
|
||||
return fmt.Errorf("can't decode starGiftAuctionState#771a4e66 to nil")
|
||||
}
|
||||
if err := b.ConsumeID(StarGiftAuctionStateTypeID); err != nil {
|
||||
return fmt.Errorf("unable to decode starGiftAuctionState#5db04f4b: %w", err)
|
||||
return fmt.Errorf("unable to decode starGiftAuctionState#771a4e66: %w", err)
|
||||
}
|
||||
return s.DecodeBare(b)
|
||||
}
|
||||
@@ -362,40 +394,40 @@ func (s *StarGiftAuctionState) Decode(b *bin.Buffer) error {
|
||||
// DecodeBare implements bin.BareDecoder.
|
||||
func (s *StarGiftAuctionState) DecodeBare(b *bin.Buffer) error {
|
||||
if s == nil {
|
||||
return fmt.Errorf("can't decode starGiftAuctionState#5db04f4b to nil")
|
||||
return fmt.Errorf("can't decode starGiftAuctionState#771a4e66 to nil")
|
||||
}
|
||||
{
|
||||
value, err := b.Int()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode starGiftAuctionState#5db04f4b: field version: %w", err)
|
||||
return fmt.Errorf("unable to decode starGiftAuctionState#771a4e66: field version: %w", err)
|
||||
}
|
||||
s.Version = value
|
||||
}
|
||||
{
|
||||
value, err := b.Int()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode starGiftAuctionState#5db04f4b: field start_date: %w", err)
|
||||
return fmt.Errorf("unable to decode starGiftAuctionState#771a4e66: field start_date: %w", err)
|
||||
}
|
||||
s.StartDate = value
|
||||
}
|
||||
{
|
||||
value, err := b.Int()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode starGiftAuctionState#5db04f4b: field end_date: %w", err)
|
||||
return fmt.Errorf("unable to decode starGiftAuctionState#771a4e66: field end_date: %w", err)
|
||||
}
|
||||
s.EndDate = value
|
||||
}
|
||||
{
|
||||
value, err := b.Long()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode starGiftAuctionState#5db04f4b: field min_bid_amount: %w", err)
|
||||
return fmt.Errorf("unable to decode starGiftAuctionState#771a4e66: field min_bid_amount: %w", err)
|
||||
}
|
||||
s.MinBidAmount = value
|
||||
}
|
||||
{
|
||||
headerLen, err := b.VectorHeader()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode starGiftAuctionState#5db04f4b: field bid_levels: %w", err)
|
||||
return fmt.Errorf("unable to decode starGiftAuctionState#771a4e66: field bid_levels: %w", err)
|
||||
}
|
||||
|
||||
if headerLen > 0 {
|
||||
@@ -404,7 +436,7 @@ func (s *StarGiftAuctionState) DecodeBare(b *bin.Buffer) error {
|
||||
for idx := 0; idx < headerLen; idx++ {
|
||||
var value AuctionBidLevel
|
||||
if err := value.Decode(b); err != nil {
|
||||
return fmt.Errorf("unable to decode starGiftAuctionState#5db04f4b: field bid_levels: %w", err)
|
||||
return fmt.Errorf("unable to decode starGiftAuctionState#771a4e66: field bid_levels: %w", err)
|
||||
}
|
||||
s.BidLevels = append(s.BidLevels, value)
|
||||
}
|
||||
@@ -412,7 +444,7 @@ func (s *StarGiftAuctionState) DecodeBare(b *bin.Buffer) error {
|
||||
{
|
||||
headerLen, err := b.VectorHeader()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode starGiftAuctionState#5db04f4b: field top_bidders: %w", err)
|
||||
return fmt.Errorf("unable to decode starGiftAuctionState#771a4e66: field top_bidders: %w", err)
|
||||
}
|
||||
|
||||
if headerLen > 0 {
|
||||
@@ -421,7 +453,7 @@ func (s *StarGiftAuctionState) DecodeBare(b *bin.Buffer) error {
|
||||
for idx := 0; idx < headerLen; idx++ {
|
||||
value, err := b.Long()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode starGiftAuctionState#5db04f4b: field top_bidders: %w", err)
|
||||
return fmt.Errorf("unable to decode starGiftAuctionState#771a4e66: field top_bidders: %w", err)
|
||||
}
|
||||
s.TopBidders = append(s.TopBidders, value)
|
||||
}
|
||||
@@ -429,31 +461,55 @@ func (s *StarGiftAuctionState) DecodeBare(b *bin.Buffer) error {
|
||||
{
|
||||
value, err := b.Int()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode starGiftAuctionState#5db04f4b: field next_round_at: %w", err)
|
||||
return fmt.Errorf("unable to decode starGiftAuctionState#771a4e66: field next_round_at: %w", err)
|
||||
}
|
||||
s.NextRoundAt = value
|
||||
}
|
||||
{
|
||||
value, err := b.Int()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode starGiftAuctionState#5db04f4b: field gifts_left: %w", err)
|
||||
return fmt.Errorf("unable to decode starGiftAuctionState#771a4e66: field last_gift_num: %w", err)
|
||||
}
|
||||
s.LastGiftNum = value
|
||||
}
|
||||
{
|
||||
value, err := b.Int()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode starGiftAuctionState#771a4e66: field gifts_left: %w", err)
|
||||
}
|
||||
s.GiftsLeft = value
|
||||
}
|
||||
{
|
||||
value, err := b.Int()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode starGiftAuctionState#5db04f4b: field current_round: %w", err)
|
||||
return fmt.Errorf("unable to decode starGiftAuctionState#771a4e66: field current_round: %w", err)
|
||||
}
|
||||
s.CurrentRound = value
|
||||
}
|
||||
{
|
||||
value, err := b.Int()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode starGiftAuctionState#5db04f4b: field total_rounds: %w", err)
|
||||
return fmt.Errorf("unable to decode starGiftAuctionState#771a4e66: field total_rounds: %w", err)
|
||||
}
|
||||
s.TotalRounds = value
|
||||
}
|
||||
{
|
||||
headerLen, err := b.VectorHeader()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode starGiftAuctionState#771a4e66: field rounds: %w", err)
|
||||
}
|
||||
|
||||
if headerLen > 0 {
|
||||
s.Rounds = make([]StarGiftAuctionRoundClass, 0, headerLen%bin.PreallocateLimit)
|
||||
}
|
||||
for idx := 0; idx < headerLen; idx++ {
|
||||
value, err := DecodeStarGiftAuctionRound(b)
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode starGiftAuctionState#771a4e66: field rounds: %w", err)
|
||||
}
|
||||
s.Rounds = append(s.Rounds, value)
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -513,6 +569,14 @@ func (s *StarGiftAuctionState) GetNextRoundAt() (value int) {
|
||||
return s.NextRoundAt
|
||||
}
|
||||
|
||||
// GetLastGiftNum returns value of LastGiftNum field.
|
||||
func (s *StarGiftAuctionState) GetLastGiftNum() (value int) {
|
||||
if s == nil {
|
||||
return
|
||||
}
|
||||
return s.LastGiftNum
|
||||
}
|
||||
|
||||
// GetGiftsLeft returns value of GiftsLeft field.
|
||||
func (s *StarGiftAuctionState) GetGiftsLeft() (value int) {
|
||||
if s == nil {
|
||||
@@ -537,20 +601,47 @@ func (s *StarGiftAuctionState) GetTotalRounds() (value int) {
|
||||
return s.TotalRounds
|
||||
}
|
||||
|
||||
// StarGiftAuctionStateFinished represents TL type `starGiftAuctionStateFinished#7d967c3a`.
|
||||
// GetRounds returns value of Rounds field.
|
||||
func (s *StarGiftAuctionState) GetRounds() (value []StarGiftAuctionRoundClass) {
|
||||
if s == nil {
|
||||
return
|
||||
}
|
||||
return s.Rounds
|
||||
}
|
||||
|
||||
// MapRounds returns field Rounds wrapped in StarGiftAuctionRoundClassArray helper.
|
||||
func (s *StarGiftAuctionState) MapRounds() (value StarGiftAuctionRoundClassArray) {
|
||||
return StarGiftAuctionRoundClassArray(s.Rounds)
|
||||
}
|
||||
|
||||
// StarGiftAuctionStateFinished represents TL type `starGiftAuctionStateFinished#972dabbf`.
|
||||
//
|
||||
// See https://core.telegram.org/constructor/starGiftAuctionStateFinished for reference.
|
||||
type StarGiftAuctionStateFinished struct {
|
||||
// Flags field of StarGiftAuctionStateFinished.
|
||||
Flags bin.Fields
|
||||
// StartDate field of StarGiftAuctionStateFinished.
|
||||
StartDate int
|
||||
// EndDate field of StarGiftAuctionStateFinished.
|
||||
EndDate int
|
||||
// AveragePrice field of StarGiftAuctionStateFinished.
|
||||
AveragePrice int64
|
||||
// ListedCount field of StarGiftAuctionStateFinished.
|
||||
//
|
||||
// Use SetListedCount and GetListedCount helpers.
|
||||
ListedCount int
|
||||
// FragmentListedCount field of StarGiftAuctionStateFinished.
|
||||
//
|
||||
// Use SetFragmentListedCount and GetFragmentListedCount helpers.
|
||||
FragmentListedCount int
|
||||
// FragmentListedURL field of StarGiftAuctionStateFinished.
|
||||
//
|
||||
// Use SetFragmentListedURL and GetFragmentListedURL helpers.
|
||||
FragmentListedURL string
|
||||
}
|
||||
|
||||
// StarGiftAuctionStateFinishedTypeID is TL type id of StarGiftAuctionStateFinished.
|
||||
const StarGiftAuctionStateFinishedTypeID = 0x7d967c3a
|
||||
const StarGiftAuctionStateFinishedTypeID = 0x972dabbf
|
||||
|
||||
// construct implements constructor of StarGiftAuctionStateClass.
|
||||
func (s StarGiftAuctionStateFinished) construct() StarGiftAuctionStateClass { return &s }
|
||||
@@ -569,6 +660,9 @@ func (s *StarGiftAuctionStateFinished) Zero() bool {
|
||||
if s == nil {
|
||||
return true
|
||||
}
|
||||
if !(s.Flags.Zero()) {
|
||||
return false
|
||||
}
|
||||
if !(s.StartDate == 0) {
|
||||
return false
|
||||
}
|
||||
@@ -578,6 +672,15 @@ func (s *StarGiftAuctionStateFinished) Zero() bool {
|
||||
if !(s.AveragePrice == 0) {
|
||||
return false
|
||||
}
|
||||
if !(s.ListedCount == 0) {
|
||||
return false
|
||||
}
|
||||
if !(s.FragmentListedCount == 0) {
|
||||
return false
|
||||
}
|
||||
if !(s.FragmentListedURL == "") {
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
@@ -596,10 +699,25 @@ func (s *StarGiftAuctionStateFinished) FillFrom(from interface {
|
||||
GetStartDate() (value int)
|
||||
GetEndDate() (value int)
|
||||
GetAveragePrice() (value int64)
|
||||
GetListedCount() (value int, ok bool)
|
||||
GetFragmentListedCount() (value int, ok bool)
|
||||
GetFragmentListedURL() (value string, ok bool)
|
||||
}) {
|
||||
s.StartDate = from.GetStartDate()
|
||||
s.EndDate = from.GetEndDate()
|
||||
s.AveragePrice = from.GetAveragePrice()
|
||||
if val, ok := from.GetListedCount(); ok {
|
||||
s.ListedCount = val
|
||||
}
|
||||
|
||||
if val, ok := from.GetFragmentListedCount(); ok {
|
||||
s.FragmentListedCount = val
|
||||
}
|
||||
|
||||
if val, ok := from.GetFragmentListedURL(); ok {
|
||||
s.FragmentListedURL = val
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// TypeID returns type id in TL schema.
|
||||
@@ -637,14 +755,42 @@ func (s *StarGiftAuctionStateFinished) TypeInfo() tdp.Type {
|
||||
Name: "AveragePrice",
|
||||
SchemaName: "average_price",
|
||||
},
|
||||
{
|
||||
Name: "ListedCount",
|
||||
SchemaName: "listed_count",
|
||||
Null: !s.Flags.Has(0),
|
||||
},
|
||||
{
|
||||
Name: "FragmentListedCount",
|
||||
SchemaName: "fragment_listed_count",
|
||||
Null: !s.Flags.Has(1),
|
||||
},
|
||||
{
|
||||
Name: "FragmentListedURL",
|
||||
SchemaName: "fragment_listed_url",
|
||||
Null: !s.Flags.Has(1),
|
||||
},
|
||||
}
|
||||
return typ
|
||||
}
|
||||
|
||||
// SetFlags sets flags for non-zero fields.
|
||||
func (s *StarGiftAuctionStateFinished) SetFlags() {
|
||||
if !(s.ListedCount == 0) {
|
||||
s.Flags.Set(0)
|
||||
}
|
||||
if !(s.FragmentListedCount == 0) {
|
||||
s.Flags.Set(1)
|
||||
}
|
||||
if !(s.FragmentListedURL == "") {
|
||||
s.Flags.Set(1)
|
||||
}
|
||||
}
|
||||
|
||||
// Encode implements bin.Encoder.
|
||||
func (s *StarGiftAuctionStateFinished) Encode(b *bin.Buffer) error {
|
||||
if s == nil {
|
||||
return fmt.Errorf("can't encode starGiftAuctionStateFinished#7d967c3a as nil")
|
||||
return fmt.Errorf("can't encode starGiftAuctionStateFinished#972dabbf as nil")
|
||||
}
|
||||
b.PutID(StarGiftAuctionStateFinishedTypeID)
|
||||
return s.EncodeBare(b)
|
||||
@@ -653,21 +799,34 @@ func (s *StarGiftAuctionStateFinished) Encode(b *bin.Buffer) error {
|
||||
// EncodeBare implements bin.BareEncoder.
|
||||
func (s *StarGiftAuctionStateFinished) EncodeBare(b *bin.Buffer) error {
|
||||
if s == nil {
|
||||
return fmt.Errorf("can't encode starGiftAuctionStateFinished#7d967c3a as nil")
|
||||
return fmt.Errorf("can't encode starGiftAuctionStateFinished#972dabbf as nil")
|
||||
}
|
||||
s.SetFlags()
|
||||
if err := s.Flags.Encode(b); err != nil {
|
||||
return fmt.Errorf("unable to encode starGiftAuctionStateFinished#972dabbf: field flags: %w", err)
|
||||
}
|
||||
b.PutInt(s.StartDate)
|
||||
b.PutInt(s.EndDate)
|
||||
b.PutLong(s.AveragePrice)
|
||||
if s.Flags.Has(0) {
|
||||
b.PutInt(s.ListedCount)
|
||||
}
|
||||
if s.Flags.Has(1) {
|
||||
b.PutInt(s.FragmentListedCount)
|
||||
}
|
||||
if s.Flags.Has(1) {
|
||||
b.PutString(s.FragmentListedURL)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Decode implements bin.Decoder.
|
||||
func (s *StarGiftAuctionStateFinished) Decode(b *bin.Buffer) error {
|
||||
if s == nil {
|
||||
return fmt.Errorf("can't decode starGiftAuctionStateFinished#7d967c3a to nil")
|
||||
return fmt.Errorf("can't decode starGiftAuctionStateFinished#972dabbf to nil")
|
||||
}
|
||||
if err := b.ConsumeID(StarGiftAuctionStateFinishedTypeID); err != nil {
|
||||
return fmt.Errorf("unable to decode starGiftAuctionStateFinished#7d967c3a: %w", err)
|
||||
return fmt.Errorf("unable to decode starGiftAuctionStateFinished#972dabbf: %w", err)
|
||||
}
|
||||
return s.DecodeBare(b)
|
||||
}
|
||||
@@ -675,29 +834,55 @@ func (s *StarGiftAuctionStateFinished) Decode(b *bin.Buffer) error {
|
||||
// DecodeBare implements bin.BareDecoder.
|
||||
func (s *StarGiftAuctionStateFinished) DecodeBare(b *bin.Buffer) error {
|
||||
if s == nil {
|
||||
return fmt.Errorf("can't decode starGiftAuctionStateFinished#7d967c3a to nil")
|
||||
return fmt.Errorf("can't decode starGiftAuctionStateFinished#972dabbf to nil")
|
||||
}
|
||||
{
|
||||
if err := s.Flags.Decode(b); err != nil {
|
||||
return fmt.Errorf("unable to decode starGiftAuctionStateFinished#972dabbf: field flags: %w", err)
|
||||
}
|
||||
}
|
||||
{
|
||||
value, err := b.Int()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode starGiftAuctionStateFinished#7d967c3a: field start_date: %w", err)
|
||||
return fmt.Errorf("unable to decode starGiftAuctionStateFinished#972dabbf: field start_date: %w", err)
|
||||
}
|
||||
s.StartDate = value
|
||||
}
|
||||
{
|
||||
value, err := b.Int()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode starGiftAuctionStateFinished#7d967c3a: field end_date: %w", err)
|
||||
return fmt.Errorf("unable to decode starGiftAuctionStateFinished#972dabbf: field end_date: %w", err)
|
||||
}
|
||||
s.EndDate = value
|
||||
}
|
||||
{
|
||||
value, err := b.Long()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode starGiftAuctionStateFinished#7d967c3a: field average_price: %w", err)
|
||||
return fmt.Errorf("unable to decode starGiftAuctionStateFinished#972dabbf: field average_price: %w", err)
|
||||
}
|
||||
s.AveragePrice = value
|
||||
}
|
||||
if s.Flags.Has(0) {
|
||||
value, err := b.Int()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode starGiftAuctionStateFinished#972dabbf: field listed_count: %w", err)
|
||||
}
|
||||
s.ListedCount = value
|
||||
}
|
||||
if s.Flags.Has(1) {
|
||||
value, err := b.Int()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode starGiftAuctionStateFinished#972dabbf: field fragment_listed_count: %w", err)
|
||||
}
|
||||
s.FragmentListedCount = value
|
||||
}
|
||||
if s.Flags.Has(1) {
|
||||
value, err := b.String()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode starGiftAuctionStateFinished#972dabbf: field fragment_listed_url: %w", err)
|
||||
}
|
||||
s.FragmentListedURL = value
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -725,6 +910,60 @@ func (s *StarGiftAuctionStateFinished) GetAveragePrice() (value int64) {
|
||||
return s.AveragePrice
|
||||
}
|
||||
|
||||
// SetListedCount sets value of ListedCount conditional field.
|
||||
func (s *StarGiftAuctionStateFinished) SetListedCount(value int) {
|
||||
s.Flags.Set(0)
|
||||
s.ListedCount = value
|
||||
}
|
||||
|
||||
// GetListedCount returns value of ListedCount conditional field and
|
||||
// boolean which is true if field was set.
|
||||
func (s *StarGiftAuctionStateFinished) GetListedCount() (value int, ok bool) {
|
||||
if s == nil {
|
||||
return
|
||||
}
|
||||
if !s.Flags.Has(0) {
|
||||
return value, false
|
||||
}
|
||||
return s.ListedCount, true
|
||||
}
|
||||
|
||||
// SetFragmentListedCount sets value of FragmentListedCount conditional field.
|
||||
func (s *StarGiftAuctionStateFinished) SetFragmentListedCount(value int) {
|
||||
s.Flags.Set(1)
|
||||
s.FragmentListedCount = value
|
||||
}
|
||||
|
||||
// GetFragmentListedCount returns value of FragmentListedCount conditional field and
|
||||
// boolean which is true if field was set.
|
||||
func (s *StarGiftAuctionStateFinished) GetFragmentListedCount() (value int, ok bool) {
|
||||
if s == nil {
|
||||
return
|
||||
}
|
||||
if !s.Flags.Has(1) {
|
||||
return value, false
|
||||
}
|
||||
return s.FragmentListedCount, true
|
||||
}
|
||||
|
||||
// SetFragmentListedURL sets value of FragmentListedURL conditional field.
|
||||
func (s *StarGiftAuctionStateFinished) SetFragmentListedURL(value string) {
|
||||
s.Flags.Set(1)
|
||||
s.FragmentListedURL = value
|
||||
}
|
||||
|
||||
// GetFragmentListedURL returns value of FragmentListedURL conditional field and
|
||||
// boolean which is true if field was set.
|
||||
func (s *StarGiftAuctionStateFinished) GetFragmentListedURL() (value string, ok bool) {
|
||||
if s == nil {
|
||||
return
|
||||
}
|
||||
if !s.Flags.Has(1) {
|
||||
return value, false
|
||||
}
|
||||
return s.FragmentListedURL, true
|
||||
}
|
||||
|
||||
// StarGiftAuctionStateClassName is schema name of StarGiftAuctionStateClass.
|
||||
const StarGiftAuctionStateClassName = "StarGiftAuctionState"
|
||||
|
||||
@@ -740,8 +979,8 @@ const StarGiftAuctionStateClassName = "StarGiftAuctionState"
|
||||
// }
|
||||
// switch v := g.(type) {
|
||||
// case *tg.StarGiftAuctionStateNotModified: // starGiftAuctionStateNotModified#fe333952
|
||||
// case *tg.StarGiftAuctionState: // starGiftAuctionState#5db04f4b
|
||||
// case *tg.StarGiftAuctionStateFinished: // starGiftAuctionStateFinished#7d967c3a
|
||||
// case *tg.StarGiftAuctionState: // starGiftAuctionState#771a4e66
|
||||
// case *tg.StarGiftAuctionStateFinished: // starGiftAuctionStateFinished#972dabbf
|
||||
// default: panic(v)
|
||||
// }
|
||||
type StarGiftAuctionStateClass interface {
|
||||
@@ -825,14 +1064,14 @@ func DecodeStarGiftAuctionState(buf *bin.Buffer) (StarGiftAuctionStateClass, err
|
||||
}
|
||||
return &v, nil
|
||||
case StarGiftAuctionStateTypeID:
|
||||
// Decoding starGiftAuctionState#5db04f4b.
|
||||
// Decoding starGiftAuctionState#771a4e66.
|
||||
v := StarGiftAuctionState{}
|
||||
if err := v.Decode(buf); err != nil {
|
||||
return nil, fmt.Errorf("unable to decode StarGiftAuctionStateClass: %w", err)
|
||||
}
|
||||
return &v, nil
|
||||
case StarGiftAuctionStateFinishedTypeID:
|
||||
// Decoding starGiftAuctionStateFinished#7d967c3a.
|
||||
// Decoding starGiftAuctionStateFinished#972dabbf.
|
||||
v := StarGiftAuctionStateFinished{}
|
||||
if err := v.Decode(buf); err != nil {
|
||||
return nil, fmt.Errorf("unable to decode StarGiftAuctionStateClass: %w", err)
|
||||
|
||||
+215
@@ -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{}
|
||||
)
|
||||
|
||||
// StarGiftBackground represents TL type `starGiftBackground#aff56398`.
|
||||
//
|
||||
// See https://core.telegram.org/constructor/starGiftBackground for reference.
|
||||
type StarGiftBackground struct {
|
||||
// CenterColor field of StarGiftBackground.
|
||||
CenterColor int
|
||||
// EdgeColor field of StarGiftBackground.
|
||||
EdgeColor int
|
||||
// TextColor field of StarGiftBackground.
|
||||
TextColor int
|
||||
}
|
||||
|
||||
// StarGiftBackgroundTypeID is TL type id of StarGiftBackground.
|
||||
const StarGiftBackgroundTypeID = 0xaff56398
|
||||
|
||||
// Ensuring interfaces in compile-time for StarGiftBackground.
|
||||
var (
|
||||
_ bin.Encoder = &StarGiftBackground{}
|
||||
_ bin.Decoder = &StarGiftBackground{}
|
||||
_ bin.BareEncoder = &StarGiftBackground{}
|
||||
_ bin.BareDecoder = &StarGiftBackground{}
|
||||
)
|
||||
|
||||
func (s *StarGiftBackground) Zero() bool {
|
||||
if s == nil {
|
||||
return true
|
||||
}
|
||||
if !(s.CenterColor == 0) {
|
||||
return false
|
||||
}
|
||||
if !(s.EdgeColor == 0) {
|
||||
return false
|
||||
}
|
||||
if !(s.TextColor == 0) {
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
// String implements fmt.Stringer.
|
||||
func (s *StarGiftBackground) String() string {
|
||||
if s == nil {
|
||||
return "StarGiftBackground(nil)"
|
||||
}
|
||||
type Alias StarGiftBackground
|
||||
return fmt.Sprintf("StarGiftBackground%+v", Alias(*s))
|
||||
}
|
||||
|
||||
// FillFrom fills StarGiftBackground from given interface.
|
||||
func (s *StarGiftBackground) FillFrom(from interface {
|
||||
GetCenterColor() (value int)
|
||||
GetEdgeColor() (value int)
|
||||
GetTextColor() (value int)
|
||||
}) {
|
||||
s.CenterColor = from.GetCenterColor()
|
||||
s.EdgeColor = from.GetEdgeColor()
|
||||
s.TextColor = from.GetTextColor()
|
||||
}
|
||||
|
||||
// TypeID returns type id in TL schema.
|
||||
//
|
||||
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
||||
func (*StarGiftBackground) TypeID() uint32 {
|
||||
return StarGiftBackgroundTypeID
|
||||
}
|
||||
|
||||
// TypeName returns name of type in TL schema.
|
||||
func (*StarGiftBackground) TypeName() string {
|
||||
return "starGiftBackground"
|
||||
}
|
||||
|
||||
// TypeInfo returns info about TL type.
|
||||
func (s *StarGiftBackground) TypeInfo() tdp.Type {
|
||||
typ := tdp.Type{
|
||||
Name: "starGiftBackground",
|
||||
ID: StarGiftBackgroundTypeID,
|
||||
}
|
||||
if s == nil {
|
||||
typ.Null = true
|
||||
return typ
|
||||
}
|
||||
typ.Fields = []tdp.Field{
|
||||
{
|
||||
Name: "CenterColor",
|
||||
SchemaName: "center_color",
|
||||
},
|
||||
{
|
||||
Name: "EdgeColor",
|
||||
SchemaName: "edge_color",
|
||||
},
|
||||
{
|
||||
Name: "TextColor",
|
||||
SchemaName: "text_color",
|
||||
},
|
||||
}
|
||||
return typ
|
||||
}
|
||||
|
||||
// Encode implements bin.Encoder.
|
||||
func (s *StarGiftBackground) Encode(b *bin.Buffer) error {
|
||||
if s == nil {
|
||||
return fmt.Errorf("can't encode starGiftBackground#aff56398 as nil")
|
||||
}
|
||||
b.PutID(StarGiftBackgroundTypeID)
|
||||
return s.EncodeBare(b)
|
||||
}
|
||||
|
||||
// EncodeBare implements bin.BareEncoder.
|
||||
func (s *StarGiftBackground) EncodeBare(b *bin.Buffer) error {
|
||||
if s == nil {
|
||||
return fmt.Errorf("can't encode starGiftBackground#aff56398 as nil")
|
||||
}
|
||||
b.PutInt(s.CenterColor)
|
||||
b.PutInt(s.EdgeColor)
|
||||
b.PutInt(s.TextColor)
|
||||
return nil
|
||||
}
|
||||
|
||||
// Decode implements bin.Decoder.
|
||||
func (s *StarGiftBackground) Decode(b *bin.Buffer) error {
|
||||
if s == nil {
|
||||
return fmt.Errorf("can't decode starGiftBackground#aff56398 to nil")
|
||||
}
|
||||
if err := b.ConsumeID(StarGiftBackgroundTypeID); err != nil {
|
||||
return fmt.Errorf("unable to decode starGiftBackground#aff56398: %w", err)
|
||||
}
|
||||
return s.DecodeBare(b)
|
||||
}
|
||||
|
||||
// DecodeBare implements bin.BareDecoder.
|
||||
func (s *StarGiftBackground) DecodeBare(b *bin.Buffer) error {
|
||||
if s == nil {
|
||||
return fmt.Errorf("can't decode starGiftBackground#aff56398 to nil")
|
||||
}
|
||||
{
|
||||
value, err := b.Int()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode starGiftBackground#aff56398: field center_color: %w", err)
|
||||
}
|
||||
s.CenterColor = value
|
||||
}
|
||||
{
|
||||
value, err := b.Int()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode starGiftBackground#aff56398: field edge_color: %w", err)
|
||||
}
|
||||
s.EdgeColor = value
|
||||
}
|
||||
{
|
||||
value, err := b.Int()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode starGiftBackground#aff56398: field text_color: %w", err)
|
||||
}
|
||||
s.TextColor = value
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// GetCenterColor returns value of CenterColor field.
|
||||
func (s *StarGiftBackground) GetCenterColor() (value int) {
|
||||
if s == nil {
|
||||
return
|
||||
}
|
||||
return s.CenterColor
|
||||
}
|
||||
|
||||
// GetEdgeColor returns value of EdgeColor field.
|
||||
func (s *StarGiftBackground) GetEdgeColor() (value int) {
|
||||
if s == nil {
|
||||
return
|
||||
}
|
||||
return s.EdgeColor
|
||||
}
|
||||
|
||||
// GetTextColor returns value of TextColor field.
|
||||
func (s *StarGiftBackground) GetTextColor() (value int) {
|
||||
if s == nil {
|
||||
return
|
||||
}
|
||||
return s.TextColor
|
||||
}
|
||||
+35
@@ -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{}
|
||||
)
|
||||
Generated
+437
-79
File diff suppressed because it is too large
Load Diff
Generated
+35
@@ -90,6 +90,8 @@ type StarsTransaction struct {
|
||||
PhonegroupMessage bool
|
||||
// StargiftAuctionBid field of StarsTransaction.
|
||||
StargiftAuctionBid bool
|
||||
// Offer field of StarsTransaction.
|
||||
Offer bool
|
||||
// Transaction ID.
|
||||
ID string
|
||||
// Amount of Telegram Stars or TON.
|
||||
@@ -291,6 +293,9 @@ func (s *StarsTransaction) Zero() bool {
|
||||
if !(s.StargiftAuctionBid == false) {
|
||||
return false
|
||||
}
|
||||
if !(s.Offer == false) {
|
||||
return false
|
||||
}
|
||||
if !(s.ID == "") {
|
||||
return false
|
||||
}
|
||||
@@ -388,6 +393,7 @@ func (s *StarsTransaction) FillFrom(from interface {
|
||||
GetStargiftDropOriginalDetails() (value bool)
|
||||
GetPhonegroupMessage() (value bool)
|
||||
GetStargiftAuctionBid() (value bool)
|
||||
GetOffer() (value bool)
|
||||
GetID() (value string)
|
||||
GetAmount() (value StarsAmountClass)
|
||||
GetDate() (value int)
|
||||
@@ -425,6 +431,7 @@ func (s *StarsTransaction) FillFrom(from interface {
|
||||
s.StargiftDropOriginalDetails = from.GetStargiftDropOriginalDetails()
|
||||
s.PhonegroupMessage = from.GetPhonegroupMessage()
|
||||
s.StargiftAuctionBid = from.GetStargiftAuctionBid()
|
||||
s.Offer = from.GetOffer()
|
||||
s.ID = from.GetID()
|
||||
s.Amount = from.GetAmount()
|
||||
s.Date = from.GetDate()
|
||||
@@ -595,6 +602,11 @@ func (s *StarsTransaction) TypeInfo() tdp.Type {
|
||||
SchemaName: "stargift_auction_bid",
|
||||
Null: !s.Flags.Has(28),
|
||||
},
|
||||
{
|
||||
Name: "Offer",
|
||||
SchemaName: "offer",
|
||||
Null: !s.Flags.Has(29),
|
||||
},
|
||||
{
|
||||
Name: "ID",
|
||||
SchemaName: "id",
|
||||
@@ -751,6 +763,9 @@ func (s *StarsTransaction) SetFlags() {
|
||||
if !(s.StargiftAuctionBid == false) {
|
||||
s.Flags.Set(28)
|
||||
}
|
||||
if !(s.Offer == false) {
|
||||
s.Flags.Set(29)
|
||||
}
|
||||
if !(s.Title == "") {
|
||||
s.Flags.Set(0)
|
||||
}
|
||||
@@ -964,6 +979,7 @@ func (s *StarsTransaction) DecodeBare(b *bin.Buffer) error {
|
||||
s.StargiftDropOriginalDetails = s.Flags.Has(26)
|
||||
s.PhonegroupMessage = s.Flags.Has(27)
|
||||
s.StargiftAuctionBid = s.Flags.Has(28)
|
||||
s.Offer = s.Flags.Has(29)
|
||||
{
|
||||
value, err := b.String()
|
||||
if err != nil {
|
||||
@@ -1385,6 +1401,25 @@ func (s *StarsTransaction) GetStargiftAuctionBid() (value bool) {
|
||||
return s.Flags.Has(28)
|
||||
}
|
||||
|
||||
// SetOffer sets value of Offer conditional field.
|
||||
func (s *StarsTransaction) SetOffer(value bool) {
|
||||
if value {
|
||||
s.Flags.Set(29)
|
||||
s.Offer = true
|
||||
} else {
|
||||
s.Flags.Unset(29)
|
||||
s.Offer = false
|
||||
}
|
||||
}
|
||||
|
||||
// GetOffer returns value of Offer conditional field.
|
||||
func (s *StarsTransaction) GetOffer() (value bool) {
|
||||
if s == nil {
|
||||
return
|
||||
}
|
||||
return s.Flags.Has(29)
|
||||
}
|
||||
|
||||
// GetID returns value of ID field.
|
||||
func (s *StarsTransaction) GetID() (value string) {
|
||||
if s == nil {
|
||||
|
||||
Generated
+479
@@ -30707,6 +30707,461 @@ func (u *UpdateStarGiftAuctionUserState) GetUserState() (value StarGiftAuctionUs
|
||||
return u.UserState
|
||||
}
|
||||
|
||||
// UpdateEmojiGameInfo represents TL type `updateEmojiGameInfo#fb9c547a`.
|
||||
//
|
||||
// See https://core.telegram.org/constructor/updateEmojiGameInfo for reference.
|
||||
type UpdateEmojiGameInfo struct {
|
||||
// Info field of UpdateEmojiGameInfo.
|
||||
Info MessagesEmojiGameInfoClass
|
||||
}
|
||||
|
||||
// UpdateEmojiGameInfoTypeID is TL type id of UpdateEmojiGameInfo.
|
||||
const UpdateEmojiGameInfoTypeID = 0xfb9c547a
|
||||
|
||||
// construct implements constructor of UpdateClass.
|
||||
func (u UpdateEmojiGameInfo) construct() UpdateClass { return &u }
|
||||
|
||||
// Ensuring interfaces in compile-time for UpdateEmojiGameInfo.
|
||||
var (
|
||||
_ bin.Encoder = &UpdateEmojiGameInfo{}
|
||||
_ bin.Decoder = &UpdateEmojiGameInfo{}
|
||||
_ bin.BareEncoder = &UpdateEmojiGameInfo{}
|
||||
_ bin.BareDecoder = &UpdateEmojiGameInfo{}
|
||||
|
||||
_ UpdateClass = &UpdateEmojiGameInfo{}
|
||||
)
|
||||
|
||||
func (u *UpdateEmojiGameInfo) Zero() bool {
|
||||
if u == nil {
|
||||
return true
|
||||
}
|
||||
if !(u.Info == nil) {
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
// String implements fmt.Stringer.
|
||||
func (u *UpdateEmojiGameInfo) String() string {
|
||||
if u == nil {
|
||||
return "UpdateEmojiGameInfo(nil)"
|
||||
}
|
||||
type Alias UpdateEmojiGameInfo
|
||||
return fmt.Sprintf("UpdateEmojiGameInfo%+v", Alias(*u))
|
||||
}
|
||||
|
||||
// FillFrom fills UpdateEmojiGameInfo from given interface.
|
||||
func (u *UpdateEmojiGameInfo) FillFrom(from interface {
|
||||
GetInfo() (value MessagesEmojiGameInfoClass)
|
||||
}) {
|
||||
u.Info = from.GetInfo()
|
||||
}
|
||||
|
||||
// TypeID returns type id in TL schema.
|
||||
//
|
||||
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
||||
func (*UpdateEmojiGameInfo) TypeID() uint32 {
|
||||
return UpdateEmojiGameInfoTypeID
|
||||
}
|
||||
|
||||
// TypeName returns name of type in TL schema.
|
||||
func (*UpdateEmojiGameInfo) TypeName() string {
|
||||
return "updateEmojiGameInfo"
|
||||
}
|
||||
|
||||
// TypeInfo returns info about TL type.
|
||||
func (u *UpdateEmojiGameInfo) TypeInfo() tdp.Type {
|
||||
typ := tdp.Type{
|
||||
Name: "updateEmojiGameInfo",
|
||||
ID: UpdateEmojiGameInfoTypeID,
|
||||
}
|
||||
if u == nil {
|
||||
typ.Null = true
|
||||
return typ
|
||||
}
|
||||
typ.Fields = []tdp.Field{
|
||||
{
|
||||
Name: "Info",
|
||||
SchemaName: "info",
|
||||
},
|
||||
}
|
||||
return typ
|
||||
}
|
||||
|
||||
// Encode implements bin.Encoder.
|
||||
func (u *UpdateEmojiGameInfo) Encode(b *bin.Buffer) error {
|
||||
if u == nil {
|
||||
return fmt.Errorf("can't encode updateEmojiGameInfo#fb9c547a as nil")
|
||||
}
|
||||
b.PutID(UpdateEmojiGameInfoTypeID)
|
||||
return u.EncodeBare(b)
|
||||
}
|
||||
|
||||
// EncodeBare implements bin.BareEncoder.
|
||||
func (u *UpdateEmojiGameInfo) EncodeBare(b *bin.Buffer) error {
|
||||
if u == nil {
|
||||
return fmt.Errorf("can't encode updateEmojiGameInfo#fb9c547a as nil")
|
||||
}
|
||||
if u.Info == nil {
|
||||
return fmt.Errorf("unable to encode updateEmojiGameInfo#fb9c547a: field info is nil")
|
||||
}
|
||||
if err := u.Info.Encode(b); err != nil {
|
||||
return fmt.Errorf("unable to encode updateEmojiGameInfo#fb9c547a: field info: %w", err)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Decode implements bin.Decoder.
|
||||
func (u *UpdateEmojiGameInfo) Decode(b *bin.Buffer) error {
|
||||
if u == nil {
|
||||
return fmt.Errorf("can't decode updateEmojiGameInfo#fb9c547a to nil")
|
||||
}
|
||||
if err := b.ConsumeID(UpdateEmojiGameInfoTypeID); err != nil {
|
||||
return fmt.Errorf("unable to decode updateEmojiGameInfo#fb9c547a: %w", err)
|
||||
}
|
||||
return u.DecodeBare(b)
|
||||
}
|
||||
|
||||
// DecodeBare implements bin.BareDecoder.
|
||||
func (u *UpdateEmojiGameInfo) DecodeBare(b *bin.Buffer) error {
|
||||
if u == nil {
|
||||
return fmt.Errorf("can't decode updateEmojiGameInfo#fb9c547a to nil")
|
||||
}
|
||||
{
|
||||
value, err := DecodeMessagesEmojiGameInfo(b)
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode updateEmojiGameInfo#fb9c547a: field info: %w", err)
|
||||
}
|
||||
u.Info = value
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// GetInfo returns value of Info field.
|
||||
func (u *UpdateEmojiGameInfo) GetInfo() (value MessagesEmojiGameInfoClass) {
|
||||
if u == nil {
|
||||
return
|
||||
}
|
||||
return u.Info
|
||||
}
|
||||
|
||||
// UpdateStarGiftCraftFail represents TL type `updateStarGiftCraftFail#ac072444`.
|
||||
//
|
||||
// See https://core.telegram.org/constructor/updateStarGiftCraftFail for reference.
|
||||
type UpdateStarGiftCraftFail struct {
|
||||
}
|
||||
|
||||
// UpdateStarGiftCraftFailTypeID is TL type id of UpdateStarGiftCraftFail.
|
||||
const UpdateStarGiftCraftFailTypeID = 0xac072444
|
||||
|
||||
// construct implements constructor of UpdateClass.
|
||||
func (u UpdateStarGiftCraftFail) construct() UpdateClass { return &u }
|
||||
|
||||
// Ensuring interfaces in compile-time for UpdateStarGiftCraftFail.
|
||||
var (
|
||||
_ bin.Encoder = &UpdateStarGiftCraftFail{}
|
||||
_ bin.Decoder = &UpdateStarGiftCraftFail{}
|
||||
_ bin.BareEncoder = &UpdateStarGiftCraftFail{}
|
||||
_ bin.BareDecoder = &UpdateStarGiftCraftFail{}
|
||||
|
||||
_ UpdateClass = &UpdateStarGiftCraftFail{}
|
||||
)
|
||||
|
||||
func (u *UpdateStarGiftCraftFail) Zero() bool {
|
||||
if u == nil {
|
||||
return true
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
// String implements fmt.Stringer.
|
||||
func (u *UpdateStarGiftCraftFail) String() string {
|
||||
if u == nil {
|
||||
return "UpdateStarGiftCraftFail(nil)"
|
||||
}
|
||||
type Alias UpdateStarGiftCraftFail
|
||||
return fmt.Sprintf("UpdateStarGiftCraftFail%+v", Alias(*u))
|
||||
}
|
||||
|
||||
// TypeID returns type id in TL schema.
|
||||
//
|
||||
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
||||
func (*UpdateStarGiftCraftFail) TypeID() uint32 {
|
||||
return UpdateStarGiftCraftFailTypeID
|
||||
}
|
||||
|
||||
// TypeName returns name of type in TL schema.
|
||||
func (*UpdateStarGiftCraftFail) TypeName() string {
|
||||
return "updateStarGiftCraftFail"
|
||||
}
|
||||
|
||||
// TypeInfo returns info about TL type.
|
||||
func (u *UpdateStarGiftCraftFail) TypeInfo() tdp.Type {
|
||||
typ := tdp.Type{
|
||||
Name: "updateStarGiftCraftFail",
|
||||
ID: UpdateStarGiftCraftFailTypeID,
|
||||
}
|
||||
if u == nil {
|
||||
typ.Null = true
|
||||
return typ
|
||||
}
|
||||
typ.Fields = []tdp.Field{}
|
||||
return typ
|
||||
}
|
||||
|
||||
// Encode implements bin.Encoder.
|
||||
func (u *UpdateStarGiftCraftFail) Encode(b *bin.Buffer) error {
|
||||
if u == nil {
|
||||
return fmt.Errorf("can't encode updateStarGiftCraftFail#ac072444 as nil")
|
||||
}
|
||||
b.PutID(UpdateStarGiftCraftFailTypeID)
|
||||
return u.EncodeBare(b)
|
||||
}
|
||||
|
||||
// EncodeBare implements bin.BareEncoder.
|
||||
func (u *UpdateStarGiftCraftFail) EncodeBare(b *bin.Buffer) error {
|
||||
if u == nil {
|
||||
return fmt.Errorf("can't encode updateStarGiftCraftFail#ac072444 as nil")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Decode implements bin.Decoder.
|
||||
func (u *UpdateStarGiftCraftFail) Decode(b *bin.Buffer) error {
|
||||
if u == nil {
|
||||
return fmt.Errorf("can't decode updateStarGiftCraftFail#ac072444 to nil")
|
||||
}
|
||||
if err := b.ConsumeID(UpdateStarGiftCraftFailTypeID); err != nil {
|
||||
return fmt.Errorf("unable to decode updateStarGiftCraftFail#ac072444: %w", err)
|
||||
}
|
||||
return u.DecodeBare(b)
|
||||
}
|
||||
|
||||
// DecodeBare implements bin.BareDecoder.
|
||||
func (u *UpdateStarGiftCraftFail) DecodeBare(b *bin.Buffer) error {
|
||||
if u == nil {
|
||||
return fmt.Errorf("can't decode updateStarGiftCraftFail#ac072444 to nil")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// UpdateChatParticipantRank represents TL type `updateChatParticipantRank#bd8367b9`.
|
||||
//
|
||||
// See https://core.telegram.org/constructor/updateChatParticipantRank for reference.
|
||||
type UpdateChatParticipantRank struct {
|
||||
// ChatID field of UpdateChatParticipantRank.
|
||||
ChatID int64
|
||||
// UserID field of UpdateChatParticipantRank.
|
||||
UserID int64
|
||||
// Rank field of UpdateChatParticipantRank.
|
||||
Rank string
|
||||
// Version field of UpdateChatParticipantRank.
|
||||
Version int
|
||||
}
|
||||
|
||||
// UpdateChatParticipantRankTypeID is TL type id of UpdateChatParticipantRank.
|
||||
const UpdateChatParticipantRankTypeID = 0xbd8367b9
|
||||
|
||||
// construct implements constructor of UpdateClass.
|
||||
func (u UpdateChatParticipantRank) construct() UpdateClass { return &u }
|
||||
|
||||
// Ensuring interfaces in compile-time for UpdateChatParticipantRank.
|
||||
var (
|
||||
_ bin.Encoder = &UpdateChatParticipantRank{}
|
||||
_ bin.Decoder = &UpdateChatParticipantRank{}
|
||||
_ bin.BareEncoder = &UpdateChatParticipantRank{}
|
||||
_ bin.BareDecoder = &UpdateChatParticipantRank{}
|
||||
|
||||
_ UpdateClass = &UpdateChatParticipantRank{}
|
||||
)
|
||||
|
||||
func (u *UpdateChatParticipantRank) Zero() bool {
|
||||
if u == nil {
|
||||
return true
|
||||
}
|
||||
if !(u.ChatID == 0) {
|
||||
return false
|
||||
}
|
||||
if !(u.UserID == 0) {
|
||||
return false
|
||||
}
|
||||
if !(u.Rank == "") {
|
||||
return false
|
||||
}
|
||||
if !(u.Version == 0) {
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
// String implements fmt.Stringer.
|
||||
func (u *UpdateChatParticipantRank) String() string {
|
||||
if u == nil {
|
||||
return "UpdateChatParticipantRank(nil)"
|
||||
}
|
||||
type Alias UpdateChatParticipantRank
|
||||
return fmt.Sprintf("UpdateChatParticipantRank%+v", Alias(*u))
|
||||
}
|
||||
|
||||
// FillFrom fills UpdateChatParticipantRank from given interface.
|
||||
func (u *UpdateChatParticipantRank) FillFrom(from interface {
|
||||
GetChatID() (value int64)
|
||||
GetUserID() (value int64)
|
||||
GetRank() (value string)
|
||||
GetVersion() (value int)
|
||||
}) {
|
||||
u.ChatID = from.GetChatID()
|
||||
u.UserID = from.GetUserID()
|
||||
u.Rank = from.GetRank()
|
||||
u.Version = from.GetVersion()
|
||||
}
|
||||
|
||||
// TypeID returns type id in TL schema.
|
||||
//
|
||||
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
||||
func (*UpdateChatParticipantRank) TypeID() uint32 {
|
||||
return UpdateChatParticipantRankTypeID
|
||||
}
|
||||
|
||||
// TypeName returns name of type in TL schema.
|
||||
func (*UpdateChatParticipantRank) TypeName() string {
|
||||
return "updateChatParticipantRank"
|
||||
}
|
||||
|
||||
// TypeInfo returns info about TL type.
|
||||
func (u *UpdateChatParticipantRank) TypeInfo() tdp.Type {
|
||||
typ := tdp.Type{
|
||||
Name: "updateChatParticipantRank",
|
||||
ID: UpdateChatParticipantRankTypeID,
|
||||
}
|
||||
if u == nil {
|
||||
typ.Null = true
|
||||
return typ
|
||||
}
|
||||
typ.Fields = []tdp.Field{
|
||||
{
|
||||
Name: "ChatID",
|
||||
SchemaName: "chat_id",
|
||||
},
|
||||
{
|
||||
Name: "UserID",
|
||||
SchemaName: "user_id",
|
||||
},
|
||||
{
|
||||
Name: "Rank",
|
||||
SchemaName: "rank",
|
||||
},
|
||||
{
|
||||
Name: "Version",
|
||||
SchemaName: "version",
|
||||
},
|
||||
}
|
||||
return typ
|
||||
}
|
||||
|
||||
// Encode implements bin.Encoder.
|
||||
func (u *UpdateChatParticipantRank) Encode(b *bin.Buffer) error {
|
||||
if u == nil {
|
||||
return fmt.Errorf("can't encode updateChatParticipantRank#bd8367b9 as nil")
|
||||
}
|
||||
b.PutID(UpdateChatParticipantRankTypeID)
|
||||
return u.EncodeBare(b)
|
||||
}
|
||||
|
||||
// EncodeBare implements bin.BareEncoder.
|
||||
func (u *UpdateChatParticipantRank) EncodeBare(b *bin.Buffer) error {
|
||||
if u == nil {
|
||||
return fmt.Errorf("can't encode updateChatParticipantRank#bd8367b9 as nil")
|
||||
}
|
||||
b.PutLong(u.ChatID)
|
||||
b.PutLong(u.UserID)
|
||||
b.PutString(u.Rank)
|
||||
b.PutInt(u.Version)
|
||||
return nil
|
||||
}
|
||||
|
||||
// Decode implements bin.Decoder.
|
||||
func (u *UpdateChatParticipantRank) Decode(b *bin.Buffer) error {
|
||||
if u == nil {
|
||||
return fmt.Errorf("can't decode updateChatParticipantRank#bd8367b9 to nil")
|
||||
}
|
||||
if err := b.ConsumeID(UpdateChatParticipantRankTypeID); err != nil {
|
||||
return fmt.Errorf("unable to decode updateChatParticipantRank#bd8367b9: %w", err)
|
||||
}
|
||||
return u.DecodeBare(b)
|
||||
}
|
||||
|
||||
// DecodeBare implements bin.BareDecoder.
|
||||
func (u *UpdateChatParticipantRank) DecodeBare(b *bin.Buffer) error {
|
||||
if u == nil {
|
||||
return fmt.Errorf("can't decode updateChatParticipantRank#bd8367b9 to nil")
|
||||
}
|
||||
{
|
||||
value, err := b.Long()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode updateChatParticipantRank#bd8367b9: field chat_id: %w", err)
|
||||
}
|
||||
u.ChatID = value
|
||||
}
|
||||
{
|
||||
value, err := b.Long()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode updateChatParticipantRank#bd8367b9: field user_id: %w", err)
|
||||
}
|
||||
u.UserID = value
|
||||
}
|
||||
{
|
||||
value, err := b.String()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode updateChatParticipantRank#bd8367b9: field rank: %w", err)
|
||||
}
|
||||
u.Rank = value
|
||||
}
|
||||
{
|
||||
value, err := b.Int()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode updateChatParticipantRank#bd8367b9: field version: %w", err)
|
||||
}
|
||||
u.Version = value
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// GetChatID returns value of ChatID field.
|
||||
func (u *UpdateChatParticipantRank) GetChatID() (value int64) {
|
||||
if u == nil {
|
||||
return
|
||||
}
|
||||
return u.ChatID
|
||||
}
|
||||
|
||||
// GetUserID returns value of UserID field.
|
||||
func (u *UpdateChatParticipantRank) GetUserID() (value int64) {
|
||||
if u == nil {
|
||||
return
|
||||
}
|
||||
return u.UserID
|
||||
}
|
||||
|
||||
// GetRank returns value of Rank field.
|
||||
func (u *UpdateChatParticipantRank) GetRank() (value string) {
|
||||
if u == nil {
|
||||
return
|
||||
}
|
||||
return u.Rank
|
||||
}
|
||||
|
||||
// GetVersion returns value of Version field.
|
||||
func (u *UpdateChatParticipantRank) GetVersion() (value int) {
|
||||
if u == nil {
|
||||
return
|
||||
}
|
||||
return u.Version
|
||||
}
|
||||
|
||||
// UpdateClassName is schema name of UpdateClass.
|
||||
const UpdateClassName = "Update"
|
||||
|
||||
@@ -30871,6 +31326,9 @@ const UpdateClassName = "Update"
|
||||
// case *tg.UpdateDeleteGroupCallMessages: // updateDeleteGroupCallMessages#3e85e92c
|
||||
// case *tg.UpdateStarGiftAuctionState: // updateStarGiftAuctionState#48e246c2
|
||||
// case *tg.UpdateStarGiftAuctionUserState: // updateStarGiftAuctionUserState#dc58f31e
|
||||
// case *tg.UpdateEmojiGameInfo: // updateEmojiGameInfo#fb9c547a
|
||||
// case *tg.UpdateStarGiftCraftFail: // updateStarGiftCraftFail#ac072444
|
||||
// case *tg.UpdateChatParticipantRank: // updateChatParticipantRank#bd8367b9
|
||||
// default: panic(v)
|
||||
// }
|
||||
type UpdateClass interface {
|
||||
@@ -31949,6 +32407,27 @@ func DecodeUpdate(buf *bin.Buffer) (UpdateClass, error) {
|
||||
return nil, fmt.Errorf("unable to decode UpdateClass: %w", err)
|
||||
}
|
||||
return &v, nil
|
||||
case UpdateEmojiGameInfoTypeID:
|
||||
// Decoding updateEmojiGameInfo#fb9c547a.
|
||||
v := UpdateEmojiGameInfo{}
|
||||
if err := v.Decode(buf); err != nil {
|
||||
return nil, fmt.Errorf("unable to decode UpdateClass: %w", err)
|
||||
}
|
||||
return &v, nil
|
||||
case UpdateStarGiftCraftFailTypeID:
|
||||
// Decoding updateStarGiftCraftFail#ac072444.
|
||||
v := UpdateStarGiftCraftFail{}
|
||||
if err := v.Decode(buf); err != nil {
|
||||
return nil, fmt.Errorf("unable to decode UpdateClass: %w", err)
|
||||
}
|
||||
return &v, nil
|
||||
case UpdateChatParticipantRankTypeID:
|
||||
// Decoding updateChatParticipantRank#bd8367b9.
|
||||
v := UpdateChatParticipantRank{}
|
||||
if err := v.Decode(buf); err != nil {
|
||||
return nil, fmt.Errorf("unable to decode UpdateClass: %w", err)
|
||||
}
|
||||
return &v, nil
|
||||
default:
|
||||
return nil, fmt.Errorf("unable to decode UpdateClass: %w", bin.NewUnexpectedID(id))
|
||||
}
|
||||
|
||||
Generated
+190
@@ -1858,6 +1858,32 @@ func (s UpdateClassArray) AsUpdateStarGiftAuctionUserState() (to UpdateStarGiftA
|
||||
return to
|
||||
}
|
||||
|
||||
// AsUpdateEmojiGameInfo returns copy with only UpdateEmojiGameInfo constructors.
|
||||
func (s UpdateClassArray) AsUpdateEmojiGameInfo() (to UpdateEmojiGameInfoArray) {
|
||||
for _, elem := range s {
|
||||
value, ok := elem.(*UpdateEmojiGameInfo)
|
||||
if !ok {
|
||||
continue
|
||||
}
|
||||
to = append(to, *value)
|
||||
}
|
||||
|
||||
return to
|
||||
}
|
||||
|
||||
// AsUpdateChatParticipantRank returns copy with only UpdateChatParticipantRank constructors.
|
||||
func (s UpdateClassArray) AsUpdateChatParticipantRank() (to UpdateChatParticipantRankArray) {
|
||||
for _, elem := range s {
|
||||
value, ok := elem.(*UpdateChatParticipantRank)
|
||||
if !ok {
|
||||
continue
|
||||
}
|
||||
to = append(to, *value)
|
||||
}
|
||||
|
||||
return to
|
||||
}
|
||||
|
||||
// UpdateNewMessageArray is adapter for slice of UpdateNewMessage.
|
||||
type UpdateNewMessageArray []UpdateNewMessage
|
||||
|
||||
@@ -13111,3 +13137,167 @@ func (s *UpdateStarGiftAuctionUserStateArray) Pop() (v UpdateStarGiftAuctionUser
|
||||
|
||||
return v, true
|
||||
}
|
||||
|
||||
// UpdateEmojiGameInfoArray is adapter for slice of UpdateEmojiGameInfo.
|
||||
type UpdateEmojiGameInfoArray []UpdateEmojiGameInfo
|
||||
|
||||
// Sort sorts slice of UpdateEmojiGameInfo.
|
||||
func (s UpdateEmojiGameInfoArray) Sort(less func(a, b UpdateEmojiGameInfo) bool) UpdateEmojiGameInfoArray {
|
||||
sort.Slice(s, func(i, j int) bool {
|
||||
return less(s[i], s[j])
|
||||
})
|
||||
return s
|
||||
}
|
||||
|
||||
// SortStable sorts slice of UpdateEmojiGameInfo.
|
||||
func (s UpdateEmojiGameInfoArray) SortStable(less func(a, b UpdateEmojiGameInfo) bool) UpdateEmojiGameInfoArray {
|
||||
sort.SliceStable(s, func(i, j int) bool {
|
||||
return less(s[i], s[j])
|
||||
})
|
||||
return s
|
||||
}
|
||||
|
||||
// Retain filters in-place slice of UpdateEmojiGameInfo.
|
||||
func (s UpdateEmojiGameInfoArray) Retain(keep func(x UpdateEmojiGameInfo) bool) UpdateEmojiGameInfoArray {
|
||||
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 UpdateEmojiGameInfoArray) First() (v UpdateEmojiGameInfo, ok bool) {
|
||||
if len(s) < 1 {
|
||||
return
|
||||
}
|
||||
return s[0], true
|
||||
}
|
||||
|
||||
// Last returns last element of slice (if exists).
|
||||
func (s UpdateEmojiGameInfoArray) Last() (v UpdateEmojiGameInfo, 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 *UpdateEmojiGameInfoArray) PopFirst() (v UpdateEmojiGameInfo, 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 UpdateEmojiGameInfo
|
||||
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 *UpdateEmojiGameInfoArray) Pop() (v UpdateEmojiGameInfo, 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
|
||||
}
|
||||
|
||||
// UpdateChatParticipantRankArray is adapter for slice of UpdateChatParticipantRank.
|
||||
type UpdateChatParticipantRankArray []UpdateChatParticipantRank
|
||||
|
||||
// Sort sorts slice of UpdateChatParticipantRank.
|
||||
func (s UpdateChatParticipantRankArray) Sort(less func(a, b UpdateChatParticipantRank) bool) UpdateChatParticipantRankArray {
|
||||
sort.Slice(s, func(i, j int) bool {
|
||||
return less(s[i], s[j])
|
||||
})
|
||||
return s
|
||||
}
|
||||
|
||||
// SortStable sorts slice of UpdateChatParticipantRank.
|
||||
func (s UpdateChatParticipantRankArray) SortStable(less func(a, b UpdateChatParticipantRank) bool) UpdateChatParticipantRankArray {
|
||||
sort.SliceStable(s, func(i, j int) bool {
|
||||
return less(s[i], s[j])
|
||||
})
|
||||
return s
|
||||
}
|
||||
|
||||
// Retain filters in-place slice of UpdateChatParticipantRank.
|
||||
func (s UpdateChatParticipantRankArray) Retain(keep func(x UpdateChatParticipantRank) bool) UpdateChatParticipantRankArray {
|
||||
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 UpdateChatParticipantRankArray) First() (v UpdateChatParticipantRank, ok bool) {
|
||||
if len(s) < 1 {
|
||||
return
|
||||
}
|
||||
return s[0], true
|
||||
}
|
||||
|
||||
// Last returns last element of slice (if exists).
|
||||
func (s UpdateChatParticipantRankArray) Last() (v UpdateChatParticipantRank, 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 *UpdateChatParticipantRankArray) PopFirst() (v UpdateChatParticipantRank, 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 UpdateChatParticipantRank
|
||||
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 *UpdateChatParticipantRankArray) Pop() (v UpdateChatParticipantRank, 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
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user