// 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{})// MessagesUploadMediaRequest represents TL type `messages.uploadMedia#519bc2b1`.// Upload a file and associate it to a chat (without actually sending it to the chat)//// See https://core.telegram.org/method/messages.uploadMedia for reference.typeMessagesUploadMediaRequeststruct {// The chat, can be inputPeerEmpty¹ for bots and inputPeerSelf² for users. // // Links: // 1) https://core.telegram.org/constructor/inputPeerEmpty // 2) https://core.telegram.org/constructor/inputPeerSelfPeerInputPeerClass// File uploaded in chunks as described in files »¹ // // Links: // 1) https://core.telegram.org/api/filesMediaInputMediaClass}// MessagesUploadMediaRequestTypeID is TL type id of MessagesUploadMediaRequest.constMessagesUploadMediaRequestTypeID = 0x519bc2b1// Ensuring interfaces in compile-time for MessagesUploadMediaRequest.var ( _ bin.Encoder = &MessagesUploadMediaRequest{} _ bin.Decoder = &MessagesUploadMediaRequest{} _ bin.BareEncoder = &MessagesUploadMediaRequest{} _ bin.BareDecoder = &MessagesUploadMediaRequest{})func ( *MessagesUploadMediaRequest) () bool {if == nil {returntrue }if !(.Peer == nil) {returnfalse }if !(.Media == nil) {returnfalse }returntrue}// String implements fmt.Stringer.func ( *MessagesUploadMediaRequest) () string {if == nil {return"MessagesUploadMediaRequest(nil)" }typeMessagesUploadMediaRequestreturnfmt.Sprintf("MessagesUploadMediaRequest%+v", (*))}// FillFrom fills MessagesUploadMediaRequest from given interface.func ( *MessagesUploadMediaRequest) ( interface { () ( InputPeerClass) () ( InputMediaClass)}) { .Peer = .() .Media = .()}// TypeID returns type id in TL schema.//// See https://core.telegram.org/mtproto/TL-tl#remarks.func (*MessagesUploadMediaRequest) () uint32 {returnMessagesUploadMediaRequestTypeID}// TypeName returns name of type in TL schema.func (*MessagesUploadMediaRequest) () string {return"messages.uploadMedia"}// TypeInfo returns info about TL type.func ( *MessagesUploadMediaRequest) () tdp.Type { := tdp.Type{Name: "messages.uploadMedia",ID: MessagesUploadMediaRequestTypeID, }if == nil { .Null = truereturn } .Fields = []tdp.Field{ {Name: "Peer",SchemaName: "peer", }, {Name: "Media",SchemaName: "media", }, }return}// Encode implements bin.Encoder.func ( *MessagesUploadMediaRequest) ( *bin.Buffer) error {if == nil {returnfmt.Errorf("can't encode messages.uploadMedia#519bc2b1 as nil") } .PutID(MessagesUploadMediaRequestTypeID)return .EncodeBare()}// EncodeBare implements bin.BareEncoder.func ( *MessagesUploadMediaRequest) ( *bin.Buffer) error {if == nil {returnfmt.Errorf("can't encode messages.uploadMedia#519bc2b1 as nil") }if .Peer == nil {returnfmt.Errorf("unable to encode messages.uploadMedia#519bc2b1: field peer is nil") }if := .Peer.Encode(); != nil {returnfmt.Errorf("unable to encode messages.uploadMedia#519bc2b1: field peer: %w", ) }if .Media == nil {returnfmt.Errorf("unable to encode messages.uploadMedia#519bc2b1: field media is nil") }if := .Media.Encode(); != nil {returnfmt.Errorf("unable to encode messages.uploadMedia#519bc2b1: field media: %w", ) }returnnil}// Decode implements bin.Decoder.func ( *MessagesUploadMediaRequest) ( *bin.Buffer) error {if == nil {returnfmt.Errorf("can't decode messages.uploadMedia#519bc2b1 to nil") }if := .ConsumeID(MessagesUploadMediaRequestTypeID); != nil {returnfmt.Errorf("unable to decode messages.uploadMedia#519bc2b1: %w", ) }return .DecodeBare()}// DecodeBare implements bin.BareDecoder.func ( *MessagesUploadMediaRequest) ( *bin.Buffer) error {if == nil {returnfmt.Errorf("can't decode messages.uploadMedia#519bc2b1 to nil") } { , := DecodeInputPeer()if != nil {returnfmt.Errorf("unable to decode messages.uploadMedia#519bc2b1: field peer: %w", ) } .Peer = } { , := DecodeInputMedia()if != nil {returnfmt.Errorf("unable to decode messages.uploadMedia#519bc2b1: field media: %w", ) } .Media = }returnnil}// GetPeer returns value of Peer field.func ( *MessagesUploadMediaRequest) () ( InputPeerClass) {if == nil {return }return .Peer}// GetMedia returns value of Media field.func ( *MessagesUploadMediaRequest) () ( InputMediaClass) {if == nil {return }return .Media}// MessagesUploadMedia invokes method messages.uploadMedia#519bc2b1 returning error if any.// Upload a file and associate it to a chat (without actually sending it to the chat)//// Possible errors://// 400 CHANNEL_INVALID: The provided channel is invalid.// 400 CHANNEL_PRIVATE: You haven't joined this channel/supergroup.// 400 CHAT_ADMIN_REQUIRED: You must be an admin in this chat to do this.// 400 CHAT_ID_INVALID: The provided chat id is invalid.// 400 CHAT_RESTRICTED: You can't send messages in this chat, you were restricted.// 403 CHAT_WRITE_FORBIDDEN: You can't write in this chat.// 400 FILE_PARTS_INVALID: The number of file parts is invalid.// 400 FILE_PART_LENGTH_INVALID: The length of a file part is invalid.// 400 IMAGE_PROCESS_FAILED: Failure while processing image.// 400 INPUT_USER_DEACTIVATED: The specified user was deleted.// 400 MEDIA_INVALID: Media invalid.// 400 MSG_ID_INVALID: Invalid message ID provided.// 400 PEER_ID_INVALID: The provided peer id is invalid.// 400 PHOTO_EXT_INVALID: The extension of the photo is invalid.// 400 PHOTO_INVALID_DIMENSIONS: The photo dimensions are invalid.// 400 PHOTO_SAVE_FILE_INVALID: Internal issues, try again later.// 400 USER_BANNED_IN_CHANNEL: You're banned from sending messages in supergroups/channels.// 400 WEBPAGE_CURL_FAILED: Failure while fetching the webpage with cURL.//// See https://core.telegram.org/method/messages.uploadMedia for reference.// Can be used by bots.func ( *Client) ( context.Context, *MessagesUploadMediaRequest) (MessageMediaClass, error) {varMessageMediaBoxif := .rpc.Invoke(, , &); != nil {returnnil, }return .MessageMedia, 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.