Skip to main content

hanzo_client/apis/
plan_api.rs

1/*
2 * Hanzo Cloud API
3 *
4 * The Hanzo Cloud API as a customer calls it: every operation under /v1/ except the operator's admin product, relay routes, legacy spellings and capabilities still reached by flag. Tagged by product: the first path segment after /v1/.
5 *
6 * The version of the OpenAPI document: v1
7 * 
8 * Generated by: https://openapi-generator.tech
9 */
10
11
12use reqwest;
13use serde::{Deserialize, Serialize, de::Error as _};
14use crate::{apis::ResponseContent, models};
15use super::{Error, configuration, ContentType};
16
17
18/// struct for typed errors of method [`get_plan`]
19#[derive(Debug, Clone, Serialize, Deserialize)]
20#[serde(untagged)]
21pub enum GetPlanError {
22    UnknownValue(serde_json::Value),
23}
24
25/// struct for typed errors of method [`get_plan_blockchain`]
26#[derive(Debug, Clone, Serialize, Deserialize)]
27#[serde(untagged)]
28pub enum GetPlanBlockchainError {
29    UnknownValue(serde_json::Value),
30}
31
32/// struct for typed errors of method [`get_plan_dns`]
33#[derive(Debug, Clone, Serialize, Deserialize)]
34#[serde(untagged)]
35pub enum GetPlanDnsError {
36    UnknownValue(serde_json::Value),
37}
38
39/// struct for typed errors of method [`get_plan_entitlements_by_id`]
40#[derive(Debug, Clone, Serialize, Deserialize)]
41#[serde(untagged)]
42pub enum GetPlanEntitlementsByIdError {
43    UnknownValue(serde_json::Value),
44}
45
46/// struct for typed errors of method [`get_plan_gpu`]
47#[derive(Debug, Clone, Serialize, Deserialize)]
48#[serde(untagged)]
49pub enum GetPlanGpuError {
50    UnknownValue(serde_json::Value),
51}
52
53/// struct for typed errors of method [`get_plan_health`]
54#[derive(Debug, Clone, Serialize, Deserialize)]
55#[serde(untagged)]
56pub enum GetPlanHealthError {
57    UnknownValue(serde_json::Value),
58}
59
60/// struct for typed errors of method [`get_plan_policy`]
61#[derive(Debug, Clone, Serialize, Deserialize)]
62#[serde(untagged)]
63pub enum GetPlanPolicyError {
64    UnknownValue(serde_json::Value),
65}
66
67/// struct for typed errors of method [`get_plan_regions`]
68#[derive(Debug, Clone, Serialize, Deserialize)]
69#[serde(untagged)]
70pub enum GetPlanRegionsError {
71    UnknownValue(serde_json::Value),
72}
73
74/// struct for typed errors of method [`get_plan_resolve_by_id`]
75#[derive(Debug, Clone, Serialize, Deserialize)]
76#[serde(untagged)]
77pub enum GetPlanResolveByIdError {
78    UnknownValue(serde_json::Value),
79}
80
81/// struct for typed errors of method [`get_plan_schema`]
82#[derive(Debug, Clone, Serialize, Deserialize)]
83#[serde(untagged)]
84pub enum GetPlanSchemaError {
85    UnknownValue(serde_json::Value),
86}
87
88/// struct for typed errors of method [`get_plan_storage`]
89#[derive(Debug, Clone, Serialize, Deserialize)]
90#[serde(untagged)]
91pub enum GetPlanStorageError {
92    UnknownValue(serde_json::Value),
93}
94
95/// struct for typed errors of method [`get_plan_subscriptions`]
96#[derive(Debug, Clone, Serialize, Deserialize)]
97#[serde(untagged)]
98pub enum GetPlanSubscriptionsError {
99    UnknownValue(serde_json::Value),
100}
101
102/// struct for typed errors of method [`get_plan_tools`]
103#[derive(Debug, Clone, Serialize, Deserialize)]
104#[serde(untagged)]
105pub enum GetPlanToolsError {
106    UnknownValue(serde_json::Value),
107}
108
109/// struct for typed errors of method [`get_plan_vocab`]
110#[derive(Debug, Clone, Serialize, Deserialize)]
111#[serde(untagged)]
112pub enum GetPlanVocabError {
113    UnknownValue(serde_json::Value),
114}
115
116
117/// Returns the Hanzo cloud plan catalog: every cloud tier with its price, included capacity, limits and feature list, scoped to the caller's catalog. A reseller org sees its own overrides in place of the canonical records it has replaced, and the canonical record for every tier it has not.
118pub async fn get_plan(configuration: &configuration::Configuration, ) -> Result<models::PlanList, Error<GetPlanError>> {
119
120    let uri_str = format!("{}/v1/plan", configuration.base_path);
121    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
122
123    if let Some(ref user_agent) = configuration.user_agent {
124        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
125    }
126    if let Some(ref token) = configuration.bearer_access_token {
127        req_builder = req_builder.bearer_auth(token.to_owned());
128    };
129
130    let req = req_builder.build()?;
131    let resp = configuration.client.execute(req).await?;
132
133    let status = resp.status();
134    let content_type = resp
135        .headers()
136        .get("content-type")
137        .and_then(|v| v.to_str().ok())
138        .unwrap_or("application/octet-stream");
139    let content_type = super::ContentType::from(content_type);
140
141    if !status.is_client_error() && !status.is_server_error() {
142        let content = resp.text().await?;
143        match content_type {
144            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
145            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::PlanList`"))),
146            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::PlanList`")))),
147        }
148    } else {
149        let content = resp.text().await?;
150        let entity: Option<GetPlanError> = serde_json::from_str(&content).ok();
151        Err(Error::ResponseError(ResponseContent { status, content, entity }))
152    }
153}
154
155/// Returns the blockchain RPC plan catalog: the tiers metered in monthly compute units, with their prices, limits and overage terms. It is the canonical catalog for every caller — these plans carry no reseller overrides.
156pub async fn get_plan_blockchain(configuration: &configuration::Configuration, ) -> Result<models::PlanList, Error<GetPlanBlockchainError>> {
157
158    let uri_str = format!("{}/v1/plan/blockchain", configuration.base_path);
159    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
160
161    if let Some(ref user_agent) = configuration.user_agent {
162        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
163    }
164    if let Some(ref token) = configuration.bearer_access_token {
165        req_builder = req_builder.bearer_auth(token.to_owned());
166    };
167
168    let req = req_builder.build()?;
169    let resp = configuration.client.execute(req).await?;
170
171    let status = resp.status();
172    let content_type = resp
173        .headers()
174        .get("content-type")
175        .and_then(|v| v.to_str().ok())
176        .unwrap_or("application/octet-stream");
177    let content_type = super::ContentType::from(content_type);
178
179    if !status.is_client_error() && !status.is_server_error() {
180        let content = resp.text().await?;
181        match content_type {
182            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
183            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::PlanList`"))),
184            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::PlanList`")))),
185        }
186    } else {
187        let content = resp.text().await?;
188        let entity: Option<GetPlanBlockchainError> = serde_json::from_str(&content).ok();
189        Err(Error::ResponseError(ResponseContent { status, content, entity }))
190    }
191}
192
193/// ListDNSPlans returns the DNS plan catalog: the tiers priced on zones, records per zone and queries per day. It is the canonical catalog for every caller — these plans carry no reseller overrides.
194pub async fn get_plan_dns(configuration: &configuration::Configuration, ) -> Result<models::PlanList, Error<GetPlanDnsError>> {
195
196    let uri_str = format!("{}/v1/plan/dns", configuration.base_path);
197    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
198
199    if let Some(ref user_agent) = configuration.user_agent {
200        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
201    }
202    if let Some(ref token) = configuration.bearer_access_token {
203        req_builder = req_builder.bearer_auth(token.to_owned());
204    };
205
206    let req = req_builder.build()?;
207    let resp = configuration.client.execute(req).await?;
208
209    let status = resp.status();
210    let content_type = resp
211        .headers()
212        .get("content-type")
213        .and_then(|v| v.to_str().ok())
214        .unwrap_or("application/octet-stream");
215    let content_type = super::ContentType::from(content_type);
216
217    if !status.is_client_error() && !status.is_server_error() {
218        let content = resp.text().await?;
219        match content_type {
220            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
221            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::PlanList`"))),
222            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::PlanList`")))),
223        }
224    } else {
225        let content = resp.text().await?;
226        let entity: Option<GetPlanDnsError> = serde_json::from_str(&content).ok();
227        Err(Error::ResponseError(ResponseContent { status, content, entity }))
228    }
229}
230
231/// Returns what one plan GRANTS and not what it costs: the canonical namespaced entitlement block and the flat license-feature list derived from it. It is the entitlement half of ResolvePlan, over the same catalog and the same 404 for an id no catalog holds — the read a licensing or quota gate makes.
232pub async fn get_plan_entitlements_by_id(configuration: &configuration::Configuration, id: &str) -> Result<models::PlanEntitlements, Error<GetPlanEntitlementsByIdError>> {
233    // add a prefix to parameters to efficiently prevent name collisions
234    let p_id = id;
235
236    let uri_str = format!("{}/v1/plan/entitlements/{id}", configuration.base_path, id=crate::apis::urlencode(p_id));
237    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
238
239    if let Some(ref user_agent) = configuration.user_agent {
240        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
241    }
242    if let Some(ref token) = configuration.bearer_access_token {
243        req_builder = req_builder.bearer_auth(token.to_owned());
244    };
245
246    let req = req_builder.build()?;
247    let resp = configuration.client.execute(req).await?;
248
249    let status = resp.status();
250    let content_type = resp
251        .headers()
252        .get("content-type")
253        .and_then(|v| v.to_str().ok())
254        .unwrap_or("application/octet-stream");
255    let content_type = super::ContentType::from(content_type);
256
257    if !status.is_client_error() && !status.is_server_error() {
258        let content = resp.text().await?;
259        match content_type {
260            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
261            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::PlanEntitlements`"))),
262            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::PlanEntitlements`")))),
263        }
264    } else {
265        let content = resp.text().await?;
266        let entity: Option<GetPlanEntitlementsByIdError> = serde_json::from_str(&content).ok();
267        Err(Error::ResponseError(ResponseContent { status, content, entity }))
268    }
269}
270
271/// ListGPUTiers returns the rentable GPU configurations, each with its accelerator count and model, VRAM, vCPUs, host memory and hourly price.
272pub async fn get_plan_gpu(configuration: &configuration::Configuration, ) -> Result<models::PlanTierList, Error<GetPlanGpuError>> {
273
274    let uri_str = format!("{}/v1/plan/gpu", configuration.base_path);
275    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
276
277    if let Some(ref user_agent) = configuration.user_agent {
278        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
279    }
280    if let Some(ref token) = configuration.bearer_access_token {
281        req_builder = req_builder.bearer_auth(token.to_owned());
282    };
283
284    let req = req_builder.build()?;
285    let resp = configuration.client.execute(req).await?;
286
287    let status = resp.status();
288    let content_type = resp
289        .headers()
290        .get("content-type")
291        .and_then(|v| v.to_str().ok())
292        .unwrap_or("application/octet-stream");
293    let content_type = super::ContentType::from(content_type);
294
295    if !status.is_client_error() && !status.is_server_error() {
296        let content = resp.text().await?;
297        match content_type {
298            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
299            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::PlanTierList`"))),
300            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::PlanTierList`")))),
301        }
302    } else {
303        let content = resp.text().await?;
304        let entity: Option<GetPlanGpuError> = serde_json::from_str(&content).ok();
305        Err(Error::ResponseError(ResponseContent { status, content, entity }))
306    }
307}
308
309/// Health reports that the plans subsystem is mounted and serving. It answers from the process itself and consults neither the catalog bundle nor the goja host, so it stays \"ok\" while either is degraded.
310pub async fn get_plan_health(configuration: &configuration::Configuration, ) -> Result<models::PlanHealth, Error<GetPlanHealthError>> {
311
312    let uri_str = format!("{}/v1/plan/health", configuration.base_path);
313    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
314
315    if let Some(ref user_agent) = configuration.user_agent {
316        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
317    }
318    if let Some(ref token) = configuration.bearer_access_token {
319        req_builder = req_builder.bearer_auth(token.to_owned());
320    };
321
322    let req = req_builder.build()?;
323    let resp = configuration.client.execute(req).await?;
324
325    let status = resp.status();
326    let content_type = resp
327        .headers()
328        .get("content-type")
329        .and_then(|v| v.to_str().ok())
330        .unwrap_or("application/octet-stream");
331    let content_type = super::ContentType::from(content_type);
332
333    if !status.is_client_error() && !status.is_server_error() {
334        let content = resp.text().await?;
335        match content_type {
336            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
337            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::PlanHealth`"))),
338            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::PlanHealth`")))),
339        }
340    } else {
341        let content = resp.text().await?;
342        let entity: Option<GetPlanHealthError> = serde_json::from_str(&content).ok();
343        Err(Error::ResponseError(ResponseContent { status, content, entity }))
344    }
345}
346
347/// Returns the published pricing policy: whether pricing is transparent, the revenue-sharing terms (idle compute resale and the open-source share) and the principles the catalog is priced by.
348pub async fn get_plan_policy(configuration: &configuration::Configuration, ) -> Result<std::collections::HashMap<String, serde_json::Value>, Error<GetPlanPolicyError>> {
349
350    let uri_str = format!("{}/v1/plan/policy", configuration.base_path);
351    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
352
353    if let Some(ref user_agent) = configuration.user_agent {
354        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
355    }
356    if let Some(ref token) = configuration.bearer_access_token {
357        req_builder = req_builder.bearer_auth(token.to_owned());
358    };
359
360    let req = req_builder.build()?;
361    let resp = configuration.client.execute(req).await?;
362
363    let status = resp.status();
364    let content_type = resp
365        .headers()
366        .get("content-type")
367        .and_then(|v| v.to_str().ok())
368        .unwrap_or("application/octet-stream");
369    let content_type = super::ContentType::from(content_type);
370
371    if !status.is_client_error() && !status.is_server_error() {
372        let content = resp.text().await?;
373        match content_type {
374            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
375            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `std::collections::HashMap&lt;String, serde_json::Value&gt;`"))),
376            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `std::collections::HashMap&lt;String, serde_json::Value&gt;`")))),
377        }
378    } else {
379        let content = resp.text().await?;
380        let entity: Option<GetPlanPolicyError> = serde_json::from_str(&content).ok();
381        Err(Error::ResponseError(ResponseContent { status, content, entity }))
382    }
383}
384
385/// Returns the regions cloud capacity is offered in, each with its display name and physical location.
386pub async fn get_plan_regions(configuration: &configuration::Configuration, ) -> Result<models::PlanRegionList, Error<GetPlanRegionsError>> {
387
388    let uri_str = format!("{}/v1/plan/regions", configuration.base_path);
389    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
390
391    if let Some(ref user_agent) = configuration.user_agent {
392        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
393    }
394    if let Some(ref token) = configuration.bearer_access_token {
395        req_builder = req_builder.bearer_auth(token.to_owned());
396    };
397
398    let req = req_builder.build()?;
399    let resp = configuration.client.execute(req).await?;
400
401    let status = resp.status();
402    let content_type = resp
403        .headers()
404        .get("content-type")
405        .and_then(|v| v.to_str().ok())
406        .unwrap_or("application/octet-stream");
407    let content_type = super::ContentType::from(content_type);
408
409    if !status.is_client_error() && !status.is_server_error() {
410        let content = resp.text().await?;
411        match content_type {
412            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
413            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::PlanRegionList`"))),
414            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::PlanRegionList`")))),
415        }
416    } else {
417        let content = resp.text().await?;
418        let entity: Option<GetPlanRegionsError> = serde_json::from_str(&content).ok();
419        Err(Error::ResponseError(ResponseContent { status, content, entity }))
420    }
421}
422
423/// Resolves one plan to everything a consumer of the catalog needs at once: its canonical entitlement block, the flat license-feature list a signed license carries, its billing reference, and the catalog it came from. The id may be the plan's id or its slug, and it is resolved against the caller's catalog, so a reseller's override wins over the canonical record. An id no catalog holds answers 404.
424pub async fn get_plan_resolve_by_id(configuration: &configuration::Configuration, id: &str) -> Result<models::PlanResolution, Error<GetPlanResolveByIdError>> {
425    // add a prefix to parameters to efficiently prevent name collisions
426    let p_id = id;
427
428    let uri_str = format!("{}/v1/plan/resolve/{id}", configuration.base_path, id=crate::apis::urlencode(p_id));
429    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
430
431    if let Some(ref user_agent) = configuration.user_agent {
432        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
433    }
434    if let Some(ref token) = configuration.bearer_access_token {
435        req_builder = req_builder.bearer_auth(token.to_owned());
436    };
437
438    let req = req_builder.build()?;
439    let resp = configuration.client.execute(req).await?;
440
441    let status = resp.status();
442    let content_type = resp
443        .headers()
444        .get("content-type")
445        .and_then(|v| v.to_str().ok())
446        .unwrap_or("application/octet-stream");
447    let content_type = super::ContentType::from(content_type);
448
449    if !status.is_client_error() && !status.is_server_error() {
450        let content = resp.text().await?;
451        match content_type {
452            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
453            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::PlanResolution`"))),
454            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::PlanResolution`")))),
455        }
456    } else {
457        let content = resp.text().await?;
458        let entity: Option<GetPlanResolveByIdError> = serde_json::from_str(&content).ok();
459        Err(Error::ResponseError(ResponseContent { status, content, entity }))
460    }
461}
462
463/// Returns the two JSON Schema documents this surface speaks: entitlements.schema.json, which declares every entitlement key with its type, unit and enum, and plan.schema.json, which a catalog plan record conforms to.
464pub async fn get_plan_schema(configuration: &configuration::Configuration, ) -> Result<models::PlanSchemas, Error<GetPlanSchemaError>> {
465
466    let uri_str = format!("{}/v1/plan/schema", configuration.base_path);
467    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
468
469    if let Some(ref user_agent) = configuration.user_agent {
470        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
471    }
472    if let Some(ref token) = configuration.bearer_access_token {
473        req_builder = req_builder.bearer_auth(token.to_owned());
474    };
475
476    let req = req_builder.build()?;
477    let resp = configuration.client.execute(req).await?;
478
479    let status = resp.status();
480    let content_type = resp
481        .headers()
482        .get("content-type")
483        .and_then(|v| v.to_str().ok())
484        .unwrap_or("application/octet-stream");
485    let content_type = super::ContentType::from(content_type);
486
487    if !status.is_client_error() && !status.is_server_error() {
488        let content = resp.text().await?;
489        match content_type {
490            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
491            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::PlanSchemas`"))),
492            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::PlanSchemas`")))),
493        }
494    } else {
495        let content = resp.text().await?;
496        let entity: Option<GetPlanSchemaError> = serde_json::from_str(&content).ok();
497        Err(Error::ResponseError(ResponseContent { status, content, entity }))
498    }
499}
500
501/// Returns the block-storage price block: the price per GB per month and the volume size bounds a cloud plan may attach.
502pub async fn get_plan_storage(configuration: &configuration::Configuration, ) -> Result<std::collections::HashMap<String, serde_json::Value>, Error<GetPlanStorageError>> {
503
504    let uri_str = format!("{}/v1/plan/storage", configuration.base_path);
505    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
506
507    if let Some(ref user_agent) = configuration.user_agent {
508        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
509    }
510    if let Some(ref token) = configuration.bearer_access_token {
511        req_builder = req_builder.bearer_auth(token.to_owned());
512    };
513
514    let req = req_builder.build()?;
515    let resp = configuration.client.execute(req).await?;
516
517    let status = resp.status();
518    let content_type = resp
519        .headers()
520        .get("content-type")
521        .and_then(|v| v.to_str().ok())
522        .unwrap_or("application/octet-stream");
523    let content_type = super::ContentType::from(content_type);
524
525    if !status.is_client_error() && !status.is_server_error() {
526        let content = resp.text().await?;
527        match content_type {
528            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
529            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `std::collections::HashMap&lt;String, serde_json::Value&gt;`"))),
530            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `std::collections::HashMap&lt;String, serde_json::Value&gt;`")))),
531        }
532    } else {
533        let content = resp.text().await?;
534        let entity: Option<GetPlanStorageError> = serde_json::from_str(&content).ok();
535        Err(Error::ResponseError(ResponseContent { status, content, entity }))
536    }
537}
538
539/// Returns the subscription ladder — the personal and team tiers a customer buys to use the cloud, each with its monthly and annual price, seat rules, limits and billing reference. Scoped to the caller's catalog.
540pub async fn get_plan_subscriptions(configuration: &configuration::Configuration, ) -> Result<models::PlanList, Error<GetPlanSubscriptionsError>> {
541
542    let uri_str = format!("{}/v1/plan/subscriptions", configuration.base_path);
543    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
544
545    if let Some(ref user_agent) = configuration.user_agent {
546        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
547    }
548    if let Some(ref token) = configuration.bearer_access_token {
549        req_builder = req_builder.bearer_auth(token.to_owned());
550    };
551
552    let req = req_builder.build()?;
553    let resp = configuration.client.execute(req).await?;
554
555    let status = resp.status();
556    let content_type = resp
557        .headers()
558        .get("content-type")
559        .and_then(|v| v.to_str().ok())
560        .unwrap_or("application/octet-stream");
561    let content_type = super::ContentType::from(content_type);
562
563    if !status.is_client_error() && !status.is_server_error() {
564        let content = resp.text().await?;
565        match content_type {
566            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
567            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::PlanList`"))),
568            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::PlanList`")))),
569        }
570    } else {
571        let content = resp.text().await?;
572        let entity: Option<GetPlanSubscriptionsError> = serde_json::from_str(&content).ok();
573        Err(Error::ResponseError(ResponseContent { status, content, entity }))
574    }
575}
576
577/// Returns the per-use price of every metered tool — web search, code interpreter, image generation, speech — each with the unit it is billed in.
578pub async fn get_plan_tools(configuration: &configuration::Configuration, ) -> Result<models::PlanToolList, Error<GetPlanToolsError>> {
579
580    let uri_str = format!("{}/v1/plan/tools", configuration.base_path);
581    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
582
583    if let Some(ref user_agent) = configuration.user_agent {
584        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
585    }
586    if let Some(ref token) = configuration.bearer_access_token {
587        req_builder = req_builder.bearer_auth(token.to_owned());
588    };
589
590    let req = req_builder.build()?;
591    let resp = configuration.client.execute(req).await?;
592
593    let status = resp.status();
594    let content_type = resp
595        .headers()
596        .get("content-type")
597        .and_then(|v| v.to_str().ok())
598        .unwrap_or("application/octet-stream");
599    let content_type = super::ContentType::from(content_type);
600
601    if !status.is_client_error() && !status.is_server_error() {
602        let content = resp.text().await?;
603        match content_type {
604            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
605            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::PlanToolList`"))),
606            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::PlanToolList`")))),
607        }
608    } else {
609        let content = resp.text().await?;
610        let entity: Option<GetPlanToolsError> = serde_json::from_str(&content).ok();
611        Err(Error::ResponseError(ResponseContent { status, content, entity }))
612    }
613}
614
615/// Returns the entitlement key vocabulary: every key with its namespace, JSON type, nullability, unit, enum and title, the list of namespaces, and the engine features a license can grant. It is derived from entitlements.schema.json on every call, so it cannot fall behind the schema.
616pub async fn get_plan_vocab(configuration: &configuration::Configuration, ) -> Result<models::PlanVocab, Error<GetPlanVocabError>> {
617
618    let uri_str = format!("{}/v1/plan/vocab", configuration.base_path);
619    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
620
621    if let Some(ref user_agent) = configuration.user_agent {
622        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
623    }
624    if let Some(ref token) = configuration.bearer_access_token {
625        req_builder = req_builder.bearer_auth(token.to_owned());
626    };
627
628    let req = req_builder.build()?;
629    let resp = configuration.client.execute(req).await?;
630
631    let status = resp.status();
632    let content_type = resp
633        .headers()
634        .get("content-type")
635        .and_then(|v| v.to_str().ok())
636        .unwrap_or("application/octet-stream");
637    let content_type = super::ContentType::from(content_type);
638
639    if !status.is_client_error() && !status.is_server_error() {
640        let content = resp.text().await?;
641        match content_type {
642            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
643            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::PlanVocab`"))),
644            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::PlanVocab`")))),
645        }
646    } else {
647        let content = resp.text().await?;
648        let entity: Option<GetPlanVocabError> = serde_json::from_str(&content).ok();
649        Err(Error::ResponseError(ResponseContent { status, content, entity }))
650    }
651}
652