Example #1
0
        public async Task <IActionResult> Get(
            [FromServices] HealthUrls healthUrls,
            [FromServices] ILifetimeScope scope,
            CancellationToken cancellationToken = default)
        {
            var versions = new ConcurrentDictionary <string, string>();

            versions.TryAdd("publicApi", FormatVersion(Assembly.GetEntryAssembly().GetName().Version.ToString(4)));

            await Task.WhenAll(healthUrls.Select(x => GetDownstreamVersionAsync(x.Key, scope, versions, cancellationToken)));

            return(Ok(versions.OrderBy(x => x.Key).ToDictionary(x => x.Key, x => x.Value)));
        }
        public async Task <IActionResult> Get(
            [FromServices] IConfiguration configuration,
            [FromServices] HealthUrls healthUrls,
            [FromServices] MarketingVersion version,
            [FromServices] ILifetimeScope scope,
            CancellationToken cancellationToken = default)
        {
            var components = new ConcurrentDictionary <string, string>();

            components.TryAdd("publicApi", FormatVersion(Assembly.GetEntryAssembly().GetName().Version.ToString(4)));
            components.TryAdd("publicSite", configuration["SiteVersion"]);

            await Task.WhenAll(healthUrls.Select(url => GetDownstreamVersionAsync(url.Key, scope, components, cancellationToken)));

            return(Ok(new ApiVersionResponse(version, components)));
        }