aboutsummaryrefslogtreecommitdiff
path: root/core/api.ts
blob: 6fac34620bf66e7387fd8126cad26e50be87a475 (plain)
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
import { SearchSentenceProps, SearchSentenceResult, SearchTermResult } from "../search/types.ts";
import { DeepPartial } from "../util/types.ts";

/** @interface serach-related functions */
export interface CoreSearch {
  terms(term: string): Promise<Array<SearchTermResult>>;
	sentence(sentence: string, optional?: DeepPartial<SearchSentenceProps>): Promise<SearchSentenceResult>;
	// glossary: (input: string) => Promise<void>;
};

/** @interface user management */
export interface CoreUser {
	termPriority(userID: number, expression: string, reading: string, priority: number): Promise<void>;
	// TODO: list
	// TODO: add
	// TODO: remove
	// TODO: get info
};

/** @interface dictionary/user data import functions */
export interface CoreImport {
	// TODO: import dictionary
	// TODO: import user preferences
};

/** @interface dictionary/user data export functions */
export interface CoreExport {
	// TODO: export dictionary
	// TODO: export user preferences
};

/**
 * @summary Core interface
 *
 * This interface gets implemented by all Core clients, so clients can be
 * swapped easily. You should probably not directly use any Core, but use the
 * abstracted API from ../api/
 */
export default abstract class Core {
	/** @summary resolved when ready */
	abstract ready: Promise<void>;

	abstract search: CoreSearch;
	abstract user: CoreUser;
	abstract import: CoreImport;
	abstract export: CoreExport;
};