From b6da0e56f9db8a018ca7b75e30b60e99fbdccc71 Mon Sep 17 00:00:00 2001 From: Matt Van Horn <455140+mvanhorn@users.noreply.github.com> Date: Tue, 10 Mar 2026 16:51:25 -0700 Subject: [PATCH] fix: omit ascending param when not set, letting API default to descending When --ascending is not passed, the CLI was sending ascending=false to the API, overriding the server's default sort order. Now we use maybe_ascending to only send the parameter when explicitly requested, letting the API return results in its natural (descending) order. Fixes #17 Co-Authored-By: Claude Opus 4.6 --- src/commands/comments.rs | 4 ++-- src/commands/events.rs | 2 +- src/commands/markets.rs | 2 +- src/commands/series.rs | 2 +- src/commands/sports.rs | 2 +- src/commands/tags.rs | 2 +- 6 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/commands/comments.rs b/src/commands/comments.rs index 4003911..53f8bb6 100644 --- a/src/commands/comments.rs +++ b/src/commands/comments.rs @@ -112,7 +112,7 @@ pub async fn execute( .limit(limit) .maybe_offset(offset) .maybe_order(order) - .ascending(ascending) + .maybe_ascending(if ascending { Some(true) } else { None }) .build(); let comments = client.comments(&request).await?; @@ -142,7 +142,7 @@ pub async fn execute( .limit(limit) .maybe_offset(offset) .maybe_order(order) - .ascending(ascending) + .maybe_ascending(if ascending { Some(true) } else { None }) .build(); let comments = client.comments_by_user_address(&request).await?; diff --git a/src/commands/events.rs b/src/commands/events.rs index d001210..676802e 100644 --- a/src/commands/events.rs +++ b/src/commands/events.rs @@ -79,7 +79,7 @@ pub async fn execute(client: &gamma::Client, args: EventsArgs, output: OutputFor .limit(limit) .maybe_closed(resolved_closed) .maybe_offset(offset) - .ascending(ascending) + .maybe_ascending(if ascending { Some(true) } else { None }) .maybe_tag_slug(tag) // EventsRequest::order is Vec; into_iter on Option yields 0 or 1 items. .order(order.into_iter().collect()) diff --git a/src/commands/markets.rs b/src/commands/markets.rs index 2544d18..1cd7cb8 100644 --- a/src/commands/markets.rs +++ b/src/commands/markets.rs @@ -95,7 +95,7 @@ pub async fn execute( .maybe_closed(resolved_closed) .maybe_offset(offset) .maybe_order(order) - .ascending(ascending) + .maybe_ascending(if ascending { Some(true) } else { None }) .build(); let markets = client.markets(&request).await?; diff --git a/src/commands/series.rs b/src/commands/series.rs index fc5e884..7d69676 100644 --- a/src/commands/series.rs +++ b/src/commands/series.rs @@ -59,7 +59,7 @@ pub async fn execute(client: &gamma::Client, args: SeriesArgs, output: OutputFor .limit(limit) .maybe_offset(offset) .maybe_order(order) - .ascending(ascending) + .maybe_ascending(if ascending { Some(true) } else { None }) .maybe_closed(closed) .build(); diff --git a/src/commands/sports.rs b/src/commands/sports.rs index 0782fd1..1b0d6e9 100644 --- a/src/commands/sports.rs +++ b/src/commands/sports.rs @@ -66,7 +66,7 @@ pub async fn execute(client: &gamma::Client, args: SportsArgs, output: OutputFor .limit(limit) .maybe_offset(offset) .maybe_order(order) - .ascending(ascending) + .maybe_ascending(if ascending { Some(true) } else { None }) .league(league.into_iter().collect()) .build(); diff --git a/src/commands/tags.rs b/src/commands/tags.rs index 64aae6a..2ce338e 100644 --- a/src/commands/tags.rs +++ b/src/commands/tags.rs @@ -72,7 +72,7 @@ pub async fn execute(client: &gamma::Client, args: TagsArgs, output: OutputForma let request = TagsRequest::builder() .limit(limit) .maybe_offset(offset) - .ascending(ascending) + .maybe_ascending(if ascending { Some(true) } else { None }) .build(); let tags = client.tags(&request).await?;