public async Task <List <CraigslistListing> > GetCraigslist(LambdaEvent lambdaEvent) { if (lastCall < DateTime.Now.AddMinutes(-20) || lastSearchQuery != lambdaEvent.search_query || lastSearchCategory != lambdaEvent.category) { List <CraigslistListing> listings = new List <CraigslistListing>(); string awsEvent = JsonConvert.SerializeObject(lambdaEvent); HttpResponseMessage response = await RunLambda(awsEvent); if (response.IsSuccessStatusCode) { CraigslistListings allListings = JsonConvert.DeserializeObject <CraigslistListings>(response.Content.ReadAsStringAsync().Result); foreach (CraigslistListing listing in allListings.listings) { listings.Add(listing); } lastListings = listings; lastCall = DateTime.Now; lastSearchQuery = lambdaEvent.search_query; lastSearchCategory = lambdaEvent.category; return(listings); } return(null); } else { return(lastListings); } }
// If you rename this function, you will need to update the invocation shim // to match if you intend to test the function with 'amplify mock function' #pragma warning disable CS1998 public async Task <dynamic> LambdaHandler(LambdaEvent input, ILambdaContext context) { context.Logger.LogLine($"Received data: {Newtonsoft.Json.JsonConvert.SerializeObject(input)}"); return(new { key1 = input.key1.ToUpper(), key2 = input.key2.ToUpper(), }); }
// If you rename this function, you will need to update the invocation shim // to match if you intend to test the function with 'amplify mock function' #pragma warning disable CS1998 public async Task <dynamic> LambdaHandler(LambdaEvent input, ILambdaContext context) { context.Logger.LogLine($"Received data: {Newtonsoft.Json.JsonConvert.SerializeObject(input)}"); Console.WriteLine("Chargin in stripe (stripe.charges.create)"); Console.WriteLine("input" + input); return(new { key1 = "hello key1", key2 = "hello key2" }); }