Added callback to ApiResponse for end-time function calls