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 PaymentsGetGiveawayInfoRequest struct {
Peer InputPeerClass
MsgID int
}
const PaymentsGetGiveawayInfoRequestTypeID = 0xf4239425
var (
_ bin .Encoder = &PaymentsGetGiveawayInfoRequest {}
_ bin .Decoder = &PaymentsGetGiveawayInfoRequest {}
_ bin .BareEncoder = &PaymentsGetGiveawayInfoRequest {}
_ bin .BareDecoder = &PaymentsGetGiveawayInfoRequest {}
)
func (g *PaymentsGetGiveawayInfoRequest ) Zero () bool {
if g == nil {
return true
}
if !(g .Peer == nil ) {
return false
}
if !(g .MsgID == 0 ) {
return false
}
return true
}
func (g *PaymentsGetGiveawayInfoRequest ) String () string {
if g == nil {
return "PaymentsGetGiveawayInfoRequest(nil)"
}
type Alias PaymentsGetGiveawayInfoRequest
return fmt .Sprintf ("PaymentsGetGiveawayInfoRequest%+v" , Alias (*g ))
}
func (g *PaymentsGetGiveawayInfoRequest ) FillFrom (from interface {
GetPeer () (value InputPeerClass )
GetMsgID () (value int )
}) {
g .Peer = from .GetPeer ()
g .MsgID = from .GetMsgID ()
}
func (*PaymentsGetGiveawayInfoRequest ) TypeID () uint32 {
return PaymentsGetGiveawayInfoRequestTypeID
}
func (*PaymentsGetGiveawayInfoRequest ) TypeName () string {
return "payments.getGiveawayInfo"
}
func (g *PaymentsGetGiveawayInfoRequest ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "payments.getGiveawayInfo" ,
ID : PaymentsGetGiveawayInfoRequestTypeID ,
}
if g == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "Peer" ,
SchemaName : "peer" ,
},
{
Name : "MsgID" ,
SchemaName : "msg_id" ,
},
}
return typ
}
func (g *PaymentsGetGiveawayInfoRequest ) Encode (b *bin .Buffer ) error {
if g == nil {
return fmt .Errorf ("can't encode payments.getGiveawayInfo#f4239425 as nil" )
}
b .PutID (PaymentsGetGiveawayInfoRequestTypeID )
return g .EncodeBare (b )
}
func (g *PaymentsGetGiveawayInfoRequest ) EncodeBare (b *bin .Buffer ) error {
if g == nil {
return fmt .Errorf ("can't encode payments.getGiveawayInfo#f4239425 as nil" )
}
if g .Peer == nil {
return fmt .Errorf ("unable to encode payments.getGiveawayInfo#f4239425: field peer is nil" )
}
if err := g .Peer .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode payments.getGiveawayInfo#f4239425: field peer: %w" , err )
}
b .PutInt (g .MsgID )
return nil
}
func (g *PaymentsGetGiveawayInfoRequest ) Decode (b *bin .Buffer ) error {
if g == nil {
return fmt .Errorf ("can't decode payments.getGiveawayInfo#f4239425 to nil" )
}
if err := b .ConsumeID (PaymentsGetGiveawayInfoRequestTypeID ); err != nil {
return fmt .Errorf ("unable to decode payments.getGiveawayInfo#f4239425: %w" , err )
}
return g .DecodeBare (b )
}
func (g *PaymentsGetGiveawayInfoRequest ) DecodeBare (b *bin .Buffer ) error {
if g == nil {
return fmt .Errorf ("can't decode payments.getGiveawayInfo#f4239425 to nil" )
}
{
value , err := DecodeInputPeer (b )
if err != nil {
return fmt .Errorf ("unable to decode payments.getGiveawayInfo#f4239425: field peer: %w" , err )
}
g .Peer = value
}
{
value , err := b .Int ()
if err != nil {
return fmt .Errorf ("unable to decode payments.getGiveawayInfo#f4239425: field msg_id: %w" , err )
}
g .MsgID = value
}
return nil
}
func (g *PaymentsGetGiveawayInfoRequest ) GetPeer () (value InputPeerClass ) {
if g == nil {
return
}
return g .Peer
}
func (g *PaymentsGetGiveawayInfoRequest ) GetMsgID () (value int ) {
if g == nil {
return
}
return g .MsgID
}
func (c *Client ) PaymentsGetGiveawayInfo (ctx context .Context , request *PaymentsGetGiveawayInfoRequest ) (PaymentsGiveawayInfoClass , error ) {
var result PaymentsGiveawayInfoBox
if err := c .rpc .Invoke (ctx , request , &result ); err != nil {
return nil , err
}
return result .GiveawayInfo , 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 .