package tg
import (
"context"
"errors"
"fmt"
"sort"
"strings"
"go.uber.org/multierr"
"github.com/gotd/td/bin"
"github.com/gotd/td/tdjson"
"github.com/gotd/td/tdp"
"github.com/gotd/td/tgerr"
)
var (
_ = bin .Buffer {}
_ = context .Background ()
_ = fmt .Stringer (nil )
_ = strings .Builder {}
_ = errors .Is
_ = multierr .AppendInto
_ = sort .Ints
_ = tdp .Format
_ = tgerr .Error {}
_ = tdjson .Encoder {}
)
type PaymentsAssignAppStoreTransactionRequest struct {
Receipt []byte
Purpose InputStorePaymentPurposeClass
}
const PaymentsAssignAppStoreTransactionRequestTypeID = 0x80ed747d
var (
_ bin .Encoder = &PaymentsAssignAppStoreTransactionRequest {}
_ bin .Decoder = &PaymentsAssignAppStoreTransactionRequest {}
_ bin .BareEncoder = &PaymentsAssignAppStoreTransactionRequest {}
_ bin .BareDecoder = &PaymentsAssignAppStoreTransactionRequest {}
)
func (a *PaymentsAssignAppStoreTransactionRequest ) Zero () bool {
if a == nil {
return true
}
if !(a .Receipt == nil ) {
return false
}
if !(a .Purpose == nil ) {
return false
}
return true
}
func (a *PaymentsAssignAppStoreTransactionRequest ) String () string {
if a == nil {
return "PaymentsAssignAppStoreTransactionRequest(nil)"
}
type Alias PaymentsAssignAppStoreTransactionRequest
return fmt .Sprintf ("PaymentsAssignAppStoreTransactionRequest%+v" , Alias (*a ))
}
func (a *PaymentsAssignAppStoreTransactionRequest ) FillFrom (from interface {
GetReceipt () (value []byte )
GetPurpose () (value InputStorePaymentPurposeClass )
}) {
a .Receipt = from .GetReceipt ()
a .Purpose = from .GetPurpose ()
}
func (*PaymentsAssignAppStoreTransactionRequest ) TypeID () uint32 {
return PaymentsAssignAppStoreTransactionRequestTypeID
}
func (*PaymentsAssignAppStoreTransactionRequest ) TypeName () string {
return "payments.assignAppStoreTransaction"
}
func (a *PaymentsAssignAppStoreTransactionRequest ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "payments.assignAppStoreTransaction" ,
ID : PaymentsAssignAppStoreTransactionRequestTypeID ,
}
if a == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "Receipt" ,
SchemaName : "receipt" ,
},
{
Name : "Purpose" ,
SchemaName : "purpose" ,
},
}
return typ
}
func (a *PaymentsAssignAppStoreTransactionRequest ) Encode (b *bin .Buffer ) error {
if a == nil {
return fmt .Errorf ("can't encode payments.assignAppStoreTransaction#80ed747d as nil" )
}
b .PutID (PaymentsAssignAppStoreTransactionRequestTypeID )
return a .EncodeBare (b )
}
func (a *PaymentsAssignAppStoreTransactionRequest ) EncodeBare (b *bin .Buffer ) error {
if a == nil {
return fmt .Errorf ("can't encode payments.assignAppStoreTransaction#80ed747d as nil" )
}
b .PutBytes (a .Receipt )
if a .Purpose == nil {
return fmt .Errorf ("unable to encode payments.assignAppStoreTransaction#80ed747d: field purpose is nil" )
}
if err := a .Purpose .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode payments.assignAppStoreTransaction#80ed747d: field purpose: %w" , err )
}
return nil
}
func (a *PaymentsAssignAppStoreTransactionRequest ) Decode (b *bin .Buffer ) error {
if a == nil {
return fmt .Errorf ("can't decode payments.assignAppStoreTransaction#80ed747d to nil" )
}
if err := b .ConsumeID (PaymentsAssignAppStoreTransactionRequestTypeID ); err != nil {
return fmt .Errorf ("unable to decode payments.assignAppStoreTransaction#80ed747d: %w" , err )
}
return a .DecodeBare (b )
}
func (a *PaymentsAssignAppStoreTransactionRequest ) DecodeBare (b *bin .Buffer ) error {
if a == nil {
return fmt .Errorf ("can't decode payments.assignAppStoreTransaction#80ed747d to nil" )
}
{
value , err := b .Bytes ()
if err != nil {
return fmt .Errorf ("unable to decode payments.assignAppStoreTransaction#80ed747d: field receipt: %w" , err )
}
a .Receipt = value
}
{
value , err := DecodeInputStorePaymentPurpose (b )
if err != nil {
return fmt .Errorf ("unable to decode payments.assignAppStoreTransaction#80ed747d: field purpose: %w" , err )
}
a .Purpose = value
}
return nil
}
func (a *PaymentsAssignAppStoreTransactionRequest ) GetReceipt () (value []byte ) {
if a == nil {
return
}
return a .Receipt
}
func (a *PaymentsAssignAppStoreTransactionRequest ) GetPurpose () (value InputStorePaymentPurposeClass ) {
if a == nil {
return
}
return a .Purpose
}
func (c *Client ) PaymentsAssignAppStoreTransaction (ctx context .Context , request *PaymentsAssignAppStoreTransactionRequest ) (UpdatesClass , error ) {
var result UpdatesBox
if err := c .rpc .Invoke (ctx , request , &result ); err != nil {
return nil , err
}
return result .Updates , nil
}
The pages are generated with Golds v0.6.7 . (GOOS=linux GOARCH=amd64)
Golds is a Go 101 project developed by Tapir Liu .
PR and bug reports are welcome and can be submitted to the issue list .
Please follow @Go100and1 (reachable from the left QR code) to get the latest news of Golds .