internal async Task ApiGetPath(
            HttpContext context,
            FeatureFlagsSettings settings
            )
        {
            if (context.Request.Method != HttpMethods.Get)
            {
                context.Response.StatusCode = StatusCodes.Status405MethodNotAllowed;
                return;
            }

            var featureFlagsSessionManager = context.RequestServices.GetRequiredService <FeatureFlagsSessionManager>();

            var featureName = context.Request.Query["feature"];

            if (string.IsNullOrEmpty(featureName))
            {
                context.Response.StatusCode = StatusCodes.Status400BadRequest;
                return;
            }

            var featureType = settings.GetFeatureType(featureName);

            if (featureType is null)
            {
                context.Response.StatusCode = StatusCodes.Status404NotFound;
                return;
            }

            var value = await featureFlagsSessionManager.GetAsync(featureName);

            var response = new FeatureResponse
            {
                Name        = featureName,
                Description = featureType.GetDescription(),
                Enabled     = value,
            };

            var json = JsonConvert.SerializeObject(response);

            await context.Response.WriteAsync(json).ConfigureAwait(false);
        }
        internal async Task ApiGetAllPath(
            HttpContext context,
            FeatureFlagsSettings settings
            )
        {
            if (context.Request.Method != HttpMethods.Get)
            {
                context.Response.StatusCode = StatusCodes.Status405MethodNotAllowed;
                return;
            }

            var sessionManager = context.RequestServices.GetService <FeatureFlagsSessionManager>();

            if (sessionManager == null)
            {
                throw new InvalidOperationException(
                          $"{nameof(FeatureFlagsSessionManager)} must be registered via {nameof(UIStartupExtensions.UseRimDevFeatureFlagsUI)}()");
            }

            var features = new List <object>();

            foreach (var featureType in settings.FeatureFlagTypes)
            {
                var featureName = featureType.Name;
                var enabled     = await sessionManager.GetAsync(featureName);

                var featureResponse = new FeatureResponse
                {
                    Name        = featureName,
                    Description = featureType.GetDescription(),
                    Enabled     = enabled,
                };

                features.Add(featureResponse);
            }

            var json = JsonConvert.SerializeObject(features);

            await context.Response.WriteAsync(json).ConfigureAwait(false);
        }