sponge_client_dart 1.10.0

  • README.md
  • CHANGELOG.md
  • Example
  • Installing
  • Versions
  • 60

Sponge client for Dart. #

This is the Sponge REST API client for Dart.

See example/example.dart.

For more information on Sponge see https://sponge.openksavi.org.

1.10.0 (2019-05-10) #

  • Added DataType.registeredType.
  • Added support for RecordType inheritance.
  • Added support for automatic use of auth tokens.
  • Added support for custom REST API operations.

1.9.0 (2019-04-15) #

  • Added a new type StreamType.
  • Added a new REST API error code ERROR_CODE_INCORRECT_USERNAME_PASSWORD ("SPONGE004").
  • Dependencies upgrade.

1.8.0 (2019-03-04) #

  • API change: Action arguments and result metadata are now specified as data types. ArgMeta and ResultMeta classes have been removed.
  • API change: Renamed ArgProvidedMeta to ProvidedMeta, ArgProvidedValue to ProvidedValue and ProvidedMeta.depends to ProvidedMeta.dependencies.
  • API change: Removed AnnotatedType. Use DataType.withAnnotated() instead.
  • Added support for categories. Processors may be assigned to registered categories.
  • Added new types: DynamicType, TypeType, DateTimeType.
  • Added CategoryMeta.features.
  • Fixed the bug that caused an error when sending an empty body in the REST API request.

1.7.0 (2019-02-01) #

  • API change: Renamed displayName to label.
  • API change: Renamed ActionArgMeta to ArgMeta, ActionResultMeta to ResultMeta, ArgProvided to ArgProvidedMeta, ArgValue to ArgProvidedValue.
  • API change: A provided argument specification in now placed in the ArgProvidedMeta class, not directly in the ArgMeta as before.
  • API change: Removed LabeledValue and ArgProvidedValue.valueSetDisplayNames because of a new support for an annotated value set.

1.6.0 (2019-01-11) #

  • A new REST API operation actionArgs that fetches the provided action arguments from the server. There is a possibility to provide action argument values and possible value sets in the action configuration. It makes easier creating a generic UI for an action call that reads and presents the actual state of the entities that are to be changed by the action and its arguments.
  • API change: Removed ActionType because there is a more versatile feature of providing action argument values and value sets.
  • Added a context and listeners to the REST API client.
  • Added a new data type AnnotatedType.

1.5.1 (2018-11-14) #

  • Removed dart:io dependency.
  • Allowed non strict types in type converters.

1.5.0 (2018-11-14) #

  • The initial release, compatible with Sponge 1.5.x.

example/example.dart

// Copyright 2018 The Sponge authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//      http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

import 'package:sponge_client_dart/sponge_client_dart.dart';

void main() async {
  // Create a new client for an anonymous user.
  var client = SpongeRestClient(
      SpongeRestClientConfiguration('http://localhost:8888/sponge.json/v1'));

  // Get the Sponge server version.
  var version = await client.getVersion();
  print('Sponge version: $version.');

  // Get actions metadata.
  List<ActionMeta> actionsMeta = await client.getActions();
  print('Available action count: ${actionsMeta.length}.');

  // Call the action with arguments.
  String upperCaseText = await client.call('UpperCase', ['Text to upper case']);
  print('Upper case text: $upperCaseText.');

  // Send a new event to the Sponge engine.
  var eventId = await client.send('alarm',
      attributes: {'source': 'Dart client', 'message': 'Something happened'});
  print('Sent event id: $eventId.');

  // Create a new client for a named user.
  client = SpongeRestClient(
    SpongeRestClientConfiguration('http://localhost:8888/sponge.json/v1')
      ..username = 'john'
      ..password = 'password',
  );
}

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  sponge_client_dart: ^1.10.0

2. Install it

You can install packages from the command line:

with pub:


$ pub get

with Flutter:


$ flutter pub get

Alternatively, your editor might support pub get or flutter pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:sponge_client_dart/sponge_client_dart.dart';
  
Version Uploaded Documentation Archive
1.10.0 May 10, 2019 Go to the documentation of sponge_client_dart 1.10.0 Download sponge_client_dart 1.10.0 archive
1.9.0 Apr 15, 2019 Go to the documentation of sponge_client_dart 1.9.0 Download sponge_client_dart 1.9.0 archive
1.8.0 Mar 4, 2019 Go to the documentation of sponge_client_dart 1.8.0 Download sponge_client_dart 1.8.0 archive
1.7.0 Feb 1, 2019 Go to the documentation of sponge_client_dart 1.7.0 Download sponge_client_dart 1.7.0 archive
1.6.0 Jan 11, 2019 Go to the documentation of sponge_client_dart 1.6.0 Download sponge_client_dart 1.6.0 archive
1.5.1 Nov 14, 2018 Go to the documentation of sponge_client_dart 1.5.1 Download sponge_client_dart 1.5.1 archive
1.5.0 Nov 14, 2018 Go to the documentation of sponge_client_dart 1.5.0 Download sponge_client_dart 1.5.0 archive
Popularity:
Describes how popular the package is relative to other packages. [more]
21
Health:
Code health derived from static analysis. [more]
100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
100
Overall:
Weighted score of the above. [more]
60
Learn more about scoring.

We analyzed this package on Jun 18, 2019, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.3.2
  • pana: 0.12.18

Platforms

Detected platforms: Flutter, web, other

No platform restriction found in primary library package:sponge_client_dart/sponge_client_dart.dart.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.0.0 <3.0.0
http ^0.12.0+2 0.12.0+2
intl ^0.15.8 0.15.8
logging ^0.11.3+2 0.11.3+2
meta ^1.1.6 1.1.7
quiver ^2.0.2 2.0.3
synchronized ^2.1.0 2.1.0+1
timezone ^0.5.2 0.5.4
Transitive dependencies
async 2.2.0
charcode 1.1.2
collection 1.14.11
http_parser 3.1.3
matcher 0.12.5
path 1.6.2
source_span 1.5.5
stack_trace 1.9.3
string_scanner 1.0.4
term_glyph 1.1.0
typed_data 1.1.6
Dev dependencies
pedantic ^1.5.0 1.7.0
test ^1.6.2