add missing api endpionts and examples

- add apis missing that were causing errors
- add bot / wifi config should work now on ecovacshome app
This commit is contained in:
Brian Martin 2020-01-05 09:29:53 -05:00
parent e4141e0a5c
commit f23c9bf4fe
7 changed files with 2886 additions and 4 deletions

View file

@ -102,8 +102,8 @@ class ConfServer:
for api in apis:
self.app.add_subapp(apis[api]["prefix"], apis[api]["app"])
for resource in self.app.router.resources():
print(resource)
#for resource in self.app.router.resources():
# print(resource)
@ -839,6 +839,34 @@ class ConfServer:
"msg": "操作成功",
"time": self.get_milli_time(datetime.utcnow().timestamp()),
}
# Example body
# {
# "code": "0000",
# "data": {
# "email": "user@gmail.com",
# "hasMobile": "N",
# "hasPassword": "Y",
# "headIco": "",
# "loginName": "user@gmail.com",
# "mobile": null,
# "mobileAreaNo": null,
# "nickname": "",
# "obfuscatedMobile": null,
# "thirdLoginInfoList": [
# {
# "accountType": "WeChat",
# "hasBind": "N"
# }
# ],
# "uid": "20180719212155_*****",
# "userName": "EAY*****"
# },
# "msg": "操作成功",
# "success": true,
# "time": 1578203898343
# }
return web.json_response(body)
except Exception as e:

View file

@ -56,7 +56,99 @@ class portal_api_appsvr(plugins.ConfServerApp):
"todo": "result",
}
return web.json_response(body)
return web.json_response(body)
#elif todo == "GetShareDeviceList":
# example response
# {
# "code": 0,
# "devices": [
# {
# "deviceName": "DEEBOT 900 Series (Cleaner Cleaner)",
# "did": "did",
# "icon": "https://portal-ww.ecouser.net/api/pim/file/get/5ba4a2cb6c2f120001c32839",
# "mid": "ls1ok3",
# "ownUsers": {
# "isMe": true,
# "nickname": "user@gmail.com",
# "user": "cg****"
# },
# "resource": "wC3g",
# "share": true,
# "shareUsers": []
# }
# ],
# "ret": "ok",
# "todo": "result"
# }
# if shared shareUsers
# "shareUsers": [
# {
# "isMe": false,
# "nickname": "user@gmail.com",
# "status": "sharing",
# "user": "eafg****"
# }
# ]
#elif todo == "ShareDevice":
# example post
# {
# "todo": "ShareDevice",
# "accountType": "EMAIL",
# "auth": {
# "realm": "ecouser.net",
# "resource": "res",
# "token": "token***",
# "userid": "cg***",
# "with": "users"
# },
# "country": "US",
# "did": "did",
# "resource": "wC3g",
# "username": "email to share to"
# }
#fail response (no user)
# {
# "todo": "result",
# "code": -3,
# "errno": -3,
# "ret": "fail"
# }
#success response
#{"ret":"ok","code":0,"todo":"result"}
#elif todo == "ShareUnRegisterDevice":
# example post
# {
# "todo": "ShareUnRegisterDevice",
# "account": "email to share to",
# "auth": {
# "realm": "ecouser.net",
# "resource": "res",
# "token": "toke",
# "userid": "userid",
# "with": "users"
# },
# "country": "US",
# "did": "did",
# "lang": "EN",
# "mid": "ls1ok3"
# }
# example response
# {
# "todo": "result",
# "code": 0,
# "data": {
# "mailContent": "<!-- 邮件代码 --><div style=\"position: relative;\"><div style=\"font-size: 14px;font-family: Helvetica;padding: 65px 0;line-height: 150%;\"><p style=\"margin-bottom: 15px;\">Hey there,</p><p style=\"margin-bottom: 15px;\">\n\t\t\tCheck out my new awesome robot vacuum: <a href=\"#\" style=\"color: #1c95ea;text-decoration: none;\">DEEBOT 900 Series</a>!<br/>\n\t\t\tDownload the <strong>ECOVACS HOME</strong> App and sign up with your email: <a href=\"#\" style=\"color: #1c95ea;text-decoration: none;\">brian@bmartin.net</a>, so you and I can control this kick-ass robot together.</p><p style=\"margin-bottom: 15px;\">\n\t\t\tIOS: <span style=\"font-size:15px\"><a href=\"https://itunes.apple.com/us/app/ecovacs-home/id1329458504?l=zh&ls=1&mt=8\">https://itunes.apple.com/us/app/ecovacs-home/id1329458504?l=zh&amp;ls=1&amp;mt=8</a></span><br/>\n\t\t\tAndroid: <span style=\"font-size:15px\"><a href=\"https://play.google.com/store/apps/details?id=com.eco.global.app\">https://play.google.com/store/apps/details?id=com.eco.global.app</a></span></p><p style=\"margin-bottom: 15px;\">\n\t\t\tThis invitation is valid within 7 days.<br/>\n\t\t\tIf I&#39;m sending to the wrong person, please ignore this email.</p><p style=\"margin-bottom: 15px;\">Thank you.</p></div></div><!-- 邮件代码 -->",
# "mailTitle": "I'm sharing my DEEBOT and you're invited!"
# },
# "ret": "ok"
# }
except Exception as e:
logging.exception("{}".format(e))

View file

@ -65,6 +65,10 @@ class portal_api_dim(plugins.ConfServerApp):
body = {"ret": "ok", "unRead": False}
return web.json_response(body)
if json_body["td"] == "ReceiveShareDevice": # EcoVacs Home
body = {"ret":"ok"}
return web.json_response(body)
except Exception as e:
logging.exception("{}".format(e))

View file

@ -69,6 +69,11 @@ class portal_api_iot(plugins.ConfServerApp):
body = {"ret": "ok", "unRead": False}
return web.json_response(body)
if json_body["td"] == "PreWifiConfig": # EcoVacs Home
body = {"ret":"ok"}
return web.json_response(body)
except Exception as e:
logging.exception("{}".format(e))

View file

@ -19,6 +19,8 @@ class portal_api_neng(plugins.ConfServerApp):
self.routes = [
web.route("*", "/neng/message/hasUnreadMsg", self.handle_neng_hasUnreadMessage, name="portal_api_neng_hasUnreadMessage"),
web.route("*", "/neng/message/getShareMsgs", self.handle_neng_getShareMsgs, name="portal_api_neng_getShareMsgs"),
web.route("*", "/neng/message/getlist", self.handle_neng_getlist, name="portal_api_neng_getlist"),
]
@ -32,6 +34,64 @@ class portal_api_neng(plugins.ConfServerApp):
except Exception as e:
logging.exception("{}".format(e))
async def handle_neng_getShareMsgs(self, request): # EcoVacs Home
try:
body = {"code":0,"data":{"hasNext":False,"msgs":[]}}
# share msg response
# {
# "code": 0,
# "data": {
# "hasNext": False,
# "msgs": [
# {
# "action": "shareDevice",
# "deviceName": "DEEBOT 900 Series",
# "did": "DID",
# "icon": "https://portal-ww.ecouser.net/api/pim/file/get/5ba4a2cb6c2f120001c32839",
# "id": "0154d03a-294e-4b99-a6df-fc2dbf4146d5",
# "isRead": False,
# "message": "User user@gmail.com sent you the sharing invitation of DEEBOT 900 Series.",
# "mid": "ls1ok3",
# "resource": "grU0",
# "shareStatus": "sharing",
# "ts": 1578206187412
# }
# ]
# }
# }
return web.json_response(body)
except Exception as e:
logging.exception("{}".format(e))
async def handle_neng_getlist(self, request): # EcoVacs Home
try:
body = {"code":0,"data":{"hasNext":False,"msgs":[]}}
#Sample Message
# {
# "id": "5da0ac9d636aec5107627ac4",
# "ts": 1570811036877,
# "did": "bot did",
# "cid": "ls1ok3",
# "name": "DEEBOT 900 Series",
# "icon": "https://portal-ww.ecouser.net/api/pim/file/get/5ba4a2cb6c2f120001c32839",
# "eventTypeId": "5aab824bb62ce30001f9a702",
# "title": "DEEBOT is off the floor.",
# "body": "DEEBOT is off the floor. Please put it back.",
# "read": false,
# "UILogicId": "D_900",
# "type": "web",
# "url": "https://portal-ww.ecouser.net/api/pim/eventdetail.html?id=5ba21e44aed83800015b9ca8" # Off the floor instructions
# }
return web.json_response(body)
except Exception as e:
logging.exception("{}".format(e))
plugin = portal_api_neng()

File diff suppressed because it is too large Load diff

View file

@ -26,8 +26,11 @@ class v1_private_user(plugins.ConfServerApp):
web.route("*", "/private/{country}/{language}/{devid}/{apptype}/{appversion}/{devtype}/{aid}/user/checkAgreement", self.handle_checkAgreement,name="v1_user_checkAgreement"),
web.route("*", "/private/{country}/{language}/{devid}/{apptype}/{appversion}/{devtype}/{aid}/user/checkAgreementBatch", self.handle_checkAgreement,name="v1_user_checkAgreementBatch"),
web.route("*", "/private/{country}/{language}/{devid}/{apptype}/{appversion}/{devtype}/{aid}/user/getUserAccountInfo", authhandler.getUserAccountInfo,name="v1_user_getUserAccountInfo"),
web.route("*", "/private/{country}/{language}/{devid}/{apptype}/{appversion}/{devtype}/{aid}/user/getUserMenuInfo", self.handle_getUserMenuInfo,name="v1_user_getUserMenuInfo"),
# Direct register from app:
# /{apiversion}/private/{country}/{language}/{devid}/{apptype}/{appversion}/{devtype}/{aid}/user/directRegister
#Register by email
# /registerByEmail
]
@ -72,5 +75,61 @@ class v1_private_user(plugins.ConfServerApp):
except Exception as e:
logging.exception("{}".format(e))
async def handle_getUserMenuInfo(self, request):
try:
apptype = request.match_info.get("apptype", "")
body = {
"code": "0000",
"data": [
{
"menuItems": [
{
"clickAction": 1,
"clickUri": "https://ecovacs.zendesk.com/hc/en-us",
"menuIconUrl": "https://gl-us-pub.ecovacs.com/upload/global/2019/12/16/2019121603180741b73907046e742b80e8fe4a90fe2498.png",
"menuId": "20191216031849_4d744630f7ad2f5208a4b8051be61d10",
"menuName": "Help & Feedback",
"paramsJson": ""
}
],
"menuPositionKey": "A_FIRST"
},
{
"menuItems": [
{
"clickAction": 3,
"clickUri": "robotShare",
"menuIconUrl": "https://gl-us-pub.ecovacs.com/upload/global/2019/12/16/2019121603284185e632ec6c5da10bd82119d7047a1f9e.png",
"menuId": "20191216032853_5fac4cc9cbd0e166dfa951485d1d8cc4",
"menuName": "Share Robot",
"paramsJson": ""
}
],
"menuPositionKey": "B_SECOND"
},
{
"menuItems": [
{
"clickAction": 3,
"clickUri": "config",
"menuIconUrl": "https://gl-us-pub.ecovacs.com/upload/global/2019/12/16/201912160325324068da4e4a09b8c3973db162e84784d5.png",
"menuId": "20191216032545_ebea0fbb4cb02d9c2fec5bdf3371bc2d",
"menuName": "Settings",
"paramsJson": ""
}
],
"menuPositionKey": "C_THIRD"
}
],
"msg": "操作成功",
"success": True,
"time": 1578203898342
}
return web.json_response(body)
except Exception as e:
logging.exception("{}".format(e))
plugin = v1_private_user()