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 is! ULabelerServiceViewLabelerViewDetailed) continue;

    labelDefs[labeler.data.creator.did] = getInterpretedLabelValueDefinitions(
      labeler.data,
    );
  }

  return labelDefs;
}