Add definition for messages from the API
This commit is contained in:
parent
5b0d009353
commit
984223c287
1 changed files with 34 additions and 0 deletions
|
|
@ -606,6 +606,40 @@ export class Communication {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export enum MessageType {
|
||||||
|
Unknown = 0,
|
||||||
|
Email = 1,
|
||||||
|
Mailer = 2,
|
||||||
|
Text = 3,
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface MessageDTO {
|
||||||
|
content: string;
|
||||||
|
created: string;
|
||||||
|
destination: string;
|
||||||
|
source: string;
|
||||||
|
type: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
export class Message {
|
||||||
|
constructor(
|
||||||
|
public content: string,
|
||||||
|
public created: Date,
|
||||||
|
public destination: string,
|
||||||
|
public source: string,
|
||||||
|
public type: MessageType,
|
||||||
|
) {}
|
||||||
|
static fromJSON(json: MessageDTO): Message {
|
||||||
|
return new Message(
|
||||||
|
json.content,
|
||||||
|
new Date(json.created),
|
||||||
|
json.destination,
|
||||||
|
json.source,
|
||||||
|
json.type as MessageType,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
export interface Pool {
|
export interface Pool {
|
||||||
condition: string;
|
condition: string;
|
||||||
id: number;
|
id: number;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue