feat: add responses package

This commit is contained in:
Karol Sójko
2022-07-06 11:59:04 +02:00
parent 67b0918ba8
commit 9d1f7043e5
73 changed files with 977 additions and 14 deletions

View File

@@ -0,0 +1,6 @@
import { MinimalHttpResponse } from '../Http/MinimalHttpResponses'
export type CloseUploadSessionResponse = MinimalHttpResponse & {
success: boolean
message: string
}

View File

@@ -0,0 +1,7 @@
export type CreateValetTokenPayload = {
operation: 'read' | 'write' | 'delete'
resources: Array<{
remoteIdentifier: string
unencryptedFileSize?: number
}>
}

View File

@@ -0,0 +1,6 @@
import { MinimalHttpResponse } from '../Http/MinimalHttpResponses'
import { CreateValetTokenResponseData } from './CreateValetTokenResponseData'
export type CreateValetTokenResponse = MinimalHttpResponse & {
data: CreateValetTokenResponseData
}

View File

@@ -0,0 +1,9 @@
export type CreateValetTokenResponseData =
| {
success: true
valetToken: string
}
| {
success: false
reason: 'no-subscription' | 'expired-subscription' | 'invalid-parameters'
}

View File

@@ -0,0 +1,5 @@
import { MinimalHttpResponse } from '../Http/MinimalHttpResponses'
export type DownloadFileChunkResponse = MinimalHttpResponse & {
data: ArrayBuffer
}

View File

@@ -0,0 +1,6 @@
import { MinimalHttpResponse } from '../Http/MinimalHttpResponses'
export type StartUploadSessionResponse = MinimalHttpResponse & {
success: boolean
uploadId: string
}

View File

@@ -0,0 +1,5 @@
import { MinimalHttpResponse } from '../Http/MinimalHttpResponses'
export type UploadFileChunkResponse = MinimalHttpResponse & {
success: boolean
}