pub struct Markets { /* private fields */ }Expand description
Markets namespace for market-related operations
Implementations§
Source§impl Markets
impl Markets
Sourcepub fn get_by_slug(&self, slug: impl Into<String>) -> GetMarket
pub fn get_by_slug(&self, slug: impl Into<String>) -> GetMarket
Get a market by its slug
Sourcepub fn list(&self) -> ListMarkets
pub fn list(&self) -> ListMarkets
List markets with optional filtering
Sourcepub fn get_many(&self, ids: impl IntoIterator<Item = i64>) -> GetManyMarkets
pub fn get_many(&self, ids: impl IntoIterator<Item = i64>) -> GetManyMarkets
Look up markets by ID, returning both open and closed markets.
Unlike Self::list with .id(…), which inherits the upstream
closed=false default and silently drops closed markets, get_many
issues two parallel requests (closed=true and closed=false) and
merges the results, so callers get every matching market regardless of
status. This matches the semantics of the single-market Self::get
endpoint, batched.
Safe batch size: ≤ 400 IDs per call (same URL-length ceiling as
ListMarkets::id). The two fan-out requests are issued concurrently,
so wall-clock latency is one round-trip, not two.
Get tags for a market
Sourcepub fn get_description(
&self,
id: impl Into<String>,
) -> Request<MarketDescription, GammaError>
pub fn get_description( &self, id: impl Into<String>, ) -> Request<MarketDescription, GammaError>
Get a market’s description text (GET /markets/{id}/description).
Sourcepub async fn query_by_information(
&self,
body: &MarketsInformationBody,
) -> Result<Vec<Market>, GammaError>
pub async fn query_by_information( &self, body: &MarketsInformationBody, ) -> Result<Vec<Market>, GammaError>
Query markets by an information filter body (POST /markets/information).
Unlike Self::list, the filter parameters are passed in the request
body rather than the query string, allowing larger batches of IDs,
slugs, token IDs, etc. without hitting URL-length limits.
Sourcepub async fn query_abridged(
&self,
body: &MarketsInformationBody,
) -> Result<Vec<Market>, GammaError>
pub async fn query_abridged( &self, body: &MarketsInformationBody, ) -> Result<Vec<Market>, GammaError>
Query abridged markets by an information filter body
(POST /markets/abridged). Returns a reduced-payload market list.
Sourcepub fn list_keyset(&self) -> ListKeysetMarkets
pub fn list_keyset(&self) -> ListKeysetMarkets
List markets using cursor-based (keyset) pagination
(GET /markets/keyset).
Prefer this over Self::list for stable paging through large result
sets. Use next_cursor from each response as after_cursor in the
next request; pagination is complete when next_cursor is None.