Merge branch 'notifications_fix' into 'master'
[SetPushersRequest] Don't include null values See merge request famedly/famedlysdk!29
This commit is contained in:
commit
d4883acf28
|
@ -259,7 +259,7 @@ class Client {
|
||||||
final dynamic resp = await connection.jsonRequest(
|
final dynamic resp = await connection.jsonRequest(
|
||||||
type: HTTPType.POST,
|
type: HTTPType.POST,
|
||||||
action: "/client/r0/pushers/set",
|
action: "/client/r0/pushers/set",
|
||||||
data: data,
|
data: data.toJson(),
|
||||||
);
|
);
|
||||||
|
|
||||||
if (resp is ErrorResponse) {
|
if (resp is ErrorResponse) {
|
||||||
|
|
|
@ -185,7 +185,9 @@ class Connection {
|
||||||
if (client.isLogged() == false && client.homeserver == null)
|
if (client.isLogged() == false && client.homeserver == null)
|
||||||
throw ("No homeserver specified.");
|
throw ("No homeserver specified.");
|
||||||
if (timeout == null) timeout = syncTimeoutSec + 5;
|
if (timeout == null) timeout = syncTimeoutSec + 5;
|
||||||
if (!(data is String)) data = jsonEncode(data);
|
dynamic json;
|
||||||
|
if (data is Map) data.removeWhere((k, v) => v == null);
|
||||||
|
(!(data is String)) ? json = jsonEncode(data) : json = data;
|
||||||
|
|
||||||
final url = "${client.homeserver}/_matrix${action}";
|
final url = "${client.homeserver}/_matrix${action}";
|
||||||
|
|
||||||
|
@ -209,12 +211,12 @@ class Connection {
|
||||||
break;
|
break;
|
||||||
case "POST":
|
case "POST":
|
||||||
resp = await httpClient
|
resp = await httpClient
|
||||||
.post(url, body: data, headers: headers)
|
.post(url, body: json, headers: headers)
|
||||||
.timeout(Duration(seconds: timeout));
|
.timeout(Duration(seconds: timeout));
|
||||||
break;
|
break;
|
||||||
case "PUT":
|
case "PUT":
|
||||||
resp = await httpClient
|
resp = await httpClient
|
||||||
.put(url, body: data, headers: headers)
|
.put(url, body: json, headers: headers)
|
||||||
.timeout(Duration(seconds: timeout));
|
.timeout(Duration(seconds: timeout));
|
||||||
break;
|
break;
|
||||||
case "DELETE":
|
case "DELETE":
|
||||||
|
|
|
@ -25,7 +25,7 @@ import 'package:json_annotation/json_annotation.dart';
|
||||||
|
|
||||||
part 'SetPushersRequest.g.dart';
|
part 'SetPushersRequest.g.dart';
|
||||||
|
|
||||||
@JsonSerializable(explicitToJson: true, nullable: false)
|
@JsonSerializable(explicitToJson: true, nullable: false, includeIfNull: false)
|
||||||
class SetPushersRequest {
|
class SetPushersRequest {
|
||||||
// Required Keys
|
// Required Keys
|
||||||
@JsonKey(nullable: false)
|
@JsonKey(nullable: false)
|
||||||
|
@ -65,7 +65,7 @@ class SetPushersRequest {
|
||||||
Map<String, dynamic> toJson() => _$SetPushersRequestToJson(this);
|
Map<String, dynamic> toJson() => _$SetPushersRequestToJson(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@JsonSerializable(explicitToJson: true, nullable: false)
|
@JsonSerializable(explicitToJson: true, nullable: false, includeIfNull: false)
|
||||||
class PusherData {
|
class PusherData {
|
||||||
String url;
|
String url;
|
||||||
String format;
|
String format;
|
||||||
|
|
|
@ -28,7 +28,7 @@ packages:
|
||||||
name: boolean_selector
|
name: boolean_selector
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.0.4"
|
version: "1.0.5"
|
||||||
build:
|
build:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
|
@ -297,7 +297,7 @@ packages:
|
||||||
name: pedantic
|
name: pedantic
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.7.0"
|
version: "1.8.0+1"
|
||||||
pool:
|
pool:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
|
|
Loading…
Reference in a new issue