Tải xuống
Kiểm tra app.capabilities để biết tính năng và app.access cùng quyền máy chủ để xác định quyền truy cập. Thay giá trị mẫu trước khi gọi.
Định nghĩa kiểu
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!]!
}Thao tác
downloadsChanged
Nhận tín hiệu khi tiến độ tải xuống thay đổi.
subscription downloadsChanged {
downloadsChanged
}cancelDownload
Dừng tải xuống, giữ bản ghi tác vụ và các tệp đã lưu.
mutation cancelDownload($id: ID!) {
cancelDownload(id: $id)
}createDownload
Tạo tác vụ tải từ URL tài nguyên hoặc tệp đính kèm trò chuyện; chỉ cung cấp đúng một nguồn.
mutation createDownload($input: DownloadInput!) {
createDownload(input: $input) { id title targetDir zipName status downloadedBytes totalBytes bytesPerSecond }
}pauseDownload
Tạm dừng tác vụ tải được chỉ định và giữ các tệp đã hoàn tất.
mutation pauseDownload($id: ID!) {
pauseDownload(id: $id)
}removeDownload
Dừng tải và xóa bản ghi tác vụ; giữ các tệp đã lưu.
mutation removeDownload($id: ID!) {
removeDownload(id: $id)
}resumeDownload
Tiếp tục tác vụ tải hiện có đang tạm dừng.
mutation resumeDownload($id: ID!) {
resumeDownload(id: $id)
}retryDownload
Thử lại tác vụ tải hiện có bị lỗi, hoàn tất một phần hoặc đã hủy.
mutation retryDownload($id: ID!) {
retryDownload(id: $id)
}downloads
Liệt kê tác vụ tải với tiến độ, kết quả và lỗi hiện tại.
query downloads {
downloads { id title targetDir zipName status downloadedBytes totalBytes bytesPerSecond }
}