From 4152c12f3df5244e1e72161f45127587bb6fa278 Mon Sep 17 00:00:00 2001 From: Nikita Maliarchuk <84377976+nikita-web-ua@users.noreply.github.com> Date: Tue, 14 Feb 2023 15:06:37 +0100 Subject: [PATCH] [ACS-4331] Add deleteTag method to tags API (#1490) * ACS-4331 - created new method for deleting a tag * ACS-4331 - added some documentation for deleteTag * ACS-4331 - added docs * ACS-4331 - README formating fix * [ACS-4331] changed Promise type to void * [ACS-4331] corrected link --- src/api/content-rest-api/README.md | 3 +- src/api/content-rest-api/api/tags.api.ts | 35 ++++++++++++++++++++++ src/api/content-rest-api/docs/TagsApi.md | 37 ++++++++++++++++++++++++ 3 files changed, 74 insertions(+), 1 deletion(-) diff --git a/src/api/content-rest-api/README.md b/src/api/content-rest-api/README.md index 87275a5d84..6490d01669 100644 --- a/src/api/content-rest-api/README.md +++ b/src/api/content-rest-api/README.md @@ -136,6 +136,7 @@ TagsApi | [**getTag**](docs/TagsApi.md#getTag) | **GET** /tags/{tagId} | Get a t TagsApi | [**listTags**](docs/TagsApi.md#listTags) | **GET** /tags | List tags TagsApi | [**listTagsForNode**](docs/TagsApi.md#listTagsForNode) | **GET** /nodes/{nodeId}/tags | List tags for a node TagsApi | [**updateTag**](docs/TagsApi.md#updateTag) | **PUT** /tags/{tagId} | Update a tag +TagsApi | [**deleteTag**](docs/TagsApi.md#deleteTag) | **DELETE** /tags/{tagId} | Delete a tag TagsApi | [**createTags**](docs/TagsApi.md#createTags) | **POST** /tags/ | Create specified by **tags** list of tags. TrashcanApi | [**deleteDeletedNode**](docs/TrashcanApi.md#deleteDeletedNode) | **DELETE** /deleted-nodes/{nodeId} | Permanently delete a deleted node TrashcanApi | [**getArchivedNodeRendition**](docs/TrashcanApi.md#getArchivedNodeRendition) | **GET** /deleted-nodes/{nodeId}/renditions/{renditionId} | Get rendition information for a deleted node @@ -333,4 +334,4 @@ VersionsApi | [**revertVersion**](docs/VersionsApi.md#revertVersion) | **POST** - [VersionPagingList](docs/VersionPagingList.md) - [DeletedNode](docs/DeletedNode.md) - [NodeAssociation](docs/NodeAssociation.md) -- [NodeChildAssociation](docs/NodeChildAssociation.md) +- [NodeChildAssociation](docs/NodeChildAssociation.md) \ No newline at end of file diff --git a/src/api/content-rest-api/api/tags.api.ts b/src/api/content-rest-api/api/tags.api.ts index 110d0e27b0..4e74921ab1 100644 --- a/src/api/content-rest-api/api/tags.api.ts +++ b/src/api/content-rest-api/api/tags.api.ts @@ -386,6 +386,41 @@ parameter are returned in addition to those specified in the **fields** paramete pathParams, queryParams, headerParams, formParams, postBody, contentTypes, accepts , TagEntry); } +/** + * Delete a tag + * + * Deletes a tag by **tagId**. This will cause the tag to be removed from all nodes. + * + * @param tagId The identifier of a tag. + * @return Promise<{}> + */ + deleteTag(tagId: string): Promise { + + throwIfNotDefined(tagId, 'tagId'); + + const postBody: null = null; + + const pathParams = { + 'tagId': tagId + }; + + const queryParams = { + }; + + const headerParams = { + + }; + const formParams = { + }; + + const contentTypes = ['application/json']; + const accepts = ['application/json']; + + return this.apiClient.callApi( + '/tags/{tagId}', 'DELETE', + pathParams, queryParams, headerParams, formParams, postBody, + contentTypes, accepts); + } /** * Create tags diff --git a/src/api/content-rest-api/docs/TagsApi.md b/src/api/content-rest-api/docs/TagsApi.md index e5f7c7918d..88c2206d28 100644 --- a/src/api/content-rest-api/docs/TagsApi.md +++ b/src/api/content-rest-api/docs/TagsApi.md @@ -10,6 +10,7 @@ Method | HTTP request | Description [**listTags**](TagsApi.md#listTags) | **GET** /tags | List tags [**listTagsForNode**](TagsApi.md#listTagsForNode) | **GET** /nodes/{nodeId}/tags | List tags for a node [**updateTag**](TagsApi.md#updateTag) | **PUT** /tags/{tagId} | Update a tag +[**deleteTag**](TagsApi.md#deleteTag) | **DELETE** /tags/{tagId} | Completely deletes a tag [**createTags**](TagsApi.md#createTags) | **POST** /tags | Create list of tags @@ -484,3 +485,39 @@ Name | Type | Description | Notes [**TagEntry[]**](TagEntry.md) + +## deleteTag +> deleteTag(tagId) + +Deletes the tag with **tagId**. This will cause the tag to be removed from all nodes. + +You must have admin rights to delete a tag. + +### Example + +```javascript +import { AlfrescoApi, TagsApi} from '@alfresco/js-api'; + +const alfrescoApi = new AlfrescoApi({ + hostEcm: 'http://127.0.0.1:8080' +}); + +const tagsApi = new TagsApi(alfrescoApi); + + +tagsApi.deleteTag(tagId).then(() => { + console.log('API called successfully.'); +}, function(error) { + console.error(error); +}); +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- +**tagId** | **string**| The identifier of a tag. | + +### Return type + +null (empty response body)