- return this.serverApi
- .get(this.resourceType + `${uuid}/contents/`, {
- params: CommonResourceService.mapKeys(_.snakeCase)(params)
- })
- .then(CommonResourceService.mapResponseKeys);
+
+ const pathUrl = uuid ? `${uuid}/contents` : 'contents';
+ const response = await CommonResourceService.defaultResponse(
+ this.serverApi
+ .get(this.resourceType + pathUrl, {
+ params: CommonResourceService.mapKeys(_.snakeCase)(params)
+ }),
+ this.actions,
+ false
+ );
+
+ const { items, ...res } = response;
+ const mappedItems = items.map((item: GroupContentsResource) => {
+ const mappedItem = TrashableResourceService.mapKeys(_.camelCase)(item);
+ if (item.kind === ResourceKind.COLLECTION) {
+ const { properties } = item;
+ return { ...mappedItem, properties };
+ } else {
+ return mappedItem;
+ }
+ });
+ const mappedResponse = { ...TrashableResourceService.mapKeys(_.camelCase)(res) };
+ return { ...mappedResponse, items: mappedItems };
+ }
+
+ shared(params: SharedArguments = {}): Promise<ListResults<GroupContentsResource>> {
+ return CommonResourceService.defaultResponse(
+ this.serverApi
+ .get(this.resourceType + 'shared', { params }),
+ this.actions
+ );