feat: add presignedUrl method to upload sdk (#12569)

This commit is contained in:
Christian
2025-05-21 22:21:50 +02:00
committed by GitHub
parent c5a6573e26
commit ca9ffcc80b
+32
View File
@@ -135,4 +135,36 @@ export class Upload {
} }
) )
} }
/**
* This method creates a presigned URL for a file upload. It sends a request to the
* `/admin/uploads/presigned-urls` API route.
*
* @param body - The details of the file to upload.
* @param query - Query parameters to pass in the request.
* @param headers - Headers to pass in the request.
* @returns The presigned URL for the file upload.
*
* @example
* sdk.admin.upload.presignedUrl({
* name: "test.txt",
* size: 1000,
* type: "text/plain",
* }))
*/
async presignedUrl(
body: HttpTypes.AdminUploadPreSignedUrlRequest,
query?: SelectParams,
headers?: ClientHeaders
) {
return this.client.fetch<HttpTypes.AdminUploadPreSignedUrlResponse>(
`/admin/uploads/presigned-urls`,
{
method: "POST",
headers,
body,
query,
}
)
}
} }