getReleases method

Future<List<SoftwareRelease>> getReleases({
  1. required SoftwareAppRef app,
  2. String channel = 'main',
  3. Iterable<String>? relays,
  4. Duration? timeout,
})

Implementation

Future<List<SoftwareRelease>> getReleases({
  required SoftwareAppRef app,
  String channel = 'main',
  Iterable<String>? relays,
  Duration? timeout,
}) async {
  final response = _requests.query(
    filter: Filter(
      authors: [app.publisher],
      kinds: const [softwareReleaseKind],
      tags: {
        '#i': [app.identifier],
        '#c': [channel],
      },
    ),
    explicitRelays: relays,
    timeout: timeout,
    name: 'software-releases',
  );
  final events = await response.future;
  if (events.isEmpty &&
      !response.relayOutcomes.values.any(
        (outcome) => outcome.status == RelayRequestStatus.eose,
      )) {
    throw const SoftwareDiscoveryException(
      'No relay completed software release discovery',
    );
  }
  return _validReleases(events, app, channel);
}