API-Referenz

Downloads

Funktionsunterstützung über app.capabilities prüfen, Autorisierung über app.access und Host-Berechtigungen. Die Beispiele verwenden synthetische Werte; vor dem Aufruf Pfade, IDs, Eingaben und Filter ersetzen.

Typdefinitionen

graphql
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!]!
}

Operationen

subscription

downloadsChanged

Empfängt ein Änderungssignal bei geändertem Downloadfortschritt.

graphql
subscription downloadsChanged {
  downloadsChanged
}
mutation

cancelDownload

Download stoppen und Aufgabenverlauf sowie gespeicherte Dateien behalten.

graphql
mutation cancelDownload($id: ID!) {
  cancelDownload(id: $id)
}
mutation

createDownload

Download aus Ressourcen-URLs oder Chat-Anhängen erstellen; genau eine Quelle angeben.

graphql
mutation createDownload($input: DownloadInput!) {
  createDownload(input: $input) { id title targetDir zipName status downloadedBytes totalBytes bytesPerSecond }
}
mutation

pauseDownload

Die angegebene Downloadaufgabe pausieren und abgeschlossene Dateien behalten.

graphql
mutation pauseDownload($id: ID!) {
  pauseDownload(id: $id)
}
mutation

removeDownload

Download stoppen und Aufgabenverlauf entfernen; gespeicherte Dateien behalten.

graphql
mutation removeDownload($id: ID!) {
  removeDownload(id: $id)
}
mutation

resumeDownload

Eine vorhandene pausierte Downloadaufgabe fortsetzen.

graphql
mutation resumeDownload($id: ID!) {
  resumeDownload(id: $id)
}
mutation

retryDownload

Eine vorhandene fehlgeschlagene, teilweise abgeschlossene oder abgebrochene Downloadaufgabe wiederholen.

graphql
mutation retryDownload($id: ID!) {
  retryDownload(id: $id)
}
query

downloads

Downloadaufgaben mit aktuellem Fortschritt, Ergebnissen und Fehlern auflisten.

graphql
query downloads {
  downloads { id title targetDir zipName status downloadedBytes totalBytes bytesPerSecond }
}