Refactor file upload and presigned URL types and method names
Simplify and standardize type and function names for uploadFile and generatePresignedUrl operations. This change improves readability and aligns naming conventions across the codebase. No functional behavior was altered.
This commit is contained in:
@@ -64,11 +64,11 @@ import type {
|
||||
GetEventBySlugData,
|
||||
GetEventBySlugResponse,
|
||||
GetEventBySlugError,
|
||||
GeneratePresignedUrlApiV1UploadsPresignedUrlPostData,
|
||||
GeneratePresignedUrlApiV1UploadsPresignedUrlPostResponse,
|
||||
GeneratePresignedUrlApiV1UploadsPresignedUrlPostError,
|
||||
UploadFileApiV1UploadsTokenPostData,
|
||||
UploadFileApiV1UploadsTokenPostError,
|
||||
GeneratePresignedUrlData,
|
||||
GeneratePresignedUrlResponse,
|
||||
GeneratePresignedUrlError,
|
||||
UploadFileData,
|
||||
UploadFileError,
|
||||
} from "./types.gen";
|
||||
import { client as _heyApiClient } from "./client.gen";
|
||||
|
||||
@@ -559,17 +559,12 @@ export const getEventBySlug = <ThrowOnError extends boolean = false>(
|
||||
* This endpoint creates a secure token that allows direct upload to the storage system.
|
||||
* After successful upload, the file will be accessible at the returned file_url.
|
||||
*/
|
||||
export const generatePresignedUrlApiV1UploadsPresignedUrlPost = <
|
||||
ThrowOnError extends boolean = false,
|
||||
>(
|
||||
options: Options<
|
||||
GeneratePresignedUrlApiV1UploadsPresignedUrlPostData,
|
||||
ThrowOnError
|
||||
>,
|
||||
export const generatePresignedUrl = <ThrowOnError extends boolean = false>(
|
||||
options: Options<GeneratePresignedUrlData, ThrowOnError>,
|
||||
) => {
|
||||
return (options.client ?? _heyApiClient).post<
|
||||
GeneratePresignedUrlApiV1UploadsPresignedUrlPostResponse,
|
||||
GeneratePresignedUrlApiV1UploadsPresignedUrlPostError,
|
||||
GeneratePresignedUrlResponse,
|
||||
GeneratePresignedUrlError,
|
||||
ThrowOnError
|
||||
>({
|
||||
security: [
|
||||
@@ -594,14 +589,12 @@ export const generatePresignedUrlApiV1UploadsPresignedUrlPost = <
|
||||
* This endpoint handles the actual file upload after a presigned URL is generated.
|
||||
* The token validates the upload permissions and destination.
|
||||
*/
|
||||
export const uploadFileApiV1UploadsTokenPost = <
|
||||
ThrowOnError extends boolean = false,
|
||||
>(
|
||||
options: Options<UploadFileApiV1UploadsTokenPostData, ThrowOnError>,
|
||||
export const uploadFile = <ThrowOnError extends boolean = false>(
|
||||
options: Options<UploadFileData, ThrowOnError>,
|
||||
) => {
|
||||
return (options.client ?? _heyApiClient).post<
|
||||
unknown,
|
||||
UploadFileApiV1UploadsTokenPostError,
|
||||
UploadFileError,
|
||||
ThrowOnError
|
||||
>({
|
||||
...formDataBodySerializer,
|
||||
|
||||
Reference in New Issue
Block a user