[ACS-7690] Saving adding o a new hold (#9862)

* ACS-7689 Save and delete to existing hold

* ACS-7689 Save and delete to existing hold, cleanup

* ACS-7689 Save and delete to existing hold, revert to separate methods

* ACS-7689 Save and delete to existing hold, fix specs

* ACS-7689 Save and delete to existing hold, fix specs

* ACS-7689 Save and delete to existing hold

* ACS-8055 add listAssignedHolds API

* ACS-8055 create legal-hold service

* ACS-8055 add documentation

* ACS-8055 fix imports

* ACS-8055 add HoldPaging class and documentation

* ACS-8055 add interface and fix test

* ACS-7689 Save and delete to existing hold, fix specs

* ACS-7689 Save and delete to existing hold, fix specs

* ACS-7690 integrate create and assign holds endpoints

* ACS-7690 fix imports

* ACS-7690 add bulk method

* ACS-7690 update readme file

* ACS-7690 add tests

* ACS-7690 update docs file

* ACS-7690 remove interface

* ACS-7690 update geHolds description and md file with createHold

* ACS-7690 add createHolds to md file

* ACS-7690 fix typo in spec, and description in legal-hold service

* ACS-7690 refactor create hold parameter and documentation

* ACS-7690 fixed test

* ACS-7690 fix test for getHolds

* ACS-7690 fix md for create hold action

* ACS-7690 fix rebase conflicts

---------

Co-authored-by: Tomasz Nastaly <tomasz.nastaly@hyland.com>
Co-authored-by: DaryaBalvanovich <darya.balvanovich1@hyland.com>
This commit is contained in:
Darya Blavanovich
2024-06-26 14:35:26 +02:00
parent 206f2e02ea
commit 0843263ce3
5 changed files with 233 additions and 23 deletions

View File

@@ -18,8 +18,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';
import { Hold, HoldEntry, HoldPaging } from './../model';
/**
* Legal Holds service.
@@ -108,4 +107,50 @@ export class LegalHoldApi extends BaseApi {
pathParams: { holdId, nodeId }
});
}
/**
* Create new hold
*
* @param filePlanId The identifier of a file plan. You can also use the -filePlan- alias.
* @param hold Hold to create
* @returns Promise<HoldEntry>
*/
createHold(filePlanId: string, hold: Hold): Promise<HoldEntry> {
throwIfNotDefined(filePlanId, 'filePlanId');
throwIfNotDefined(hold, 'hold');
const pathParams = {
filePlanId
};
return this.post({
path: '/file-plans/{filePlanId}/holds',
pathParams,
bodyParam: [hold],
returnType: HoldEntry
});
}
/**
* Create list of new holds
*
* @param filePlanId The identifier of a file plan. You can also use the -filePlan- alias.
* @param holds Array of holds
* @returns Promise<HoldPaging>
*/
createHolds(filePlanId = '-filePlan-', holds: Hold[]): Promise<HoldPaging> {
throwIfNotDefined(filePlanId, 'filePlanId');
throwIfNotDefined(holds, 'holds');
const pathParams = {
filePlanId
};
return this.post({
path: '/file-plans/{filePlanId}/holds',
pathParams,
bodyParam: holds,
returnType: HoldPaging
});
}
}

View File

@@ -8,6 +8,8 @@ All URIs are relative to _https://localhost/alfresco/api/-default-/public/gs/ver
| [**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 |
[**createHold**](LegalHoldApi.md#createHold) | **POST** /file-plans/{filePlanId}/holds | Create one hold
[**createHolds**](LegalHoldApi.md#createHolds) | **POST** /file-plans/{filePlanId}/holds | Create list of holds
<a name="getHolds"></a>
@@ -28,7 +30,7 @@ this.alfrescoApi.setConfig({
hostEcm: 'http://127.0.0.1:8080'
});
let legalHoldApi = new LegalHoldApi(this.alfrescoApi);
const legalHoldApi = new LegalHoldApi(this.alfrescoApi);
let opts = {
'skipCount': 56 // | The number of entities that exist in the collection before those included in this list.
@@ -180,3 +182,96 @@ legalHoldApi.unassignHold('holdId', 'nodeId').then(
### Return type
**void**
<a name="createHold"></a>
# **createHold**
> HoldEntry createHold(filePlanId, holds)
Create 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'
});
const legalHoldApi = new LegalHoldApi(this.alfrescoApi);
const hold = {
name: 'Hold 1',
reason: 'Reason 1'
};
legalHoldApi.createHold('-filePlan-', hold).then((data) => {
console.log('API called successfully. Returned data: ' + data);
}, function(error) {
console.error(error);
});
```
### Parameters
Name | Type | Default value | Description
------------- | ------------- | ------------- | -------------
**filePlanId** | **string** | | The site details
**hold** | **Hold**| | Hold to create.
### Return type
[**HoldEntry**](./HoldEntry.md)
<a name="createHolds"></a>
# **createHolds**
> HoldPaging createHolds(filePlanId, holds)
Create legal holds list.
### 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'
});
const legalHoldApi = new LegalHoldApi(this.alfrescoApi);
let opts = [
{
name: 'Hold 1',
reason: 'Reason 1'
},
{
name: 'Hold 2',
reason: 'Reason 2',
description: 'Description'
}
];
legalHoldApi.createHolds('-filePlan-', holds).then((data) => {
console.log('API called successfully. Returned data: ' + data);
}, function(error) {
console.error(error);
});
```
### Parameters
Name | Type | Default value | Description
------------- | ------------- | ------------- | -------------
**filePlanId** | **string** | | The site details
**holds** | **Hold[]**| | Array of new holds.
### Return type
[**HoldPaging**](./HoldPaging.md)