Téléchargements
Vérifier app.capabilities pour la prise en charge des fonctionnalités et app.access ainsi que les permissions de l’hôte pour les autorisations. Les exemples utilisent des valeurs synthétiques ; remplacer les chemins, ID, entrées et filtres avant tout appel.
Définitions de types
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!]!
}Opérations
downloadsChanged
Recevoir un signal lorsque la progression des téléchargements change.
subscription downloadsChanged {
downloadsChanged
}cancelDownload
Arrêter un téléchargement en conservant son enregistrement et les fichiers enregistrés.
mutation cancelDownload($id: ID!) {
cancelDownload(id: $id)
}createDownload
Créer un téléchargement depuis des URL de ressources ou des pièces jointes de discussion ; fournir exactement une source.
mutation createDownload($input: DownloadInput!) {
createDownload(input: $input) { id title targetDir zipName status downloadedBytes totalBytes bytesPerSecond }
}pauseDownload
Suspendre la tâche de téléchargement indiquée en conservant les fichiers terminés.
mutation pauseDownload($id: ID!) {
pauseDownload(id: $id)
}removeDownload
Arrêter un téléchargement et supprimer son enregistrement ; conserver les fichiers enregistrés.
mutation removeDownload($id: ID!) {
removeDownload(id: $id)
}resumeDownload
Reprendre une tâche de téléchargement existante en pause.
mutation resumeDownload($id: ID!) {
resumeDownload(id: $id)
}retryDownload
Réessayer une tâche existante échouée, partielle ou annulée.
mutation retryDownload($id: ID!) {
retryDownload(id: $id)
}downloads
Lister les téléchargements avec leur progression, leurs résultats et leurs erreurs actuels.
query downloads {
downloads { id title targetDir zipName status downloadedBytes totalBytes bytesPerSecond }
}