updated protocols

This commit is contained in:
Andrew Gundersen 2021-07-11 11:54:39 -05:00
commit 531a32a5a5
37 changed files with 682 additions and 650 deletions

View file

@ -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 {