From 3649eb2c95aec8d2e55d35110bf0e1c85254ef38 Mon Sep 17 00:00:00 2001 From: Luke Bennett Date: Sun, 13 Jun 2021 02:36:50 +0100 Subject: [PATCH 1/6] docs: fix param syntax and improve body desc --- help.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/help.md b/help.md index c4a15ef..feaa136 100644 --- a/help.md +++ b/help.md @@ -24,7 +24,7 @@ # Meta Usage | Name | Path | Method | A | Description | | :------------: | :------------------------------------- | :----: | :---: | ---------------------------------------------------------------------------------------------------------------------------------------- | -| ChangePassword | BankF/{name}/pass/change | PATCH | true | if the password supplied in the header matches the user `{name}`'s password, the user's password is changed to the one given in the body | +| ChangePassword | BankF/{name}/pass/change | PATCH | true | if the password supplied in the header matches the user `{name}`'s password, the user's password is changed to the one given in the body, with a key of `password`. i.e. { "password": "NewPassword" } | | SetBal | BankF/admin/{name}/bal/amount={amount} | PATCH | true | sets the balance of a give user `{name}` if the supplied password matches the admin password | # System Usage @@ -40,6 +40,6 @@ | Name | Path | Method | A | Description | | :----------: | :------------------------------------------ | :----: | :---: | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | AddUser | BankF/user/{name} | POST | true | registers a user with the name `{name}`, balance of 0 and a password of the password supplied in the header | -| AdminAddUser | BankF/admin/user/{name}?init_bal={init_bal} | POST | true | if the password supplied in the header matches the admin password, then it registers a user with the name `{name}`, balance of `init_bal` and a password supplied by the body of the request | +| AdminAddUser | BankF/admin/user/{name}?init_bal={init_bal} | POST | true | if the password supplied in the header matches the admin password, then it registers a user with the name `{name}`, balance of `init_bal` and a password that is supplied in the body of the request. i.e. { "password": "ThePassword" } | | DelUser | BankF/user/{name} | DELETE | true | if the password supplied in the header matches the user `{name}`'s password, then the user is deleted | -| AdminDelUser | BankF/admin/user/{name} | DELETE | true | if the password supplied in the header matches the admin password, then the user is deleted | \ No newline at end of file +| AdminDelUser | BankF/admin/user/{name} | DELETE | true | if the password supplied in the header matches the admin password, then the user is deleted | From d90f0dc9ba1f4a7c017149056f0ea823791736b4 Mon Sep 17 00:00:00 2001 From: Luke Bennett Date: Sun, 13 Jun 2021 21:52:58 +0100 Subject: [PATCH 2/6] docs: format help.md with prettier --- help.md | 29 +++++++++++++++++------------ 1 file changed, 17 insertions(+), 12 deletions(-) diff --git a/help.md b/help.md index feaa136..f14f439 100644 --- a/help.md +++ b/help.md @@ -10,10 +10,12 @@ | -6 | InsufficientFunds | # Things of Note -* all endpoints respond with **JSON** file type -* "**A**" denotes requiring Authentication in the form of a header titled "**Password**" + +- all endpoints respond with **JSON** file type +- "**A**" denotes requiring Authentication in the form of a header titled "**Password**" # Usage + | Name | Path | Method | A | Description | | :------------: | :------------------------------------- | :----: | :---: | -------------------------------------------------------------------------------------------------- | | GetBal | BankF/{name}/bal | GET | false | returns the balance of a given user `{name}` | @@ -22,12 +24,14 @@ | VerifyPassword | BankF/{name}/pass/verify | GET | true | returns `1` if the supplied user `{name}`'s password matches the password supplied in the header | # Meta Usage -| Name | Path | Method | A | Description | -| :------------: | :------------------------------------- | :----: | :---: | ---------------------------------------------------------------------------------------------------------------------------------------- | -| ChangePassword | BankF/{name}/pass/change | PATCH | true | if the password supplied in the header matches the user `{name}`'s password, the user's password is changed to the one given in the body, with a key of `password`. i.e. { "password": "NewPassword" } | -| SetBal | BankF/admin/{name}/bal/amount={amount} | PATCH | true | sets the balance of a give user `{name}` if the supplied password matches the admin password | + +| Name | Path | Method | A | Description | +| :------------: | :------------------------------------- | :----: | :--: | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| ChangePassword | BankF/{name}/pass/change | PATCH | true | if the password supplied in the header matches the user `{name}`'s password, the user's password is changed to the one given in the body, with a key of `password`. i.e. { "password": "NewPassword" } | +| SetBal | BankF/admin/{name}/bal/amount={amount} | PATCH | true | sets the balance of a give user `{name}` if the supplied password matches the admin password | # System Usage + | Name | Path | Method | A | Description | | :-------------: | :-------------------- | :----: | :---: | ------------------------------------------------------------------------------------- | | Help | BankF/help | GET | false | the page you're looking at right now! | @@ -37,9 +41,10 @@ | AdminVerifyPass | BankF/admin/verify | GET | true | returns `1` if the password supplied in the header matches the admin password | # User Management -| Name | Path | Method | A | Description | -| :----------: | :------------------------------------------ | :----: | :---: | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| AddUser | BankF/user/{name} | POST | true | registers a user with the name `{name}`, balance of 0 and a password of the password supplied in the header | -| AdminAddUser | BankF/admin/user/{name}?init_bal={init_bal} | POST | true | if the password supplied in the header matches the admin password, then it registers a user with the name `{name}`, balance of `init_bal` and a password that is supplied in the body of the request. i.e. { "password": "ThePassword" } | -| DelUser | BankF/user/{name} | DELETE | true | if the password supplied in the header matches the user `{name}`'s password, then the user is deleted | -| AdminDelUser | BankF/admin/user/{name} | DELETE | true | if the password supplied in the header matches the admin password, then the user is deleted | + +| Name | Path | Method | A | Description | +| :----------: | :------------------------------------------ | :----: | :--: | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| AddUser | BankF/user/{name} | POST | true | registers a user with the name `{name}`, balance of 0 and a password of the password supplied in the header | +| AdminAddUser | BankF/admin/user/{name}?init_bal={init_bal} | POST | true | if the password supplied in the header matches the admin password, then it registers a user with the name `{name}`, balance of `init_bal` and a password that is supplied in the body of the request. i.e. { "password": "ThePassword" } | +| DelUser | BankF/user/{name} | DELETE | true | if the password supplied in the header matches the user `{name}`'s password, then the user is deleted | +| AdminDelUser | BankF/admin/user/{name} | DELETE | true | if the password supplied in the header matches the admin password, then the user is deleted | From a988dab36121953fb4f4986ec8b7cb79eccd7af6 Mon Sep 17 00:00:00 2001 From: Luke Bennett Date: Sun, 13 Jun 2021 21:54:47 +0100 Subject: [PATCH 3/6] docs(help): explain where log length is configured --- help.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/help.md b/help.md index f14f439..8db4393 100644 --- a/help.md +++ b/help.md @@ -19,7 +19,7 @@ | Name | Path | Method | A | Description | | :------------: | :------------------------------------- | :----: | :---: | -------------------------------------------------------------------------------------------------- | | GetBal | BankF/{name}/bal | GET | false | returns the balance of a given user `{name}` | -| GetLog | BankF/{name}/log | GET | true | returns a list of last `n` number of transactions (a configurable amount) of a given user `{name}` | +| GetLog | BankF/{name}/log | GET | true | returns a list of last `n` number of transactions (configurable in CCash webserver) of a given user `{name}` | | SendFunds | BankF/{name}/send/{to}/amount={amount} | POST | true | sends `{amount}` from user `{name}` to user `{to}` | | VerifyPassword | BankF/{name}/pass/verify | GET | true | returns `1` if the supplied user `{name}`'s password matches the password supplied in the header | From ce16d5f5aeba452c6432cffc659ea4d3d48761a9 Mon Sep 17 00:00:00 2001 From: Luke Bennett Date: Sun, 13 Jun 2021 21:55:00 +0100 Subject: [PATCH 4/6] docs: format help.md with prettier --- help.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/help.md b/help.md index 8db4393..d91ee74 100644 --- a/help.md +++ b/help.md @@ -16,12 +16,12 @@ # Usage -| Name | Path | Method | A | Description | -| :------------: | :------------------------------------- | :----: | :---: | -------------------------------------------------------------------------------------------------- | -| GetBal | BankF/{name}/bal | GET | false | returns the balance of a given user `{name}` | +| Name | Path | Method | A | Description | +| :------------: | :------------------------------------- | :----: | :---: | ------------------------------------------------------------------------------------------------------------ | +| GetBal | BankF/{name}/bal | GET | false | returns the balance of a given user `{name}` | | GetLog | BankF/{name}/log | GET | true | returns a list of last `n` number of transactions (configurable in CCash webserver) of a given user `{name}` | -| SendFunds | BankF/{name}/send/{to}/amount={amount} | POST | true | sends `{amount}` from user `{name}` to user `{to}` | -| VerifyPassword | BankF/{name}/pass/verify | GET | true | returns `1` if the supplied user `{name}`'s password matches the password supplied in the header | +| SendFunds | BankF/{name}/send/{to}/amount={amount} | POST | true | sends `{amount}` from user `{name}` to user `{to}` | +| VerifyPassword | BankF/{name}/pass/verify | GET | true | returns `1` if the supplied user `{name}`'s password matches the password supplied in the header | # Meta Usage From 4ce87f4aa13f3a9dc6575bb5b9c2e63c1b33b9ff Mon Sep 17 00:00:00 2001 From: Luke Bennett Date: Sun, 13 Jun 2021 22:02:37 +0100 Subject: [PATCH 5/6] docs(help): correct password as body explaination --- help.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/help.md b/help.md index d91ee74..d30e3df 100644 --- a/help.md +++ b/help.md @@ -27,7 +27,7 @@ | Name | Path | Method | A | Description | | :------------: | :------------------------------------- | :----: | :--: | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -| ChangePassword | BankF/{name}/pass/change | PATCH | true | if the password supplied in the header matches the user `{name}`'s password, the user's password is changed to the one given in the body, with a key of `password`. i.e. { "password": "NewPassword" } | +| ChangePassword | BankF/{name}/pass/change | PATCH | true | if the password supplied in the header matches the user `{name}`'s password, the user's password is changed to the one given as the body | | SetBal | BankF/admin/{name}/bal/amount={amount} | PATCH | true | sets the balance of a give user `{name}` if the supplied password matches the admin password | # System Usage @@ -45,6 +45,6 @@ | Name | Path | Method | A | Description | | :----------: | :------------------------------------------ | :----: | :--: | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | AddUser | BankF/user/{name} | POST | true | registers a user with the name `{name}`, balance of 0 and a password of the password supplied in the header | -| AdminAddUser | BankF/admin/user/{name}?init_bal={init_bal} | POST | true | if the password supplied in the header matches the admin password, then it registers a user with the name `{name}`, balance of `init_bal` and a password that is supplied in the body of the request. i.e. { "password": "ThePassword" } | +| AdminAddUser | BankF/admin/user/{name}?init_bal={init_bal} | POST | true | if the password supplied in the header matches the admin password, then it registers a user with the name `{name}`, balance of `init_bal` and a password that is supplied as the body of the request | | DelUser | BankF/user/{name} | DELETE | true | if the password supplied in the header matches the user `{name}`'s password, then the user is deleted | | AdminDelUser | BankF/admin/user/{name} | DELETE | true | if the password supplied in the header matches the admin password, then the user is deleted | From d99e8b1adfa7d410909942705246b292a5b679cb Mon Sep 17 00:00:00 2001 From: Luke Bennett Date: Sun, 13 Jun 2021 22:02:46 +0100 Subject: [PATCH 6/6] docs: format help.md with prettier --- help.md | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/help.md b/help.md index d30e3df..543833e 100644 --- a/help.md +++ b/help.md @@ -25,10 +25,10 @@ # Meta Usage -| Name | Path | Method | A | Description | -| :------------: | :------------------------------------- | :----: | :--: | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| Name | Path | Method | A | Description | +| :------------: | :------------------------------------- | :----: | :--: | ---------------------------------------------------------------------------------------------------------------------------------------- | | ChangePassword | BankF/{name}/pass/change | PATCH | true | if the password supplied in the header matches the user `{name}`'s password, the user's password is changed to the one given as the body | -| SetBal | BankF/admin/{name}/bal/amount={amount} | PATCH | true | sets the balance of a give user `{name}` if the supplied password matches the admin password | +| SetBal | BankF/admin/{name}/bal/amount={amount} | PATCH | true | sets the balance of a give user `{name}` if the supplied password matches the admin password | # System Usage @@ -42,9 +42,9 @@ # User Management -| Name | Path | Method | A | Description | -| :----------: | :------------------------------------------ | :----: | :--: | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| AddUser | BankF/user/{name} | POST | true | registers a user with the name `{name}`, balance of 0 and a password of the password supplied in the header | +| Name | Path | Method | A | Description | +| :----------: | :------------------------------------------ | :----: | :--: | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| AddUser | BankF/user/{name} | POST | true | registers a user with the name `{name}`, balance of 0 and a password of the password supplied in the header | | AdminAddUser | BankF/admin/user/{name}?init_bal={init_bal} | POST | true | if the password supplied in the header matches the admin password, then it registers a user with the name `{name}`, balance of `init_bal` and a password that is supplied as the body of the request | -| DelUser | BankF/user/{name} | DELETE | true | if the password supplied in the header matches the user `{name}`'s password, then the user is deleted | -| AdminDelUser | BankF/admin/user/{name} | DELETE | true | if the password supplied in the header matches the admin password, then the user is deleted | +| DelUser | BankF/user/{name} | DELETE | true | if the password supplied in the header matches the user `{name}`'s password, then the user is deleted | +| AdminDelUser | BankF/admin/user/{name} | DELETE | true | if the password supplied in the header matches the admin password, then the user is deleted |