Downloads
Check app.capabilities for feature support and app.access plus host permissions for authorization. Examples use synthetic values; replace paths, IDs, inputs and filters before calling.
Type Definitions
type Subscription {
downloadsChanged: Boolean!
}
type Mutation {
cancelDownload(id: ID!): Boolean!
createDownload(input: DownloadInput!): Download!
pauseDownload(id: ID!): Boolean!
removeDownload(id: ID!): Boolean!
resumeDownload(id: ID!): Boolean!
retryDownload(id: ID!): Boolean!
}
type Query {
downloads: [Download!]!
}
input ChatDownloadInput {
messageId: ID!
peerId: ID!
fileIds: [String!]!
}
type ChatDownloadSource {
messageId: ID!
peerId: ID!
fileIds: [String!]!
}
type Download {
id: ID!
title: String!
source: DownloadSource!
targetDir: String!
zipName: String
status: DownloadStatus!
downloadedBytes: Long!
totalBytes: Long!
bytesPerSecond: Long!
totalFiles: Int!
doneFiles: Int!
currentFile: String!
error: String!
failures: [DownloadFailure!]!
}
type DownloadFailure {
path: String!
error: String!
}
input DownloadInput @oneOf {
resources: ResourceDownloadInput
chat: ChatDownloadInput
}
union DownloadSource = ResourceDownloadSource | ChatDownloadSource
enum DownloadStatus {
PENDING
DOWNLOADING
PAUSED
PACKING
COMPLETED
PARTIAL
FAILED
CANCELED
}
scalar Long
input ResourceDownloadInput {
urls: [String!]!
targetDir: String!
zipName: String
}
type ResourceDownloadSource {
urls: [String!]!
}Operations
downloadsChanged
Receive a change signal when download progress changes.
subscription downloadsChanged {
downloadsChanged
}cancelDownload
Stop a download and retain its task record and saved files.
mutation cancelDownload($id: ID!) {
cancelDownload(id: $id)
}createDownload
Create a download from resource URLs or chat attachments; supply exactly one source.
mutation createDownload($input: DownloadInput!) {
createDownload(input: $input) { id title targetDir zipName status downloadedBytes totalBytes bytesPerSecond }
}pauseDownload
Pause the specified download task and preserve completed files.
mutation pauseDownload($id: ID!) {
pauseDownload(id: $id)
}removeDownload
Stop a download and remove its task record; keep saved files.
mutation removeDownload($id: ID!) {
removeDownload(id: $id)
}resumeDownload
Resume an existing paused download task.
mutation resumeDownload($id: ID!) {
resumeDownload(id: $id)
}retryDownload
Retry an existing failed, partial or canceled download task.
mutation retryDownload($id: ID!) {
retryDownload(id: $id)
}downloads
List download tasks and their current progress, results and failures.
query downloads {
downloads { id title targetDir zipName status downloadedBytes totalBytes bytesPerSecond }
}