From ee1741ae39d08ed407b9e6b6b88dccdf8ee91b19 Mon Sep 17 00:00:00 2001
From: Marcel Nellesen <nellesen@itc.rwth-aachen.de>
Date: Fri, 21 May 2021 09:43:01 +0000
Subject: [PATCH] Update: Added methods for project invitation handling
 (coscine/issues#1528)

---
 src/requests/project-api.ts | 44 +++++++++++++++++++++++++++++++++++++
 1 file changed, 44 insertions(+)

diff --git a/src/requests/project-api.ts b/src/requests/project-api.ts
index 7dc4736..3686e59 100644
--- a/src/requests/project-api.ts
+++ b/src/requests/project-api.ts
@@ -155,4 +155,48 @@ export class ProjectApi {
   ) {
     ProjectApi.getTopLevelProjects(thenHandler, catchHandler, '?noanalyticslog=true');
   }
+  public static getInvitationsList(
+    projectId: string,
+    thenHandler: any = apiConnectionBasic.defaultThenHandler,
+    catchHandler: any = apiConnectionBasic.defaultOnCatch
+  ) {
+    apiConnectionBasic.setHeader();
+    return axios
+      .get(getProjectApiUrl() + 'invitation/list/' + projectId)
+      .then(thenHandler)
+      .catch(catchHandler);
+  }
+  public static storeInvitation(
+    body: any,
+    thenHandler: any = apiConnectionBasic.defaultThenHandler,
+    catchHandler: any = apiConnectionBasic.defaultOnCatch
+  ) {
+    apiConnectionBasic.setHeader();
+    return axios
+      .post(getProjectApiUrl() + 'invitation', body)
+      .then(thenHandler)
+      .catch(catchHandler);
+  }
+  public static deleteInvitation(
+    invitationId: string,
+    thenHandler: any = apiConnectionBasic.defaultThenHandler,
+    catchHandler: any = apiConnectionBasic.defaultOnCatch
+  ) {
+    apiConnectionBasic.setHeader();
+    return axios
+      .delete(getProjectApiUrl() + 'invitation/' + invitationId)
+      .then(thenHandler)
+      .catch(catchHandler);
+  }
+  public static resolveInvitation(
+    token: string,
+    thenHandler: any = apiConnectionBasic.defaultThenHandler,
+    catchHandler: any = apiConnectionBasic.defaultOnCatch
+  ) {
+    apiConnectionBasic.setHeader();
+    return axios
+      .get(getProjectApiUrl() + 'invitation/resolve/' + token)
+      .then(thenHandler)
+      .catch(catchHandler);
+  }
 }
-- 
GitLab