public async Task <ActionResult> Run(
            [HttpTrigger(AuthorizationLevel.Anonymous, "get", Route = null)] HttpRequest req)
        {
            var principal = StaticWebAppsAuth.Parse(req);
            var adminUser = principal.Claims.FirstOrDefault(c => c.Type == ClaimTypes.Name);

            _logger.LogInformation($"Spegling begärd av {adminUser}");

            string user = req.Query["user"].ToString();

            if (string.IsNullOrEmpty(user))
            {
                return(new BadRequestObjectResult("'user' must be specified"));
            }

            try
            {
                var result = await _nyaSenderClient.CallMirrorFunction(user);

                return(new OkObjectResult(result));
            }catch (RequestException e)
            {
                _logger.LogError(e, $"Spegling misslyckades: {e.Message}");
                return(new ObjectResult(e.Payload ?? e.Message)
                {
                    StatusCode = (int)e.StatusCode
                });
            }
        }
        public async Task <ActionResult> Run(
            [HttpTrigger(AuthorizationLevel.Anonymous, "get", Route = null)] HttpRequest req)
        {
            var principal = StaticWebAppsAuth.Parse(req);
            var adminUser = principal.Claims.FirstOrDefault(c => c.Type == ClaimTypes.Name);

            _logger.LogInformation($"ListGroups called by {adminUser}");

            try
            {
                var result = await _nyaSenderClient.CallListGroup();

                return(new OkObjectResult(result));
            }catch (RequestException e)
            {
                return(new ObjectResult(e.Payload ?? e.Message)
                {
                    StatusCode = (int)e.StatusCode
                });
            }
        }