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