wpNotifyUpdateToken method
Sends a request to update a user's FCM token into WordPress
using a valid token
and status
.
Implementation
Future<WPUpdateTokenResponse?> wpNotifyUpdateToken(
{required String token, required bool status}) async {
Map<String, dynamic> payload = {"token": token};
payload["status"] = status;
// send http request
return await network(
request: (api) =>
api.post("/$_prefix/$_apiVersion/token/update", data: payload),
handleSuccess: (response) {
dynamic json = response.data;
return _jsonHasBadStatus(json)
? _throwExceptionForStatusCode(json)
: WPUpdateTokenResponse.fromJson(json);
},
);
}