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 MessagesTranscribedAudio struct {
Flags bin .Fields
Pending bool
TranscriptionID int64
Text string
TrialRemainsNum int
TrialRemainsUntilDate int
}
const MessagesTranscribedAudioTypeID = 0xcfb9d957
var (
_ bin .Encoder = &MessagesTranscribedAudio {}
_ bin .Decoder = &MessagesTranscribedAudio {}
_ bin .BareEncoder = &MessagesTranscribedAudio {}
_ bin .BareDecoder = &MessagesTranscribedAudio {}
)
func (t *MessagesTranscribedAudio ) Zero () bool {
if t == nil {
return true
}
if !(t .Flags .Zero ()) {
return false
}
if !(t .Pending == false ) {
return false
}
if !(t .TranscriptionID == 0 ) {
return false
}
if !(t .Text == "" ) {
return false
}
if !(t .TrialRemainsNum == 0 ) {
return false
}
if !(t .TrialRemainsUntilDate == 0 ) {
return false
}
return true
}
func (t *MessagesTranscribedAudio ) String () string {
if t == nil {
return "MessagesTranscribedAudio(nil)"
}
type Alias MessagesTranscribedAudio
return fmt .Sprintf ("MessagesTranscribedAudio%+v" , Alias (*t ))
}
func (t *MessagesTranscribedAudio ) FillFrom (from interface {
GetPending () (value bool )
GetTranscriptionID () (value int64 )
GetText () (value string )
GetTrialRemainsNum () (value int , ok bool )
GetTrialRemainsUntilDate () (value int , ok bool )
}) {
t .Pending = from .GetPending ()
t .TranscriptionID = from .GetTranscriptionID ()
t .Text = from .GetText ()
if val , ok := from .GetTrialRemainsNum (); ok {
t .TrialRemainsNum = val
}
if val , ok := from .GetTrialRemainsUntilDate (); ok {
t .TrialRemainsUntilDate = val
}
}
func (*MessagesTranscribedAudio ) TypeID () uint32 {
return MessagesTranscribedAudioTypeID
}
func (*MessagesTranscribedAudio ) TypeName () string {
return "messages.transcribedAudio"
}
func (t *MessagesTranscribedAudio ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "messages.transcribedAudio" ,
ID : MessagesTranscribedAudioTypeID ,
}
if t == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "Pending" ,
SchemaName : "pending" ,
Null : !t .Flags .Has (0 ),
},
{
Name : "TranscriptionID" ,
SchemaName : "transcription_id" ,
},
{
Name : "Text" ,
SchemaName : "text" ,
},
{
Name : "TrialRemainsNum" ,
SchemaName : "trial_remains_num" ,
Null : !t .Flags .Has (1 ),
},
{
Name : "TrialRemainsUntilDate" ,
SchemaName : "trial_remains_until_date" ,
Null : !t .Flags .Has (1 ),
},
}
return typ
}
func (t *MessagesTranscribedAudio ) SetFlags () {
if !(t .Pending == false ) {
t .Flags .Set (0 )
}
if !(t .TrialRemainsNum == 0 ) {
t .Flags .Set (1 )
}
if !(t .TrialRemainsUntilDate == 0 ) {
t .Flags .Set (1 )
}
}
func (t *MessagesTranscribedAudio ) Encode (b *bin .Buffer ) error {
if t == nil {
return fmt .Errorf ("can't encode messages.transcribedAudio#cfb9d957 as nil" )
}
b .PutID (MessagesTranscribedAudioTypeID )
return t .EncodeBare (b )
}
func (t *MessagesTranscribedAudio ) EncodeBare (b *bin .Buffer ) error {
if t == nil {
return fmt .Errorf ("can't encode messages.transcribedAudio#cfb9d957 as nil" )
}
t .SetFlags ()
if err := t .Flags .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode messages.transcribedAudio#cfb9d957: field flags: %w" , err )
}
b .PutLong (t .TranscriptionID )
b .PutString (t .Text )
if t .Flags .Has (1 ) {
b .PutInt (t .TrialRemainsNum )
}
if t .Flags .Has (1 ) {
b .PutInt (t .TrialRemainsUntilDate )
}
return nil
}
func (t *MessagesTranscribedAudio ) Decode (b *bin .Buffer ) error {
if t == nil {
return fmt .Errorf ("can't decode messages.transcribedAudio#cfb9d957 to nil" )
}
if err := b .ConsumeID (MessagesTranscribedAudioTypeID ); err != nil {
return fmt .Errorf ("unable to decode messages.transcribedAudio#cfb9d957: %w" , err )
}
return t .DecodeBare (b )
}
func (t *MessagesTranscribedAudio ) DecodeBare (b *bin .Buffer ) error {
if t == nil {
return fmt .Errorf ("can't decode messages.transcribedAudio#cfb9d957 to nil" )
}
{
if err := t .Flags .Decode (b ); err != nil {
return fmt .Errorf ("unable to decode messages.transcribedAudio#cfb9d957: field flags: %w" , err )
}
}
t .Pending = t .Flags .Has (0 )
{
value , err := b .Long ()
if err != nil {
return fmt .Errorf ("unable to decode messages.transcribedAudio#cfb9d957: field transcription_id: %w" , err )
}
t .TranscriptionID = value
}
{
value , err := b .String ()
if err != nil {
return fmt .Errorf ("unable to decode messages.transcribedAudio#cfb9d957: field text: %w" , err )
}
t .Text = value
}
if t .Flags .Has (1 ) {
value , err := b .Int ()
if err != nil {
return fmt .Errorf ("unable to decode messages.transcribedAudio#cfb9d957: field trial_remains_num: %w" , err )
}
t .TrialRemainsNum = value
}
if t .Flags .Has (1 ) {
value , err := b .Int ()
if err != nil {
return fmt .Errorf ("unable to decode messages.transcribedAudio#cfb9d957: field trial_remains_until_date: %w" , err )
}
t .TrialRemainsUntilDate = value
}
return nil
}
func (t *MessagesTranscribedAudio ) SetPending (value bool ) {
if value {
t .Flags .Set (0 )
t .Pending = true
} else {
t .Flags .Unset (0 )
t .Pending = false
}
}
func (t *MessagesTranscribedAudio ) GetPending () (value bool ) {
if t == nil {
return
}
return t .Flags .Has (0 )
}
func (t *MessagesTranscribedAudio ) GetTranscriptionID () (value int64 ) {
if t == nil {
return
}
return t .TranscriptionID
}
func (t *MessagesTranscribedAudio ) GetText () (value string ) {
if t == nil {
return
}
return t .Text
}
func (t *MessagesTranscribedAudio ) SetTrialRemainsNum (value int ) {
t .Flags .Set (1 )
t .TrialRemainsNum = value
}
func (t *MessagesTranscribedAudio ) GetTrialRemainsNum () (value int , ok bool ) {
if t == nil {
return
}
if !t .Flags .Has (1 ) {
return value , false
}
return t .TrialRemainsNum , true
}
func (t *MessagesTranscribedAudio ) SetTrialRemainsUntilDate (value int ) {
t .Flags .Set (1 )
t .TrialRemainsUntilDate = value
}
func (t *MessagesTranscribedAudio ) GetTrialRemainsUntilDate () (value int , ok bool ) {
if t == nil {
return
}
if !t .Flags .Has (1 ) {
return value , false
}
return t .TrialRemainsUntilDate , true
}
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 .