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.6 KiB
Go
207 lines
5.6 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{}
|
|
)
|
|
|
|
// RemoveSavedNotificationSoundRequest represents TL type `removeSavedNotificationSound#e363474e`.
|
|
type RemoveSavedNotificationSoundRequest struct {
|
|
// Identifier of the notification sound
|
|
NotificationSoundID int64
|
|
}
|
|
|
|
// RemoveSavedNotificationSoundRequestTypeID is TL type id of RemoveSavedNotificationSoundRequest.
|
|
const RemoveSavedNotificationSoundRequestTypeID = 0xe363474e
|
|
|
|
// Ensuring interfaces in compile-time for RemoveSavedNotificationSoundRequest.
|
|
var (
|
|
_ bin.Encoder = &RemoveSavedNotificationSoundRequest{}
|
|
_ bin.Decoder = &RemoveSavedNotificationSoundRequest{}
|
|
_ bin.BareEncoder = &RemoveSavedNotificationSoundRequest{}
|
|
_ bin.BareDecoder = &RemoveSavedNotificationSoundRequest{}
|
|
)
|
|
|
|
func (r *RemoveSavedNotificationSoundRequest) Zero() bool {
|
|
if r == nil {
|
|
return true
|
|
}
|
|
if !(r.NotificationSoundID == 0) {
|
|
return false
|
|
}
|
|
|
|
return true
|
|
}
|
|
|
|
// String implements fmt.Stringer.
|
|
func (r *RemoveSavedNotificationSoundRequest) String() string {
|
|
if r == nil {
|
|
return "RemoveSavedNotificationSoundRequest(nil)"
|
|
}
|
|
type Alias RemoveSavedNotificationSoundRequest
|
|
return fmt.Sprintf("RemoveSavedNotificationSoundRequest%+v", Alias(*r))
|
|
}
|
|
|
|
// TypeID returns type id in TL schema.
|
|
//
|
|
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
|
func (*RemoveSavedNotificationSoundRequest) TypeID() uint32 {
|
|
return RemoveSavedNotificationSoundRequestTypeID
|
|
}
|
|
|
|
// TypeName returns name of type in TL schema.
|
|
func (*RemoveSavedNotificationSoundRequest) TypeName() string {
|
|
return "removeSavedNotificationSound"
|
|
}
|
|
|
|
// TypeInfo returns info about TL type.
|
|
func (r *RemoveSavedNotificationSoundRequest) TypeInfo() tdp.Type {
|
|
typ := tdp.Type{
|
|
Name: "removeSavedNotificationSound",
|
|
ID: RemoveSavedNotificationSoundRequestTypeID,
|
|
}
|
|
if r == nil {
|
|
typ.Null = true
|
|
return typ
|
|
}
|
|
typ.Fields = []tdp.Field{
|
|
{
|
|
Name: "NotificationSoundID",
|
|
SchemaName: "notification_sound_id",
|
|
},
|
|
}
|
|
return typ
|
|
}
|
|
|
|
// Encode implements bin.Encoder.
|
|
func (r *RemoveSavedNotificationSoundRequest) Encode(b *bin.Buffer) error {
|
|
if r == nil {
|
|
return fmt.Errorf("can't encode removeSavedNotificationSound#e363474e as nil")
|
|
}
|
|
b.PutID(RemoveSavedNotificationSoundRequestTypeID)
|
|
return r.EncodeBare(b)
|
|
}
|
|
|
|
// EncodeBare implements bin.BareEncoder.
|
|
func (r *RemoveSavedNotificationSoundRequest) EncodeBare(b *bin.Buffer) error {
|
|
if r == nil {
|
|
return fmt.Errorf("can't encode removeSavedNotificationSound#e363474e as nil")
|
|
}
|
|
b.PutLong(r.NotificationSoundID)
|
|
return nil
|
|
}
|
|
|
|
// Decode implements bin.Decoder.
|
|
func (r *RemoveSavedNotificationSoundRequest) Decode(b *bin.Buffer) error {
|
|
if r == nil {
|
|
return fmt.Errorf("can't decode removeSavedNotificationSound#e363474e to nil")
|
|
}
|
|
if err := b.ConsumeID(RemoveSavedNotificationSoundRequestTypeID); err != nil {
|
|
return fmt.Errorf("unable to decode removeSavedNotificationSound#e363474e: %w", err)
|
|
}
|
|
return r.DecodeBare(b)
|
|
}
|
|
|
|
// DecodeBare implements bin.BareDecoder.
|
|
func (r *RemoveSavedNotificationSoundRequest) DecodeBare(b *bin.Buffer) error {
|
|
if r == nil {
|
|
return fmt.Errorf("can't decode removeSavedNotificationSound#e363474e to nil")
|
|
}
|
|
{
|
|
value, err := b.Long()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode removeSavedNotificationSound#e363474e: field notification_sound_id: %w", err)
|
|
}
|
|
r.NotificationSoundID = value
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// EncodeTDLibJSON implements tdjson.TDLibEncoder.
|
|
func (r *RemoveSavedNotificationSoundRequest) EncodeTDLibJSON(b tdjson.Encoder) error {
|
|
if r == nil {
|
|
return fmt.Errorf("can't encode removeSavedNotificationSound#e363474e as nil")
|
|
}
|
|
b.ObjStart()
|
|
b.PutID("removeSavedNotificationSound")
|
|
b.Comma()
|
|
b.FieldStart("notification_sound_id")
|
|
b.PutLong(r.NotificationSoundID)
|
|
b.Comma()
|
|
b.StripComma()
|
|
b.ObjEnd()
|
|
return nil
|
|
}
|
|
|
|
// DecodeTDLibJSON implements tdjson.TDLibDecoder.
|
|
func (r *RemoveSavedNotificationSoundRequest) DecodeTDLibJSON(b tdjson.Decoder) error {
|
|
if r == nil {
|
|
return fmt.Errorf("can't decode removeSavedNotificationSound#e363474e to nil")
|
|
}
|
|
|
|
return b.Obj(func(b tdjson.Decoder, key []byte) error {
|
|
switch string(key) {
|
|
case tdjson.TypeField:
|
|
if err := b.ConsumeID("removeSavedNotificationSound"); err != nil {
|
|
return fmt.Errorf("unable to decode removeSavedNotificationSound#e363474e: %w", err)
|
|
}
|
|
case "notification_sound_id":
|
|
value, err := b.Long()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode removeSavedNotificationSound#e363474e: field notification_sound_id: %w", err)
|
|
}
|
|
r.NotificationSoundID = value
|
|
default:
|
|
return b.Skip()
|
|
}
|
|
return nil
|
|
})
|
|
}
|
|
|
|
// GetNotificationSoundID returns value of NotificationSoundID field.
|
|
func (r *RemoveSavedNotificationSoundRequest) GetNotificationSoundID() (value int64) {
|
|
if r == nil {
|
|
return
|
|
}
|
|
return r.NotificationSoundID
|
|
}
|
|
|
|
// RemoveSavedNotificationSound invokes method removeSavedNotificationSound#e363474e returning error if any.
|
|
func (c *Client) RemoveSavedNotificationSound(ctx context.Context, notificationsoundid int64) error {
|
|
var ok Ok
|
|
|
|
request := &RemoveSavedNotificationSoundRequest{
|
|
NotificationSoundID: notificationsoundid,
|
|
}
|
|
if err := c.rpc.Invoke(ctx, request, &ok); err != nil {
|
|
return err
|
|
}
|
|
return nil
|
|
}
|