getProtocolMetadata method
Fetches the metadata from the node about a particular third party protocol.
protocol
The name of the protocol.
Implementation
Future<Protocol> getProtocolMetadata(String protocol) async {
final requestUri = Uri(
path:
'_api/client/v3/thirdparty/protocol/${Uri.encodeComponent(protocol)}');
final request = Request('GET', baseUri!.resolveUri(requestUri));
request.headers['authorization'] = 'Bearer ${bearerToken!}';
final response = await httpClient.send(request);
final responseBody = await response.stream.toBytes();
if (response.statusCode != 200) unexpectedResponse(response, responseBody);
final responseString = utf8.decode(responseBody);
final json = jsonDecode(responseString);
return Protocol.fromJson(json as Map<String, Object?>);
}