Nature Remo API Client for Dart

Dart CI

Usage

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}');
}

Supported API

Cloud API

http://swagger.nature.global

StatusEndpointHTTP Method
:heavy_check_mark:/1/users/meGET
:heavy_check_mark:/1/users/mePOST
:heavy_check_mark:/1/devicesGET
:heavy_check_mark:/1/devices/{device}POST
:heavy_check_mark:/1/devices/{device}/deletePOST
:heavy_check_mark:/1/devices/{device}/temperature_offsetPOST
:heavy_check_mark:/1/devices/{device}/humidity_offsetPOST
:heavy_check_mark:/1/detectappliancePOST
:heavy_check_mark:/1/appliancesGET
:heavy_check_mark:/1/appliancesPOST
:heavy_check_mark:/1/appliance_ordersPOST
:heavy_check_mark:/1/appliances/{appliance}/deletePOST
:heavy_check_mark:/1/appliances/{appliance}POST
:heavy_check_mark:/1/appliances/{appliance}/aircon_settingsPOST
:heavy_check_mark:/1/appliances/{appliance}/tvPOST
:heavy_check_mark:/1/appliances/{appliance}/lightPOST
:heavy_check_mark:/1/appliances/{appliance}/signalsGET
:heavy_check_mark:/1/appliances/{appliance}/signalsPOST
:heavy_check_mark:/1/appliances/{appliance}/signal_ordersPOST
:heavy_check_mark:/1/signals/{signal}POST
:heavy_check_mark:/1/signals/{signal}/deletePOST
:heavy_check_mark:/1/signals/{signal}/sendPOST

Local API

http://local.swagger.nature.global/

StatusEndpointHTTP Method
:heavy_check_mark:/messagesGET
:heavy_check_mark:/messagesPOST

Features and bugs

Please file feature requests and bugs at the issue tracker.

Libraries

nature_remo