public static async Task <HttpResponseMessage> HttpStart( [HttpTrigger(AuthorizationLevel.Anonymous, "get", "post")] HttpRequestMessage req, [OrchestrationClient] DurableOrchestrationClient starter, TraceWriter log) { //req.Properties[""] // Function input comes from the request content. var httpContext = (HttpContext)req.Properties[nameof(HttpContext)]; var input = new SearchFlightCommand() { SearchId = httpContext.Request.Query["searchId"].ToString(), ReturnUrl = httpContext.Request.Query["returnUrl"].ToString(), Destination = httpContext.Request.Query["destination"].ToString(), Origin = httpContext.Request.Query["origin"].ToString(), StartDate = DateTime.Parse(httpContext.Request.Query["startDate"].ToString()), }; string instanceId = await starter.StartNewAsync("FlightSearchOrchestration", input); log.Info($"Started orchestration with ID = '{instanceId}'."); return(starter.CreateCheckStatusResponse(req, instanceId)); }
public static async Task <IEnumerable <TicketSearchResultItem> > SearchTicketActivity([ActivityTrigger] SearchFlightCommand searchFlightCommand, TraceWriter log) { log.Info($"Searching for tickets"); return(await new TicketAPI().Search(searchFlightCommand.Destination, searchFlightCommand.StartDate)); }