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