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
239 lines
5.9 KiB
Go
239 lines
5.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{}
|
|
)
|
|
|
|
// CreateBasicGroupChatRequest represents TL type `createBasicGroupChat#758ab4e4`.
|
|
type CreateBasicGroupChatRequest struct {
|
|
// Basic group identifier
|
|
BasicGroupID int64
|
|
// Pass true to create the chat without a network request. In this case all information
|
|
// about the chat except its type, title and photo can be incorrect
|
|
Force bool
|
|
}
|
|
|
|
// CreateBasicGroupChatRequestTypeID is TL type id of CreateBasicGroupChatRequest.
|
|
const CreateBasicGroupChatRequestTypeID = 0x758ab4e4
|
|
|
|
// Ensuring interfaces in compile-time for CreateBasicGroupChatRequest.
|
|
var (
|
|
_ bin.Encoder = &CreateBasicGroupChatRequest{}
|
|
_ bin.Decoder = &CreateBasicGroupChatRequest{}
|
|
_ bin.BareEncoder = &CreateBasicGroupChatRequest{}
|
|
_ bin.BareDecoder = &CreateBasicGroupChatRequest{}
|
|
)
|
|
|
|
func (c *CreateBasicGroupChatRequest) Zero() bool {
|
|
if c == nil {
|
|
return true
|
|
}
|
|
if !(c.BasicGroupID == 0) {
|
|
return false
|
|
}
|
|
if !(c.Force == false) {
|
|
return false
|
|
}
|
|
|
|
return true
|
|
}
|
|
|
|
// String implements fmt.Stringer.
|
|
func (c *CreateBasicGroupChatRequest) String() string {
|
|
if c == nil {
|
|
return "CreateBasicGroupChatRequest(nil)"
|
|
}
|
|
type Alias CreateBasicGroupChatRequest
|
|
return fmt.Sprintf("CreateBasicGroupChatRequest%+v", Alias(*c))
|
|
}
|
|
|
|
// TypeID returns type id in TL schema.
|
|
//
|
|
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
|
func (*CreateBasicGroupChatRequest) TypeID() uint32 {
|
|
return CreateBasicGroupChatRequestTypeID
|
|
}
|
|
|
|
// TypeName returns name of type in TL schema.
|
|
func (*CreateBasicGroupChatRequest) TypeName() string {
|
|
return "createBasicGroupChat"
|
|
}
|
|
|
|
// TypeInfo returns info about TL type.
|
|
func (c *CreateBasicGroupChatRequest) TypeInfo() tdp.Type {
|
|
typ := tdp.Type{
|
|
Name: "createBasicGroupChat",
|
|
ID: CreateBasicGroupChatRequestTypeID,
|
|
}
|
|
if c == nil {
|
|
typ.Null = true
|
|
return typ
|
|
}
|
|
typ.Fields = []tdp.Field{
|
|
{
|
|
Name: "BasicGroupID",
|
|
SchemaName: "basic_group_id",
|
|
},
|
|
{
|
|
Name: "Force",
|
|
SchemaName: "force",
|
|
},
|
|
}
|
|
return typ
|
|
}
|
|
|
|
// Encode implements bin.Encoder.
|
|
func (c *CreateBasicGroupChatRequest) Encode(b *bin.Buffer) error {
|
|
if c == nil {
|
|
return fmt.Errorf("can't encode createBasicGroupChat#758ab4e4 as nil")
|
|
}
|
|
b.PutID(CreateBasicGroupChatRequestTypeID)
|
|
return c.EncodeBare(b)
|
|
}
|
|
|
|
// EncodeBare implements bin.BareEncoder.
|
|
func (c *CreateBasicGroupChatRequest) EncodeBare(b *bin.Buffer) error {
|
|
if c == nil {
|
|
return fmt.Errorf("can't encode createBasicGroupChat#758ab4e4 as nil")
|
|
}
|
|
b.PutInt53(c.BasicGroupID)
|
|
b.PutBool(c.Force)
|
|
return nil
|
|
}
|
|
|
|
// Decode implements bin.Decoder.
|
|
func (c *CreateBasicGroupChatRequest) Decode(b *bin.Buffer) error {
|
|
if c == nil {
|
|
return fmt.Errorf("can't decode createBasicGroupChat#758ab4e4 to nil")
|
|
}
|
|
if err := b.ConsumeID(CreateBasicGroupChatRequestTypeID); err != nil {
|
|
return fmt.Errorf("unable to decode createBasicGroupChat#758ab4e4: %w", err)
|
|
}
|
|
return c.DecodeBare(b)
|
|
}
|
|
|
|
// DecodeBare implements bin.BareDecoder.
|
|
func (c *CreateBasicGroupChatRequest) DecodeBare(b *bin.Buffer) error {
|
|
if c == nil {
|
|
return fmt.Errorf("can't decode createBasicGroupChat#758ab4e4 to nil")
|
|
}
|
|
{
|
|
value, err := b.Int53()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode createBasicGroupChat#758ab4e4: field basic_group_id: %w", err)
|
|
}
|
|
c.BasicGroupID = value
|
|
}
|
|
{
|
|
value, err := b.Bool()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode createBasicGroupChat#758ab4e4: field force: %w", err)
|
|
}
|
|
c.Force = value
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// EncodeTDLibJSON implements tdjson.TDLibEncoder.
|
|
func (c *CreateBasicGroupChatRequest) EncodeTDLibJSON(b tdjson.Encoder) error {
|
|
if c == nil {
|
|
return fmt.Errorf("can't encode createBasicGroupChat#758ab4e4 as nil")
|
|
}
|
|
b.ObjStart()
|
|
b.PutID("createBasicGroupChat")
|
|
b.Comma()
|
|
b.FieldStart("basic_group_id")
|
|
b.PutInt53(c.BasicGroupID)
|
|
b.Comma()
|
|
b.FieldStart("force")
|
|
b.PutBool(c.Force)
|
|
b.Comma()
|
|
b.StripComma()
|
|
b.ObjEnd()
|
|
return nil
|
|
}
|
|
|
|
// DecodeTDLibJSON implements tdjson.TDLibDecoder.
|
|
func (c *CreateBasicGroupChatRequest) DecodeTDLibJSON(b tdjson.Decoder) error {
|
|
if c == nil {
|
|
return fmt.Errorf("can't decode createBasicGroupChat#758ab4e4 to nil")
|
|
}
|
|
|
|
return b.Obj(func(b tdjson.Decoder, key []byte) error {
|
|
switch string(key) {
|
|
case tdjson.TypeField:
|
|
if err := b.ConsumeID("createBasicGroupChat"); err != nil {
|
|
return fmt.Errorf("unable to decode createBasicGroupChat#758ab4e4: %w", err)
|
|
}
|
|
case "basic_group_id":
|
|
value, err := b.Int53()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode createBasicGroupChat#758ab4e4: field basic_group_id: %w", err)
|
|
}
|
|
c.BasicGroupID = value
|
|
case "force":
|
|
value, err := b.Bool()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode createBasicGroupChat#758ab4e4: field force: %w", err)
|
|
}
|
|
c.Force = value
|
|
default:
|
|
return b.Skip()
|
|
}
|
|
return nil
|
|
})
|
|
}
|
|
|
|
// GetBasicGroupID returns value of BasicGroupID field.
|
|
func (c *CreateBasicGroupChatRequest) GetBasicGroupID() (value int64) {
|
|
if c == nil {
|
|
return
|
|
}
|
|
return c.BasicGroupID
|
|
}
|
|
|
|
// GetForce returns value of Force field.
|
|
func (c *CreateBasicGroupChatRequest) GetForce() (value bool) {
|
|
if c == nil {
|
|
return
|
|
}
|
|
return c.Force
|
|
}
|
|
|
|
// CreateBasicGroupChat invokes method createBasicGroupChat#758ab4e4 returning error if any.
|
|
func (c *Client) CreateBasicGroupChat(ctx context.Context, request *CreateBasicGroupChatRequest) (*Chat, error) {
|
|
var result Chat
|
|
|
|
if err := c.rpc.Invoke(ctx, request, &result); err != nil {
|
|
return nil, err
|
|
}
|
|
return &result, nil
|
|
}
|