Skip to content

carp_services

Client services for the CARP Web Services (CAWS) backend.

The CARP Core services are implemented as CAWS clients:

CarpService gives access to the CAWS-only ("non-core") endpoints: files, documents and collections, plus the legacy consent and data point endpoints. Authentication is handled by CarpAuthService in the carp_auth library. References such as DeploymentReference and ParticipationReference bind these calls to one study deployment. The carp_backend package builds on this library to upload data from a running study.

Each app is assumed to connect to one CAWS backend only, so the default constructors return shared instances. Configure them before use, like:

await CarpAuthService().configure(authProperties);

user = await CarpAuthService().authenticateWithUsernamePassword(
  username: username,
  password: password,
);

CarpParticipationService().configure(app);

where authProperties, username, and password set up authentication, and app is the CarpApp that points the participation service to the right CAWS instance.

Classes

  • ActiveParticipationInvitationDialog — A modal dialog showing a list of ActiveParticipationInvitations for the user to select one from.
  • CarpApp — The CAWS server instance that the client services talk to.
  • CarpBadRequestException — A CarpServiceRequestException for HTTP 400 Bad Request.
  • CarpBaseService — Base class for all CAWS client services.
  • CarpDataStreamService — A CARP Core DataStreamService that talks to CAWS.
  • CarpDeploymentService — A CARP Core DeploymentService that talks to CAWS.
  • CarpFileResponse — Metadata of a file stored in CAWS, as returned by the file endpoint.
  • CarpInternalServerException — A CarpServiceRequestException for HTTP 500 Internal Server Error.
  • CarpNotFoundException — A CarpServiceRequestException for HTTP 404 Not Found.
  • CarpParticipationService — A CARP Core ParticipationService that talks to CAWS.
  • CarpProtocolService — A CARP Core ProtocolService and ProtocolFactoryService that talks to CAWS.
  • CarpReference — Base class for references to one CAWS resource, like a file, document, collection or deployment.
  • CarpService — Gives access to the CAWS-only ("non-core") endpoints: files, documents and collections.
  • CarpServiceException — Base exception thrown by the CAWS client services.
  • CarpServiceRequestException — Exception for CAWS REST/HTTP service communication.
  • CarpServiceTask — Base class for asynchronous file tasks started by a FileStorageReference.
  • CarpUnauthorizedException — A CarpServiceRequestException for HTTP 401 Unauthorized or 403 Forbidden.
  • ClonableMultipartFile — A http.MultipartFile that can be cloned, so HTTPRetry.send can re-submit a multipart POST request with the same file.
  • CollectionReference — A reference to a collection of JSON documents in CAWS.
  • ConsentDocument — A signed consent document read from the legacy CAWS consent endpoint.
  • DataPoint — A data point for the legacy CAWS data point endpoint, holding a header and the data.
  • DataPointHeader — The header (meta-data) attached to all DataPoints, like study, user, time span and data format.
  • DataPointReference — A reference to the legacy data point endpoint of one study deployment in CAWS.
  • DataStreamReference — A reference to the data streams of one study deployment in CAWS.
  • DeploymentReference — A reference to one primary device in a study deployment in CAWS.
  • DocumentReference — A reference to a JSON document in a CAWS collection, used to write, read or delete it.
  • DocumentSnapshot — A local copy of a document read from a CAWS collection. The maps are mutable, but changing them does not update the server.
  • FileDownloadTask — Downloads a file from CAWS to a local file in the background.
  • FileMetadata — Metadata for a FileStorageReference. Metadata stores default attributes such as size and content type. Also allow for storing custom metadata.
  • FileStorageReference — A reference to one file in the CAWS file storage of a study.
  • FileUploadTask — Uploads a local file to CAWS in the background.
  • HTTPRetry — Wraps the HTTP operations (GET, POST, PUT, DELETE, multipart SEND) with retry on network errors.
  • HTTPStatus — An HTTP status code and its reason phrase, as held by a CarpServiceRequestException.
  • ParticipationReference — A reference to the participant data of one study deployment in CAWS.
  • PushIdGenerator — Utility class for generating CARP document keys.
  • RPCCarpReference — A CarpReference to a CARP Core RPC endpoint, like the deployment, participation or data stream service.

Enums

  • TaskStateType — The state of a CarpServiceTask, like a file upload or download.

Functions

zipJson

List<int> zipJson(
  1. Map<String, dynamic> json
)

Gzips the json map to a list of bytes.

zipString

List<int> zipString(
  1. String str
)

Gzips the str string to a list of bytes using UTF8 encoding.

Properties

httpr

HTTPRetry httpr
final

The shared HTTPRetry client used by all CAWS services.