datasquirel/utils/upload-image.d.ts
Benjamin Toby 4b8e8de71f Updates
2024-12-15 11:25:07 +01:00

61 lines
1.5 KiB
TypeScript

export = uploadImage;
/**
* @typedef {Object} FunctionReturn
* @property {boolean} success - Did the function run successfully?
* @property {{
* urlPath: string,
* urlThumbnailPath: string
* } | null} payload - Payload containing the url for the image and its thumbnail
* @property {string} [msg] - An optional message
*/
/**
* # Upload Image via API
* @async
*
* @param {Object} params - Single Param object containing params
* @param {String} [params.key] - *FULL ACCESS API Key
* @param {{
* imageData: string,
* imageName: string,
* mimeType?: string,
* thumbnailSize?: number,
* folder?: string,
* isPrivate?: boolean,
* }} params.payload - Image Data Eg.
* @param {boolean} [params.user_id] - User ID
*
* @returns { Promise<FunctionReturn> } - Return Object
*/
declare function uploadImage({ key, payload, user_id }: {
key?: string;
payload: {
imageData: string;
imageName: string;
mimeType?: string;
thumbnailSize?: number;
folder?: string;
isPrivate?: boolean;
};
user_id?: boolean;
}): 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;
urlThumbnailPath: string;
} | null;
/**
* - An optional message
*/
msg?: string;
};