7a04f298d2
- update to latest telegram layer - remove some references to fields in tg.Entities that don't exist in the schema - originally added here: https://github.com/beeper/td/commit/820929062a2ba0104397bc01235ab58a9cff780e - referenced here - https://github.com/mautrix/telegramgo/commit/124f0967ed195b5a380c9bd02e170ada9710dde3 - https://github.com/mautrix/telegramgo/commit/4205047aab2e0639217148b5d125bfaab668bd8e
272 lines
6.9 KiB
Go
272 lines
6.9 KiB
Go
// Code generated by gotdgen, DO NOT EDIT.
|
|
|
|
package tdapi
|
|
|
|
import (
|
|
"context"
|
|
"errors"
|
|
"fmt"
|
|
"sort"
|
|
"strings"
|
|
|
|
"go.uber.org/multierr"
|
|
|
|
"go.mau.fi/mautrix-telegram/pkg/gotd/bin"
|
|
"go.mau.fi/mautrix-telegram/pkg/gotd/tdjson"
|
|
"go.mau.fi/mautrix-telegram/pkg/gotd/tdp"
|
|
"go.mau.fi/mautrix-telegram/pkg/gotd/tgerr"
|
|
)
|
|
|
|
// No-op definition for keeping imports.
|
|
var (
|
|
_ = bin.Buffer{}
|
|
_ = context.Background()
|
|
_ = fmt.Stringer(nil)
|
|
_ = strings.Builder{}
|
|
_ = errors.Is
|
|
_ = multierr.AppendInto
|
|
_ = sort.Ints
|
|
_ = tdp.Format
|
|
_ = tgerr.Error{}
|
|
_ = tdjson.Encoder{}
|
|
)
|
|
|
|
// SetBusinessAccountNameRequest represents TL type `setBusinessAccountName#3b946b52`.
|
|
type SetBusinessAccountNameRequest struct {
|
|
// Unique identifier of business connection
|
|
BusinessConnectionID string
|
|
// The new value of the first name for the business account; 1-64 characters
|
|
FirstName string
|
|
// The new value of the optional last name for the business account; 0-64 characters
|
|
LastName string
|
|
}
|
|
|
|
// SetBusinessAccountNameRequestTypeID is TL type id of SetBusinessAccountNameRequest.
|
|
const SetBusinessAccountNameRequestTypeID = 0x3b946b52
|
|
|
|
// Ensuring interfaces in compile-time for SetBusinessAccountNameRequest.
|
|
var (
|
|
_ bin.Encoder = &SetBusinessAccountNameRequest{}
|
|
_ bin.Decoder = &SetBusinessAccountNameRequest{}
|
|
_ bin.BareEncoder = &SetBusinessAccountNameRequest{}
|
|
_ bin.BareDecoder = &SetBusinessAccountNameRequest{}
|
|
)
|
|
|
|
func (s *SetBusinessAccountNameRequest) Zero() bool {
|
|
if s == nil {
|
|
return true
|
|
}
|
|
if !(s.BusinessConnectionID == "") {
|
|
return false
|
|
}
|
|
if !(s.FirstName == "") {
|
|
return false
|
|
}
|
|
if !(s.LastName == "") {
|
|
return false
|
|
}
|
|
|
|
return true
|
|
}
|
|
|
|
// String implements fmt.Stringer.
|
|
func (s *SetBusinessAccountNameRequest) String() string {
|
|
if s == nil {
|
|
return "SetBusinessAccountNameRequest(nil)"
|
|
}
|
|
type Alias SetBusinessAccountNameRequest
|
|
return fmt.Sprintf("SetBusinessAccountNameRequest%+v", Alias(*s))
|
|
}
|
|
|
|
// TypeID returns type id in TL schema.
|
|
//
|
|
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
|
func (*SetBusinessAccountNameRequest) TypeID() uint32 {
|
|
return SetBusinessAccountNameRequestTypeID
|
|
}
|
|
|
|
// TypeName returns name of type in TL schema.
|
|
func (*SetBusinessAccountNameRequest) TypeName() string {
|
|
return "setBusinessAccountName"
|
|
}
|
|
|
|
// TypeInfo returns info about TL type.
|
|
func (s *SetBusinessAccountNameRequest) TypeInfo() tdp.Type {
|
|
typ := tdp.Type{
|
|
Name: "setBusinessAccountName",
|
|
ID: SetBusinessAccountNameRequestTypeID,
|
|
}
|
|
if s == nil {
|
|
typ.Null = true
|
|
return typ
|
|
}
|
|
typ.Fields = []tdp.Field{
|
|
{
|
|
Name: "BusinessConnectionID",
|
|
SchemaName: "business_connection_id",
|
|
},
|
|
{
|
|
Name: "FirstName",
|
|
SchemaName: "first_name",
|
|
},
|
|
{
|
|
Name: "LastName",
|
|
SchemaName: "last_name",
|
|
},
|
|
}
|
|
return typ
|
|
}
|
|
|
|
// Encode implements bin.Encoder.
|
|
func (s *SetBusinessAccountNameRequest) Encode(b *bin.Buffer) error {
|
|
if s == nil {
|
|
return fmt.Errorf("can't encode setBusinessAccountName#3b946b52 as nil")
|
|
}
|
|
b.PutID(SetBusinessAccountNameRequestTypeID)
|
|
return s.EncodeBare(b)
|
|
}
|
|
|
|
// EncodeBare implements bin.BareEncoder.
|
|
func (s *SetBusinessAccountNameRequest) EncodeBare(b *bin.Buffer) error {
|
|
if s == nil {
|
|
return fmt.Errorf("can't encode setBusinessAccountName#3b946b52 as nil")
|
|
}
|
|
b.PutString(s.BusinessConnectionID)
|
|
b.PutString(s.FirstName)
|
|
b.PutString(s.LastName)
|
|
return nil
|
|
}
|
|
|
|
// Decode implements bin.Decoder.
|
|
func (s *SetBusinessAccountNameRequest) Decode(b *bin.Buffer) error {
|
|
if s == nil {
|
|
return fmt.Errorf("can't decode setBusinessAccountName#3b946b52 to nil")
|
|
}
|
|
if err := b.ConsumeID(SetBusinessAccountNameRequestTypeID); err != nil {
|
|
return fmt.Errorf("unable to decode setBusinessAccountName#3b946b52: %w", err)
|
|
}
|
|
return s.DecodeBare(b)
|
|
}
|
|
|
|
// DecodeBare implements bin.BareDecoder.
|
|
func (s *SetBusinessAccountNameRequest) DecodeBare(b *bin.Buffer) error {
|
|
if s == nil {
|
|
return fmt.Errorf("can't decode setBusinessAccountName#3b946b52 to nil")
|
|
}
|
|
{
|
|
value, err := b.String()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode setBusinessAccountName#3b946b52: field business_connection_id: %w", err)
|
|
}
|
|
s.BusinessConnectionID = value
|
|
}
|
|
{
|
|
value, err := b.String()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode setBusinessAccountName#3b946b52: field first_name: %w", err)
|
|
}
|
|
s.FirstName = value
|
|
}
|
|
{
|
|
value, err := b.String()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode setBusinessAccountName#3b946b52: field last_name: %w", err)
|
|
}
|
|
s.LastName = value
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// EncodeTDLibJSON implements tdjson.TDLibEncoder.
|
|
func (s *SetBusinessAccountNameRequest) EncodeTDLibJSON(b tdjson.Encoder) error {
|
|
if s == nil {
|
|
return fmt.Errorf("can't encode setBusinessAccountName#3b946b52 as nil")
|
|
}
|
|
b.ObjStart()
|
|
b.PutID("setBusinessAccountName")
|
|
b.Comma()
|
|
b.FieldStart("business_connection_id")
|
|
b.PutString(s.BusinessConnectionID)
|
|
b.Comma()
|
|
b.FieldStart("first_name")
|
|
b.PutString(s.FirstName)
|
|
b.Comma()
|
|
b.FieldStart("last_name")
|
|
b.PutString(s.LastName)
|
|
b.Comma()
|
|
b.StripComma()
|
|
b.ObjEnd()
|
|
return nil
|
|
}
|
|
|
|
// DecodeTDLibJSON implements tdjson.TDLibDecoder.
|
|
func (s *SetBusinessAccountNameRequest) DecodeTDLibJSON(b tdjson.Decoder) error {
|
|
if s == nil {
|
|
return fmt.Errorf("can't decode setBusinessAccountName#3b946b52 to nil")
|
|
}
|
|
|
|
return b.Obj(func(b tdjson.Decoder, key []byte) error {
|
|
switch string(key) {
|
|
case tdjson.TypeField:
|
|
if err := b.ConsumeID("setBusinessAccountName"); err != nil {
|
|
return fmt.Errorf("unable to decode setBusinessAccountName#3b946b52: %w", err)
|
|
}
|
|
case "business_connection_id":
|
|
value, err := b.String()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode setBusinessAccountName#3b946b52: field business_connection_id: %w", err)
|
|
}
|
|
s.BusinessConnectionID = value
|
|
case "first_name":
|
|
value, err := b.String()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode setBusinessAccountName#3b946b52: field first_name: %w", err)
|
|
}
|
|
s.FirstName = value
|
|
case "last_name":
|
|
value, err := b.String()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode setBusinessAccountName#3b946b52: field last_name: %w", err)
|
|
}
|
|
s.LastName = value
|
|
default:
|
|
return b.Skip()
|
|
}
|
|
return nil
|
|
})
|
|
}
|
|
|
|
// GetBusinessConnectionID returns value of BusinessConnectionID field.
|
|
func (s *SetBusinessAccountNameRequest) GetBusinessConnectionID() (value string) {
|
|
if s == nil {
|
|
return
|
|
}
|
|
return s.BusinessConnectionID
|
|
}
|
|
|
|
// GetFirstName returns value of FirstName field.
|
|
func (s *SetBusinessAccountNameRequest) GetFirstName() (value string) {
|
|
if s == nil {
|
|
return
|
|
}
|
|
return s.FirstName
|
|
}
|
|
|
|
// GetLastName returns value of LastName field.
|
|
func (s *SetBusinessAccountNameRequest) GetLastName() (value string) {
|
|
if s == nil {
|
|
return
|
|
}
|
|
return s.LastName
|
|
}
|
|
|
|
// SetBusinessAccountName invokes method setBusinessAccountName#3b946b52 returning error if any.
|
|
func (c *Client) SetBusinessAccountName(ctx context.Context, request *SetBusinessAccountNameRequest) error {
|
|
var ok Ok
|
|
|
|
if err := c.rpc.Invoke(ctx, request, &ok); err != nil {
|
|
return err
|
|
}
|
|
return nil
|
|
}
|