Skip to content

Commit

Permalink
Implementation of Aspose.Tasks Missing Features
Browse files Browse the repository at this point in the history
Add a Task Link to Project
Add Calendar to Project
  • Loading branch information
assadvirgo committed Apr 13, 2015
1 parent a2e5b7b commit 667a6e3
Show file tree
Hide file tree
Showing 2 changed files with 61 additions and 13 deletions.
72 changes: 60 additions & 12 deletions lib/aspose-tasks.js
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,34 @@ AsposeTasks.prototype.getCalendars = function(fileName,callback){
});
};

AsposeTasks.prototype.addCalendar = function(fileName,calendar,callback){

fileName = typeof fileName !== 'undefined' ? fileName : '';
calendar = typeof calendar !== 'undefined' ? calendar : '';

if(fileName === '' || calendar === ''){
throw new Error('missing required arguments.');
}

if(typeof calendar === 'object')
{
calendar = JSON.stringify(calendar);
}

var strURI = this.baseURI + 'tasks/' + fileName + '/calendars';
var signedURI = Utils.Sign(strURI,this.appSID,this.appKey);

Utils.ProcessCommand('POST',signedURI,calendar,function(data){
if(typeof callback === 'function'){
if(data.Status == 'Created'){
callback.call(null,data.CalendarItem);
} else {
throw new Error(data);
}
}
});
};

AsposeTasks.prototype.getCalendar = function(fileName, calId, callback){

fileName = typeof fileName !== 'undefined' ? fileName : '';
Expand Down Expand Up @@ -463,6 +491,34 @@ AsposeTasks.prototype.getLinks = function(fileName,callback){
});
};

AsposeTasks.prototype.addLink = function(fileName,taskData,callback){

fileName = typeof fileName !== 'undefined' ? fileName : '';
taskData = typeof taskData !== 'undefined' ? taskData : '';

if(fileName === '' || taskData === ''){
throw new Error('missing required arguments.');
}

if(typeof taskData === 'object')
{
taskData = JSON.stringify(taskData);
}

var strURI = this.baseURI + 'tasks/' + fileName + '/taskLinks';
var signedURI = Utils.Sign(strURI,this.appSID,this.appKey);

Utils.ProcessCommand('POST',signedURI,taskData,function(data){
if(typeof callback === 'function'){
if(data.Status === 'OK'){
callback.call(null,data);
} else {
throw new Error(data.Message);
}
}
});
};

AsposeTasks.prototype.deleteLink = function(fileName, linkIndex, callback){

fileName = typeof fileName !== 'undefined' ? fileName : '';
Expand Down Expand Up @@ -581,12 +637,8 @@ AsposeTasks.prototype.getExtendedAttribute = function(fileName, attrIndex, callb

fileName = typeof fileName !== 'undefined' ? fileName : '';

if(fileName === ''){
throw new Error('Filename not defined.');
}

if(attrIndex === ''){
throw new Error('attrIndex not defined.');
if(fileName === '' || attrIndex === ''){
throw new Error('missing required attributes.');
}

var strURI = this.baseURI + 'tasks/' + fileName + '/extendedAttributes/' + attrIndex;
Expand All @@ -607,12 +659,8 @@ AsposeTasks.prototype.deleteExtendedAttribute = function(fileName, attrIndex, ca

fileName = typeof fileName !== 'undefined' ? fileName : '';

if(fileName === ''){
throw new Error('Filename not defined.');
}

if(attrIndex === ''){
throw new Error('attrIndex not defined.');
if(fileName === '' || attrIndex === ''){
throw new Error('missing required parameters.');
}

var strURI = this.baseURI + 'tasks/' + fileName + '/extendedAttributes/' + attrIndex;
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "asposecloud",
"version": "1.2.0",
"version": "1.3.0",
"description": "Aspose Cloud SDK for NodeJS",
"main": "lib/aspose-cloud.js",
"scripts": {
Expand Down

0 comments on commit 667a6e3

Please sign in to comment.