@@ -31,15 +31,15 @@ def __init__(self, response: dict) -> None:
3131 Args:
3232 response: Dictionary containing file metadata from the API.
3333 """
34- self .file_id : str = response ["fileId" ]
35- self .file_name : str = response ["fileName" ]
34+ self .fileId : str = response ["fileId" ]
35+ self .fileName : str = response ["fileName" ]
3636 self .url : str = response .get ("url" , "" )
37- self .created_by : str = response .get ("createdBy" , "" )
38- self .last_modified : str = response .get ("lastModified" , "" )
39- self .file_type : dict = response .get ("fileType" , {})
40- self .file_category : Optional [str ] = response .get ("fileCategory" , None )
37+ self .createdBy : str = response .get ("createdBy" , "" )
38+ self .lastModified : str = response .get ("lastModified" , "" )
39+ self .fileType : dict = response .get ("fileType" , {})
40+ self .fileCategory : Optional [str ] = response .get ("fileCategory" , None )
4141 self .size : str = str (response .get ("size" , "" ))
42- self .created_at : str = response .get ("createdAt" , "" )
42+ self .createdAt : str = response .get ("createdAt" , "" )
4343 self .status : str = response .get ("status" , "" )
4444 self .duration : Optional [str ] = response .get ("duration" , None )
4545
@@ -60,56 +60,56 @@ def download(self, fileName: str, path: str = "./") -> None:
6060 RequestInterface .download_url (url = self .url , destination = path , name = fileName )
6161
6262 @staticmethod
63- def get (file_id : str ) -> Item :
63+ def get (fileId : str ) -> Item :
6464 """Retrieve a file by its ID.
6565
6666 Args:
67- file_id : The unique identifier of the file to retrieve.
67+ fileId : The unique identifier of the file to retrieve.
6868
6969 Returns:
7070 File.Item: A file item containing the file metadata.
7171 """
7272 r = File .interface .send_request (
7373 rtype = RequestTypes .GET ,
74- route = f"file/{ file_id } " ,
74+ route = f"file/{ fileId } " ,
7575 )
7676 return File .Item (response = r )
7777
7878 @staticmethod
7979 def create (
80- local_path : str ,
81- file_name : str ,
82- folder_id : Optional [UUID ] = None ,
80+ localPath : str ,
81+ uploadPath : str ,
82+ folderId : Optional [UUID ] = None ,
8383 ) -> Item :
8484 """Create and upload a new file to AudioStack.
8585
8686 This method uploads a local file to the AudioStack system and waits
8787 for the upload to complete before returning the file item.
8888
8989 Args:
90- local_path : Path to the local file to upload.
91- file_name : Name to assign to the file in AudioStack.
92- folder_id : Optional UUID of the folder to upload to. If None, uses root folder.
90+ localPath : Path to the local file to upload.
91+ uploadPath : Name to assign to the file in AudioStack.
92+ folderId : Optional UUID of the folder to upload to. If None, uses root folder.
9393
9494 Returns:
9595 File.Item: The created file item with complete metadata.
9696
9797 Raises:
98- Exception: If local_path is not provided, file doesn't exist, file_name is not provided,
98+ Exception: If localPath is not provided, file doesn't exist, uploadPath is not provided,
9999 or if the upload fails.
100100 """
101- if not local_path :
101+ if not localPath :
102102 raise Exception ("Please supply a localPath (path to your local file)" )
103103
104- if not os .path .isfile (local_path ):
104+ if not os .path .isfile (localPath ):
105105 raise Exception ("Supplied file does not exist" )
106106
107- if not file_name :
107+ if not uploadPath :
108108 raise Exception ("Please supply a valid file name" )
109109
110110 payload = {
111- "fileName" : file_name ,
112- "folderId" : folder_id ,
111+ "fileName" : uploadPath ,
112+ "folderId" : folderId ,
113113 }
114114
115115 r = File .interface .send_request (
@@ -118,36 +118,36 @@ def create(
118118 json = payload ,
119119 )
120120 File .interface .send_upload_request (
121- local_path = local_path , upload_url = r ["uploadUrl" ], mime_type = r ["mimeType" ]
121+ local_path = localPath , upload_url = r ["uploadUrl" ], mime_type = r ["mimeType" ]
122122 )
123123
124124 start = time .time ()
125125
126- file = File .get (file_id = r ["fileId" ])
126+ file = File .get (fileId = r ["fileId" ])
127127
128128 while file .status != "uploaded" and time .time () - start < TIMEOUT_THRESHOLD_S :
129129 print ("Response in progress please wait..." )
130- file = File .get (file_id = r ["fileId" ])
130+ file = File .get (fileId = r ["fileId" ])
131131
132132 if file .status != "uploaded" :
133133 raise Exception ("File upload failed" )
134134
135135 return file
136136
137137 @staticmethod
138- def delete (file_id : str , folder_id : str = "" ) -> None :
138+ def delete (fileId : str , folderId : str = "" ) -> None :
139139 """Delete a file from AudioStack.
140140
141141 Args:
142- file_id : The unique identifier of the file to delete.
143- folder_id : The folder ID where the file is located. If empty, uses root folder.
142+ fileId : The unique identifier of the file to delete.
143+ folderId : The folder ID where the file is located. If empty, uses root folder.
144144 """
145- if not folder_id :
146- folder_id = Folder .get_root_folder_id ()
145+ if not folderId :
146+ folderId = Folder .get_root_folder_id ()
147147
148148 File .interface .send_request (
149149 rtype = RequestTypes .DELETE ,
150- route = f"file/{ file_id } /{ folder_id } " ,
150+ route = f"file/{ fileId } /{ folderId } " ,
151151 )
152152
153153
@@ -173,12 +173,12 @@ def __init__(self, response: dict) -> None:
173173 Args:
174174 response: Dictionary containing folder metadata from the API.
175175 """
176- self .folder_id : str = response ["folderId" ]
177- self .folder_name : str = response ["folderName" ]
178- self .parent_folder_id : str = response .get ("parentFolderId" , "" )
179- self .created_by : str = response .get ("createdBy" , "" )
180- self .last_modified : Optional [str ] = response .get ("lastModified" , None )
181- self .created_at : str = response .get ("createdAt" , "" )
176+ self .folderId : str = response ["folderId" ]
177+ self .folderName : str = response ["folderName" ]
178+ self .parentFolderId : str = response .get ("parentFolderId" , "" )
179+ self .createdBy : str = response .get ("createdBy" , "" )
180+ self .lastModified : Optional [str ] = response .get ("lastModified" , None )
181+ self .createdAt : str = response .get ("createdAt" , "" )
182182
183183 class ListResponse :
184184 """Represents a list response containing folders and files.
@@ -199,7 +199,7 @@ def __init__(self, response: dict) -> None:
199199 self .files : List [File .Item ] = [
200200 File .Item (response = x ) for x in response ["files" ]
201201 ]
202- self .current_path_chain : dict = response ["currentPathChain" ]
202+ self .currentPathChain : dict = response ["currentPathChain" ]
203203
204204 @staticmethod
205205 def get_root_folder_id () -> str :
@@ -208,19 +208,19 @@ def get_root_folder_id() -> str:
208208 Returns:
209209 str: The unique identifier of the root folder.
210210 """
211- root_folder_id = Folder .interface .send_request (
211+ rootFolderId = Folder .interface .send_request (
212212 rtype = RequestTypes .GET ,
213213 route = "folder" ,
214214 )["currentPathChain" ][0 ]["folderId" ]
215- return root_folder_id
215+ return rootFolderId
216216
217217 @staticmethod
218- def create (name : str , parent_folder_id : Optional [UUID ] = None ) -> "Folder.Item" :
218+ def create (name : str , parentFolderId : Optional [UUID ] = None ) -> "Folder.Item" :
219219 """Create a new folder in AudioStack.
220220
221221 Args:
222222 name: The name of the folder to create.
223- parent_folder_id : Optional UUID of the parent folder. If None, creates in root.
223+ parentFolderId : Optional UUID of the parent folder. If None, creates in root.
224224
225225 Returns:
226226 Folder.Item: The created folder item with complete metadata.
@@ -229,8 +229,8 @@ def create(name: str, parent_folder_id: Optional[UUID] = None) -> "Folder.Item":
229229 "folderName" : name ,
230230 }
231231
232- if parent_folder_id :
233- payload ["parentFolderId" ] = str (parent_folder_id )
232+ if parentFolderId :
233+ payload ["parentFolderId" ] = str (parentFolderId )
234234
235235 r = Folder .interface .send_request (
236236 rtype = RequestTypes .POST ,
@@ -240,29 +240,29 @@ def create(name: str, parent_folder_id: Optional[UUID] = None) -> "Folder.Item":
240240 return Folder .Item (response = r )
241241
242242 @staticmethod
243- def get (folder_id : UUID ) -> "Folder.Item" :
243+ def get (folderId : UUID ) -> "Folder.Item" :
244244 """Retrieve a folder by its ID.
245245
246246 Args:
247- folder_id : The unique identifier of the folder to retrieve.
247+ folderId : The unique identifier of the folder to retrieve.
248248
249249 Returns:
250250 Folder.Item: A folder item containing the folder metadata.
251251 """
252252 r = Folder .interface .send_request (
253253 rtype = RequestTypes .GET ,
254- route = f"folder/{ folder_id } " ,
254+ route = f"folder/{ folderId } " ,
255255 )
256256 return Folder .Item (response = r ["currentPathChain" ][0 ])
257257
258258 @staticmethod
259- def delete (folder_id : UUID ) -> None :
259+ def delete (folderId : UUID ) -> None :
260260 """Delete a folder from AudioStack.
261261
262262 Args:
263- folder_id : The unique identifier of the folder to delete.
263+ folderId : The unique identifier of the folder to delete.
264264 """
265265 File .interface .send_request (
266266 rtype = RequestTypes .DELETE ,
267- route = f"folder/{ folder_id } " ,
267+ route = f"folder/{ folderId } " ,
268268 )
0 commit comments