-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathInterfaces.ts
More file actions
77 lines (66 loc) · 2.3 KB
/
Interfaces.ts
File metadata and controls
77 lines (66 loc) · 2.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
import { Resource } from "./Resource";
import {
ConditionTypes,
QueryFunctionType,
RequestInterceptorType,
ResponseInterceptorType,
} from "./Types";
export interface IConfig {
baseURL?: string;
headers?: Record<string, string | number>;
params?: Record<string, string | number>;
interceptors?: IInterceptors;
}
export interface IInternalConfig extends IConfig {
interceptors: IInterceptors;
}
export interface IInterceptors {
requests: RequestInterceptorType[];
responses: ResponseInterceptorType[];
}
export interface IPaginate {
page?: number;
perPage?: number;
}
export interface IQueryable {
where(field: string, value: any): Resource;
where(field: string, condition: ConditionTypes, value: any): Resource;
where(query: QueryFunctionType): Resource;
andWhere(field: string, value: any): Resource;
andWhere(field: string, condition: ConditionTypes, value: any): Resource;
andWhere(query: QueryFunctionType): Resource;
orWhere(field: string, value: any): Resource;
orWhere(field: string, condition: ConditionTypes, value: any): Resource;
orWhere(query: QueryFunctionType): Resource;
whereNot(field: string, value: any): Resource;
whereLike(field: string, value: any): Resource;
whereNotLike(field: string, value: any): Resource;
whereIn(field: string, value: any[]): Resource;
whereNotIn(field: string, value: any[]): Resource;
whereBetween(field: string, start: any, end: any): Resource;
whereNotBetween(field: string, start: any, end: any): Resource;
whereNull(field: string): Resource;
whereNotNull(field: string): Resource;
orWhereNot(field: string, value: any): Resource;
orWhereLike(field: string, value: any): Resource;
orWhereNotLike(field: string, value: any): Resource;
orWhereIn(field: string, value: any[]): Resource;
orWhereNotIn(field: string, value: any[]): Resource;
orWhereBetween(field: string, start: any, end: any): Resource;
orWhereNotBetween(field: string, start: any, end: any): Resource;
orWhereNull(field: string): Resource;
orWhereNotNull(field: string): Resource;
}
export interface IPagination {
data: Array<any>;
pagination: IPaginationMetadata;
}
export interface IPaginationMetadata {
total: number;
lastPage: number;
prevPage: number | null;
nextPage: number | null;
currentPage: number;
from: number;
to: number;
}