/// <summary> /// Access completed result of lambda function as dynamic object. If completed result is JSON object then you can directly access its properties. /// Throws exception when last event is not lambda completed event. /// </summary> /// <param name="item"></param> /// <returns></returns> public static dynamic Result(this ILambdaItem item) { Ensure.NotNull(item, nameof(item)); var completedEvent = item.LastEvent() as LambdaCompletedEvent; if (completedEvent == null) { throw new InvalidOperationException(Resources.Lambda_result_can_not_be_accessed); } return(completedEvent.Result()); }
/// <summary> /// Retruns the <see cref="LambdaTimedoutEvent"/> and if it is the last event, otherwise null is returned. /// </summary> /// <param name="item"></param> /// <returns></returns> public static LambdaTimedoutEvent LastTimedoutEvent(this ILambdaItem item) { Ensure.NotNull(item, nameof(item)); return(item.LastEvent() as LambdaTimedoutEvent); }
/// <summary> /// Retruns the <see cref="LambdaCompletedEvent"/> and if it is the last event, otherwise null is returned. /// </summary> /// <param name="item"></param> /// <returns></returns> public static LambdaCompletedEvent LastCompletedEvent(this ILambdaItem item) { Ensure.NotNull(item, nameof(item)); return(item.LastEvent() as LambdaCompletedEvent); }