feat: add presignedUrl method to upload sdk (#12569)
This commit is contained in:
@@ -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,
|
||||||
|
}
|
||||||
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user