1 | "use strict";
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 | Object.defineProperty(exports, "__esModule", { value: true });
|
8 | const axios_1 = require("axios");
|
9 | const stringify = require("json-stringify-safe");
|
10 | const retry_1 = require("./util/retry");
|
11 |
|
12 |
|
13 |
|
14 | function webhookBaseUrl() {
|
15 | return process.env.ATOMIST_WEBHOOK_BASEURL || "https://webhook.atomist.com";
|
16 | }
|
17 | exports.webhookBaseUrl = webhookBaseUrl;
|
18 |
|
19 |
|
20 |
|
21 |
|
22 |
|
23 |
|
24 |
|
25 |
|
26 |
|
27 |
|
28 | function postAtomistWebhook(webhook, payload, workspaceId, retryOptions = retry_1.DefaultRetryOptions) {
|
29 | const url = `${webhookBaseUrl()}/atomist/${webhook}/teams/${workspaceId}`;
|
30 | const desc = `posting '${stringify(payload)}' to '${url}'`;
|
31 | return retry_1.doWithRetry(() => axios_1.default.post(url, payload), desc, retryOptions);
|
32 | }
|
33 | exports.postAtomistWebhook = postAtomistWebhook;
|
34 |
|
\ | No newline at end of file |