PlainApp
API 참조

다운로드

기능 지원은 app.capabilities, 인가는 app.access와 호스트 권한으로 확인하세요. 예제는 합성 값을 사용합니다. 호출 전에 경로, ID, 입력, 필터를 바꾸세요.

타입 정의

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

작업

subscription

downloadsChanged

다운로드 진행 상황 변경 시 변경 신호를 받습니다.

graphql
subscription downloadsChanged {
  downloadsChanged
}
mutation

cancelDownload

다운로드를 중지하고 작업 기록과 저장된 파일을 유지합니다.

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

createDownload

리소스 URL 또는 채팅 첨부파일로 다운로드를 만듭니다. 소스는 정확히 하나만 지정해야 합니다.

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

pauseDownload

지정한 다운로드 작업을 일시 중지하고 완료된 파일을 유지합니다.

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

removeDownload

다운로드를 중지하고 작업 기록을 삭제하되 저장된 파일은 유지합니다.

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

resumeDownload

기존의 일시 중지된 다운로드 작업을 재개합니다.

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

retryDownload

기존의 실패, 부분 완료 또는 취소된 다운로드 작업을 재시도합니다.

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

downloads

다운로드 작업과 현재 진행 상황, 결과, 오류를 나열합니다.

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