DS Kinetic
The official Dart client for the DataSpeed Kinetic 360 platform.
This package provides a unified interface, combining both REST (ds_api
) and gRPC (ds_proto
) APIs to interact with DataSpeed's suite of autonomous vehicle services.
Requirements
- Dart 2.15.0+ or Flutter 2.8.0+
- Dio 5.0.0+ (for the REST client)
- grpc (for the gRPC client)
- protobuf (for gRPC message generation)
Installation
Add the package to your pubspec.yaml
:
dependencies:
ds_kinetic: ^1.0.0
Then, run dart pub get
or flutter pub get
.
Getting Started
Here is a basic example of how to use the REST client to fetch a list of vehicles from the fleet.
dart
import 'package:ds_kinetic/ds_kinetic.dart';
import 'package:dio/dio.dart';
void main() async {
// 1. Initialize the API client
// You can customize the Dio instance for authentication and other settings.
final dsk360 = Dsk360Api(
dio: Dio(BaseOptions(baseUrl: 'https://api.corp.dataspeedinc.com')),
// Authentication is required. See the "Authentication" section below.
// interceptors: [
// YourOAuthInterceptor(),
// ],
);
// 2. Get the API for the service you need (e.g., FleetApi)
final fleetApi = dsk360.getFleetApi();
// 3. Call the desired endpoint
try {
final response = await fleetApi.getVehicles();
if (response.statusCode == 200 && response.data != null) {
print('Successfully fetched vehicles:');
for (var vehicle in response.data!.asList()) {
print('- Vehicle: ${vehicle.name}, UUID: ${vehicle.uuid}');
}
}
} on DioException catch (e) {
// Handle API errors (e.g., network issues, 4xx/5xx responses)
print('Error calling FleetApi->getVehicles: $e');
} catch (e) {
print('An unexpected error occurred: $e');
}
}
gRPC Client Usage
The gRPC client stubs are also included in this package. To use them, you will need to set up a ClientChannel
and instantiate the specific service client you intend to use. Please refer to the generated source code and the official gRPC Dart documentation for examples.
Available Services
This client provides access to a wide range of services through both REST and gRPC interfaces:
- Fleet Management: Access vehicle status, diagnostics, and telemetry.
- Mission Control: Create, assign, and monitor vehicle missions.
- Atlas Mapping: Interact with maps, routes, and navigation data.
- Docket Ticketing: Manage support and service tickets.
- Real-time Data: Stream live data for vehicle status and mission updates.
Authentication
The Kinetic 360 API is secured using OAuth 2.0. You must implement an authentication flow to obtain and manage access tokens.
The REST client, built on Dio
, can be configured with an Interceptor
to automatically attach the Authorization
header to every request. Please refer to the official Dio
documentation and OAuth 2.0 best practices for implementation details.
Full Documentation
Detailed documentation for all API endpoints, data models, and authentication scopes is available in the doc/
directory of this package.
Libraries
- constants
- ds_kinetic
- extensions/atlas/atlas
- extensions/atlas/chart
- extensions/atlas/chart_info
- extensions/atlas/coordinate
- extensions/atlas/path
- extensions/atlas/pose
- extensions/atlas/pt_coordinate
- extensions/atlas/quaternion
- extensions/atlas/reference_frame
- extensions/atlas/route
- extensions/atlas/site
- extensions/atlas/speed_constraints
- extensions/atlas/trail
- extensions/atlas/trip
- extensions/atlas/trip_action
- extensions/atlas/waypoint
- extensions/atlas/waypoint_edge
- extensions/common/common
- extensions/extensions
- helpers