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:
benny b
2026-03-17 05:59:08 -04:00
committed by GitHub
parent e496d8f870
commit ffd2a42f7c
5 changed files with 214 additions and 13 deletions

View File

@@ -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 {