@@ -17,9 +17,9 @@ def __init__(self, status):
1717
1818class ProcessingResponse (_Response ):
1919
20- def __init__ (self , status , countdown = 0 , output = None ):
20+ def __init__ (self , status , countdown = 30 , output = None ):
2121 super ().__init__ (status )
22- self .countdown = countdown
22+ self .countdown = 30 if countdown < 30 else countdown
2323 self .output = output
2424
2525 @classmethod
@@ -34,23 +34,40 @@ def skip(cls, output=None):
3434 def reschedule (cls , countdown = 30 ):
3535 return cls (ResultType .RESCHEDULE , countdown = countdown )
3636
37+ @classmethod
38+ def slow_process_reschedule (cls , countdown = 300 ):
39+ return cls (
40+ ResultType .RESCHEDULE ,
41+ countdown = 300 if countdown < 300 else countdown ,
42+ )
43+
44+ @classmethod
45+ def fail (cls , output = None ):
46+ return cls (ResultType .FAIL , output = output )
47+
3748
3849class ValidationResponse (_Response ):
39- def __init__ (self , status , data ):
50+ def __init__ (self , status , data , output = None ):
4051 super ().__init__ (status )
4152 self .data = data
53+ self .output = output
4254
4355 @classmethod
4456 def done (cls , data ):
4557 return cls (ResultType .SUCCESS , data )
4658
59+ @classmethod
60+ def fail (cls , data = None , output = None ):
61+ return cls (ResultType .FAIL , data = data , output = output )
62+
4763
4864class _InteractiveTaskResponse (_Response ):
49- def __init__ (self , status , http_status , headers , body ):
65+ def __init__ (self , status , http_status , headers , body , output ):
5066 super ().__init__ (status )
5167 self .http_status = http_status
5268 self .headers = headers
5369 self .body = body
70+ self .output = output
5471
5572 @property
5673 def data (self ):
@@ -62,7 +79,11 @@ def data(self):
6279
6380 @classmethod
6481 def done (cls , http_status = 200 , headers = None , body = None ):
65- return cls (ResultType .SUCCESS , http_status , headers , body )
82+ return cls (ResultType .SUCCESS , http_status , headers , body , None )
83+
84+ @classmethod
85+ def fail (cls , http_status = 400 , headers = None , body = None , output = None ):
86+ return cls (ResultType .FAIL , http_status , headers , body , output )
6687
6788
6889class CustomEventResponse (_InteractiveTaskResponse ):
0 commit comments