public async Task <HttpResponseMessage> ExecuteIntent([FromBody] SkillServiceRequest request) { try { var controllerId = _securityService.GetControllerUidFromAmazonUserId(request.Session.User.UserId); if (controllerId == null) { throw new UnauthorizedAccessException(); } var apiRequest = new ApiRequest { Action = "Service/IPersonalAgentService/ProcessSkillServiceRequest", Parameter = JObject.FromObject(request) }; var apiResponse = await _messageDispatcher.SendRequestAsync(controllerId.Value, apiRequest, TimeSpan.FromSeconds(5)); if (apiResponse.ResultCode == ApiResultCode.Success) { return(CreateJsonResponse(apiResponse.Result.ToObject <SkillServiceResponse>())); } return(CreateJsonResponse("Es ist ein Fehler aufgetreten. Du musst dich bei Christian beschweren.")); } catch (ControllerNotReachableException) { return(CreateJsonResponse("Ich konnte deine Wohnung leider nicht erreichen. Versuche es später noch einmal.")); } }
public Task <ApiResponse> Execute([FromBody] ApiRequest request) { if (request == null) { throw new ArgumentNullException(nameof(request)); } Guid controllerId; ValidateControllerSecurity(out controllerId); Trace.TraceInformation($"Received request for controller '{controllerId}'."); return(_messageDispatcher.SendRequestAsync(controllerId, request, _timeout)); }