ACS-7689 Save and delete to existing hold (#9841)

This commit is contained in:
tomson
2024-06-26 14:03:34 +02:00
committed by Darya Blavanovich
parent bf7f202b91
commit 206f2e02ea
6 changed files with 296 additions and 13 deletions

View File

@@ -19,6 +19,7 @@ import { BaseApi } from './base.api';
import { throwIfNotDefined } from '../../../assert';
import { ContentPagingQuery } from '../../content-rest-api';
import { HoldPaging } from '../model/holdPaging';
import { HoldEntry } from '../model';
/**
* Legal Holds service.
@@ -52,4 +53,59 @@ export class LegalHoldApi extends BaseApi {
returnType: HoldPaging
});
}
/**
* Assign node to legal hold
*
* @param holdId The identifier of a hold
* @param nodeId The id of the node to be assigned to existing hold
* @returns Promise<HoldEntry>
*/
assignHold(nodeId: string, holdId: string): Promise<HoldEntry> {
throwIfNotDefined(holdId, 'holdId');
throwIfNotDefined(nodeId, 'nodeId');
return this.post({
path: `/holds/{holdId}/children`,
pathParams: { holdId },
bodyParam: [nodeId],
returnType: HoldEntry
});
}
/**
* Assign nodes to legal hold
*
* @param holdId The identifier of a hold
* @param nodeIds The list with id of nodes to assign to existing hold
* @returns Promise<HoldPaging>
*/
assignHolds(nodeIds: { id: string }[], holdId: string): Promise<HoldPaging> {
throwIfNotDefined(holdId, 'holdId');
throwIfNotDefined(nodeIds, 'nodeIds');
return this.post({
path: `/holds/{holdId}/children`,
pathParams: { holdId },
bodyParam: nodeIds,
returnType: HoldPaging
});
}
/**
* Deletes the relationship between a child with id nodeId and a parent hold with id holdId
*
* @param holdId The identifier of a hold
* @param nodeId The Id of the node which is unassigned
* @returns Empty response
*/
unassignHold(holdId: string, nodeId: string): Promise<void> {
throwIfNotDefined(holdId, 'holdId');
throwIfNotDefined(nodeId, 'nodeId');
return this.delete({
path: `/holds/{holdId}/children/{nodeId}`,
pathParams: { holdId, nodeId }
});
}
}

View File

@@ -1,18 +1,24 @@
# LegalHoldApi
All URIs are relative to *https://localhost/alfresco/api/-default-/public/gs/versions/1*
All URIs are relative to _https://localhost/alfresco/api/-default-/public/gs/versions/1_
Method | HTTP request | Description
------------- | ------------- | -------------
[**getHolds**](LegalHoldApi.md#getHolds) | **GET** /file-plans/{filePlanId}/holds | Get legal holds list
| Method | HTTP request | Description |
| ------------------------------------------------ | -------------------------------------------- | ----------------------------- |
| [**getHolds**](LegalHoldApi.md#getHolds) | **GET** /file-plans/{filePlanId}/holds | Get legal holds list |
| [**assignHold**](LegalHoldApi.md#assignHold) | **POST** /holds/{holdId}/children | Assign node to legal hold |
| [**assignHolds**](LegalHoldApi.md#assignHolds) | **POST** /holds/{holdId}/children | Assign nodes to legal hold |
| [**unassignHold**](LegalHoldApi.md#unassignHold) | **DELETE** /holds/{holdId}/children/{nodeId} | Unassign node from legal hold |
<a name="getHolds"></a>
# **getHolds**
> HoldPaging getHolds(filePlanId, opts)
Get legal holds list.
### Example
```javascript
import LegalHoldApi from 'LegalHoldApi';
import { AlfrescoApi } from '@alfresco/js-api';
@@ -24,7 +30,7 @@ this.alfrescoApi.setConfig({
let legalHoldApi = new LegalHoldApi(this.alfrescoApi);
let opts = {
let opts = {
'skipCount': 56 // | The number of entities that exist in the collection before those included in this list.
'maxItems': 56 // | The maximum number of items to return in the list.
};
@@ -39,12 +45,138 @@ legalHoldApi.getHolds('-filePlan-', opts).then((data) => {
### Parameters
Name | Type | Default value | Description
------------- | ------------- | ------------- | -------------
**filePlanId** | **string** | | The site details
**skipCount** | **number**| `0` | The number of entities that exist in the collection before those included in this list. [optional]
**maxItems** | **number**| `100` | The maximum number of items to return in the list. [optional]
| Name | Type | Default value | Description |
| -------------- | ---------- | ------------- | -------------------------------------------------------------------------------------------------- |
| **filePlanId** | **string** | | The site details |
| **skipCount** | **number** | `0` | The number of entities that exist in the collection before those included in this list. [optional] |
| **maxItems** | **number** | `100` | The maximum number of items to return in the list. [optional] |
### Return type
[**HoldPaging**](HoldPaging.md)
<a name="assignHold"></a>
# **assignHold**
> HoldEntry assignHold(nodeId, holdId)
Assign node to legal hold.
### Example
```javascript
import LegalHoldApi from 'LegalHoldApi';
import { AlfrescoApi } from '@alfresco/js-api';
this.alfrescoApi = new AlfrescoApi();
this.alfrescoApi.setConfig({
hostEcm: 'http://127.0.0.1:8080'
});
let legalHoldApi = new LegalHoldApi(this.alfrescoApi);
legalHoldApi.assignHold('nodeId', 'holdId').then(
(data) => {
console.log('API called successfully. Returned data: ' + data);
},
function (error) {
console.error(error);
}
);
```
### Parameters
| Name | Type | Default value | Description |
| ---------- | ---------- | ------------- | ----------------------------------------- |
| **nodeId** | **string** | | The id of the node to be assigned to hold |
| **holdId** | **string** | | The identifier of a hold. |
### Return type
[**HoldEntry**](HoldEntry.md)
<a name="assignHolds"></a>
# **assignHolds**
> HoldPaging assignHolds(nodeIds, holdId)
Assign nodes to legal hold.
### Example
```javascript
import LegalHoldApi from 'LegalHoldApi';
import { AlfrescoApi } from '@alfresco/js-api';
this.alfrescoApi = new AlfrescoApi();
this.alfrescoApi.setConfig({
hostEcm: 'http://127.0.0.1:8080'
});
let legalHoldApi = new LegalHoldApi(this.alfrescoApi);
legalHoldApi.assignHolds([{ id: 'foo' }, { id: 'bar' }], 'holdId').then(
(data) => {
console.log('API called successfully. Returned data: ' + data);
},
function (error) {
console.error(error);
}
);
```
### Parameters
| Name | Type | Default value | Description |
| ----------- |----------------------| ------------- | ---------------------------------------------------- |
| **nodeIds** | **{ id: string }[]** | | The list with id of nodes to assign to existing hold |
| **holdId** | **string** | | The identifier of a hold. |
### Return type
[**HoldPaging**](HoldPaging.md)
<a name="unassignHold"></a>
# **unassignHold**
> void unassignHold(holdId, nodeId)
Unassign node from legal hold.
### Example
```javascript
import LegalHoldApi from 'LegalHoldApi';
import { AlfrescoApi } from '@alfresco/js-api';
this.alfrescoApi = new AlfrescoApi();
this.alfrescoApi.setConfig({
hostEcm: 'http://127.0.0.1:8080'
});
let legalHoldApi = new LegalHoldApi(this.alfrescoApi);
legalHoldApi.unassignHold('holdId', 'nodeId').then(
(data) => {
console.log('API called successfully. Returned data: ' + data);
},
function (error) {
console.error(error);
}
);
```
### Parameters
| Name | Type | Default value | Description |
| ---------- | ---------- | ------------- | ------------------------------------------ |
| **holdId** | **string** | | The identifier of a hold |
| **nodeId** | **string** | | The nodeId of the node which is unassigned |
### Return type
**void**

View File

@@ -16,8 +16,8 @@
*/
export interface Hold {
name: string;
id?: string;
name?: string;
reason?: string;
description?: string;
selected?: boolean;