queryLocationByAlias method

Future<List<Location>> queryLocationByAlias(
  1. String alias
)
inherited

Retrieve an array of third party network locations from a SDN room alias.

alias The SDN room alias to look up.

Implementation

Future<List<Location>> queryLocationByAlias(String alias) async {
  final requestUri =
      Uri(path: '_api/client/v3/thirdparty/location', queryParameters: {
    'alias': alias,
  });
  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 (json as List)
      .map((v) => Location.fromJson(v as Map<String, Object?>))
      .toList();
}