lb_writer 1.1.1 lb_writer: ^1.1.1 copied to clipboard
Logbot writer client API client to be user to read and write into devices
Logbot Writer SDK for Flutter #
This is a package that enables read and write capabilities in the device.
This Dart package is automatically generated by the OpenAPI Generator project:
- API version: 1.0.1
- Build package: org.openapitools.codegen.languages.DartClientCodegen
Requirements #
Dart 2.17 or later
Installation & Usage #
Add the dependencies from pub.dev:
dependencies:
lb_auth:
lb_writer:
lb_auth
is always required to make authorized calls to the APIs.
To use the SDK on you application see the example below:
/// Remember to call LogbotSetup.init() after ensureInitialized()
Future<void> main() async {
WidgetsFlutterBinding.ensureInitialized();
await LogbotSetup.init();
runApp(const MyApp());
}
import 'package:lb_auth/lb_auth.dart';
import 'package:lb_writer/lb_writer.dart';
class Example {
Future<void> run() async {
/// Initialize Logbot SDK by logging in with Logbot Credentials
await LogbotAuth.init(LogbotCredentials(
username: username,
password: password,
clientId: clientId,
clientSecret: clientSecret,
));
/// Starts the Logbot Discovery to search for local devices
await LogbotDiscovery.startDiscovery();
/// Starts the background service to retrieve device status every minute
/// (needed to read device status from cache)
LogbotStateManager.start();
/// Now you can use every API included on the SDK
/// for example:
List<Connection>? response = await LogbotWriter.connections.listConnections();
}
}
Tests #
To run all tests:
flutter test
Documentation for API Endpoints #
All URIs are relative to https://devices.logbotiot.cloud
Class | Method | HTTP request | Description |
---|---|---|---|
ConnectionApi | addConnection | POST /connection | Creates a new connection |
ConnectionApi | clearConnections | DELETE /connection | Deletes all active connections |
ConnectionApi | connectionDiscover | POST /connection/{id}/discover | Discovers PLC metrics. |
ConnectionApi | connectionRead | POST /connection/{id}/read | Read one metric over the specified connection |
ConnectionApi | connectionWrite | POST /connection/{id}/write | Write one metric over the specified connection |
ConnectionApi | deleteConnection | DELETE /connection/{id} | Deletes the connection |
ConnectionApi | discover | POST /connection/discover | Creates a temporary connection and discover its metrics |
ConnectionApi | getConnection | GET /connection/{id} | Retrives informations about the connection |
ConnectionApi | listConnections | GET /connection | Retrives informations about all active connections |
ConnectionApi | read | POST /connection/read | Creates a temporary connection and reads the given metric |
ConnectionApi | write | POST /connection/write | Creates a temporary connection and writes the given metric |
DeviceApi | getInfo | GET /info | Get the device informations |
DeviceApi | getStats | GET /stats | Get device stats |
DeviceApi | healthcheck | GET /healthcheck | Checks the device status |
Documentation For Models #
Author #
Logbot SRL info@logbot.cloud