2018-05-28 10:07:25 +00:00
|
|
|
import * as plugins from './smartuniverse.plugins';
|
|
|
|
|
2019-04-11 15:52:01 +00:00
|
|
|
import * as interfaces from './interfaces';
|
2018-05-28 10:07:25 +00:00
|
|
|
|
2019-09-10 21:55:20 +00:00
|
|
|
export class ClientUniverseMessage<T> implements interfaces.IUniverseMessage {
|
2018-05-28 10:07:25 +00:00
|
|
|
// ======
|
|
|
|
// STATIC
|
|
|
|
// ======
|
2019-08-13 16:06:13 +00:00
|
|
|
public static createMessageFromMessageDescriptor(messageDescriptor: interfaces.IUniverseMessage) {
|
|
|
|
const clientuniverseMessage = new ClientUniverseMessage(messageDescriptor);
|
|
|
|
return clientuniverseMessage;
|
|
|
|
}
|
2018-05-28 10:07:25 +00:00
|
|
|
|
|
|
|
// ========
|
|
|
|
// INSTANCE
|
|
|
|
// ========
|
2019-04-22 07:58:36 +00:00
|
|
|
|
2019-04-24 21:27:57 +00:00
|
|
|
// properties
|
2019-04-22 07:58:36 +00:00
|
|
|
public id: string;
|
|
|
|
|
|
|
|
public timestamp: number;
|
|
|
|
public smartTimestamp: plugins.smarttime.TimeStamp;
|
|
|
|
public messageText: string;
|
|
|
|
public passphrase: string;
|
2019-09-10 21:55:20 +00:00
|
|
|
public payload: T;
|
2019-04-22 07:58:36 +00:00
|
|
|
public targetChannelName: string;
|
2019-04-11 15:52:01 +00:00
|
|
|
|
2019-08-13 16:06:13 +00:00
|
|
|
constructor(messageArg: interfaces.IUniverseMessage) {
|
2019-04-24 21:27:57 +00:00
|
|
|
for (const key of Object.keys(messageArg)) {
|
|
|
|
this[key] = messageArg[key];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-08-13 16:16:16 +00:00
|
|
|
/**
|
|
|
|
* gets json for payload
|
|
|
|
*/
|
2019-06-06 21:23:37 +00:00
|
|
|
getAsJsonForPayload() {}
|
2018-05-28 10:07:25 +00:00
|
|
|
}
|