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 PaymentsGetUniqueStarGiftRequest struct {
Slug string
}
const PaymentsGetUniqueStarGiftRequestTypeID = 0xa1974d72
var (
_ bin .Encoder = &PaymentsGetUniqueStarGiftRequest {}
_ bin .Decoder = &PaymentsGetUniqueStarGiftRequest {}
_ bin .BareEncoder = &PaymentsGetUniqueStarGiftRequest {}
_ bin .BareDecoder = &PaymentsGetUniqueStarGiftRequest {}
)
func (g *PaymentsGetUniqueStarGiftRequest ) Zero () bool {
if g == nil {
return true
}
if !(g .Slug == "" ) {
return false
}
return true
}
func (g *PaymentsGetUniqueStarGiftRequest ) String () string {
if g == nil {
return "PaymentsGetUniqueStarGiftRequest(nil)"
}
type Alias PaymentsGetUniqueStarGiftRequest
return fmt .Sprintf ("PaymentsGetUniqueStarGiftRequest%+v" , Alias (*g ))
}
func (g *PaymentsGetUniqueStarGiftRequest ) FillFrom (from interface {
GetSlug () (value string )
}) {
g .Slug = from .GetSlug ()
}
func (*PaymentsGetUniqueStarGiftRequest ) TypeID () uint32 {
return PaymentsGetUniqueStarGiftRequestTypeID
}
func (*PaymentsGetUniqueStarGiftRequest ) TypeName () string {
return "payments.getUniqueStarGift"
}
func (g *PaymentsGetUniqueStarGiftRequest ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "payments.getUniqueStarGift" ,
ID : PaymentsGetUniqueStarGiftRequestTypeID ,
}
if g == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "Slug" ,
SchemaName : "slug" ,
},
}
return typ
}
func (g *PaymentsGetUniqueStarGiftRequest ) Encode (b *bin .Buffer ) error {
if g == nil {
return fmt .Errorf ("can't encode payments.getUniqueStarGift#a1974d72 as nil" )
}
b .PutID (PaymentsGetUniqueStarGiftRequestTypeID )
return g .EncodeBare (b )
}
func (g *PaymentsGetUniqueStarGiftRequest ) EncodeBare (b *bin .Buffer ) error {
if g == nil {
return fmt .Errorf ("can't encode payments.getUniqueStarGift#a1974d72 as nil" )
}
b .PutString (g .Slug )
return nil
}
func (g *PaymentsGetUniqueStarGiftRequest ) Decode (b *bin .Buffer ) error {
if g == nil {
return fmt .Errorf ("can't decode payments.getUniqueStarGift#a1974d72 to nil" )
}
if err := b .ConsumeID (PaymentsGetUniqueStarGiftRequestTypeID ); err != nil {
return fmt .Errorf ("unable to decode payments.getUniqueStarGift#a1974d72: %w" , err )
}
return g .DecodeBare (b )
}
func (g *PaymentsGetUniqueStarGiftRequest ) DecodeBare (b *bin .Buffer ) error {
if g == nil {
return fmt .Errorf ("can't decode payments.getUniqueStarGift#a1974d72 to nil" )
}
{
value , err := b .String ()
if err != nil {
return fmt .Errorf ("unable to decode payments.getUniqueStarGift#a1974d72: field slug: %w" , err )
}
g .Slug = value
}
return nil
}
func (g *PaymentsGetUniqueStarGiftRequest ) GetSlug () (value string ) {
if g == nil {
return
}
return g .Slug
}
func (c *Client ) PaymentsGetUniqueStarGift (ctx context .Context , slug string ) (*PaymentsUniqueStarGift , error ) {
var result PaymentsUniqueStarGift
request := &PaymentsGetUniqueStarGiftRequest {
Slug : slug ,
}
if err := c .rpc .Invoke (ctx , request , &result ); err != nil {
return nil , err
}
return &result , nil
}
The pages are generated with Golds v0.8.4 . (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 @zigo_101 (reachable from the left QR code) to get the latest news of Golds .