Skip to content
This repository was archived by the owner on Jun 11, 2025. It is now read-only.

Commit 86fec25

Browse files
[ACS-4118] create a tag from tags list
[ACS-4118] create a tag from tags list
2 parents 11252d0 + 3d8e285 commit 86fec25

File tree

3 files changed

+64
-8
lines changed

3 files changed

+64
-8
lines changed

src/api/content-rest-api/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,7 @@ TagsApi | [**getTag**](docs/TagsApi.md#getTag) | **GET** /tags/{tagId} | Get a t
136136
TagsApi | [**listTags**](docs/TagsApi.md#listTags) | **GET** /tags | List tags
137137
TagsApi | [**listTagsForNode**](docs/TagsApi.md#listTagsForNode) | **GET** /nodes/{nodeId}/tags | List tags for a node
138138
TagsApi | [**updateTag**](docs/TagsApi.md#updateTag) | **PUT** /tags/{tagId} | Update a tag
139+
TagsApi | [**createTags**](docs/TagsApi.md#createTags) | **POST** /tags/ | Create specified by **tags** list of tags.
139140
TrashcanApi | [**deleteDeletedNode**](docs/TrashcanApi.md#deleteDeletedNode) | **DELETE** /deleted-nodes/{nodeId} | Permanently delete a deleted node
140141
TrashcanApi | [**getArchivedNodeRendition**](docs/TrashcanApi.md#getArchivedNodeRendition) | **GET** /deleted-nodes/{nodeId}/renditions/{renditionId} | Get rendition information for a deleted node
141142
TrashcanApi | [**getArchivedNodeRenditionContent**](docs/TrashcanApi.md#getArchivedNodeRenditionContent) | **GET** /deleted-nodes/{nodeId}/renditions/{renditionId}/content | Get rendition content of a deleted node

src/api/content-rest-api/api/tags.api.ts

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -228,6 +228,7 @@ If not supplied then the default value is 0.
228228
If not supplied then the default value is 100.
229229
(default to 100)
230230
* @param opts.fields A list of field names.
231+
* @param opts.name Name for which tag is returned.
231232
232233
You can use this parameter to restrict the fields
233234
returned within a response if, for example, you want to save on overall bandwidth.
@@ -257,7 +258,8 @@ parameter are returned in addition to those specified in the **fields** paramete
257258
'skipCount': opts['skipCount'],
258259
'maxItems': opts['maxItems'],
259260
'fields': buildCollectionParam(opts['fields'], 'csv'),
260-
'include': buildCollectionParam(opts['include'], 'csv')
261+
'include': buildCollectionParam(opts['include'], 'csv'),
262+
where: opts?.name ? `(name='${opts.name}')` : undefined
261263
};
262264

263265
const headerParams = {
@@ -385,4 +387,20 @@ parameter are returned in addition to those specified in the **fields** paramete
385387
contentTypes, accepts , TagEntry);
386388
}
387389

390+
/**
391+
* Create tags
392+
*
393+
* Create specified by **tags** list of tags.
394+
*
395+
* @param tags List of tags to create.
396+
*
397+
* @return Promise<TagEntry[]>
398+
*/
399+
createTags(tags: TagBody[]): Promise<TagEntry[]> {
400+
throwIfNotDefined(tags, 'tags');
401+
return this.apiClient.callApi(
402+
'/tags', 'POST',
403+
{}, {}, {}, {}, tags,
404+
['application/json'], ['application/json']);
405+
}
388406
}

src/api/content-rest-api/docs/TagsApi.md

Lines changed: 44 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,15 @@
22

33
All URIs are relative to *https://localhost/alfresco/api/-default-/public/alfresco/versions/1*
44

5-
Method | HTTP request | Description
6-
------------- | ------------- | -------------
7-
[**createTagForNode**](TagsApi.md#createTagForNode) | **POST** /nodes/{nodeId}/tags | Create a tag for a node
5+
Method | HTTP request | Description
6+
------------- |--------------------------------------| -------------
7+
[**createTagForNode**](TagsApi.md#createTagForNode) | **POST** /nodes/{nodeId}/tags | Create a tag for a node
88
[**deleteTagFromNode**](TagsApi.md#deleteTagFromNode) | **DELETE** /nodes/{nodeId}/tags/{tagId} | Delete a tag from a node
9-
[**getTag**](TagsApi.md#getTag) | **GET** /tags/{tagId} | Get a tag
10-
[**listTags**](TagsApi.md#listTags) | **GET** /tags | List tags
11-
[**listTagsForNode**](TagsApi.md#listTagsForNode) | **GET** /nodes/{nodeId}/tags | List tags for a node
12-
[**updateTag**](TagsApi.md#updateTag) | **PUT** /tags/{tagId} | Update a tag
9+
[**getTag**](TagsApi.md#getTag) | **GET** /tags/{tagId} | Get a tag
10+
[**listTags**](TagsApi.md#listTags) | **GET** /tags | List tags
11+
[**listTagsForNode**](TagsApi.md#listTagsForNode) | **GET** /nodes/{nodeId}/tags | List tags for a node
12+
[**updateTag**](TagsApi.md#updateTag) | **PUT** /tags/{tagId} | Update a tag
13+
[**createTags**](TagsApi.md#createTags) | **POST** /tags | Create list of tags
1314

1415

1516
<a name="createTagForNode"></a>
@@ -234,6 +235,7 @@ List tags
234235
Gets a list of tags in this repository.
235236

236237
You can use the **include** parameter to return additional **values** information.
238+
You can also use **name** parameter to return tags only for specified name.
237239

238240

239241
### Example
@@ -447,3 +449,38 @@ parameter are returned in addition to those specified in the **fields** paramete
447449

448450
[**TagEntry**](TagEntry.md)
449451

452+
<a name="createTags"></a>
453+
## createTags
454+
> TagEntry[] createTags(tags: TagBody[])
455+
456+
Create specified by **tags** list of tags.
457+
458+
### Example
459+
460+
```javascript
461+
import { AlfrescoApi, TagsApi} from '@alfresco/js-api';
462+
463+
const alfrescoApi = new AlfrescoApi({
464+
hostEcm: 'http://127.0.0.1:8080'
465+
});
466+
467+
const tagsApi = new TagsApi(alfrescoApi);
468+
469+
tagsApi.createTags(tags).then((data) => {
470+
console.log('API called successfully. Returned data: ' + data);
471+
}, function(error) {
472+
console.error(error);
473+
});
474+
```
475+
476+
### Parameters
477+
478+
Name | Type | Description | Notes
479+
------------- |-----------------------------|-------------------------| -------------
480+
**tags** | [**TagBody[]**](TagBody.md) | List of tags to create. |
481+
482+
483+
### Return type
484+
485+
[**TagEntry[]**](TagEntry.md)
486+

0 commit comments

Comments
 (0)