see example.
void main(List<String> args) async {
final accessToken = Platform.environment['NATURE_REMO_ACCESS_TOKEN'];
if (accessToken == null || accessToken.isEmpty) {
throw Exception('Env: NATURE_REMO_ACCESS_TOKEN does not exist');
}
final natureRemoCloudApiClient = NatureRemoCloudApiClient(accessToken: accessToken);
Future<Response> _usersHandler(Request request) async {
final user = await natureRemoCloudApiClient.getMe();
return Response.ok(
jsonEncode(user),
headers: {
'content-type': 'application/json',
},
);
}
final _router = Router()..get('/users/me', _usersHandler);
final _handler = Pipeline().addMiddleware(logRequests()).addHandler(_router);
final ip = InternetAddress.anyIPv4;
final port = int.parse(Platform.environment['PORT'] ?? '8080');
final server = await serve(_handler, ip, port);
print('Server listening on port ${server.port}');
}
Status | Endpoint | HTTP Method |
---|---|---|
✔️ | /1/users/me | GET |
✔️ | /1/users/me | POST |
✔️ | /1/devices | GET |
✔️ | /1/devices/{device} | POST |
✔️ | /1/devices/{device}/delete | POST |
✔️ | /1/devices/{device}/temperature_offset | POST |
✔️ | /1/devices/{device}/humidity_offset | POST |
✔️ | /1/detectappliance | POST |
✔️ | /1/appliances | GET |
✔️ | /1/appliances | POST |
✔️ | /1/appliance_orders | POST |
✔️ | /1/appliances/{appliance}/delete | POST |
✔️ | /1/appliances/{appliance} | POST |
✔️ | /1/appliances/{appliance}/aircon_settings | POST |
✔️ | /1/appliances/{appliance}/tv | POST |
✔️ | /1/appliances/{appliance}/light | POST |
✔️ | /1/appliances/{appliance}/signals | GET |
✔️ | /1/appliances/{appliance}/signals | POST |
✔️ | /1/appliances/{appliance}/signal_orders | POST |
✔️ | /1/signals/{signal} | POST |
✔️ | /1/signals/{signal}/delete | POST |
✔️ | /1/signals/{signal}/send | POST |
http://local.swagger.nature.global/
Status | Endpoint | HTTP Method |
---|---|---|
✔️ | /messages | GET |
✔️ | /messages | POST |
Please file feature requests and bugs at the issue tracker.