new docs!

This commit is contained in:
EntireTwix 2021-06-09 23:50:15 -07:00
parent 179deb85cc
commit 169a13be2e

283
help.html
View file

@ -1,85 +1,198 @@
<body> <h1 class="code-line" data-line-start=0 data-line-end=1 ><a id="Error_Responses_0"></a>Error Responses</h1>
<h1>ALL FUNCTIONS (that have args) ARE EXPECTING JSON AS DATA TYPE</h1> <table class="table table-striped table-bordered">
<h2>/BankF/<span style="color: #993300;">admin</span>/close (POST)</h2> <thead>
<p><span style="background-color: #808080;">&nbsp;attempt&nbsp;</span> - admin password</p> <tr>
<blockquote> <th>#</th>
<p>Closes and Saves the server.</p> <th>meaning</th>
</blockquote> </tr>
<h2>/BankF/user (POST)</h2> </thead>
<p><span style="background-color: #808080;">&nbsp;name&nbsp;</span> - name of the user being added (must be less then 50 characters)</p> <tbody>
<p><span style="background-color: #808080;">&nbsp;init_pass&nbsp;</span> - initial password for the user being added</p> <tr>
<blockquote> <td>-1</td>
<p>Adds a user to the bank</p> <td>UserNotFound</td>
</blockquote> </tr>
<h2>/BankF/<span style="color: #993300;">admin</span>/user (POST)</h2> <tr>
<p><span style="background-color: #808080;">&nbsp;name&nbsp;</span> - name of the user being added</p> <td>-2</td>
<p><span style="background-color: #808080;">&nbsp;attempt&nbsp;</span> - admin password required to add user with balance</p> <td>WrongPassword</td>
<p><span style="background-color: #808080;">&nbsp;init_bal&nbsp;</span> - initial balance for user being added</p> </tr>
<p><span style="background-color: #808080;">&nbsp;init_pass&nbsp;</span> - initial password for user being added</p> <tr>
<blockquote> <td>-3</td>
<p>Adds a user with initial balance</p> <td>InvalidRequest</td>
</blockquote> </tr>
<h2>/BankF/sendfunds (POST)</h2> <tr>
<p><span style="background-color: #808080;">&nbsp;a_name&nbsp;</span> - sender's name</p> <td>-4</td>
<p><span style="background-color: #808080;">&nbsp;b_name&nbsp;</span> - reciever's name</p> <td>WrongAdminPassword</td>
<p><span style="background-color: #808080;">&nbsp;amount&nbsp;</span> - amount being sent</p> </tr>
<p><span style="background-color: #808080;">&nbsp;attempt&nbsp;</span> - password of sender</p> <tr>
<blockquote> <td>-5</td>
<p>Sends money from one user to another</p> <td>NameTooLong</td>
</blockquote> </tr>
<h2>/BankF/changepass (PATCH)</h2> <tr>
<p><span style="background-color: #808080;">&nbsp;name&nbsp;</span> - name of user's password being changes</p> <td>-6</td>
<p><span style="background-color: #808080;">&nbsp;attempt&nbsp;</span> - password of user being changed</p> <td>UserAlreadyExists</td>
<p><span style="background-color: #808080;">&nbsp;new_pass&nbsp;</span> - new password to replace the current user's password</p> </tr>
<blockquote> <tr>
<p>Changes password of a user, returns -1 if user doesnt exist</p> <td>-7</td>
</blockquote> <td>InsufficientFunds</td>
<h2>/BankF/<span style="color: #993300;">admin</span>/{<span style="color: #339966;">name</span>}/bal (PATCH)</h2> </tr>
<p><span style="background-color: #808080;">&nbsp;name&nbsp;</span> - the name of the user being set</p> </tbody>
<p><span style="background-color: #808080;">&nbsp;attempt&nbsp;</span> - the admin password required</p> </table>
<p><span style="background-color: #808080;">&nbsp;amount&nbsp;</span> - the new balance of the user</p> <h1 class="code-line" data-line-start=12 data-line-end=13 ><a id="Things_of_Note_12"></a>Things of Note</h1>
<blockquote> <ul>
<p>Sets the balance of a user</p> <li class="has-line-data" data-line-start="13" data-line-end="14">all endpoints respond with <strong>JSON</strong> file type</li>
</blockquote> <li class="has-line-data" data-line-start="14" data-line-end="16">&quot;<strong>A</strong>&quot; denotes requiring Authentication in the form of a header titled &quot;<strong>Password</strong>&quot;</li>
<h2>/BankF/help (GET)</h2> </ul>
<blockquote> <h1 class="code-line" data-line-start=16 data-line-end=17 ><a id="Usage_16"></a>Usage</h1>
<p>the page you're looking at right now!</p> <table class="table table-striped table-bordered">
</blockquote> <thead>
<h2>/BankF/vpass (POST)</h2> <tr>
<p><span style="background-color: #808080;">&nbsp;name&nbsp;</span> - name of user being verified</p> <th style="text-align:center">Name</th>
<p><span style="background-color: #808080;">&nbsp;attempt&nbsp;</span> - password being verified</p> <th style="text-align:left">Path</th>
<blockquote> <th style="text-align:center">Method</th>
<p>returns 0 or 1 based on if [attempt] is equal to the password of the user [name], or -1 if user does not exist. The intended usage for this function is for connected services</p> <th style="text-align:center">A</th>
</blockquote> <th>Description</th>
<h2>/BankF/contains/{<span style="color: #339966;">name</span>} (GET)</h2> </tr>
<blockquote> </thead>
<p>returns a 0 or 1 based on if the bank contains the user</p> <tbody>
</blockquote> <tr>
<h2>/BankF/{<span style="color: #339966;">name</span>}/bal (GET)</h2> <td style="text-align:center">GetBal</td>
<blockquote> <td style="text-align:left">/{name}/bal</td>
<p>returns the balance of a given user's name, if -1 that means the user does not exist</p> <td style="text-align:center">GET</td>
</blockquote> <td style="text-align:center">true</td>
<h2>/BankF/<span style="color: #993300;">admin</span>/vpass (POST)</h2> <td>returns the balance of a given user <code>{name}</code></td>
<p><span style="background-color: #808080;">&nbsp;attempt&nbsp;</span> - admin password</p> </tr>
<blockquote> <tr>
<p>Verifies if password entered is admin password</p> <td style="text-align:center">GetLog</td>
</blockquote> <td style="text-align:left">/{name}/log</td>
<h2>/BankF/{<span style="color: #339966;">name</span>}/log (POST)</h2> <td style="text-align:center">GET</td>
<p><span style="background-color: #808080;">&nbsp;attempt&nbsp;</span> - user password</p> <td style="text-align:center">true</td>
<blockquote> <td>returns a list of last <code>n</code> number of transactions (a configurable amount) of a given user <code>{name}</code></td>
<p>returns a list of last 100 transactions, -1 if user not found, 0 if invalid password</p> </tr>
</blockquote> <tr>
<h2>/BankF/user (DELETE)</h2> <td style="text-align:center">SendFunds</td>
<p><span style="background-color: #808080;">&nbsp;name&nbsp;</span> - name of user being deleted</p> <td style="text-align:left">/{name}/send/{to}/amount={amount}</td>
<p><span style="background-color: #808080;">&nbsp;attempt&nbsp;</span> - password of user being deleted</p> <td style="text-align:center">POST</td>
<blockquote> <td style="text-align:center">false</td>
<p>Deletes a user with the password of the user as verification</p> <td>sends <code>{amount}</code> from user <code>{name}</code> to user <code>{to}</code></td>
</blockquote> </tr>
<h2>/BankF/<span style="color: #993300;">admin</span>/user (DELETE)</h2> <tr>
<p><span style="background-color: #808080;">&nbsp;name&nbsp;</span> - name of user being deleted</p> <td style="text-align:center">VerifyPassword</td>
<p><span style="background-color: #808080;">&nbsp;attempt&nbsp;</span> - admin password</p> <td style="text-align:left">/{name}/pass/verify</td>
<blockquote> <td style="text-align:center">GET</td>
<p>Deletes a user with admin password as verification</p> <td style="text-align:center">true</td>
</blockquote> <td>returns <code>true</code> or <code>false</code> depending on if the supplied user <code>{name}</code>'s password matches the password supplied in the header</td>
</body> </tr>
</tbody>
</table>
<h1 class="code-line" data-line-start=24 data-line-end=25 ><a id="Meta_Usage_24"></a>Meta Usage</h1>
<table class="table table-striped table-bordered">
<thead>
<tr>
<th style="text-align:center">Name</th>
<th style="text-align:left">Path</th>
<th style="text-align:center">Method</th>
<th style="text-align:center">A</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align:center">ChangePassword</td>
<td style="text-align:left">/{name}/pass/change</td>
<td style="text-align:center">PATCH</td>
<td style="text-align:center">true</td>
<td>if the password supplied in the header matches the user <code>{name}</code>'s password, the users password is changed to the one given in the body</td>
</tr>
<tr>
<td style="text-align:center">SetBal</td>
<td style="text-align:left">/admin/{name}/bal/amount={amount}</td>
<td style="text-align:center">PATCH</td>
<td style="text-align:center">true</td>
<td>sets the balance of a give user <code>{name}</code> if the supplied password matches the admin password</td>
</tr>
</tbody>
</table>
<h1 class="code-line" data-line-start=30 data-line-end=31 ><a id="System_Usage_30"></a>System Usage</h1>
<table class="table table-striped table-bordered">
<thead>
<tr>
<th style="text-align:center">Name</th>
<th style="text-align:left">Path</th>
<th style="text-align:center">Method</th>
<th style="text-align:center">A</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align:center">Help</td>
<td style="text-align:left">/help</td>
<td style="text-align:center">GET</td>
<td style="text-align:center">false</td>
<td>the page youre looking at right now!</td>
</tr>
<tr>
<td style="text-align:center">Close</td>
<td style="text-align:left">/admin/close</td>
<td style="text-align:center">POST</td>
<td style="text-align:center">true</td>
<td>saves and then closes the program if the supplied password matches the admin password</td>
</tr>
<tr>
<td style="text-align:center">Contains</td>
<td style="text-align:left">/contains/{name}</td>
<td style="text-align:center">GET</td>
<td style="text-align:center">false</td>
<td>returns <code>true</code> or <code>false</code> depending on if the supplied user <code>{name}</code> exists</td>
</tr>
<tr>
<td style="text-align:center">AdminVerifyPass</td>
<td style="text-align:left">/admin/verify</td>
<td style="text-align:center">GET</td>
<td style="text-align:center">true</td>
<td>returns <code>true</code> or <code>false</code> depending on if the password supplied in the header matches the admin password</td>
</tr>
</tbody>
</table>
<h1 class="code-line" data-line-start=38 data-line-end=39 ><a id="User_Management_38"></a>User Management</h1>
<table class="table table-striped table-bordered">
<thead>
<tr>
<th style="text-align:center">Name</th>
<th style="text-align:left">Path</th>
<th style="text-align:center">Method</th>
<th style="text-align:center">A</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align:center">AddUser</td>
<td style="text-align:left">/user/{name}</td>
<td style="text-align:center">POST</td>
<td style="text-align:center">true</td>
<td>registers a user with the name <code>{name}</code>, balance of 0 and a password of the password supplied in the header</td>
</tr>
<tr>
<td style="text-align:center">AdminAddUser</td>
<td style="text-align:left">/admin/user/{name}?init_bal={init_bal}</td>
<td style="text-align:center">POST</td>
<td style="text-align:center">true</td>
<td>if the password supplied in the header matches the admin password, then it registers a user with the name <code>{name}</code>, balance of <code>init_bal</code> and a password supplied by the body of the request</td>
</tr>
<tr>
<td style="text-align:center">DelUser</td>
<td style="text-align:left">/user/{name}</td>
<td style="text-align:center">DELETE</td>
<td style="text-align:center">true</td>
<td>if the password supplied in the header matches the user <code>{name}</code>'s password, then the user is deleted</td>
</tr>
<tr>
<td style="text-align:center">AdminDelUser</td>
<td style="text-align:left">/admin/user/{name}</td>
<td style="text-align:center">DELETE</td>
<td style="text-align:center">true</td>
<td>if the password supplied in the header matches the admin password, then the user is deleted</td>
</tr>
</tbody>
</table>