public async Task <SessionStateResponse> GetSessionAsync(string matchmakerSessionId) { if (!ValidateMatchmakerSessionIdFormat(matchmakerSessionId)) { return(SessionStateResponse.ErrorResponse()); } SessionState sessionState = await _rowStorage.GetRowAsync <SessionState>(matchmakerSessionId); if (sessionState == null) { return(SessionStateResponse.ErrorResponse()); } return(new SessionStateResponse { Connected = sessionState.Connected, Valid = sessionState.Valid }); }
public async Task <IActionResult> GetSessionAsync( [HttpTrigger(AuthorizationLevel.Anonymous, "get", Route = "session/{sessionId}")] HttpRequest req, string sessionId, ILogger log) { // Validate keys if (!TryValidateRequest(req, out PartyType _)) { return(new UnauthorizedResult()); } log.LogInformation("Getting session status"); SessionStateResponse session = await _matchmakerService.GetSessionAsync(sessionId); if (session == null) { return(new BadRequestResult()); } return(new JsonResult(session)); }