feat: added nyc for test coverage reporting. fix: add jsdoc comments

This commit is contained in:
StevanFreeborn
2023-01-26 13:58:25 -06:00
parent b36d9445bd
commit 8b6e5ccefc
10 changed files with 2993 additions and 27 deletions
+27 -2
View File
@@ -1,13 +1,38 @@
/**
* @class ApiResponse - A generic response object for API requests.
*/
export class ApiResponse<T> {
/**
* @property {number} statusCode - The status code of the response.
*/
readonly statusCode: number;
/**
* @property {boolean} isSuccessful - True if the status code is less than 400; otherwise, false.
*/
readonly isSuccessful: boolean;
/**
* @property {string} message - The message of the response.
*/
readonly message: string;
/**
* @property {T} data - The data of the response.
*/
readonly data: T;
constructor(statusCode: number, isSuccessful: boolean, message: string, data: T) {
/**
* @constructor - Creates a new instance of the ApiResponse class.
* @param {number} statusCode - The status code of the response.
* @param {string} message - The message of the response.
* @param {T} data - The data of the response.
* @returns {ApiResponse<T>} - A new instance of the ApiResponse class.
*/
constructor(statusCode: number, message: string, data: T) {
this.statusCode = statusCode;
this.isSuccessful = statusCode < 400;
this.message = message;
this.data = data;
}
}
}