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
238 lines
5.8 KiB
Go
238 lines
5.8 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{}
|
|
)
|
|
|
|
// RefundStarPaymentRequest represents TL type `refundStarPayment#9476a055`.
|
|
type RefundStarPaymentRequest struct {
|
|
// Identifier of the user that did the payment
|
|
UserID int64
|
|
// Telegram payment identifier
|
|
TelegramPaymentChargeID string
|
|
}
|
|
|
|
// RefundStarPaymentRequestTypeID is TL type id of RefundStarPaymentRequest.
|
|
const RefundStarPaymentRequestTypeID = 0x9476a055
|
|
|
|
// Ensuring interfaces in compile-time for RefundStarPaymentRequest.
|
|
var (
|
|
_ bin.Encoder = &RefundStarPaymentRequest{}
|
|
_ bin.Decoder = &RefundStarPaymentRequest{}
|
|
_ bin.BareEncoder = &RefundStarPaymentRequest{}
|
|
_ bin.BareDecoder = &RefundStarPaymentRequest{}
|
|
)
|
|
|
|
func (r *RefundStarPaymentRequest) Zero() bool {
|
|
if r == nil {
|
|
return true
|
|
}
|
|
if !(r.UserID == 0) {
|
|
return false
|
|
}
|
|
if !(r.TelegramPaymentChargeID == "") {
|
|
return false
|
|
}
|
|
|
|
return true
|
|
}
|
|
|
|
// String implements fmt.Stringer.
|
|
func (r *RefundStarPaymentRequest) String() string {
|
|
if r == nil {
|
|
return "RefundStarPaymentRequest(nil)"
|
|
}
|
|
type Alias RefundStarPaymentRequest
|
|
return fmt.Sprintf("RefundStarPaymentRequest%+v", Alias(*r))
|
|
}
|
|
|
|
// TypeID returns type id in TL schema.
|
|
//
|
|
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
|
func (*RefundStarPaymentRequest) TypeID() uint32 {
|
|
return RefundStarPaymentRequestTypeID
|
|
}
|
|
|
|
// TypeName returns name of type in TL schema.
|
|
func (*RefundStarPaymentRequest) TypeName() string {
|
|
return "refundStarPayment"
|
|
}
|
|
|
|
// TypeInfo returns info about TL type.
|
|
func (r *RefundStarPaymentRequest) TypeInfo() tdp.Type {
|
|
typ := tdp.Type{
|
|
Name: "refundStarPayment",
|
|
ID: RefundStarPaymentRequestTypeID,
|
|
}
|
|
if r == nil {
|
|
typ.Null = true
|
|
return typ
|
|
}
|
|
typ.Fields = []tdp.Field{
|
|
{
|
|
Name: "UserID",
|
|
SchemaName: "user_id",
|
|
},
|
|
{
|
|
Name: "TelegramPaymentChargeID",
|
|
SchemaName: "telegram_payment_charge_id",
|
|
},
|
|
}
|
|
return typ
|
|
}
|
|
|
|
// Encode implements bin.Encoder.
|
|
func (r *RefundStarPaymentRequest) Encode(b *bin.Buffer) error {
|
|
if r == nil {
|
|
return fmt.Errorf("can't encode refundStarPayment#9476a055 as nil")
|
|
}
|
|
b.PutID(RefundStarPaymentRequestTypeID)
|
|
return r.EncodeBare(b)
|
|
}
|
|
|
|
// EncodeBare implements bin.BareEncoder.
|
|
func (r *RefundStarPaymentRequest) EncodeBare(b *bin.Buffer) error {
|
|
if r == nil {
|
|
return fmt.Errorf("can't encode refundStarPayment#9476a055 as nil")
|
|
}
|
|
b.PutInt53(r.UserID)
|
|
b.PutString(r.TelegramPaymentChargeID)
|
|
return nil
|
|
}
|
|
|
|
// Decode implements bin.Decoder.
|
|
func (r *RefundStarPaymentRequest) Decode(b *bin.Buffer) error {
|
|
if r == nil {
|
|
return fmt.Errorf("can't decode refundStarPayment#9476a055 to nil")
|
|
}
|
|
if err := b.ConsumeID(RefundStarPaymentRequestTypeID); err != nil {
|
|
return fmt.Errorf("unable to decode refundStarPayment#9476a055: %w", err)
|
|
}
|
|
return r.DecodeBare(b)
|
|
}
|
|
|
|
// DecodeBare implements bin.BareDecoder.
|
|
func (r *RefundStarPaymentRequest) DecodeBare(b *bin.Buffer) error {
|
|
if r == nil {
|
|
return fmt.Errorf("can't decode refundStarPayment#9476a055 to nil")
|
|
}
|
|
{
|
|
value, err := b.Int53()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode refundStarPayment#9476a055: field user_id: %w", err)
|
|
}
|
|
r.UserID = value
|
|
}
|
|
{
|
|
value, err := b.String()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode refundStarPayment#9476a055: field telegram_payment_charge_id: %w", err)
|
|
}
|
|
r.TelegramPaymentChargeID = value
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// EncodeTDLibJSON implements tdjson.TDLibEncoder.
|
|
func (r *RefundStarPaymentRequest) EncodeTDLibJSON(b tdjson.Encoder) error {
|
|
if r == nil {
|
|
return fmt.Errorf("can't encode refundStarPayment#9476a055 as nil")
|
|
}
|
|
b.ObjStart()
|
|
b.PutID("refundStarPayment")
|
|
b.Comma()
|
|
b.FieldStart("user_id")
|
|
b.PutInt53(r.UserID)
|
|
b.Comma()
|
|
b.FieldStart("telegram_payment_charge_id")
|
|
b.PutString(r.TelegramPaymentChargeID)
|
|
b.Comma()
|
|
b.StripComma()
|
|
b.ObjEnd()
|
|
return nil
|
|
}
|
|
|
|
// DecodeTDLibJSON implements tdjson.TDLibDecoder.
|
|
func (r *RefundStarPaymentRequest) DecodeTDLibJSON(b tdjson.Decoder) error {
|
|
if r == nil {
|
|
return fmt.Errorf("can't decode refundStarPayment#9476a055 to nil")
|
|
}
|
|
|
|
return b.Obj(func(b tdjson.Decoder, key []byte) error {
|
|
switch string(key) {
|
|
case tdjson.TypeField:
|
|
if err := b.ConsumeID("refundStarPayment"); err != nil {
|
|
return fmt.Errorf("unable to decode refundStarPayment#9476a055: %w", err)
|
|
}
|
|
case "user_id":
|
|
value, err := b.Int53()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode refundStarPayment#9476a055: field user_id: %w", err)
|
|
}
|
|
r.UserID = value
|
|
case "telegram_payment_charge_id":
|
|
value, err := b.String()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode refundStarPayment#9476a055: field telegram_payment_charge_id: %w", err)
|
|
}
|
|
r.TelegramPaymentChargeID = value
|
|
default:
|
|
return b.Skip()
|
|
}
|
|
return nil
|
|
})
|
|
}
|
|
|
|
// GetUserID returns value of UserID field.
|
|
func (r *RefundStarPaymentRequest) GetUserID() (value int64) {
|
|
if r == nil {
|
|
return
|
|
}
|
|
return r.UserID
|
|
}
|
|
|
|
// GetTelegramPaymentChargeID returns value of TelegramPaymentChargeID field.
|
|
func (r *RefundStarPaymentRequest) GetTelegramPaymentChargeID() (value string) {
|
|
if r == nil {
|
|
return
|
|
}
|
|
return r.TelegramPaymentChargeID
|
|
}
|
|
|
|
// RefundStarPayment invokes method refundStarPayment#9476a055 returning error if any.
|
|
func (c *Client) RefundStarPayment(ctx context.Context, request *RefundStarPaymentRequest) error {
|
|
var ok Ok
|
|
|
|
if err := c.rpc.Invoke(ctx, request, &ok); err != nil {
|
|
return err
|
|
}
|
|
return nil
|
|
}
|