[ACS-8597] use endpoint for bulk hold operation status (#10120)

* ACS-8597 add operation status api, use entry for assign response

* ACS-8597 review remarks - property order, docs cosistency
This commit is contained in:
Grzegorz Jaśkowski
2024-08-26 17:15:02 +02:00
committed by GitHub
parent 61faf92d41
commit 94787b5705
14 changed files with 304 additions and 24 deletions

View File

@@ -18,9 +18,9 @@
import { BaseApi } from './base.api';
import { throwIfNotDefined } from '../../../assert';
import { ContentPagingQuery } from '../../content-rest-api';
import { HoldBody, HoldEntry, HoldPaging } from './../model';
import { BulkAssignHoldResponse } from '../model/bulkAssignHoldResponse';
import { BulkAssignHoldResponseEntry, HoldBody, HoldEntry, HoldPaging } from './../model';
import { RequestQuery } from '../../search-rest-api';
import { HoldBulkStatusEntry } from '../model/holdBulkStatusEntry';
/**
* Legal Holds service.
@@ -161,9 +161,9 @@ export class LegalHoldApi extends BaseApi {
*
* @param holdId The identifier of a hold
* @param query Search query
* @returns Promise<BulkAssignHoldResponse>
* @returns Promise<BulkAssignHoldResponseEntry>
*/
bulkAssignHold(holdId: string, query: RequestQuery): Promise<BulkAssignHoldResponse> {
bulkAssignHold(holdId: string, query: RequestQuery): Promise<BulkAssignHoldResponseEntry> {
throwIfNotDefined(holdId, 'holdId');
throwIfNotDefined(query, 'query');
@@ -176,4 +176,22 @@ export class LegalHoldApi extends BaseApi {
}
});
}
/**
* Get status of bulk operation with **bulkStatusId** for **holdId**.
*
* @param bulkStatusId The identifier of a bulk status
* @param holdId The identifier of a hold
* @returns Promise<HoldsBulkStatusEntry>
*/
getBulkStatus(bulkStatusId: string, holdId: string): Promise<HoldBulkStatusEntry> {
throwIfNotDefined(holdId, 'holdId');
throwIfNotDefined(bulkStatusId, 'bulkStatusId');
return this.get({
path: `/holds/{holdId}/bulk-statuses/{bulkStatusId}`,
pathParams: { holdId, bulkStatusId },
returnType: HoldBulkStatusEntry
});
}
}

View File

@@ -0,0 +1,7 @@
# BulkAssignHoldResponseEntry
## Properties
| Name | Type | Description |
| --------- | ------------------------------------------------------- | -------------------------------------------------- |
| **Entry** | [**BulkAssignHoldResponse**](BulkAssignHoldResponse.md) | Response received after bulk assign hold operation |

View File

@@ -0,0 +1,8 @@
# HoldBulkOperation
## Properties
| Name | Type | Default value | Description |
| --------- | -------------------------------------------------------------- | ------------- | ---------------------------------------------------- |
| **op** | **string** | | Operations type. Currently only **ADD** type exists. |
| **query** | [**RequestQuery**](../../search-rest-api/docs/RequestQuery.md) | | Query to get files to assign to a hold. |

View File

@@ -0,0 +1,14 @@
# HoldBulkStatus
## Properties
| Name | Type | Description | Notes |
|---------------------- | --------------------------------------------- | --------------------------------------------- | --------------------------------------------- |
| **bulkStatusId** | **string** | Bulk status id | |
| **errorsCount** | **number** | Number of errors thrown during bulk operation | |
| **holdBulkOperation** | [**HoldBulkOperation**](HoldBulkOperation.md) | Specifies operation type and targeted files | |
| **processedItems** | **number** | Number of processed files | |
| **status** | **string** | Current status of operation | |
| **totalItems** | **number** | Number of targeted files | |
| **startTime** | **Date** | Date and time of operation start | |
| **endTime** | **Date** | Date and time of operation end | Is included only after operation is completed |

View File

@@ -0,0 +1,7 @@
# HoldBulkStatusEntry
## Properties
| Name | Type | Description |
|---------------------- | --------------------------------------------- | --------------------------------------------- |
| **entry** | [**HoldBulkStatus**](HoldBulkStatus.md) | Current status of hulk assign holds operation |

View File

@@ -2,15 +2,16 @@
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 |
| [**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 |
| [**bulkAssignHold**](LegalHoldApi.md#bulkAssignHold) | **POST** /holds/{holdId}/bulk | Bulk add of nodes to the hold |
| 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 |
| [**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 |
| [**bulkAssignHold**](LegalHoldApi.md#bulkAssignHold) | **POST** /holds/{holdId}/bulk | Bulk add of nodes to the hold |
| [**getBulkStatus**](LegalHoldApi.md#getBulkStatus) | **GET** /holds/{holdId}/bulk-statuses/{bulkStatusId} | Get current status of bulk operation |
<a name="getHolds"></a>
@@ -324,3 +325,43 @@ legalHoldApi.bulkAssignHold('holdId', { query: 'SITE:swsdp and TYPE:content', la
### Return type
[**BulkAssignHoldResponse**](./BulkAssignHoldResponse.md)
# **getBulkStatus**
> HoldBulkStatusEntry getBulkStatus(holdId, bulkOperationId)
Get current status of asynchronous bulk operations with `bulkStatusId` happening for hold with `holdId`
### 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);
legalHoldApi.bulkAssignHold('holdId', 'bulkOperationId').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 |
| **bulkOperationId** | **string** | | The identifies of a bulk operation |
### Return type
[**HoldBulkStatusEntry**](./HoldBulkStatusEntry.md)

View File

@@ -0,0 +1,22 @@
/*!
* @license
* Copyright © 2005-2024 Hyland Software, Inc. and its affiliates. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { BulkAssignHoldResponse } from './bulkAssignHoldResponse';
export interface BulkAssignHoldResponseEntry {
entry: BulkAssignHoldResponse;
}

View File

@@ -0,0 +1,30 @@
/*!
* @license
* Copyright © 2005-2024 Hyland Software, Inc. and its affiliates. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
export class HoldBulkOperation {
op: string;
query: {
language: string;
query: string;
};
constructor(input?: Partial<HoldBulkOperation>) {
if (input) {
Object.assign(this, input);
}
}
}

View File

@@ -0,0 +1,38 @@
/*!
* @license
* Copyright © 2005-2024 Hyland Software, Inc. and its affiliates. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { HoldBulkOperation } from './holdBulkOperation';
import { DateAlfresco } from '../../content-custom-api';
export class HoldBulkStatus {
bulkStatusId: string;
errorsCount: number;
holdBulkOperation: HoldBulkOperation;
processedItems: number;
status: string;
totalItems: number;
startTime: Date;
endTime?: Date;
constructor(input?: Partial<HoldBulkStatus>) {
if (input) {
Object.assign(this, input);
this.startTime = input.startTime ? DateAlfresco.parseDate(input.startTime) : undefined;
this.endTime = input.endTime ? DateAlfresco.parseDate(input.endTime) : undefined;
}
}
}

View File

@@ -0,0 +1,28 @@
/*!
* @license
* Copyright © 2005-2024 Hyland Software, Inc. and its affiliates. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { HoldBulkStatus } from './holdBulkStatus';
export class HoldBulkStatusEntry {
entry: HoldBulkStatus;
constructor(input?: Partial<HoldBulkStatusEntry>) {
if (input) {
Object.assign(this, input);
}
}
}

View File

@@ -76,8 +76,12 @@ export * from './unfiledContainerChildAssociation';
export * from './unfiledRecordFolderChildAssociation';
export * from './hold';
export * from './holdBody';
export * from './holdBulkOperation';
export * from './holdBulkStatus';
export * from './holdBulkStatusEntry';
export * from './holdEntry';
export * from './holdPaging';
export * from './holdPagingList';
export * from './nodeAssignedHold';
export * from './bulkAssignHoldResponse';
export * from './bulkAssignHoldResponseEntry';