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 OnrampSession struct {
Provider string
SessionID string
URL string
ExpiresDate int
}
const OnrampSessionTypeID = 0xd1e42e24
var (
_ bin .Encoder = &OnrampSession {}
_ bin .Decoder = &OnrampSession {}
_ bin .BareEncoder = &OnrampSession {}
_ bin .BareDecoder = &OnrampSession {}
)
func (o *OnrampSession ) Zero () bool {
if o == nil {
return true
}
if !(o .Provider == "" ) {
return false
}
if !(o .SessionID == "" ) {
return false
}
if !(o .URL == "" ) {
return false
}
if !(o .ExpiresDate == 0 ) {
return false
}
return true
}
func (o *OnrampSession ) String () string {
if o == nil {
return "OnrampSession(nil)"
}
type Alias OnrampSession
return fmt .Sprintf ("OnrampSession%+v" , Alias (*o ))
}
func (o *OnrampSession ) FillFrom (from interface {
GetProvider () (value string )
GetSessionID () (value string )
GetURL () (value string )
GetExpiresDate () (value int )
}) {
o .Provider = from .GetProvider ()
o .SessionID = from .GetSessionID ()
o .URL = from .GetURL ()
o .ExpiresDate = from .GetExpiresDate ()
}
func (*OnrampSession ) TypeID () uint32 {
return OnrampSessionTypeID
}
func (*OnrampSession ) TypeName () string {
return "onrampSession"
}
func (o *OnrampSession ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "onrampSession" ,
ID : OnrampSessionTypeID ,
}
if o == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "Provider" ,
SchemaName : "provider" ,
},
{
Name : "SessionID" ,
SchemaName : "session_id" ,
},
{
Name : "URL" ,
SchemaName : "url" ,
},
{
Name : "ExpiresDate" ,
SchemaName : "expires_date" ,
},
}
return typ
}
func (o *OnrampSession ) Encode (b *bin .Buffer ) error {
if o == nil {
return fmt .Errorf ("can't encode onrampSession#d1e42e24 as nil" )
}
b .PutID (OnrampSessionTypeID )
return o .EncodeBare (b )
}
func (o *OnrampSession ) EncodeBare (b *bin .Buffer ) error {
if o == nil {
return fmt .Errorf ("can't encode onrampSession#d1e42e24 as nil" )
}
b .PutString (o .Provider )
b .PutString (o .SessionID )
b .PutString (o .URL )
b .PutInt (o .ExpiresDate )
return nil
}
func (o *OnrampSession ) Decode (b *bin .Buffer ) error {
if o == nil {
return fmt .Errorf ("can't decode onrampSession#d1e42e24 to nil" )
}
if err := b .ConsumeID (OnrampSessionTypeID ); err != nil {
return fmt .Errorf ("unable to decode onrampSession#d1e42e24: %w" , err )
}
return o .DecodeBare (b )
}
func (o *OnrampSession ) DecodeBare (b *bin .Buffer ) error {
if o == nil {
return fmt .Errorf ("can't decode onrampSession#d1e42e24 to nil" )
}
{
value , err := b .String ()
if err != nil {
return fmt .Errorf ("unable to decode onrampSession#d1e42e24: field provider: %w" , err )
}
o .Provider = value
}
{
value , err := b .String ()
if err != nil {
return fmt .Errorf ("unable to decode onrampSession#d1e42e24: field session_id: %w" , err )
}
o .SessionID = value
}
{
value , err := b .String ()
if err != nil {
return fmt .Errorf ("unable to decode onrampSession#d1e42e24: field url: %w" , err )
}
o .URL = value
}
{
value , err := b .Int ()
if err != nil {
return fmt .Errorf ("unable to decode onrampSession#d1e42e24: field expires_date: %w" , err )
}
o .ExpiresDate = value
}
return nil
}
func (o *OnrampSession ) GetProvider () (value string ) {
if o == nil {
return
}
return o .Provider
}
func (o *OnrampSession ) GetSessionID () (value string ) {
if o == nil {
return
}
return o .SessionID
}
func (o *OnrampSession ) GetURL () (value string ) {
if o == nil {
return
}
return o .URL
}
func (o *OnrampSession ) GetExpiresDate () (value int ) {
if o == nil {
return
}
return o .ExpiresDate
}
The pages are generated with Golds v0.8.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 @zigo_101 (reachable from the left QR code) to get the latest news of Golds .