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
| Name | Type | Required | Description |
|---|---|---|---|
Precise | bool | — | Disable some checks on limit and offset values, useful for example to stream videos by keyframes |
CDNSupported | bool | — | Whether the current client supports CDN downloads |
Location | InputFileLocationClass | yes | File location |
Offset | int64 | yes | Number of bytes to be skipped |
Limit | int | yes | Number of bytes to be returned |
Returns
Possible errors
| Code | Type | Description |
|---|---|---|
| 400 | CDN_METHOD_INVALID | You can't call this method in a CDN DC. |
| 400 | CHANNEL_INVALID | The provided channel is invalid. |
| 400 | CHANNEL_PRIVATE | You haven't joined this channel/supergroup. |
| 406 | FILEREF_UPGRADE_NEEDED | The client has to be updated in order to support file references. |
| 400 | FILE_ID_INVALID | The provided file id is invalid. |
| 400 | FILE_REFERENCE_EMPTY | An empty file reference was specified. |
| 400 | FILE_REFERENCE_EXPIRED | File reference expired, it must be refetched as described in the documentation. |
| 400 | FILE_REFERENCE_INVALID | The specified file reference is invalid. |
| 400 | LIMIT_INVALID | The provided limit is invalid. |
| 400 | LOCATION_INVALID | The provided location is invalid. |
| 400 | MSG_ID_INVALID | Invalid message ID provided. |
| 400 | OFFSET_INVALID | The provided offset is invalid. |
| 400 | PEER_ID_INVALID | The provided peer id is invalid. |
References
- Official documentation
- Generated Go reference
- TL definition:
upload.getFile#be5335be