git ssb

0+

bencevans / huawei-mifi



Commit 59b142eb77d43824a0cd73b904b0187d20bb94f1

friendly api

Ben Evans committed on 11/17/2018, 6:09:01 PM
Parent: b0f2a12e61821d424e901ca7ac7f981aa5ea59d0

Files changed

index.jschanged
test.jschanged
index.jsView
@@ -30,9 +30,9 @@
3030 async authenticate() {
3131 await this._request(`http://${this.host}`)
3232 }
3333
34- async getStatus() {
34 + async status() {
3535 const res = await this.request(`/api/monitoring/status`)
3636 return {
3737 /**
3838 * mobile signal strength
@@ -51,9 +51,9 @@
5151 currentDevices: parseInt(res.CurrentWifiUser)
5252 }
5353 }
5454
55- async getTrafficStatistics() {
55 + async traffic() {
5656 const res = await this.request(`/api/monitoring/traffic-statistics`)
5757 return {
5858 currentConnectTime: parseInt(res.CurrentConnectTime),
5959 currentUpload: parseInt(res.CurrentUpload),
@@ -65,9 +65,9 @@
6565 totalConnectTime: parseInt(res.TotalConnectTime),
6666 }
6767 }
6868
69- async getCheckNotifications() {
69 + async notifications() {
7070 const res = await this.request(`/api/monitoring/check-notifications`)
7171 return {
7272 unreadMessage: parseInt(res.UnreadMessage),
7373 smsStorageFull: parseInt(res.SmsStorageFull),
test.jsView
@@ -9,20 +9,20 @@
99 t.end()
1010 })
1111
1212 test('get status', async t => {
13- const status = await client.getStatus()
13 + const status = await client.status()
1414 console.log(status)
1515 t.end()
1616 })
1717
1818 test('get traffic stats', async t => {
19- const status = await client.getTrafficStatistics()
19 + const status = await client.traffic()
2020 console.log(status)
2121 t.end()
2222 })
2323
2424 test('check notifications', async t => {
25- const status = await client.getCheckNotifications()
25 + const status = await client.notifications()
2626 console.log(status)
2727 t.end()
2828 })

Built with git-ssb-web