Skip to content

Merger #46

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Jan 21, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
## 1.0.9
Fixed Health Check issue

## 1.0.8
Fixed some queries

2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -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.8
parse_server_sdk: ^1.0.9
```
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.

14 changes: 7 additions & 7 deletions example/lib/main.dart
Original file line number Diff line number Diff line change
@@ -35,10 +35,10 @@ class _MyAppState extends State<MyApp> {

initParse() async {
// Initialize parse
Parse().initialize(ApplicationConstants.keyParseApplicationId,
Parse().initialize(
ApplicationConstants.keyParseApplicationId,
ApplicationConstants.keyParseServerUrl,
masterKey: ApplicationConstants.keyParseMasterKey,
appName: ApplicationConstants.keyAppName,
debug: true);

// Check server is healthy and live - Debug is on in this instance so check logs for result
@@ -74,7 +74,7 @@ class _MyAppState extends State<MyApp> {
}

void getAllItemsByName() async {
var apiResponse = await ParseObject('ParseTableName').getAll();
var apiResponse = await ParseObject('TestObjectForApi').getAll();

if (apiResponse.success && apiResponse.result != null) {
for (var testObject in apiResponse.result) {
@@ -120,14 +120,14 @@ class _MyAppState extends State<MyApp> {
}

void query() async {
var queryBuilder = QueryBuilder<DietPlan>(DietPlan())
..whereContains(DietPlan.keyName, "iet")
..keysToReturn([DietPlan.keyName]);
var queryBuilder = QueryBuilder<ParseObject>(ParseObject('TestObjectForApi'))
..setLimit(10)
..includeObject(['Day']);

var apiResponse = await queryBuilder.query();

if (apiResponse.success && apiResponse.result != null) {
print("Result: ${((apiResponse.result as List<dynamic>).first as DietPlan).toString()}");
print("Result: ${((apiResponse.result as List<dynamic>).first as ParseObject).toString()}");
} else {
print("Result: ${apiResponse.error.message}");
}
6 changes: 3 additions & 3 deletions lib/parse.dart
Original file line number Diff line number Diff line change
@@ -69,8 +69,8 @@ class Parse {
// liveQuery: true);
// ```
Parse initialize(String appId, String serverUrl,
{bool debug,
String appName,
{bool debug: false,
String appName: "",
String liveQueryUrl,
String masterKey,
String sessionId}) {
@@ -96,7 +96,7 @@ class Parse {

try {
var response = await ParseHTTPClient().get("${ParseCoreData().serverUrl}$keyEndPointHealth");
parseResponse = ParseResponse.handleResponse(this, response);
parseResponse = ParseResponse.handleResponse(this, response, returnAsResult: true);
} on Exception catch (e) {
parseResponse = ParseResponse.handleException(e);
}
2 changes: 1 addition & 1 deletion lib/src/objects/parse_response.dart
Original file line number Diff line number Diff line change
@@ -46,7 +46,7 @@ class ParseResponse {
/// Handles any errors returned in response
static ParseResponse _handleError(ParseResponse response, Response apiResponse) {
Map<String, dynamic> responseData = json.decode(apiResponse.body);
response.error = ParseError(code: responseData['code'], message: responseData['error']);
response.error = ParseError(code: responseData['code'], message: responseData['error'].toString());
response.statusCode = responseData['code'];
return response;
}
4 changes: 3 additions & 1 deletion lib/src/utils/parse_logger.dart
Original file line number Diff line number Diff line change
@@ -6,8 +6,10 @@ void logger(
String type,
ParseResponse parseResponse) {
var responseString = ' \n';
var name = appName;
if (name.length > 0) name = "$appName ";

responseString += "----\n$appName API Response ($className : $type) :";
responseString += "----\n${name}API Response ($className : $type) :";

if (parseResponse.success) {
responseString += "\nStatus Code: ${parseResponse.statusCode}";