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

Commit e692367

Browse files
ACS-4118 Use callApi and write some documentation for tags creation
1 parent cfd2b60 commit e692367

File tree

2 files changed

+57
-13
lines changed

2 files changed

+57
-13
lines changed

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

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -385,12 +385,20 @@ parameter are returned in addition to those specified in the **fields** paramete
385385
contentTypes, accepts , TagEntry);
386386
}
387387

388+
/**
389+
* Create tags
390+
*
391+
* Create specified by **tags** list of tags.
392+
*
393+
* @param tags List of tags to create.
394+
*
395+
* @return Promise<TagEntry[]>
396+
*/
388397
createTags(tags: TagBody[]): Promise<TagEntry[]> {
389-
return this.apiClient.post({
390-
path: '/tags',
391-
bodyParam: tags,
392-
contentTypes: ['application/json'],
393-
accepts: ['application/json']
394-
});
398+
throwIfNotDefined(tags, 'tags');
399+
return this.apiClient.callApi(
400+
'/tags', 'POST',
401+
{}, {}, {}, {}, tags,
402+
['application/json'], ['application/json']);
395403
}
396404
}

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

Lines changed: 43 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>
@@ -447,3 +448,38 @@ parameter are returned in addition to those specified in the **fields** paramete
447448

448449
[**TagEntry**](TagEntry.md)
449450

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

0 commit comments

Comments
 (0)