wpUserDelete method
Sends a request to delete a WordPress user. Include a valid
userToken
and an optional reassign
argument to send a successful request.
Returns a WPUserDeleteResponse future. Throws an Exception if fails.
Implementation
Future<WPUserDeleteResponse> wpUserDelete(
{String? userToken, int? reassign}) async {
Map<String, dynamic> payload = {};
if (reassign != null) {
payload["reassign"] = reassign;
}
// send http request
final json = await _http(
method: "POST",
url: _urlForRouteType(WPRouteType.UserDelete),
userToken: userToken,
shouldAuthRequest: true,
body: payload,
);
// return response
return _jsonHasBadStatus(json)
? this._throwExceptionForStatusCode(json)
: WPUserDeleteResponse.fromJson(json);
}