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 LangpackGetDifferenceRequest struct {
LangPack string
LangCode string
FromVersion int
}
const LangpackGetDifferenceRequestTypeID = 0xcd984aa5
var (
_ bin .Encoder = &LangpackGetDifferenceRequest {}
_ bin .Decoder = &LangpackGetDifferenceRequest {}
_ bin .BareEncoder = &LangpackGetDifferenceRequest {}
_ bin .BareDecoder = &LangpackGetDifferenceRequest {}
)
func (g *LangpackGetDifferenceRequest ) Zero () bool {
if g == nil {
return true
}
if !(g .LangPack == "" ) {
return false
}
if !(g .LangCode == "" ) {
return false
}
if !(g .FromVersion == 0 ) {
return false
}
return true
}
func (g *LangpackGetDifferenceRequest ) String () string {
if g == nil {
return "LangpackGetDifferenceRequest(nil)"
}
type Alias LangpackGetDifferenceRequest
return fmt .Sprintf ("LangpackGetDifferenceRequest%+v" , Alias (*g ))
}
func (g *LangpackGetDifferenceRequest ) FillFrom (from interface {
GetLangPack () (value string )
GetLangCode () (value string )
GetFromVersion () (value int )
}) {
g .LangPack = from .GetLangPack ()
g .LangCode = from .GetLangCode ()
g .FromVersion = from .GetFromVersion ()
}
func (*LangpackGetDifferenceRequest ) TypeID () uint32 {
return LangpackGetDifferenceRequestTypeID
}
func (*LangpackGetDifferenceRequest ) TypeName () string {
return "langpack.getDifference"
}
func (g *LangpackGetDifferenceRequest ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "langpack.getDifference" ,
ID : LangpackGetDifferenceRequestTypeID ,
}
if g == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "LangPack" ,
SchemaName : "lang_pack" ,
},
{
Name : "LangCode" ,
SchemaName : "lang_code" ,
},
{
Name : "FromVersion" ,
SchemaName : "from_version" ,
},
}
return typ
}
func (g *LangpackGetDifferenceRequest ) Encode (b *bin .Buffer ) error {
if g == nil {
return fmt .Errorf ("can't encode langpack.getDifference#cd984aa5 as nil" )
}
b .PutID (LangpackGetDifferenceRequestTypeID )
return g .EncodeBare (b )
}
func (g *LangpackGetDifferenceRequest ) EncodeBare (b *bin .Buffer ) error {
if g == nil {
return fmt .Errorf ("can't encode langpack.getDifference#cd984aa5 as nil" )
}
b .PutString (g .LangPack )
b .PutString (g .LangCode )
b .PutInt (g .FromVersion )
return nil
}
func (g *LangpackGetDifferenceRequest ) Decode (b *bin .Buffer ) error {
if g == nil {
return fmt .Errorf ("can't decode langpack.getDifference#cd984aa5 to nil" )
}
if err := b .ConsumeID (LangpackGetDifferenceRequestTypeID ); err != nil {
return fmt .Errorf ("unable to decode langpack.getDifference#cd984aa5: %w" , err )
}
return g .DecodeBare (b )
}
func (g *LangpackGetDifferenceRequest ) DecodeBare (b *bin .Buffer ) error {
if g == nil {
return fmt .Errorf ("can't decode langpack.getDifference#cd984aa5 to nil" )
}
{
value , err := b .String ()
if err != nil {
return fmt .Errorf ("unable to decode langpack.getDifference#cd984aa5: field lang_pack: %w" , err )
}
g .LangPack = value
}
{
value , err := b .String ()
if err != nil {
return fmt .Errorf ("unable to decode langpack.getDifference#cd984aa5: field lang_code: %w" , err )
}
g .LangCode = value
}
{
value , err := b .Int ()
if err != nil {
return fmt .Errorf ("unable to decode langpack.getDifference#cd984aa5: field from_version: %w" , err )
}
g .FromVersion = value
}
return nil
}
func (g *LangpackGetDifferenceRequest ) GetLangPack () (value string ) {
if g == nil {
return
}
return g .LangPack
}
func (g *LangpackGetDifferenceRequest ) GetLangCode () (value string ) {
if g == nil {
return
}
return g .LangCode
}
func (g *LangpackGetDifferenceRequest ) GetFromVersion () (value int ) {
if g == nil {
return
}
return g .FromVersion
}
func (c *Client ) LangpackGetDifference (ctx context .Context , request *LangpackGetDifferenceRequest ) (*LangPackDifference , error ) {
var result LangPackDifference
if err := c .rpc .Invoke (ctx , request , &result ); err != nil {
return nil , err
}
return &result , nil
}
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 .