pub struct CodingPlanUsageRequest {
pub key: String,
/* private fields */
}Expand description
Coding Plan usage / quota query request
(GET /api/monitor/usage/quota/limit).
Construct with CodingPlanUsageRequest::new and execute with
CodingPlanUsageRequest::send. Implements HttpClient so it flows
through the shared retry / connection-pool / masking pipeline.
use zai_rs::usage::CodingPlanUsageRequest;
let resp = CodingPlanUsageRequest::new(key).send().await?;
if let Some(five_hour) = resp.time_limit() {
tracing::info!("5h window: {}% used", five_hour.percentage);
}Fields§
§key: StringBearer API key.
Implementations§
Source§impl CodingPlanUsageRequest
impl CodingPlanUsageRequest
Sourcepub fn with_base_url(self, base: impl Into<String>) -> Self
pub fn with_base_url(self, base: impl Into<String>) -> Self
Override the base URL (e.g. https://api.z.ai/api/monitor for the
international endpoint).
Sourcepub fn with_endpoint_config(self, endpoint_config: EndpointConfig) -> Self
pub fn with_endpoint_config(self, endpoint_config: EndpointConfig) -> Self
Replace the full endpoint configuration.
Sourcepub fn with_monitor_base(self, base: impl Into<String>) -> Self
pub fn with_monitor_base(self, base: impl Into<String>) -> Self
Override the monitor base URL only.
Sourcepub fn with_http_config(self, config: HttpClientConfig) -> Self
pub fn with_http_config(self, config: HttpClientConfig) -> Self
Customize the HTTP transport (timeout, retries, masking, …).
Sourcepub async fn send(&self) -> ZaiResult<CodingPlanUsageResponse>
pub async fn send(&self) -> ZaiResult<CodingPlanUsageResponse>
Send the quota query and parse the typed envelope.
Trait Implementations§
Source§impl HttpClient for CodingPlanUsageRequest
impl HttpClient for CodingPlanUsageRequest
type Body = ()
type ApiUrl = String
type ApiKey = String
fn api_url(&self) -> &Self::ApiUrl
fn api_key(&self) -> &Self::ApiKey
fn body(&self) -> &Self::Body
Source§fn http_config(&self) -> Arc<HttpClientConfig> ⓘ
fn http_config(&self) -> Arc<HttpClientConfig> ⓘ
Get HTTP client configuration for this request Read more
Source§fn post(&self) -> impl Future<Output = ZaiResult<Response>> + Send
fn post(&self) -> impl Future<Output = ZaiResult<Response>> + Send
Sends a POST request to the API endpoint. Read more
Source§fn get(&self) -> impl Future<Output = ZaiResult<Response>> + Send
fn get(&self) -> impl Future<Output = ZaiResult<Response>> + Send
Sends a GET request to the API endpoint. Read more
Auto Trait Implementations§
impl Freeze for CodingPlanUsageRequest
impl RefUnwindSafe for CodingPlanUsageRequest
impl Send for CodingPlanUsageRequest
impl Sync for CodingPlanUsageRequest
impl Unpin for CodingPlanUsageRequest
impl UnsafeUnpin for CodingPlanUsageRequest
impl UnwindSafe for CodingPlanUsageRequest
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more