aboutsummaryrefslogtreecommitdiffstats
path: root/server/sonar-web/src/main/js/api
diff options
context:
space:
mode:
authorGrégoire Aubert <gregoire.aubert@sonarsource.com>2018-01-31 11:23:12 +0100
committerGuillaume Jambet <guillaume.jambet@gmail.com>2018-03-01 15:21:05 +0100
commit3c5c062c8bf27f5ed93c72871d9d9ddcf4c0c548 (patch)
tree0efb13547233d7d159a6732add6aa4d850349357 /server/sonar-web/src/main/js/api
parentee3a17fa0f5a597f7f8d76562cb8d15fc6b3b342 (diff)
downloadsonarqube-3c5c062c8bf27f5ed93c72871d9d9ddcf4c0c548.tar.gz
sonarqube-3c5c062c8bf27f5ed93c72871d9d9ddcf4c0c548.zip
SONAR-10344 Create the webhooks console page
* SONAR-10348 Create the webhooks console page * SONAR-10349 Add webhook console at global admin scope * SONAR-10349 Add webhook console at project scope * SONAR-10349 Add webhook console at organization scope
Diffstat (limited to 'server/sonar-web/src/main/js/api')
-rw-r--r--server/sonar-web/src/main/js/api/webhooks.ts43
1 files changed, 43 insertions, 0 deletions
diff --git a/server/sonar-web/src/main/js/api/webhooks.ts b/server/sonar-web/src/main/js/api/webhooks.ts
new file mode 100644
index 00000000000..fa526855e02
--- /dev/null
+++ b/server/sonar-web/src/main/js/api/webhooks.ts
@@ -0,0 +1,43 @@
+/*
+ * SonarQube
+ * Copyright (C) 2009-2018 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+import { getJSON } from '../helpers/request';
+import throwGlobalError from '../app/utils/throwGlobalError';
+
+export interface Delivery {
+ id: string;
+ at: string;
+ success: boolean;
+ httpStatus: number;
+ durationMs: number;
+}
+
+export interface Webhook {
+ key: string;
+ name: string;
+ url: string;
+ latestDelivery?: Delivery;
+}
+
+export function searchWebhooks(data: {
+ organization: string | undefined;
+ project?: string;
+}): Promise<{ webhooks: Webhook[] }> {
+ return getJSON('/api/webhooks/search', data).catch(throwGlobalError);
+}