mirror of
https://github.com/ether/etherpad-lite.git
synced 2025-05-15 11:36:53 -04:00
A nicer way to handle the API versions
Instead of manually copy/pasting the API version functions every time we version bump, we should reuse the content of a previous API version.
This commit is contained in:
parent
f238ba2f26
commit
bf29feb321
1 changed files with 35 additions and 147 deletions
|
@ -38,8 +38,7 @@ catch(e)
|
||||||
}
|
}
|
||||||
|
|
||||||
//a list of all functions
|
//a list of all functions
|
||||||
var version =
|
var API_V1 =
|
||||||
{ "1":
|
|
||||||
{ "createGroup" : []
|
{ "createGroup" : []
|
||||||
, "createGroupIfNotExistsFor" : ["groupMapper"]
|
, "createGroupIfNotExistsFor" : ["groupMapper"]
|
||||||
, "deleteGroup" : ["groupID"]
|
, "deleteGroup" : ["groupID"]
|
||||||
|
@ -67,154 +66,43 @@ var version =
|
||||||
, "setPassword" : ["padID", "password"]
|
, "setPassword" : ["padID", "password"]
|
||||||
, "isPasswordProtected" : ["padID"]
|
, "isPasswordProtected" : ["padID"]
|
||||||
, "listAuthorsOfPad" : ["padID"]
|
, "listAuthorsOfPad" : ["padID"]
|
||||||
, "padUsersCount" : ["padID"]
|
, "padUsersCount" : ["padID"] };
|
||||||
}
|
|
||||||
, "1.1":
|
var API_V1_1 =
|
||||||
{ "createGroup" : []
|
{ "getAuthorName" : ["authorID"]
|
||||||
, "createGroupIfNotExistsFor" : ["groupMapper"]
|
|
||||||
, "deleteGroup" : ["groupID"]
|
|
||||||
, "listPads" : ["groupID"]
|
|
||||||
, "createPad" : ["padID", "text"]
|
|
||||||
, "createGroupPad" : ["groupID", "padName", "text"]
|
|
||||||
, "createAuthor" : ["name"]
|
|
||||||
, "createAuthorIfNotExistsFor": ["authorMapper" , "name"]
|
|
||||||
, "listPadsOfAuthor" : ["authorID"]
|
|
||||||
, "createSession" : ["groupID", "authorID", "validUntil"]
|
|
||||||
, "deleteSession" : ["sessionID"]
|
|
||||||
, "getSessionInfo" : ["sessionID"]
|
|
||||||
, "listSessionsOfGroup" : ["groupID"]
|
|
||||||
, "listSessionsOfAuthor" : ["authorID"]
|
|
||||||
, "getText" : ["padID", "rev"]
|
|
||||||
, "setText" : ["padID", "text"]
|
|
||||||
, "getHTML" : ["padID", "rev"]
|
|
||||||
, "setHTML" : ["padID", "html"]
|
|
||||||
, "getRevisionsCount" : ["padID"]
|
|
||||||
, "getLastEdited" : ["padID"]
|
|
||||||
, "deletePad" : ["padID"]
|
|
||||||
, "getReadOnlyID" : ["padID"]
|
|
||||||
, "setPublicStatus" : ["padID", "publicStatus"]
|
|
||||||
, "getPublicStatus" : ["padID"]
|
|
||||||
, "setPassword" : ["padID", "password"]
|
|
||||||
, "isPasswordProtected" : ["padID"]
|
|
||||||
, "listAuthorsOfPad" : ["padID"]
|
|
||||||
, "padUsersCount" : ["padID"]
|
|
||||||
, "getAuthorName" : ["authorID"]
|
|
||||||
, "padUsers" : ["padID"]
|
, "padUsers" : ["padID"]
|
||||||
, "sendClientsMessage" : ["padID", "msg"]
|
, "sendClientsMessage" : ["padID", "msg"]
|
||||||
, "listAllGroups" : []
|
, "listAllGroups" : [] };
|
||||||
}
|
|
||||||
, "1.2":
|
var API_V1_2 =
|
||||||
{ "createGroup" : []
|
{ "checkToken" : [] };
|
||||||
, "createGroupIfNotExistsFor" : ["groupMapper"]
|
|
||||||
, "deleteGroup" : ["groupID"]
|
var API_V1_2_1 =
|
||||||
, "listPads" : ["groupID"]
|
{ "listAllPads" : [] };
|
||||||
, "createPad" : ["padID", "text"]
|
|
||||||
, "createGroupPad" : ["groupID", "padName", "text"]
|
var API_V1_2_7 =
|
||||||
, "createAuthor" : ["name"]
|
{ "createDiffHTML" : ["padID", "startRev", "endRev"]
|
||||||
, "createAuthorIfNotExistsFor": ["authorMapper" , "name"]
|
|
||||||
, "listPadsOfAuthor" : ["authorID"]
|
|
||||||
, "createSession" : ["groupID", "authorID", "validUntil"]
|
|
||||||
, "deleteSession" : ["sessionID"]
|
|
||||||
, "getSessionInfo" : ["sessionID"]
|
|
||||||
, "listSessionsOfGroup" : ["groupID"]
|
|
||||||
, "listSessionsOfAuthor" : ["authorID"]
|
|
||||||
, "getText" : ["padID", "rev"]
|
|
||||||
, "setText" : ["padID", "text"]
|
|
||||||
, "getHTML" : ["padID", "rev"]
|
|
||||||
, "setHTML" : ["padID", "html"]
|
|
||||||
, "getRevisionsCount" : ["padID"]
|
|
||||||
, "getLastEdited" : ["padID"]
|
|
||||||
, "deletePad" : ["padID"]
|
|
||||||
, "getReadOnlyID" : ["padID"]
|
|
||||||
, "setPublicStatus" : ["padID", "publicStatus"]
|
|
||||||
, "getPublicStatus" : ["padID"]
|
|
||||||
, "setPassword" : ["padID", "password"]
|
|
||||||
, "isPasswordProtected" : ["padID"]
|
|
||||||
, "listAuthorsOfPad" : ["padID"]
|
|
||||||
, "padUsersCount" : ["padID"]
|
|
||||||
, "getAuthorName" : ["authorID"]
|
|
||||||
, "padUsers" : ["padID"]
|
|
||||||
, "sendClientsMessage" : ["padID", "msg"]
|
|
||||||
, "listAllGroups" : []
|
|
||||||
, "checkToken" : []
|
|
||||||
}
|
|
||||||
, "1.2.1":
|
|
||||||
{ "createGroup" : []
|
|
||||||
, "createGroupIfNotExistsFor" : ["groupMapper"]
|
|
||||||
, "deleteGroup" : ["groupID"]
|
|
||||||
, "listPads" : ["groupID"]
|
|
||||||
, "listAllPads" : []
|
|
||||||
, "createPad" : ["padID", "text"]
|
|
||||||
, "createGroupPad" : ["groupID", "padName", "text"]
|
|
||||||
, "createAuthor" : ["name"]
|
|
||||||
, "createAuthorIfNotExistsFor": ["authorMapper" , "name"]
|
|
||||||
, "listPadsOfAuthor" : ["authorID"]
|
|
||||||
, "createSession" : ["groupID", "authorID", "validUntil"]
|
|
||||||
, "deleteSession" : ["sessionID"]
|
|
||||||
, "getSessionInfo" : ["sessionID"]
|
|
||||||
, "listSessionsOfGroup" : ["groupID"]
|
|
||||||
, "listSessionsOfAuthor" : ["authorID"]
|
|
||||||
, "getText" : ["padID", "rev"]
|
|
||||||
, "setText" : ["padID", "text"]
|
|
||||||
, "getHTML" : ["padID", "rev"]
|
|
||||||
, "setHTML" : ["padID", "html"]
|
|
||||||
, "getRevisionsCount" : ["padID"]
|
|
||||||
, "getLastEdited" : ["padID"]
|
|
||||||
, "deletePad" : ["padID"]
|
|
||||||
, "getReadOnlyID" : ["padID"]
|
|
||||||
, "setPublicStatus" : ["padID", "publicStatus"]
|
|
||||||
, "getPublicStatus" : ["padID"]
|
|
||||||
, "setPassword" : ["padID", "password"]
|
|
||||||
, "isPasswordProtected" : ["padID"]
|
|
||||||
, "listAuthorsOfPad" : ["padID"]
|
|
||||||
, "padUsersCount" : ["padID"]
|
|
||||||
, "getAuthorName" : ["authorID"]
|
|
||||||
, "padUsers" : ["padID"]
|
|
||||||
, "sendClientsMessage" : ["padID", "msg"]
|
|
||||||
, "listAllGroups" : []
|
|
||||||
, "checkToken" : []
|
|
||||||
}
|
|
||||||
, "1.2.7":
|
|
||||||
{ "createGroup" : []
|
|
||||||
, "createGroupIfNotExistsFor" : ["groupMapper"]
|
|
||||||
, "deleteGroup" : ["groupID"]
|
|
||||||
, "listPads" : ["groupID"]
|
|
||||||
, "listAllPads" : []
|
|
||||||
, "createDiffHTML" : ["padID", "startRev", "endRev"]
|
|
||||||
, "createPad" : ["padID", "text"]
|
|
||||||
, "createGroupPad" : ["groupID", "padName", "text"]
|
|
||||||
, "createAuthor" : ["name"]
|
|
||||||
, "createAuthorIfNotExistsFor": ["authorMapper" , "name"]
|
|
||||||
, "listPadsOfAuthor" : ["authorID"]
|
|
||||||
, "createSession" : ["groupID", "authorID", "validUntil"]
|
|
||||||
, "deleteSession" : ["sessionID"]
|
|
||||||
, "getSessionInfo" : ["sessionID"]
|
|
||||||
, "listSessionsOfGroup" : ["groupID"]
|
|
||||||
, "listSessionsOfAuthor" : ["authorID"]
|
|
||||||
, "getText" : ["padID", "rev"]
|
|
||||||
, "setText" : ["padID", "text"]
|
|
||||||
, "getHTML" : ["padID", "rev"]
|
|
||||||
, "setHTML" : ["padID", "html"]
|
|
||||||
, "getRevisionsCount" : ["padID"]
|
|
||||||
, "getLastEdited" : ["padID"]
|
|
||||||
, "deletePad" : ["padID"]
|
|
||||||
, "getReadOnlyID" : ["padID"]
|
|
||||||
, "setPublicStatus" : ["padID", "publicStatus"]
|
|
||||||
, "getPublicStatus" : ["padID"]
|
|
||||||
, "setPassword" : ["padID", "password"]
|
|
||||||
, "isPasswordProtected" : ["padID"]
|
|
||||||
, "listAuthorsOfPad" : ["padID"]
|
|
||||||
, "padUsersCount" : ["padID"]
|
|
||||||
, "getAuthorName" : ["authorID"]
|
|
||||||
, "padUsers" : ["padID"]
|
|
||||||
, "sendClientsMessage" : ["padID", "msg"]
|
|
||||||
, "listAllGroups" : []
|
|
||||||
, "checkToken" : []
|
|
||||||
, "getChatHistory" : ["padID"]
|
, "getChatHistory" : ["padID"]
|
||||||
, "getChatHistory" : ["padID", "start", "end"]
|
, "getChatHistory" : ["padID", "start", "end"]
|
||||||
, "getChatHead" : ["padID"]
|
, "getChatHead" : ["padID"] };
|
||||||
|
|
||||||
|
function apiConcat(v1, v2) {
|
||||||
|
for (var key in v1) {
|
||||||
|
v2[key] = v1[key];
|
||||||
}
|
}
|
||||||
};
|
return v2;
|
||||||
|
}
|
||||||
|
|
||||||
|
API_V1_1 = apiConcat(API_V1, API_V1_1) ;
|
||||||
|
API_V1_2 = apiConcat(API_V1_1, API_V1_2) ;
|
||||||
|
API_V1_2_1 = apiConcat(API_V1_2, API_V1_2_1) ;
|
||||||
|
API_V1_2_7 = apiConcat(API_V1_2_1, API_V1_2_7) ;
|
||||||
|
|
||||||
|
var version = { "1" : API_V1
|
||||||
|
, "1.1" : API_V1_1
|
||||||
|
, "1.2" : API_V1_2
|
||||||
|
, "1.2.1" : API_V1_2_1
|
||||||
|
, "1.2.7" : API_V1_2_7 };
|
||||||
|
|
||||||
// set the latest available API version here
|
// set the latest available API version here
|
||||||
exports.latestApiVersion = '1.2.7';
|
exports.latestApiVersion = '1.2.7';
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue