1 // Copyright (C) The Arvados Authors. All rights reserved.
3 // SPDX-License-Identifier: AGPL-3.0
5 import * as _ from "lodash";
6 import { CommonResourceService, ListResults, ListArguments } from '~/services/common-service/common-resource-service';
7 import { AxiosInstance } from "axios";
8 import { CollectionResource } from "~/models/collection";
9 import { ProjectResource } from "~/models/project";
10 import { ProcessResource } from "~/models/process";
11 import { TrashableResource } from "~/models/resource";
12 import { TrashableResourceService } from "~/services/common-service/trashable-resource-service";
13 import { ApiActions } from "~/services/api/api-actions";
14 import { GroupResource } from "~/models/group";
16 export interface ContentsArguments {
22 includeTrash?: boolean;
25 export interface SharedArguments extends ListArguments {
29 export type GroupContentsResource =
34 export class GroupsService<T extends GroupResource = GroupResource> extends TrashableResourceService<T> {
36 constructor(serverApi: AxiosInstance, actions: ApiActions) {
37 super(serverApi, "groups", actions);
40 contents(uuid: string, args: ContentsArguments = {}): Promise<ListResults<GroupContentsResource>> {
41 const { filters, order, ...other } = args;
44 filters: filters ? `[${filters}]` : undefined,
45 order: order ? order : undefined
47 return CommonResourceService.defaultResponse(
49 .get(this.resourceType + `${uuid}/contents`, {
50 params: CommonResourceService.mapKeys(_.snakeCase)(params)
56 shared(params: SharedArguments = {}): Promise<ListResults<GroupContentsResource>> {
57 return CommonResourceService.defaultResponse(
59 .get(this.resourceType + 'shared', { params }),
65 export enum GroupContentsResourcePrefix {
66 COLLECTION = "collections",
68 PROCESS = "container_requests"