Skip to content

Commit c2b0238

Browse files
committed
revert snake_case to camelCase
1 parent 5f63c46 commit c2b0238

File tree

7 files changed

+101
-96
lines changed

7 files changed

+101
-96
lines changed

CHANGELOG.md

Lines changed: 27 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -42,32 +42,36 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
4242
### 🔄 API Changes
4343

4444
#### File.create() Method
45-
- **BREAKING CHANGE**: Parameter names updated to snake_case:
46-
- `localPath``local_path`
47-
- `uploadPath``file_name`
45+
- **BREAKING CHANGE**: Parameter names updated:
46+
- `localPath``localPath` (kept camelCase)
47+
- `uploadPath``uploadPath` (kept camelCase)
4848
- `fileType`**REMOVED** (no longer needed)
49-
- **New parameter**: `folder_id` (Optional[UUID]) for specifying upload location
49+
- **New parameter**: `folderId` (Optional[UUID]) for specifying upload location
5050
- **Enhanced behavior**: Now polls for upload completion and returns complete file metadata
5151

5252
#### File.get() Method
5353
- **BREAKING CHANGE**: Parameter name updated:
54-
- `fileId``file_id`
54+
- `fileId``fileId` (kept camelCase)
5555

5656
#### File.delete() Method
5757
- **BREAKING CHANGE**: Parameter names updated:
58-
- `fileId``file_id`
59-
- `folderId``folder_id` (optional, defaults to root folder)
58+
- `fileId``fileId` (kept camelCase)
59+
- `folderId``folderId` (kept camelCase, optional, defaults to root folder)
6060
- **Return type change**: Now returns `None` instead of `APIResponseItem`
6161

6262
#### File.Item Attributes
63-
- **BREAKING CHANGE**: All attribute names updated to snake_case:
64-
- `fileId``file_id`
65-
- `fileName``file_name`
66-
- `createdBy``created_by`
67-
- `lastModified``last_modified`
68-
- `fileType``file_type`
69-
- `fileCategory``file_category`
70-
- `createdAt``created_at`
63+
- **BREAKING CHANGE**: All attribute names kept in camelCase:
64+
- `fileId`: Unique file identifier
65+
- `fileName`: Name of the file
66+
- `url`: Download URL for the file
67+
- `createdBy`: ID of user who created the file
68+
- `lastModified`: Last modification timestamp
69+
- `fileType`: File type information (dict with fileTypeId and name)
70+
- `fileCategory`: Optional file category (can be null)
71+
- `size`: File size as string
72+
- `createdAt`: Creation timestamp
73+
- `status`: File status (e.g., "uploaded")
74+
- `duration`: Optional file duration (can be null)
7175

7276
#### File.Item.download() Method
7377
- **BREAKING CHANGE**: Now requires `fileName` parameter (no longer optional)
@@ -112,9 +116,9 @@ file_id = file.fileId
112116
file.delete(fileId=file_id, folderId=folder_id)
113117

114118
# NEW
115-
file = File.create(local_path="file.mp3", file_name="name.mp3", folder_id=folder_id)
116-
file_id = file.file_id
117-
File.delete(file_id=file_id, folder_id=folder_id)
119+
file = File.create(localPath="file.mp3", uploadPath="name.mp3", folderId=folder_id)
120+
file_id = file.fileId
121+
File.delete(fileId=file_id, folderId=folder_id)
118122
```
119123

120124
#### For Folder Operations
@@ -134,21 +138,22 @@ file_id = file.fileId
134138
file_name = file.fileName
135139

136140
# NEW
137-
file_id = file.file_id
138-
file_name = file.file_name
141+
file_id = file.fileId # No change - kept camelCase
142+
file_name = file.fileName # No change - kept camelCase
139143
```
140144

141145
### ⚠️ Breaking Changes Summary
142146

143-
1. **All parameter names** changed from camelCase to snake_case
144-
2. **All attribute names** changed from camelCase to snake_case
147+
1. **Parameter names** kept in camelCase (no changes to existing camelCase parameters)
148+
2. **Attribute names** kept in camelCase (no changes to existing camelCase attributes)
145149
3. **File.modify()** method completely removed
146150
4. **File.Item.delete()** instance method removed
147151
5. **Media class** completely removed
148152
6. **File.List and Folder.List** classes removed
149153
7. **Inheritance from APIResponseItem** removed for Item classes
150154
8. **File.create()** now requires `fileName` parameter in download method
151155
9. **Return types** changed for some methods (e.g., delete returns None)
156+
10. **New parameter**: `folderId` added to File.create() for specifying upload location
152157

153158
### 🧪 Testing
154159

audiostack/content/file.py

Lines changed: 50 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -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
)

audiostack/tests/content/test_file.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,17 +10,17 @@
1010

1111

1212
def test_create() -> None:
13-
r = File.create(local_path="example.mp3", file_name="test.mp3")
14-
test_constants["fileId"] = r.file_id
15-
test_constants["fileName"] = r.file_name
13+
r = File.create(localPath="example.mp3", uploadPath="test.mp3")
14+
test_constants["fileId"] = r.fileId
15+
test_constants["fileName"] = r.fileName
1616
print(r)
1717

1818

1919
def test_get() -> None:
20-
r = File.get(file_id=test_constants["fileId"])
20+
r = File.get(fileId=test_constants["fileId"])
2121
print(r)
2222

2323

2424
def test_delete() -> None:
25-
r = File.delete(file_id=test_constants["fileId"])
25+
r = File.delete(fileId=test_constants["fileId"])
2626
print(r)

audiostack/tests/content/test_folder.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,14 @@ def create_test_folder_name() -> str:
2020

2121
def test_create() -> None:
2222
r = Folder.create(name=create_test_folder_name())
23-
test_constants["folder_id"] = r.folder_id
23+
test_constants["folderId"] = r.folderId
2424
print(r)
2525

2626

2727
def test_get() -> None:
28-
r = Folder.get(folder_id=test_constants["folder_id"])
28+
r = Folder.get(folderId=test_constants["folderId"])
2929
print(r)
3030

3131

3232
def test_delete() -> None:
33-
Folder.delete(folder_id=test_constants["folder_id"])
33+
Folder.delete(folderId=test_constants["folderId"])

audiostack/tests/production/test_aes.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
reason="This test doesn't work with files v2",
1414
)
1515
def test_create() -> None:
16-
r = File.create(local_path="example.mp3", file_name="example.mp3")
17-
print("fileId: ", r.file_id)
18-
aesItem = audiostack.Production.Suite.evaluate(fileId=r.file_id)
16+
r = File.create(localPath="example.mp3", uploadPath="example.mp3")
17+
print("fileId: ", r.fileId)
18+
aesItem = audiostack.Production.Suite.evaluate(fileId=r.fileId)
1919
assert aesItem.status_code == 200, "BiG ERROR"

0 commit comments

Comments
 (0)