flaschengeist-types/types/flaschengeist.d.ts

60 lines
1.1 KiB
TypeScript

/// <reference path="PEP440.d.ts" />
/**
* Types used for communicating with the API
*/
declare namespace FG {
interface BackendPlugin {
permissions: string[];
version: PEP440Version;
}
interface Backend {
plugins: {[key: string]: BackendPlugin};
version: PEP440Version;
}
interface Notification {
id: number;
plugin: string;
text: string;
data?: any;
time: Date;
}
interface User {
userid: string;
display_name: string;
firstname: string;
lastname: string;
mail: string;
birthday?: Date;
roles: Array<string>;
permissions?: Array<string>;
avatar_url?: string;
}
interface Session {
expires: Date;
token: string;
lifetime: number;
browser: string;
platform: string;
userid: string;
}
type Permission = string;
interface Role {
id: number;
name: string;
permissions: Array<Permission>;
}
interface PaginationFilter {
limit?: number;
offset?: number;
from?: Date;
to?: Date;
/** Default to ascending */
descending?: boolean;
}
interface PaginationResponse<T> {
result: T[];
count: number;
}
}