sendRequest method

Future<CapabilityLink> sendRequest(
  1. Signed<WitnessRequest> witnessRequest
)

Implementation

Future<CapabilityLink> sendRequest(
  Signed<WitnessRequest> witnessRequest,
) async {
  final resp = await post('/request', json.encode(witnessRequest.toJson()));

  if (resp.statusCode == HttpStatus.accepted) {
    return SendRequestResponse.fromJson(json.decode(resp.body))
        .capabilityLink;
  }

  return Future.error(HttpResponseError(resp.statusCode, resp.body));
}