approveRequest method

Future<void> approveRequest(
  1. CapabilityLink capabilityLink,
  2. Signed<WitnessStatement> signedWitnessStatement,
  3. PrivateKey withPrivateKey
)

Implementation

Future<void> approveRequest(
  CapabilityLink capabilityLink,
  Signed<WitnessStatement> signedWitnessStatement,
  PrivateKey withPrivateKey,
) async {
  final content = signedWitnessStatement.toJson();
  final resp = await postAuth(
    '/request/${capabilityLink.value}/approve',
    json.encode(content),
    withPrivateKey,
  );

  if (resp.statusCode != HttpStatus.ok) {
    return Future.error(HttpResponseError(resp.statusCode, resp.body));
  }
}