skedify-types
Version:
56 lines (49 loc) • 1.1 kB
text/typescript
export interface APIError<Entity> {
code: string | number;
message: string;
ticket_id?: string;
fields?: {
[Key in keyof Entity]?: string[];
};
}
interface BaseResponse {
status: number;
headers: Record<string, string>;
url: string;
method: string;
query: Record<string, string | number>;
}
export interface APIResponseWarning {
code: number;
message: string;
[key: string]: unknown;
}
export interface APIResponse<Entity> extends BaseResponse {
data: Entity;
warnings: APIResponseWarning[];
status: number;
meta: Record<string, unknown> | [];
paging?: PagingResponse;
}
export interface APIErrorResponse<Entity> extends BaseResponse {
data: null;
warnings?: unknown[];
errors: APIError<Entity>[];
meta?: Record<string, unknown>;
}
export interface PagingResponse {
currentPage: number;
from: number;
hasNext: boolean;
hasPrevious: boolean;
totalPages: number;
size: number;
to: number;
totalResults: number;
}
export interface BaseFields {
id: string;
created_at: string;
enterprise_id: string;
external_id?: string | null;
}