Download
Verificare app.capabilities per il supporto delle funzionalità e app.access insieme alle autorizzazioni host per l’autorizzazione. Gli esempi usano valori sintetici; sostituire percorsi, ID, input e filtri prima della chiamata.
Definizioni di tipo
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!]!
}Operazioni
downloadsChanged
Ricevere un segnale quando cambia l’avanzamento dei download.
subscription downloadsChanged {
downloadsChanged
}cancelDownload
Interrompere un download conservando la relativa registrazione e i file salvati.
mutation cancelDownload($id: ID!) {
cancelDownload(id: $id)
}createDownload
Creare un download da URL di risorse o allegati della chat; specificare esattamente una fonte.
mutation createDownload($input: DownloadInput!) {
createDownload(input: $input) { id title targetDir zipName status downloadedBytes totalBytes bytesPerSecond }
}pauseDownload
Mettere in pausa il download indicato e conservare i file completati.
mutation pauseDownload($id: ID!) {
pauseDownload(id: $id)
}removeDownload
Interrompere un download e rimuoverne la registrazione; conservare i file salvati.
mutation removeDownload($id: ID!) {
removeDownload(id: $id)
}resumeDownload
Riprendere un download esistente in pausa.
mutation resumeDownload($id: ID!) {
resumeDownload(id: $id)
}retryDownload
Riprovare un download esistente non riuscito, parziale o annullato.
mutation retryDownload($id: ID!) {
retryDownload(id: $id)
}downloads
Elencare i download con avanzamento, risultati ed errori attuali.
query downloads {
downloads { id title targetDir zipName status downloadedBytes totalBytes bytesPerSecond }
}