public SkillResponse FunctionHandler(SkillRequest input, ILambdaContext context) { context.Logger.LogLine("Request Type: " + input.GetRequestType().Name); // Either use the appropriate request handler or just return an empty response. SkillRequestHandler appropriateRequestHandler = SkillRequestHandlers.Find(x => x.IsHandlerForRequest(input)); return(appropriateRequestHandler != null?appropriateRequestHandler.HandleRequest(input, context) : ResponseBuilder.Empty()); }
/// <summary> /// Uses the current context and skill request handler to return an appropriate response to the current request. /// If the request could not be handled, the FallbackResponse is used. /// </summary> /// <returns></returns> public SkillResponse HandleRequest() { return(SkillRequestHandler != null?SkillRequestHandler.HandleRequest() : FallbackResponse); }