move gotd fork into repo. (#111)
- update to latest telegram layer - remove some references to fields in tg.Entities that don't exist in the schema - originally added here: https://github.com/beeper/td/commit/820929062a2ba0104397bc01235ab58a9cff780e - referenced here - https://github.com/mautrix/telegramgo/commit/124f0967ed195b5a380c9bd02e170ada9710dde3 - https://github.com/mautrix/telegramgo/commit/4205047aab2e0639217148b5d125bfaab668bd8e
This commit is contained in:
@@ -0,0 +1,206 @@
|
||||
// Code generated by gotdgen, DO NOT EDIT.
|
||||
|
||||
package tdapi
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
"sort"
|
||||
"strings"
|
||||
|
||||
"go.uber.org/multierr"
|
||||
|
||||
"go.mau.fi/mautrix-telegram/pkg/gotd/bin"
|
||||
"go.mau.fi/mautrix-telegram/pkg/gotd/tdjson"
|
||||
"go.mau.fi/mautrix-telegram/pkg/gotd/tdp"
|
||||
"go.mau.fi/mautrix-telegram/pkg/gotd/tgerr"
|
||||
)
|
||||
|
||||
// No-op definition for keeping imports.
|
||||
var (
|
||||
_ = bin.Buffer{}
|
||||
_ = context.Background()
|
||||
_ = fmt.Stringer(nil)
|
||||
_ = strings.Builder{}
|
||||
_ = errors.Is
|
||||
_ = multierr.AppendInto
|
||||
_ = sort.Ints
|
||||
_ = tdp.Format
|
||||
_ = tgerr.Error{}
|
||||
_ = tdjson.Encoder{}
|
||||
)
|
||||
|
||||
// GetSavedNotificationSoundRequest represents TL type `getSavedNotificationSound#1b647917`.
|
||||
type GetSavedNotificationSoundRequest struct {
|
||||
// Identifier of the notification sound
|
||||
NotificationSoundID int64
|
||||
}
|
||||
|
||||
// GetSavedNotificationSoundRequestTypeID is TL type id of GetSavedNotificationSoundRequest.
|
||||
const GetSavedNotificationSoundRequestTypeID = 0x1b647917
|
||||
|
||||
// Ensuring interfaces in compile-time for GetSavedNotificationSoundRequest.
|
||||
var (
|
||||
_ bin.Encoder = &GetSavedNotificationSoundRequest{}
|
||||
_ bin.Decoder = &GetSavedNotificationSoundRequest{}
|
||||
_ bin.BareEncoder = &GetSavedNotificationSoundRequest{}
|
||||
_ bin.BareDecoder = &GetSavedNotificationSoundRequest{}
|
||||
)
|
||||
|
||||
func (g *GetSavedNotificationSoundRequest) Zero() bool {
|
||||
if g == nil {
|
||||
return true
|
||||
}
|
||||
if !(g.NotificationSoundID == 0) {
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
// String implements fmt.Stringer.
|
||||
func (g *GetSavedNotificationSoundRequest) String() string {
|
||||
if g == nil {
|
||||
return "GetSavedNotificationSoundRequest(nil)"
|
||||
}
|
||||
type Alias GetSavedNotificationSoundRequest
|
||||
return fmt.Sprintf("GetSavedNotificationSoundRequest%+v", Alias(*g))
|
||||
}
|
||||
|
||||
// TypeID returns type id in TL schema.
|
||||
//
|
||||
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
||||
func (*GetSavedNotificationSoundRequest) TypeID() uint32 {
|
||||
return GetSavedNotificationSoundRequestTypeID
|
||||
}
|
||||
|
||||
// TypeName returns name of type in TL schema.
|
||||
func (*GetSavedNotificationSoundRequest) TypeName() string {
|
||||
return "getSavedNotificationSound"
|
||||
}
|
||||
|
||||
// TypeInfo returns info about TL type.
|
||||
func (g *GetSavedNotificationSoundRequest) TypeInfo() tdp.Type {
|
||||
typ := tdp.Type{
|
||||
Name: "getSavedNotificationSound",
|
||||
ID: GetSavedNotificationSoundRequestTypeID,
|
||||
}
|
||||
if g == nil {
|
||||
typ.Null = true
|
||||
return typ
|
||||
}
|
||||
typ.Fields = []tdp.Field{
|
||||
{
|
||||
Name: "NotificationSoundID",
|
||||
SchemaName: "notification_sound_id",
|
||||
},
|
||||
}
|
||||
return typ
|
||||
}
|
||||
|
||||
// Encode implements bin.Encoder.
|
||||
func (g *GetSavedNotificationSoundRequest) Encode(b *bin.Buffer) error {
|
||||
if g == nil {
|
||||
return fmt.Errorf("can't encode getSavedNotificationSound#1b647917 as nil")
|
||||
}
|
||||
b.PutID(GetSavedNotificationSoundRequestTypeID)
|
||||
return g.EncodeBare(b)
|
||||
}
|
||||
|
||||
// EncodeBare implements bin.BareEncoder.
|
||||
func (g *GetSavedNotificationSoundRequest) EncodeBare(b *bin.Buffer) error {
|
||||
if g == nil {
|
||||
return fmt.Errorf("can't encode getSavedNotificationSound#1b647917 as nil")
|
||||
}
|
||||
b.PutLong(g.NotificationSoundID)
|
||||
return nil
|
||||
}
|
||||
|
||||
// Decode implements bin.Decoder.
|
||||
func (g *GetSavedNotificationSoundRequest) Decode(b *bin.Buffer) error {
|
||||
if g == nil {
|
||||
return fmt.Errorf("can't decode getSavedNotificationSound#1b647917 to nil")
|
||||
}
|
||||
if err := b.ConsumeID(GetSavedNotificationSoundRequestTypeID); err != nil {
|
||||
return fmt.Errorf("unable to decode getSavedNotificationSound#1b647917: %w", err)
|
||||
}
|
||||
return g.DecodeBare(b)
|
||||
}
|
||||
|
||||
// DecodeBare implements bin.BareDecoder.
|
||||
func (g *GetSavedNotificationSoundRequest) DecodeBare(b *bin.Buffer) error {
|
||||
if g == nil {
|
||||
return fmt.Errorf("can't decode getSavedNotificationSound#1b647917 to nil")
|
||||
}
|
||||
{
|
||||
value, err := b.Long()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode getSavedNotificationSound#1b647917: field notification_sound_id: %w", err)
|
||||
}
|
||||
g.NotificationSoundID = value
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// EncodeTDLibJSON implements tdjson.TDLibEncoder.
|
||||
func (g *GetSavedNotificationSoundRequest) EncodeTDLibJSON(b tdjson.Encoder) error {
|
||||
if g == nil {
|
||||
return fmt.Errorf("can't encode getSavedNotificationSound#1b647917 as nil")
|
||||
}
|
||||
b.ObjStart()
|
||||
b.PutID("getSavedNotificationSound")
|
||||
b.Comma()
|
||||
b.FieldStart("notification_sound_id")
|
||||
b.PutLong(g.NotificationSoundID)
|
||||
b.Comma()
|
||||
b.StripComma()
|
||||
b.ObjEnd()
|
||||
return nil
|
||||
}
|
||||
|
||||
// DecodeTDLibJSON implements tdjson.TDLibDecoder.
|
||||
func (g *GetSavedNotificationSoundRequest) DecodeTDLibJSON(b tdjson.Decoder) error {
|
||||
if g == nil {
|
||||
return fmt.Errorf("can't decode getSavedNotificationSound#1b647917 to nil")
|
||||
}
|
||||
|
||||
return b.Obj(func(b tdjson.Decoder, key []byte) error {
|
||||
switch string(key) {
|
||||
case tdjson.TypeField:
|
||||
if err := b.ConsumeID("getSavedNotificationSound"); err != nil {
|
||||
return fmt.Errorf("unable to decode getSavedNotificationSound#1b647917: %w", err)
|
||||
}
|
||||
case "notification_sound_id":
|
||||
value, err := b.Long()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode getSavedNotificationSound#1b647917: field notification_sound_id: %w", err)
|
||||
}
|
||||
g.NotificationSoundID = value
|
||||
default:
|
||||
return b.Skip()
|
||||
}
|
||||
return nil
|
||||
})
|
||||
}
|
||||
|
||||
// GetNotificationSoundID returns value of NotificationSoundID field.
|
||||
func (g *GetSavedNotificationSoundRequest) GetNotificationSoundID() (value int64) {
|
||||
if g == nil {
|
||||
return
|
||||
}
|
||||
return g.NotificationSoundID
|
||||
}
|
||||
|
||||
// GetSavedNotificationSound invokes method getSavedNotificationSound#1b647917 returning error if any.
|
||||
func (c *Client) GetSavedNotificationSound(ctx context.Context, notificationsoundid int64) (*NotificationSounds, error) {
|
||||
var result NotificationSounds
|
||||
|
||||
request := &GetSavedNotificationSoundRequest{
|
||||
NotificationSoundID: notificationsoundid,
|
||||
}
|
||||
if err := c.rpc.Invoke(ctx, request, &result); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &result, nil
|
||||
}
|
||||
Reference in New Issue
Block a user