-
Notifications
You must be signed in to change notification settings - Fork 1
/
webhook.ts
63 lines (56 loc) · 1.63 KB
/
webhook.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
import { Localization } from "../utils/localization";
import { AppCrash } from "./app-crash";
import { InAppFeedback, NewTesterDevice } from "./app-distribution";
import { PerformanceAlert } from "./performance-alert";
export interface IWebhook {
url: string;
language?: string;
}
/**
* Declares Webhook class
*/
export abstract class Webhook implements IWebhook {
/**
* Constructor
*
* @param {IWebhook} webhook Webhook data
*/
constructor(webhook: IWebhook) {
this.url = webhook.url;
this.language = Localization.defaultLanguage;
}
public readonly url: string;
public readonly language: string;
/**
* Creates a JSON payload for a message about new app feedback
*
* @param {InAppFeedback} appFeedback
* @return {object} Message payload
*/
public abstract createAppFeedbackMessage(appFeedback: InAppFeedback): object;
/**
* Creates a JSON payload for a message about new tester device
*
* @param {NewTesterDevice} newTesterDevice
* @return {object} Message payload
*/
public abstract createNewTesterDeviceMessage(
newTesterDevice: NewTesterDevice
): object;
/**
* Create message payload for the webhook to send a crashlytics message
*
* @param {AppCrash} appCrash
* @return {object} Message payload
*/
public abstract createCrashlyticsMessage(appCrash: AppCrash): object;
/**
* Creates a JSON payload for a message about a performance alert
*
* @param performanceAlert {PerformanceAlert} Performance alert
* @return {object} Message payload
*/
public abstract createPerformanceAlertMessage(
performanceAlert: PerformanceAlert
): object;
}