forked from jordanlambrecht/tracker-tracker
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtypes.ts
More file actions
36 lines (32 loc) · 1.17 KB
/
Copy pathtypes.ts
File metadata and controls
36 lines (32 loc) · 1.17 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
// src/lib/image-hosting/types.ts
//
// Types: ImageHostId, UploadOptions, UploadResult, ImageHostAdapter
export type ImageHostId = "ptpimg" | "onlyimage" | "imgbb"
export interface UploadOptions {
/** Seconds until auto-delete. Only supported by imgbb (60-15552000) and onlyimage (ISO 8601 converted internally). null = permanent. */
expirationSeconds?: number | null
}
export interface UploadResult {
/** Direct URL to the full-size image */
url: string
/** URL to the viewer/gallery page (if available) */
viewerUrl?: string
/** Thumbnail URL (if available) */
thumbUrl?: string
/** Image ID for programmatic deletion — requires API key + this ID (if available) */
deleteId?: string
/** Which host was used */
host: ImageHostId
}
// Stateless object adapters — no class needed since there's no per-instance state.
// This differs from tracker adapters (class-based) because image host uploads are
// simple request/response with no session, polling, or connection state.
export interface ImageHostAdapter {
readonly id: ImageHostId
upload(
fileBuffer: Buffer,
fileName: string,
apiKey: string,
options?: UploadOptions
): Promise<UploadResult>
}