wpNonce method

Future<WPNonceResponse> wpNonce()

Makes a request to get a valid nonce code

Returns a WPNonceResponse future. Throws an Exception if fails.

Implementation

Future<WPNonceResponse> wpNonce() async {
  // send http request
  final json = await _http(
    method: "GET",
    url: _urlForRouteType(WPRouteType.AuthNonce),
  );

  // return response
  return _jsonHasBadStatus(json)
      ? this._throwExceptionForStatusCode(json)
      : WPNonceResponse.fromJson(json);
}