parse_rest_api 0.0.1 copy "parse_rest_api: ^0.0.1" to clipboard
parse_rest_api: ^0.0.1 copied to clipboard

A CloudFirestore inspired Wrapper for Parse REST API.

Native Dart Parse API #

A CloudFirestore inspired Wrapper for Parse REST API. Explore more features in the example file.

ACL and User #

Create document and user and save it to parse with access restrictions:

import 'package:parse_rest_api/parse_rest_api.dart';

  //Initialize Parse
  Parse.initialize('https://MY.URL/parse', 'MY-APP-ID');
  //Create collection reference
  final myclass = CollectionReference('myclass');
  //register new user
  var user = await Parse.registerUser('Pete', 'pete!1234');
  //include current session token in header
  user.setTokenForParse();
  //create new acl object
  final acl = ParseACL();
  //deny public read & write requests
  acl.setPublic(false, false);
  //allow only user to read and write
  acl.addRights(user.id, true, true);
  //create document inside collection with the defined access restriction
  var doc = await myclass.add({
    'owner': 'Pete',
    'ACL': acl,
  });

Query collections #

Create a query document and return result:

//create new query
  final query = CollectionReference('todos').query();
  //await returned documents
  final docs = await query
      //filter: where name is not 'Swim'
      .where('name', QueryFilter.notEqualTo('Swim'))
      //filter: where rank is greater than 1
      .where('rank', QueryFilter.greaterThanOrEqual(2))
      //order first by rank
      .orderBy('rank')
      //then order by name
      .orderBy('name')
      //return max 4 docs (default: 100)
      .limit(4)
      //get documents
      .get();
2
likes
30
pub points
0%
popularity

Publisher

unverified uploader

A CloudFirestore inspired Wrapper for Parse REST API.

Repository (GitHub)
View/report issues

License

MIT (LICENSE)

Dependencies

http

More

Packages that depend on parse_rest_api