docs : documentation for new endpoints

This commit is contained in:
daragh 2023-12-31 02:42:25 +00:00
parent 79edb50f65
commit c72ade8dab
No known key found for this signature in database
2 changed files with 65 additions and 2 deletions

View file

@ -179,13 +179,76 @@ Errors:
```json
{"result": "error", "error": "no valid key"}
```
#### Success
```json
{"result": "success", "success": "key valid"}
```
### POST /ldap/ssh
Returns array of SSH keys associated with the Skynet account
```json
{
"auth" : {
"user": "username",
"pass": "password"
}
}
```
#### Errors
```json
{"result": "error", "error": "Failed to authenticate"}
```
#### Success
```json
{"result": "success", "success": ["key1","key2","key3"]}
```
### DELETE /ldap/ssh
Deletes SSH key from Skynet account
```json
{
"auth" : {
"user": "username",
"pass": "password"
},
"key": "ssh key"
}
```
#### Errors
```json
{"result": "error", "error": "Failed to authenticate"}
```
```json
{"result": "error", "error": "Failed to remove key"}
```
#### Success
```json
{"result": "success"}
```
### POST /ldap/ssh/add
Adds SSH key to Skynet account
```json
{
"auth" : {
"user": "username",
"pass": "password"
},
"key": "ssh key"
}
```
#### Errors
```json
{"result": "error", "error": "Failed to authenticate"}
```
```json
{"result": "error", "error": "Failed to add key"}
```
#### Success
```json
{"result": "success"}
```
## Responses
Generic responses which is used unless otherwise specified above.

View file

@ -64,7 +64,7 @@ pub async fn remove_ssh_key(mut req: Request<State>) -> tide::Result {
Ok(_) => Ok(json!({"result": "success"}).into()),
Err(e) => {
dbg!(e);
Ok(json!({"result": "error", "error": "Failed to add key"}).into())
Ok(json!({"result": "error", "error": "Failed to remove key"}).into())
}
};