@@ -45,6 +45,31 @@ def delete(server_context: ServerContext, container_path: str = None) -> any:
45
45
return server_context .make_request (url , headers = headers )
46
46
47
47
48
+ def rename (
49
+ server_context : ServerContext ,
50
+ name : str = None ,
51
+ title : str = None ,
52
+ add_alias : bool = True ,
53
+ container_path : str = None ,
54
+ ) -> any :
55
+ """
56
+ Renames a container at the given container_path, or at the server_context's container path
57
+ :param server_context: A LabKey server context. See utils.create_server_context.
58
+ :param name: The new name of the container.
59
+ :param title: The new title of the container.
60
+ :param add_alias: Whether to add a folder alias for the folder's current name.
61
+ :param container_path: The path of the container to rename.
62
+ :return:
63
+ """
64
+ url = server_context .build_url ("admin" , "renameContainer.api" , container_path )
65
+ payload = {
66
+ "name" : name ,
67
+ "title" : title ,
68
+ "addAlias" : add_alias ,
69
+ }
70
+ return server_context .make_request (url , json = payload )
71
+
72
+
48
73
class ContainerWrapper :
49
74
"""
50
75
Wrapper for all of the API methods exposed in the container module. Used by the APIWrapper class.
@@ -68,3 +93,8 @@ def create(
68
93
69
94
def delete (self , container_path : str = None ):
70
95
return delete (self .server_context , container_path )
96
+
97
+ def rename (
98
+ self , name : str = None , title : str = None , add_alias : bool = True , container_path : str = None
99
+ ):
100
+ return rename (self .server_context , name , title , add_alias , container_path )
0 commit comments