parent
768b012e8b
commit
a08c50a77d
|
@ -61,7 +61,7 @@ Portal submits content into new blog post
|
||||||
## Usage
|
## Usage
|
||||||
|
|
||||||
### API version
|
### API version
|
||||||
The latest version is `1.2.10`
|
The latest version is `1.2.11`
|
||||||
|
|
||||||
The current version can be queried via /api.
|
The current version can be queried via /api.
|
||||||
|
|
||||||
|
@ -402,6 +402,24 @@ returns the number of revisions of this pad
|
||||||
* `{code: 0, message:"ok", data: {revisions: 56}}`
|
* `{code: 0, message:"ok", data: {revisions: 56}}`
|
||||||
* `{code: 1, message:"padID does not exist", data: null}`
|
* `{code: 1, message:"padID does not exist", data: null}`
|
||||||
|
|
||||||
|
#### getSavedRevisionsCount(padID)
|
||||||
|
* API >= 1.2.11
|
||||||
|
|
||||||
|
returns the number of saved revisions of this pad
|
||||||
|
|
||||||
|
*Example returns:*
|
||||||
|
* `{code: 0, message:"ok", data: {savedRevisions: 42}}`
|
||||||
|
* `{code: 1, message:"padID does not exist", data: null}`
|
||||||
|
|
||||||
|
#### listSavedRevisions(padID)
|
||||||
|
* API >= 1.2.11
|
||||||
|
|
||||||
|
returns the list of saved revisions of this pad
|
||||||
|
|
||||||
|
*Example returns:*
|
||||||
|
* `{code: 0, message:"ok", data: {savedRevisions: [2, 42, 1337]}}`
|
||||||
|
* `{code: 1, message:"padID does not exist", data: null}`
|
||||||
|
|
||||||
#### padUsersCount(padID)
|
#### padUsersCount(padID)
|
||||||
* API >= 1
|
* API >= 1
|
||||||
|
|
||||||
|
|
|
@ -517,6 +517,44 @@ exports.getRevisionsCount = function(padID, callback)
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
getSavedRevisionsCount(padID) returns the number of saved revisions of this pad
|
||||||
|
|
||||||
|
Example returns:
|
||||||
|
|
||||||
|
{code: 0, message:"ok", data: {savedRevisions: 42}}
|
||||||
|
{code: 1, message:"padID does not exist", data: null}
|
||||||
|
*/
|
||||||
|
exports.getSavedRevisionsCount = function(padID, callback)
|
||||||
|
{
|
||||||
|
//get the pad
|
||||||
|
getPadSafe(padID, true, function(err, pad)
|
||||||
|
{
|
||||||
|
if(ERR(err, callback)) return;
|
||||||
|
|
||||||
|
callback(null, {savedRevisions: pad.getSavedRevisionsNumber()});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
listSavedRevisions(padID) returns the list of saved revisions of this pad
|
||||||
|
|
||||||
|
Example returns:
|
||||||
|
|
||||||
|
{code: 0, message:"ok", data: {savedRevisions: [2, 42, 1337]}}
|
||||||
|
{code: 1, message:"padID does not exist", data: null}
|
||||||
|
*/
|
||||||
|
exports.listSavedRevisions = function(padID, callback)
|
||||||
|
{
|
||||||
|
//get the pad
|
||||||
|
getPadSafe(padID, true, function(err, pad)
|
||||||
|
{
|
||||||
|
if(ERR(err, callback)) return;
|
||||||
|
|
||||||
|
callback(null, {savedRevisions: pad.getSavedRevisionsList()});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
getLastEdited(padID) returns the timestamp of the last revision of the pad
|
getLastEdited(padID) returns the timestamp of the last revision of the pad
|
||||||
|
|
||||||
|
|
|
@ -54,6 +54,18 @@ Pad.prototype.getHeadRevisionNumber = function getHeadRevisionNumber() {
|
||||||
return this.head;
|
return this.head;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Pad.prototype.getSavedRevisionsNumber = function getSavedRevisionsNumber() {
|
||||||
|
return this.savedRevisions.length;
|
||||||
|
};
|
||||||
|
|
||||||
|
Pad.prototype.getSavedRevisionsList = function getSavedRevisionsList() {
|
||||||
|
var savedRev = new Array();
|
||||||
|
for(var rev in this.savedRevisions){
|
||||||
|
savedRev.push(this.savedRevisions[rev].revNum);
|
||||||
|
}
|
||||||
|
return savedRev;
|
||||||
|
};
|
||||||
|
|
||||||
Pad.prototype.getPublicStatus = function getPublicStatus() {
|
Pad.prototype.getPublicStatus = function getPublicStatus() {
|
||||||
return this.publicStatus;
|
return this.publicStatus;
|
||||||
};
|
};
|
||||||
|
|
|
@ -368,6 +368,8 @@ var version =
|
||||||
, "setHTML" : ["padID", "html"]
|
, "setHTML" : ["padID", "html"]
|
||||||
, "getAttributePool" : ["padID"]
|
, "getAttributePool" : ["padID"]
|
||||||
, "getRevisionsCount" : ["padID"]
|
, "getRevisionsCount" : ["padID"]
|
||||||
|
, "getSavedRevisionsCount" : ["padID"]
|
||||||
|
, "listSavedRevisions" : ["padID"]
|
||||||
, "getRevisionChangeset" : ["padID", "rev"]
|
, "getRevisionChangeset" : ["padID", "rev"]
|
||||||
, "getLastEdited" : ["padID"]
|
, "getLastEdited" : ["padID"]
|
||||||
, "deletePad" : ["padID"]
|
, "deletePad" : ["padID"]
|
||||||
|
|
Loading…
Reference in New Issue