feat: add bookmark folders support (#30)
Add `twitter bookmarks folders` command to list bookmark folders and `twitter bookmarks folders <id>` to fetch tweets from a specific folder, with --since date filtering and pagination support. Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -5,7 +5,7 @@ from __future__ import annotations
|
||||
import json
|
||||
from typing import Any, Dict, Iterable, List, Optional
|
||||
|
||||
from .models import Author, Metrics, Tweet, TweetMedia, UserProfile
|
||||
from .models import Author, BookmarkFolder, Metrics, Tweet, TweetMedia, UserProfile
|
||||
from .timeutil import format_iso8601, format_local_time
|
||||
|
||||
|
||||
@@ -175,6 +175,19 @@ def tweets_to_compact_json(tweets: Iterable[Tweet]) -> str:
|
||||
)
|
||||
|
||||
|
||||
def bookmark_folder_to_dict(folder: BookmarkFolder) -> Dict[str, Any]:
|
||||
"""Convert a BookmarkFolder dataclass into a JSON-safe dict."""
|
||||
return {
|
||||
"id": folder.id,
|
||||
"name": folder.name,
|
||||
}
|
||||
|
||||
|
||||
def bookmark_folders_to_data(folders: Iterable[BookmarkFolder]) -> List[Dict[str, Any]]:
|
||||
"""Serialize BookmarkFolder objects to Python dicts."""
|
||||
return [bookmark_folder_to_dict(f) for f in folders]
|
||||
|
||||
|
||||
def user_profile_to_dict(user: UserProfile) -> Dict[str, Any]:
|
||||
"""Convert a UserProfile dataclass into a JSON-safe dict."""
|
||||
return {
|
||||
|
||||
Reference in New Issue
Block a user