forked from dresden-elektronik/deconz-rest-plugin
-
Notifications
You must be signed in to change notification settings - Fork 0
/
rest_info.cpp
48 lines (42 loc) · 1.2 KB
/
rest_info.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
/*
* Copyright (c) 2018 dresden elektronik ingenieurtechnik gmbh.
* All rights reserved.
*
* The software in this package is published under the terms of the BSD
* style license a copy of which has been included with this distribution in
* the LICENSE.txt file.
*
*/
#include "de_web_plugin.h"
#include "de_web_plugin_private.h"
/*! Info REST API broker.
\param req - request data
\param rsp - response data
\return REQ_READY_SEND
REQ_NOT_HANDLED
*/
int DeRestPluginPrivate::handleInfoApi(const ApiRequest &req, ApiResponse &rsp)
{
// GET /api/<apikey>/info/timezones
if ((req.path.size() == 4) && (req.hdr.method() == "GET") && (req.path[3] == "timezones"))
{
return getInfoTimezones(req, rsp);
}
return REQ_NOT_HANDLED;
}
/*! GET /api/<apikey>/info/timezones
\return REQ_READY_SEND
REQ_NOT_HANDLED
*/
int DeRestPluginPrivate::getInfoTimezones(const ApiRequest &req, ApiResponse &rsp)
{
Q_UNUSED(req);
// QByteArrayList tzs = getTimezones();
// foreach (QByteArray tz, tzs)
// {
// rsp.list.append(QVariant(tz));
// }
rsp.list = getTimezones();
rsp.httpStatus = HttpStatusOk;
return REQ_READY_SEND;
}