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 AccountUpdateBusinessLocationRequest struct {
Flags bin .Fields
GeoPoint InputGeoPointClass
Address string
}
const AccountUpdateBusinessLocationRequestTypeID = 0x9e6b131a
var (
_ bin .Encoder = &AccountUpdateBusinessLocationRequest {}
_ bin .Decoder = &AccountUpdateBusinessLocationRequest {}
_ bin .BareEncoder = &AccountUpdateBusinessLocationRequest {}
_ bin .BareDecoder = &AccountUpdateBusinessLocationRequest {}
)
func (u *AccountUpdateBusinessLocationRequest ) Zero () bool {
if u == nil {
return true
}
if !(u .Flags .Zero ()) {
return false
}
if !(u .GeoPoint == nil ) {
return false
}
if !(u .Address == "" ) {
return false
}
return true
}
func (u *AccountUpdateBusinessLocationRequest ) String () string {
if u == nil {
return "AccountUpdateBusinessLocationRequest(nil)"
}
type Alias AccountUpdateBusinessLocationRequest
return fmt .Sprintf ("AccountUpdateBusinessLocationRequest%+v" , Alias (*u ))
}
func (u *AccountUpdateBusinessLocationRequest ) FillFrom (from interface {
GetGeoPoint () (value InputGeoPointClass , ok bool )
GetAddress () (value string , ok bool )
}) {
if val , ok := from .GetGeoPoint (); ok {
u .GeoPoint = val
}
if val , ok := from .GetAddress (); ok {
u .Address = val
}
}
func (*AccountUpdateBusinessLocationRequest ) TypeID () uint32 {
return AccountUpdateBusinessLocationRequestTypeID
}
func (*AccountUpdateBusinessLocationRequest ) TypeName () string {
return "account.updateBusinessLocation"
}
func (u *AccountUpdateBusinessLocationRequest ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "account.updateBusinessLocation" ,
ID : AccountUpdateBusinessLocationRequestTypeID ,
}
if u == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "GeoPoint" ,
SchemaName : "geo_point" ,
Null : !u .Flags .Has (1 ),
},
{
Name : "Address" ,
SchemaName : "address" ,
Null : !u .Flags .Has (0 ),
},
}
return typ
}
func (u *AccountUpdateBusinessLocationRequest ) SetFlags () {
if !(u .GeoPoint == nil ) {
u .Flags .Set (1 )
}
if !(u .Address == "" ) {
u .Flags .Set (0 )
}
}
func (u *AccountUpdateBusinessLocationRequest ) Encode (b *bin .Buffer ) error {
if u == nil {
return fmt .Errorf ("can't encode account.updateBusinessLocation#9e6b131a as nil" )
}
b .PutID (AccountUpdateBusinessLocationRequestTypeID )
return u .EncodeBare (b )
}
func (u *AccountUpdateBusinessLocationRequest ) EncodeBare (b *bin .Buffer ) error {
if u == nil {
return fmt .Errorf ("can't encode account.updateBusinessLocation#9e6b131a as nil" )
}
u .SetFlags ()
if err := u .Flags .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode account.updateBusinessLocation#9e6b131a: field flags: %w" , err )
}
if u .Flags .Has (1 ) {
if u .GeoPoint == nil {
return fmt .Errorf ("unable to encode account.updateBusinessLocation#9e6b131a: field geo_point is nil" )
}
if err := u .GeoPoint .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode account.updateBusinessLocation#9e6b131a: field geo_point: %w" , err )
}
}
if u .Flags .Has (0 ) {
b .PutString (u .Address )
}
return nil
}
func (u *AccountUpdateBusinessLocationRequest ) Decode (b *bin .Buffer ) error {
if u == nil {
return fmt .Errorf ("can't decode account.updateBusinessLocation#9e6b131a to nil" )
}
if err := b .ConsumeID (AccountUpdateBusinessLocationRequestTypeID ); err != nil {
return fmt .Errorf ("unable to decode account.updateBusinessLocation#9e6b131a: %w" , err )
}
return u .DecodeBare (b )
}
func (u *AccountUpdateBusinessLocationRequest ) DecodeBare (b *bin .Buffer ) error {
if u == nil {
return fmt .Errorf ("can't decode account.updateBusinessLocation#9e6b131a to nil" )
}
{
if err := u .Flags .Decode (b ); err != nil {
return fmt .Errorf ("unable to decode account.updateBusinessLocation#9e6b131a: field flags: %w" , err )
}
}
if u .Flags .Has (1 ) {
value , err := DecodeInputGeoPoint (b )
if err != nil {
return fmt .Errorf ("unable to decode account.updateBusinessLocation#9e6b131a: field geo_point: %w" , err )
}
u .GeoPoint = value
}
if u .Flags .Has (0 ) {
value , err := b .String ()
if err != nil {
return fmt .Errorf ("unable to decode account.updateBusinessLocation#9e6b131a: field address: %w" , err )
}
u .Address = value
}
return nil
}
func (u *AccountUpdateBusinessLocationRequest ) SetGeoPoint (value InputGeoPointClass ) {
u .Flags .Set (1 )
u .GeoPoint = value
}
func (u *AccountUpdateBusinessLocationRequest ) GetGeoPoint () (value InputGeoPointClass , ok bool ) {
if u == nil {
return
}
if !u .Flags .Has (1 ) {
return value , false
}
return u .GeoPoint , true
}
func (u *AccountUpdateBusinessLocationRequest ) SetAddress (value string ) {
u .Flags .Set (0 )
u .Address = value
}
func (u *AccountUpdateBusinessLocationRequest ) GetAddress () (value string , ok bool ) {
if u == nil {
return
}
if !u .Flags .Has (0 ) {
return value , false
}
return u .Address , true
}
func (u *AccountUpdateBusinessLocationRequest ) GetGeoPointAsNotEmpty () (*InputGeoPoint , bool ) {
if value , ok := u .GetGeoPoint (); ok {
return value .AsNotEmpty ()
}
return nil , false
}
func (c *Client ) AccountUpdateBusinessLocation (ctx context .Context , request *AccountUpdateBusinessLocationRequest ) (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 .