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 PaymentsAssignPlayMarketTransactionRequest struct {
Receipt DataJSON
Purpose InputStorePaymentPurposeClass
}
const PaymentsAssignPlayMarketTransactionRequestTypeID = 0xdffd50d3
var (
_ bin .Encoder = &PaymentsAssignPlayMarketTransactionRequest {}
_ bin .Decoder = &PaymentsAssignPlayMarketTransactionRequest {}
_ bin .BareEncoder = &PaymentsAssignPlayMarketTransactionRequest {}
_ bin .BareDecoder = &PaymentsAssignPlayMarketTransactionRequest {}
)
func (a *PaymentsAssignPlayMarketTransactionRequest ) Zero () bool {
if a == nil {
return true
}
if !(a .Receipt .Zero ()) {
return false
}
if !(a .Purpose == nil ) {
return false
}
return true
}
func (a *PaymentsAssignPlayMarketTransactionRequest ) String () string {
if a == nil {
return "PaymentsAssignPlayMarketTransactionRequest(nil)"
}
type Alias PaymentsAssignPlayMarketTransactionRequest
return fmt .Sprintf ("PaymentsAssignPlayMarketTransactionRequest%+v" , Alias (*a ))
}
func (a *PaymentsAssignPlayMarketTransactionRequest ) FillFrom (from interface {
GetReceipt () (value DataJSON )
GetPurpose () (value InputStorePaymentPurposeClass )
}) {
a .Receipt = from .GetReceipt ()
a .Purpose = from .GetPurpose ()
}
func (*PaymentsAssignPlayMarketTransactionRequest ) TypeID () uint32 {
return PaymentsAssignPlayMarketTransactionRequestTypeID
}
func (*PaymentsAssignPlayMarketTransactionRequest ) TypeName () string {
return "payments.assignPlayMarketTransaction"
}
func (a *PaymentsAssignPlayMarketTransactionRequest ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "payments.assignPlayMarketTransaction" ,
ID : PaymentsAssignPlayMarketTransactionRequestTypeID ,
}
if a == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "Receipt" ,
SchemaName : "receipt" ,
},
{
Name : "Purpose" ,
SchemaName : "purpose" ,
},
}
return typ
}
func (a *PaymentsAssignPlayMarketTransactionRequest ) Encode (b *bin .Buffer ) error {
if a == nil {
return fmt .Errorf ("can't encode payments.assignPlayMarketTransaction#dffd50d3 as nil" )
}
b .PutID (PaymentsAssignPlayMarketTransactionRequestTypeID )
return a .EncodeBare (b )
}
func (a *PaymentsAssignPlayMarketTransactionRequest ) EncodeBare (b *bin .Buffer ) error {
if a == nil {
return fmt .Errorf ("can't encode payments.assignPlayMarketTransaction#dffd50d3 as nil" )
}
if err := a .Receipt .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode payments.assignPlayMarketTransaction#dffd50d3: field receipt: %w" , err )
}
if a .Purpose == nil {
return fmt .Errorf ("unable to encode payments.assignPlayMarketTransaction#dffd50d3: field purpose is nil" )
}
if err := a .Purpose .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode payments.assignPlayMarketTransaction#dffd50d3: field purpose: %w" , err )
}
return nil
}
func (a *PaymentsAssignPlayMarketTransactionRequest ) Decode (b *bin .Buffer ) error {
if a == nil {
return fmt .Errorf ("can't decode payments.assignPlayMarketTransaction#dffd50d3 to nil" )
}
if err := b .ConsumeID (PaymentsAssignPlayMarketTransactionRequestTypeID ); err != nil {
return fmt .Errorf ("unable to decode payments.assignPlayMarketTransaction#dffd50d3: %w" , err )
}
return a .DecodeBare (b )
}
func (a *PaymentsAssignPlayMarketTransactionRequest ) DecodeBare (b *bin .Buffer ) error {
if a == nil {
return fmt .Errorf ("can't decode payments.assignPlayMarketTransaction#dffd50d3 to nil" )
}
{
if err := a .Receipt .Decode (b ); err != nil {
return fmt .Errorf ("unable to decode payments.assignPlayMarketTransaction#dffd50d3: field receipt: %w" , err )
}
}
{
value , err := DecodeInputStorePaymentPurpose (b )
if err != nil {
return fmt .Errorf ("unable to decode payments.assignPlayMarketTransaction#dffd50d3: field purpose: %w" , err )
}
a .Purpose = value
}
return nil
}
func (a *PaymentsAssignPlayMarketTransactionRequest ) GetReceipt () (value DataJSON ) {
if a == nil {
return
}
return a .Receipt
}
func (a *PaymentsAssignPlayMarketTransactionRequest ) GetPurpose () (value InputStorePaymentPurposeClass ) {
if a == nil {
return
}
return a .Purpose
}
func (c *Client ) PaymentsAssignPlayMarketTransaction (ctx context .Context , request *PaymentsAssignPlayMarketTransactionRequest ) (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 .