Skip to main content

hanzo_client/apis/
framework_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 [`delete_framework_by_doctype_by_name`]
19#[derive(Debug, Clone, Serialize, Deserialize)]
20#[serde(untagged)]
21pub enum DeleteFrameworkByDoctypeByNameError {
22    UnknownValue(serde_json::Value),
23}
24
25/// struct for typed errors of method [`delete_framework_doctypes_by_name`]
26#[derive(Debug, Clone, Serialize, Deserialize)]
27#[serde(untagged)]
28pub enum DeleteFrameworkDoctypesByNameError {
29    UnknownValue(serde_json::Value),
30}
31
32/// struct for typed errors of method [`delete_framework_roles_by_user_by_role`]
33#[derive(Debug, Clone, Serialize, Deserialize)]
34#[serde(untagged)]
35pub enum DeleteFrameworkRolesByUserByRoleError {
36    UnknownValue(serde_json::Value),
37}
38
39/// struct for typed errors of method [`get_framework_by_doctype`]
40#[derive(Debug, Clone, Serialize, Deserialize)]
41#[serde(untagged)]
42pub enum GetFrameworkByDoctypeError {
43    UnknownValue(serde_json::Value),
44}
45
46/// struct for typed errors of method [`get_framework_by_doctype_by_name`]
47#[derive(Debug, Clone, Serialize, Deserialize)]
48#[serde(untagged)]
49pub enum GetFrameworkByDoctypeByNameError {
50    UnknownValue(serde_json::Value),
51}
52
53/// struct for typed errors of method [`get_framework_doctypes`]
54#[derive(Debug, Clone, Serialize, Deserialize)]
55#[serde(untagged)]
56pub enum GetFrameworkDoctypesError {
57    UnknownValue(serde_json::Value),
58}
59
60/// struct for typed errors of method [`get_framework_doctypes_by_name`]
61#[derive(Debug, Clone, Serialize, Deserialize)]
62#[serde(untagged)]
63pub enum GetFrameworkDoctypesByNameError {
64    UnknownValue(serde_json::Value),
65}
66
67/// struct for typed errors of method [`get_framework_modules`]
68#[derive(Debug, Clone, Serialize, Deserialize)]
69#[serde(untagged)]
70pub enum GetFrameworkModulesError {
71    UnknownValue(serde_json::Value),
72}
73
74/// struct for typed errors of method [`get_framework_modules_by_module`]
75#[derive(Debug, Clone, Serialize, Deserialize)]
76#[serde(untagged)]
77pub enum GetFrameworkModulesByModuleError {
78    UnknownValue(serde_json::Value),
79}
80
81/// struct for typed errors of method [`get_framework_roles`]
82#[derive(Debug, Clone, Serialize, Deserialize)]
83#[serde(untagged)]
84pub enum GetFrameworkRolesError {
85    UnknownValue(serde_json::Value),
86}
87
88/// struct for typed errors of method [`get_framework_summary`]
89#[derive(Debug, Clone, Serialize, Deserialize)]
90#[serde(untagged)]
91pub enum GetFrameworkSummaryError {
92    UnknownValue(serde_json::Value),
93}
94
95/// struct for typed errors of method [`post_framework_by_doctype`]
96#[derive(Debug, Clone, Serialize, Deserialize)]
97#[serde(untagged)]
98pub enum PostFrameworkByDoctypeError {
99    UnknownValue(serde_json::Value),
100}
101
102/// struct for typed errors of method [`post_framework_by_doctype_by_name_cancel`]
103#[derive(Debug, Clone, Serialize, Deserialize)]
104#[serde(untagged)]
105pub enum PostFrameworkByDoctypeByNameCancelError {
106    UnknownValue(serde_json::Value),
107}
108
109/// struct for typed errors of method [`post_framework_by_doctype_by_name_submit`]
110#[derive(Debug, Clone, Serialize, Deserialize)]
111#[serde(untagged)]
112pub enum PostFrameworkByDoctypeByNameSubmitError {
113    UnknownValue(serde_json::Value),
114}
115
116/// struct for typed errors of method [`post_framework_doctypes`]
117#[derive(Debug, Clone, Serialize, Deserialize)]
118#[serde(untagged)]
119pub enum PostFrameworkDoctypesError {
120    UnknownValue(serde_json::Value),
121}
122
123/// struct for typed errors of method [`post_framework_modules_by_module_install`]
124#[derive(Debug, Clone, Serialize, Deserialize)]
125#[serde(untagged)]
126pub enum PostFrameworkModulesByModuleInstallError {
127    UnknownValue(serde_json::Value),
128}
129
130/// struct for typed errors of method [`post_framework_roles`]
131#[derive(Debug, Clone, Serialize, Deserialize)]
132#[serde(untagged)]
133pub enum PostFrameworkRolesError {
134    UnknownValue(serde_json::Value),
135}
136
137/// struct for typed errors of method [`put_framework_by_doctype_by_name`]
138#[derive(Debug, Clone, Serialize, Deserialize)]
139#[serde(untagged)]
140pub enum PutFrameworkByDoctypeByNameError {
141    UnknownValue(serde_json::Value),
142}
143
144/// struct for typed errors of method [`put_framework_doctypes_by_name`]
145#[derive(Debug, Clone, Serialize, Deserialize)]
146#[serde(untagged)]
147pub enum PutFrameworkDoctypesByNameError {
148    UnknownValue(serde_json::Value),
149}
150
151
152/// Removes one document, after its on_trash hooks agree. A SUBMITTED document cannot be deleted — cancel it first. Answers 204.
153pub async fn delete_framework_by_doctype_by_name(configuration: &configuration::Configuration, doctype: &str, name: &str) -> Result<(), Error<DeleteFrameworkByDoctypeByNameError>> {
154    // add a prefix to parameters to efficiently prevent name collisions
155    let p_doctype = doctype;
156    let p_name = name;
157
158    let uri_str = format!("{}/v1/framework/{doctype}/{name}", configuration.base_path, doctype=crate::apis::urlencode(p_doctype), name=crate::apis::urlencode(p_name));
159    let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &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
173    if !status.is_client_error() && !status.is_server_error() {
174        Ok(())
175    } else {
176        let content = resp.text().await?;
177        let entity: Option<DeleteFrameworkByDoctypeByNameError> = serde_json::from_str(&content).ok();
178        Err(Error::ResponseError(ResponseContent { status, content, entity }))
179    }
180}
181
182/// Removes a DocType and every document stored under it. The definition and its data go together — a document with no schema can be neither validated nor read back — so there is no undo. Manager-only. Answers 204.
183pub async fn delete_framework_doctypes_by_name(configuration: &configuration::Configuration, name: &str) -> Result<(), Error<DeleteFrameworkDoctypesByNameError>> {
184    // add a prefix to parameters to efficiently prevent name collisions
185    let p_name = name;
186
187    let uri_str = format!("{}/v1/framework/doctypes/{name}", configuration.base_path, name=crate::apis::urlencode(p_name));
188    let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str);
189
190    if let Some(ref user_agent) = configuration.user_agent {
191        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
192    }
193    if let Some(ref token) = configuration.bearer_access_token {
194        req_builder = req_builder.bearer_auth(token.to_owned());
195    };
196
197    let req = req_builder.build()?;
198    let resp = configuration.client.execute(req).await?;
199
200    let status = resp.status();
201
202    if !status.is_client_error() && !status.is_server_error() {
203        Ok(())
204    } else {
205        let content = resp.text().await?;
206        let entity: Option<DeleteFrameworkDoctypesByNameError> = serde_json::from_str(&content).ok();
207        Err(Error::ResponseError(ResponseContent { status, content, entity }))
208    }
209}
210
211/// Removes one (user, role) grant in the caller's org. Manager-only. Answers 204; a grant that does not exist is not found.
212pub async fn delete_framework_roles_by_user_by_role(configuration: &configuration::Configuration, user: &str, role: &str) -> Result<(), Error<DeleteFrameworkRolesByUserByRoleError>> {
213    // add a prefix to parameters to efficiently prevent name collisions
214    let p_user = user;
215    let p_role = role;
216
217    let uri_str = format!("{}/v1/framework/roles/{user}/{role}", configuration.base_path, user=crate::apis::urlencode(p_user), role=crate::apis::urlencode(p_role));
218    let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str);
219
220    if let Some(ref user_agent) = configuration.user_agent {
221        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
222    }
223    if let Some(ref token) = configuration.bearer_access_token {
224        req_builder = req_builder.bearer_auth(token.to_owned());
225    };
226
227    let req = req_builder.build()?;
228    let resp = configuration.client.execute(req).await?;
229
230    let status = resp.status();
231
232    if !status.is_client_error() && !status.is_server_error() {
233        Ok(())
234    } else {
235        let content = resp.text().await?;
236        let entity: Option<DeleteFrameworkRolesByUserByRoleError> = serde_json::from_str(&content).ok();
237        Err(Error::ResponseError(ResponseContent { status, content, entity }))
238    }
239}
240
241/// Returns the caller org's documents of one DocType, filtered, ordered and projected by the query. The DocType is resolved FIRST — through the same permission gate the list itself uses — because the query is validated against its schema: a filter, sort or field name the DocType does not declare is refused rather than reaching the store.
242pub async fn get_framework_by_doctype(configuration: &configuration::Configuration, doctype: &str, filters: Option<&str>, fields: Option<&str>, order_by: Option<&str>, limit: Option<&str>) -> Result<models::DocumentList, Error<GetFrameworkByDoctypeError>> {
243    // add a prefix to parameters to efficiently prevent name collisions
244    let p_doctype = doctype;
245    let p_filters = filters;
246    let p_fields = fields;
247    let p_order_by = order_by;
248    let p_limit = limit;
249
250    let uri_str = format!("{}/v1/framework/{doctype}", configuration.base_path, doctype=crate::apis::urlencode(p_doctype));
251    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
252
253    if let Some(ref param_value) = p_filters {
254        req_builder = req_builder.query(&[("filters", &param_value.to_string())]);
255    }
256    if let Some(ref param_value) = p_fields {
257        req_builder = req_builder.query(&[("fields", &param_value.to_string())]);
258    }
259    if let Some(ref param_value) = p_order_by {
260        req_builder = req_builder.query(&[("order_by", &param_value.to_string())]);
261    }
262    if let Some(ref param_value) = p_limit {
263        req_builder = req_builder.query(&[("limit", &param_value.to_string())]);
264    }
265    if let Some(ref user_agent) = configuration.user_agent {
266        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
267    }
268    if let Some(ref token) = configuration.bearer_access_token {
269        req_builder = req_builder.bearer_auth(token.to_owned());
270    };
271
272    let req = req_builder.build()?;
273    let resp = configuration.client.execute(req).await?;
274
275    let status = resp.status();
276    let content_type = resp
277        .headers()
278        .get("content-type")
279        .and_then(|v| v.to_str().ok())
280        .unwrap_or("application/octet-stream");
281    let content_type = super::ContentType::from(content_type);
282
283    if !status.is_client_error() && !status.is_server_error() {
284        let content = resp.text().await?;
285        match content_type {
286            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
287            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::DocumentList`"))),
288            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::DocumentList`")))),
289        }
290    } else {
291        let content = resp.text().await?;
292        let entity: Option<GetFrameworkByDoctypeError> = serde_json::from_str(&content).ok();
293        Err(Error::ResponseError(ResponseContent { status, content, entity }))
294    }
295}
296
297/// Returns one document by name, with Password fields redacted.
298pub async fn get_framework_by_doctype_by_name(configuration: &configuration::Configuration, doctype: &str, name: &str) -> Result<std::collections::HashMap<String, serde_json::Value>, Error<GetFrameworkByDoctypeByNameError>> {
299    // add a prefix to parameters to efficiently prevent name collisions
300    let p_doctype = doctype;
301    let p_name = name;
302
303    let uri_str = format!("{}/v1/framework/{doctype}/{name}", configuration.base_path, doctype=crate::apis::urlencode(p_doctype), name=crate::apis::urlencode(p_name));
304    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
305
306    if let Some(ref user_agent) = configuration.user_agent {
307        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
308    }
309    if let Some(ref token) = configuration.bearer_access_token {
310        req_builder = req_builder.bearer_auth(token.to_owned());
311    };
312
313    let req = req_builder.build()?;
314    let resp = configuration.client.execute(req).await?;
315
316    let status = resp.status();
317    let content_type = resp
318        .headers()
319        .get("content-type")
320        .and_then(|v| v.to_str().ok())
321        .unwrap_or("application/octet-stream");
322    let content_type = super::ContentType::from(content_type);
323
324    if !status.is_client_error() && !status.is_server_error() {
325        let content = resp.text().await?;
326        match content_type {
327            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
328            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;`"))),
329            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;`")))),
330        }
331    } else {
332        let content = resp.text().await?;
333        let entity: Option<GetFrameworkByDoctypeByNameError> = serde_json::from_str(&content).ok();
334        Err(Error::ResponseError(ResponseContent { status, content, entity }))
335    }
336}
337
338/// Returns every DocType defined in the caller's org. Another tenant's definitions are never included: the org is part of the store key.
339pub async fn get_framework_doctypes(configuration: &configuration::Configuration, ) -> Result<models::DocTypeList, Error<GetFrameworkDoctypesError>> {
340
341    let uri_str = format!("{}/v1/framework/doctypes", configuration.base_path);
342    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
343
344    if let Some(ref user_agent) = configuration.user_agent {
345        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
346    }
347    if let Some(ref token) = configuration.bearer_access_token {
348        req_builder = req_builder.bearer_auth(token.to_owned());
349    };
350
351    let req = req_builder.build()?;
352    let resp = configuration.client.execute(req).await?;
353
354    let status = resp.status();
355    let content_type = resp
356        .headers()
357        .get("content-type")
358        .and_then(|v| v.to_str().ok())
359        .unwrap_or("application/octet-stream");
360    let content_type = super::ContentType::from(content_type);
361
362    if !status.is_client_error() && !status.is_server_error() {
363        let content = resp.text().await?;
364        match content_type {
365            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
366            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::DocTypeList`"))),
367            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::DocTypeList`")))),
368        }
369    } else {
370        let content = resp.text().await?;
371        let entity: Option<GetFrameworkDoctypesError> = serde_json::from_str(&content).ok();
372        Err(Error::ResponseError(ResponseContent { status, content, entity }))
373    }
374}
375
376/// Returns one DocType definition — its fields, naming rule, permissions and lifecycle flags. Scoped to the caller's org, so another tenant's DocType of the same name is simply not found.
377pub async fn get_framework_doctypes_by_name(configuration: &configuration::Configuration, name: &str) -> Result<models::DocType, Error<GetFrameworkDoctypesByNameError>> {
378    // add a prefix to parameters to efficiently prevent name collisions
379    let p_name = name;
380
381    let uri_str = format!("{}/v1/framework/doctypes/{name}", configuration.base_path, name=crate::apis::urlencode(p_name));
382    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
383
384    if let Some(ref user_agent) = configuration.user_agent {
385        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
386    }
387    if let Some(ref token) = configuration.bearer_access_token {
388        req_builder = req_builder.bearer_auth(token.to_owned());
389    };
390
391    let req = req_builder.build()?;
392    let resp = configuration.client.execute(req).await?;
393
394    let status = resp.status();
395    let content_type = resp
396        .headers()
397        .get("content-type")
398        .and_then(|v| v.to_str().ok())
399        .unwrap_or("application/octet-stream");
400    let content_type = super::ContentType::from(content_type);
401
402    if !status.is_client_error() && !status.is_server_error() {
403        let content = resp.text().await?;
404        match content_type {
405            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
406            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::DocType`"))),
407            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::DocType`")))),
408        }
409    } else {
410        let content = resp.text().await?;
411        let entity: Option<GetFrameworkDoctypesByNameError> = serde_json::from_str(&content).ok();
412        Err(Error::ResponseError(ResponseContent { status, content, entity }))
413    }
414}
415
416/// Returns every app lane compiled into this deployment and the DocTypes each one installs. It describes the BINARY, not the org: what a given org has actually installed is the per-module state below.
417pub async fn get_framework_modules(configuration: &configuration::Configuration, ) -> Result<models::ModuleList, Error<GetFrameworkModulesError>> {
418
419    let uri_str = format!("{}/v1/framework/modules", configuration.base_path);
420    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
421
422    if let Some(ref user_agent) = configuration.user_agent {
423        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
424    }
425    if let Some(ref token) = configuration.bearer_access_token {
426        req_builder = req_builder.bearer_auth(token.to_owned());
427    };
428
429    let req = req_builder.build()?;
430    let resp = configuration.client.execute(req).await?;
431
432    let status = resp.status();
433    let content_type = resp
434        .headers()
435        .get("content-type")
436        .and_then(|v| v.to_str().ok())
437        .unwrap_or("application/octet-stream");
438    let content_type = super::ContentType::from(content_type);
439
440    if !status.is_client_error() && !status.is_server_error() {
441        let content = resp.text().await?;
442        match content_type {
443            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
444            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::ModuleList`"))),
445            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::ModuleList`")))),
446        }
447    } else {
448        let content = resp.text().await?;
449        let entity: Option<GetFrameworkModulesError> = serde_json::from_str(&content).ok();
450        Err(Error::ResponseError(ResponseContent { status, content, entity }))
451    }
452}
453
454/// Returns one app lane's install state for the caller's org: the DocTypes the lane declares, and which of them already exist in the org. That is the honest \"set up\" versus \"installed\" answer a console renders.
455pub async fn get_framework_modules_by_module(configuration: &configuration::Configuration, module: &str) -> Result<models::ModuleState, Error<GetFrameworkModulesByModuleError>> {
456    // add a prefix to parameters to efficiently prevent name collisions
457    let p_module = module;
458
459    let uri_str = format!("{}/v1/framework/modules/{module}", configuration.base_path, module=crate::apis::urlencode(p_module));
460    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
461
462    if let Some(ref user_agent) = configuration.user_agent {
463        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
464    }
465    if let Some(ref token) = configuration.bearer_access_token {
466        req_builder = req_builder.bearer_auth(token.to_owned());
467    };
468
469    let req = req_builder.build()?;
470    let resp = configuration.client.execute(req).await?;
471
472    let status = resp.status();
473    let content_type = resp
474        .headers()
475        .get("content-type")
476        .and_then(|v| v.to_str().ok())
477        .unwrap_or("application/octet-stream");
478    let content_type = super::ContentType::from(content_type);
479
480    if !status.is_client_error() && !status.is_server_error() {
481        let content = resp.text().await?;
482        match content_type {
483            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
484            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::ModuleState`"))),
485            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::ModuleState`")))),
486        }
487    } else {
488        let content = resp.text().await?;
489        let entity: Option<GetFrameworkModulesByModuleError> = serde_json::from_str(&content).ok();
490        Err(Error::ResponseError(ResponseContent { status, content, entity }))
491    }
492}
493
494/// Returns every (user, role) assignment in the caller's org. Roles are what DocType permissions are written against, so this is the grant table the permission calculus resolves a member's rights from.
495pub async fn get_framework_roles(configuration: &configuration::Configuration, ) -> Result<models::RoleList, Error<GetFrameworkRolesError>> {
496
497    let uri_str = format!("{}/v1/framework/roles", configuration.base_path);
498    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
499
500    if let Some(ref user_agent) = configuration.user_agent {
501        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
502    }
503    if let Some(ref token) = configuration.bearer_access_token {
504        req_builder = req_builder.bearer_auth(token.to_owned());
505    };
506
507    let req = req_builder.build()?;
508    let resp = configuration.client.execute(req).await?;
509
510    let status = resp.status();
511    let content_type = resp
512        .headers()
513        .get("content-type")
514        .and_then(|v| v.to_str().ok())
515        .unwrap_or("application/octet-stream");
516    let content_type = super::ContentType::from(content_type);
517
518    if !status.is_client_error() && !status.is_server_error() {
519        let content = resp.text().await?;
520        match content_type {
521            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
522            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::RoleList`"))),
523            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::RoleList`")))),
524        }
525    } else {
526        let content = resp.text().await?;
527        let entity: Option<GetFrameworkRolesError> = serde_json::from_str(&content).ok();
528        Err(Error::ResponseError(ResponseContent { status, content, entity }))
529    }
530}
531
532/// Reports how much of the DocType surface the caller's org uses: how many DocTypes it has defined, and how many documents exist across them.
533pub async fn get_framework_summary(configuration: &configuration::Configuration, ) -> Result<models::SummaryView, Error<GetFrameworkSummaryError>> {
534
535    let uri_str = format!("{}/v1/framework/summary", configuration.base_path);
536    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
537
538    if let Some(ref user_agent) = configuration.user_agent {
539        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
540    }
541    if let Some(ref token) = configuration.bearer_access_token {
542        req_builder = req_builder.bearer_auth(token.to_owned());
543    };
544
545    let req = req_builder.build()?;
546    let resp = configuration.client.execute(req).await?;
547
548    let status = resp.status();
549    let content_type = resp
550        .headers()
551        .get("content-type")
552        .and_then(|v| v.to_str().ok())
553        .unwrap_or("application/octet-stream");
554    let content_type = super::ContentType::from(content_type);
555
556    if !status.is_client_error() && !status.is_server_error() {
557        let content = resp.text().await?;
558        match content_type {
559            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
560            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::SummaryView`"))),
561            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::SummaryView`")))),
562        }
563    } else {
564        let content = resp.text().await?;
565        let entity: Option<GetFrameworkSummaryError> = serde_json::from_str(&content).ok();
566        Err(Error::ResponseError(ResponseContent { status, content, entity }))
567    }
568}
569
570/// The body is the DOCUMENT'S field data: a flat JSON object whose properties are the fieldnames the DocType declares, not a fixed envelope. That is why this operation publishes no request schema — the shape is metadata the DocType defines at run time, and no Go struct both accepts it verbatim and describes it, so nothing is asserted rather than something false.  The engine validates and coerces every field against the DocType, runs the before_insert and before_save hooks (either may reject the write), stores the document, then runs the after hooks. It answers 201 with the stored document: the field data plus the managed envelope — `name`, `doctype`, `docstatus`, `createdAt`, `updatedAt`. A Password field comes back as a fixed redaction marker and is dropped when empty; its stored value is never returned by this or any other read on this surface.  `name` in the body is the REQUESTED DOCUMENT NAME, not a data field. A DocType with an autoname rule names the document itself and ignores it; a prompt-named DocType takes it. This collision is also why the two path segments cannot be folded into the body, and so why the route stays untyped.  Scoped to the org of the validated principal, and the engine's own permission calculus decides the rest: the caller needs create rights on this DocType through a role it holds, or a platform admin bit. A caller with no validated principal reaches the engine as the zero Caller and is refused before any store is opened — a forged org header alone buys nothing.  A DocType declared Single has exactly ONE document per org, so this writes that one instance instead of adding a row. The body is size-bounded by the engine, the same bound on every host.
571pub async fn post_framework_by_doctype(configuration: &configuration::Configuration, doctype: &str) -> Result<(), Error<PostFrameworkByDoctypeError>> {
572    // add a prefix to parameters to efficiently prevent name collisions
573    let p_doctype = doctype;
574
575    let uri_str = format!("{}/v1/framework/{doctype}", configuration.base_path, doctype=crate::apis::urlencode(p_doctype));
576    let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
577
578    if let Some(ref user_agent) = configuration.user_agent {
579        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
580    }
581    if let Some(ref token) = configuration.bearer_access_token {
582        req_builder = req_builder.bearer_auth(token.to_owned());
583    };
584
585    let req = req_builder.build()?;
586    let resp = configuration.client.execute(req).await?;
587
588    let status = resp.status();
589
590    if !status.is_client_error() && !status.is_server_error() {
591        Ok(())
592    } else {
593        let content = resp.text().await?;
594        let entity: Option<PostFrameworkByDoctypeError> = serde_json::from_str(&content).ok();
595        Err(Error::ResponseError(ResponseContent { status, content, entity }))
596    }
597}
598
599/// Moves a submitted document to cancelled (docstatus 1 → 2) after its on_cancel hooks agree. Cancelling is terminal — a cancelled document cannot be re-submitted — but it CAN then be deleted.
600pub async fn post_framework_by_doctype_by_name_cancel(configuration: &configuration::Configuration, doctype: &str, name: &str) -> Result<std::collections::HashMap<String, serde_json::Value>, Error<PostFrameworkByDoctypeByNameCancelError>> {
601    // add a prefix to parameters to efficiently prevent name collisions
602    let p_doctype = doctype;
603    let p_name = name;
604
605    let uri_str = format!("{}/v1/framework/{doctype}/{name}/cancel", configuration.base_path, doctype=crate::apis::urlencode(p_doctype), name=crate::apis::urlencode(p_name));
606    let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
607
608    if let Some(ref user_agent) = configuration.user_agent {
609        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
610    }
611    if let Some(ref token) = configuration.bearer_access_token {
612        req_builder = req_builder.bearer_auth(token.to_owned());
613    };
614
615    let req = req_builder.build()?;
616    let resp = configuration.client.execute(req).await?;
617
618    let status = resp.status();
619    let content_type = resp
620        .headers()
621        .get("content-type")
622        .and_then(|v| v.to_str().ok())
623        .unwrap_or("application/octet-stream");
624    let content_type = super::ContentType::from(content_type);
625
626    if !status.is_client_error() && !status.is_server_error() {
627        let content = resp.text().await?;
628        match content_type {
629            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
630            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;`"))),
631            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;`")))),
632        }
633    } else {
634        let content = resp.text().await?;
635        let entity: Option<PostFrameworkByDoctypeByNameCancelError> = serde_json::from_str(&content).ok();
636        Err(Error::ResponseError(ResponseContent { status, content, entity }))
637    }
638}
639
640/// Moves a draft to submitted (docstatus 0 → 1) after its on_submit hooks agree. A submitted document is IMMUTABLE: further writes and deletes are refused until it is cancelled. Only a submittable DocType has this lifecycle; any other docstatus is an illegal transition.
641pub async fn post_framework_by_doctype_by_name_submit(configuration: &configuration::Configuration, doctype: &str, name: &str) -> Result<std::collections::HashMap<String, serde_json::Value>, Error<PostFrameworkByDoctypeByNameSubmitError>> {
642    // add a prefix to parameters to efficiently prevent name collisions
643    let p_doctype = doctype;
644    let p_name = name;
645
646    let uri_str = format!("{}/v1/framework/{doctype}/{name}/submit", configuration.base_path, doctype=crate::apis::urlencode(p_doctype), name=crate::apis::urlencode(p_name));
647    let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
648
649    if let Some(ref user_agent) = configuration.user_agent {
650        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
651    }
652    if let Some(ref token) = configuration.bearer_access_token {
653        req_builder = req_builder.bearer_auth(token.to_owned());
654    };
655
656    let req = req_builder.build()?;
657    let resp = configuration.client.execute(req).await?;
658
659    let status = resp.status();
660    let content_type = resp
661        .headers()
662        .get("content-type")
663        .and_then(|v| v.to_str().ok())
664        .unwrap_or("application/octet-stream");
665    let content_type = super::ContentType::from(content_type);
666
667    if !status.is_client_error() && !status.is_server_error() {
668        let content = resp.text().await?;
669        match content_type {
670            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
671            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;`"))),
672            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;`")))),
673        }
674    } else {
675        let content = resp.text().await?;
676        let entity: Option<PostFrameworkByDoctypeByNameSubmitError> = serde_json::from_str(&content).ok();
677        Err(Error::ResponseError(ResponseContent { status, content, entity }))
678    }
679}
680
681/// Defines a DocType in the caller's org: the metadata that gives a document surface its fields, its naming rule, whether it has a submit/cancel lifecycle, and which role may do what to it. Manager-only — on a fresh org the first caller to administer it is seeded as its System Manager, after which only a System Manager (or a platform admin) may define. Answers 201.
682pub async fn post_framework_doctypes(configuration: &configuration::Configuration, doc_type: models::DocType) -> Result<models::DocType, Error<PostFrameworkDoctypesError>> {
683    // add a prefix to parameters to efficiently prevent name collisions
684    let p_doc_type = doc_type;
685
686    let uri_str = format!("{}/v1/framework/doctypes", configuration.base_path);
687    let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
688
689    if let Some(ref user_agent) = configuration.user_agent {
690        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
691    }
692    if let Some(ref token) = configuration.bearer_access_token {
693        req_builder = req_builder.bearer_auth(token.to_owned());
694    };
695    req_builder = req_builder.json(&p_doc_type);
696
697    let req = req_builder.build()?;
698    let resp = configuration.client.execute(req).await?;
699
700    let status = resp.status();
701    let content_type = resp
702        .headers()
703        .get("content-type")
704        .and_then(|v| v.to_str().ok())
705        .unwrap_or("application/octet-stream");
706    let content_type = super::ContentType::from(content_type);
707
708    if !status.is_client_error() && !status.is_server_error() {
709        let content = resp.text().await?;
710        match content_type {
711            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
712            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::DocType`"))),
713            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::DocType`")))),
714        }
715    } else {
716        let content = resp.text().await?;
717        let entity: Option<PostFrameworkDoctypesError> = serde_json::from_str(&content).ok();
718        Err(Error::ResponseError(ResponseContent { status, content, entity }))
719    }
720}
721
722/// Creates an app lane's DocTypes in the caller's org. Idempotent and create-if-absent: a DocType the org already has is reported as existing and never replaced, so re-installing cannot clobber a definition the org has since edited. Manager-only.
723pub async fn post_framework_modules_by_module_install(configuration: &configuration::Configuration, module: &str) -> Result<models::Install, Error<PostFrameworkModulesByModuleInstallError>> {
724    // add a prefix to parameters to efficiently prevent name collisions
725    let p_module = module;
726
727    let uri_str = format!("{}/v1/framework/modules/{module}/install", configuration.base_path, module=crate::apis::urlencode(p_module));
728    let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
729
730    if let Some(ref user_agent) = configuration.user_agent {
731        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
732    }
733    if let Some(ref token) = configuration.bearer_access_token {
734        req_builder = req_builder.bearer_auth(token.to_owned());
735    };
736
737    let req = req_builder.build()?;
738    let resp = configuration.client.execute(req).await?;
739
740    let status = resp.status();
741    let content_type = resp
742        .headers()
743        .get("content-type")
744        .and_then(|v| v.to_str().ok())
745        .unwrap_or("application/octet-stream");
746    let content_type = super::ContentType::from(content_type);
747
748    if !status.is_client_error() && !status.is_server_error() {
749        let content = resp.text().await?;
750        match content_type {
751            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
752            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::Install`"))),
753            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::Install`")))),
754        }
755    } else {
756        let content = resp.text().await?;
757        let entity: Option<PostFrameworkModulesByModuleInstallError> = serde_json::from_str(&content).ok();
758        Err(Error::ResponseError(ResponseContent { status, content, entity }))
759    }
760}
761
762/// Grants one user one role in the caller's org — how a member gains rights on a DocType, since permissions name roles and never users. Manager-only. Answers 201.
763pub async fn post_framework_roles(configuration: &configuration::Configuration, role_assignment: models::RoleAssignment) -> Result<models::RoleAssignment, Error<PostFrameworkRolesError>> {
764    // add a prefix to parameters to efficiently prevent name collisions
765    let p_role_assignment = role_assignment;
766
767    let uri_str = format!("{}/v1/framework/roles", configuration.base_path);
768    let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
769
770    if let Some(ref user_agent) = configuration.user_agent {
771        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
772    }
773    if let Some(ref token) = configuration.bearer_access_token {
774        req_builder = req_builder.bearer_auth(token.to_owned());
775    };
776    req_builder = req_builder.json(&p_role_assignment);
777
778    let req = req_builder.build()?;
779    let resp = configuration.client.execute(req).await?;
780
781    let status = resp.status();
782    let content_type = resp
783        .headers()
784        .get("content-type")
785        .and_then(|v| v.to_str().ok())
786        .unwrap_or("application/octet-stream");
787    let content_type = super::ContentType::from(content_type);
788
789    if !status.is_client_error() && !status.is_server_error() {
790        let content = resp.text().await?;
791        match content_type {
792            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
793            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::RoleAssignment`"))),
794            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::RoleAssignment`")))),
795        }
796    } else {
797        let content = resp.text().await?;
798        let entity: Option<PostFrameworkRolesError> = serde_json::from_str(&content).ok();
799        Err(Error::ResponseError(ResponseContent { status, content, entity }))
800    }
801}
802
803/// PUT semantics: the stored field data BECOMES the body, so a field the body omits is not left at its previous value. The body is the document's own field data — the same metadata-defined open object the create takes, and the same reason this operation publishes no request schema.  Only a DRAFT can be edited. A document that has been submitted or cancelled is immutable and the write is refused as a conflict, so the submit lifecycle cannot be bypassed by a plain update — cancel it first, and note that a cancelled document can be deleted but never re-submitted or re-edited. The engine validates the new data against the DocType, runs before_save (which may reject), writes, then runs the after hooks, and answers 200 with the stored document plus its managed envelope, Password fields redacted.  The document name in the path is percent-decoded before it is matched, so a name containing a space is addressed as it is stored. An unknown DocType or document is not found, and the same answer covers a document that exists in another tenant: the org comes from the validated principal and is part of the store key, so a caller cannot learn that another org's document exists. Write rights on the DocType are required, decided by the engine's permission calculus.  For a Single DocType the path name is ignored — there is one instance per org and this writes it.
804pub async fn put_framework_by_doctype_by_name(configuration: &configuration::Configuration, doctype: &str, name: &str) -> Result<(), Error<PutFrameworkByDoctypeByNameError>> {
805    // add a prefix to parameters to efficiently prevent name collisions
806    let p_doctype = doctype;
807    let p_name = name;
808
809    let uri_str = format!("{}/v1/framework/{doctype}/{name}", configuration.base_path, doctype=crate::apis::urlencode(p_doctype), name=crate::apis::urlencode(p_name));
810    let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str);
811
812    if let Some(ref user_agent) = configuration.user_agent {
813        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
814    }
815    if let Some(ref token) = configuration.bearer_access_token {
816        req_builder = req_builder.bearer_auth(token.to_owned());
817    };
818
819    let req = req_builder.build()?;
820    let resp = configuration.client.execute(req).await?;
821
822    let status = resp.status();
823
824    if !status.is_client_error() && !status.is_server_error() {
825        Ok(())
826    } else {
827        let content = resp.text().await?;
828        let entity: Option<PutFrameworkByDoctypeByNameError> = serde_json::from_str(&content).ok();
829        Err(Error::ResponseError(ResponseContent { status, content, entity }))
830    }
831}
832
833/// Replaces a DocType definition wholesale (PUT semantics): the stored definition becomes the body. The name in the URL is authoritative over the body's, and documents already stored under the DocType are left intact. Manager-only.
834pub async fn put_framework_doctypes_by_name(configuration: &configuration::Configuration, name: &str, doc_type: models::DocType) -> Result<models::DocType, Error<PutFrameworkDoctypesByNameError>> {
835    // add a prefix to parameters to efficiently prevent name collisions
836    let p_name = name;
837    let p_doc_type = doc_type;
838
839    let uri_str = format!("{}/v1/framework/doctypes/{name}", configuration.base_path, name=crate::apis::urlencode(p_name));
840    let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str);
841
842    if let Some(ref user_agent) = configuration.user_agent {
843        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
844    }
845    if let Some(ref token) = configuration.bearer_access_token {
846        req_builder = req_builder.bearer_auth(token.to_owned());
847    };
848    req_builder = req_builder.json(&p_doc_type);
849
850    let req = req_builder.build()?;
851    let resp = configuration.client.execute(req).await?;
852
853    let status = resp.status();
854    let content_type = resp
855        .headers()
856        .get("content-type")
857        .and_then(|v| v.to_str().ok())
858        .unwrap_or("application/octet-stream");
859    let content_type = super::ContentType::from(content_type);
860
861    if !status.is_client_error() && !status.is_server_error() {
862        let content = resp.text().await?;
863        match content_type {
864            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
865            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::DocType`"))),
866            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::DocType`")))),
867        }
868    } else {
869        let content = resp.text().await?;
870        let entity: Option<PutFrameworkDoctypesByNameError> = serde_json::from_str(&content).ok();
871        Err(Error::ResponseError(ResponseContent { status, content, entity }))
872    }
873}
874