Added HTML Documentation
This commit is contained in:
parent
37656907d3
commit
352bc249d9
36
documentation/create_user.html
Normal file
36
documentation/create_user.html
Normal file
@ -0,0 +1,36 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<link rel="stylesheet" href="github-markdown.css">
|
||||
</head>
|
||||
<body class="markdown-body">
|
||||
<style>
|
||||
.markdown-body {
|
||||
box-sizing: border-box;
|
||||
min-width: 200px;
|
||||
max-width: 980px;
|
||||
margin: 0 auto;
|
||||
padding: 45px;
|
||||
}
|
||||
|
||||
@media (max-width: 767px) {
|
||||
.markdown-body {
|
||||
padding: 15px;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
<div class="markdown-heading"><h1 class="heading-element">Create User</h1><a id="user-content-create-user" class="anchor" aria-label="Permalink: Create User" href="#create-user"><span aria-hidden="true" class="octicon octicon-link"></span></a></div>
|
||||
<p>Creates a new user in the database.
|
||||
Endpoint</p>
|
||||
<div class="highlight highlight-source-js"><pre><span class="pl-c1">POST</span> <span class="pl-c1">/</span><span class="pl-s1">api</span><span class="pl-c1">/</span><span class="pl-s1">create_user</span></pre></div>
|
||||
<div class="markdown-heading"><h2 class="heading-element">Request Body</h2><a id="user-content-request-body" class="anchor" aria-label="Permalink: Request Body" href="#request-body"><span aria-hidden="true" class="octicon octicon-link"></span></a></div>
|
||||
<div class="highlight highlight-source-json"><pre>{
|
||||
<span class="pl-ent">"username"</span>: <span class="pl-s"><span class="pl-pds">"</span>example_user<span class="pl-pds">"</span></span>,
|
||||
<span class="pl-ent">"password"</span>: <span class="pl-s"><span class="pl-pds">"</span>example_password<span class="pl-pds">"</span></span>
|
||||
<br>}</pre></div>
|
||||
<div class="markdown-heading"><h2 class="heading-element">Example Request</h2><a id="user-content-example-request" class="anchor" aria-label="Permalink: Example Request" href="#example-request"><span aria-hidden="true" class="octicon octicon-link"></span></a></div>
|
||||
<div class="highlight highlight-source-shell"><pre>curl -X POST <span class="pl-s"><span class="pl-pds">"</span>https://example.com/api/create_user<span class="pl-pds">"</span></span> \
|
||||
-H <span class="pl-s"><span class="pl-pds">"</span>Content-Type: application/json<span class="pl-pds">"</span></span> \
|
||||
-d <span class="pl-s"><span class="pl-pds">'</span>{"username": "example_user", "password": "example_password"}<span class="pl-pds">'</span></span></pre></div>
|
||||
</body>
|
||||
</html>
|
@ -1,9 +1,5 @@
|
||||
# Create User
|
||||
|
||||
This API provides endpoints for user management, including user signup, login, and accessing user tests.
|
||||
|
||||
## Endpoint Details
|
||||
|
||||
Creates a new user in the database.
|
||||
Endpoint
|
||||
|
||||
@ -27,15 +23,3 @@ curl -X POST "https://example.com/api/create_user" \
|
||||
-H "Content-Type: application/json" \
|
||||
-d '{"username": "example_user", "password": "example_password"}'
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Response
|
||||
|
||||
Upon successful execution, the endpoints return appropriate responses. Errors are logged for any database-related issues.
|
||||
|
||||
Ensure that you handle responses appropriately in your application.
|
||||
|
||||
This documentation provides details on user management endpoints, including signup, login, and accessing user tests.
|
61
documentation/get_user_tests.html
Normal file
61
documentation/get_user_tests.html
Normal file
@ -0,0 +1,61 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<link rel="stylesheet" href="github-markdown.css">
|
||||
</head>
|
||||
<body class="markdown-body">
|
||||
<style>
|
||||
.markdown-body {
|
||||
box-sizing: border-box;
|
||||
min-width: 200px;
|
||||
max-width: 980px;
|
||||
margin: 0 auto;
|
||||
padding: 45px;
|
||||
}
|
||||
|
||||
@media (max-width: 767px) {
|
||||
.markdown-body {
|
||||
padding: 15px;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
<div class="markdown-heading"><h1 class="heading-element">Get User Tests</h1><a id="user-content-get-user-tests" class="anchor" aria-label="Permalink: Get User Tests" href="#get-user-tests"><span aria-hidden="true" class="octicon octicon-link"></span></a></div>
|
||||
<p>Retrieves tests associated with a specific user from the database.</p>
|
||||
<div class="markdown-heading"><h2 class="heading-element">Endpoint</h2><a id="user-content-endpoint" class="anchor" aria-label="Permalink: Endpoint" href="#endpoint"><span aria-hidden="true" class="octicon octicon-link"></span></a></div>
|
||||
<div class="highlight highlight-source-js"><pre><span class="pl-c1">GET</span> <span class="pl-c1">/</span><span class="pl-s1">api</span><span class="pl-c1">/</span><span class="pl-s1">get_tests</span><span class="pl-c1">/</span><span class="pl-c1"><</span><span class="pl-ent">user_id</span><span class="pl-c1">></span>/<span class="pl-c1"><</span><span class="pl-ent">secret</span><span class="pl-c1">></span></pre></div>
|
||||
<div class="markdown-heading"><h2 class="heading-element">Parameters</h2><a id="user-content-parameters" class="anchor" aria-label="Permalink: Parameters" href="#parameters"><span aria-hidden="true" class="octicon octicon-link"></span></a></div>
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Parameter</th>
|
||||
<th>Type</th>
|
||||
<th>Description</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>user_id</td>
|
||||
<td>integer</td>
|
||||
<td>User ID of the user whose tests need to be retrieved</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>secret</td>
|
||||
<td>String</td>
|
||||
<td>Secret key for authentication</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<div class="markdown-heading"><h2 class="heading-element">Example Request</h2><a id="user-content-example-request" class="anchor" aria-label="Permalink: Example Request" href="#example-request"><span aria-hidden="true" class="octicon octicon-link"></span></a></div>
|
||||
<div class="highlight highlight-source-shell"><pre>curl -X GET <span class="pl-s"><span class="pl-pds">"</span>https://example.com/api/get_tests/123/your_secret_key_here<span class="pl-pds">"</span></span></pre></div>
|
||||
<div class="markdown-heading"><h2 class="heading-element">Example Response</h2><a id="user-content-example-response" class="anchor" aria-label="Permalink: Example Response" href="#example-response"><span aria-hidden="true" class="octicon octicon-link"></span></a></div>
|
||||
<div class="highlight highlight-source-json"><pre>{
|
||||
<span class="pl-ent">"test_type"</span>: <span class="pl-s"><span class="pl-pds">"</span>words<span class="pl-pds">"</span></span>,
|
||||
<span class="pl-ent">"test_length"</span>: <span class="pl-c1">100</span>,
|
||||
<span class="pl-ent">"test_time"</span>: <span class="pl-c1">300</span>,
|
||||
<span class="pl-ent">"test_seed"</span>: <span class="pl-c1">987654321</span>,
|
||||
<span class="pl-ent">"quote_id"</span>: <span class="pl-c1">123</span>,
|
||||
<span class="pl-ent">"wpm"</span>: <span class="pl-c1">65</span>,
|
||||
<span class="pl-ent">"accuracy"</span>: <span class="pl-c1">98</span>
|
||||
<br>}</pre></div>
|
||||
</body>
|
||||
</html>
|
1200
documentation/github-markdown.css
Normal file
1200
documentation/github-markdown.css
Normal file
File diff suppressed because it is too large
Load Diff
31
documentation/index.html
Normal file
31
documentation/index.html
Normal file
@ -0,0 +1,31 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<link rel="stylesheet" href="github-markdown.css">
|
||||
</head>
|
||||
<body class="markdown-body">
|
||||
<style>
|
||||
.markdown-body {
|
||||
box-sizing: border-box;
|
||||
min-width: 200px;
|
||||
max-width: 980px;
|
||||
margin: 0 auto;
|
||||
padding: 45px;
|
||||
}
|
||||
|
||||
@media (max-width: 767px) {
|
||||
.markdown-body {
|
||||
padding: 15px;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
<div class="markdown-heading"><h1 class="heading-element">Links</h1><a id="user-content-links" class="anchor" aria-label="Permalink: Links" href="#links"><span aria-hidden="true" class="octicon octicon-link"></span></a></div>
|
||||
<ul>
|
||||
<li><a href="./create_user.html">Create User</a></li>
|
||||
<li><a href="./get_user_tests.html">Get User Tests</a></li>
|
||||
<li><a href="./leaderboard.html">Leaderboard</a></li>
|
||||
<li><a href="./login.html">Login</a></li>
|
||||
<li><a href="./post_test.html">Post Test</a></li>
|
||||
</ul>
|
||||
</body>
|
||||
</html>
|
7
documentation/index.md
Normal file
7
documentation/index.md
Normal file
@ -0,0 +1,7 @@
|
||||
# Links
|
||||
|
||||
- [Create User](./create_user.md)
|
||||
- [Get User Tests](./get_user_tests.md)
|
||||
- [Leaderboard](./leaderboard.md)
|
||||
- [Login](./login.md)
|
||||
- [Post Test](./post_test.md)
|
47
documentation/leaderboard.html
Normal file
47
documentation/leaderboard.html
Normal file
@ -0,0 +1,47 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<link rel="stylesheet" href="github-markdown.css">
|
||||
</head>
|
||||
<body class="markdown-body">
|
||||
<style>
|
||||
.markdown-body {
|
||||
box-sizing: border-box;
|
||||
min-width: 200px;
|
||||
max-width: 980px;
|
||||
margin: 0 auto;
|
||||
padding: 45px;
|
||||
}
|
||||
|
||||
@media (max-width: 767px) {
|
||||
.markdown-body {
|
||||
padding: 15px;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
<div class="markdown-heading"><h1 class="heading-element">Leaderboard</h1><a id="user-content-leaderboard" class="anchor" aria-label="Permalink: Leaderboard" href="#leaderboard"><span aria-hidden="true" class="octicon octicon-link"></span></a></div>
|
||||
<p>This API endpoint retrieves the highest test data from each user and returns it as a JSON array.</p>
|
||||
<div class="markdown-heading"><h2 class="heading-element">Endpoint</h2><a id="user-content-endpoint" class="anchor" aria-label="Permalink: Endpoint" href="#endpoint"><span aria-hidden="true" class="octicon octicon-link"></span></a></div>
|
||||
<pre><code>GET /api/leaderboard
|
||||
</code></pre>
|
||||
<div class="markdown-heading"><h2 class="heading-element">Request Parameters</h2><a id="user-content-request-parameters" class="anchor" aria-label="Permalink: Request Parameters" href="#request-parameters"><span aria-hidden="true" class="octicon octicon-link"></span></a></div>
|
||||
<p>This endpoint does not require any request parameters.</p>
|
||||
<div class="markdown-heading"><h2 class="heading-element">Example Request</h2><a id="user-content-example-request" class="anchor" aria-label="Permalink: Example Request" href="#example-request"><span aria-hidden="true" class="octicon octicon-link"></span></a></div>
|
||||
<div class="highlight highlight-source-shell"><pre>curl -X GET <span class="pl-s"><span class="pl-pds">"</span>https://example.com/api/leaderboard<span class="pl-pds">"</span></span></pre></div>
|
||||
<div class="markdown-heading"><h2 class="heading-element">Response</h2><a id="user-content-response" class="anchor" aria-label="Permalink: Response" href="#response"><span aria-hidden="true" class="octicon octicon-link"></span></a></div>
|
||||
<div class="highlight highlight-source-json"><pre>[
|
||||
{
|
||||
<span class="pl-ent">"userName"</span>: <span class="pl-s"><span class="pl-pds">"</span>user_1<span class="pl-pds">"</span></span>,
|
||||
<span class="pl-ent">"wpm"</span>: <span class="pl-c1">85</span>,
|
||||
},
|
||||
{
|
||||
<span class="pl-ent">"userName"</span>: <span class="pl-s"><span class="pl-pds">"</span>user_2<span class="pl-pds">"</span></span>,
|
||||
<span class="pl-ent">"score"</span>: <span class="pl-c1">80</span>,
|
||||
},
|
||||
{
|
||||
<span class="pl-ent">"userName"</span>: <span class="pl-s"><span class="pl-pds">"</span>user_3<span class="pl-pds">"</span></span>,
|
||||
<span class="pl-ent">"wpm"</span>: <span class="pl-c1">73</span>,
|
||||
}
|
||||
]</pre></div>
|
||||
</body>
|
||||
</html>
|
56
documentation/login.html
Normal file
56
documentation/login.html
Normal file
@ -0,0 +1,56 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<link rel="stylesheet" href="github-markdown.css">
|
||||
</head>
|
||||
<body class="markdown-body">
|
||||
<style>
|
||||
.markdown-body {
|
||||
box-sizing: border-box;
|
||||
min-width: 200px;
|
||||
max-width: 980px;
|
||||
margin: 0 auto;
|
||||
padding: 45px;
|
||||
}
|
||||
|
||||
@media (max-width: 767px) {
|
||||
.markdown-body {
|
||||
padding: 15px;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
<div class="markdown-heading"><h1 class="heading-element">Login</h1><a id="user-content-login" class="anchor" aria-label="Permalink: Login" href="#login"><span aria-hidden="true" class="octicon octicon-link"></span></a></div>
|
||||
<p>Authenticates a user and returns their user ID along with a secret key.
|
||||
Endpoint</p>
|
||||
<div class="highlight highlight-source-js"><pre><span class="pl-c1">GET</span> <span class="pl-c1">/</span><span class="pl-s1">api</span><span class="pl-c1">/</span><span class="pl-s1">login</span><span class="pl-c1">/</span><span class="pl-c1"><</span><span class="pl-ent">username</span><span class="pl-c1">></span>/<span class="pl-c1"><</span><span class="pl-ent">password</span><span class="pl-c1">></span></pre></div>
|
||||
<div class="markdown-heading"><h2 class="heading-element">Parameters</h2><a id="user-content-parameters" class="anchor" aria-label="Permalink: Parameters" href="#parameters"><span aria-hidden="true" class="octicon octicon-link"></span></a></div>
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Parameter</th>
|
||||
<th>Type</th>
|
||||
<th>Description</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>username</td>
|
||||
<td>String</td>
|
||||
<td>Username of the user</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>password</td>
|
||||
<td>String</td>
|
||||
<td>Password of the user</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<div class="markdown-heading"><h2 class="heading-element">Example Request</h2><a id="user-content-example-request" class="anchor" aria-label="Permalink: Example Request" href="#example-request"><span aria-hidden="true" class="octicon octicon-link"></span></a></div>
|
||||
<div class="highlight highlight-source-shell"><pre>curl -X GET <span class="pl-s"><span class="pl-pds">"</span>https://example.com/api/login/example_user/example_password<span class="pl-pds">"</span></span></pre></div>
|
||||
<div class="markdown-heading"><h2 class="heading-element">Example Response</h2><a id="user-content-example-response" class="anchor" aria-label="Permalink: Example Response" href="#example-response"><span aria-hidden="true" class="octicon octicon-link"></span></a></div>
|
||||
<div class="highlight highlight-source-json"><pre>{
|
||||
<span class="pl-ent">"user_id"</span>: <span class="pl-c1">123</span>,
|
||||
<span class="pl-ent">"secret"</span>: <span class="pl-s"><span class="pl-pds">"</span>random_secret_key<span class="pl-pds">"</span></span>
|
||||
}</pre></div>
|
||||
</body>
|
||||
</html>
|
18
documentation/markdown-to-html.sh
Executable file
18
documentation/markdown-to-html.sh
Executable file
@ -0,0 +1,18 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Read markdown content from file
|
||||
markdown_content=$(cat $1)
|
||||
|
||||
# Convert markdown to HTML
|
||||
html_content=$(gh api \
|
||||
--method POST \
|
||||
-H "Accept: application/vnd.github+json" \
|
||||
-H "X-GitHub-Api-Version: 2022-11-28" \
|
||||
/markdown \
|
||||
-f text="$markdown_content"
|
||||
)
|
||||
|
||||
# Write HTML content to file
|
||||
echo "$html_content" > $2
|
||||
|
||||
echo "Conversion completed. HTML content written to $2"
|
113
documentation/post_test.html
Normal file
113
documentation/post_test.html
Normal file
@ -0,0 +1,113 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<link rel="stylesheet" href="github-markdown.css">
|
||||
</head>
|
||||
<body class="markdown-body">
|
||||
<style>
|
||||
.markdown-body {
|
||||
box-sizing: border-box;
|
||||
min-width: 200px;
|
||||
max-width: 980px;
|
||||
margin: 0 auto;
|
||||
padding: 45px;
|
||||
}
|
||||
|
||||
@media (max-width: 767px) {
|
||||
.markdown-body {
|
||||
padding: 15px;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
<p>Post Test Data This API endpoint allows you to post test data, recording the results of a test taken by a user.</p>
|
||||
<div class="markdown-heading"><h1 class="heading-element">Endpoint</h1><a id="user-content-endpoint" class="anchor" aria-label="Permalink: Endpoint" href="#endpoint"><span aria-hidden="true" class="octicon octicon-link"></span></a></div>
|
||||
<pre><code>POST /api/post_test
|
||||
</code></pre>
|
||||
<div class="markdown-heading"><h1 class="heading-element">Request Parameters</h1><a id="user-content-request-parameters" class="anchor" aria-label="Permalink: Request Parameters" href="#request-parameters"><span aria-hidden="true" class="octicon octicon-link"></span></a></div>
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Parameter</th>
|
||||
<th align="center">Type</th>
|
||||
<th>Description</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>testType</td>
|
||||
<td align="center">String</td>
|
||||
<td>Type of the test (e.g., "typing", "multiple choice")</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>testLength</td>
|
||||
<td align="center">Integer</td>
|
||||
<td>Length of the test in number of items or questions</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>testTime</td>
|
||||
<td align="center">Integer</td>
|
||||
<td>Duration of the test in seconds</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>testSeed</td>
|
||||
<td align="center">String</td>
|
||||
<td>Seed for generating randomized test content</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>quoteId</td>
|
||||
<td align="center">String</td>
|
||||
<td>Identifier for a specific quote, if applicable</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>wpm</td>
|
||||
<td align="center">Integer</td>
|
||||
<td>Words per minute (typing speed)</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>accuracy</td>
|
||||
<td align="center">Integer</td>
|
||||
<td>Accuracy of responses (e.g., percentage)</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>userId</td>
|
||||
<td align="center">String</td>
|
||||
<td>Identifier of the user taking the test</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>secret</td>
|
||||
<td align="center">String</td>
|
||||
<td>Secret key for authentication and authorization</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<div class="markdown-heading"><h1 class="heading-element">Example Request</h1><a id="user-content-example-request" class="anchor" aria-label="Permalink: Example Request" href="#example-request"><span aria-hidden="true" class="octicon octicon-link"></span></a></div>
|
||||
<div class="highlight highlight-source-shell"><pre>curl -X POST <span class="pl-s"><span class="pl-pds">"</span>https://example.com/api/post_test<span class="pl-pds">"</span></span> \
|
||||
-H <span class="pl-s"><span class="pl-pds">"</span>Content-Type: application/json<span class="pl-pds">"</span></span> <span class="pl-cce">\ </span>
|
||||
-d <span class="pl-s"><span class="pl-pds">'</span>{ </span>
|
||||
<span class="pl-s"> "testType": "typing", </span>
|
||||
<span class="pl-s"> "testLength": 100, </span>
|
||||
<span class="pl-s"> "testTime": 600, </span>
|
||||
<span class="pl-s"> "testSeed": "random_seed_123", </span>
|
||||
<span class="pl-s"> "quoteId": "quote_456", </span>
|
||||
<span class="pl-s"> "wpm": 65.5, </span>
|
||||
<span class="pl-s"> "accuracy": 98.2, </span>
|
||||
<span class="pl-s"> "userId": "user_789", </span>
|
||||
<span class="pl-s"> "secret": "your_secret_key_here" </span>
|
||||
<span class="pl-s"> }<span class="pl-pds">'</span></span></pre></div>
|
||||
<div class="markdown-heading"><h1 class="heading-element">Example Response</h1><a id="user-content-example-response" class="anchor" aria-label="Permalink: Example Response" href="#example-response"><span aria-hidden="true" class="octicon octicon-link"></span></a></div>
|
||||
<p>Upon successful submission, you will receive a JSON response with the following structure:</p>
|
||||
<div class="highlight highlight-source-json"><pre>{
|
||||
<span class="pl-ent">"status"</span>: <span class="pl-s"><span class="pl-pds">"</span>success<span class="pl-pds">"</span></span>,
|
||||
<span class="pl-ent">"message"</span>: <span class="pl-s"><span class="pl-pds">"</span>Test results successfully recorded<span class="pl-pds">"</span></span>,
|
||||
<span class="pl-ent">"testId"</span>: <span class="pl-s"><span class="pl-pds">"</span>test_123456789<span class="pl-pds">"</span></span>
|
||||
}</pre></div>
|
||||
<ul>
|
||||
<li>
|
||||
<code>status</code>: Indicates the status of the request (either "success" or "error").</li>
|
||||
<li>
|
||||
<code>message</code>: Describes the outcome of the request.</li>
|
||||
<li>
|
||||
<code>testId</code>: Unique identifier assigned to the recorded test data.</li>
|
||||
</ul>
|
||||
</body>
|
||||
</html>
|
Loading…
Reference in New Issue
Block a user