11from  __future__ import  annotations 
22
3+ import  warnings 
34from  typing  import  TYPE_CHECKING , Any , Optional , Union 
45from  urllib .parse  import  urlencode 
56
@@ -77,10 +78,19 @@ async def create(
7778        branch_name : str ,
7879        sync_with_git : bool  =  True ,
7980        description : str  =  "" ,
80-         background_execution : bool  =  False ,
81-     ) ->  BranchData :
81+         wait_until_completion : bool  =  True ,
82+         background_execution : Optional [bool ] =  False ,
83+     ) ->  BranchData  |  str :
84+         if  background_execution  is  not   None :
85+             warnings .warn (
86+                 "`background_execution` is deprecated, please use `wait_until_completion` instead." ,
87+                 DeprecationWarning ,
88+                 stacklevel = 1 ,
89+             )
90+ 
91+         wait_until_completion  =  wait_until_completion  or  not  background_execution 
8292        input_data  =  {
83-             "background_execution " : background_execution ,
93+             "wait_until_completion " : wait_until_completion ,
8494            "data" : {
8595                "name" : branch_name ,
8696                "description" : description ,
@@ -90,7 +100,8 @@ async def create(
90100
91101        query  =  Mutation (mutation = "BranchCreate" , input_data = input_data , query = MUTATION_QUERY_DATA )
92102        response  =  await  self .client .execute_graphql (query = query .render (), tracker = "mutation-branch-create" )
93- 
103+         if  not  wait_until_completion :
104+             return  BranchData (** response ["BranchCreate" ]["task" ]["id" ])
94105        return  BranchData (** response ["BranchCreate" ]["object" ])
95106
96107    async  def  delete (self , branch_name : str ) ->  bool :
0 commit comments