// 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{} ) // SetStickerSetTitleRequest represents TL type `setStickerSetTitle#64e933a2`. type SetStickerSetTitleRequest struct { // Sticker set name. The sticker set must be owned by the current user Name string // New sticker set title Title string } // SetStickerSetTitleRequestTypeID is TL type id of SetStickerSetTitleRequest. const SetStickerSetTitleRequestTypeID = 0x64e933a2 // Ensuring interfaces in compile-time for SetStickerSetTitleRequest. var ( _ bin.Encoder = &SetStickerSetTitleRequest{} _ bin.Decoder = &SetStickerSetTitleRequest{} _ bin.BareEncoder = &SetStickerSetTitleRequest{} _ bin.BareDecoder = &SetStickerSetTitleRequest{} ) func (s *SetStickerSetTitleRequest) Zero() bool { if s == nil { return true } if !(s.Name == "") { return false } if !(s.Title == "") { return false } return true } // String implements fmt.Stringer. func (s *SetStickerSetTitleRequest) String() string { if s == nil { return "SetStickerSetTitleRequest(nil)" } type Alias SetStickerSetTitleRequest return fmt.Sprintf("SetStickerSetTitleRequest%+v", Alias(*s)) } // TypeID returns type id in TL schema. // // See https://core.telegram.org/mtproto/TL-tl#remarks. func (*SetStickerSetTitleRequest) TypeID() uint32 { return SetStickerSetTitleRequestTypeID } // TypeName returns name of type in TL schema. func (*SetStickerSetTitleRequest) TypeName() string { return "setStickerSetTitle" } // TypeInfo returns info about TL type. func (s *SetStickerSetTitleRequest) TypeInfo() tdp.Type { typ := tdp.Type{ Name: "setStickerSetTitle", ID: SetStickerSetTitleRequestTypeID, } if s == nil { typ.Null = true return typ } typ.Fields = []tdp.Field{ { Name: "Name", SchemaName: "name", }, { Name: "Title", SchemaName: "title", }, } return typ } // Encode implements bin.Encoder. func (s *SetStickerSetTitleRequest) Encode(b *bin.Buffer) error { if s == nil { return fmt.Errorf("can't encode setStickerSetTitle#64e933a2 as nil") } b.PutID(SetStickerSetTitleRequestTypeID) return s.EncodeBare(b) } // EncodeBare implements bin.BareEncoder. func (s *SetStickerSetTitleRequest) EncodeBare(b *bin.Buffer) error { if s == nil { return fmt.Errorf("can't encode setStickerSetTitle#64e933a2 as nil") } b.PutString(s.Name) b.PutString(s.Title) return nil } // Decode implements bin.Decoder. func (s *SetStickerSetTitleRequest) Decode(b *bin.Buffer) error { if s == nil { return fmt.Errorf("can't decode setStickerSetTitle#64e933a2 to nil") } if err := b.ConsumeID(SetStickerSetTitleRequestTypeID); err != nil { return fmt.Errorf("unable to decode setStickerSetTitle#64e933a2: %w", err) } return s.DecodeBare(b) } // DecodeBare implements bin.BareDecoder. func (s *SetStickerSetTitleRequest) DecodeBare(b *bin.Buffer) error { if s == nil { return fmt.Errorf("can't decode setStickerSetTitle#64e933a2 to nil") } { value, err := b.String() if err != nil { return fmt.Errorf("unable to decode setStickerSetTitle#64e933a2: field name: %w", err) } s.Name = value } { value, err := b.String() if err != nil { return fmt.Errorf("unable to decode setStickerSetTitle#64e933a2: field title: %w", err) } s.Title = value } return nil } // EncodeTDLibJSON implements tdjson.TDLibEncoder. func (s *SetStickerSetTitleRequest) EncodeTDLibJSON(b tdjson.Encoder) error { if s == nil { return fmt.Errorf("can't encode setStickerSetTitle#64e933a2 as nil") } b.ObjStart() b.PutID("setStickerSetTitle") b.Comma() b.FieldStart("name") b.PutString(s.Name) b.Comma() b.FieldStart("title") b.PutString(s.Title) b.Comma() b.StripComma() b.ObjEnd() return nil } // DecodeTDLibJSON implements tdjson.TDLibDecoder. func (s *SetStickerSetTitleRequest) DecodeTDLibJSON(b tdjson.Decoder) error { if s == nil { return fmt.Errorf("can't decode setStickerSetTitle#64e933a2 to nil") } return b.Obj(func(b tdjson.Decoder, key []byte) error { switch string(key) { case tdjson.TypeField: if err := b.ConsumeID("setStickerSetTitle"); err != nil { return fmt.Errorf("unable to decode setStickerSetTitle#64e933a2: %w", err) } case "name": value, err := b.String() if err != nil { return fmt.Errorf("unable to decode setStickerSetTitle#64e933a2: field name: %w", err) } s.Name = value case "title": value, err := b.String() if err != nil { return fmt.Errorf("unable to decode setStickerSetTitle#64e933a2: field title: %w", err) } s.Title = value default: return b.Skip() } return nil }) } // GetName returns value of Name field. func (s *SetStickerSetTitleRequest) GetName() (value string) { if s == nil { return } return s.Name } // GetTitle returns value of Title field. func (s *SetStickerSetTitleRequest) GetTitle() (value string) { if s == nil { return } return s.Title } // SetStickerSetTitle invokes method setStickerSetTitle#64e933a2 returning error if any. func (c *Client) SetStickerSetTitle(ctx context.Context, request *SetStickerSetTitleRequest) error { var ok Ok if err := c.rpc.Invoke(ctx, request, &ok); err != nil { return err } return nil }