refs #master Merge branch 'origin/master' into 13828-trash-view
[arvados-workbench2.git] / src / services / collection-service / collection-service.ts
index c0d61bd27b4d5d789a09a0096c16154ddcbbb461..e26da78875b91963a6a1e51703f2a1f9ffbc17cc 100644 (file)
@@ -68,4 +68,21 @@ export class CollectionService extends CommonResourceService<CollectionResource>
 
     }
 
+    trash(uuid: string): Promise<CollectionResource> {
+        return this.serverApi
+            .post(this.resourceType + `${uuid}/trash`)
+            .then(CommonResourceService.mapResponseKeys);
+    }
+
+    untrash(uuid: string): Promise<CollectionResource> {
+        const params = {
+            ensure_unique_name: true
+        };
+        return this.serverApi
+            .post(this.resourceType + `${uuid}/untrash`, {
+                params: CommonResourceService.mapKeys(_.snakeCase)(params)
+            })
+            .then(CommonResourceService.mapResponseKeys);
+    }
+    
 }