Skip to content
This repository has been archived by the owner on Feb 8, 2024. It is now read-only.

Commit

Permalink
[ADF-2563] Update node content (#331)
Browse files Browse the repository at this point in the history
* Update node content

* change log update
  • Loading branch information
eromano committed May 17, 2018
1 parent 31a7fc6 commit d25b881
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 10 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
# [2.4.0](https://github.com/Alfresco/alfresco-js-api/releases/tag/2.4.0) (??-??-2018)

## Features
[Update Content in UplaodAPI](https://issues.alfresco.com/jira/browse/ADF-2563)

## Fixes

Expand Down
7 changes: 4 additions & 3 deletions index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -507,7 +507,7 @@ declare namespace AlfrescoApi {
export interface NodesApi {
new(client: ApiClient): NodesApi;

addNode(nodeId: string, nodeBody: any, opts?: { autoRename?: boolean, include?: Array<string>, fields?: Array<string> }): Promise<NodeEntry>;
addNode(nodeId: string, nodeBody: any, opts?: { autoRename?: boolean, include?: Array<string>, fields?: Array<string> }, formParams?: any): Promise<NodeEntry>;

copyNode(nodeId: string, copyBody: any, opts?: { include?: Array<string>, fields?: Array<string> }): Promise<NodeEntry>;

Expand Down Expand Up @@ -557,7 +557,7 @@ declare namespace AlfrescoApi {

updateFileContent(nodeId?: string, contentBody?: string, opts?: { majorVersion?: boolean, comment?: string, include?: Array<string>, fields?: Array<string> }): Promise<NodeEntry>;

updateNodeContent(nodeId?: string, contentBody?: string, opts?: any): Promise<NodeEntry>;
updateNodeContent(nodeId?: string, contentBody?: string, opts?: any, formParams: string): Promise<NodeEntry>;

updateNode(nodeId?: string, nodeBody?: NodeBody, opts?: { include?: Array<string>, fields?: Array<string> }): Promise<NodeEntry>;
}
Expand Down Expand Up @@ -5270,7 +5270,8 @@ declare namespace AlfrescoApi {
export interface UploadApi {
new(config: AlfrescoApiConfig): UploadApi;

uploadFile(fileDefinition?: any, relativePath?: any, nodeId?: any, nodeBody?: any, opts?: any): any;
uploadFile(fileDefinition?: any, relativePath?: any, rootFolderId?: string, nodeBody?: any, opts?: any): any;
updateFile(fileDefinition?: any, relativePath?: any, nodeId?: string, nodeBody?: any, opts?: any): any;

addNodeUpload(nodeId?: any, nodeBody?: any, opts?: any, formParams?: any): any;
}
Expand Down
8 changes: 5 additions & 3 deletions src/alfresco-core-rest-api/src/api/NodesApi.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,10 @@
* @param {Boolean} opts.autoRename If true, then a name clash will cause an attempt to auto rename by finding a unique name using an integer suffix.
* @param {string[]} opts.include Returns additional information about the node. The following optional fields can be requested:\n* path\n* isLink\n* allowableOperations\n
* @param {string[]} opts.fields A list of field names.\n\nYou can use this parameter to restrict the fields\nreturned within a response if, for example, you want to save on overall bandwidth.\n\nThe list applies to a returned individual\nentity or entries within a collection.\n\nIf the API method also supports the **include**\nparameter, then the fields specified in the **include**\nparameter are returned in addition to those specified in the **fields** parameter.\n
* @param {Object.<String, Object>} formParams A map of form parameters and their values.
* data is of type: {module:model/NodeEntry}
*/
this.addNode = function(nodeId, nodeBody, opts) {
this.addNode = function(nodeId, nodeBody, opts, formParams) {
opts = opts || {};
var postBody = nodeBody;

Expand All @@ -70,8 +71,7 @@
};
var headerParams = {
};
var formParams = {
};
formParams = formParams || {};

var authNames = ['basicAuth'];
var contentTypes = ['application/json', 'multipart/form-data'];
Expand Down Expand Up @@ -888,6 +888,7 @@
'nodeId': nodeId
};
var queryParams = {
'name': opts['name'],
'majorVersion': opts['majorVersion'],
'comment': opts['comment'],
'include': this.apiClient.buildCollectionParam(opts['include'], 'csv'),
Expand Down Expand Up @@ -931,6 +932,7 @@
var queryParams = {
'majorVersion': opts['majorVersion'],
'comment': opts['comment'],
'name': opts['name'],
'include': this.apiClient.buildCollectionParam(opts['include'], 'csv'),
'fields': this.apiClient.buildCollectionParam(opts['fields'], 'csv')
};
Expand Down
15 changes: 11 additions & 4 deletions src/alfrescoUpload.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ class AlfrescoUpload extends AlfrescoCoreRestApi.NodesApi {
Emitter.call(this);
}

uploadFile(fileDefinition, relativePath, nodeId, nodeBody, opts) {
nodeId = nodeId || '-root-';
uploadFile(fileDefinition, relativePath, rootFolderId, nodeBody, opts) {
rootFolderId = rootFolderId || '-root-';
opts = opts || {};

var nodeBodyRequired = {
Expand All @@ -31,17 +31,24 @@ class AlfrescoUpload extends AlfrescoCoreRestApi.NodesApi {

formParam = Object.assign(formParam, opts);

return this.addNodeUpload(nodeId, nodeBody, opts, formParam);
return this.addNodeUpload(rootFolderId, nodeBody, opts, formParam);
}

updateFile(fileDefinition, relativePath, nodeId, nodeBody, opts) {
opts = opts || {};

return this.updateNodeContent(nodeId, nodeBody, opts);
}

/**
* Create a node
*
* @param {String} nodeId The identifier of a node. You can also use one of these well-known aliases: -my-\ -shared- -root-\n
* @param {String} rootFolderId The identifier of a node. You can also use one of these well-known aliases: -my-\ -shared- -root-\n
* @param {module:model/NodeBody1} nodeBody The node information to create.
* @param {Object} opts Optional parameters
* @param {Object.<String, Object>} formParams A map of form parameters and their values.
*/
//@deprecated in 2.4.0 use addNode in NodesApi
addNodeUpload(nodeId, nodeBody, opts, formParams) {
opts = opts || {};
var postBody = nodeBody;
Expand Down

0 comments on commit d25b881

Please sign in to comment.