Skip to content

Commit

Permalink
Reformatted code, excluded unnecessary newlines and removed version 2…
Browse files Browse the repository at this point in the history
….2.2
  • Loading branch information
SamTV12345 committed Sep 16, 2024
1 parent 495ec4b commit 06ecd52
Show file tree
Hide file tree
Showing 3 changed files with 55 additions and 46 deletions.
6 changes: 0 additions & 6 deletions src/node/handler/APIHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -142,12 +142,6 @@ version['1.3.0'] = {
};


version['2.2.2'] = {
...version['1.3.0'],

}


// set the latest available API version here
exports.latestApiVersion = '1.3.0';

Expand Down
91 changes: 55 additions & 36 deletions src/node/handler/RestAPI.ts
Original file line number Diff line number Diff line change
Expand Up @@ -954,27 +954,30 @@ export const expressCreateServer = async (hookName: string, {app}: ArgsExpressTy
summary: 'Get the chat history of a pad',
tags: ['pad']
}
mapping.get(GET)!["/pads/chatHead"] = {apiVersion: '1.2.7', functionName: 'getChatHead',
responses: prepareResponses({type: "object", properties: {
chatHead: {
type: "object",
properties: {
"text": {
"type": "string"
},
"userId": {
"type": "string"
},
"userName": {
"type": "string"
},
"time": {
"type": "integer"
mapping.get(GET)!["/pads/chatHead"] = {
apiVersion: '1.2.7', functionName: 'getChatHead',
responses: prepareResponses({
type: "object", properties: {
chatHead: {
type: "object",
properties: {
"text": {
"type": "string"
},
"userId": {
"type": "string"
},
"userName": {
"type": "string"
},
"time": {
"type": "integer"
}
}
}
}

}}),
}
}),
requestBody: [
{
"name": "padID",
Expand All @@ -990,7 +993,8 @@ export const expressCreateServer = async (hookName: string, {app}: ArgsExpressTy
}

// Version 1.2.8
mapping.get(GET)!["/pads/attributePool"] = {apiVersion: '1.2.8', functionName: 'getAttributePool',
mapping.get(GET)!["/pads/attributePool"] = {
apiVersion: '1.2.8', functionName: 'getAttributePool',
responses: prepareResponses({type: "object", properties: {}}),
requestBody: [
{
Expand All @@ -1004,7 +1008,8 @@ export const expressCreateServer = async (hookName: string, {app}: ArgsExpressTy
summary: 'Get the attribute pool of a pad',
tags: ['pad']
}
mapping.get(GET)!["/pads/revisionChangeset"] = {apiVersion: '1.2.8', functionName: 'getRevisionChangeset',
mapping.get(GET)!["/pads/revisionChangeset"] = {
apiVersion: '1.2.8', functionName: 'getRevisionChangeset',
responses: prepareResponses({type: "object", properties: {}}),
requestBody: [
{
Expand All @@ -1027,7 +1032,8 @@ export const expressCreateServer = async (hookName: string, {app}: ArgsExpressTy
}

// Version 1.2.9
mapping.get(POST)!["/pads/copypad"] = {apiVersion: '1.2.9', functionName: 'copyPad',
mapping.get(POST)!["/pads/copypad"] = {
apiVersion: '1.2.9', functionName: 'copyPad',
requestBody: {
content: {
"application/json": {
Expand Down Expand Up @@ -1055,7 +1061,8 @@ export const expressCreateServer = async (hookName: string, {app}: ArgsExpressTy
}


mapping.get(POST)!["/pads/movePad"] = {apiVersion: '1.2.9', functionName: 'movePad',
mapping.get(POST)!["/pads/movePad"] = {
apiVersion: '1.2.9', functionName: 'movePad',
requestBody: {
content: {
"application/json": {
Expand Down Expand Up @@ -1083,7 +1090,8 @@ export const expressCreateServer = async (hookName: string, {app}: ArgsExpressTy
}

// Version 1.2.10
mapping.get(POST)!["/pads/padId"] = {apiVersion: '1.2.10', functionName: 'getPadID',
mapping.get(POST)!["/pads/padId"] = {
apiVersion: '1.2.10', functionName: 'getPadID',
requestBody: {
content: {
"application/json": {
Expand All @@ -1105,7 +1113,8 @@ export const expressCreateServer = async (hookName: string, {app}: ArgsExpressTy
}

// Version 1.2.11
mapping.get(GET)!["/savedRevisions"] = {apiVersion: '1.2.11', functionName: 'listSavedRevisions',
mapping.get(GET)!["/savedRevisions"] = {
apiVersion: '1.2.11', functionName: 'listSavedRevisions',
responses: prepareResponses({type: "object", properties: {savedRevisions: {type: "array", items: {type: "object"}}}}),
requestBody: [
{
Expand All @@ -1121,7 +1130,8 @@ export const expressCreateServer = async (hookName: string, {app}: ArgsExpressTy
}


mapping.get(POST)!["/savedRevisions"] = {apiVersion: '1.2.11', functionName: 'saveRevision',
mapping.get(POST)!["/savedRevisions"] = {
apiVersion: '1.2.11', functionName: 'saveRevision',
requestBody: {
content: {
"application/json": {
Expand All @@ -1145,7 +1155,8 @@ export const expressCreateServer = async (hookName: string, {app}: ArgsExpressTy
tags: ['pad']
}

mapping.get(GET)!["/savedRevisions/revisionsCount"] = {apiVersion: '1.2.11', functionName: 'getSavedRevisionsCount',
mapping.get(GET)!["/savedRevisions/revisionsCount"] = {
apiVersion: '1.2.11', functionName: 'getSavedRevisionsCount',
responses: prepareResponses({type: "object", properties: {revisionsCount: {type: "integer"}}}),
requestBody: [
{
Expand All @@ -1161,7 +1172,8 @@ export const expressCreateServer = async (hookName: string, {app}: ArgsExpressTy
}

// Version 1.2.12
mapping.get(PATCH)!["/chats/messages"] = {apiVersion: '1.2.12', functionName: 'appendChatMessage',
mapping.get(PATCH)!["/chats/messages"] = {
apiVersion: '1.2.12', functionName: 'appendChatMessage',
requestBody: {
content: {
"application/json": {
Expand Down Expand Up @@ -1194,7 +1206,8 @@ export const expressCreateServer = async (hookName: string, {app}: ArgsExpressTy
// Version 1.2.13

// Version 1.2.14
mapping.get(GET)!["/stats"] = {apiVersion: '1.2.14', functionName: 'getStats',
mapping.get(GET)!["/stats"] = {
apiVersion: '1.2.14', functionName: 'getStats',
responses: prepareResponses({type: "object", properties: {stats: {type: "object"}}}),
summary: 'Get stats',
tags: ['stats']
Expand All @@ -1203,7 +1216,8 @@ export const expressCreateServer = async (hookName: string, {app}: ArgsExpressTy
// Version 1.2.15

// Version 1.3.0
mapping.get(PATCH)!["/pads/text"] = {apiVersion: '1.3.0', functionName: 'appendText',
mapping.get(PATCH)!["/pads/text"] = {
apiVersion: '1.3.0', functionName: 'appendText',
requestBody: {
content: {
"application/json": {
Expand All @@ -1229,7 +1243,8 @@ export const expressCreateServer = async (hookName: string, {app}: ArgsExpressTy
summary: 'Appends text to a pad',
tags: ['pad']
}
mapping.get(POST)!["/pads/copyWithoutHistory"] = {apiVersion: '1.3.0', functionName: 'copyPadWithoutHistory',
mapping.get(POST)!["/pads/copyWithoutHistory"] = {
apiVersion: '1.3.0', functionName: 'copyPadWithoutHistory',
requestBody: {
content: {
"application/json": {
Expand All @@ -1242,14 +1257,14 @@ export const expressCreateServer = async (hookName: string, {app}: ArgsExpressTy
destinationID: {
type: "string"
},
force : {
force: {
type: "string"
},
authorID: {
type: "string"
}
},
required: ["sourceID", "destinationID","force", "authorID"]
required: ["sourceID", "destinationID", "force", "authorID"]
}
}
}
Expand All @@ -1258,7 +1273,8 @@ export const expressCreateServer = async (hookName: string, {app}: ArgsExpressTy
summary: 'Copies a pad without its history',
tags: ['pad']
}
mapping.get(POST)!["/pads/group"] = {apiVersion: '1.3.0', functionName: 'createGroupPad',
mapping.get(POST)!["/pads/group"] = {
apiVersion: '1.3.0', functionName: 'createGroupPad',
requestBody: {
content: {
"application/json": {
Expand Down Expand Up @@ -1288,7 +1304,8 @@ export const expressCreateServer = async (hookName: string, {app}: ArgsExpressTy
tags: ['pad']

}
mapping.get(POST)!["/pads"] = {apiVersion: '1.3.0', functionName: 'createPad',
mapping.get(POST)!["/pads"] = {
apiVersion: '1.3.0', functionName: 'createPad',
requestBody: {
content: {
"application/json": {
Expand Down Expand Up @@ -1343,7 +1360,8 @@ export const expressCreateServer = async (hookName: string, {app}: ArgsExpressTy
}


mapping.get(POST)!["/pads/html"] = {apiVersion: '1.3.0', functionName: 'setHTML',
mapping.get(POST)!["/pads/html"] = {
apiVersion: '1.3.0', functionName: 'setHTML',
requestBody: {
content: {
"application/json": {
Expand All @@ -1370,7 +1388,8 @@ export const expressCreateServer = async (hookName: string, {app}: ArgsExpressTy
tags: ['pad']
}

mapping.get(POST)!["/pads/text"] = {apiVersion: '1.3.0', functionName: 'setText',
mapping.get(POST)!["/pads/text"] = {
apiVersion: '1.3.0', functionName: 'setText',
requestBody: {
content: {
"application/json": {
Expand Down
4 changes: 0 additions & 4 deletions src/node/hooks/express/specialpages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -370,8 +370,4 @@ exports.expressCreateServer = async (hookName: string, args: ArgsExpressType, cb
// express-session automatically calls req.session.touch() so we don't need to do it here.
res.json({status: 'ok'});
});




};

0 comments on commit 06ecd52

Please sign in to comment.