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 PaymentsLaunchPrepaidGiveawayRequest struct {
Peer InputPeerClass
GiveawayID int64
Purpose InputStorePaymentPurposeClass
}
const PaymentsLaunchPrepaidGiveawayRequestTypeID = 0x5ff58f20
var (
_ bin .Encoder = &PaymentsLaunchPrepaidGiveawayRequest {}
_ bin .Decoder = &PaymentsLaunchPrepaidGiveawayRequest {}
_ bin .BareEncoder = &PaymentsLaunchPrepaidGiveawayRequest {}
_ bin .BareDecoder = &PaymentsLaunchPrepaidGiveawayRequest {}
)
func (l *PaymentsLaunchPrepaidGiveawayRequest ) Zero () bool {
if l == nil {
return true
}
if !(l .Peer == nil ) {
return false
}
if !(l .GiveawayID == 0 ) {
return false
}
if !(l .Purpose == nil ) {
return false
}
return true
}
func (l *PaymentsLaunchPrepaidGiveawayRequest ) String () string {
if l == nil {
return "PaymentsLaunchPrepaidGiveawayRequest(nil)"
}
type Alias PaymentsLaunchPrepaidGiveawayRequest
return fmt .Sprintf ("PaymentsLaunchPrepaidGiveawayRequest%+v" , Alias (*l ))
}
func (l *PaymentsLaunchPrepaidGiveawayRequest ) FillFrom (from interface {
GetPeer () (value InputPeerClass )
GetGiveawayID () (value int64 )
GetPurpose () (value InputStorePaymentPurposeClass )
}) {
l .Peer = from .GetPeer ()
l .GiveawayID = from .GetGiveawayID ()
l .Purpose = from .GetPurpose ()
}
func (*PaymentsLaunchPrepaidGiveawayRequest ) TypeID () uint32 {
return PaymentsLaunchPrepaidGiveawayRequestTypeID
}
func (*PaymentsLaunchPrepaidGiveawayRequest ) TypeName () string {
return "payments.launchPrepaidGiveaway"
}
func (l *PaymentsLaunchPrepaidGiveawayRequest ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "payments.launchPrepaidGiveaway" ,
ID : PaymentsLaunchPrepaidGiveawayRequestTypeID ,
}
if l == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "Peer" ,
SchemaName : "peer" ,
},
{
Name : "GiveawayID" ,
SchemaName : "giveaway_id" ,
},
{
Name : "Purpose" ,
SchemaName : "purpose" ,
},
}
return typ
}
func (l *PaymentsLaunchPrepaidGiveawayRequest ) Encode (b *bin .Buffer ) error {
if l == nil {
return fmt .Errorf ("can't encode payments.launchPrepaidGiveaway#5ff58f20 as nil" )
}
b .PutID (PaymentsLaunchPrepaidGiveawayRequestTypeID )
return l .EncodeBare (b )
}
func (l *PaymentsLaunchPrepaidGiveawayRequest ) EncodeBare (b *bin .Buffer ) error {
if l == nil {
return fmt .Errorf ("can't encode payments.launchPrepaidGiveaway#5ff58f20 as nil" )
}
if l .Peer == nil {
return fmt .Errorf ("unable to encode payments.launchPrepaidGiveaway#5ff58f20: field peer is nil" )
}
if err := l .Peer .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode payments.launchPrepaidGiveaway#5ff58f20: field peer: %w" , err )
}
b .PutLong (l .GiveawayID )
if l .Purpose == nil {
return fmt .Errorf ("unable to encode payments.launchPrepaidGiveaway#5ff58f20: field purpose is nil" )
}
if err := l .Purpose .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode payments.launchPrepaidGiveaway#5ff58f20: field purpose: %w" , err )
}
return nil
}
func (l *PaymentsLaunchPrepaidGiveawayRequest ) Decode (b *bin .Buffer ) error {
if l == nil {
return fmt .Errorf ("can't decode payments.launchPrepaidGiveaway#5ff58f20 to nil" )
}
if err := b .ConsumeID (PaymentsLaunchPrepaidGiveawayRequestTypeID ); err != nil {
return fmt .Errorf ("unable to decode payments.launchPrepaidGiveaway#5ff58f20: %w" , err )
}
return l .DecodeBare (b )
}
func (l *PaymentsLaunchPrepaidGiveawayRequest ) DecodeBare (b *bin .Buffer ) error {
if l == nil {
return fmt .Errorf ("can't decode payments.launchPrepaidGiveaway#5ff58f20 to nil" )
}
{
value , err := DecodeInputPeer (b )
if err != nil {
return fmt .Errorf ("unable to decode payments.launchPrepaidGiveaway#5ff58f20: field peer: %w" , err )
}
l .Peer = value
}
{
value , err := b .Long ()
if err != nil {
return fmt .Errorf ("unable to decode payments.launchPrepaidGiveaway#5ff58f20: field giveaway_id: %w" , err )
}
l .GiveawayID = value
}
{
value , err := DecodeInputStorePaymentPurpose (b )
if err != nil {
return fmt .Errorf ("unable to decode payments.launchPrepaidGiveaway#5ff58f20: field purpose: %w" , err )
}
l .Purpose = value
}
return nil
}
func (l *PaymentsLaunchPrepaidGiveawayRequest ) GetPeer () (value InputPeerClass ) {
if l == nil {
return
}
return l .Peer
}
func (l *PaymentsLaunchPrepaidGiveawayRequest ) GetGiveawayID () (value int64 ) {
if l == nil {
return
}
return l .GiveawayID
}
func (l *PaymentsLaunchPrepaidGiveawayRequest ) GetPurpose () (value InputStorePaymentPurposeClass ) {
if l == nil {
return
}
return l .Purpose
}
func (c *Client ) PaymentsLaunchPrepaidGiveaway (ctx context .Context , request *PaymentsLaunchPrepaidGiveawayRequest ) (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 .