datasquirel/utils/upload-image.d.ts

61 lines
1.5 KiB
TypeScript
Raw 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,
* urlThumbnailPath: 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 Image via API
2024-11-08 15:44:31 +00:00
* @async
*
* @param {Object} params - Single Param object containing params
2024-12-15 10:25:07 +00:00
* @param {String} [params.key] - *FULL ACCESS API Key
2024-11-08 15:44:31 +00:00
* @param {{
* imageData: string,
* imageName: string,
* mimeType?: string,
* thumbnailSize?: number,
* folder?: string,
* isPrivate?: boolean,
* }} 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-12-15 10:25:07 +00:00
key?: string;
2024-11-08 15:44:31 +00:00
payload: {
imageData: string;
imageName: string;
mimeType?: string;
thumbnailSize?: number;
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;
urlThumbnailPath: string;
} | null;
/**
* - An optional message
*/
msg?: string;
};