diff --git a/docs/core/services/nodes-api.service.md b/docs/core/services/nodes-api.service.md index 82beb830e6..b9b9d89110 100644 --- a/docs/core/services/nodes-api.service.md +++ b/docs/core/services/nodes-api.service.md @@ -89,15 +89,15 @@ Accesses and manipulates ACS document nodes using their node IDs. - _nodeId:_ `string` - ID of the target node - _options:_ `{ includeSource?: boolean; } & NodesIncludeQuery & 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 assigned holds -- **initiateFolderSizeCalculation**(nodeId: `string`): [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`JobIdBodyEntry`](../../../lib/js-api/src/api/content-rest-api/docs/JobIdBodyEntry.md)`>`
+- **initiateFolderSizeCalculation**(nodeId: `string`): [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`JobIdBodyEntry`](../../../lib/js-api/src/api/content-rest-api/docs/NodesApi.md#jobidbodyentry)`>`
Initiate a new request to calculate folder size. - _nodeId:_ `string` - ID of the target node - - **Returns** [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`JobIdBodyEntry`](../../../lib/js-api/src/api/content-rest-api/docs/JobIdBodyEntry.md)`>` - Job id which can be used to track request status -- **getFolderSizeInfo**(nodeId: `string`, jobId: `string`): [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`SizeDetailsEntry`](../../../lib/js-api/src/api/content-rest-api/docs/SizeDetailsEntry.md)`>`
+ - **Returns** [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`JobIdBodyEntry`](../../../lib/js-api/src/api/content-rest-api/docs/NodesApi.md#jobidbodyentry)`>` - Job id which can be used to track request status +- **getFolderSizeInfo**(nodeId: `string`, jobId: `string`): [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`SizeDetailsEntry`](../../../lib/js-api/src/api/content-rest-api/docs/NodesApi.md#sizedetailsentry)`>`
Gets the size of a folder. - _nodeId:_ `string` - ID of the target node - _jobId:_ `string` - ID of the job started by the `initiateFolderSizeCalculation` request - - **Returns** [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`SizeDetailsEntry`](../../../lib/js-api/src/api/content-rest-api/docs/SizeDetailsEntry.md)`>` - Details of the folder + - **Returns** [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`SizeDetailsEntry`](../../../lib/js-api/src/api/content-rest-api/docs/NodesApi.md#sizedetailsentry)`>` - Details of the folder ## Details diff --git a/lib/content-services/src/lib/common/services/nodes-api.service.ts b/lib/content-services/src/lib/common/services/nodes-api.service.ts index 70bb7b5fe6..01a896fbcf 100644 --- a/lib/content-services/src/lib/common/services/nodes-api.service.ts +++ b/lib/content-services/src/lib/common/services/nodes-api.service.ts @@ -259,15 +259,17 @@ export class NodesApiService { /** * Initiate a new request to calculate folder size. + * * @param nodeId Node Id * @returns The job id which can be used to track request status */ initiateFolderSizeCalculation(nodeId: string): Observable { - return from(this.nodesApi.initialFolderSizeCalculation(nodeId)); + return from(this.nodesApi.initiateFolderSizeCalculation(nodeId)); } /** * Gets the size of a folder. + * * @param nodeId Node Id * @param jobId Job Id * @returns Folder details diff --git a/lib/js-api/src/api/content-rest-api/api/nodes.api.ts b/lib/js-api/src/api/content-rest-api/api/nodes.api.ts index 212afce53e..2edd15bc8c 100644 --- a/lib/js-api/src/api/content-rest-api/api/nodes.api.ts +++ b/lib/js-api/src/api/content-rest-api/api/nodes.api.ts @@ -993,7 +993,7 @@ export class NodesApi extends BaseApi { * @param nodeId Node Id * @returns The job id which can be used to track request status */ - initialFolderSizeCalculation(nodeId: string): Promise { + initiateFolderSizeCalculation(nodeId: string): Promise { throwIfNotDefined(nodeId, 'nodeId'); const pathParams = { diff --git a/lib/js-api/src/api/content-rest-api/docs/JobIdBody.md b/lib/js-api/src/api/content-rest-api/docs/JobIdBody.md deleted file mode 100644 index a7e3900d90..0000000000 --- a/lib/js-api/src/api/content-rest-api/docs/JobIdBody.md +++ /dev/null @@ -1,7 +0,0 @@ -# JobIdBody - -## Properties - - Name | Type | Description | Notes ------------|--------|---------------------------------------------------------------------------------------|------------------- - **jobId** | string | Id of the job that can be used to track the status of folder size calculation request | [default to null] diff --git a/lib/js-api/src/api/content-rest-api/docs/JobIdBodyEntry.md b/lib/js-api/src/api/content-rest-api/docs/JobIdBodyEntry.md deleted file mode 100644 index c90bf91177..0000000000 --- a/lib/js-api/src/api/content-rest-api/docs/JobIdBodyEntry.md +++ /dev/null @@ -1,7 +0,0 @@ -# JobIdBodyEntry - -**Properties** - -| Name | Type | -|-----------|---------------------------| -| **entry** | [JobIdBody](JobIdBody.md) | diff --git a/lib/js-api/src/api/content-rest-api/docs/NodesApi.md b/lib/js-api/src/api/content-rest-api/docs/NodesApi.md index e760708db4..9a55040b6b 100644 --- a/lib/js-api/src/api/content-rest-api/docs/NodesApi.md +++ b/lib/js-api/src/api/content-rest-api/docs/NodesApi.md @@ -25,6 +25,8 @@ All URIs are relative to *https://localhost/alfresco/api/-default-/public/alfres | [unlockNode](#unlockNode) | **POST** /nodes/{nodeId}/unlock | Unlock a node | | [updateNode](#updateNode) | **PUT** /nodes/{nodeId} | Update a node | | [updateNodeContent](#updateNodeContent) | **PUT** /nodes/{nodeId}/content | Update node content | +| [initialFolderSizeCalculation](#initialFolderSizeCalculation) | **POST** /nodes/{nodeId}/size-details | Initiate a new request to calculate folder size | +| [getFolderSizeInfo](#getFolderSizeInfo) | **GET** /nodes/{nodeId}/size-details/{jobId} | Gets the details of a folder | ## copyNode @@ -1196,6 +1198,67 @@ nodesApi.updateNodeContent(``, contentBodyUpdate, opts).then((data) => { console.log('API called successfully. Returned data: ' + data); }); ``` +## initialFolderSizeCalculation + +Initiate a new request to calculate folder size. + +> this endpoint is available in **Alfresco 7.1** and newer versions. + +Initiates a request to calculate the size of the node with identifier **nodeId**. + +**Parameters** + +| Name | Type | Description | +|-----------------------|----------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| **nodeId** | string | The identifier of a node. | + +**Return type**: [JobIdBodyEntry](#JobIdBodyEntry) + +**Example** + +```javascript +import {AlfrescoApi, NodesApi} from '@alfresco/js-api'; + +const alfrescoApi = new AlfrescoApi(/*..*/); +const nodesApi = new NodesApi(alfrescoApi); +const contentBodyUpdate = {}; +const opts = {}; + +nodesApi.initiateFolderSizeCalculation(``).then((data) => { + console.log('API called successfully. Returned data: ' + data); +}); +``` +## getFolderSizeInfo + +Gets the size details of a folder + +> this endpoint is available in **Alfresco 7.1** and newer versions. + +Fetches the size details of folder with the identifier **nodeId** + +**Parameters** + +| Name | Type | Description | +|------------|----------|------------------------------------------------------------------------------------| +| **nodeId** | string | The identifier of a node. | +| **jobId** | string | The identifier for the job which is calculating the currently selected node's size | + +**Return type**: [SizeDetailsEntry](#SizeDetailsEntry) + +**Example** + +```javascript +import {AlfrescoApi, NodesApi} from '@alfresco/js-api'; + +const alfrescoApi = new AlfrescoApi(/*..*/); +const nodesApi = new NodesApi(alfrescoApi); +const contentBodyUpdate = {}; +const opts = {}; + +nodesApi.getFolderSizeInfo(``, ``).then((data) => { + console.log('API called successfully. Returned data: ' + data); +}); +``` # Models @@ -1409,6 +1472,39 @@ nodesApi.updateNodeContent(``, contentBodyUpdate, opts).then((data) => { | isInheritanceEnabled | boolean | | locallySet | [PermissionElement[]](PermissionElement.md) | +# JobIdBodyEntry + +**Properties** + +| Name | Type | +|-----------|-------------------------| +| **entry** | [JobIdBody](#JobIdBody) | + +# JobIdBody + +**Properties** +| Name | Type | Description | Notes | +|-----------|--------|---------------------------------------------------------------------------------------|-------------------| +| **jobId** | string | Id of the job that can be used to track the status of folder size calculation request | [default to null] | +# SizeDetailsEntry + +**Properties** + +| Name | Type | +|-----------|-----------------------------| +| **entry** | [SizeDetails](#SizeDetails) | + +# SizeDetails + +**Properties** +| Name | Type | Description | Notes | +|-------------------|--------|-----------------------------------------------------------------------------|------------------| +| **id** | string | Unique alphanumeric id unique to this response request | [default to null]| +| **sizeInBytes** | string | Size of the folder in bytes | [default to null]| +| **calculatedAt** | string | Timestamp of when the folder size was calculated | [default to null]| +| **numberOfFiles** | number | Number of files present within the folder | [default to null]| +| **status** | string | Status of the request. Can be 'NOT-INITIATED', 'IN-PROGRESS' or 'COMPLETED' | [default to null]| +| **jobId** | string | The job ID which was used to track down the folder details | [default to null]| diff --git a/lib/js-api/src/api/content-rest-api/docs/SizeDetails.md b/lib/js-api/src/api/content-rest-api/docs/SizeDetails.md deleted file mode 100644 index 8e865fa685..0000000000 --- a/lib/js-api/src/api/content-rest-api/docs/SizeDetails.md +++ /dev/null @@ -1,12 +0,0 @@ -# Size Details - -## Properties - - Name | Type | Description | Notes --------------------|--------|-----------------------------------------------------------------------------|------------------- - **id** | string | | [default to null] - **sizeInBytes** | string | Size of the folder in bytes | [default to null] - **calculatedAt** | string | Timestamp of when the folder size was calculated | [default to null] - **numberOfFiles** | number | Number of files present within the folder | [default to null] - **status** | string | Status of the request. Can be 'NOT-INITIATED', 'IN-PROGRESS' or 'COMPLETED' | [default to null] - **jobId** | string | The job ID which was used to track down the folder details | [default to null] diff --git a/lib/js-api/src/api/content-rest-api/docs/SizeDetailsEntry.md b/lib/js-api/src/api/content-rest-api/docs/SizeDetailsEntry.md deleted file mode 100644 index 5ac215ff88..0000000000 --- a/lib/js-api/src/api/content-rest-api/docs/SizeDetailsEntry.md +++ /dev/null @@ -1,7 +0,0 @@ -# SizeDetailsEntry - -**Properties** - -| Name | Type | -|-----------|-------------------------------| -| **entry** | [SizeDetails](SizeDetails.md) | diff --git a/lib/js-api/src/api/content-rest-api/model/sizeDetails.ts b/lib/js-api/src/api/content-rest-api/model/sizeDetails.ts index 644af38c47..4d697a1351 100644 --- a/lib/js-api/src/api/content-rest-api/model/sizeDetails.ts +++ b/lib/js-api/src/api/content-rest-api/model/sizeDetails.ts @@ -20,7 +20,7 @@ export class SizeDetails { sizeInBytes: string; calculatedAt: string; numberOfFiles: number; - status: string; + status: SizeDetails.StatusEnum; jobId: string; constructor(entry: SizeDetails) { @@ -32,3 +32,11 @@ export class SizeDetails { this.jobId = entry.jobId; } } +export namespace SizeDetails { + export type StatusEnum = 'IN-PROGRESS' | 'COMPLETE' | 'NOT-INITIATED'; + export const StatusEnum = { + IN_PROGRESS: 'IN-PROGRESS' as StatusEnum, + COMPLETE: 'COMPLETE' as StatusEnum, + NOT_INITIATED: 'NOT-INITIATED' as StatusEnum + }; +}