From 2890e4856c89aa53373a59e8c2490428dbfd28da Mon Sep 17 00:00:00 2001 From: g-jaskowski Date: Mon, 5 Aug 2024 18:15:40 +0200 Subject: [PATCH] ACS-7600 create separate type for hold creation --- .../services/legal-hold.service.md | 10 ++++----- .../legal-hold/services/legal-hold.service.ts | 6 ++--- .../gs-core-rest-api/api/legal-hold.api.ts | 6 ++--- .../src/api/gs-core-rest-api/docs/HoldBody.md | 19 ++++++++++++++++ .../api/gs-core-rest-api/model/holdBody.ts | 22 +++++++++++++++++++ .../src/api/gs-core-rest-api/model/index.ts | 1 + 6 files changed, 53 insertions(+), 11 deletions(-) create mode 100644 lib/js-api/src/api/gs-core-rest-api/docs/HoldBody.md create mode 100644 lib/js-api/src/api/gs-core-rest-api/model/holdBody.ts diff --git a/docs/content-services/services/legal-hold.service.md b/docs/content-services/services/legal-hold.service.md index a8e7f6d4b4..6ddb4408d4 100644 --- a/docs/content-services/services/legal-hold.service.md +++ b/docs/content-services/services/legal-hold.service.md @@ -18,15 +18,15 @@ Manages holds for nodes. - _filePlanId_: `string` - The identifier of a file plan. You can also use the -filePlan- alias - _options_: `ContentPagingQuery` - Optional parameters supported by JS-API - **Returns** [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`Hold`](../../../lib/js-api/src/api/gs-core-rest-api/docs/Hold.md)`[]>` - List of holds
-- **createHold**(filePlanId: `string`, hold: [`Hold`](../../../lib/js-api/src/api/gs-core-rest-api/docs/Hold.md)): [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`HoldEntry`](../../../lib/js-api/src/api/gs-core-rest-api/docs/HoldEntry.md)`>`
+- **createHold**(filePlanId: `string`, hold: [`HoldBody`](../../../lib/js-api/src/api/gs-core-rest-api/docs/HoldBody.md)): [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`HoldEntry`](../../../lib/js-api/src/api/gs-core-rest-api/docs/HoldEntry.md)`>`
Create new hold in File Plan. - _filePlanId_: `string` - The identifier of a file plan. You can also use the -filePlan- alias - - _hold_: [`Hold`](../../../lib/js-api/src/api/gs-core-rest-api/docs/Hold.md) - Hold that should be created + - _hold_: [`HoldBody`](../../../lib/js-api/src/api/gs-core-rest-api/docs/HoldBody.md) - Hold that should be created - **Returns** [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`HoldEntry`](../../../lib/js-api/src/api/gs-core-rest-api/docs/HoldEntry.md)`>` - Hold entry
-- **createHolds**(filePlanId: `string`, holds: [`Hold`](../../../lib/js-api/src/api/gs-core-rest-api/docs/Hold.md)`[]`): [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`Hold`](../../../lib/js-api/src/api/gs-core-rest-api/docs/Hold.md)`[]>`
+- **createHolds**(filePlanId: `string`, holds: [`HoldBody`](../../../lib/js-api/src/api/gs-core-rest-api/docs/HoldBody.md)`[]`): [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`Hold`](../../../lib/js-api/src/api/gs-core-rest-api/docs/Hold.md)`[]>`
Create new holds in File Plan. - _filePlanId_: `string` - The identifier of a file plan. You can also use the -filePlan- alias - - _holds_: `<`[`Hold`](../../../lib/js-api/src/api/gs-core-rest-api/docs/Hold.md)`[]>` - Array of holds that should be created + - _holds_: `<`[`HoldBody`](../../../lib/js-api/src/api/gs-core-rest-api/docs/HoldBody.md)`[]>` - Array of holds that should be created - **Returns** [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`HoldPaging`](../../../lib/js-api/src/api/gs-core-rest-api/docs/HoldPaging.md)`>` - List of paginated holds entries - **assignHold**(nodeId: `string`, holdId: `string`): [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`HoldEntry`](../../../lib/js-api/src/api/gs-core-rest-api/docs/HoldEntry.md)`>`
@@ -39,7 +39,7 @@ Manages holds for nodes. Assign multiple nodes to a hold. - _nodeIds_: `<{id: string}[]>` - The Ids of the nodes which will be assigned to a hold - _holdId_: `string` - The Id of the hold to which nodes will be assigned - - **Returns** [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`HoldPaging`](../../../lib/js-api/src/api/gs-core-rest-api/docs/Hold.md)`>` - Hold paging + - **Returns** [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`HoldPaging`](../../../lib/js-api/src/api/gs-core-rest-api/docs/HoldPaging.md)`>` - Hold paging - **unassignHold**(holdId: `string`, nodeId: `string`): [`Observable`](http://reactivex.io/documentation/observable.html)``
Unassign a node from a hold. diff --git a/lib/content-services/src/lib/legal-hold/services/legal-hold.service.ts b/lib/content-services/src/lib/legal-hold/services/legal-hold.service.ts index 600d6dd82f..94b87cf43f 100644 --- a/lib/content-services/src/lib/legal-hold/services/legal-hold.service.ts +++ b/lib/content-services/src/lib/legal-hold/services/legal-hold.service.ts @@ -16,7 +16,7 @@ */ import { AlfrescoApiService } from '@alfresco/adf-core'; -import { ContentPagingQuery, Hold, HoldEntry, HoldPaging, LegalHoldApi } from '@alfresco/js-api'; +import { ContentPagingQuery, Hold, HoldBody, HoldEntry, HoldPaging, LegalHoldApi } from '@alfresco/js-api'; import { Injectable } from '@angular/core'; import { Observable, from } from 'rxjs'; import { map } from 'rxjs/operators'; @@ -91,7 +91,7 @@ export class LegalHoldService { * @param hold Hold to create * @returns List of created holds Observable */ - createHold(filePlanId: string, hold: Hold): Observable { + createHold(filePlanId: string, hold: HoldBody): Observable { return from(this.legalHoldApi.createHold(filePlanId, hold)); } @@ -102,7 +102,7 @@ export class LegalHoldService { * @param holds Array of holds to create * @returns List of created holds Observable */ - createHolds(filePlanId: string, holds: Hold[]): Observable { + createHolds(filePlanId: string, holds: HoldBody[]): Observable { return from(this.legalHoldApi.createHolds(filePlanId, holds)); } } diff --git a/lib/js-api/src/api/gs-core-rest-api/api/legal-hold.api.ts b/lib/js-api/src/api/gs-core-rest-api/api/legal-hold.api.ts index e4abe85ed3..b1f28b461f 100644 --- a/lib/js-api/src/api/gs-core-rest-api/api/legal-hold.api.ts +++ b/lib/js-api/src/api/gs-core-rest-api/api/legal-hold.api.ts @@ -18,7 +18,7 @@ import { BaseApi } from './base.api'; import { throwIfNotDefined } from '../../../assert'; import { ContentPagingQuery } from '../../content-rest-api'; -import { Hold, HoldEntry, HoldPaging } from './../model'; +import { HoldBody, HoldEntry, HoldPaging } from './../model'; /** * Legal Holds service. @@ -115,7 +115,7 @@ export class LegalHoldApi extends BaseApi { * @param hold Hold to create * @returns Promise */ - createHold(filePlanId: string, hold: Hold): Promise { + createHold(filePlanId: string, hold: HoldBody): Promise { throwIfNotDefined(filePlanId, 'filePlanId'); throwIfNotDefined(hold, 'hold'); @@ -138,7 +138,7 @@ export class LegalHoldApi extends BaseApi { * @param holds Array of holds * @returns Promise */ - createHolds(filePlanId = '-filePlan-', holds: Hold[]): Promise { + createHolds(filePlanId = '-filePlan-', holds: HoldBody[]): Promise { throwIfNotDefined(filePlanId, 'filePlanId'); throwIfNotDefined(holds, 'holds'); diff --git a/lib/js-api/src/api/gs-core-rest-api/docs/HoldBody.md b/lib/js-api/src/api/gs-core-rest-api/docs/HoldBody.md new file mode 100644 index 0000000000..1dfaac263f --- /dev/null +++ b/lib/js-api/src/api/gs-core-rest-api/docs/HoldBody.md @@ -0,0 +1,19 @@ +# HoldBody + +## Basic usage + +```ts +export interface HoldBody { + name: string; + reason: string; + description?: string; +} +``` + +## Properties + +Name | Type | Default value | Description +--------------- | ------------- | ------------- | -------------------------------------------- +**name** | **string** | | Hold name +**reason** | **string** | | Hold reason +**description** | **string** | | (Optional) Additional information for a hold diff --git a/lib/js-api/src/api/gs-core-rest-api/model/holdBody.ts b/lib/js-api/src/api/gs-core-rest-api/model/holdBody.ts new file mode 100644 index 0000000000..8b2bd69c79 --- /dev/null +++ b/lib/js-api/src/api/gs-core-rest-api/model/holdBody.ts @@ -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. + */ + +export interface HoldBody { + name: string; + reason: string; + description?: string; +} diff --git a/lib/js-api/src/api/gs-core-rest-api/model/index.ts b/lib/js-api/src/api/gs-core-rest-api/model/index.ts index 2229944250..c184d0cc74 100644 --- a/lib/js-api/src/api/gs-core-rest-api/model/index.ts +++ b/lib/js-api/src/api/gs-core-rest-api/model/index.ts @@ -75,6 +75,7 @@ export * from './transferContainerChildAssociation'; export * from './unfiledContainerChildAssociation'; export * from './unfiledRecordFolderChildAssociation'; export * from './hold'; +export * from './holdBody'; export * from './holdEntry'; export * from './holdPaging'; export * from './holdPagingList';