7a04f298d2
- update to latest telegram layer - remove some references to fields in tg.Entities that don't exist in the schema - originally added here: https://github.com/beeper/td/commit/820929062a2ba0104397bc01235ab58a9cff780e - referenced here - https://github.com/mautrix/telegramgo/commit/124f0967ed195b5a380c9bd02e170ada9710dde3 - https://github.com/mautrix/telegramgo/commit/4205047aab2e0639217148b5d125bfaab668bd8e
207 lines
5.0 KiB
Go
207 lines
5.0 KiB
Go
// Code generated by gotdgen, DO NOT EDIT.
|
|
|
|
package tdapi
|
|
|
|
import (
|
|
"context"
|
|
"errors"
|
|
"fmt"
|
|
"sort"
|
|
"strings"
|
|
|
|
"go.uber.org/multierr"
|
|
|
|
"go.mau.fi/mautrix-telegram/pkg/gotd/bin"
|
|
"go.mau.fi/mautrix-telegram/pkg/gotd/tdjson"
|
|
"go.mau.fi/mautrix-telegram/pkg/gotd/tdp"
|
|
"go.mau.fi/mautrix-telegram/pkg/gotd/tgerr"
|
|
)
|
|
|
|
// No-op definition for keeping imports.
|
|
var (
|
|
_ = bin.Buffer{}
|
|
_ = context.Background()
|
|
_ = fmt.Stringer(nil)
|
|
_ = strings.Builder{}
|
|
_ = errors.Is
|
|
_ = multierr.AppendInto
|
|
_ = sort.Ints
|
|
_ = tdp.Format
|
|
_ = tgerr.Error{}
|
|
_ = tdjson.Encoder{}
|
|
)
|
|
|
|
// SetGiftSettingsRequest represents TL type `setGiftSettings#e10ba702`.
|
|
type SetGiftSettingsRequest struct {
|
|
// The new settings
|
|
Settings GiftSettings
|
|
}
|
|
|
|
// SetGiftSettingsRequestTypeID is TL type id of SetGiftSettingsRequest.
|
|
const SetGiftSettingsRequestTypeID = 0xe10ba702
|
|
|
|
// Ensuring interfaces in compile-time for SetGiftSettingsRequest.
|
|
var (
|
|
_ bin.Encoder = &SetGiftSettingsRequest{}
|
|
_ bin.Decoder = &SetGiftSettingsRequest{}
|
|
_ bin.BareEncoder = &SetGiftSettingsRequest{}
|
|
_ bin.BareDecoder = &SetGiftSettingsRequest{}
|
|
)
|
|
|
|
func (s *SetGiftSettingsRequest) Zero() bool {
|
|
if s == nil {
|
|
return true
|
|
}
|
|
if !(s.Settings.Zero()) {
|
|
return false
|
|
}
|
|
|
|
return true
|
|
}
|
|
|
|
// String implements fmt.Stringer.
|
|
func (s *SetGiftSettingsRequest) String() string {
|
|
if s == nil {
|
|
return "SetGiftSettingsRequest(nil)"
|
|
}
|
|
type Alias SetGiftSettingsRequest
|
|
return fmt.Sprintf("SetGiftSettingsRequest%+v", Alias(*s))
|
|
}
|
|
|
|
// TypeID returns type id in TL schema.
|
|
//
|
|
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
|
func (*SetGiftSettingsRequest) TypeID() uint32 {
|
|
return SetGiftSettingsRequestTypeID
|
|
}
|
|
|
|
// TypeName returns name of type in TL schema.
|
|
func (*SetGiftSettingsRequest) TypeName() string {
|
|
return "setGiftSettings"
|
|
}
|
|
|
|
// TypeInfo returns info about TL type.
|
|
func (s *SetGiftSettingsRequest) TypeInfo() tdp.Type {
|
|
typ := tdp.Type{
|
|
Name: "setGiftSettings",
|
|
ID: SetGiftSettingsRequestTypeID,
|
|
}
|
|
if s == nil {
|
|
typ.Null = true
|
|
return typ
|
|
}
|
|
typ.Fields = []tdp.Field{
|
|
{
|
|
Name: "Settings",
|
|
SchemaName: "settings",
|
|
},
|
|
}
|
|
return typ
|
|
}
|
|
|
|
// Encode implements bin.Encoder.
|
|
func (s *SetGiftSettingsRequest) Encode(b *bin.Buffer) error {
|
|
if s == nil {
|
|
return fmt.Errorf("can't encode setGiftSettings#e10ba702 as nil")
|
|
}
|
|
b.PutID(SetGiftSettingsRequestTypeID)
|
|
return s.EncodeBare(b)
|
|
}
|
|
|
|
// EncodeBare implements bin.BareEncoder.
|
|
func (s *SetGiftSettingsRequest) EncodeBare(b *bin.Buffer) error {
|
|
if s == nil {
|
|
return fmt.Errorf("can't encode setGiftSettings#e10ba702 as nil")
|
|
}
|
|
if err := s.Settings.Encode(b); err != nil {
|
|
return fmt.Errorf("unable to encode setGiftSettings#e10ba702: field settings: %w", err)
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// Decode implements bin.Decoder.
|
|
func (s *SetGiftSettingsRequest) Decode(b *bin.Buffer) error {
|
|
if s == nil {
|
|
return fmt.Errorf("can't decode setGiftSettings#e10ba702 to nil")
|
|
}
|
|
if err := b.ConsumeID(SetGiftSettingsRequestTypeID); err != nil {
|
|
return fmt.Errorf("unable to decode setGiftSettings#e10ba702: %w", err)
|
|
}
|
|
return s.DecodeBare(b)
|
|
}
|
|
|
|
// DecodeBare implements bin.BareDecoder.
|
|
func (s *SetGiftSettingsRequest) DecodeBare(b *bin.Buffer) error {
|
|
if s == nil {
|
|
return fmt.Errorf("can't decode setGiftSettings#e10ba702 to nil")
|
|
}
|
|
{
|
|
if err := s.Settings.Decode(b); err != nil {
|
|
return fmt.Errorf("unable to decode setGiftSettings#e10ba702: field settings: %w", err)
|
|
}
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// EncodeTDLibJSON implements tdjson.TDLibEncoder.
|
|
func (s *SetGiftSettingsRequest) EncodeTDLibJSON(b tdjson.Encoder) error {
|
|
if s == nil {
|
|
return fmt.Errorf("can't encode setGiftSettings#e10ba702 as nil")
|
|
}
|
|
b.ObjStart()
|
|
b.PutID("setGiftSettings")
|
|
b.Comma()
|
|
b.FieldStart("settings")
|
|
if err := s.Settings.EncodeTDLibJSON(b); err != nil {
|
|
return fmt.Errorf("unable to encode setGiftSettings#e10ba702: field settings: %w", err)
|
|
}
|
|
b.Comma()
|
|
b.StripComma()
|
|
b.ObjEnd()
|
|
return nil
|
|
}
|
|
|
|
// DecodeTDLibJSON implements tdjson.TDLibDecoder.
|
|
func (s *SetGiftSettingsRequest) DecodeTDLibJSON(b tdjson.Decoder) error {
|
|
if s == nil {
|
|
return fmt.Errorf("can't decode setGiftSettings#e10ba702 to nil")
|
|
}
|
|
|
|
return b.Obj(func(b tdjson.Decoder, key []byte) error {
|
|
switch string(key) {
|
|
case tdjson.TypeField:
|
|
if err := b.ConsumeID("setGiftSettings"); err != nil {
|
|
return fmt.Errorf("unable to decode setGiftSettings#e10ba702: %w", err)
|
|
}
|
|
case "settings":
|
|
if err := s.Settings.DecodeTDLibJSON(b); err != nil {
|
|
return fmt.Errorf("unable to decode setGiftSettings#e10ba702: field settings: %w", err)
|
|
}
|
|
default:
|
|
return b.Skip()
|
|
}
|
|
return nil
|
|
})
|
|
}
|
|
|
|
// GetSettings returns value of Settings field.
|
|
func (s *SetGiftSettingsRequest) GetSettings() (value GiftSettings) {
|
|
if s == nil {
|
|
return
|
|
}
|
|
return s.Settings
|
|
}
|
|
|
|
// SetGiftSettings invokes method setGiftSettings#e10ba702 returning error if any.
|
|
func (c *Client) SetGiftSettings(ctx context.Context, settings GiftSettings) error {
|
|
var ok Ok
|
|
|
|
request := &SetGiftSettingsRequest{
|
|
Settings: settings,
|
|
}
|
|
if err := c.rpc.Invoke(ctx, request, &ok); err != nil {
|
|
return err
|
|
}
|
|
return nil
|
|
}
|