Skip to content

Commit

Permalink
doc: adding more api examples
Browse files Browse the repository at this point in the history
  • Loading branch information
esatterwhite committed Dec 9, 2018
1 parent a93e413 commit 63dc2df
Show file tree
Hide file tree
Showing 56 changed files with 241 additions and 2,117 deletions.
34 changes: 29 additions & 5 deletions docs/api/api_data.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ define({ "api": [
"name": "get_ping",
"type": "get",
"url": "/ping",
"title": "",
"title": "check if service is running",
"version": "8.0.0",
"examples": [
{
Expand All @@ -17,8 +17,22 @@ define({ "api": [
"title": "Node.js:",
"content": "const http = require('http')\nhttp.get('http://localhost:3000/ping, (err, res) => {\n console.log(res.statusCode);\n})",
"type": "js"
},
{
"title": "python:",
"content": "import json\nfrom urllib.request import Request, urlopen\nreq = Request(url='http://localhost:3000/ping', method='GET')\nres = urlopen(req)\nprint(res.status)",
"type": "python"
}
],
"header": {
"examples": [
{
"title": "Headers Example:",
"content": "HTTP/1.1 200 OK\nDate: Fri, 23 Dec 2018 00:19:13 GMT\nConnection: keep-alive\nContent-Length: 0",
"type": "text"
}
]
},
"filename": "lib/server/api/get_ping.js",
"groupTitle": "ping"
},
Expand Down Expand Up @@ -120,7 +134,7 @@ define({ "api": [
},
{
"title": "Node.js:",
"content": "const http = require('http')\nconst data = JSON.stringify({\n timeout: 5000,\n data: {foo: 'bar', bar: 'baz'},\n callback: {\n transport: 'http',\n method: 'post',\n uri: 'http://mydomain.name/timer/callback'\n }\n})\nconst options = {\n hostname: 'localhost',\n port: 3000,\n path: '/timer',\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json',\n 'Content-Length': Buffer.byteLength(data)\n }\n };\nconst req = http.request(options, (res) => {\n let data = '';\n res.on('data', (chunk) => {\n data += chunk;\n });\n\n res.on('end', () => {\n // done\n });\n})\nreq.write(data);\nreq.end();",
"content": "const http = require('http')\nconst data = JSON.stringify({\n timeout: 5000,\n data: {foo: 'bar', bar: 'baz'},\n callback: {\n transport: 'http',\n method: 'post',\n uri: 'http://mydomain.name/timer/callback'\n }\n})\n\nconst req = http.request({\n hostname: 'localhost',\n port: 3000,\n path: '/timer',\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json',\n 'Content-Length': Buffer.byteLength(data)\n }\n}, (res) => {\n let data = '';\n res.on('data', (chunk) => {\n data += chunk;\n });\n\n res.on('end', () => {\n // done\n });\n})\nreq.write(data);\nreq.end();",
"type": "js"
},
{
Expand Down Expand Up @@ -149,10 +163,10 @@ define({ "api": [
"Parameter": [
{
"group": "Parameter",
"type": "Number",
"type": "UUID",
"optional": false,
"field": "id",
"description": "<p>Users unique ID.</p>"
"description": "<p>unique timer ID.</p>"
}
]
},
Expand All @@ -173,8 +187,18 @@ define({ "api": [
},
{
"title": "Node.js:",
"content": "const http = require('http')\nconst options = {\n hostname: 'localhost',\n port: 3000,\n path: '/timer/8c66a779-9c74-4e30-b5e8-f32d60909d45',\n method: 'DELETE',\n headers: {\n 'Content-Type': 'application/json',\n }\n };\nconst req = http.request(options, (res) => {\n res.on('end', () => {\n // done\n });\n})\nreq.end();",
"content": "const http = require('http')\nconst req = http.request({\n hostname: 'localhost',\n port: 3000,\n path: '/timer/8c66a779-9c74-4e30-b5e8-f32d60909d45',\n method: 'DELETE',\n headers: {\n 'Content-Type': 'application/json',\n }\n}, (res) => {\n res.on('end', () => {\n // done\n });\n})\nreq.end();",
"type": "js"
},
{
"title": "python:",
"content": "import json\nfrom urllib.request import Request, urlopen\nreq = Request(url='http://localhost:3000/timer/8c66a779-9c74-4e30-b5e8-f32d60909d45', method='DELETE')\nres = urlopen(req)\nprint(res.status)",
"type": "python"
},
{
"title": "ruby:",
"content": "require 'json'\nrequire 'net/http'\nrequire 'uri'\n\nuri = URI.parse('http://localhost:3003/timer/8c66a779-9c74-4e30-b5e8-f32d60909d45')\n\nhttp = Net::HTTP.new(uri.host, uri.port)\nrequest = Net::HTTP::Delete.new(uri.request_uri, {'Content-Type': 'application/json'})\nresponse = http.request(request)\nprint response.code",
"type": "ruby"
}
],
"filename": "lib/server/api/delete_timer.js",
Expand Down
34 changes: 29 additions & 5 deletions docs/api/api_data.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"name": "get_ping",
"type": "get",
"url": "/ping",
"title": "",
"title": "check if service is running",
"version": "8.0.0",
"examples": [
{
Expand All @@ -17,8 +17,22 @@
"title": "Node.js:",
"content": "const http = require('http')\nhttp.get('http://localhost:3000/ping, (err, res) => {\n console.log(res.statusCode);\n})",
"type": "js"
},
{
"title": "python:",
"content": "import json\nfrom urllib.request import Request, urlopen\nreq = Request(url='http://localhost:3000/ping', method='GET')\nres = urlopen(req)\nprint(res.status)",
"type": "python"
}
],
"header": {
"examples": [
{
"title": "Headers Example:",
"content": "HTTP/1.1 200 OK\nDate: Fri, 23 Dec 2018 00:19:13 GMT\nConnection: keep-alive\nContent-Length: 0",
"type": "text"
}
]
},
"filename": "lib/server/api/get_ping.js",
"groupTitle": "ping"
},
Expand Down Expand Up @@ -120,7 +134,7 @@
},
{
"title": "Node.js:",
"content": "const http = require('http')\nconst data = JSON.stringify({\n timeout: 5000,\n data: {foo: 'bar', bar: 'baz'},\n callback: {\n transport: 'http',\n method: 'post',\n uri: 'http://mydomain.name/timer/callback'\n }\n})\nconst options = {\n hostname: 'localhost',\n port: 3000,\n path: '/timer',\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json',\n 'Content-Length': Buffer.byteLength(data)\n }\n };\nconst req = http.request(options, (res) => {\n let data = '';\n res.on('data', (chunk) => {\n data += chunk;\n });\n\n res.on('end', () => {\n // done\n });\n})\nreq.write(data);\nreq.end();",
"content": "const http = require('http')\nconst data = JSON.stringify({\n timeout: 5000,\n data: {foo: 'bar', bar: 'baz'},\n callback: {\n transport: 'http',\n method: 'post',\n uri: 'http://mydomain.name/timer/callback'\n }\n})\n\nconst req = http.request({\n hostname: 'localhost',\n port: 3000,\n path: '/timer',\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json',\n 'Content-Length': Buffer.byteLength(data)\n }\n}, (res) => {\n let data = '';\n res.on('data', (chunk) => {\n data += chunk;\n });\n\n res.on('end', () => {\n // done\n });\n})\nreq.write(data);\nreq.end();",
"type": "js"
},
{
Expand Down Expand Up @@ -149,10 +163,10 @@
"Parameter": [
{
"group": "Parameter",
"type": "Number",
"type": "UUID",
"optional": false,
"field": "id",
"description": "<p>Users unique ID.</p>"
"description": "<p>unique timer ID.</p>"
}
]
},
Expand All @@ -173,8 +187,18 @@
},
{
"title": "Node.js:",
"content": "const http = require('http')\nconst options = {\n hostname: 'localhost',\n port: 3000,\n path: '/timer/8c66a779-9c74-4e30-b5e8-f32d60909d45',\n method: 'DELETE',\n headers: {\n 'Content-Type': 'application/json',\n }\n };\nconst req = http.request(options, (res) => {\n res.on('end', () => {\n // done\n });\n})\nreq.end();",
"content": "const http = require('http')\nconst req = http.request({\n hostname: 'localhost',\n port: 3000,\n path: '/timer/8c66a779-9c74-4e30-b5e8-f32d60909d45',\n method: 'DELETE',\n headers: {\n 'Content-Type': 'application/json',\n }\n}, (res) => {\n res.on('end', () => {\n // done\n });\n})\nreq.end();",
"type": "js"
},
{
"title": "python:",
"content": "import json\nfrom urllib.request import Request, urlopen\nreq = Request(url='http://localhost:3000/timer/8c66a779-9c74-4e30-b5e8-f32d60909d45', method='DELETE')\nres = urlopen(req)\nprint(res.status)",
"type": "python"
},
{
"title": "ruby:",
"content": "require 'json'\nrequire 'net/http'\nrequire 'uri'\n\nuri = URI.parse('http://localhost:3003/timer/8c66a779-9c74-4e30-b5e8-f32d60909d45')\n\nhttp = Net::HTTP.new(uri.host, uri.port)\nrequest = Net::HTTP::Delete.new(uri.request_uri, {'Content-Type': 'application/json'})\nresponse = http.request(request)\nprint response.code",
"type": "ruby"
}
],
"filename": "lib/server/api/delete_timer.js",
Expand Down
4 changes: 2 additions & 2 deletions docs/api/api_project.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
define({
"name": "skyring",
"version": "7.0.1",
"version": "9.0.0",
"description": "Distributed timers as a service",
"sampleUrl": false,
"defaultVersion": "0.0.0",
"apidoc": "0.3.0",
"generator": {
"name": "apidoc",
"time": "2018-11-30T22:14:26.485Z",
"time": "2018-12-09T16:52:26.410Z",
"url": "http://apidocjs.com",
"version": "0.17.7"
}
Expand Down
4 changes: 2 additions & 2 deletions docs/api/api_project.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
{
"name": "skyring",
"version": "7.0.1",
"version": "9.0.0",
"description": "Distributed timers as a service",
"sampleUrl": false,
"defaultVersion": "0.0.0",
"apidoc": "0.3.0",
"generator": {
"name": "apidoc",
"time": "2018-11-30T22:14:26.485Z",
"time": "2018-12-09T16:52:26.410Z",
"url": "http://apidocjs.com",
"version": "0.17.7"
}
Expand Down
Binary file removed docs/api/img/glyphicons-halflings-white.png
Binary file not shown.
Binary file removed docs/api/img/glyphicons-halflings.png
Binary file not shown.
9 changes: 0 additions & 9 deletions docs/api/vendor/bootstrap-responsive.min.css

This file was deleted.

Loading

0 comments on commit 63dc2df

Please sign in to comment.