Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Documented directory list #56

Merged
merged 1 commit into from
Jun 5, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
102 changes: 98 additions & 4 deletions backend/docs/api_data.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ define({ "api": [
"type": "post",
"url": "/api/login",
"title": "Authenticate the user",
"name": "Login",
"group": "Authenticate",
"parameter": {
"fields": {
Expand Down Expand Up @@ -33,13 +32,13 @@ define({ "api": [
"type": "String",
"optional": false,
"field": "token",
"description": "<p>User token, valid for 20 minutes .</p>"
"description": "<p>User token, valid for 20 minutes.</p>"
}
]
},
"examples": [
{
"title": "Sucess",
"title": "Success",
"content": "HTTP/1.1 200 OK\n{\n \"token\": \"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VybmFtZSI6ImRhbmllbHJjIiwiaWF0IjoxNTI3MTY1NTg2LCJleHAiOjE1MjcxNjY3ODZ9.VEvOcyPa-LKSr0kJXTa6TvpCqyKmenJRbEgdxNKJjik\" \n}",
"type": "json"
}
Expand Down Expand Up @@ -77,6 +76,101 @@ define({ "api": [
},
"version": "0.0.0",
"filename": "routes/login.js",
"groupTitle": "Authenticate"
"groupTitle": "Authenticate",
"name": "PostApiLogin"
},
{
"type": "get",
"url": "/api/directories",
"title": "List items",
"group": "Directories",
"description": "<p>List items from specified path. The token is needed.</p>",
"header": {
"fields": {
"Header": [
{
"group": "Header",
"type": "String",
"optional": false,
"field": "Authorization",
"description": "<p>Authorization token.</p>"
}
]
}
},
"parameter": {
"fields": {
"Parameter": [
{
"group": "Parameter",
"type": "String",
"optional": false,
"field": "path",
"description": "<p>The directory path.</p>"
}
]
}
},
"examples": [
{
"title": "Example usage",
"content": "curl -H \"Authorization: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VybmFtZSI6ImRhbmllbCIsImlhdCI6MTUyNzI5Mjk2NSwiZXhwIjoxNTI3Mjk0MTY1fQ.M8HAJAjq5E8k-e4LzxMXccG7z5ay4Yrs05ZmhXhMv6g\" http://127.0.0.1:3000/api/directories?path=Documents/example",
"type": "curl"
}
],
"success": {
"examples": [
{
"title": "Success",
"content": "HTTP/1.1 200 OK\n{\n \"items\": [\n {\n \"name\": \"dir1\",\n \"path\": \"/dir1\",\n \"isFile\": false\n },\n {\n \"name\": \"file1.txt\",\n \"path\": \"/file1.txt\",\n \"isFile\": true\n }\n ]\n}",
"type": "json"
}
]
},
"error": {
"fields": {
"Error 4xx": [
{
"group": "Error 4xx",
"optional": false,
"field": "ENOENT",
"description": "<p>No such file or directory.</p>"
},
{
"group": "Error 4xx",
"optional": false,
"field": "NoTokenProvided",
"description": "<p>No token provided.</p>"
},
{
"group": "Error 4xx",
"optional": false,
"field": "InvalidToken",
"description": "<p>Invalid token.</p>"
}
]
},
"examples": [
{
"title": "ENOENT",
"content": "HTTP/1.1 404 NotFound\n{\n \"error\": \"ENOENT: no such file or directory, scandir '<directory_path>'\"\n}",
"type": "json"
},
{
"title": "NoTokenProvided",
"content": "HTTP/1.1 401 Unauthorized\n{\n \"error\": \"Access denied. No token provided.\"\n}",
"type": "json"
},
{
"title": "InvalidToken",
"content": "HTTP/1.1 400 BadRequest\n{\n \"error\": \"Invalid token\"\n}",
"type": "json"
}
]
},
"version": "0.0.0",
"filename": "routes/directories.js",
"groupTitle": "Directories",
"name": "GetApiDirectories"
}
] });
102 changes: 98 additions & 4 deletions backend/docs/api_data.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
"type": "post",
"url": "/api/login",
"title": "Authenticate the user",
"name": "Login",
"group": "Authenticate",
"parameter": {
"fields": {
Expand Down Expand Up @@ -33,13 +32,13 @@
"type": "String",
"optional": false,
"field": "token",
"description": "<p>User token, valid for 20 minutes .</p>"
"description": "<p>User token, valid for 20 minutes.</p>"
}
]
},
"examples": [
{
"title": "Sucess",
"title": "Success",
"content": "HTTP/1.1 200 OK\n{\n \"token\": \"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VybmFtZSI6ImRhbmllbHJjIiwiaWF0IjoxNTI3MTY1NTg2LCJleHAiOjE1MjcxNjY3ODZ9.VEvOcyPa-LKSr0kJXTa6TvpCqyKmenJRbEgdxNKJjik\" \n}",
"type": "json"
}
Expand Down Expand Up @@ -77,6 +76,101 @@
},
"version": "0.0.0",
"filename": "routes/login.js",
"groupTitle": "Authenticate"
"groupTitle": "Authenticate",
"name": "PostApiLogin"
},
{
"type": "get",
"url": "/api/directories",
"title": "List items",
"group": "Directories",
"description": "<p>List items from specified path. The token is needed.</p>",
"header": {
"fields": {
"Header": [
{
"group": "Header",
"type": "String",
"optional": false,
"field": "Authorization",
"description": "<p>Authorization token.</p>"
}
]
}
},
"parameter": {
"fields": {
"Parameter": [
{
"group": "Parameter",
"type": "String",
"optional": false,
"field": "path",
"description": "<p>The directory path.</p>"
}
]
}
},
"examples": [
{
"title": "Example usage",
"content": "curl -H \"Authorization: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VybmFtZSI6ImRhbmllbCIsImlhdCI6MTUyNzI5Mjk2NSwiZXhwIjoxNTI3Mjk0MTY1fQ.M8HAJAjq5E8k-e4LzxMXccG7z5ay4Yrs05ZmhXhMv6g\" http://127.0.0.1:3000/api/directories?path=Documents/example",
"type": "curl"
}
],
"success": {
"examples": [
{
"title": "Success",
"content": "HTTP/1.1 200 OK\n{\n \"items\": [\n {\n \"name\": \"dir1\",\n \"path\": \"/dir1\",\n \"isFile\": false\n },\n {\n \"name\": \"file1.txt\",\n \"path\": \"/file1.txt\",\n \"isFile\": true\n }\n ]\n}",
"type": "json"
}
]
},
"error": {
"fields": {
"Error 4xx": [
{
"group": "Error 4xx",
"optional": false,
"field": "ENOENT",
"description": "<p>No such file or directory.</p>"
},
{
"group": "Error 4xx",
"optional": false,
"field": "NoTokenProvided",
"description": "<p>No token provided.</p>"
},
{
"group": "Error 4xx",
"optional": false,
"field": "InvalidToken",
"description": "<p>Invalid token.</p>"
}
]
},
"examples": [
{
"title": "ENOENT",
"content": "HTTP/1.1 404 NotFound\n{\n \"error\": \"ENOENT: no such file or directory, scandir '<directory_path>'\"\n}",
"type": "json"
},
{
"title": "NoTokenProvided",
"content": "HTTP/1.1 401 Unauthorized\n{\n \"error\": \"Access denied. No token provided.\"\n}",
"type": "json"
},
{
"title": "InvalidToken",
"content": "HTTP/1.1 400 BadRequest\n{\n \"error\": \"Invalid token\"\n}",
"type": "json"
}
]
},
"version": "0.0.0",
"filename": "routes/directories.js",
"groupTitle": "Directories",
"name": "GetApiDirectories"
}
]
2 changes: 1 addition & 1 deletion backend/docs/api_project.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ define({
"apidoc": "0.3.0",
"generator": {
"name": "apidoc",
"time": "2018-05-24T16:32:08.705Z",
"time": "2018-05-26T00:22:17.461Z",
"url": "http://apidocjs.com",
"version": "0.17.6"
}
Expand Down
2 changes: 1 addition & 1 deletion backend/docs/api_project.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"apidoc": "0.3.0",
"generator": {
"name": "apidoc",
"time": "2018-05-24T16:32:08.705Z",
"time": "2018-05-26T00:22:17.461Z",
"url": "http://apidocjs.com",
"version": "0.17.6"
}
Expand Down
Loading