datasquirel/utils/upload-file.d.ts

57 lines
1.4 KiB
TypeScript
Raw Permalink Normal View History

2024-11-08 15:44:31 +00:00
export = uploadImage;
/**
* @typedef {Object} FunctionReturn
* @property {boolean} success - Did the function run successfully?
* @property {{
* urlPath: string,
* } | null} payload - Payload containing the url for the image and its thumbnail
* @property {string} [msg] - An optional message
*/
/**
2024-12-06 10:44:26 +00:00
* # Upload File via API
2024-11-08 15:44:31 +00:00
* @async
*
* @param {Object} params - Single Param object containing params
* @param {String} params.key - *FULL ACCESS API Key
* @param {{
* fileData: string,
* fileName: string,
* mimeType?: string,
* folder?: string,
2024-12-06 10:44:26 +00:00
* isPrivate?: boolean
2024-11-08 15:44:31 +00:00
* }} params.payload - Image Data Eg.
2024-12-06 10:44:26 +00:00
* @param {boolean} [params.user_id] - User ID
2024-11-08 15:44:31 +00:00
*
* @returns { Promise<FunctionReturn> } - Return Object
*/
2024-12-06 10:44:26 +00:00
declare function uploadImage({ key, payload, user_id }: {
2024-11-08 15:44:31 +00:00
key: string;
payload: {
fileData: string;
fileName: string;
mimeType?: string;
folder?: string;
isPrivate?: boolean;
};
2024-12-06 10:44:26 +00:00
user_id?: boolean;
2024-11-08 15:44:31 +00:00
}): Promise<FunctionReturn>;
declare namespace uploadImage {
export { FunctionReturn };
}
type FunctionReturn = {
/**
* - Did the function run successfully?
*/
success: boolean;
/**
* - Payload containing the url for the image and its thumbnail
*/
payload: {
urlPath: string;
} | null;
/**
* - An optional message
*/
msg?: string;
};