Test outlet is now functional
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
NADAL Jean-Baptiste
2020-02-24 16:39:30 +01:00
parent e4de72a4f6
commit 8e7e94568f
14 changed files with 456 additions and 81 deletions

13
docs/api/README.md Normal file
View File

@@ -0,0 +1,13 @@
# Domo API documentation
## Quick overview
This documentation allow you to control the domo system.
## API design
- http://dev.enchant.com/api/v1
- http://www.vinaysahni.com/best-practices-for-a-pragmatic-restful-api#useful-post-responses
- https://restfulapi.net/resource-naming/

77
docs/api/test-rest-api.md Normal file
View File

@@ -0,0 +1,77 @@
# Test all the REST API of domo.
## Outlets
### list
```
curl -v http://localhost:34000/v1/outlets
```
```json
{
"id": "",
"outlets": [
{
"id": 1,
"name": "Bureau JB",
"sender": 12797322,
"speech_name": "bureau",
"state": true,
"switch": 0
},
{
"id": 2,
"name": "Salon",
"sender": 12797322,
"speech_name": "salon",
"state": false,
"switch": 1
},
{
"id": 3,
"name": "Sapin",
"sender": 12797322,
"speech_name": "sapin",
"state": false,
"switch": 2
}
],
"response_code": 200,
"status": "passed"
}
```
### read
```
curl -v http://localhost:34000/v1/outlets/2
```
```json
{
"id": 2,
"name": "Salon",
"sender": 12797322,
"speech_name": "salon",
"state": false,
"switch": 1
}
```
### create
```
curl -X POST -v http://localhost:34000/v1/outlets -d "{\"name\":\"test\", \"sender\": 12797322, \"switch\": 4}"
```
### update
```
curl -X PUT -v http://localhost:34000/v1/outlets/4 -d "{\"name\":\"test1\", \"sender\": 1, \"switch\": 2}"
```
### delete
```
curl -v http://localhost:34000/v1/outlets/2
```

238
docs/api/tests-ubus-api.md Normal file
View File

@@ -0,0 +1,238 @@
# Test all the ubus API of domo.
## domo.capabilities
### list
```
./usr/bin/ubus call domo.capabilities list
```
```json
{
"capabilities": [
{
"name": "outlets",
"speech_name": "lumière"
},
{
"name": "shutters",
"speech_name": "volet"
},
{
"name": "sprinklers",
"speech_name": "station"
}
]
}
```
## domo.outlets
### create
```
./usr/bin/ubus call domo.outlets create "{\"name\":\"test\", \"sender\": 12797322, \"switch\": 4}"
```
#### create failed 1
Name is missing.
```
./usr/bin/ubus call domo.outlets create "{\"sender\": 12797322, \"switch\": 4}"
./usr/bin/ubus call domo.outlets create "{\"name\":\"test\", \"switch\": 4}"
./usr/bin/ubus call domo.outlets create "{\"name\":\"test\", \"sender\": 12797322}"
```
### list
```
./usr/bin/ubus call domo.outlets list
```
```json
{
"outlets": [
{
"id": 1,
"name": "Bureau JB",
"speech_name": "bureau",
"zone": "",
"state": true,
"sender": 12797322,
"switch": 0
},
{
"id": 2,
"name": "Salon",
"speech_name": "salon",
"zone": "",
"state": false,
"sender": 12797322,
"switch": 1
},
{
"id": 3,
"name": "Sapin",
"speech_name": "sapin",
"zone": "",
"state": false,
"sender": 12797322,
"switch": 2
}
]
}
```
### read
```
./usr/bin/ubus call domo.outlets read "{\"id\":2}"
```
```json
{
"id": 2,
"name": "Salon",
"speech_name": "salon",
"state": false,
"zone": "",
"sender": 12797322,
"switch": 1
}
```
### update
```
./usr/bin/ubus call domo.outlets update "{\"id\": 4, \"name\":\"test1\", \"sender\": 1, \"switch\": 2}"
```
### delete
```
./usr/bin/ubus call domo.outlets delete "{\"id\": 4}"
```
## domo.sequences
### create
```
./usr/bin/ubus call domo.sequences create
```
### list
```
./usr/bin/ubus call domo.sequences list
```
### read
```
./usr/bin/ubus call domo.sequences read
```
### update
```
./usr/bin/ubus call domo.sequences update
```
### delete
```
./usr/bin/ubus call domo.sequences delete
```
## domo.shutters
### create
```
./usr/bin/ubus call domo.shutters create
```
### list
```
./usr/bin/ubus call domo.shutters list
```
### read
```
./usr/bin/ubus call domo.shutters read
```
### update
```
./usr/bin/ubus call domo.shutters update
```
### delete
```
./usr/bin/ubus call domo.shutters delete
```
### up
```
./usr/bin/ubus call domo.shutters up
```
### down
```
./usr/bin/ubus call domo.shutters down
```
## domo.sprinklers
### create
```
./usr/bin/ubus call domo.sprinklers create
```
### list
```
./usr/bin/ubus call domo.sprinklers list
```
### read
```
./usr/bin/ubus call domo.sprinklers read
```
### update
```
./usr/bin/ubus call domo.sprinklers update
```
### delete
```
./usr/bin/ubus call domo.sprinklers delete
```
### open
```
./usr/bin/ubus call domo.sprinklers open
```
### close
```
./usr/bin/ubus call domo.sprinklers close
```