Skip to main content

nordnet_api/resources/
tick_sizes.rs

1//! Resource methods for the `tick_sizes` API group.
2//!
3//! Endpoints:
4//! - `GET /tick_sizes`         → [`Client::list_tick_sizes`]
5//! - `GET /tick_sizes/{id}`    → [`Client::get_tick_size`]
6
7use crate::client::Client;
8use crate::error::Error;
9use nordnet_model::ids::TickSizeId;
10use nordnet_model::models::tick_sizes::TicksizeTable;
11
12impl Client {
13    /// `GET /tick_sizes` — Returns a list of all tick size tables.
14    ///
15    /// # Errors
16    ///
17    /// Returns [`Error::Unauthorized`] (401), [`Error::TooManyRequests`]
18    /// (429), or [`Error::ServiceUnavailable`] (503) as documented.
19    #[doc(alias = "GET /tick_sizes")]
20    pub async fn list_tick_sizes(&self) -> Result<Vec<TicksizeTable>, Error> {
21        self.get("/tick_sizes").await
22    }
23
24    /// `GET /tick_sizes/{tick_size_id}` — Returns one or more tick size
25    /// tables identified by `id`.
26    ///
27    /// The Nordnet API path parameter technically accepts a comma-separated
28    /// list of IDs. This method covers the single-ID case. A future helper
29    /// may be added for multi-ID lookups when needed (Phase 4+).
30    ///
31    /// # Errors
32    ///
33    /// Returns [`Error::BadRequest`] (400), [`Error::Unauthorized`] (401),
34    /// [`Error::TooManyRequests`] (429), or [`Error::ServiceUnavailable`]
35    /// (503) as documented.
36    #[doc(alias = "GET /tick_sizes/{tick_size_id}")]
37    pub async fn get_tick_size(&self, id: TickSizeId) -> Result<Vec<TicksizeTable>, Error> {
38        self.get(&format!("/tick_sizes/{}", id)).await
39    }
40}