carp_webservices 0.1.0 copy "carp_webservices: ^0.1.0" to clipboard
carp_webservices: ^0.1.0 copied to clipboard

outdated

Flutter API for accessing CARP web services, supporting authentication, file management, data point CRUD, and user-specific collections of objects.

CARP Web Service Plugin for Flutter #

A Flutter plugin to access the CARP Web Service API.

pub package

For Flutter plugins for other CARP products, see CARP Mobile Sensing in Flutter.

Note: This plugin is still under development, and some APIs might not be available yet. Feedback and Pull Requests are most welcome!

Setup #

  1. You need a CARP Web Service host running. See the CARP Web Service API documentation for how to do this. If you're part of the CACHET team, you can use the specified development, staging, and production servers.

  2. Add carp_services as a dependency in your pubspec.yaml file.

Usage #

import 'package:carp_webservices/carp_service/carp_service.dart';

Configuration of CarpService

The CarpService is a singleton and needs to be configured once. Note that a valid Study with a valid study ID is needed.

final String uri = "http://staging.carp.cachet.dk:8080";

CarpApp app;
Study study;

study = new Study(testStudyId, "user@dtu.dk", name: "Test study #$testStudyId");
app = new CarpApp(
      study: study,
      name: "any_display_friendly_name_is_fine",
      uri: Uri.parse(uri),
      oauth: OAuthEndPoint(clientID: "the_client_id", clientSecret: "the_client_secret"));

CarpService.configure(app);

The singleton can then be accessed via CarpService.instance.

Authentication

Authentication is currently only supported using username and password.

CarpUser user;
try {
   user = await CarpService.instance.authenticate(username: "a_username", password: "the_password");
} catch (excp) {
   ...;
}

File Upload

A FileStorageReference is used to upload files to CARP. You can add metadata to a file using the FileMetadata class.

final File myFile = new File("abc.txt");

final FileUploadTask uploadTask = CarpService.instance.getFileStorageReference("abc.txt").putFile(
      myFile,
      new FileMetadata(
        contentLanguage: 'en',
        customMetadata: <String, String>{'activity': 'test'},
      ),
    );

await uploadTask.onComplete;

Data Points

Collections and Objects

Features and bugs #

Please file feature requests and bug reports at the issue tracker.

License #

This software is copyright (c) 2018 Copenhagen Center for Health Technology (CACHET) at the Technical University of Denmark (DTU). This software is made available 'as-is' in a MIT license.

0
likes
0
pub points
68%
popularity

Publisher

verified publishercachet.dk

Flutter API for accessing CARP web services, supporting authentication, file management, data point CRUD, and user-specific collections of objects.

Homepage
Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

carp_core, carp_mobile_sensing, flutter

More

Packages that depend on carp_webservices