@@ -1153,9 +1153,10 @@ async def query_gql_query(
11531153
11541154 async def create_diff (
11551155 self , branch : str , name : str , from_time : datetime , to_time : datetime , wait_until_completion : bool = True
1156- ) -> str :
1156+ ) -> bool | str :
1157+ if from_time > to_time :
1158+ raise ValueError ("from_time must be <= to_time" )
11571159 input_data = {
1158- # Should be switched to `wait_until_completion` once `background_execution` is removed server side.
11591160 "wait_until_completion" : wait_until_completion ,
11601161 "data" : {
11611162 "name" : name ,
@@ -1188,8 +1189,11 @@ async def get_diff_summary(
11881189 input_data = {"branch_name" : branch }
11891190 if name :
11901191 input_data ["name" ] = name
1191- if from_time and to_time :
1192+ if from_time and to_time and from_time > to_time :
1193+ raise ValueError ("from_time must be <= to_time" )
1194+ if from_time :
11921195 input_data ["from_time" ] = from_time .isoformat ()
1196+ if to_time :
11931197 input_data ["to_time" ] = to_time .isoformat ()
11941198 response = await self .execute_graphql (
11951199 query = query ,
@@ -2322,9 +2326,10 @@ def query_gql_query(
23222326
23232327 def create_diff (
23242328 self , branch : str , name : str , from_time : datetime , to_time : datetime , wait_until_completion : bool = True
2325- ) -> str :
2329+ ) -> bool | str :
2330+ if from_time > to_time :
2331+ raise ValueError ("from_time must be <= to_time" )
23262332 input_data = {
2327- # Should be switched to `wait_until_completion` once `background_execution` is removed server side.
23282333 "wait_until_completion" : wait_until_completion ,
23292334 "data" : {
23302335 "name" : name ,
@@ -2357,8 +2362,11 @@ def get_diff_summary(
23572362 input_data = {"branch_name" : branch }
23582363 if name :
23592364 input_data ["name" ] = name
2360- if from_time and to_time :
2365+ if from_time and to_time and from_time > to_time :
2366+ raise ValueError ("from_time must be <= to_time" )
2367+ if from_time :
23612368 input_data ["from_time" ] = from_time .isoformat ()
2369+ if to_time :
23622370 input_data ["to_time" ] = to_time .isoformat ()
23632371 response = self .execute_graphql (
23642372 query = query ,
0 commit comments