updated protocols
This commit is contained in:
parent
7283e3f6f9
commit
531a32a5a5
37 changed files with 682 additions and 650 deletions
73
src/types.ts
73
src/types.ts
|
|
@ -1,27 +1,76 @@
|
|||
|
||||
/**
|
||||
* Messages from platform except for CLOSE_AUTH_FAIL
|
||||
*/
|
||||
interface ClientProtocol {
|
||||
header: string;
|
||||
body: Init | Update
|
||||
}
|
||||
|
||||
/**
|
||||
* Initial message from platform to seed uiState
|
||||
*/
|
||||
interface Init {
|
||||
profile: Profile;
|
||||
messages: Message[];
|
||||
}
|
||||
|
||||
/**
|
||||
* Update something in uiState
|
||||
*/
|
||||
interface Update {
|
||||
name: string;
|
||||
data: Message[] | Message | Annotation | string;
|
||||
data: Profile | Message[] | Message | Annotation | string;
|
||||
}
|
||||
|
||||
/**
|
||||
* A standard message in Messenger
|
||||
*/
|
||||
interface Message {
|
||||
modifier: string;
|
||||
content: string[];
|
||||
context: boolean | string;
|
||||
content: Content[];
|
||||
context: Context;
|
||||
seen: boolean;
|
||||
uid: string;
|
||||
}
|
||||
|
||||
interface Content {
|
||||
text: string;
|
||||
audio: string | boolean;
|
||||
}
|
||||
|
||||
interface Context {
|
||||
img: string | boolean;
|
||||
text: string | boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
* Update a specific attribute in a given message
|
||||
*/
|
||||
interface Annotation {
|
||||
name: string;
|
||||
data: string | string[];
|
||||
data: Context | Content[] | boolean;
|
||||
uid: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Send raw, uncategorized data to the platform
|
||||
*/
|
||||
interface Raw {
|
||||
text: string | boolean;
|
||||
audio: string | boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
* The oppisite of Raw, when you know exactly what needs to get done
|
||||
*/
|
||||
interface PlatformRequest {
|
||||
intent: string;
|
||||
params: any;
|
||||
epic: string | boolean;
|
||||
confidence: number;
|
||||
}
|
||||
|
||||
interface WindowState {
|
||||
width: number;
|
||||
height: number;
|
||||
|
|
@ -30,19 +79,9 @@ interface WindowState {
|
|||
}
|
||||
|
||||
interface Profile {
|
||||
crimataId: string;
|
||||
alias: string;
|
||||
initials: string;
|
||||
}
|
||||
|
||||
interface LoginPayload {
|
||||
email: string;
|
||||
password: string;
|
||||
}
|
||||
|
||||
interface AuthState {
|
||||
profile: Profile | null;
|
||||
token: string | null;
|
||||
crimata_id: string;
|
||||
name: string;
|
||||
photo: string;
|
||||
}
|
||||
|
||||
interface AccountCredentials {
|
||||
|
|
|
|||
Loading…
Reference in a new issue