Denys Vuika ea2c0ce229
[PRODENG-211] integrate JS-API with monorepo (part 1) (#9081)
* integrate JS-API with monorepo

* [ci:force] fix token issue

[ci:force] migrate docs folder

[ci:force] clean personal tokens

* [ci:force] gha workflow support

* [ci:force] npm publish target

* fix js-api test linting

* [ci:force] fix test linting, mocks, https scheme

* [ci:force] fix https scheme

* [ci:force] typescript mappings

* [ci:force] update scripts

* lint fixes

* linting fixes

* fix linting

* [ci:force] linting fixes

* linting fixes

* [ci:force] remove js-api upstream and corresponding scripts

* [ci:force] jsdoc fixes

* fix jsdoc linting

* [ci:force] jsdoc fixes

* [ci:force] jsdoc fixes

* jsdoc fixes

* jsdoc fixes

* jsdoc fixes

* [ci:force] fix jsdoc

* [ci:force] reduce code duplication

* replace 'chai' expect with node.js assert

* replace 'chai' expect with node.js assert

* [ci:force] remove chai and chai-spies for js-api testing

* [ci:force] cleanup and fix imports

* [ci:force] fix linting

* [ci:force] fix unit test

* [ci:force] fix sonar linting findings

* [ci:force] switch activiti api models to interfaces (-2.5% reduction of bundle)

* [ci:force] switch activiti api models to interfaces

* [ci:force] switch AGS api models to interfaces

* [ci:force] switch AGS api models to interfaces

* [ci:force] switch search api models to interfaces

* [ci:force] switch content api models to interfaces where applicable
2023-11-21 05:27:51 -05:00

15 KiB

ContentApi

All URIs are relative to /activiti-app/api

Method HTTP request Description
createRelatedContentOnProcessInstance POST /enterprise/process-instances/{processInstanceId}/content Attach existing content to a process instance
createRelatedContentOnProcessInstance POST /enterprise/process-instances/{processInstanceId}/raw-content Upload content and attach to a process instance
createRelatedContentOnTask POST /enterprise/tasks/{taskId}/content Attach existing content to a task
createRelatedContentOnTask POST /enterprise/tasks/{taskId}/raw-content Upload content and attach to a task
createTemporaryRawRelatedContent POST /enterprise/content/raw Upload content and create a local representation
createTemporaryRelatedContent POST /enterprise/content Create a local representation of content from a remote repository
deleteContent DELETE /enterprise/content/{contentId} Remove a local content representation
getContent GET /enterprise/content/{contentId} Get a local content representation
getRawContent GET /enterprise/content/{contentId}/rendition/{renditionType} Stream content rendition
getRawContent GET /enterprise/content/{contentId}/raw Stream content from a local content representation
getRelatedContentForProcessInstance GET /enterprise/process-instances/{processInstanceId}/content List content attached to a process instance
getRelatedContentForTask GET /enterprise/tasks/{taskId}/content List content attached to a task
getProcessesAndTasksOnContent GET enterprise/content/document-runtime Lists processes and tasks on workflow started with provided document

createRelatedContentOnProcessInstance

RelatedContentRepresentation createRelatedContentOnProcessInstance(processInstanceIdrelatedContentopts)

Attach existing content to a process instance

Example

import ContentApi from 'ContentApi';
import { AlfrescoApi } from '@alfresco/js-api';

this.alfrescoApi = new AlfrescoApi();
this.alfrescoApi.setConfig({
    hostEcm: 'http://127.0.0.1:8080'
});

let contentApi = new ContentApi(this.alfrescoApi);

let opts = { 
  'isRelatedContent': true //  | isRelatedContent
};

contentApi.createRelatedContentOnProcessInstance(processInstanceIdrelatedContentopts).then((data) => {
  console.log('API called successfully. Returned data: ' + data);
}, function(error) {
  console.error(error);
});

Parameters

Name Type Description Notes
processInstanceId string processInstanceId
relatedContent RelatedContentRepresentation relatedContent
isRelatedContent boolean isRelatedContent [optional]

Return type

RelatedContentRepresentation

createRelatedContentOnProcessInstance

RelatedContentRepresentation createRelatedContentOnProcessInstance(processInstanceIdfileopts)

Upload content and attach to a process instance

Example

import ContentApi from 'ContentApi';
import { AlfrescoApi } from '@alfresco/js-api';

this.alfrescoApi = new AlfrescoApi();
this.alfrescoApi.setConfig({
    hostEcm: 'http://127.0.0.1:8080'
});

let contentApi = new ContentApi(this.alfrescoApi);

let opts = { 
  'isRelatedContent': true //  | isRelatedContent
};

contentApi.createRelatedContentOnProcessInstance(processInstanceIdfileopts).then((data) => {
  console.log('API called successfully. Returned data: ' + data);
}, function(error) {
  console.error(error);
});

Parameters

Name Type Description Notes
processInstanceId string processInstanceId
file Blob file
isRelatedContent boolean isRelatedContent [optional]

Return type

RelatedContentRepresentation

createRelatedContentOnTask

RelatedContentRepresentation createRelatedContentOnTask(taskIdrelatedContentopts)

Attach existing content to a task

Example

import ContentApi from 'ContentApi';
import { AlfrescoApi } from '@alfresco/js-api';

this.alfrescoApi = new AlfrescoApi();
this.alfrescoApi.setConfig({
    hostEcm: 'http://127.0.0.1:8080'
});

let contentApi = new ContentApi(this.alfrescoApi);

let opts = { 
  'isRelatedContent': true //  | isRelatedContent
};

contentApi.createRelatedContentOnTask(taskIdrelatedContentopts).then((data) => {
  console.log('API called successfully. Returned data: ' + data);
}, function(error) {
  console.error(error);
});

Parameters

Name Type Description Notes
taskId string taskId
relatedContent RelatedContentRepresentation relatedContent
isRelatedContent boolean isRelatedContent [optional]

Return type

RelatedContentRepresentation

createRelatedContentOnTask

RelatedContentRepresentation createRelatedContentOnTask(taskIdfileopts)

Upload content and attach to a task

Example

import ContentApi from 'ContentApi';
import { AlfrescoApi } from '@alfresco/js-api';

this.alfrescoApi = new AlfrescoApi();
this.alfrescoApi.setConfig({
    hostEcm: 'http://127.0.0.1:8080'
});

let contentApi = new ContentApi(this.alfrescoApi);

let opts = { 
  'isRelatedContent': true //  | isRelatedContent
};

contentApi.createRelatedContentOnTask(taskIdfileopts).then((data) => {
  console.log('API called successfully. Returned data: ' + data);
}, function(error) {
  console.error(error);
});

Parameters

Name Type Description Notes
taskId string taskId
file Blob file
isRelatedContent boolean isRelatedContent [optional]

Return type

RelatedContentRepresentation

createTemporaryRawRelatedContent

RelatedContentRepresentation createTemporaryRawRelatedContent(file)

Upload content and create a local representation

Example

import ContentApi from 'ContentApi';
import { AlfrescoApi } from '@alfresco/js-api';

this.alfrescoApi = new AlfrescoApi();
this.alfrescoApi.setConfig({
    hostEcm: 'http://127.0.0.1:8080'
});

let contentApi = new ContentApi(this.alfrescoApi);


contentApi.createTemporaryRawRelatedContent(file).then((data) => {
  console.log('API called successfully. Returned data: ' + data);
}, function(error) {
  console.error(error);
});

Parameters

Name Type Description Notes
file Blob file

Return type

RelatedContentRepresentation

createTemporaryRelatedContent

RelatedContentRepresentation createTemporaryRelatedContent(relatedContent)

Create a local representation of content from a remote repository

Example

import ContentApi from 'ContentApi';
import { AlfrescoApi } from '@alfresco/js-api';

this.alfrescoApi = new AlfrescoApi();
this.alfrescoApi.setConfig({
    hostEcm: 'http://127.0.0.1:8080'
});

let contentApi = new ContentApi(this.alfrescoApi);


contentApi.createTemporaryRelatedContent(relatedContent).then((data) => {
  console.log('API called successfully. Returned data: ' + data);
}, function(error) {
  console.error(error);
});

Parameters

Name Type Description Notes
relatedContent RelatedContentRepresentation relatedContent

Return type

RelatedContentRepresentation

deleteContent

deleteContent(contentId)

Remove a local content representation

Example

import ContentApi from 'ContentApi';
import { AlfrescoApi } from '@alfresco/js-api';

this.alfrescoApi = new AlfrescoApi();
this.alfrescoApi.setConfig({
    hostEcm: 'http://127.0.0.1:8080'
});

let contentApi = new ContentApi(this.alfrescoApi);


contentApi.deleteContent(contentId).then(() => {
  console.log('API called successfully.');
}, function(error) {
  console.error(error);
});

Parameters

Name Type Description Notes
contentId number contentId

Return type

null (empty response body)

getContent

RelatedContentRepresentation getContent(contentId)

Get a local content representation

Example

import ContentApi from 'ContentApi';
import { AlfrescoApi } from '@alfresco/js-api';

this.alfrescoApi = new AlfrescoApi();
this.alfrescoApi.setConfig({
    hostEcm: 'http://127.0.0.1:8080'
});

let contentApi = new ContentApi(this.alfrescoApi);


contentApi.getContent(contentId).then((data) => {
  console.log('API called successfully. Returned data: ' + data);
}, function(error) {
  console.error(error);
});

Parameters

Name Type Description Notes
contentId number contentId

Return type

RelatedContentRepresentation

getRawContent

getRawContent(contentIdrenditionType)

Stream content rendition

Example

import ContentApi from 'ContentApi';
import { AlfrescoApi } from '@alfresco/js-api';

this.alfrescoApi = new AlfrescoApi();
this.alfrescoApi.setConfig({
    hostEcm: 'http://127.0.0.1:8080'
});

let contentApi = new ContentApi(this.alfrescoApi);


contentApi.getRawContent(contentIdrenditionType).then(() => {
  console.log('API called successfully.');
}, function(error) {
  console.error(error);
});

Parameters

Name Type Description Notes
contentId number contentId
renditionType string renditionType

Return type

null (empty response body)

getRawContent

getRawContent(contentId)

Stream content from a local content representation

Example

import ContentApi from 'ContentApi';
import { AlfrescoApi } from '@alfresco/js-api';

this.alfrescoApi = new AlfrescoApi();
this.alfrescoApi.setConfig({
    hostEcm: 'http://127.0.0.1:8080'
});

let contentApi = new ContentApi(this.alfrescoApi);


contentApi.getRawContent(contentId).then(() => {
  console.log('API called successfully.');
}, function(error) {
  console.error(error);
});

Parameters

Name Type Description Notes
contentId number contentId

Return type

null (empty response body)

getRelatedContentForProcessInstance

ResultListDataRepresentationRelatedContentRepresentation getRelatedContentForProcessInstance(processInstanceIdopts)

List content attached to a process instance

Example

import ContentApi from 'ContentApi';
import { AlfrescoApi } from '@alfresco/js-api';

this.alfrescoApi = new AlfrescoApi();
this.alfrescoApi.setConfig({
    hostEcm: 'http://127.0.0.1:8080'
});

let contentApi = new ContentApi(this.alfrescoApi);

let opts = { 
  'isRelatedContent': true //  | isRelatedContent
};

contentApi.getRelatedContentForProcessInstance(processInstanceIdopts).then((data) => {
  console.log('API called successfully. Returned data: ' + data);
}, function(error) {
  console.error(error);
});

Parameters

Name Type Description Notes
processInstanceId string processInstanceId
isRelatedContent boolean isRelatedContent [optional]

Return type

ResultListDataRepresentationRelatedContentRepresentation

getRelatedContentForTask

ResultListDataRepresentationRelatedContentRepresentation getRelatedContentForTask(taskIdopts)

List content attached to a task

Example

import ContentApi from 'ContentApi';
import { AlfrescoApi } from '@alfresco/js-api';

this.alfrescoApi = new AlfrescoApi();
this.alfrescoApi.setConfig({
    hostEcm: 'http://127.0.0.1:8080'
});

let contentApi = new ContentApi(this.alfrescoApi);

let opts = { 
  'isRelatedContent': true //  | isRelatedContent
};

contentApi.getRelatedContentForTask(taskIdopts).then((data) => {
  console.log('API called successfully. Returned data: ' + data);
}, function(error) {
  console.error(error);
});

Parameters

Name Type Description Notes
taskId string taskId
isRelatedContent boolean isRelatedContent [optional]

Return type

ResultListDataRepresentationRelatedContentRepresentation

getProcessesAndTasksOnContent

ResultListDataRepresentationRelatedProcessTask getProcessesAndTasksOnContent(sourceId, source, size, page)

Lists processes and tasks on workflow started with provided document

Example

import ContentApi from 'ContentApi';
import { AlfrescoApi } from '@alfresco/js-api';

const alfrescoApi = new AlfrescoApi();
alfrescoApi.setConfig({
    hostEcm: 'http://127.0.0.1:8080'
});

const contentApi = new ContentApi(alfrescoApi);

contentApi.getProcessesAndTasksOnContent('sourceId', 'source').then((data) => {
  console.log('API called successfully. Returned data: ' + data);
}, function(error) {
  console.error(error);
});

Parameters

Name Type Description Notes
sourceId string id of the document that workflow or task was started with
source string source of the document that workflow or task was started with
sourceId number size of the entries to get optional param
sourceId number page number optional param

Return type

ResultListDataRepresentationRelatedProcessTask