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{}
|
||||
)
|
||||
|
||||
// ViewSponsoredChatRequest represents TL type `viewSponsoredChat#66ad792a`.
|
||||
type ViewSponsoredChatRequest struct {
|
||||
// Unique identifier of the sponsored chat
|
||||
SponsoredChatUniqueID int64
|
||||
}
|
||||
|
||||
// ViewSponsoredChatRequestTypeID is TL type id of ViewSponsoredChatRequest.
|
||||
const ViewSponsoredChatRequestTypeID = 0x66ad792a
|
||||
|
||||
// Ensuring interfaces in compile-time for ViewSponsoredChatRequest.
|
||||
var (
|
||||
_ bin.Encoder = &ViewSponsoredChatRequest{}
|
||||
_ bin.Decoder = &ViewSponsoredChatRequest{}
|
||||
_ bin.BareEncoder = &ViewSponsoredChatRequest{}
|
||||
_ bin.BareDecoder = &ViewSponsoredChatRequest{}
|
||||
)
|
||||
|
||||
func (v *ViewSponsoredChatRequest) Zero() bool {
|
||||
if v == nil {
|
||||
return true
|
||||
}
|
||||
if !(v.SponsoredChatUniqueID == 0) {
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
// String implements fmt.Stringer.
|
||||
func (v *ViewSponsoredChatRequest) String() string {
|
||||
if v == nil {
|
||||
return "ViewSponsoredChatRequest(nil)"
|
||||
}
|
||||
type Alias ViewSponsoredChatRequest
|
||||
return fmt.Sprintf("ViewSponsoredChatRequest%+v", Alias(*v))
|
||||
}
|
||||
|
||||
// TypeID returns type id in TL schema.
|
||||
//
|
||||
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
||||
func (*ViewSponsoredChatRequest) TypeID() uint32 {
|
||||
return ViewSponsoredChatRequestTypeID
|
||||
}
|
||||
|
||||
// TypeName returns name of type in TL schema.
|
||||
func (*ViewSponsoredChatRequest) TypeName() string {
|
||||
return "viewSponsoredChat"
|
||||
}
|
||||
|
||||
// TypeInfo returns info about TL type.
|
||||
func (v *ViewSponsoredChatRequest) TypeInfo() tdp.Type {
|
||||
typ := tdp.Type{
|
||||
Name: "viewSponsoredChat",
|
||||
ID: ViewSponsoredChatRequestTypeID,
|
||||
}
|
||||
if v == nil {
|
||||
typ.Null = true
|
||||
return typ
|
||||
}
|
||||
typ.Fields = []tdp.Field{
|
||||
{
|
||||
Name: "SponsoredChatUniqueID",
|
||||
SchemaName: "sponsored_chat_unique_id",
|
||||
},
|
||||
}
|
||||
return typ
|
||||
}
|
||||
|
||||
// Encode implements bin.Encoder.
|
||||
func (v *ViewSponsoredChatRequest) Encode(b *bin.Buffer) error {
|
||||
if v == nil {
|
||||
return fmt.Errorf("can't encode viewSponsoredChat#66ad792a as nil")
|
||||
}
|
||||
b.PutID(ViewSponsoredChatRequestTypeID)
|
||||
return v.EncodeBare(b)
|
||||
}
|
||||
|
||||
// EncodeBare implements bin.BareEncoder.
|
||||
func (v *ViewSponsoredChatRequest) EncodeBare(b *bin.Buffer) error {
|
||||
if v == nil {
|
||||
return fmt.Errorf("can't encode viewSponsoredChat#66ad792a as nil")
|
||||
}
|
||||
b.PutInt53(v.SponsoredChatUniqueID)
|
||||
return nil
|
||||
}
|
||||
|
||||
// Decode implements bin.Decoder.
|
||||
func (v *ViewSponsoredChatRequest) Decode(b *bin.Buffer) error {
|
||||
if v == nil {
|
||||
return fmt.Errorf("can't decode viewSponsoredChat#66ad792a to nil")
|
||||
}
|
||||
if err := b.ConsumeID(ViewSponsoredChatRequestTypeID); err != nil {
|
||||
return fmt.Errorf("unable to decode viewSponsoredChat#66ad792a: %w", err)
|
||||
}
|
||||
return v.DecodeBare(b)
|
||||
}
|
||||
|
||||
// DecodeBare implements bin.BareDecoder.
|
||||
func (v *ViewSponsoredChatRequest) DecodeBare(b *bin.Buffer) error {
|
||||
if v == nil {
|
||||
return fmt.Errorf("can't decode viewSponsoredChat#66ad792a to nil")
|
||||
}
|
||||
{
|
||||
value, err := b.Int53()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode viewSponsoredChat#66ad792a: field sponsored_chat_unique_id: %w", err)
|
||||
}
|
||||
v.SponsoredChatUniqueID = value
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// EncodeTDLibJSON implements tdjson.TDLibEncoder.
|
||||
func (v *ViewSponsoredChatRequest) EncodeTDLibJSON(b tdjson.Encoder) error {
|
||||
if v == nil {
|
||||
return fmt.Errorf("can't encode viewSponsoredChat#66ad792a as nil")
|
||||
}
|
||||
b.ObjStart()
|
||||
b.PutID("viewSponsoredChat")
|
||||
b.Comma()
|
||||
b.FieldStart("sponsored_chat_unique_id")
|
||||
b.PutInt53(v.SponsoredChatUniqueID)
|
||||
b.Comma()
|
||||
b.StripComma()
|
||||
b.ObjEnd()
|
||||
return nil
|
||||
}
|
||||
|
||||
// DecodeTDLibJSON implements tdjson.TDLibDecoder.
|
||||
func (v *ViewSponsoredChatRequest) DecodeTDLibJSON(b tdjson.Decoder) error {
|
||||
if v == nil {
|
||||
return fmt.Errorf("can't decode viewSponsoredChat#66ad792a to nil")
|
||||
}
|
||||
|
||||
return b.Obj(func(b tdjson.Decoder, key []byte) error {
|
||||
switch string(key) {
|
||||
case tdjson.TypeField:
|
||||
if err := b.ConsumeID("viewSponsoredChat"); err != nil {
|
||||
return fmt.Errorf("unable to decode viewSponsoredChat#66ad792a: %w", err)
|
||||
}
|
||||
case "sponsored_chat_unique_id":
|
||||
value, err := b.Int53()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode viewSponsoredChat#66ad792a: field sponsored_chat_unique_id: %w", err)
|
||||
}
|
||||
v.SponsoredChatUniqueID = value
|
||||
default:
|
||||
return b.Skip()
|
||||
}
|
||||
return nil
|
||||
})
|
||||
}
|
||||
|
||||
// GetSponsoredChatUniqueID returns value of SponsoredChatUniqueID field.
|
||||
func (v *ViewSponsoredChatRequest) GetSponsoredChatUniqueID() (value int64) {
|
||||
if v == nil {
|
||||
return
|
||||
}
|
||||
return v.SponsoredChatUniqueID
|
||||
}
|
||||
|
||||
// ViewSponsoredChat invokes method viewSponsoredChat#66ad792a returning error if any.
|
||||
func (c *Client) ViewSponsoredChat(ctx context.Context, sponsoredchatuniqueid int64) error {
|
||||
var ok Ok
|
||||
|
||||
request := &ViewSponsoredChatRequest{
|
||||
SponsoredChatUniqueID: sponsoredchatuniqueid,
|
||||
}
|
||||
if err := c.rpc.Invoke(ctx, request, &ok); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
Reference in New Issue
Block a user