Skip to main content

upload.getFile

Returns content of a whole file or its part.

func (c *Client) UploadGetFile(ctx context.Context, request *UploadGetFileRequest) (UploadFileClass, error)

Calling this method

client.Run(ctx, func(ctx context.Context) error {
api := client.API()

res, err := api.UploadGetFile(ctx, &tg.UploadGetFileRequest{
// see Parameters
})
if err != nil {
return err
}
_ = res // UploadFileClass
return nil
})

Parameters

NameTypeRequiredDescription
PreciseboolDisable some checks on limit and offset values, useful for example to stream videos by keyframes
CDNSupportedboolWhether the current client supports CDN downloads
LocationInputFileLocationClassyesFile location
Offsetint64yesNumber of bytes to be skipped
LimitintyesNumber of bytes to be returned

Returns

UploadFileClass

Possible errors

CodeTypeDescription
400CDN_METHOD_INVALIDYou can't call this method in a CDN DC.
400CHANNEL_INVALIDThe provided channel is invalid.
400CHANNEL_PRIVATEYou haven't joined this channel/supergroup.
406FILEREF_UPGRADE_NEEDEDThe client has to be updated in order to support file references.
400FILE_ID_INVALIDThe provided file id is invalid.
400FILE_REFERENCE_EMPTYAn empty file reference was specified.
400FILE_REFERENCE_EXPIREDFile reference expired, it must be refetched as described in the documentation.
400FILE_REFERENCE_INVALIDThe specified file reference is invalid.
400LIMIT_INVALIDThe provided limit is invalid.
400LOCATION_INVALIDThe provided location is invalid.
400MSG_ID_INVALIDInvalid message ID provided.
400OFFSET_INVALIDThe provided offset is invalid.
400PEER_ID_INVALIDThe provided peer id is invalid.

References