fix: added dependencies for development. feat: added axios as dependency. feat: added some initial modeals. feat: setup unit testing
This commit is contained in:
@@ -0,0 +1,13 @@
|
||||
export class ApiResponse<T> {
|
||||
readonly statusCode: number;
|
||||
readonly isSuccessful: boolean;
|
||||
readonly message: string;
|
||||
readonly data: T;
|
||||
|
||||
constructor(statusCode: number, isSuccessful: boolean, message: string, data: T) {
|
||||
this.statusCode = statusCode;
|
||||
this.isSuccessful = statusCode < 400;
|
||||
this.message = message;
|
||||
this.data = data;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
class App {
|
||||
href: string;
|
||||
id: number;
|
||||
name: string;
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
export class ArgumentValidator {
|
||||
public static isNullOrWhiteSpace(value: string | null | undefined): boolean {
|
||||
return value === null || value === undefined || (/^\s*$/).test(value);
|
||||
}
|
||||
|
||||
public static isValidUrl(value: string | null | undefined): boolean {
|
||||
let url: URL;
|
||||
|
||||
try {
|
||||
url = new URL(value);
|
||||
} catch (error) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return url.protocol === 'http:' || url.protocol === 'https:';
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
export class PagingRequest {
|
||||
pageNumber: number;
|
||||
pageSize: number;
|
||||
|
||||
constructor(pageNumber: number, pageSize: number) {
|
||||
this.pageNumber = pageNumber;
|
||||
this.pageSize = pageSize;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user