getLabelDefinitions method

Implementation

Future<Map<String, List<InterpretedLabelValueDefinition>>>
    getLabelDefinitions(final ModerationPrefs prefs) async {
  final dids = <String>{
    _kBskyLabelerDid, // need when they don't have LabelersPref in their pref
    ...prefs.labelers.map((e) => e.did),
  }.toList();

  final labelers = await getServices(
    dids: dids,
    detailed: true,
    $headers: getLabelerHeaders(prefs),
  );

  final labelDefs = <String, List<InterpretedLabelValueDefinition>>{};
  for (final labeler in labelers.data.views) {
    if (labeler.isLabelerViewDetailed) {
      final data = labeler.labelerViewDetailed;
      final did = data.creator.did;

      labelDefs[did] = getInterpretedLabelValueDefinitions(data);
    }
  }

  return labelDefs;
}