// 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{})// MessagesAddChatUserRequest represents TL type `messages.addChatUser#f24753e3`.// Adds a user to a chat and sends a service message on it.// 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/messages.addChatUser for reference.typeMessagesAddChatUserRequeststruct {// Chat IDChatIDint64// User ID to be addedUserIDInputUserClass// Number of last messages to be forwardedFwdLimitint}// MessagesAddChatUserRequestTypeID is TL type id of MessagesAddChatUserRequest.constMessagesAddChatUserRequestTypeID = 0xf24753e3// Ensuring interfaces in compile-time for MessagesAddChatUserRequest.var ( _ bin.Encoder = &MessagesAddChatUserRequest{} _ bin.Decoder = &MessagesAddChatUserRequest{} _ bin.BareEncoder = &MessagesAddChatUserRequest{} _ bin.BareDecoder = &MessagesAddChatUserRequest{})func ( *MessagesAddChatUserRequest) () bool {if == nil {returntrue }if !(.ChatID == 0) {returnfalse }if !(.UserID == nil) {returnfalse }if !(.FwdLimit == 0) {returnfalse }returntrue}// String implements fmt.Stringer.func ( *MessagesAddChatUserRequest) () string {if == nil {return"MessagesAddChatUserRequest(nil)" }typeMessagesAddChatUserRequestreturnfmt.Sprintf("MessagesAddChatUserRequest%+v", (*))}// FillFrom fills MessagesAddChatUserRequest from given interface.func ( *MessagesAddChatUserRequest) ( interface { () ( int64) () ( InputUserClass) () ( int)}) { .ChatID = .() .UserID = .() .FwdLimit = .()}// TypeID returns type id in TL schema.//// See https://core.telegram.org/mtproto/TL-tl#remarks.func (*MessagesAddChatUserRequest) () uint32 {returnMessagesAddChatUserRequestTypeID}// TypeName returns name of type in TL schema.func (*MessagesAddChatUserRequest) () string {return"messages.addChatUser"}// TypeInfo returns info about TL type.func ( *MessagesAddChatUserRequest) () tdp.Type { := tdp.Type{Name: "messages.addChatUser",ID: MessagesAddChatUserRequestTypeID, }if == nil { .Null = truereturn } .Fields = []tdp.Field{ {Name: "ChatID",SchemaName: "chat_id", }, {Name: "UserID",SchemaName: "user_id", }, {Name: "FwdLimit",SchemaName: "fwd_limit", }, }return}// Encode implements bin.Encoder.func ( *MessagesAddChatUserRequest) ( *bin.Buffer) error {if == nil {returnfmt.Errorf("can't encode messages.addChatUser#f24753e3 as nil") } .PutID(MessagesAddChatUserRequestTypeID)return .EncodeBare()}// EncodeBare implements bin.BareEncoder.func ( *MessagesAddChatUserRequest) ( *bin.Buffer) error {if == nil {returnfmt.Errorf("can't encode messages.addChatUser#f24753e3 as nil") } .PutLong(.ChatID)if .UserID == nil {returnfmt.Errorf("unable to encode messages.addChatUser#f24753e3: field user_id is nil") }if := .UserID.Encode(); != nil {returnfmt.Errorf("unable to encode messages.addChatUser#f24753e3: field user_id: %w", ) } .PutInt(.FwdLimit)returnnil}// Decode implements bin.Decoder.func ( *MessagesAddChatUserRequest) ( *bin.Buffer) error {if == nil {returnfmt.Errorf("can't decode messages.addChatUser#f24753e3 to nil") }if := .ConsumeID(MessagesAddChatUserRequestTypeID); != nil {returnfmt.Errorf("unable to decode messages.addChatUser#f24753e3: %w", ) }return .DecodeBare()}// DecodeBare implements bin.BareDecoder.func ( *MessagesAddChatUserRequest) ( *bin.Buffer) error {if == nil {returnfmt.Errorf("can't decode messages.addChatUser#f24753e3 to nil") } { , := .Long()if != nil {returnfmt.Errorf("unable to decode messages.addChatUser#f24753e3: field chat_id: %w", ) } .ChatID = } { , := DecodeInputUser()if != nil {returnfmt.Errorf("unable to decode messages.addChatUser#f24753e3: field user_id: %w", ) } .UserID = } { , := .Int()if != nil {returnfmt.Errorf("unable to decode messages.addChatUser#f24753e3: field fwd_limit: %w", ) } .FwdLimit = }returnnil}// GetChatID returns value of ChatID field.func ( *MessagesAddChatUserRequest) () ( int64) {if == nil {return }return .ChatID}// GetUserID returns value of UserID field.func ( *MessagesAddChatUserRequest) () ( InputUserClass) {if == nil {return }return .UserID}// GetFwdLimit returns value of FwdLimit field.func ( *MessagesAddChatUserRequest) () ( int) {if == nil {return }return .FwdLimit}// MessagesAddChatUser invokes method messages.addChatUser#f24753e3 returning error if any.// Adds a user to a chat and sends a service message on it.// 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 BOT_GROUPS_BLOCKED: This bot can't be added to groups.// 403 CHAT_ADMIN_REQUIRED: You must be an admin in this chat to do this.// 400 CHAT_ID_INVALID: The provided chat id is invalid.// 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 PEER_ID_INVALID: The provided peer id is invalid.// 400 USERS_TOO_MUCH: The maximum number of users has been exceeded (to create a chat, for example).// 400 USER_ALREADY_PARTICIPANT: The user is already in the group.// 400 USER_ID_INVALID: The provided user ID is invalid.// 400 USER_IS_BLOCKED: You were blocked by this user.// 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.// 400 YOU_BLOCKED_USER: You blocked this user.//// See https://core.telegram.org/method/messages.addChatUser for reference.func ( *Client) ( context.Context, *MessagesAddChatUserRequest) (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.