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 ChannelsEditLocationRequest struct {
Channel InputChannelClass
GeoPoint InputGeoPointClass
Address string
}
const ChannelsEditLocationRequestTypeID = 0x58e63f6d
var (
_ bin .Encoder = &ChannelsEditLocationRequest {}
_ bin .Decoder = &ChannelsEditLocationRequest {}
_ bin .BareEncoder = &ChannelsEditLocationRequest {}
_ bin .BareDecoder = &ChannelsEditLocationRequest {}
)
func (e *ChannelsEditLocationRequest ) Zero () bool {
if e == nil {
return true
}
if !(e .Channel == nil ) {
return false
}
if !(e .GeoPoint == nil ) {
return false
}
if !(e .Address == "" ) {
return false
}
return true
}
func (e *ChannelsEditLocationRequest ) String () string {
if e == nil {
return "ChannelsEditLocationRequest(nil)"
}
type Alias ChannelsEditLocationRequest
return fmt .Sprintf ("ChannelsEditLocationRequest%+v" , Alias (*e ))
}
func (e *ChannelsEditLocationRequest ) FillFrom (from interface {
GetChannel () (value InputChannelClass )
GetGeoPoint () (value InputGeoPointClass )
GetAddress () (value string )
}) {
e .Channel = from .GetChannel ()
e .GeoPoint = from .GetGeoPoint ()
e .Address = from .GetAddress ()
}
func (*ChannelsEditLocationRequest ) TypeID () uint32 {
return ChannelsEditLocationRequestTypeID
}
func (*ChannelsEditLocationRequest ) TypeName () string {
return "channels.editLocation"
}
func (e *ChannelsEditLocationRequest ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "channels.editLocation" ,
ID : ChannelsEditLocationRequestTypeID ,
}
if e == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "Channel" ,
SchemaName : "channel" ,
},
{
Name : "GeoPoint" ,
SchemaName : "geo_point" ,
},
{
Name : "Address" ,
SchemaName : "address" ,
},
}
return typ
}
func (e *ChannelsEditLocationRequest ) Encode (b *bin .Buffer ) error {
if e == nil {
return fmt .Errorf ("can't encode channels.editLocation#58e63f6d as nil" )
}
b .PutID (ChannelsEditLocationRequestTypeID )
return e .EncodeBare (b )
}
func (e *ChannelsEditLocationRequest ) EncodeBare (b *bin .Buffer ) error {
if e == nil {
return fmt .Errorf ("can't encode channels.editLocation#58e63f6d as nil" )
}
if e .Channel == nil {
return fmt .Errorf ("unable to encode channels.editLocation#58e63f6d: field channel is nil" )
}
if err := e .Channel .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode channels.editLocation#58e63f6d: field channel: %w" , err )
}
if e .GeoPoint == nil {
return fmt .Errorf ("unable to encode channels.editLocation#58e63f6d: field geo_point is nil" )
}
if err := e .GeoPoint .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode channels.editLocation#58e63f6d: field geo_point: %w" , err )
}
b .PutString (e .Address )
return nil
}
func (e *ChannelsEditLocationRequest ) Decode (b *bin .Buffer ) error {
if e == nil {
return fmt .Errorf ("can't decode channels.editLocation#58e63f6d to nil" )
}
if err := b .ConsumeID (ChannelsEditLocationRequestTypeID ); err != nil {
return fmt .Errorf ("unable to decode channels.editLocation#58e63f6d: %w" , err )
}
return e .DecodeBare (b )
}
func (e *ChannelsEditLocationRequest ) DecodeBare (b *bin .Buffer ) error {
if e == nil {
return fmt .Errorf ("can't decode channels.editLocation#58e63f6d to nil" )
}
{
value , err := DecodeInputChannel (b )
if err != nil {
return fmt .Errorf ("unable to decode channels.editLocation#58e63f6d: field channel: %w" , err )
}
e .Channel = value
}
{
value , err := DecodeInputGeoPoint (b )
if err != nil {
return fmt .Errorf ("unable to decode channels.editLocation#58e63f6d: field geo_point: %w" , err )
}
e .GeoPoint = value
}
{
value , err := b .String ()
if err != nil {
return fmt .Errorf ("unable to decode channels.editLocation#58e63f6d: field address: %w" , err )
}
e .Address = value
}
return nil
}
func (e *ChannelsEditLocationRequest ) GetChannel () (value InputChannelClass ) {
if e == nil {
return
}
return e .Channel
}
func (e *ChannelsEditLocationRequest ) GetGeoPoint () (value InputGeoPointClass ) {
if e == nil {
return
}
return e .GeoPoint
}
func (e *ChannelsEditLocationRequest ) GetAddress () (value string ) {
if e == nil {
return
}
return e .Address
}
func (e *ChannelsEditLocationRequest ) GetChannelAsNotEmpty () (NotEmptyInputChannel , bool ) {
return e .Channel .AsNotEmpty ()
}
func (e *ChannelsEditLocationRequest ) GetGeoPointAsNotEmpty () (*InputGeoPoint , bool ) {
return e .GeoPoint .AsNotEmpty ()
}
func (c *Client ) ChannelsEditLocation (ctx context .Context , request *ChannelsEditLocationRequest ) (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.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 .