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

A typed Dart client for the Claris FileMaker OData v4 API, with a fluent query builder for $filter, $select, $orderby, $top and $skip.

example/filemaker_odata_api_example.dart

import 'package:filemaker_odata_api/filemaker_odata_api.dart';

Future<void> main() async {
  final od = ODataClient(
    host: 'https://fms.example.com',
    database: 'Contacts',
    username: 'admin',
    password: 'secret',
  );

  try {
    // List tables.
    print('Tables: ${await od.tables()}');

    // Query with a filter, projection, sort and paging.
    final result = await od.query(
      table: 'Contacts',
      filter: Filter.equals('state', 'NSW').and(Filter.greaterThan('age', 21)),
      select: ['id', 'name', 'state'],
      orderBy: [const OrderBy('name')],
      top: 50,
      count: true,
    );
    print('${result.rows.length} of ${result.count}');
    for (final row in result.rows) {
      print('  ${row['id']}: ${row['name']}');
    }

    // Create.
    final created = await od.create(
      table: 'Contacts',
      fields: {'name': 'Jane Doe', 'state': 'NSW'},
    );
    final Object id = created['id'] as Object;

    // Update.
    await od.update(table: 'Contacts', id: id, fields: {'state': 'QLD'});

    // Delete.
    await od.delete(table: 'Contacts', id: id);
  } on ODataAuthException catch (e) {
    print('Auth failed: $e');
  } on ODataException catch (e) {
    print('OData error: $e');
  } finally {
    od.close();
  }
}
0
likes
160
points
0
downloads

Documentation

API reference

Publisher

verified publisheraphero.com.au

Weekly Downloads

A typed Dart client for the Claris FileMaker OData v4 API, with a fluent query builder for $filter, $select, $orderby, $top and $skip.

Repository (GitHub)
View/report issues

Topics

#filemaker #claris #odata #rest #database

License

MIT (license)

Dependencies

http, meta

More

Packages that depend on filemaker_odata_api