diff --git a/README.md b/README.md index afb139412..c910a5f9b 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,7 @@ Want to get involved? Join our Slack channel and help out! (http://flutter-parse ## Getting Started To install, either add to your pubspec.yaml -``` +```yml dependencies: parse_server_sdk: ^1.0.16 ``` @@ -20,7 +20,7 @@ or clone this repository and add to your project. As this is an early developmen Once you have the library added to your project, upon first call to your app (Similar to what your application class would be) add the following... -``` +```dart Parse().initialize( ApplicationConstants.keyApplicationId, ApplicationConstants.keyParseServerUrl); @@ -28,7 +28,7 @@ Parse().initialize( It's possible to add other params, such as ... -``` +```dart Parse().initialize( ApplicationConstants.keyApplicationId, ApplicationConstants.keyParseServerUrl, @@ -42,7 +42,7 @@ Parse().initialize( ## Queries Once you have setup the project and initialised the instance, you can then retreive data from your server by calling: -``` +```dart var apiResponse = await ParseObject('ParseTableName').getAll(); if (apiResponse.success){ @@ -53,7 +53,7 @@ var apiResponse = await ParseObject('ParseTableName').getAll(); ``` Or you can get an object by its objectId: -``` +```dart var dietPlan = await DietPlan().getObject('R5EonpUDWy'); if (dietPlan.success) { @@ -67,7 +67,7 @@ var dietPlan = await DietPlan().getObject('R5EonpUDWy'); ## Complex queries You can create complex queries to really put your database to the test: -``` +```dart var queryBuilder = QueryBuilder(DietPlan()) ..startsWith(DietPlan.keyName, "Keto") ..greaterThan(DietPlan.keyFat, 64) @@ -110,7 +110,7 @@ The features available are:- ## Objects You can create custom objects by calling: -``` +```dart var dietPlan = ParseObject('DietPlan') ..set('Name', 'Ketogenic') ..set('Fat', 65); @@ -132,7 +132,7 @@ The features available are:- ## Custom Objects You can create your own ParseObjects or convert your existing objects into Parse Objects by doing the following: -``` +```dart class DietPlan extends ParseObject implements ParseCloneable { DietPlan() : super(_keyTableName); @@ -155,7 +155,7 @@ class DietPlan extends ParseObject implements ParseCloneable { To add a variable to an object call and retrieve it, call -``` +```dart dietPlan.set('RandomInt', 8); var randomInt = dietPlan.get('RandomInt'); ``` @@ -164,13 +164,13 @@ var randomInt = dietPlan.get('RandomInt'); You can now save an object by calling .pin() on an instance of an object -``` +```dart dietPlan.pin(); ``` and to retrieve it -``` +```dart var dietPlan = DietPlan().fromPin('OBJECT ID OF OBJECT'); ``` @@ -178,7 +178,7 @@ var dietPlan = DietPlan().fromPin('OBJECT ID OF OBJECT'); Retrieve it, call -``` +```dart var response = await dietPlan.increment("count", 1); ``` @@ -187,7 +187,7 @@ var response = await dietPlan.increment("count", 1); Retrieve it, call -``` +```dart var response = await dietPlan.add("listKeywords", ["a", "a","d"]); var response = await dietPlan.addUnique("listKeywords", ["a", "a","d"]); @@ -202,22 +202,22 @@ var response = await dietPlan.remove("listKeywords", ["a"]); You can create and control users just as normal using this SDK. To register a user, first create one : -``` +```dart var user = ParseUser().create("TestFlutter", "TestPassword123", "TestFlutterSDK@gmail.com"); ``` Then have the user sign up: -``` +```dart var response = await user.signUp(); if (response.success) user = response.result; ``` You can also logout and login with the user: -``` +```dart var response = await user.login(); if (response.success) user = response.result; ``` Also, once logged in you can manage sessions tokens. This feature can be called after Parse().init() on startup to check for a logged in user. -``` +```dart user = ParseUser.currentUser(); ``` Other user features are:- @@ -231,12 +231,12 @@ Other user features are:- ## Config The SDK now supports Parse Config. A map of all configs can be grabbed from the server by calling : -``` +```dart var response = await ParseConfig().getConfigs(); ``` and to add a config: -``` +```dart ParseConfig().addConfig('TestConfig', 'testing'); ```