1 // Copyright (C) The Arvados Authors. All rights reserved.
3 // SPDX-License-Identifier: AGPL-3.0
5 import { snakeCase } from "lodash";
6 import { AxiosInstance } from "axios";
7 import { TrashableResource } from "models/resource";
8 import { CommonResourceService } from "services/common-service/common-resource-service";
9 import { ApiActions } from "services/api/api-actions";
11 export class TrashableResourceService<T extends TrashableResource> extends CommonResourceService<T> {
13 constructor(serverApi: AxiosInstance, resourceType: string, actions: ApiActions, readOnlyFields: string[] = []) {
14 super(serverApi, resourceType, actions, readOnlyFields);
17 trash(uuid: string): Promise<T> {
18 return CommonResourceService.defaultResponse(
20 .post(this.resourceType + `/${uuid}/trash`),
25 untrash(uuid: string): Promise<T> {
27 ensure_unique_name: true
29 return CommonResourceService.defaultResponse(
31 .post(this.resourceType + `/${uuid}/untrash`, {
32 params: CommonResourceService.mapKeys(snakeCase)(params)