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 RestrictionReason struct {
Platform string
Reason string
Text string
}
const RestrictionReasonTypeID = 0xd072acb4
var (
_ bin .Encoder = &RestrictionReason {}
_ bin .Decoder = &RestrictionReason {}
_ bin .BareEncoder = &RestrictionReason {}
_ bin .BareDecoder = &RestrictionReason {}
)
func (r *RestrictionReason ) Zero () bool {
if r == nil {
return true
}
if !(r .Platform == "" ) {
return false
}
if !(r .Reason == "" ) {
return false
}
if !(r .Text == "" ) {
return false
}
return true
}
func (r *RestrictionReason ) String () string {
if r == nil {
return "RestrictionReason(nil)"
}
type Alias RestrictionReason
return fmt .Sprintf ("RestrictionReason%+v" , Alias (*r ))
}
func (r *RestrictionReason ) FillFrom (from interface {
GetPlatform () (value string )
GetReason () (value string )
GetText () (value string )
}) {
r .Platform = from .GetPlatform ()
r .Reason = from .GetReason ()
r .Text = from .GetText ()
}
func (*RestrictionReason ) TypeID () uint32 {
return RestrictionReasonTypeID
}
func (*RestrictionReason ) TypeName () string {
return "restrictionReason"
}
func (r *RestrictionReason ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "restrictionReason" ,
ID : RestrictionReasonTypeID ,
}
if r == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "Platform" ,
SchemaName : "platform" ,
},
{
Name : "Reason" ,
SchemaName : "reason" ,
},
{
Name : "Text" ,
SchemaName : "text" ,
},
}
return typ
}
func (r *RestrictionReason ) Encode (b *bin .Buffer ) error {
if r == nil {
return fmt .Errorf ("can't encode restrictionReason#d072acb4 as nil" )
}
b .PutID (RestrictionReasonTypeID )
return r .EncodeBare (b )
}
func (r *RestrictionReason ) EncodeBare (b *bin .Buffer ) error {
if r == nil {
return fmt .Errorf ("can't encode restrictionReason#d072acb4 as nil" )
}
b .PutString (r .Platform )
b .PutString (r .Reason )
b .PutString (r .Text )
return nil
}
func (r *RestrictionReason ) Decode (b *bin .Buffer ) error {
if r == nil {
return fmt .Errorf ("can't decode restrictionReason#d072acb4 to nil" )
}
if err := b .ConsumeID (RestrictionReasonTypeID ); err != nil {
return fmt .Errorf ("unable to decode restrictionReason#d072acb4: %w" , err )
}
return r .DecodeBare (b )
}
func (r *RestrictionReason ) DecodeBare (b *bin .Buffer ) error {
if r == nil {
return fmt .Errorf ("can't decode restrictionReason#d072acb4 to nil" )
}
{
value , err := b .String ()
if err != nil {
return fmt .Errorf ("unable to decode restrictionReason#d072acb4: field platform: %w" , err )
}
r .Platform = value
}
{
value , err := b .String ()
if err != nil {
return fmt .Errorf ("unable to decode restrictionReason#d072acb4: field reason: %w" , err )
}
r .Reason = value
}
{
value , err := b .String ()
if err != nil {
return fmt .Errorf ("unable to decode restrictionReason#d072acb4: field text: %w" , err )
}
r .Text = value
}
return nil
}
func (r *RestrictionReason ) GetPlatform () (value string ) {
if r == nil {
return
}
return r .Platform
}
func (r *RestrictionReason ) GetReason () (value string ) {
if r == nil {
return
}
return r .Reason
}
func (r *RestrictionReason ) GetText () (value string ) {
if r == nil {
return
}
return r .Text
}
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 .