Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ jobs:
./cc-test-reporter before-build
export AUDIO_STACK_DEV_KEY=$AFLR_API_KEY_PROD_TEST
poetry run task test
./cc-test-reporter after-build \
--coverage-input-type coverage.py --exit-code $?
# ./cc-test-reporter after-build \
# --coverage-input-type coverage.py --exit-code $?
lint:
docker:
- image: cimg/python:3.8
Expand Down
165 changes: 165 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,171 @@ All notable changes to `audiostack` will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/)
and this project adheres to [Semantic Versioning](http://semver.org/).

## [3.0.0] - 2025-07-29

### 🆕 New Features

#### File System Overhaul
- **Complete file system redesign** with hierarchical folder structure
- **New File.Item class** with comprehensive metadata:
- `fileId`: Unique file identifier
- `fileName`: Name of the file
- `url`: Download URL for the file
- `createdBy`: ID of user who created the file
- `lastModified`: Last modification timestamp
- `fileType`: File type information (dict with fileTypeId and name)
- `fileCategory`: Optional file category (can be null)
- `size`: File size as string
- `createdAt`: Creation timestamp
- `status`: File status (e.g., "uploaded")
- `duration`: Optional file duration (can be null)

#### New Folder System
- **New Folder.Item class** with hierarchical structure:
- `folderId`: Unique folder identifier
- `folderName`: Name of the folder
- `parentFolderId`: Parent folder ID (empty string for root)
- `createdBy`: ID of user who created the folder
- `lastModified`: Optional last modification timestamp (can be null)
- `createdAt`: Creation timestamp
- **New Folder.ListResponse class** for folder listing operations with:
- `folders`: List of Folder.Item objects
- `files`: List of File.Item objects
- `currentPathChain`: Dictionary containing path chain information
- **New Folder.get_root_folder_id()` method to get root folder ID

#### Enhanced File Operations
- **Improved file upload process** with automatic polling for completion
- **Timeout handling** using `TIMEOUT_THRESHOLD_S` for upload operations
- **Better error handling** with specific error messages for upload failures

### 🔄 API Changes

#### File.create() Method
- **BREAKING CHANGE**: Parameter names updated:
- `fileType` → **REMOVED** (no longer needed)
- **New parameter**: `folderId` (Optional[UUID]) for specifying upload location
- **Enhanced behavior**: Now polls for upload completion and returns complete file metadata

#### File.get() Method
- **BREAKING CHANGE**: Parameter name updated:
- `fileId` → `fileId` (kept camelCase)

#### File.delete() Method
- **BREAKING CHANGE**: Parameter names updated:
- `fileId` → `fileId` (kept camelCase)
- `folderId` → `folderId` (kept camelCase, optional, defaults to root folder)
- **Return type change**: Now returns `None` instead of `APIResponseItem`

#### File.Item Attributes
- **BREAKING CHANGE**: All attribute names kept in camelCase:
- `fileId`: Unique file identifier
- `fileName`: Name of the file
- `url`: Download URL for the file
- `createdBy`: ID of user who created the file
- `lastModified`: Last modification timestamp
- `fileType`: File type information (dict with fileTypeId and name)
- `fileCategory`: Optional file category (can be null)
- `size`: File size as string
- `createdAt`: Creation timestamp
- `status`: File status (e.g., "uploaded")
- `duration`: Optional file duration (can be null)

#### File.Item.download() Method
- **BREAKING CHANGE**: Now requires `fileName` parameter (no longer optional)

#### Folder Methods
- **Folder.create(name, parentFolderId)** - Create new folder with optional parent
- **Folder.get(folderId)** - Retrieve folder by ID
- **Folder.delete(folderId)** - Delete folder by ID
- **Folder.get_root_folder_id()** - Get root folder ID

### 🗑️ Removed Features

#### Deprecated Methods
- **File.modify()** - Completely removed
- **File.get_file_categories()** - Completely removed
- **File.get_category_id_by_name()** - Completely removed
- **File.Item.delete()** - Instance method removed (use static method instead)

#### Deprecated Classes
- **Media class** - Completely removed
- **File.List class** - Replaced with Folder.ListResponse
- **Folder.List class** - Replaced with Folder.ListResponse

#### Deprecated Inheritance
- **File.Item** no longer inherits from `APIResponseItem`
- **Folder.Item** no longer inherits from `APIResponseItem`

### 🔧 Technical Improvements

#### Code Quality
- **Comprehensive docstrings** added to all methods and classes (PEP 257 compliant)
- **Type hints** improved throughout the codebase
- **Better error messages** with more descriptive exceptions
- **Fixed typos** in error messages ("eixst" → "exist")

#### Upload Process
- **Fixed upload polling logic** with proper timeout handling
- **Added mime_type parameter** to `send_upload_request` calls
- **Improved upload status checking** with proper boolean logic

### 📝 Migration Guide

#### For File Operations
```python
# OLD
file = File.create(localPath="file.mp3", uploadPath="name.mp3", fileType="audio")
fileId = file.fileId
file.delete(fileId=fileId, folderId=folderId)

# NEW
file = File.create(localPath="file.mp3", uploadPath="name.mp3", folderId=folderId)
fileId = file.fileId
File.delete(fileId=fileId, folderId=folderId)
```

#### For Folder Operations
```python
# OLD
root = Folder.get_root() # Returns Folder.Item
folderId = root.currentPathChain["folderId"]

# NEW
folderId = Folder.get_root_folder_id() # Returns string directly
```

#### For File Item Access
```python
# OLD
fileId = file.fileId
fileName = file.fileName

# NEW
fileId = file.fileId # No change - kept camelCase
fileName = file.fileName # No change - kept camelCase
```

### ⚠️ Breaking Changes Summary

1. **Parameter names** kept in camelCase (no changes to existing camelCase parameters)
2. **Attribute names** kept in camelCase (no changes to existing camelCase attributes)
3. **File.modify()** method completely removed
4. **File.Item.delete()** instance method removed
5. **Media class** completely removed
6. **File.List and Folder.List** classes removed
7. **Inheritance from APIResponseItem** removed for Item classes
8. **File.create()** now requires `fileName` parameter in download method
9. **Return types** changed for some methods (e.g., delete returns None)
10. **New parameter**: `folderId` added to File.create() for specifying upload location

### 🧪 Testing

- **All existing tests updated** to work with new API
- **New test patterns** for folder operations
- **Conditional test skipping** for staging environment
- **Improved test coverage** for new file system features

## [2.10.1] - 2025-02-24
- Fixed logic that removed 0 float values from payload

Expand Down
1 change: 0 additions & 1 deletion audiostack/content/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
from audiostack.content.file import File, Folder # noqa: F401
from audiostack.content.media import Media # noqa: F401
from audiostack.content.recommend import ( # noqa: F401
RecommendIAB,
RecommendMood,
Expand Down
Loading