diff --git a/.idea/workspace.xml b/.idea/workspace.xml
index ff7b747ba..6bdc9e8f1 100644
--- a/.idea/workspace.xml
+++ b/.idea/workspace.xml
@@ -16,7 +16,9 @@
-
+
+
+
@@ -77,74 +79,75 @@
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
-
+
+
-
-
+
+
+
-
-
-
+
+
+
-
-
+
+
+
+
+
-
-
+
+
-
-
+
+
-
+
-
-
-
-
-
+
+
@@ -153,8 +156,6 @@
- import
- BaseClient
bad
client
send
@@ -183,6 +184,8 @@
term
query
save(
+ keys
+ List<
part
@@ -196,7 +199,7 @@
@@ -237,8 +240,6 @@
-
-
@@ -249,18 +250,20 @@
-
-
+
+
+
+
-
-
-
-
+
+
+
+
@@ -268,8 +271,8 @@
-
+
@@ -282,18 +285,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
@@ -579,7 +570,14 @@
1547895940859
-
+
+ 1547896458167
+
+
+
+ 1547896458167
+
+
@@ -592,10 +590,9 @@
-
-
+
-
+
@@ -605,19 +602,19 @@
-
-
+
+
-
+
-
-
+
+
@@ -686,35 +683,21 @@
-
+
+
- file://$PROJECT_DIR$/example/lib/main.dart
- 168
-
-
-
- file://$PROJECT_DIR$/example/lib/main.dart
- 140
-
-
-
- file://$PROJECT_DIR$/example/lib/main.dart
- 167
-
+ file://$PROJECT_DIR$/lib/src/network/parse_query.dart
+ 174
+
file://$PROJECT_DIR$/example/lib/main.dart
128
-
-
-
- file://$PROJECT_DIR$/example/lib/main.dart
- 126
-
+
@@ -789,13 +772,6 @@
-
-
-
-
-
-
-
@@ -929,9 +905,6 @@
-
-
-
@@ -939,13 +912,6 @@
-
-
-
-
-
-
-
@@ -960,13 +926,6 @@
-
-
-
-
-
-
-
@@ -1009,13 +968,6 @@
-
-
-
-
-
-
-
@@ -1044,30 +996,20 @@
-
-
-
-
-
-
-
-
+
-
-
-
-
-
+
+
-
+
-
-
+
+
@@ -1078,6 +1020,51 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/CHANGELOG.md b/CHANGELOG.md
index ae22bd85b..ec415e748 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,6 @@
+## 1.0.8
+Fixed some queries
+
## 1.0.7
Some items now return a response rather than a ParseObject
diff --git a/README.md b/README.md
index b4dba2a05..b9a44bfdf 100644
--- a/README.md
+++ b/README.md
@@ -13,7 +13,7 @@ Want to get involved? Join our Slack channel and help out! (http://flutter-parse
To install, either add to your pubspec.yaml
```
dependencies:
- parse_server_sdk: ^1.0.7
+ parse_server_sdk: ^1.0.8
```
or clone this repository and add to your project. As this is an early development with multiple contributors, it is probably best to download/clone and keep updating as an when a new feature is added.
diff --git a/example/lib/main.dart b/example/lib/main.dart
index 8558aa208..bf418b237 100644
--- a/example/lib/main.dart
+++ b/example/lib/main.dart
@@ -51,13 +51,13 @@ class _MyAppState extends State {
}
runTestQueries() {
- createItem();
- getAllItems();
- getAllItemsByName();
- getSingleItem();
+ //createItem();
+ //getAllItems();
+ //getAllItemsByName();
+ //getSingleItem();
query();
- function();
- initUser();
+ //function();
+ //initUser();
}
void createItem() async {
@@ -112,7 +112,6 @@ class _MyAppState extends State {
// shows example of retrieving a pin
var newDietPlanFromPin = DietPlan().fromPin('R5EonpUDWy');
-
if (newDietPlanFromPin != null) print('Retreiving from pin worked!');
} else {
@@ -122,7 +121,8 @@ class _MyAppState extends State {
void query() async {
var queryBuilder = QueryBuilder(DietPlan())
- ..whereContains(DietPlan.keyName, "eto");
+ ..whereContains(DietPlan.keyName, "iet")
+ ..keysToReturn([DietPlan.keyName]);
var apiResponse = await queryBuilder.query();
diff --git a/lib/src/network/parse_query.dart b/lib/src/network/parse_query.dart
index 6473951d7..35f7163ed 100644
--- a/lib/src/network/parse_query.dart
+++ b/lib/src/network/parse_query.dart
@@ -49,12 +49,12 @@ class QueryBuilder {
/// [String] keys will only return the columns of a result you want the data for,
/// this is useful for large objects
void keysToReturn(List keys){
- limiters["keys"] = keys.toString();
+ limiters["keys"] = concatArray(keys);
}
/// Includes other ParseObjects stored as a Pointer
- void includeObject(String objectType){
- limiters["include"] = objectType;
+ void includeObject(List objectTypes){
+ limiters["include"] = concatArray(objectTypes);
}
/// Returns an object where the [String] column starts with [value]
@@ -148,15 +148,15 @@ class QueryBuilder {
/// Performs a search to see if [String] contains other string
void whereContains(String column, String value, {bool caseSensitive: false}) {
if (caseSensitive) {
- queries.add(MapEntry(_SINGLE_QUERY, '\"$column\":{\"\$regex\": \"$query\"}'));
+ queries.add(MapEntry(_SINGLE_QUERY, '\"$column\":{\"\$regex\": \"$value\"}'));
} else {
- queries.add(MapEntry(_SINGLE_QUERY, '\"$column\":{\"\$regex\": \"$query\", \"\$options\": \"i\"}'));
+ queries.add(MapEntry(_SINGLE_QUERY, '\"$column\":{\"\$regex\": \"$value\", \"\$options\": \"i\"}'));
}
}
/// Powerful search for containing whole words. This search is much quicker than regex and can search for whole words including wether they are case sensitive or not.
/// This search can also order by the score of the search
- void textContainsWholeWord(String column, String query, {bool caseSensitive: false, bool orderByScore: true}){
+ void whereContainsWholeWord(String column, String query, {bool caseSensitive: false, bool orderByScore: true}){
queries.add(MapEntry(_SINGLE_QUERY, '\"$column\":{\"\$text\":{\"\$search\":{\"\$term\": \"$query\", \"\$caseSensitive\": $caseSensitive }}}'));
if (orderByScore) orderByDescending('score');
}
@@ -177,7 +177,6 @@ class QueryBuilder {
/// Runs through all queries and adds them to a query string
String buildQueries(List queries) {
-
String queryBuilder = "";
for (var item in queries) {
@@ -191,6 +190,20 @@ class QueryBuilder {
return queryBuilder;
}
+ String concatArray(List queries) {
+ String queryBuilder = "";
+
+ for (var item in queries) {
+ if (item == queries.first) {
+ queryBuilder += item;
+ } else {
+ queryBuilder += ",$item";
+ }
+ }
+
+ return queryBuilder;
+ }
+
/// Creates a query param using the column, the value and the queryOperator
/// that the column and value are being queried against
MapEntry _buildQueryWithColumnValueAndOperator(MapEntry columnAndValue, String queryOperator) {
diff --git a/lib/src/objects/parse_object.dart b/lib/src/objects/parse_object.dart
index 11293f99d..6ee661d25 100644
--- a/lib/src/objects/parse_object.dart
+++ b/lib/src/objects/parse_object.dart
@@ -170,8 +170,16 @@ class ParseObject extends ParseBase implements ParseCloneable {
/// Can be used to create custom queries
Future query(String query) async {
try {
- var uri = "${ParseCoreData().serverUrl}$_path?$query";
- var result = await _client.get(uri);
+
+ Uri tempUri = Uri.parse(ParseCoreData().serverUrl);
+
+ Uri url = Uri(
+ scheme: tempUri.scheme,
+ host: tempUri.host,
+ path: "${tempUri.path}$_path",
+ query: query);
+
+ var result = await _client.get(url);
return handleResponse(result, ParseApiRQ.query);
} on Exception catch (e) {
return handleException(e, ParseApiRQ.query);
diff --git a/lib/src/objects/parse_user.dart b/lib/src/objects/parse_user.dart
index 63d983347..69e921443 100644
--- a/lib/src/objects/parse_user.dart
+++ b/lib/src/objects/parse_user.dart
@@ -74,8 +74,7 @@ class ParseUser extends ParseObject implements ParseCloneable {
host: tempUri.host,
path: "${tempUri.path}$keyEndPointUserName");
- final response = await _client
- .get(uri, headers: {keyHeaderSessionToken: _client.data.sessionId});
+ final response = await _client.get(uri, headers: {keyHeaderSessionToken: _client.data.sessionId});
return _handleResponse(response, ParseApiRQ.currentUser);
} on Exception catch (e) {
return _handleException(e, ParseApiRQ.currentUser);
diff --git a/pubspec.yaml b/pubspec.yaml
index 0d2fdab72..53dbe4721 100644
--- a/pubspec.yaml
+++ b/pubspec.yaml
@@ -1,6 +1,6 @@
name: parse_server_sdk
description: Flutter plugin for Parse Server, (https://parseplatform.org), (https://back4app.com)
-version: 1.0.7
+version: 1.0.8
homepage: https://github.com/phillwiggins/flutter_parse_sdk
author: PhillWiggins