1 // Copyright (C) The Arvados Authors. All rights reserved.
3 // SPDX-License-Identifier: AGPL-3.0
5 import * as _ from "lodash";
6 import { AxiosInstance } from "axios";
7 import { TrashableResource } from "src/models/resource";
8 import { CommonResourceService } from "~/services/common-service/common-resource-service";
10 export class TrashableResourceService<T extends TrashableResource> extends CommonResourceService<T> {
12 constructor(serverApi: AxiosInstance, resourceType: string) {
13 super(serverApi, resourceType);
16 trash(uuid: string): Promise<T> {
18 .post(this.resourceType + `${uuid}/trash`)
19 .then(CommonResourceService.mapResponseKeys);
22 untrash(uuid: string): Promise<T> {
24 ensure_unique_name: true
27 .post(this.resourceType + `${uuid}/untrash`, {
28 params: CommonResourceService.mapKeys(_.snakeCase)(params)
30 .then(CommonResourceService.mapResponseKeys);