Skip to main content

hanzo_client/apis/
trust_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_trust_by_kind_by_id`]
19#[derive(Debug, Clone, Serialize, Deserialize)]
20#[serde(untagged)]
21pub enum DeleteTrustByKindByIdError {
22    UnknownValue(serde_json::Value),
23}
24
25/// struct for typed errors of method [`get_trust`]
26#[derive(Debug, Clone, Serialize, Deserialize)]
27#[serde(untagged)]
28pub enum GetTrustError {
29    UnknownValue(serde_json::Value),
30}
31
32/// struct for typed errors of method [`get_trust_controls`]
33#[derive(Debug, Clone, Serialize, Deserialize)]
34#[serde(untagged)]
35pub enum GetTrustControlsError {
36    UnknownValue(serde_json::Value),
37}
38
39/// struct for typed errors of method [`get_trust_controls_by_id`]
40#[derive(Debug, Clone, Serialize, Deserialize)]
41#[serde(untagged)]
42pub enum GetTrustControlsByIdError {
43    UnknownValue(serde_json::Value),
44}
45
46/// struct for typed errors of method [`get_trust_coverage`]
47#[derive(Debug, Clone, Serialize, Deserialize)]
48#[serde(untagged)]
49pub enum GetTrustCoverageError {
50    UnknownValue(serde_json::Value),
51}
52
53/// struct for typed errors of method [`get_trust_coverage_by_framework`]
54#[derive(Debug, Clone, Serialize, Deserialize)]
55#[serde(untagged)]
56pub enum GetTrustCoverageByFrameworkError {
57    UnknownValue(serde_json::Value),
58}
59
60/// struct for typed errors of method [`get_trust_documents`]
61#[derive(Debug, Clone, Serialize, Deserialize)]
62#[serde(untagged)]
63pub enum GetTrustDocumentsError {
64    UnknownValue(serde_json::Value),
65}
66
67/// struct for typed errors of method [`get_trust_evidence`]
68#[derive(Debug, Clone, Serialize, Deserialize)]
69#[serde(untagged)]
70pub enum GetTrustEvidenceError {
71    UnknownValue(serde_json::Value),
72}
73
74/// struct for typed errors of method [`get_trust_faq`]
75#[derive(Debug, Clone, Serialize, Deserialize)]
76#[serde(untagged)]
77pub enum GetTrustFaqError {
78    UnknownValue(serde_json::Value),
79}
80
81/// struct for typed errors of method [`get_trust_frameworks`]
82#[derive(Debug, Clone, Serialize, Deserialize)]
83#[serde(untagged)]
84pub enum GetTrustFrameworksError {
85    UnknownValue(serde_json::Value),
86}
87
88/// struct for typed errors of method [`get_trust_policies`]
89#[derive(Debug, Clone, Serialize, Deserialize)]
90#[serde(untagged)]
91pub enum GetTrustPoliciesError {
92    UnknownValue(serde_json::Value),
93}
94
95/// struct for typed errors of method [`get_trust_profile`]
96#[derive(Debug, Clone, Serialize, Deserialize)]
97#[serde(untagged)]
98pub enum GetTrustProfileError {
99    UnknownValue(serde_json::Value),
100}
101
102/// struct for typed errors of method [`get_trust_published_by_org`]
103#[derive(Debug, Clone, Serialize, Deserialize)]
104#[serde(untagged)]
105pub enum GetTrustPublishedByOrgError {
106    UnknownValue(serde_json::Value),
107}
108
109/// struct for typed errors of method [`get_trust_risk`]
110#[derive(Debug, Clone, Serialize, Deserialize)]
111#[serde(untagged)]
112pub enum GetTrustRiskError {
113    UnknownValue(serde_json::Value),
114}
115
116/// struct for typed errors of method [`get_trust_subprocessors`]
117#[derive(Debug, Clone, Serialize, Deserialize)]
118#[serde(untagged)]
119pub enum GetTrustSubprocessorsError {
120    UnknownValue(serde_json::Value),
121}
122
123/// struct for typed errors of method [`get_trust_updates`]
124#[derive(Debug, Clone, Serialize, Deserialize)]
125#[serde(untagged)]
126pub enum GetTrustUpdatesError {
127    UnknownValue(serde_json::Value),
128}
129
130/// struct for typed errors of method [`put_trust_by_kind_by_id`]
131#[derive(Debug, Clone, Serialize, Deserialize)]
132#[serde(untagged)]
133pub enum PutTrustByKindByIdError {
134    UnknownValue(serde_json::Value),
135}
136
137
138/// Removes one record from a section of your organization's trust centre. A record that is not there is a 404, never a silent success. A control that belongs to the deployment's own inventory is removed by a commit, not by a request.
139pub async fn delete_trust_by_kind_by_id(configuration: &configuration::Configuration, kind: &str, id: &str) -> Result<models::Dropped, Error<DeleteTrustByKindByIdError>> {
140    // add a prefix to parameters to efficiently prevent name collisions
141    let p_kind = kind;
142    let p_id = id;
143
144    let uri_str = format!("{}/v1/trust/{kind}/{id}", configuration.base_path, kind=crate::apis::urlencode(p_kind), id=crate::apis::urlencode(p_id));
145    let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str);
146
147    if let Some(ref user_agent) = configuration.user_agent {
148        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
149    }
150    if let Some(ref token) = configuration.bearer_access_token {
151        req_builder = req_builder.bearer_auth(token.to_owned());
152    };
153
154    let req = req_builder.build()?;
155    let resp = configuration.client.execute(req).await?;
156
157    let status = resp.status();
158    let content_type = resp
159        .headers()
160        .get("content-type")
161        .and_then(|v| v.to_str().ok())
162        .unwrap_or("application/octet-stream");
163    let content_type = super::ContentType::from(content_type);
164
165    if !status.is_client_error() && !status.is_server_error() {
166        let content = resp.text().await?;
167        match content_type {
168            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
169            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::Dropped`"))),
170            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::Dropped`")))),
171        }
172    } else {
173        let content = resp.text().await?;
174        let entity: Option<DeleteTrustByKindByIdError> = serde_json::from_str(&content).ok();
175        Err(Error::ResponseError(ResponseContent { status, content, entity }))
176    }
177}
178
179/// Reads YOUR organization's whole trust centre, including the addresses of your own gated documents. Same shape as the published endpoint; the difference is that this one is resolved from your validated bearer and shows you your own artifacts.
180pub async fn get_trust(configuration: &configuration::Configuration, ) -> Result<models::Centre, Error<GetTrustError>> {
181
182    let uri_str = format!("{}/v1/trust", configuration.base_path);
183    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
184
185    if let Some(ref user_agent) = configuration.user_agent {
186        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
187    }
188    if let Some(ref token) = configuration.bearer_access_token {
189        req_builder = req_builder.bearer_auth(token.to_owned());
190    };
191
192    let req = req_builder.build()?;
193    let resp = configuration.client.execute(req).await?;
194
195    let status = resp.status();
196    let content_type = resp
197        .headers()
198        .get("content-type")
199        .and_then(|v| v.to_str().ok())
200        .unwrap_or("application/octet-stream");
201    let content_type = super::ContentType::from(content_type);
202
203    if !status.is_client_error() && !status.is_server_error() {
204        let content = resp.text().await?;
205        match content_type {
206            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
207            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::Centre`"))),
208            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::Centre`")))),
209        }
210    } else {
211        let content = resp.text().await?;
212        let entity: Option<GetTrustError> = serde_json::from_str(&content).ok();
213        Err(Error::ResponseError(ResponseContent { status, content, entity }))
214    }
215}
216
217/// Lists every control your organization publishes, with the counts.  A control names what it asserts, the mechanism behind it, the repository and file where that mechanism is enforced, how it is verified, and the framework clauses it maps to. Status is automated, partial or absent — and an absent one still names the clause it would satisfy, which is a roadmap, while never moving a coverage number.
218pub async fn get_trust_controls(configuration: &configuration::Configuration, ) -> Result<models::ControlList, Error<GetTrustControlsError>> {
219
220    let uri_str = format!("{}/v1/trust/controls", configuration.base_path);
221    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
222
223    if let Some(ref user_agent) = configuration.user_agent {
224        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
225    }
226    if let Some(ref token) = configuration.bearer_access_token {
227        req_builder = req_builder.bearer_auth(token.to_owned());
228    };
229
230    let req = req_builder.build()?;
231    let resp = configuration.client.execute(req).await?;
232
233    let status = resp.status();
234    let content_type = resp
235        .headers()
236        .get("content-type")
237        .and_then(|v| v.to_str().ok())
238        .unwrap_or("application/octet-stream");
239    let content_type = super::ContentType::from(content_type);
240
241    if !status.is_client_error() && !status.is_server_error() {
242        let content = resp.text().await?;
243        match content_type {
244            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
245            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::ControlList`"))),
246            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::ControlList`")))),
247        }
248    } else {
249        let content = resp.text().await?;
250        let entity: Option<GetTrustControlsError> = serde_json::from_str(&content).ok();
251        Err(Error::ResponseError(ResponseContent { status, content, entity }))
252    }
253}
254
255/// Reads one control by id.
256pub async fn get_trust_controls_by_id(configuration: &configuration::Configuration, id: &str) -> Result<serde_json::Value, Error<GetTrustControlsByIdError>> {
257    // add a prefix to parameters to efficiently prevent name collisions
258    let p_id = id;
259
260    let uri_str = format!("{}/v1/trust/controls/{id}", configuration.base_path, id=crate::apis::urlencode(p_id));
261    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
262
263    if let Some(ref user_agent) = configuration.user_agent {
264        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
265    }
266    if let Some(ref token) = configuration.bearer_access_token {
267        req_builder = req_builder.bearer_auth(token.to_owned());
268    };
269
270    let req = req_builder.build()?;
271    let resp = configuration.client.execute(req).await?;
272
273    let status = resp.status();
274    let content_type = resp
275        .headers()
276        .get("content-type")
277        .and_then(|v| v.to_str().ok())
278        .unwrap_or("application/octet-stream");
279    let content_type = super::ContentType::from(content_type);
280
281    if !status.is_client_error() && !status.is_server_error() {
282        let content = resp.text().await?;
283        match content_type {
284            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
285            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `serde_json::Value`"))),
286            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `serde_json::Value`")))),
287        }
288    } else {
289        let content = resp.text().await?;
290        let entity: Option<GetTrustControlsByIdError> = serde_json::from_str(&content).ok();
291        Err(Error::ResponseError(ResponseContent { status, content, entity }))
292    }
293}
294
295/// Reads coverage: per framework, how many clauses have an automated control behind them, how many are partial, and how many have none — each carrying the unit it is counted in, because \"12 of 20\" is not a fact until you know what the 20 are.  Nothing here is a verdict. There is no boolean, and a control that only a person has read counts one rung weaker than it claims to be, because only a check that can FAIL is evidence.
296pub async fn get_trust_coverage(configuration: &configuration::Configuration, ) -> Result<models::TrustCoverage, Error<GetTrustCoverageError>> {
297
298    let uri_str = format!("{}/v1/trust/coverage", configuration.base_path);
299    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
300
301    if let Some(ref user_agent) = configuration.user_agent {
302        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
303    }
304    if let Some(ref token) = configuration.bearer_access_token {
305        req_builder = req_builder.bearer_auth(token.to_owned());
306    };
307
308    let req = req_builder.build()?;
309    let resp = configuration.client.execute(req).await?;
310
311    let status = resp.status();
312    let content_type = resp
313        .headers()
314        .get("content-type")
315        .and_then(|v| v.to_str().ok())
316        .unwrap_or("application/octet-stream");
317    let content_type = super::ContentType::from(content_type);
318
319    if !status.is_client_error() && !status.is_server_error() {
320        let content = resp.text().await?;
321        match content_type {
322            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
323            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::TrustCoverage`"))),
324            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::TrustCoverage`")))),
325        }
326    } else {
327        let content = resp.text().await?;
328        let entity: Option<GetTrustCoverageError> = serde_json::from_str(&content).ok();
329        Err(Error::ResponseError(ResponseContent { status, content, entity }))
330    }
331}
332
333/// Reads one framework clause by clause: every clause the standard publishes, what covers it, and which controls stand behind it — so a coverage number can be checked line by line rather than taken on trust.
334pub async fn get_trust_coverage_by_framework(configuration: &configuration::Configuration, framework: &str) -> Result<models::ClauseCoverage, Error<GetTrustCoverageByFrameworkError>> {
335    // add a prefix to parameters to efficiently prevent name collisions
336    let p_framework = framework;
337
338    let uri_str = format!("{}/v1/trust/coverage/{framework}", configuration.base_path, framework=crate::apis::urlencode(p_framework));
339    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
340
341    if let Some(ref user_agent) = configuration.user_agent {
342        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
343    }
344    if let Some(ref token) = configuration.bearer_access_token {
345        req_builder = req_builder.bearer_auth(token.to_owned());
346    };
347
348    let req = req_builder.build()?;
349    let resp = configuration.client.execute(req).await?;
350
351    let status = resp.status();
352    let content_type = resp
353        .headers()
354        .get("content-type")
355        .and_then(|v| v.to_str().ok())
356        .unwrap_or("application/octet-stream");
357    let content_type = super::ContentType::from(content_type);
358
359    if !status.is_client_error() && !status.is_server_error() {
360        let content = resp.text().await?;
361        match content_type {
362            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
363            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::ClauseCoverage`"))),
364            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::ClauseCoverage`")))),
365        }
366    } else {
367        let content = resp.text().await?;
368        let entity: Option<GetTrustCoverageByFrameworkError> = serde_json::from_str(&content).ok();
369        Err(Error::ResponseError(ResponseContent { status, content, entity }))
370    }
371}
372
373/// Lists your organization's documents. Because this is your own centre, a gated artifact carries its address here; through the published endpoint it does not.
374pub async fn get_trust_documents(configuration: &configuration::Configuration, ) -> Result<models::TrustDocuments, Error<GetTrustDocumentsError>> {
375
376    let uri_str = format!("{}/v1/trust/documents", configuration.base_path);
377    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
378
379    if let Some(ref user_agent) = configuration.user_agent {
380        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
381    }
382    if let Some(ref token) = configuration.bearer_access_token {
383        req_builder = req_builder.bearer_auth(token.to_owned());
384    };
385
386    let req = req_builder.build()?;
387    let resp = configuration.client.execute(req).await?;
388
389    let status = resp.status();
390    let content_type = resp
391        .headers()
392        .get("content-type")
393        .and_then(|v| v.to_str().ok())
394        .unwrap_or("application/octet-stream");
395    let content_type = super::ContentType::from(content_type);
396
397    if !status.is_client_error() && !status.is_server_error() {
398        let content = resp.text().await?;
399        match content_type {
400            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
401            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::TrustDocuments`"))),
402            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::TrustDocuments`")))),
403        }
404    } else {
405        let content = resp.text().await?;
406        let entity: Option<GetTrustDocumentsError> = serde_json::from_str(&content).ok();
407        Err(Error::ResponseError(ResponseContent { status, content, entity }))
408    }
409}
410
411/// Reads the audit rows that stand behind one control, over a window.  The inventory decides what evidences what: a control names the audit actions that are its trail, and this resolves the control id to those actions and reads them. So evidence cannot drift from the inventory, and it is scoped to your own organization — the query carries no organization field for a caller to fill in.  A control that nothing in the trail evidences says so plainly rather than answering an empty page, because an empty page reads like a clean quarter. A deployment with no audit store answers 501 and says the trail was not read, for the same reason.
412pub async fn get_trust_evidence(configuration: &configuration::Configuration, control: Option<&str>, from: Option<&str>, to: Option<&str>, limit: Option<&str>) -> Result<serde_json::Value, Error<GetTrustEvidenceError>> {
413    // add a prefix to parameters to efficiently prevent name collisions
414    let p_control = control;
415    let p_from = from;
416    let p_to = to;
417    let p_limit = limit;
418
419    let uri_str = format!("{}/v1/trust/evidence", configuration.base_path);
420    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
421
422    if let Some(ref param_value) = p_control {
423        req_builder = req_builder.query(&[("control", &param_value.to_string())]);
424    }
425    if let Some(ref param_value) = p_from {
426        req_builder = req_builder.query(&[("from", &param_value.to_string())]);
427    }
428    if let Some(ref param_value) = p_to {
429        req_builder = req_builder.query(&[("to", &param_value.to_string())]);
430    }
431    if let Some(ref param_value) = p_limit {
432        req_builder = req_builder.query(&[("limit", &param_value.to_string())]);
433    }
434    if let Some(ref user_agent) = configuration.user_agent {
435        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
436    }
437    if let Some(ref token) = configuration.bearer_access_token {
438        req_builder = req_builder.bearer_auth(token.to_owned());
439    };
440
441    let req = req_builder.build()?;
442    let resp = configuration.client.execute(req).await?;
443
444    let status = resp.status();
445    let content_type = resp
446        .headers()
447        .get("content-type")
448        .and_then(|v| v.to_str().ok())
449        .unwrap_or("application/octet-stream");
450    let content_type = super::ContentType::from(content_type);
451
452    if !status.is_client_error() && !status.is_server_error() {
453        let content = resp.text().await?;
454        match content_type {
455            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
456            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `serde_json::Value`"))),
457            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `serde_json::Value`")))),
458        }
459    } else {
460        let content = resp.text().await?;
461        let entity: Option<GetTrustEvidenceError> = serde_json::from_str(&content).ok();
462        Err(Error::ResponseError(ResponseContent { status, content, entity }))
463    }
464}
465
466/// Lists your knowledge base — the questions a reviewer asks, answered once.
467pub async fn get_trust_faq(configuration: &configuration::Configuration, ) -> Result<models::FaqList, Error<GetTrustFaqError>> {
468
469    let uri_str = format!("{}/v1/trust/faq", configuration.base_path);
470    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
471
472    if let Some(ref user_agent) = configuration.user_agent {
473        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
474    }
475    if let Some(ref token) = configuration.bearer_access_token {
476        req_builder = req_builder.bearer_auth(token.to_owned());
477    };
478
479    let req = req_builder.build()?;
480    let resp = configuration.client.execute(req).await?;
481
482    let status = resp.status();
483    let content_type = resp
484        .headers()
485        .get("content-type")
486        .and_then(|v| v.to_str().ok())
487        .unwrap_or("application/octet-stream");
488    let content_type = super::ContentType::from(content_type);
489
490    if !status.is_client_error() && !status.is_server_error() {
491        let content = resp.text().await?;
492        match content_type {
493            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
494            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::FaqList`"))),
495            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::FaqList`")))),
496        }
497    } else {
498        let content = resp.text().await?;
499        let entity: Option<GetTrustFaqError> = serde_json::from_str(&content).ok();
500        Err(Error::ResponseError(ResponseContent { status, content, entity }))
501    }
502}
503
504/// Lists the frameworks coverage is computed against, and how many clauses each publishes. That count is the denominator of every coverage number, which is what keeps an uncovered clause visible instead of dropping out of the fraction.
505pub async fn get_trust_frameworks(configuration: &configuration::Configuration, ) -> Result<models::FrameworkList, Error<GetTrustFrameworksError>> {
506
507    let uri_str = format!("{}/v1/trust/frameworks", configuration.base_path);
508    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
509
510    if let Some(ref user_agent) = configuration.user_agent {
511        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
512    }
513    if let Some(ref token) = configuration.bearer_access_token {
514        req_builder = req_builder.bearer_auth(token.to_owned());
515    };
516
517    let req = req_builder.build()?;
518    let resp = configuration.client.execute(req).await?;
519
520    let status = resp.status();
521    let content_type = resp
522        .headers()
523        .get("content-type")
524        .and_then(|v| v.to_str().ok())
525        .unwrap_or("application/octet-stream");
526    let content_type = super::ContentType::from(content_type);
527
528    if !status.is_client_error() && !status.is_server_error() {
529        let content = resp.text().await?;
530        match content_type {
531            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
532            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::FrameworkList`"))),
533            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::FrameworkList`")))),
534        }
535    } else {
536        let content = resp.text().await?;
537        let entity: Option<GetTrustFrameworksError> = serde_json::from_str(&content).ok();
538        Err(Error::ResponseError(ResponseContent { status, content, entity }))
539    }
540}
541
542/// Lists your organization's published policies.
543pub async fn get_trust_policies(configuration: &configuration::Configuration, ) -> Result<models::PolicyList, Error<GetTrustPoliciesError>> {
544
545    let uri_str = format!("{}/v1/trust/policies", configuration.base_path);
546    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
547
548    if let Some(ref user_agent) = configuration.user_agent {
549        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
550    }
551    if let Some(ref token) = configuration.bearer_access_token {
552        req_builder = req_builder.bearer_auth(token.to_owned());
553    };
554
555    let req = req_builder.build()?;
556    let resp = configuration.client.execute(req).await?;
557
558    let status = resp.status();
559    let content_type = resp
560        .headers()
561        .get("content-type")
562        .and_then(|v| v.to_str().ok())
563        .unwrap_or("application/octet-stream");
564    let content_type = super::ContentType::from(content_type);
565
566    if !status.is_client_error() && !status.is_server_error() {
567        let content = resp.text().await?;
568        match content_type {
569            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
570            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::PolicyList`"))),
571            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::PolicyList`")))),
572        }
573    } else {
574        let content = resp.text().await?;
575        let entity: Option<GetTrustPoliciesError> = serde_json::from_str(&content).ok();
576        Err(Error::ResponseError(ResponseContent { status, content, entity }))
577    }
578}
579
580/// Reads your organization's trust-centre profile — the name, tagline and summary a visitor sees, whether the centre is published, and where to send somebody who wants a gated document.
581pub async fn get_trust_profile(configuration: &configuration::Configuration, ) -> Result<serde_json::Value, Error<GetTrustProfileError>> {
582
583    let uri_str = format!("{}/v1/trust/profile", configuration.base_path);
584    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
585
586    if let Some(ref user_agent) = configuration.user_agent {
587        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
588    }
589    if let Some(ref token) = configuration.bearer_access_token {
590        req_builder = req_builder.bearer_auth(token.to_owned());
591    };
592
593    let req = req_builder.build()?;
594    let resp = configuration.client.execute(req).await?;
595
596    let status = resp.status();
597    let content_type = resp
598        .headers()
599        .get("content-type")
600        .and_then(|v| v.to_str().ok())
601        .unwrap_or("application/octet-stream");
602    let content_type = super::ContentType::from(content_type);
603
604    if !status.is_client_error() && !status.is_server_error() {
605        let content = resp.text().await?;
606        match content_type {
607            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
608            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `serde_json::Value`"))),
609            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `serde_json::Value`")))),
610        }
611    } else {
612        let content = resp.text().await?;
613        let entity: Option<GetTrustProfileError> = serde_json::from_str(&content).ok();
614        Err(Error::ResponseError(ResponseContent { status, content, entity }))
615    }
616}
617
618/// Reads a published trust centre — the whole thing in one answer: the organization's profile, its control inventory, coverage computed against each framework's whole published clause list, its documents, subprocessors, policies, knowledge base, updates and risk profile.  This is the PUBLIC endpoint and needs no credential, because a published trust centre is a public document. It answers only for an organization that has published one — an organization that has not is not found rather than empty, since an empty centre and a centre nobody meant to show read the same and are not the same thing.  A gated document appears here with its title, its type and its date and NO address: the listing says the artifact exists and that reading it takes a grant. Nothing an independent auditor signed is ever released through this endpoint.
619pub async fn get_trust_published_by_org(configuration: &configuration::Configuration, org: &str) -> Result<models::Centre, Error<GetTrustPublishedByOrgError>> {
620    // add a prefix to parameters to efficiently prevent name collisions
621    let p_org = org;
622
623    let uri_str = format!("{}/v1/trust/published/{org}", configuration.base_path, org=crate::apis::urlencode(p_org));
624    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
625
626    if let Some(ref user_agent) = configuration.user_agent {
627        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
628    }
629
630    let req = req_builder.build()?;
631    let resp = configuration.client.execute(req).await?;
632
633    let status = resp.status();
634    let content_type = resp
635        .headers()
636        .get("content-type")
637        .and_then(|v| v.to_str().ok())
638        .unwrap_or("application/octet-stream");
639    let content_type = super::ContentType::from(content_type);
640
641    if !status.is_client_error() && !status.is_server_error() {
642        let content = resp.text().await?;
643        match content_type {
644            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
645            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::Centre`"))),
646            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::Centre`")))),
647        }
648    } else {
649        let content = resp.text().await?;
650        let entity: Option<GetTrustPublishedByOrgError> = serde_json::from_str(&content).ok();
651        Err(Error::ResponseError(ResponseContent { status, content, entity }))
652    }
653}
654
655/// Reads your risk profile — the label and value pairs describing what your organization handles and how.
656pub async fn get_trust_risk(configuration: &configuration::Configuration, ) -> Result<serde_json::Value, Error<GetTrustRiskError>> {
657
658    let uri_str = format!("{}/v1/trust/risk", configuration.base_path);
659    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
660
661    if let Some(ref user_agent) = configuration.user_agent {
662        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
663    }
664    if let Some(ref token) = configuration.bearer_access_token {
665        req_builder = req_builder.bearer_auth(token.to_owned());
666    };
667
668    let req = req_builder.build()?;
669    let resp = configuration.client.execute(req).await?;
670
671    let status = resp.status();
672    let content_type = resp
673        .headers()
674        .get("content-type")
675        .and_then(|v| v.to_str().ok())
676        .unwrap_or("application/octet-stream");
677    let content_type = super::ContentType::from(content_type);
678
679    if !status.is_client_error() && !status.is_server_error() {
680        let content = resp.text().await?;
681        match content_type {
682            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
683            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `serde_json::Value`"))),
684            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `serde_json::Value`")))),
685        }
686    } else {
687        let content = resp.text().await?;
688        let entity: Option<GetTrustRiskError> = serde_json::from_str(&content).ok();
689        Err(Error::ResponseError(ResponseContent { status, content, entity }))
690    }
691}
692
693/// Lists the third parties your organization sends data to, each naming what it is for.
694pub async fn get_trust_subprocessors(configuration: &configuration::Configuration, ) -> Result<models::SubprocessorList, Error<GetTrustSubprocessorsError>> {
695
696    let uri_str = format!("{}/v1/trust/subprocessors", configuration.base_path);
697    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
698
699    if let Some(ref user_agent) = configuration.user_agent {
700        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
701    }
702    if let Some(ref token) = configuration.bearer_access_token {
703        req_builder = req_builder.bearer_auth(token.to_owned());
704    };
705
706    let req = req_builder.build()?;
707    let resp = configuration.client.execute(req).await?;
708
709    let status = resp.status();
710    let content_type = resp
711        .headers()
712        .get("content-type")
713        .and_then(|v| v.to_str().ok())
714        .unwrap_or("application/octet-stream");
715    let content_type = super::ContentType::from(content_type);
716
717    if !status.is_client_error() && !status.is_server_error() {
718        let content = resp.text().await?;
719        match content_type {
720            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
721            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::SubprocessorList`"))),
722            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::SubprocessorList`")))),
723        }
724    } else {
725        let content = resp.text().await?;
726        let entity: Option<GetTrustSubprocessorsError> = serde_json::from_str(&content).ok();
727        Err(Error::ResponseError(ResponseContent { status, content, entity }))
728    }
729}
730
731/// Lists your trust-centre updates, newest as you ordered them.
732pub async fn get_trust_updates(configuration: &configuration::Configuration, ) -> Result<models::UpdateList, Error<GetTrustUpdatesError>> {
733
734    let uri_str = format!("{}/v1/trust/updates", configuration.base_path);
735    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
736
737    if let Some(ref user_agent) = configuration.user_agent {
738        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
739    }
740    if let Some(ref token) = configuration.bearer_access_token {
741        req_builder = req_builder.bearer_auth(token.to_owned());
742    };
743
744    let req = req_builder.build()?;
745    let resp = configuration.client.execute(req).await?;
746
747    let status = resp.status();
748    let content_type = resp
749        .headers()
750        .get("content-type")
751        .and_then(|v| v.to_str().ok())
752        .unwrap_or("application/octet-stream");
753    let content_type = super::ContentType::from(content_type);
754
755    if !status.is_client_error() && !status.is_server_error() {
756        let content = resp.text().await?;
757        match content_type {
758            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
759            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::UpdateList`"))),
760            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::UpdateList`")))),
761        }
762    } else {
763        let content = resp.text().await?;
764        let entity: Option<GetTrustUpdatesError> = serde_json::from_str(&content).ok();
765        Err(Error::ResponseError(ResponseContent { status, content, entity }))
766    }
767}
768
769/// Writes one record into a section of YOUR organization's trust centre — profile, control, document, subprocessor, policy, faq, update or risk.  A control written here is held to exactly the rule a control committed to the deployment's own inventory is held to, by the same validator: its prose may not claim a certificate and may not name a framework (a framework belongs in the mappings, where it arrives attached to a number), anything short of automated must say what is missing, and a mapping to a clause no framework declares is refused rather than scored as nothing.  A document defaults to GATED. An artifact an independent auditor signed — a SOC 2 report, an ISO certificate, a penetration test, an auditor letter — cannot be made public at all; it is released through a grant. A self-assessment can, because the organization is the one attesting it.  The deployment's OWN control inventory is governed in git and is not writable here: naming one of its ids is a conflict, not an overwrite.
770pub async fn put_trust_by_kind_by_id(configuration: &configuration::Configuration, kind: &str, id: &str, section_write: models::SectionWrite) -> Result<models::Written, Error<PutTrustByKindByIdError>> {
771    // add a prefix to parameters to efficiently prevent name collisions
772    let p_kind = kind;
773    let p_id = id;
774    let p_section_write = section_write;
775
776    let uri_str = format!("{}/v1/trust/{kind}/{id}", configuration.base_path, kind=crate::apis::urlencode(p_kind), id=crate::apis::urlencode(p_id));
777    let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str);
778
779    if let Some(ref user_agent) = configuration.user_agent {
780        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
781    }
782    if let Some(ref token) = configuration.bearer_access_token {
783        req_builder = req_builder.bearer_auth(token.to_owned());
784    };
785    req_builder = req_builder.json(&p_section_write);
786
787    let req = req_builder.build()?;
788    let resp = configuration.client.execute(req).await?;
789
790    let status = resp.status();
791    let content_type = resp
792        .headers()
793        .get("content-type")
794        .and_then(|v| v.to_str().ok())
795        .unwrap_or("application/octet-stream");
796    let content_type = super::ContentType::from(content_type);
797
798    if !status.is_client_error() && !status.is_server_error() {
799        let content = resp.text().await?;
800        match content_type {
801            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
802            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::Written`"))),
803            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::Written`")))),
804        }
805    } else {
806        let content = resp.text().await?;
807        let entity: Option<PutTrustByKindByIdError> = serde_json::from_str(&content).ok();
808        Err(Error::ResponseError(ResponseContent { status, content, entity }))
809    }
810}
811