323 lines
7.6 KiB
TypeScript
323 lines
7.6 KiB
TypeScript
|
|
// ---------------------------------------------------------------------------
|
||
|
|
// Common
|
||
|
|
// ---------------------------------------------------------------------------
|
||
|
|
|
||
|
|
export interface ITestConnectionResult {
|
||
|
|
ok: boolean;
|
||
|
|
error?: string;
|
||
|
|
}
|
||
|
|
|
||
|
|
export interface IBookStackListParams {
|
||
|
|
count?: number;
|
||
|
|
offset?: number;
|
||
|
|
sort?: string;
|
||
|
|
filter?: Record<string, string>;
|
||
|
|
}
|
||
|
|
|
||
|
|
export interface IBookStackListResponse<T> {
|
||
|
|
data: T[];
|
||
|
|
total: number;
|
||
|
|
}
|
||
|
|
|
||
|
|
export interface IBookStackErrorResponse {
|
||
|
|
error: {
|
||
|
|
code: number;
|
||
|
|
message: string;
|
||
|
|
};
|
||
|
|
}
|
||
|
|
|
||
|
|
export interface IBookStackTag {
|
||
|
|
name: string;
|
||
|
|
value: string;
|
||
|
|
order?: number;
|
||
|
|
}
|
||
|
|
|
||
|
|
export type TBookStackExportFormat = 'html' | 'pdf' | 'plaintext' | 'markdown';
|
||
|
|
|
||
|
|
// ---------------------------------------------------------------------------
|
||
|
|
// Books
|
||
|
|
// ---------------------------------------------------------------------------
|
||
|
|
|
||
|
|
export interface IBookStackBook {
|
||
|
|
id: number;
|
||
|
|
name: string;
|
||
|
|
slug: string;
|
||
|
|
description: string;
|
||
|
|
description_html?: string;
|
||
|
|
created_at: string;
|
||
|
|
updated_at: string;
|
||
|
|
created_by: number;
|
||
|
|
updated_by: number;
|
||
|
|
owned_by: number;
|
||
|
|
default_template_id: number | null;
|
||
|
|
tags?: IBookStackTag[];
|
||
|
|
cover?: { id: number; name: string; url: string } | null;
|
||
|
|
contents?: IBookStackBookContent[];
|
||
|
|
}
|
||
|
|
|
||
|
|
export interface IBookStackBookContent {
|
||
|
|
id: number;
|
||
|
|
name: string;
|
||
|
|
slug: string;
|
||
|
|
type: 'chapter' | 'page';
|
||
|
|
book_id: number;
|
||
|
|
priority: number;
|
||
|
|
created_at: string;
|
||
|
|
updated_at: string;
|
||
|
|
url: string;
|
||
|
|
pages?: IBookStackBookContent[];
|
||
|
|
}
|
||
|
|
|
||
|
|
// ---------------------------------------------------------------------------
|
||
|
|
// Chapters
|
||
|
|
// ---------------------------------------------------------------------------
|
||
|
|
|
||
|
|
export interface IBookStackChapter {
|
||
|
|
id: number;
|
||
|
|
book_id: number;
|
||
|
|
name: string;
|
||
|
|
slug: string;
|
||
|
|
description: string;
|
||
|
|
description_html?: string;
|
||
|
|
priority: number;
|
||
|
|
created_at: string;
|
||
|
|
updated_at: string;
|
||
|
|
created_by: number;
|
||
|
|
updated_by: number;
|
||
|
|
owned_by: number;
|
||
|
|
default_template_id?: number | null;
|
||
|
|
tags?: IBookStackTag[];
|
||
|
|
pages?: IBookStackPage[];
|
||
|
|
}
|
||
|
|
|
||
|
|
// ---------------------------------------------------------------------------
|
||
|
|
// Pages
|
||
|
|
// ---------------------------------------------------------------------------
|
||
|
|
|
||
|
|
export interface IBookStackPage {
|
||
|
|
id: number;
|
||
|
|
book_id: number;
|
||
|
|
chapter_id: number;
|
||
|
|
name: string;
|
||
|
|
slug: string;
|
||
|
|
html: string;
|
||
|
|
raw_html?: string;
|
||
|
|
markdown: string;
|
||
|
|
priority: number;
|
||
|
|
draft: boolean;
|
||
|
|
template: boolean;
|
||
|
|
created_at: string;
|
||
|
|
updated_at: string;
|
||
|
|
created_by: number;
|
||
|
|
updated_by: number;
|
||
|
|
owned_by: number;
|
||
|
|
revision_count: number;
|
||
|
|
editor: string;
|
||
|
|
book_slug?: string;
|
||
|
|
tags?: IBookStackTag[];
|
||
|
|
}
|
||
|
|
|
||
|
|
// ---------------------------------------------------------------------------
|
||
|
|
// Shelves
|
||
|
|
// ---------------------------------------------------------------------------
|
||
|
|
|
||
|
|
export interface IBookStackShelf {
|
||
|
|
id: number;
|
||
|
|
name: string;
|
||
|
|
slug: string;
|
||
|
|
description: string;
|
||
|
|
description_html?: string;
|
||
|
|
created_at: string;
|
||
|
|
updated_at: string;
|
||
|
|
created_by: number;
|
||
|
|
updated_by: number;
|
||
|
|
owned_by: number;
|
||
|
|
tags?: IBookStackTag[];
|
||
|
|
cover?: { id: number; name: string; url: string } | null;
|
||
|
|
books?: IBookStackBook[];
|
||
|
|
}
|
||
|
|
|
||
|
|
// ---------------------------------------------------------------------------
|
||
|
|
// Attachments
|
||
|
|
// ---------------------------------------------------------------------------
|
||
|
|
|
||
|
|
export interface IBookStackAttachment {
|
||
|
|
id: number;
|
||
|
|
name: string;
|
||
|
|
extension: string;
|
||
|
|
uploaded_to: number;
|
||
|
|
external: boolean;
|
||
|
|
order: number;
|
||
|
|
created_at: string;
|
||
|
|
updated_at: string;
|
||
|
|
created_by: number;
|
||
|
|
updated_by: number;
|
||
|
|
content?: string;
|
||
|
|
links?: {
|
||
|
|
html: string;
|
||
|
|
markdown: string;
|
||
|
|
};
|
||
|
|
}
|
||
|
|
|
||
|
|
// ---------------------------------------------------------------------------
|
||
|
|
// Comments
|
||
|
|
// ---------------------------------------------------------------------------
|
||
|
|
|
||
|
|
export interface IBookStackComment {
|
||
|
|
id: number;
|
||
|
|
html: string;
|
||
|
|
parent_id: number | null;
|
||
|
|
local_id: number;
|
||
|
|
content_ref: string;
|
||
|
|
created_at: string;
|
||
|
|
updated_at: string;
|
||
|
|
created_by: number;
|
||
|
|
updated_by: number;
|
||
|
|
archived?: boolean;
|
||
|
|
replies?: IBookStackComment[];
|
||
|
|
}
|
||
|
|
|
||
|
|
// ---------------------------------------------------------------------------
|
||
|
|
// Image Gallery
|
||
|
|
// ---------------------------------------------------------------------------
|
||
|
|
|
||
|
|
export interface IBookStackImage {
|
||
|
|
id: number;
|
||
|
|
name: string;
|
||
|
|
url: string;
|
||
|
|
path: string;
|
||
|
|
type: string;
|
||
|
|
uploaded_to: number;
|
||
|
|
created_at: string;
|
||
|
|
updated_at: string;
|
||
|
|
created_by: number;
|
||
|
|
updated_by: number;
|
||
|
|
thumbs?: {
|
||
|
|
gallery: string;
|
||
|
|
display: string;
|
||
|
|
};
|
||
|
|
content?: {
|
||
|
|
html: string;
|
||
|
|
markdown: string;
|
||
|
|
};
|
||
|
|
}
|
||
|
|
|
||
|
|
// ---------------------------------------------------------------------------
|
||
|
|
// Users
|
||
|
|
// ---------------------------------------------------------------------------
|
||
|
|
|
||
|
|
export interface IBookStackUser {
|
||
|
|
id: number;
|
||
|
|
name: string;
|
||
|
|
slug: string;
|
||
|
|
email: string;
|
||
|
|
profile_url: string;
|
||
|
|
edit_url?: string;
|
||
|
|
avatar_url: string;
|
||
|
|
external_auth_id: string;
|
||
|
|
created_at: string;
|
||
|
|
updated_at: string;
|
||
|
|
last_activity_at?: string;
|
||
|
|
roles?: { id: number; display_name: string }[];
|
||
|
|
}
|
||
|
|
|
||
|
|
// ---------------------------------------------------------------------------
|
||
|
|
// Roles
|
||
|
|
// ---------------------------------------------------------------------------
|
||
|
|
|
||
|
|
export interface IBookStackRole {
|
||
|
|
id: number;
|
||
|
|
display_name: string;
|
||
|
|
description: string;
|
||
|
|
mfa_enforced: boolean;
|
||
|
|
external_auth_id: string;
|
||
|
|
permissions_count: number;
|
||
|
|
users_count?: number;
|
||
|
|
created_at: string;
|
||
|
|
updated_at: string;
|
||
|
|
permissions?: string[];
|
||
|
|
users?: IBookStackUser[];
|
||
|
|
}
|
||
|
|
|
||
|
|
// ---------------------------------------------------------------------------
|
||
|
|
// Search
|
||
|
|
// ---------------------------------------------------------------------------
|
||
|
|
|
||
|
|
export interface IBookStackSearchResult {
|
||
|
|
id: number;
|
||
|
|
name: string;
|
||
|
|
slug: string;
|
||
|
|
book_id?: number;
|
||
|
|
chapter_id?: number;
|
||
|
|
type: string;
|
||
|
|
url: string;
|
||
|
|
preview_html?: { name: string; content: string };
|
||
|
|
tags?: IBookStackTag[];
|
||
|
|
created_at: string;
|
||
|
|
updated_at: string;
|
||
|
|
}
|
||
|
|
|
||
|
|
// ---------------------------------------------------------------------------
|
||
|
|
// Audit Log
|
||
|
|
// ---------------------------------------------------------------------------
|
||
|
|
|
||
|
|
export interface IBookStackAuditLogEntry {
|
||
|
|
id: number;
|
||
|
|
type: string;
|
||
|
|
detail: string;
|
||
|
|
user_id: number;
|
||
|
|
loggable_id: number;
|
||
|
|
loggable_type: string;
|
||
|
|
ip: string;
|
||
|
|
created_at: string;
|
||
|
|
user?: IBookStackUser;
|
||
|
|
}
|
||
|
|
|
||
|
|
// ---------------------------------------------------------------------------
|
||
|
|
// Recycle Bin
|
||
|
|
// ---------------------------------------------------------------------------
|
||
|
|
|
||
|
|
export interface IBookStackRecycleBinItem {
|
||
|
|
id: number;
|
||
|
|
deleted_by: number;
|
||
|
|
created_at: string;
|
||
|
|
updated_at: string;
|
||
|
|
deletable_type: string;
|
||
|
|
deletable_id: number;
|
||
|
|
deletable?: Record<string, any>;
|
||
|
|
}
|
||
|
|
|
||
|
|
// ---------------------------------------------------------------------------
|
||
|
|
// Content Permissions
|
||
|
|
// ---------------------------------------------------------------------------
|
||
|
|
|
||
|
|
export interface IBookStackContentPermission {
|
||
|
|
owner: IBookStackUser;
|
||
|
|
role_permissions: {
|
||
|
|
role_id: number;
|
||
|
|
view: boolean;
|
||
|
|
create: boolean;
|
||
|
|
update: boolean;
|
||
|
|
delete: boolean;
|
||
|
|
}[];
|
||
|
|
fallback_permissions: {
|
||
|
|
inheriting: boolean;
|
||
|
|
view: boolean;
|
||
|
|
create: boolean;
|
||
|
|
update: boolean;
|
||
|
|
delete: boolean;
|
||
|
|
};
|
||
|
|
}
|
||
|
|
|
||
|
|
// ---------------------------------------------------------------------------
|
||
|
|
// System
|
||
|
|
// ---------------------------------------------------------------------------
|
||
|
|
|
||
|
|
export interface IBookStackSystemInfo {
|
||
|
|
version: string;
|
||
|
|
instance_id: string;
|
||
|
|
app_name: string;
|
||
|
|
app_logo: string | null;
|
||
|
|
base_url: string;
|
||
|
|
}
|