Skip to content

Commit 722fb31

Browse files
authored
feat: update for new file system implementation (#75)
* feat: update for new file system implementation * change base url * only useful methods * add docstrings * fix files and typing * fix cc reporter * revert snake_case to camelCase * Update CHANGELOG.md
1 parent d72102b commit 722fb31

File tree

17 files changed

+450
-355
lines changed

17 files changed

+450
-355
lines changed

.circleci/config.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@ jobs:
3838
./cc-test-reporter before-build
3939
export AUDIO_STACK_DEV_KEY=$AFLR_API_KEY_PROD_TEST
4040
poetry run task test
41-
./cc-test-reporter after-build \
42-
--coverage-input-type coverage.py --exit-code $?
41+
# ./cc-test-reporter after-build \
42+
# --coverage-input-type coverage.py --exit-code $?
4343
lint:
4444
docker:
4545
- image: cimg/python:3.8

CHANGELOG.md

Lines changed: 165 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,171 @@ All notable changes to `audiostack` will be documented in this file.
44
The format is based on [Keep a Changelog](http://keepachangelog.com/)
55
and this project adheres to [Semantic Versioning](http://semver.org/).
66

7+
## [3.0.0] - 2025-07-29
8+
9+
### 🆕 New Features
10+
11+
#### File System Overhaul
12+
- **Complete file system redesign** with hierarchical folder structure
13+
- **New File.Item class** with comprehensive metadata:
14+
- `fileId`: Unique file identifier
15+
- `fileName`: Name of the file
16+
- `url`: Download URL for the file
17+
- `createdBy`: ID of user who created the file
18+
- `lastModified`: Last modification timestamp
19+
- `fileType`: File type information (dict with fileTypeId and name)
20+
- `fileCategory`: Optional file category (can be null)
21+
- `size`: File size as string
22+
- `createdAt`: Creation timestamp
23+
- `status`: File status (e.g., "uploaded")
24+
- `duration`: Optional file duration (can be null)
25+
26+
#### New Folder System
27+
- **New Folder.Item class** with hierarchical structure:
28+
- `folderId`: Unique folder identifier
29+
- `folderName`: Name of the folder
30+
- `parentFolderId`: Parent folder ID (empty string for root)
31+
- `createdBy`: ID of user who created the folder
32+
- `lastModified`: Optional last modification timestamp (can be null)
33+
- `createdAt`: Creation timestamp
34+
- **New Folder.ListResponse class** for folder listing operations with:
35+
- `folders`: List of Folder.Item objects
36+
- `files`: List of File.Item objects
37+
- `currentPathChain`: Dictionary containing path chain information
38+
- **New Folder.get_root_folder_id()` method to get root folder ID
39+
40+
#### Enhanced File Operations
41+
- **Improved file upload process** with automatic polling for completion
42+
- **Timeout handling** using `TIMEOUT_THRESHOLD_S` for upload operations
43+
- **Better error handling** with specific error messages for upload failures
44+
45+
### 🔄 API Changes
46+
47+
#### File.create() Method
48+
- **BREAKING CHANGE**: Parameter names updated:
49+
- `fileType`**REMOVED** (no longer needed)
50+
- **New parameter**: `folderId` (Optional[UUID]) for specifying upload location
51+
- **Enhanced behavior**: Now polls for upload completion and returns complete file metadata
52+
53+
#### File.get() Method
54+
- **BREAKING CHANGE**: Parameter name updated:
55+
- `fileId``fileId` (kept camelCase)
56+
57+
#### File.delete() Method
58+
- **BREAKING CHANGE**: Parameter names updated:
59+
- `fileId``fileId` (kept camelCase)
60+
- `folderId``folderId` (kept camelCase, optional, defaults to root folder)
61+
- **Return type change**: Now returns `None` instead of `APIResponseItem`
62+
63+
#### File.Item Attributes
64+
- **BREAKING CHANGE**: All attribute names kept in camelCase:
65+
- `fileId`: Unique file identifier
66+
- `fileName`: Name of the file
67+
- `url`: Download URL for the file
68+
- `createdBy`: ID of user who created the file
69+
- `lastModified`: Last modification timestamp
70+
- `fileType`: File type information (dict with fileTypeId and name)
71+
- `fileCategory`: Optional file category (can be null)
72+
- `size`: File size as string
73+
- `createdAt`: Creation timestamp
74+
- `status`: File status (e.g., "uploaded")
75+
- `duration`: Optional file duration (can be null)
76+
77+
#### File.Item.download() Method
78+
- **BREAKING CHANGE**: Now requires `fileName` parameter (no longer optional)
79+
80+
#### Folder Methods
81+
- **Folder.create(name, parentFolderId)** - Create new folder with optional parent
82+
- **Folder.get(folderId)** - Retrieve folder by ID
83+
- **Folder.delete(folderId)** - Delete folder by ID
84+
- **Folder.get_root_folder_id()** - Get root folder ID
85+
86+
### 🗑️ Removed Features
87+
88+
#### Deprecated Methods
89+
- **File.modify()** - Completely removed
90+
- **File.get_file_categories()** - Completely removed
91+
- **File.get_category_id_by_name()** - Completely removed
92+
- **File.Item.delete()** - Instance method removed (use static method instead)
93+
94+
#### Deprecated Classes
95+
- **Media class** - Completely removed
96+
- **File.List class** - Replaced with Folder.ListResponse
97+
- **Folder.List class** - Replaced with Folder.ListResponse
98+
99+
#### Deprecated Inheritance
100+
- **File.Item** no longer inherits from `APIResponseItem`
101+
- **Folder.Item** no longer inherits from `APIResponseItem`
102+
103+
### 🔧 Technical Improvements
104+
105+
#### Code Quality
106+
- **Comprehensive docstrings** added to all methods and classes (PEP 257 compliant)
107+
- **Type hints** improved throughout the codebase
108+
- **Better error messages** with more descriptive exceptions
109+
- **Fixed typos** in error messages ("eixst" → "exist")
110+
111+
#### Upload Process
112+
- **Fixed upload polling logic** with proper timeout handling
113+
- **Added mime_type parameter** to `send_upload_request` calls
114+
- **Improved upload status checking** with proper boolean logic
115+
116+
### 📝 Migration Guide
117+
118+
#### For File Operations
119+
```python
120+
# OLD
121+
file = File.create(localPath="file.mp3", uploadPath="name.mp3", fileType="audio")
122+
fileId = file.fileId
123+
file.delete(fileId=fileId, folderId=folderId)
124+
125+
# NEW
126+
file = File.create(localPath="file.mp3", uploadPath="name.mp3", folderId=folderId)
127+
fileId = file.fileId
128+
File.delete(fileId=fileId, folderId=folderId)
129+
```
130+
131+
#### For Folder Operations
132+
```python
133+
# OLD
134+
root = Folder.get_root() # Returns Folder.Item
135+
folderId = root.currentPathChain["folderId"]
136+
137+
# NEW
138+
folderId = Folder.get_root_folder_id() # Returns string directly
139+
```
140+
141+
#### For File Item Access
142+
```python
143+
# OLD
144+
fileId = file.fileId
145+
fileName = file.fileName
146+
147+
# NEW
148+
fileId = file.fileId # No change - kept camelCase
149+
fileName = file.fileName # No change - kept camelCase
150+
```
151+
152+
### ⚠️ Breaking Changes Summary
153+
154+
1. **Parameter names** kept in camelCase (no changes to existing camelCase parameters)
155+
2. **Attribute names** kept in camelCase (no changes to existing camelCase attributes)
156+
3. **File.modify()** method completely removed
157+
4. **File.Item.delete()** instance method removed
158+
5. **Media class** completely removed
159+
6. **File.List and Folder.List** classes removed
160+
7. **Inheritance from APIResponseItem** removed for Item classes
161+
8. **File.create()** now requires `fileName` parameter in download method
162+
9. **Return types** changed for some methods (e.g., delete returns None)
163+
10. **New parameter**: `folderId` added to File.create() for specifying upload location
164+
165+
### 🧪 Testing
166+
167+
- **All existing tests updated** to work with new API
168+
- **New test patterns** for folder operations
169+
- **Conditional test skipping** for staging environment
170+
- **Improved test coverage** for new file system features
171+
7172
## [2.10.1] - 2025-02-24
8173
- Fixed logic that removed 0 float values from payload
9174

audiostack/content/__init__.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
from audiostack.content.file import File, Folder # noqa: F401
2-
from audiostack.content.media import Media # noqa: F401
32
from audiostack.content.recommend import ( # noqa: F401
43
RecommendIAB,
54
RecommendMood,

0 commit comments

Comments
 (0)