// 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{} ) // GetOwnedBotsRequest represents TL type `getOwnedBots#8b87c7fd`. type GetOwnedBotsRequest struct { } // GetOwnedBotsRequestTypeID is TL type id of GetOwnedBotsRequest. const GetOwnedBotsRequestTypeID = 0x8b87c7fd // Ensuring interfaces in compile-time for GetOwnedBotsRequest. var ( _ bin.Encoder = &GetOwnedBotsRequest{} _ bin.Decoder = &GetOwnedBotsRequest{} _ bin.BareEncoder = &GetOwnedBotsRequest{} _ bin.BareDecoder = &GetOwnedBotsRequest{} ) func (g *GetOwnedBotsRequest) Zero() bool { if g == nil { return true } return true } // String implements fmt.Stringer. func (g *GetOwnedBotsRequest) String() string { if g == nil { return "GetOwnedBotsRequest(nil)" } type Alias GetOwnedBotsRequest return fmt.Sprintf("GetOwnedBotsRequest%+v", Alias(*g)) } // TypeID returns type id in TL schema. // // See https://core.telegram.org/mtproto/TL-tl#remarks. func (*GetOwnedBotsRequest) TypeID() uint32 { return GetOwnedBotsRequestTypeID } // TypeName returns name of type in TL schema. func (*GetOwnedBotsRequest) TypeName() string { return "getOwnedBots" } // TypeInfo returns info about TL type. func (g *GetOwnedBotsRequest) TypeInfo() tdp.Type { typ := tdp.Type{ Name: "getOwnedBots", ID: GetOwnedBotsRequestTypeID, } if g == nil { typ.Null = true return typ } typ.Fields = []tdp.Field{} return typ } // Encode implements bin.Encoder. func (g *GetOwnedBotsRequest) Encode(b *bin.Buffer) error { if g == nil { return fmt.Errorf("can't encode getOwnedBots#8b87c7fd as nil") } b.PutID(GetOwnedBotsRequestTypeID) return g.EncodeBare(b) } // EncodeBare implements bin.BareEncoder. func (g *GetOwnedBotsRequest) EncodeBare(b *bin.Buffer) error { if g == nil { return fmt.Errorf("can't encode getOwnedBots#8b87c7fd as nil") } return nil } // Decode implements bin.Decoder. func (g *GetOwnedBotsRequest) Decode(b *bin.Buffer) error { if g == nil { return fmt.Errorf("can't decode getOwnedBots#8b87c7fd to nil") } if err := b.ConsumeID(GetOwnedBotsRequestTypeID); err != nil { return fmt.Errorf("unable to decode getOwnedBots#8b87c7fd: %w", err) } return g.DecodeBare(b) } // DecodeBare implements bin.BareDecoder. func (g *GetOwnedBotsRequest) DecodeBare(b *bin.Buffer) error { if g == nil { return fmt.Errorf("can't decode getOwnedBots#8b87c7fd to nil") } return nil } // EncodeTDLibJSON implements tdjson.TDLibEncoder. func (g *GetOwnedBotsRequest) EncodeTDLibJSON(b tdjson.Encoder) error { if g == nil { return fmt.Errorf("can't encode getOwnedBots#8b87c7fd as nil") } b.ObjStart() b.PutID("getOwnedBots") b.Comma() b.StripComma() b.ObjEnd() return nil } // DecodeTDLibJSON implements tdjson.TDLibDecoder. func (g *GetOwnedBotsRequest) DecodeTDLibJSON(b tdjson.Decoder) error { if g == nil { return fmt.Errorf("can't decode getOwnedBots#8b87c7fd to nil") } return b.Obj(func(b tdjson.Decoder, key []byte) error { switch string(key) { case tdjson.TypeField: if err := b.ConsumeID("getOwnedBots"); err != nil { return fmt.Errorf("unable to decode getOwnedBots#8b87c7fd: %w", err) } default: return b.Skip() } return nil }) } // GetOwnedBots invokes method getOwnedBots#8b87c7fd returning error if any. func (c *Client) GetOwnedBots(ctx context.Context) (*Users, error) { var result Users request := &GetOwnedBotsRequest{} if err := c.rpc.Invoke(ctx, request, &result); err != nil { return nil, err } return &result, nil }