///
export interface ISiObject {
id: string;
updatedAt: number;
createdAt: number;
}
export interface IHCBotUser extends ISiObject {
firstName: () => string;
lastName: () => string;
username: () => string;
avatar: () => Promise;
publicKey: () => Buffer;
}
export interface IHCBotThread extends ISiObject {
name: () => string;
description: () => string;
}
export interface IHCBotGetterSetter {
get: () => Promise;
set: (value: T) => Promise;
}
export interface IHCBotInfoMe {
username: () => string;
userId: () => string;
firstName: () => string;
lastName: () => string;
avatar: () => IHCBotGetterSetter;
}
export interface IHCBotInfoServer {
domain: () => string;
ip: () => string;
ping: () => Promise;
}
export interface IHCBotInfo {
me: () => IHCBotInfoMe;
server: () => IHCBotInfoServer;
}
export interface IHCBotMessage {
timestamp: () => number;
sender: () => IHCBotUser;
thread: () => IHCBotThread;
payload: () => string;
}
export declare type IHCBotChatOnMessageHandler = (message: IHCBotMessage) => Promise;
export declare type IHCBotChatHistoryReturnType = Promise;
export interface IHCBotChatHistory {
last: (count: number) => IHCBotChatHistoryReturnType;
range: (fromTimestamp: number, toTimestamp: number) => IHCBotChatHistoryReturnType;
me: () => IHCBotChatHistoryReturnType;
in: (threadId: string) => IHCBotChatHistoryReturnType;
}
export interface IHCBotChat {
onReceived: (handler: IHCBotChatOnMessageHandler) => void;
onSent: (handler: IHCBotChatOnMessageHandler) => void;
send: (thread: string | IHCBotThread, payload: string) => Promise;
history: () => IHCBotChatHistory;
threads: () => Promise;
}
export interface IHCBotDirectoryUser {
firstName: () => string;
lastName: () => string;
username: () => string;
}
export declare type IHCBotDirectoryReturnType = Promise;
export interface IHCBotDirectory {
query: (query: string) => IHCBotDirectoryReturnType;
friends: () => Promise;
getUser: (username: string) => Promise;
}
export interface IHCBotCryptoKeyPair {
public: () => Buffer;
private: () => Buffer;
}
export interface IHCBotCrypto {
keys: () => {
user: () => IHCBotCryptoKeyPair;
device: () => IHCBotCryptoKeyPair;
};
encrypt: (data: Buffer, user: IHCBotUser) => Promise;
decrypt: (data: Buffer) => Promise;
}
/**
* For types on a HuskyChatBot
* Is subject to change lol....
*/
export interface IHCBot {
info: () => IHCBotInfo;
chat: () => IHCBotChat;
directory: () => IHCBotDirectory;
crypto: () => IHCBotCrypto;
}
/**
* The static items on a husky chat bot (just so you have them).
*/
export interface IHCBotStatic {
signIn: (username: string, password: string) => Promise;
signUp: {
start: (email: string, password: string) => Promise;
finalize: (email: string, code: number) => Promise;
};
}