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 PaymentsFulfillStarsSubscriptionRequest struct {
Peer InputPeerClass
SubscriptionID string
}
const PaymentsFulfillStarsSubscriptionRequestTypeID = 0xcc5bebb3
var (
_ bin .Encoder = &PaymentsFulfillStarsSubscriptionRequest {}
_ bin .Decoder = &PaymentsFulfillStarsSubscriptionRequest {}
_ bin .BareEncoder = &PaymentsFulfillStarsSubscriptionRequest {}
_ bin .BareDecoder = &PaymentsFulfillStarsSubscriptionRequest {}
)
func (f *PaymentsFulfillStarsSubscriptionRequest ) Zero () bool {
if f == nil {
return true
}
if !(f .Peer == nil ) {
return false
}
if !(f .SubscriptionID == "" ) {
return false
}
return true
}
func (f *PaymentsFulfillStarsSubscriptionRequest ) String () string {
if f == nil {
return "PaymentsFulfillStarsSubscriptionRequest(nil)"
}
type Alias PaymentsFulfillStarsSubscriptionRequest
return fmt .Sprintf ("PaymentsFulfillStarsSubscriptionRequest%+v" , Alias (*f ))
}
func (f *PaymentsFulfillStarsSubscriptionRequest ) FillFrom (from interface {
GetPeer () (value InputPeerClass )
GetSubscriptionID () (value string )
}) {
f .Peer = from .GetPeer ()
f .SubscriptionID = from .GetSubscriptionID ()
}
func (*PaymentsFulfillStarsSubscriptionRequest ) TypeID () uint32 {
return PaymentsFulfillStarsSubscriptionRequestTypeID
}
func (*PaymentsFulfillStarsSubscriptionRequest ) TypeName () string {
return "payments.fulfillStarsSubscription"
}
func (f *PaymentsFulfillStarsSubscriptionRequest ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "payments.fulfillStarsSubscription" ,
ID : PaymentsFulfillStarsSubscriptionRequestTypeID ,
}
if f == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "Peer" ,
SchemaName : "peer" ,
},
{
Name : "SubscriptionID" ,
SchemaName : "subscription_id" ,
},
}
return typ
}
func (f *PaymentsFulfillStarsSubscriptionRequest ) Encode (b *bin .Buffer ) error {
if f == nil {
return fmt .Errorf ("can't encode payments.fulfillStarsSubscription#cc5bebb3 as nil" )
}
b .PutID (PaymentsFulfillStarsSubscriptionRequestTypeID )
return f .EncodeBare (b )
}
func (f *PaymentsFulfillStarsSubscriptionRequest ) EncodeBare (b *bin .Buffer ) error {
if f == nil {
return fmt .Errorf ("can't encode payments.fulfillStarsSubscription#cc5bebb3 as nil" )
}
if f .Peer == nil {
return fmt .Errorf ("unable to encode payments.fulfillStarsSubscription#cc5bebb3: field peer is nil" )
}
if err := f .Peer .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode payments.fulfillStarsSubscription#cc5bebb3: field peer: %w" , err )
}
b .PutString (f .SubscriptionID )
return nil
}
func (f *PaymentsFulfillStarsSubscriptionRequest ) Decode (b *bin .Buffer ) error {
if f == nil {
return fmt .Errorf ("can't decode payments.fulfillStarsSubscription#cc5bebb3 to nil" )
}
if err := b .ConsumeID (PaymentsFulfillStarsSubscriptionRequestTypeID ); err != nil {
return fmt .Errorf ("unable to decode payments.fulfillStarsSubscription#cc5bebb3: %w" , err )
}
return f .DecodeBare (b )
}
func (f *PaymentsFulfillStarsSubscriptionRequest ) DecodeBare (b *bin .Buffer ) error {
if f == nil {
return fmt .Errorf ("can't decode payments.fulfillStarsSubscription#cc5bebb3 to nil" )
}
{
value , err := DecodeInputPeer (b )
if err != nil {
return fmt .Errorf ("unable to decode payments.fulfillStarsSubscription#cc5bebb3: field peer: %w" , err )
}
f .Peer = value
}
{
value , err := b .String ()
if err != nil {
return fmt .Errorf ("unable to decode payments.fulfillStarsSubscription#cc5bebb3: field subscription_id: %w" , err )
}
f .SubscriptionID = value
}
return nil
}
func (f *PaymentsFulfillStarsSubscriptionRequest ) GetPeer () (value InputPeerClass ) {
if f == nil {
return
}
return f .Peer
}
func (f *PaymentsFulfillStarsSubscriptionRequest ) GetSubscriptionID () (value string ) {
if f == nil {
return
}
return f .SubscriptionID
}
func (c *Client ) PaymentsFulfillStarsSubscription (ctx context .Context , request *PaymentsFulfillStarsSubscriptionRequest ) (bool , error ) {
var result BoolBox
if err := c .rpc .Invoke (ctx , request , &result ); err != nil {
return false , err
}
_ , ok := result .Bool .(*BoolTrue )
return ok , 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 .