getAccount3PIDs method

Future<List<ThirdPartyIdentifier>?> getAccount3PIDs()
inherited

Gets a list of the third party identifiers that the node has associated with the user's account.

This is not the same as the list of third party identifiers bound to the user's SDN ID in identity servers.

Identifiers in this list may be used by the node as, for example, identifiers that it will accept to reset the user's account password.

returns threepids:

Implementation

Future<List<ThirdPartyIdentifier>?> getAccount3PIDs() async {
  final requestUri = Uri(path: '_api/client/v3/account/3pid');
  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 ((v) => v != null
      ? (v as List)
          .map(
              (v) => ThirdPartyIdentifier.fromJson(v as Map<String, Object?>))
          .toList()
      : null)(json['threepids']);
}