c8y_client 0.0.1 copy "c8y_client: ^0.0.1" to clipboard
c8y_client: ^0.0.1 copied to clipboard

outdated

Dart client for Cumulocity IoT Platfom. Based on http://resources.cumulocity.com/documentation/javasdk/current/ and http://resources.cumulocity.com/documentation/websdk/client/

A library for Dart developers.

Created from templates made available by Stagehand under a Apache License Version 2.0 license.

Usage #

import 'package:c8yClient/src/core/model/id.dart';

A simple usage example: Get all devices with Position

import 'package:c8yClient/c8y_client.dart';
import 'package:c8yClient/src/sdk/client/client.dart';
import 'package:c8yClient/src/core/authentication/cumulocity_credentials.dart';

main() async {
  var client = Client.withPageSize('https://tenant.serviceProvider.com',
      CumulocityCredentials('user', 'password'), 100);
  try {
    var mos = await client
      .inventory()
      .list({'fragmentType': 'c8y_Position'});
    var i = mos.iterator;
    while (i.moveNext()) {
      print(i.current.name);
    }
  }
  catch (error) {
    print("error : " + error.toString());
  }

}

A simple usage example: Get device by ID and a get dynamic property

import 'package:c8yClient/c8y_client.dart';
import 'package:c8yClient/src/sdk/client/client.dart';
import 'package:c8yClient/src/core/authentication/cumulocity_credentials.dart';

main() async {
  var client = Client.withPageSize('https://tenant.serviceProvider.com',
      CumulocityCredentials('user', 'password'), 100);
  try {
    var mo = await client.inventory().getManagedObject(ID('10407719'));
    print(mo.name);
    print(mo.fragment['Numero_de_Satelites']);
  }
  catch (error) {
    print("error : " + error.toString());
  }

}

A simple usage example: Get current user

import 'package:c8yClient/c8y_client.dart';
import 'package:c8yClient/src/sdk/client/client.dart';
import 'package:c8yClient/src/core/authentication/cumulocity_credentials.dart';

main() async {
  var client = Client.withPageSize('https://tenant.serviceProvider.com',
      CumulocityCredentials('user', 'password'), 100);
  try {
    var currentUser = await client.user().currentUser();
    print(currentUser.userName);
  }
  catch (error) {
    print("error : " + error.toString());
  }

}

Features and bugs #

Please file feature requests and bugs at the issue tracker.

3
likes
0
pub points
0%
popularity

Publisher

unverified uploader

Dart client for Cumulocity IoT Platfom. Based on http://resources.cumulocity.com/documentation/javasdk/current/ and http://resources.cumulocity.com/documentation/websdk/client/

Homepage

License

unknown (LICENSE)

Dependencies

http, http_parser, json_annotation, logger

More

Packages that depend on c8y_client