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
272 lines
6.6 KiB
Go
272 lines
6.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{}
|
|
)
|
|
|
|
// EditStoryCoverRequest represents TL type `editStoryCover#c242975e`.
|
|
type EditStoryCoverRequest struct {
|
|
// Identifier of the chat that posted the story
|
|
StoryPosterChatID int64
|
|
// Identifier of the story to edit
|
|
StoryID int32
|
|
// New timestamp of the frame, which will be used as video thumbnail
|
|
CoverFrameTimestamp float64
|
|
}
|
|
|
|
// EditStoryCoverRequestTypeID is TL type id of EditStoryCoverRequest.
|
|
const EditStoryCoverRequestTypeID = 0xc242975e
|
|
|
|
// Ensuring interfaces in compile-time for EditStoryCoverRequest.
|
|
var (
|
|
_ bin.Encoder = &EditStoryCoverRequest{}
|
|
_ bin.Decoder = &EditStoryCoverRequest{}
|
|
_ bin.BareEncoder = &EditStoryCoverRequest{}
|
|
_ bin.BareDecoder = &EditStoryCoverRequest{}
|
|
)
|
|
|
|
func (e *EditStoryCoverRequest) Zero() bool {
|
|
if e == nil {
|
|
return true
|
|
}
|
|
if !(e.StoryPosterChatID == 0) {
|
|
return false
|
|
}
|
|
if !(e.StoryID == 0) {
|
|
return false
|
|
}
|
|
if !(e.CoverFrameTimestamp == 0) {
|
|
return false
|
|
}
|
|
|
|
return true
|
|
}
|
|
|
|
// String implements fmt.Stringer.
|
|
func (e *EditStoryCoverRequest) String() string {
|
|
if e == nil {
|
|
return "EditStoryCoverRequest(nil)"
|
|
}
|
|
type Alias EditStoryCoverRequest
|
|
return fmt.Sprintf("EditStoryCoverRequest%+v", Alias(*e))
|
|
}
|
|
|
|
// TypeID returns type id in TL schema.
|
|
//
|
|
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
|
func (*EditStoryCoverRequest) TypeID() uint32 {
|
|
return EditStoryCoverRequestTypeID
|
|
}
|
|
|
|
// TypeName returns name of type in TL schema.
|
|
func (*EditStoryCoverRequest) TypeName() string {
|
|
return "editStoryCover"
|
|
}
|
|
|
|
// TypeInfo returns info about TL type.
|
|
func (e *EditStoryCoverRequest) TypeInfo() tdp.Type {
|
|
typ := tdp.Type{
|
|
Name: "editStoryCover",
|
|
ID: EditStoryCoverRequestTypeID,
|
|
}
|
|
if e == nil {
|
|
typ.Null = true
|
|
return typ
|
|
}
|
|
typ.Fields = []tdp.Field{
|
|
{
|
|
Name: "StoryPosterChatID",
|
|
SchemaName: "story_poster_chat_id",
|
|
},
|
|
{
|
|
Name: "StoryID",
|
|
SchemaName: "story_id",
|
|
},
|
|
{
|
|
Name: "CoverFrameTimestamp",
|
|
SchemaName: "cover_frame_timestamp",
|
|
},
|
|
}
|
|
return typ
|
|
}
|
|
|
|
// Encode implements bin.Encoder.
|
|
func (e *EditStoryCoverRequest) Encode(b *bin.Buffer) error {
|
|
if e == nil {
|
|
return fmt.Errorf("can't encode editStoryCover#c242975e as nil")
|
|
}
|
|
b.PutID(EditStoryCoverRequestTypeID)
|
|
return e.EncodeBare(b)
|
|
}
|
|
|
|
// EncodeBare implements bin.BareEncoder.
|
|
func (e *EditStoryCoverRequest) EncodeBare(b *bin.Buffer) error {
|
|
if e == nil {
|
|
return fmt.Errorf("can't encode editStoryCover#c242975e as nil")
|
|
}
|
|
b.PutInt53(e.StoryPosterChatID)
|
|
b.PutInt32(e.StoryID)
|
|
b.PutDouble(e.CoverFrameTimestamp)
|
|
return nil
|
|
}
|
|
|
|
// Decode implements bin.Decoder.
|
|
func (e *EditStoryCoverRequest) Decode(b *bin.Buffer) error {
|
|
if e == nil {
|
|
return fmt.Errorf("can't decode editStoryCover#c242975e to nil")
|
|
}
|
|
if err := b.ConsumeID(EditStoryCoverRequestTypeID); err != nil {
|
|
return fmt.Errorf("unable to decode editStoryCover#c242975e: %w", err)
|
|
}
|
|
return e.DecodeBare(b)
|
|
}
|
|
|
|
// DecodeBare implements bin.BareDecoder.
|
|
func (e *EditStoryCoverRequest) DecodeBare(b *bin.Buffer) error {
|
|
if e == nil {
|
|
return fmt.Errorf("can't decode editStoryCover#c242975e to nil")
|
|
}
|
|
{
|
|
value, err := b.Int53()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode editStoryCover#c242975e: field story_poster_chat_id: %w", err)
|
|
}
|
|
e.StoryPosterChatID = value
|
|
}
|
|
{
|
|
value, err := b.Int32()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode editStoryCover#c242975e: field story_id: %w", err)
|
|
}
|
|
e.StoryID = value
|
|
}
|
|
{
|
|
value, err := b.Double()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode editStoryCover#c242975e: field cover_frame_timestamp: %w", err)
|
|
}
|
|
e.CoverFrameTimestamp = value
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// EncodeTDLibJSON implements tdjson.TDLibEncoder.
|
|
func (e *EditStoryCoverRequest) EncodeTDLibJSON(b tdjson.Encoder) error {
|
|
if e == nil {
|
|
return fmt.Errorf("can't encode editStoryCover#c242975e as nil")
|
|
}
|
|
b.ObjStart()
|
|
b.PutID("editStoryCover")
|
|
b.Comma()
|
|
b.FieldStart("story_poster_chat_id")
|
|
b.PutInt53(e.StoryPosterChatID)
|
|
b.Comma()
|
|
b.FieldStart("story_id")
|
|
b.PutInt32(e.StoryID)
|
|
b.Comma()
|
|
b.FieldStart("cover_frame_timestamp")
|
|
b.PutDouble(e.CoverFrameTimestamp)
|
|
b.Comma()
|
|
b.StripComma()
|
|
b.ObjEnd()
|
|
return nil
|
|
}
|
|
|
|
// DecodeTDLibJSON implements tdjson.TDLibDecoder.
|
|
func (e *EditStoryCoverRequest) DecodeTDLibJSON(b tdjson.Decoder) error {
|
|
if e == nil {
|
|
return fmt.Errorf("can't decode editStoryCover#c242975e to nil")
|
|
}
|
|
|
|
return b.Obj(func(b tdjson.Decoder, key []byte) error {
|
|
switch string(key) {
|
|
case tdjson.TypeField:
|
|
if err := b.ConsumeID("editStoryCover"); err != nil {
|
|
return fmt.Errorf("unable to decode editStoryCover#c242975e: %w", err)
|
|
}
|
|
case "story_poster_chat_id":
|
|
value, err := b.Int53()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode editStoryCover#c242975e: field story_poster_chat_id: %w", err)
|
|
}
|
|
e.StoryPosterChatID = value
|
|
case "story_id":
|
|
value, err := b.Int32()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode editStoryCover#c242975e: field story_id: %w", err)
|
|
}
|
|
e.StoryID = value
|
|
case "cover_frame_timestamp":
|
|
value, err := b.Double()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode editStoryCover#c242975e: field cover_frame_timestamp: %w", err)
|
|
}
|
|
e.CoverFrameTimestamp = value
|
|
default:
|
|
return b.Skip()
|
|
}
|
|
return nil
|
|
})
|
|
}
|
|
|
|
// GetStoryPosterChatID returns value of StoryPosterChatID field.
|
|
func (e *EditStoryCoverRequest) GetStoryPosterChatID() (value int64) {
|
|
if e == nil {
|
|
return
|
|
}
|
|
return e.StoryPosterChatID
|
|
}
|
|
|
|
// GetStoryID returns value of StoryID field.
|
|
func (e *EditStoryCoverRequest) GetStoryID() (value int32) {
|
|
if e == nil {
|
|
return
|
|
}
|
|
return e.StoryID
|
|
}
|
|
|
|
// GetCoverFrameTimestamp returns value of CoverFrameTimestamp field.
|
|
func (e *EditStoryCoverRequest) GetCoverFrameTimestamp() (value float64) {
|
|
if e == nil {
|
|
return
|
|
}
|
|
return e.CoverFrameTimestamp
|
|
}
|
|
|
|
// EditStoryCover invokes method editStoryCover#c242975e returning error if any.
|
|
func (c *Client) EditStoryCover(ctx context.Context, request *EditStoryCoverRequest) error {
|
|
var ok Ok
|
|
|
|
if err := c.rpc.Invoke(ctx, request, &ok); err != nil {
|
|
return err
|
|
}
|
|
return nil
|
|
}
|