Skip to content

Commit 2233e95

Browse files
committed
fix: improve adapter for storage to cover various types of download URLs
1 parent 9c5f591 commit 2233e95

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

adminforth/types/Adapters.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ export interface OAuth2Adapter {
141141

142142
export interface StorageAdapter {
143143
/**
144-
* This method should return the presigned URL for the given key capable of upload.
144+
* This method should return the presigned URL for the given key capable of upload (PUT multipart form data to it).
145145
* The PUT method should fail if the file already exists.
146146
* @param key - The key of the file to be uploaded e.g. "uploads/file.txt"
147147
* @param expiresIn - The expiration time in seconds for the presigned URL
@@ -150,11 +150,14 @@ export interface StorageAdapter {
150150
getUploadSignedUrl(key: string, contentType: string, expiresIn?: number): Promise<string>;
151151

152152
/**
153-
* This method should return the presigned URL for the given key capable of download
153+
* This method should return the URL for the given key capable of download (200 GET request with response or 200 HEAD request without response).
154+
* If adapter configured to use public storage, this method should return the public URL of the file.
155+
* If adapter configured to use private storage, this method should return the presigned URL for the file.
156+
*
154157
* @param key - The key of the file to be downloaded e.g. "uploads/file.txt"
155158
* @param expiresIn - The expiration time in seconds for the presigned URL
156159
*/
157-
getDownloadSignedUrl(key: string, expiresIn?: number): Promise<string>;
160+
getDownloadUrl(key: string, expiresIn?: number): Promise<string>;
158161

159162
/**
160163
* This method should mark the file for deletion.

0 commit comments

Comments
 (0)