Files
mautrix-telegram/pkg/gotd/tdapi/tl_remove_notification_group_gen.go
T
2025-06-27 20:03:37 -07:00

238 lines
6.2 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{}
)
// RemoveNotificationGroupRequest represents TL type `removeNotificationGroup#661a638e`.
type RemoveNotificationGroupRequest struct {
// Notification group identifier
NotificationGroupID int32
// The maximum identifier of removed notifications
MaxNotificationID int32
}
// RemoveNotificationGroupRequestTypeID is TL type id of RemoveNotificationGroupRequest.
const RemoveNotificationGroupRequestTypeID = 0x661a638e
// Ensuring interfaces in compile-time for RemoveNotificationGroupRequest.
var (
_ bin.Encoder = &RemoveNotificationGroupRequest{}
_ bin.Decoder = &RemoveNotificationGroupRequest{}
_ bin.BareEncoder = &RemoveNotificationGroupRequest{}
_ bin.BareDecoder = &RemoveNotificationGroupRequest{}
)
func (r *RemoveNotificationGroupRequest) Zero() bool {
if r == nil {
return true
}
if !(r.NotificationGroupID == 0) {
return false
}
if !(r.MaxNotificationID == 0) {
return false
}
return true
}
// String implements fmt.Stringer.
func (r *RemoveNotificationGroupRequest) String() string {
if r == nil {
return "RemoveNotificationGroupRequest(nil)"
}
type Alias RemoveNotificationGroupRequest
return fmt.Sprintf("RemoveNotificationGroupRequest%+v", Alias(*r))
}
// TypeID returns type id in TL schema.
//
// See https://core.telegram.org/mtproto/TL-tl#remarks.
func (*RemoveNotificationGroupRequest) TypeID() uint32 {
return RemoveNotificationGroupRequestTypeID
}
// TypeName returns name of type in TL schema.
func (*RemoveNotificationGroupRequest) TypeName() string {
return "removeNotificationGroup"
}
// TypeInfo returns info about TL type.
func (r *RemoveNotificationGroupRequest) TypeInfo() tdp.Type {
typ := tdp.Type{
Name: "removeNotificationGroup",
ID: RemoveNotificationGroupRequestTypeID,
}
if r == nil {
typ.Null = true
return typ
}
typ.Fields = []tdp.Field{
{
Name: "NotificationGroupID",
SchemaName: "notification_group_id",
},
{
Name: "MaxNotificationID",
SchemaName: "max_notification_id",
},
}
return typ
}
// Encode implements bin.Encoder.
func (r *RemoveNotificationGroupRequest) Encode(b *bin.Buffer) error {
if r == nil {
return fmt.Errorf("can't encode removeNotificationGroup#661a638e as nil")
}
b.PutID(RemoveNotificationGroupRequestTypeID)
return r.EncodeBare(b)
}
// EncodeBare implements bin.BareEncoder.
func (r *RemoveNotificationGroupRequest) EncodeBare(b *bin.Buffer) error {
if r == nil {
return fmt.Errorf("can't encode removeNotificationGroup#661a638e as nil")
}
b.PutInt32(r.NotificationGroupID)
b.PutInt32(r.MaxNotificationID)
return nil
}
// Decode implements bin.Decoder.
func (r *RemoveNotificationGroupRequest) Decode(b *bin.Buffer) error {
if r == nil {
return fmt.Errorf("can't decode removeNotificationGroup#661a638e to nil")
}
if err := b.ConsumeID(RemoveNotificationGroupRequestTypeID); err != nil {
return fmt.Errorf("unable to decode removeNotificationGroup#661a638e: %w", err)
}
return r.DecodeBare(b)
}
// DecodeBare implements bin.BareDecoder.
func (r *RemoveNotificationGroupRequest) DecodeBare(b *bin.Buffer) error {
if r == nil {
return fmt.Errorf("can't decode removeNotificationGroup#661a638e to nil")
}
{
value, err := b.Int32()
if err != nil {
return fmt.Errorf("unable to decode removeNotificationGroup#661a638e: field notification_group_id: %w", err)
}
r.NotificationGroupID = value
}
{
value, err := b.Int32()
if err != nil {
return fmt.Errorf("unable to decode removeNotificationGroup#661a638e: field max_notification_id: %w", err)
}
r.MaxNotificationID = value
}
return nil
}
// EncodeTDLibJSON implements tdjson.TDLibEncoder.
func (r *RemoveNotificationGroupRequest) EncodeTDLibJSON(b tdjson.Encoder) error {
if r == nil {
return fmt.Errorf("can't encode removeNotificationGroup#661a638e as nil")
}
b.ObjStart()
b.PutID("removeNotificationGroup")
b.Comma()
b.FieldStart("notification_group_id")
b.PutInt32(r.NotificationGroupID)
b.Comma()
b.FieldStart("max_notification_id")
b.PutInt32(r.MaxNotificationID)
b.Comma()
b.StripComma()
b.ObjEnd()
return nil
}
// DecodeTDLibJSON implements tdjson.TDLibDecoder.
func (r *RemoveNotificationGroupRequest) DecodeTDLibJSON(b tdjson.Decoder) error {
if r == nil {
return fmt.Errorf("can't decode removeNotificationGroup#661a638e to nil")
}
return b.Obj(func(b tdjson.Decoder, key []byte) error {
switch string(key) {
case tdjson.TypeField:
if err := b.ConsumeID("removeNotificationGroup"); err != nil {
return fmt.Errorf("unable to decode removeNotificationGroup#661a638e: %w", err)
}
case "notification_group_id":
value, err := b.Int32()
if err != nil {
return fmt.Errorf("unable to decode removeNotificationGroup#661a638e: field notification_group_id: %w", err)
}
r.NotificationGroupID = value
case "max_notification_id":
value, err := b.Int32()
if err != nil {
return fmt.Errorf("unable to decode removeNotificationGroup#661a638e: field max_notification_id: %w", err)
}
r.MaxNotificationID = value
default:
return b.Skip()
}
return nil
})
}
// GetNotificationGroupID returns value of NotificationGroupID field.
func (r *RemoveNotificationGroupRequest) GetNotificationGroupID() (value int32) {
if r == nil {
return
}
return r.NotificationGroupID
}
// GetMaxNotificationID returns value of MaxNotificationID field.
func (r *RemoveNotificationGroupRequest) GetMaxNotificationID() (value int32) {
if r == nil {
return
}
return r.MaxNotificationID
}
// RemoveNotificationGroup invokes method removeNotificationGroup#661a638e returning error if any.
func (c *Client) RemoveNotificationGroup(ctx context.Context, request *RemoveNotificationGroupRequest) error {
var ok Ok
if err := c.rpc.Invoke(ctx, request, &ok); err != nil {
return err
}
return nil
}