// Code generated by gotdgen, DO NOT EDIT.package tgimport ()// 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{})// ChannelsInviteToChannelRequest represents TL type `channels.inviteToChannel#199f3a6c`.// Invite users to a channel/supergroup// May also return 0-N updates of type updateGroupInvitePrivacyForbidden¹: it indicates// we couldn't add a user to a chat because of their privacy settings; if required, an// invite link² can be shared with the user, instead.//// Links:// 1. https://core.telegram.org/constructor/updateGroupInvitePrivacyForbidden// 2. https://core.telegram.org/api/invites//// See https://core.telegram.org/method/channels.inviteToChannel for reference.typeChannelsInviteToChannelRequeststruct {// Channel/supergroupChannelInputChannelClass// Users to inviteUsers []InputUserClass}// ChannelsInviteToChannelRequestTypeID is TL type id of ChannelsInviteToChannelRequest.constChannelsInviteToChannelRequestTypeID = 0x199f3a6c// Ensuring interfaces in compile-time for ChannelsInviteToChannelRequest.var ( _ bin.Encoder = &ChannelsInviteToChannelRequest{} _ bin.Decoder = &ChannelsInviteToChannelRequest{} _ bin.BareEncoder = &ChannelsInviteToChannelRequest{} _ bin.BareDecoder = &ChannelsInviteToChannelRequest{})func ( *ChannelsInviteToChannelRequest) () bool {if == nil {returntrue }if !(.Channel == nil) {returnfalse }if !(.Users == nil) {returnfalse }returntrue}// String implements fmt.Stringer.func ( *ChannelsInviteToChannelRequest) () string {if == nil {return"ChannelsInviteToChannelRequest(nil)" }typeChannelsInviteToChannelRequestreturnfmt.Sprintf("ChannelsInviteToChannelRequest%+v", (*))}// FillFrom fills ChannelsInviteToChannelRequest from given interface.func ( *ChannelsInviteToChannelRequest) ( interface { () ( InputChannelClass) () ( []InputUserClass)}) { .Channel = .() .Users = .()}// TypeID returns type id in TL schema.//// See https://core.telegram.org/mtproto/TL-tl#remarks.func (*ChannelsInviteToChannelRequest) () uint32 {returnChannelsInviteToChannelRequestTypeID}// TypeName returns name of type in TL schema.func (*ChannelsInviteToChannelRequest) () string {return"channels.inviteToChannel"}// TypeInfo returns info about TL type.func ( *ChannelsInviteToChannelRequest) () tdp.Type { := tdp.Type{Name: "channels.inviteToChannel",ID: ChannelsInviteToChannelRequestTypeID, }if == nil { .Null = truereturn } .Fields = []tdp.Field{ {Name: "Channel",SchemaName: "channel", }, {Name: "Users",SchemaName: "users", }, }return}// Encode implements bin.Encoder.func ( *ChannelsInviteToChannelRequest) ( *bin.Buffer) error {if == nil {returnfmt.Errorf("can't encode channels.inviteToChannel#199f3a6c as nil") } .PutID(ChannelsInviteToChannelRequestTypeID)return .EncodeBare()}// EncodeBare implements bin.BareEncoder.func ( *ChannelsInviteToChannelRequest) ( *bin.Buffer) error {if == nil {returnfmt.Errorf("can't encode channels.inviteToChannel#199f3a6c as nil") }if .Channel == nil {returnfmt.Errorf("unable to encode channels.inviteToChannel#199f3a6c: field channel is nil") }if := .Channel.Encode(); != nil {returnfmt.Errorf("unable to encode channels.inviteToChannel#199f3a6c: field channel: %w", ) } .PutVectorHeader(len(.Users))for , := range .Users {if == nil {returnfmt.Errorf("unable to encode channels.inviteToChannel#199f3a6c: field users element with index %d is nil", ) }if := .Encode(); != nil {returnfmt.Errorf("unable to encode channels.inviteToChannel#199f3a6c: field users element with index %d: %w", , ) } }returnnil}// Decode implements bin.Decoder.func ( *ChannelsInviteToChannelRequest) ( *bin.Buffer) error {if == nil {returnfmt.Errorf("can't decode channels.inviteToChannel#199f3a6c to nil") }if := .ConsumeID(ChannelsInviteToChannelRequestTypeID); != nil {returnfmt.Errorf("unable to decode channels.inviteToChannel#199f3a6c: %w", ) }return .DecodeBare()}// DecodeBare implements bin.BareDecoder.func ( *ChannelsInviteToChannelRequest) ( *bin.Buffer) error {if == nil {returnfmt.Errorf("can't decode channels.inviteToChannel#199f3a6c to nil") } { , := DecodeInputChannel()if != nil {returnfmt.Errorf("unable to decode channels.inviteToChannel#199f3a6c: field channel: %w", ) } .Channel = } { , := .VectorHeader()if != nil {returnfmt.Errorf("unable to decode channels.inviteToChannel#199f3a6c: field users: %w", ) }if > 0 { .Users = make([]InputUserClass, 0, %bin.PreallocateLimit) }for := 0; < ; ++ { , := DecodeInputUser()if != nil {returnfmt.Errorf("unable to decode channels.inviteToChannel#199f3a6c: field users: %w", ) } .Users = append(.Users, ) } }returnnil}// GetChannel returns value of Channel field.func ( *ChannelsInviteToChannelRequest) () ( InputChannelClass) {if == nil {return }return .Channel}// GetUsers returns value of Users field.func ( *ChannelsInviteToChannelRequest) () ( []InputUserClass) {if == nil {return }return .Users}// GetChannelAsNotEmpty returns mapped value of Channel field.func ( *ChannelsInviteToChannelRequest) () (NotEmptyInputChannel, bool) {return .Channel.AsNotEmpty()}// MapUsers returns field Users wrapped in InputUserClassArray helper.func ( *ChannelsInviteToChannelRequest) () ( InputUserClassArray) {returnInputUserClassArray(.Users)}// ChannelsInviteToChannel invokes method channels.inviteToChannel#199f3a6c returning error if any.// Invite users to a channel/supergroup// May also return 0-N updates of type updateGroupInvitePrivacyForbidden¹: it indicates// we couldn't add a user to a chat because of their privacy settings; if required, an// invite link² can be shared with the user, instead.//// Links:// 1. https://core.telegram.org/constructor/updateGroupInvitePrivacyForbidden// 2. https://core.telegram.org/api/invites//// Possible errors://// 400 BOTS_TOO_MUCH: There are too many bots in this chat/channel.// 400 BOT_GROUPS_BLOCKED: This bot can't be added to groups.// 400 CHANNEL_INVALID: The provided channel is invalid.// 406 CHANNEL_PRIVATE: You haven't joined this channel/supergroup.// 403 CHAT_ADMIN_REQUIRED: You must be an admin in this chat to do this.// 400 CHAT_INVALID: Invalid chat.// 403 CHAT_WRITE_FORBIDDEN: You can't write in this chat.// 400 INPUT_USER_DEACTIVATED: The specified user was deleted.// 400 MSG_ID_INVALID: Invalid message ID provided.// 400 USERS_TOO_MUCH: The maximum number of users has been exceeded (to create a chat, for example).// 400 USER_BANNED_IN_CHANNEL: You're banned from sending messages in supergroups/channels.// 400 USER_BLOCKED: User blocked.// 400 USER_BOT: Bots can only be admins in channels.// 403 USER_CHANNELS_TOO_MUCH: One of the users you tried to add is already in too many channels/supergroups.// 400 USER_ID_INVALID: The provided user ID is invalid.// 400 USER_KICKED: This user was kicked from this supergroup/channel.// 403 USER_NOT_MUTUAL_CONTACT: The provided user is not a mutual contact.// 403 USER_PRIVACY_RESTRICTED: The user's privacy settings do not allow you to do this.//// See https://core.telegram.org/method/channels.inviteToChannel for reference.func ( *Client) ( context.Context, *ChannelsInviteToChannelRequest) (UpdatesClass, error) {varUpdatesBoxif := .rpc.Invoke(, , &); != nil {returnnil, }return .Updates, nil}
The pages are generated with Goldsv0.6.7. (GOOS=linux GOARCH=amd64)
Golds is a Go 101 project developed by Tapir Liu.
PR and bug reports are welcome and can be submitted to the issue list.
Please follow @Go100and1 (reachable from the left QR code) to get the latest news of Golds.