Skip to main content

hanzo_client/apis/
dataroom_api.rs

1/*
2 * Hanzo Cloud API
3 *
4 * The Hanzo Cloud API as a customer calls it: every operation under /v1/ except the operator's admin product, relay routes, legacy spellings and capabilities still reached by flag. Tagged by product: the first path segment after /v1/.
5 *
6 * The version of the OpenAPI document: v1
7 * 
8 * Generated by: https://openapi-generator.tech
9 */
10
11
12use reqwest;
13use serde::{Deserialize, Serialize, de::Error as _};
14use crate::{apis::ResponseContent, models};
15use super::{Error, configuration, ContentType};
16
17
18/// struct for typed errors of method [`get_dataroom_analytics_dataroom_by_dataroomid`]
19#[derive(Debug, Clone, Serialize, Deserialize)]
20#[serde(untagged)]
21pub enum GetDataroomAnalyticsDataroomByDataroomidError {
22    UnknownValue(serde_json::Value),
23}
24
25/// struct for typed errors of method [`get_dataroom_analytics_link_by_linkid`]
26#[derive(Debug, Clone, Serialize, Deserialize)]
27#[serde(untagged)]
28pub enum GetDataroomAnalyticsLinkByLinkidError {
29    UnknownValue(serde_json::Value),
30}
31
32/// struct for typed errors of method [`get_dataroom_datarooms`]
33#[derive(Debug, Clone, Serialize, Deserialize)]
34#[serde(untagged)]
35pub enum GetDataroomDataroomsError {
36    UnknownValue(serde_json::Value),
37}
38
39/// struct for typed errors of method [`get_dataroom_datarooms_by_id`]
40#[derive(Debug, Clone, Serialize, Deserialize)]
41#[serde(untagged)]
42pub enum GetDataroomDataroomsByIdError {
43    UnknownValue(serde_json::Value),
44}
45
46/// struct for typed errors of method [`get_dataroom_documents`]
47#[derive(Debug, Clone, Serialize, Deserialize)]
48#[serde(untagged)]
49pub enum GetDataroomDocumentsError {
50    UnknownValue(serde_json::Value),
51}
52
53/// struct for typed errors of method [`get_dataroom_documents_by_id`]
54#[derive(Debug, Clone, Serialize, Deserialize)]
55#[serde(untagged)]
56pub enum GetDataroomDocumentsByIdError {
57    UnknownValue(serde_json::Value),
58}
59
60/// struct for typed errors of method [`get_dataroom_documents_by_id_file`]
61#[derive(Debug, Clone, Serialize, Deserialize)]
62#[serde(untagged)]
63pub enum GetDataroomDocumentsByIdFileError {
64    UnknownValue(serde_json::Value),
65}
66
67/// struct for typed errors of method [`get_dataroom_health`]
68#[derive(Debug, Clone, Serialize, Deserialize)]
69#[serde(untagged)]
70pub enum GetDataroomHealthError {
71    UnknownValue(serde_json::Value),
72}
73
74/// struct for typed errors of method [`get_dataroom_links`]
75#[derive(Debug, Clone, Serialize, Deserialize)]
76#[serde(untagged)]
77pub enum GetDataroomLinksError {
78    UnknownValue(serde_json::Value),
79}
80
81/// struct for typed errors of method [`get_dataroom_trust`]
82#[derive(Debug, Clone, Serialize, Deserialize)]
83#[serde(untagged)]
84pub enum GetDataroomTrustError {
85    UnknownValue(serde_json::Value),
86}
87
88/// struct for typed errors of method [`get_dataroom_trust_center_by_slug`]
89#[derive(Debug, Clone, Serialize, Deserialize)]
90#[serde(untagged)]
91pub enum GetDataroomTrustCenterBySlugError {
92    UnknownValue(serde_json::Value),
93}
94
95/// struct for typed errors of method [`get_dataroom_trust_center_by_slug_file_by_item`]
96#[derive(Debug, Clone, Serialize, Deserialize)]
97#[serde(untagged)]
98pub enum GetDataroomTrustCenterBySlugFileByItemError {
99    UnknownValue(serde_json::Value),
100}
101
102/// struct for typed errors of method [`get_dataroom_view_by_linkid`]
103#[derive(Debug, Clone, Serialize, Deserialize)]
104#[serde(untagged)]
105pub enum GetDataroomViewByLinkidError {
106    UnknownValue(serde_json::Value),
107}
108
109/// struct for typed errors of method [`get_dataroom_view_by_linkid_document_by_documentid_file`]
110#[derive(Debug, Clone, Serialize, Deserialize)]
111#[serde(untagged)]
112pub enum GetDataroomViewByLinkidDocumentByDocumentidFileError {
113    UnknownValue(serde_json::Value),
114}
115
116/// struct for typed errors of method [`patch_dataroom_trust_artifacts_by_id`]
117#[derive(Debug, Clone, Serialize, Deserialize)]
118#[serde(untagged)]
119pub enum PatchDataroomTrustArtifactsByIdError {
120    UnknownValue(serde_json::Value),
121}
122
123/// struct for typed errors of method [`post_dataroom_datarooms`]
124#[derive(Debug, Clone, Serialize, Deserialize)]
125#[serde(untagged)]
126pub enum PostDataroomDataroomsError {
127    UnknownValue(serde_json::Value),
128}
129
130/// struct for typed errors of method [`post_dataroom_datarooms_by_id_documents`]
131#[derive(Debug, Clone, Serialize, Deserialize)]
132#[serde(untagged)]
133pub enum PostDataroomDataroomsByIdDocumentsError {
134    UnknownValue(serde_json::Value),
135}
136
137/// struct for typed errors of method [`post_dataroom_documents`]
138#[derive(Debug, Clone, Serialize, Deserialize)]
139#[serde(untagged)]
140pub enum PostDataroomDocumentsError {
141    UnknownValue(serde_json::Value),
142}
143
144/// struct for typed errors of method [`post_dataroom_links`]
145#[derive(Debug, Clone, Serialize, Deserialize)]
146#[serde(untagged)]
147pub enum PostDataroomLinksError {
148    UnknownValue(serde_json::Value),
149}
150
151/// struct for typed errors of method [`post_dataroom_trust_artifacts`]
152#[derive(Debug, Clone, Serialize, Deserialize)]
153#[serde(untagged)]
154pub enum PostDataroomTrustArtifactsError {
155    UnknownValue(serde_json::Value),
156}
157
158/// struct for typed errors of method [`post_dataroom_trust_center_by_slug_requests`]
159#[derive(Debug, Clone, Serialize, Deserialize)]
160#[serde(untagged)]
161pub enum PostDataroomTrustCenterBySlugRequestsError {
162    UnknownValue(serde_json::Value),
163}
164
165/// struct for typed errors of method [`post_dataroom_trust_requests_by_id_grant`]
166#[derive(Debug, Clone, Serialize, Deserialize)]
167#[serde(untagged)]
168pub enum PostDataroomTrustRequestsByIdGrantError {
169    UnknownValue(serde_json::Value),
170}
171
172/// struct for typed errors of method [`post_dataroom_trust_requests_by_id_refuse`]
173#[derive(Debug, Clone, Serialize, Deserialize)]
174#[serde(untagged)]
175pub enum PostDataroomTrustRequestsByIdRefuseError {
176    UnknownValue(serde_json::Value),
177}
178
179/// struct for typed errors of method [`post_dataroom_view_by_linkid_authenticate`]
180#[derive(Debug, Clone, Serialize, Deserialize)]
181#[serde(untagged)]
182pub enum PostDataroomViewByLinkidAuthenticateError {
183    UnknownValue(serde_json::Value),
184}
185
186/// struct for typed errors of method [`post_dataroom_view_by_linkid_pageview`]
187#[derive(Debug, Clone, Serialize, Deserialize)]
188#[serde(untagged)]
189pub enum PostDataroomViewByLinkidPageviewError {
190    UnknownValue(serde_json::Value),
191}
192
193/// struct for typed errors of method [`put_dataroom_trust`]
194#[derive(Debug, Clone, Serialize, Deserialize)]
195#[serde(untagged)]
196pub enum PutDataroomTrustError {
197    UnknownValue(serde_json::Value),
198}
199
200
201/// Rolls up every share link pointing at one data room: session and page-view totals for the room, plus the per-page breakdown for each link beneath it.  A room id outside the caller's own tenant store is not found. Only links that NAME the room are counted — a link created over a single document contributes nothing here, even when that document also sits in the room.
202pub async fn get_dataroom_analytics_dataroom_by_dataroomid(configuration: &configuration::Configuration, dataroom_id: &str) -> Result<models::DataroomStats, Error<GetDataroomAnalyticsDataroomByDataroomidError>> {
203    // add a prefix to parameters to efficiently prevent name collisions
204    let p_dataroom_id = dataroom_id;
205
206    let uri_str = format!("{}/v1/dataroom/analytics/dataroom/{dataroomId}", configuration.base_path, dataroomId=crate::apis::urlencode(p_dataroom_id));
207    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
208
209    if let Some(ref user_agent) = configuration.user_agent {
210        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
211    }
212    if let Some(ref token) = configuration.bearer_access_token {
213        req_builder = req_builder.bearer_auth(token.to_owned());
214    };
215
216    let req = req_builder.build()?;
217    let resp = configuration.client.execute(req).await?;
218
219    let status = resp.status();
220    let content_type = resp
221        .headers()
222        .get("content-type")
223        .and_then(|v| v.to_str().ok())
224        .unwrap_or("application/octet-stream");
225    let content_type = super::ContentType::from(content_type);
226
227    if !status.is_client_error() && !status.is_server_error() {
228        let content = resp.text().await?;
229        match content_type {
230            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
231            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::DataroomStats`"))),
232            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::DataroomStats`")))),
233        }
234    } else {
235        let content = resp.text().await?;
236        let entity: Option<GetDataroomAnalyticsDataroomByDataroomidError> = serde_json::from_str(&content).ok();
237        Err(Error::ResponseError(ResponseContent { status, content, entity }))
238    }
239}
240
241/// Reports how one share link was actually read: total viewing sessions, total page views, and per page the view count, the summed dwell measure and its average.  The link is resolved in the caller's OWN tenant store, so another org's link id is not found — knowing a link id is enough to OPEN the room it shares, and never enough to read who has been reading it.
242pub async fn get_dataroom_analytics_link_by_linkid(configuration: &configuration::Configuration, link_id: &str) -> Result<models::DataroomLinkStats, Error<GetDataroomAnalyticsLinkByLinkidError>> {
243    // add a prefix to parameters to efficiently prevent name collisions
244    let p_link_id = link_id;
245
246    let uri_str = format!("{}/v1/dataroom/analytics/link/{linkId}", configuration.base_path, linkId=crate::apis::urlencode(p_link_id));
247    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
248
249    if let Some(ref user_agent) = configuration.user_agent {
250        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
251    }
252    if let Some(ref token) = configuration.bearer_access_token {
253        req_builder = req_builder.bearer_auth(token.to_owned());
254    };
255
256    let req = req_builder.build()?;
257    let resp = configuration.client.execute(req).await?;
258
259    let status = resp.status();
260    let content_type = resp
261        .headers()
262        .get("content-type")
263        .and_then(|v| v.to_str().ok())
264        .unwrap_or("application/octet-stream");
265    let content_type = super::ContentType::from(content_type);
266
267    if !status.is_client_error() && !status.is_server_error() {
268        let content = resp.text().await?;
269        match content_type {
270            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
271            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::DataroomLinkStats`"))),
272            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::DataroomLinkStats`")))),
273        }
274    } else {
275        let content = resp.text().await?;
276        let entity: Option<GetDataroomAnalyticsLinkByLinkidError> = serde_json::from_str(&content).ok();
277        Err(Error::ResponseError(ResponseContent { status, content, entity }))
278    }
279}
280
281/// Returns every data room in the caller org's own store, newest first, with its short public id, name, description and timestamps.  Documents are not included — a room's contents come from reading the single room.
282pub async fn get_dataroom_datarooms(configuration: &configuration::Configuration, ) -> Result<models::DataroomRooms, Error<GetDataroomDataroomsError>> {
283
284    let uri_str = format!("{}/v1/dataroom/datarooms", configuration.base_path);
285    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
286
287    if let Some(ref user_agent) = configuration.user_agent {
288        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
289    }
290    if let Some(ref token) = configuration.bearer_access_token {
291        req_builder = req_builder.bearer_auth(token.to_owned());
292    };
293
294    let req = req_builder.build()?;
295    let resp = configuration.client.execute(req).await?;
296
297    let status = resp.status();
298    let content_type = resp
299        .headers()
300        .get("content-type")
301        .and_then(|v| v.to_str().ok())
302        .unwrap_or("application/octet-stream");
303    let content_type = super::ContentType::from(content_type);
304
305    if !status.is_client_error() && !status.is_server_error() {
306        let content = resp.text().await?;
307        match content_type {
308            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
309            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::DataroomRooms`"))),
310            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::DataroomRooms`")))),
311        }
312    } else {
313        let content = resp.text().await?;
314        let entity: Option<GetDataroomDataroomsError> = serde_json::from_str(&content).ok();
315        Err(Error::ResponseError(ResponseContent { status, content, entity }))
316    }
317}
318
319/// Reads one of the caller org's data rooms together with every document in it, each carrying its membership id and order index.  The documents are sorted by that index with unordered ones last and creation time breaking ties — the SAME order a link's visitor sees, so this is what the room looks like from the outside. A room id outside the caller's own tenant store is not found.
320pub async fn get_dataroom_datarooms_by_id(configuration: &configuration::Configuration, id: &str) -> Result<models::DataroomRoomDetailOne, Error<GetDataroomDataroomsByIdError>> {
321    // add a prefix to parameters to efficiently prevent name collisions
322    let p_id = id;
323
324    let uri_str = format!("{}/v1/dataroom/datarooms/{id}", configuration.base_path, id=crate::apis::urlencode(p_id));
325    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
326
327    if let Some(ref user_agent) = configuration.user_agent {
328        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
329    }
330    if let Some(ref token) = configuration.bearer_access_token {
331        req_builder = req_builder.bearer_auth(token.to_owned());
332    };
333
334    let req = req_builder.build()?;
335    let resp = configuration.client.execute(req).await?;
336
337    let status = resp.status();
338    let content_type = resp
339        .headers()
340        .get("content-type")
341        .and_then(|v| v.to_str().ok())
342        .unwrap_or("application/octet-stream");
343    let content_type = super::ContentType::from(content_type);
344
345    if !status.is_client_error() && !status.is_server_error() {
346        let content = resp.text().await?;
347        match content_type {
348            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
349            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::DataroomRoomDetailOne`"))),
350            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::DataroomRoomDetailOne`")))),
351        }
352    } else {
353        let content = resp.text().await?;
354        let entity: Option<GetDataroomDataroomsByIdError> = serde_json::from_str(&content).ok();
355        Err(Error::ResponseError(ResponseContent { status, content, entity }))
356    }
357}
358
359/// Returns every document in the caller org's own store, newest first — name, opaque storage key, content type, page count, size and timestamps.  Tenant isolation is the per-org store itself: there is one SQLite file per org and the org is never a parameter, so no input the caller controls can address another tenant's documents. Metadata only — the bytes come from the file route.
360pub async fn get_dataroom_documents(configuration: &configuration::Configuration, ) -> Result<models::DataroomDocuments, Error<GetDataroomDocumentsError>> {
361
362    let uri_str = format!("{}/v1/dataroom/documents", configuration.base_path);
363    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
364
365    if let Some(ref user_agent) = configuration.user_agent {
366        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
367    }
368    if let Some(ref token) = configuration.bearer_access_token {
369        req_builder = req_builder.bearer_auth(token.to_owned());
370    };
371
372    let req = req_builder.build()?;
373    let resp = configuration.client.execute(req).await?;
374
375    let status = resp.status();
376    let content_type = resp
377        .headers()
378        .get("content-type")
379        .and_then(|v| v.to_str().ok())
380        .unwrap_or("application/octet-stream");
381    let content_type = super::ContentType::from(content_type);
382
383    if !status.is_client_error() && !status.is_server_error() {
384        let content = resp.text().await?;
385        match content_type {
386            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
387            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::DataroomDocuments`"))),
388            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::DataroomDocuments`")))),
389        }
390    } else {
391        let content = resp.text().await?;
392        let entity: Option<GetDataroomDocumentsError> = serde_json::from_str(&content).ok();
393        Err(Error::ResponseError(ResponseContent { status, content, entity }))
394    }
395}
396
397/// Reads one of the caller org's documents — its name, opaque storage key, content type, page count, size and timestamps.  The lookup runs in the caller's own tenant store, so an id belonging to another org is not found exactly like one that never existed. Metadata only: the bytes are a separate read.
398pub async fn get_dataroom_documents_by_id(configuration: &configuration::Configuration, id: &str) -> Result<models::DataroomDocumentOne, Error<GetDataroomDocumentsByIdError>> {
399    // add a prefix to parameters to efficiently prevent name collisions
400    let p_id = id;
401
402    let uri_str = format!("{}/v1/dataroom/documents/{id}", configuration.base_path, id=crate::apis::urlencode(p_id));
403    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
404
405    if let Some(ref user_agent) = configuration.user_agent {
406        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
407    }
408    if let Some(ref token) = configuration.bearer_access_token {
409        req_builder = req_builder.bearer_auth(token.to_owned());
410    };
411
412    let req = req_builder.build()?;
413    let resp = configuration.client.execute(req).await?;
414
415    let status = resp.status();
416    let content_type = resp
417        .headers()
418        .get("content-type")
419        .and_then(|v| v.to_str().ok())
420        .unwrap_or("application/octet-stream");
421    let content_type = super::ContentType::from(content_type);
422
423    if !status.is_client_error() && !status.is_server_error() {
424        let content = resp.text().await?;
425        match content_type {
426            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
427            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::DataroomDocumentOne`"))),
428            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::DataroomDocumentOne`")))),
429        }
430    } else {
431        let content = resp.text().await?;
432        let entity: Option<GetDataroomDocumentsByIdError> = serde_json::from_str(&content).ok();
433        Err(Error::ResponseError(ResponseContent { status, content, entity }))
434    }
435}
436
437/// Streams the stored file back under the type read from its BYTES — a raster image or a PDF renders in place, and anything else is served as application/octet-stream with an attachment disposition, so a stored file never executes as markup in this origin. Every response carries nosniff, which keeps the declared type binding.  Requires a validated principal; 403 without one, and the document is resolved in the caller's own tenant store, so another org's id is a 404. This is the OWNER's path and applies no link gate at all — the per-link password, email and download controls live on the viewer surface, not here. Bytes that cannot be fetched from object storage are 502, never a truncated or empty file.
438pub async fn get_dataroom_documents_by_id_file(configuration: &configuration::Configuration, id: &str) -> Result<(), Error<GetDataroomDocumentsByIdFileError>> {
439    // add a prefix to parameters to efficiently prevent name collisions
440    let p_id = id;
441
442    let uri_str = format!("{}/v1/dataroom/documents/{id}/file", configuration.base_path, id=crate::apis::urlencode(p_id));
443    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
444
445    if let Some(ref user_agent) = configuration.user_agent {
446        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
447    }
448    if let Some(ref token) = configuration.bearer_access_token {
449        req_builder = req_builder.bearer_auth(token.to_owned());
450    };
451
452    let req = req_builder.build()?;
453    let resp = configuration.client.execute(req).await?;
454
455    let status = resp.status();
456
457    if !status.is_client_error() && !status.is_server_error() {
458        Ok(())
459    } else {
460        let content = resp.text().await?;
461        let entity: Option<GetDataroomDocumentsByIdFileError> = serde_json::from_str(&content).ok();
462        Err(Error::ResponseError(ResponseContent { status, content, entity }))
463    }
464}
465
466/// Health reports that the data room subsystem is up.  It answers before the bundle loads, holds no state and touches no store, so it stays true in exactly the situation an operator is probing for. It says nothing about whether a room can be OPENED — that is what the room operations answer — because a liveness probe that fails on a dependency takes a working process out of rotation.
467pub async fn get_dataroom_health(configuration: &configuration::Configuration, ) -> Result<models::DataroomLiveness, Error<GetDataroomHealthError>> {
468
469    let uri_str = format!("{}/v1/dataroom/health", 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::DataroomLiveness`"))),
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::DataroomLiveness`")))),
496        }
497    } else {
498        let content = resp.text().await?;
499        let entity: Option<GetDataroomHealthError> = serde_json::from_str(&content).ok();
500        Err(Error::ResponseError(ResponseContent { status, content, entity }))
501    }
502}
503
504/// Returns every live share link in the caller org's own store, newest first, with the controls a visitor will meet: whether an address is required, whether a password is set, the allow and deny lists, whether download is permitted, and when the link expires.  Archived links are omitted entirely. A link reports only THAT a password is set — the stored form is a bcrypt hash and no route returns it.
505pub async fn get_dataroom_links(configuration: &configuration::Configuration, ) -> Result<models::DataroomLinks, Error<GetDataroomLinksError>> {
506
507    let uri_str = format!("{}/v1/dataroom/links", 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::DataroomLinks`"))),
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::DataroomLinks`")))),
534        }
535    } else {
536        let content = resp.text().await?;
537        let entity: Option<GetDataroomLinksError> = serde_json::from_str(&content).ok();
538        Err(Error::ResponseError(ResponseContent { status, content, entity }))
539    }
540}
541
542/// Answers the caller org's OWN trust centre: its settings, every item it holds in both tiers, the requests waiting on it, and the grants it has made.  The org is the caller's, taken from the validated bearer and from nothing else, so this op cannot be pointed at another tenant — there is no field for one. An org that has never opened a centre reads back an empty one rather than an error, because having no trust centre is an ordinary state and this is the read that tells you so.
543pub async fn get_dataroom_trust(configuration: &configuration::Configuration, ) -> Result<models::TrustDesk, Error<GetDataroomTrustError>> {
544
545    let uri_str = format!("{}/v1/dataroom/trust", 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::TrustDesk`"))),
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::TrustDesk`")))),
572        }
573    } else {
574        let content = resp.text().await?;
575        let entity: Option<GetDataroomTrustError> = serde_json::from_str(&content).ok();
576        Err(Error::ResponseError(ResponseContent { status, content, entity }))
577    }
578}
579
580/// Answers an org's public trust centre: its name, the text a party must accept to ask for a document, and every item it publishes.  An item is either available NOW — the things the org states itself, its policies, its filled questionnaires, its subprocessor list, its knowledge base — or available ON REQUEST, which is everything an independent auditor put their name to. Both are listed by name and kind, so a reader can see WHAT exists before asking for it; only the second withholds the content.  No principal is involved and none is accepted: the org is resolved from the address, which answers only for a centre its owner has published. An address nobody publishes at is not found, the same answer an unpublished one gets.
581pub async fn get_dataroom_trust_center_by_slug(configuration: &configuration::Configuration, slug: &str) -> Result<models::TrustPage, Error<GetDataroomTrustCenterBySlugError>> {
582    // add a prefix to parameters to efficiently prevent name collisions
583    let p_slug = slug;
584
585    let uri_str = format!("{}/v1/dataroom/trust/center/{slug}", configuration.base_path, slug=crate::apis::urlencode(p_slug));
586    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
587
588    if let Some(ref user_agent) = configuration.user_agent {
589        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
590    }
591    if let Some(ref token) = configuration.bearer_access_token {
592        req_builder = req_builder.bearer_auth(token.to_owned());
593    };
594
595    let req = req_builder.build()?;
596    let resp = configuration.client.execute(req).await?;
597
598    let status = resp.status();
599    let content_type = resp
600        .headers()
601        .get("content-type")
602        .and_then(|v| v.to_str().ok())
603        .unwrap_or("application/octet-stream");
604    let content_type = super::ContentType::from(content_type);
605
606    if !status.is_client_error() && !status.is_server_error() {
607        let content = resp.text().await?;
608        match content_type {
609            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
610            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::TrustPage`"))),
611            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::TrustPage`")))),
612        }
613    } else {
614        let content = resp.text().await?;
615        let entity: Option<GetDataroomTrustCenterBySlugError> = serde_json::from_str(&content).ok();
616        Err(Error::ResponseError(ResponseContent { status, content, entity }))
617    }
618}
619
620/// Streams the file behind an item a trust centre publishes openly — a policy, a filled questionnaire, a knowledge-base attachment — under the type read from its bytes: a picture or a PDF renders in place, anything else downloads inert.  No principal and no link: these are the things an org states about itself, so they are served to anyone who asks. The narrowing is in the lookup rather than in a check: the item must be public, must not be retired, and must belong to a centre its owner has published, so an item released only on request is NOT FOUND here rather than refused — the same answer an id that never existed gets, which is what stops this reporting what the released-on-request tier holds.  Bytes that cannot be fetched from object storage are 502, never a truncated file.
621pub async fn get_dataroom_trust_center_by_slug_file_by_item(configuration: &configuration::Configuration, slug: &str, item: &str) -> Result<(), Error<GetDataroomTrustCenterBySlugFileByItemError>> {
622    // add a prefix to parameters to efficiently prevent name collisions
623    let p_slug = slug;
624    let p_item = item;
625
626    let uri_str = format!("{}/v1/dataroom/trust/center/{slug}/file/{item}", configuration.base_path, slug=crate::apis::urlencode(p_slug), item=crate::apis::urlencode(p_item));
627    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
628
629    if let Some(ref user_agent) = configuration.user_agent {
630        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
631    }
632    if let Some(ref token) = configuration.bearer_access_token {
633        req_builder = req_builder.bearer_auth(token.to_owned());
634    };
635
636    let req = req_builder.build()?;
637    let resp = configuration.client.execute(req).await?;
638
639    let status = resp.status();
640
641    if !status.is_client_error() && !status.is_server_error() {
642        Ok(())
643    } else {
644        let content = resp.text().await?;
645        let entity: Option<GetDataroomTrustCenterBySlugFileByItemError> = serde_json::from_str(&content).ok();
646        Err(Error::ResponseError(ResponseContent { status, content, entity }))
647    }
648}
649
650/// Answers the pre-auth face of a link to anyone holding its id: name and type, which gates apply (whether an address is required, whether a password is set), whether download is permitted, whether it has expired, and the name and description of the room behind it — or, for a single-document link, that document's name and page count.  No principal is involved: the owning org is resolved from the link id through dataroom's one cross-tenant routing table, and an unknown or archived link is a 404.  It is metadata only — a room's document list and every file stay behind the authenticate step. An expired link is REPORTED as expired here rather than refused, so a visitor learns why the next step will fail; nothing about the password beyond its existence is disclosed.
651pub async fn get_dataroom_view_by_linkid(configuration: &configuration::Configuration, link_id: &str) -> Result<(), Error<GetDataroomViewByLinkidError>> {
652    // add a prefix to parameters to efficiently prevent name collisions
653    let p_link_id = link_id;
654
655    let uri_str = format!("{}/v1/dataroom/view/{linkId}", configuration.base_path, linkId=crate::apis::urlencode(p_link_id));
656    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
657
658    if let Some(ref user_agent) = configuration.user_agent {
659        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
660    }
661    if let Some(ref token) = configuration.bearer_access_token {
662        req_builder = req_builder.bearer_auth(token.to_owned());
663    };
664
665    let req = req_builder.build()?;
666    let resp = configuration.client.execute(req).await?;
667
668    let status = resp.status();
669
670    if !status.is_client_error() && !status.is_server_error() {
671        Ok(())
672    } else {
673        let content = resp.text().await?;
674        let entity: Option<GetDataroomViewByLinkidError> = serde_json::from_str(&content).ok();
675        Err(Error::ResponseError(ResponseContent { status, content, entity }))
676    }
677}
678
679/// Streams a document's bytes to a visitor holding an open viewing session, under the type read from those bytes: a picture or a PDF renders in place, anything else downloads inert.  No principal: `?viewId=` from the authenticate step is the authorisation and must belong to this link, or the call is 403 — holding the link id alone gets no bytes. The document must be reachable THROUGH this link (a member of the room the link opens, or the single document the link names), so a visitor cannot walk to an unrelated document by guessing an id; anything else is a 404, as is an unknown or archived link. Bytes that cannot be fetched from object storage are 502.  `?download=1` additionally requires the link's `allowDownload` and is 403 when the owner did not permit it. Read that flag precisely: it gates the DOWNLOAD intent, not access to the bytes — without the parameter an authorised visitor is served the file for in-place viewing whether or not downloads are allowed.
680pub async fn get_dataroom_view_by_linkid_document_by_documentid_file(configuration: &configuration::Configuration, link_id: &str, document_id: &str) -> Result<(), Error<GetDataroomViewByLinkidDocumentByDocumentidFileError>> {
681    // add a prefix to parameters to efficiently prevent name collisions
682    let p_link_id = link_id;
683    let p_document_id = document_id;
684
685    let uri_str = format!("{}/v1/dataroom/view/{linkId}/document/{documentId}/file", configuration.base_path, linkId=crate::apis::urlencode(p_link_id), documentId=crate::apis::urlencode(p_document_id));
686    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
687
688    if let Some(ref user_agent) = configuration.user_agent {
689        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
690    }
691    if let Some(ref token) = configuration.bearer_access_token {
692        req_builder = req_builder.bearer_auth(token.to_owned());
693    };
694
695    let req = req_builder.build()?;
696    let resp = configuration.client.execute(req).await?;
697
698    let status = resp.status();
699
700    if !status.is_client_error() && !status.is_server_error() {
701        Ok(())
702    } else {
703        let content = resp.text().await?;
704        let entity: Option<GetDataroomViewByLinkidDocumentByDocumentidFileError> = serde_json::from_str(&content).ok();
705        Err(Error::ResponseError(ResponseContent { status, content, entity }))
706    }
707}
708
709/// Amend changes an item on the caller org's trust centre — replace its file with a newer edition, move it between public and gated, rewrite what it says, or retire it — and answers with the item as it now stands.  Retiring is the withdrawal: the item leaves the public centre immediately and can no longer be granted, while grants already made over it stand, because a release that happened is part of the record and un-happening it in the record would be a lie. Restoring is the same call with retired false.  Moving an item an independent auditor signed to the public tier is refused, and refused by the database rather than only here. Only an admin of the org may call it, and the item is resolved in that org's own store, so another org's id is not found.
710pub async fn patch_dataroom_trust_artifacts_by_id(configuration: &configuration::Configuration, id: &str, trust_edit: models::TrustEdit) -> Result<models::TrustItemView, Error<PatchDataroomTrustArtifactsByIdError>> {
711    // add a prefix to parameters to efficiently prevent name collisions
712    let p_id = id;
713    let p_trust_edit = trust_edit;
714
715    let uri_str = format!("{}/v1/dataroom/trust/artifacts/{id}", configuration.base_path, id=crate::apis::urlencode(p_id));
716    let mut req_builder = configuration.client.request(reqwest::Method::PATCH, &uri_str);
717
718    if let Some(ref user_agent) = configuration.user_agent {
719        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
720    }
721    if let Some(ref token) = configuration.bearer_access_token {
722        req_builder = req_builder.bearer_auth(token.to_owned());
723    };
724    req_builder = req_builder.json(&p_trust_edit);
725
726    let req = req_builder.build()?;
727    let resp = configuration.client.execute(req).await?;
728
729    let status = resp.status();
730    let content_type = resp
731        .headers()
732        .get("content-type")
733        .and_then(|v| v.to_str().ok())
734        .unwrap_or("application/octet-stream");
735    let content_type = super::ContentType::from(content_type);
736
737    if !status.is_client_error() && !status.is_server_error() {
738        let content = resp.text().await?;
739        match content_type {
740            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
741            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::TrustItemView`"))),
742            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::TrustItemView`")))),
743        }
744    } else {
745        let content = resp.text().await?;
746        let entity: Option<PatchDataroomTrustArtifactsByIdError> = serde_json::from_str(&content).ok();
747        Err(Error::ResponseError(ResponseContent { status, content, entity }))
748    }
749}
750
751/// Opens a new data room for the caller org and answers with it, including the short public id it is addressed by.  `name` is required; without it the call is refused and the tenant store is untouched, because a dispatch answering 4xx rolls its transaction back. A new room holds no documents and is reachable by NOBODY until a share link is created over it — opening a room and granting access are two separate acts, so a room cannot leak by existing.
752pub async fn post_dataroom_datarooms(configuration: &configuration::Configuration, dataroom_create: models::DataroomCreate) -> Result<models::DataroomRoomOne, Error<PostDataroomDataroomsError>> {
753    // add a prefix to parameters to efficiently prevent name collisions
754    let p_dataroom_create = dataroom_create;
755
756    let uri_str = format!("{}/v1/dataroom/datarooms", configuration.base_path);
757    let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
758
759    if let Some(ref user_agent) = configuration.user_agent {
760        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
761    }
762    if let Some(ref token) = configuration.bearer_access_token {
763        req_builder = req_builder.bearer_auth(token.to_owned());
764    };
765    req_builder = req_builder.json(&p_dataroom_create);
766
767    let req = req_builder.build()?;
768    let resp = configuration.client.execute(req).await?;
769
770    let status = resp.status();
771    let content_type = resp
772        .headers()
773        .get("content-type")
774        .and_then(|v| v.to_str().ok())
775        .unwrap_or("application/octet-stream");
776    let content_type = super::ContentType::from(content_type);
777
778    if !status.is_client_error() && !status.is_server_error() {
779        let content = resp.text().await?;
780        match content_type {
781            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
782            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::DataroomRoomOne`"))),
783            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::DataroomRoomOne`")))),
784        }
785    } else {
786        let content = resp.text().await?;
787        let entity: Option<PostDataroomDataroomsError> = serde_json::from_str(&content).ok();
788        Err(Error::ResponseError(ResponseContent { status, content, entity }))
789    }
790}
791
792/// Puts an already-uploaded document into one of the caller org's data rooms and answers with the new membership id.  It ATTACHES, it never uploads: the bytes must already be stored, so the usual order is upload the document, then add it to the room. Both the room and the document must exist in the caller's own store — either missing is not found — and a document already in the room is refused as a conflict rather than duplicated.
793pub async fn post_dataroom_datarooms_by_id_documents(configuration: &configuration::Configuration, id: &str, dataroom_add_document: models::DataroomAddDocument) -> Result<models::DataroomMembership, Error<PostDataroomDataroomsByIdDocumentsError>> {
794    // add a prefix to parameters to efficiently prevent name collisions
795    let p_id = id;
796    let p_dataroom_add_document = dataroom_add_document;
797
798    let uri_str = format!("{}/v1/dataroom/datarooms/{id}/documents", configuration.base_path, id=crate::apis::urlencode(p_id));
799    let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
800
801    if let Some(ref user_agent) = configuration.user_agent {
802        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
803    }
804    if let Some(ref token) = configuration.bearer_access_token {
805        req_builder = req_builder.bearer_auth(token.to_owned());
806    };
807    req_builder = req_builder.json(&p_dataroom_add_document);
808
809    let req = req_builder.build()?;
810    let resp = configuration.client.execute(req).await?;
811
812    let status = resp.status();
813    let content_type = resp
814        .headers()
815        .get("content-type")
816        .and_then(|v| v.to_str().ok())
817        .unwrap_or("application/octet-stream");
818    let content_type = super::ContentType::from(content_type);
819
820    if !status.is_client_error() && !status.is_server_error() {
821        let content = resp.text().await?;
822        match content_type {
823            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
824            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::DataroomMembership`"))),
825            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::DataroomMembership`")))),
826        }
827    } else {
828        let content = resp.text().await?;
829        let entity: Option<PostDataroomDataroomsByIdDocumentsError> = serde_json::from_str(&content).ok();
830        Err(Error::ResponseError(ResponseContent { status, content, entity }))
831    }
832}
833
834/// Takes the file ITSELF as the raw request body — not a JSON envelope, not multipart — stores it on the object-storage client, and records the metadata row, answering with the new document. `?name=` names it (default \"document\"), the request's Content-Type is recorded as the document's mime type, and `?numPages=` is optional. That recorded type is metadata the owner sees; what the file is later SERVED as is read from the bytes.  Requires a validated principal; 403 without one. An empty body is 400 and anything over 64 MiB is 413 — a data room holds decks and PDFs, not a media library.  The storage key is 128 random bits under the tenant's own key prefix, minted before the bytes are written: if the system's randomness is unavailable the upload fails 500 rather than fall back to a predictable key that could overwrite another document's bytes. A storage write that fails is 502 and no metadata row is recorded, so a document never exists without its file.
835pub async fn post_dataroom_documents(configuration: &configuration::Configuration, ) -> Result<(), Error<PostDataroomDocumentsError>> {
836
837    let uri_str = format!("{}/v1/dataroom/documents", configuration.base_path);
838    let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
839
840    if let Some(ref user_agent) = configuration.user_agent {
841        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
842    }
843    if let Some(ref token) = configuration.bearer_access_token {
844        req_builder = req_builder.bearer_auth(token.to_owned());
845    };
846
847    let req = req_builder.build()?;
848    let resp = configuration.client.execute(req).await?;
849
850    let status = resp.status();
851
852    if !status.is_client_error() && !status.is_server_error() {
853        Ok(())
854    } else {
855        let content = resp.text().await?;
856        let entity: Option<PostDataroomDocumentsError> = serde_json::from_str(&content).ok();
857        Err(Error::ResponseError(ResponseContent { status, content, entity }))
858    }
859}
860
861/// Grants access: it mints a public share link over one data room (`dataroomId`) or one document (`documentId`) — one of the two is required — and answers with the link, whose `id` is the token a visitor opens it with.  This is how a party is let in. The controls are declared HERE and enforced on the viewer surface: `password` is hashed with bcrypt before storage and is never readable back, `emailProtected` (on by default) makes a visitor state an address, `allowList`/`denyList` narrow which addresses pass, `allowDownload` (off by default) governs downloads, and `expiresAt` closes the link. The target room or document must exist in the caller's own store or it is not found.  Creating a link also writes dataroom's ONE cross-tenant row: the link id to owning org mapping an anonymous visitor is routed through. That write is part of the operation — if it fails the call is 500 — so a link that no visitor could open is never handed back as usable.  The address a visitor later states is recorded UNVERIFIED, so a link gated only by email is openable by anyone the link reaches. Use a password for a link that must not travel.
862pub async fn post_dataroom_links(configuration: &configuration::Configuration, dataroom_link_create: models::DataroomLinkCreate) -> Result<models::DataroomLinkOne, Error<PostDataroomLinksError>> {
863    // add a prefix to parameters to efficiently prevent name collisions
864    let p_dataroom_link_create = dataroom_link_create;
865
866    let uri_str = format!("{}/v1/dataroom/links", configuration.base_path);
867    let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
868
869    if let Some(ref user_agent) = configuration.user_agent {
870        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
871    }
872    if let Some(ref token) = configuration.bearer_access_token {
873        req_builder = req_builder.bearer_auth(token.to_owned());
874    };
875    req_builder = req_builder.json(&p_dataroom_link_create);
876
877    let req = req_builder.build()?;
878    let resp = configuration.client.execute(req).await?;
879
880    let status = resp.status();
881    let content_type = resp
882        .headers()
883        .get("content-type")
884        .and_then(|v| v.to_str().ok())
885        .unwrap_or("application/octet-stream");
886    let content_type = super::ContentType::from(content_type);
887
888    if !status.is_client_error() && !status.is_server_error() {
889        let content = resp.text().await?;
890        match content_type {
891            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
892            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::DataroomLinkOne`"))),
893            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::DataroomLinkOne`")))),
894        }
895    } else {
896        let content = resp.text().await?;
897        let entity: Option<PostDataroomLinksError> = serde_json::from_str(&content).ok();
898        Err(Error::ResponseError(ResponseContent { status, content, entity }))
899    }
900}
901
902/// Publish puts an item on the caller org's trust centre and answers with it.  The item is GATED unless it says otherwise, so a kind nobody has thought of yet arrives private and someone has to release it deliberately — that default is what keeps an auditor's report from becoming readable because a field went unset. An item whose attester is \"auditor\" cannot be public at all: the database refuses the pair, so no path through this API can publish one.  A file is optional and is uploaded FIRST, through POST /v1/dataroom/documents, then named here — the data room is the one place bytes enter, so a trust centre document is an ordinary data-room document and inherits its storage, its grants and its page-by-page access record. A gated item that has a file is added to the org's release room, which is what lets a party be granted the whole gated tier in one link.  Only an admin of the org may call it.
903pub async fn post_dataroom_trust_artifacts(configuration: &configuration::Configuration, trust_publish: models::TrustPublish) -> Result<models::TrustItemView, Error<PostDataroomTrustArtifactsError>> {
904    // add a prefix to parameters to efficiently prevent name collisions
905    let p_trust_publish = trust_publish;
906
907    let uri_str = format!("{}/v1/dataroom/trust/artifacts", configuration.base_path);
908    let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
909
910    if let Some(ref user_agent) = configuration.user_agent {
911        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
912    }
913    if let Some(ref token) = configuration.bearer_access_token {
914        req_builder = req_builder.bearer_auth(token.to_owned());
915    };
916    req_builder = req_builder.json(&p_trust_publish);
917
918    let req = req_builder.build()?;
919    let resp = configuration.client.execute(req).await?;
920
921    let status = resp.status();
922    let content_type = resp
923        .headers()
924        .get("content-type")
925        .and_then(|v| v.to_str().ok())
926        .unwrap_or("application/octet-stream");
927    let content_type = super::ContentType::from(content_type);
928
929    if !status.is_client_error() && !status.is_server_error() {
930        let content = resp.text().await?;
931        match content_type {
932            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
933            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::TrustItemView`"))),
934            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::TrustItemView`")))),
935        }
936    } else {
937        let content = resp.text().await?;
938        let entity: Option<PostDataroomTrustArtifactsError> = serde_json::from_str(&content).ok();
939        Err(Error::ResponseError(ResponseContent { status, content, entity }))
940    }
941}
942
943/// Records a request to read what an independent auditor signed, and answers with its id.  The org that owns the centre decides. Nothing is released here and no link is minted: this writes the ask down, which is the whole promise the form makes. The write is the answer — a request that could not be stored is an error, never a receipt, so a form can never appear to have been sent and be gone.  `email` is required and is the ONLY address the eventual grant will admit, so an address the asker cannot read is an ask that cannot be answered. Where the centre states an NDA, `accept` must be true and the text in force is recorded verbatim against the request.  Asking twice for the same thing from the same address is the SAME ask: the second answers with the first's id rather than opening a second row, which is also what keeps an anonymous endpoint from filling a tenant's store.
944pub async fn post_dataroom_trust_center_by_slug_requests(configuration: &configuration::Configuration, slug: &str, trust_ask: models::TrustAsk) -> Result<models::TrustAsked, Error<PostDataroomTrustCenterBySlugRequestsError>> {
945    // add a prefix to parameters to efficiently prevent name collisions
946    let p_slug = slug;
947    let p_trust_ask = trust_ask;
948
949    let uri_str = format!("{}/v1/dataroom/trust/center/{slug}/requests", configuration.base_path, slug=crate::apis::urlencode(p_slug));
950    let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
951
952    if let Some(ref user_agent) = configuration.user_agent {
953        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
954    }
955    if let Some(ref token) = configuration.bearer_access_token {
956        req_builder = req_builder.bearer_auth(token.to_owned());
957    };
958    req_builder = req_builder.json(&p_trust_ask);
959
960    let req = req_builder.build()?;
961    let resp = configuration.client.execute(req).await?;
962
963    let status = resp.status();
964    let content_type = resp
965        .headers()
966        .get("content-type")
967        .and_then(|v| v.to_str().ok())
968        .unwrap_or("application/octet-stream");
969    let content_type = super::ContentType::from(content_type);
970
971    if !status.is_client_error() && !status.is_server_error() {
972        let content = resp.text().await?;
973        match content_type {
974            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
975            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::TrustAsked`"))),
976            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::TrustAsked`")))),
977        }
978    } else {
979        let content = resp.text().await?;
980        let entity: Option<PostDataroomTrustCenterBySlugRequestsError> = serde_json::from_str(&content).ok();
981        Err(Error::ResponseError(ResponseContent { status, content, entity }))
982    }
983}
984
985/// Grant answers a request by opening access: it mints a share link over what was asked for, addressed to the address that asked and closing at expiry, records the decision, and mails the asker.  The link is NEVER a public URL. It carries the asker's address on its allow list, so forwarding it to somebody else does not open it, and it expires. What the party then does with it — which document, which page, for how long — is recorded by the data room's own view tracking, which is where the access record for this release lives; there is no second log.  A request that was already answered is refused rather than answered twice, so a second click cannot mint a second link. Only an admin of the org may call it, and the request is resolved in that org's own store, so another org's request id is not found — which is also what stops one org deciding another's queue.  Mail is best effort and the grant does not depend on it: a deployment that sends no mail still records the grant and says so in `delivery`, so the approver knows to pass the address on themselves.
986pub async fn post_dataroom_trust_requests_by_id_grant(configuration: &configuration::Configuration, id: &str, trust_decision: models::TrustDecision) -> Result<models::TrustGranted, Error<PostDataroomTrustRequestsByIdGrantError>> {
987    // add a prefix to parameters to efficiently prevent name collisions
988    let p_id = id;
989    let p_trust_decision = trust_decision;
990
991    let uri_str = format!("{}/v1/dataroom/trust/requests/{id}/grant", configuration.base_path, id=crate::apis::urlencode(p_id));
992    let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
993
994    if let Some(ref user_agent) = configuration.user_agent {
995        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
996    }
997    if let Some(ref token) = configuration.bearer_access_token {
998        req_builder = req_builder.bearer_auth(token.to_owned());
999    };
1000    req_builder = req_builder.json(&p_trust_decision);
1001
1002    let req = req_builder.build()?;
1003    let resp = configuration.client.execute(req).await?;
1004
1005    let status = resp.status();
1006    let content_type = resp
1007        .headers()
1008        .get("content-type")
1009        .and_then(|v| v.to_str().ok())
1010        .unwrap_or("application/octet-stream");
1011    let content_type = super::ContentType::from(content_type);
1012
1013    if !status.is_client_error() && !status.is_server_error() {
1014        let content = resp.text().await?;
1015        match content_type {
1016            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1017            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::TrustGranted`"))),
1018            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::TrustGranted`")))),
1019        }
1020    } else {
1021        let content = resp.text().await?;
1022        let entity: Option<PostDataroomTrustRequestsByIdGrantError> = serde_json::from_str(&content).ok();
1023        Err(Error::ResponseError(ResponseContent { status, content, entity }))
1024    }
1025}
1026
1027/// Refuse answers a request by declining it, recording who declined and why.  Nothing is released and no link is minted. The refusal STAYS on the record beside the ask — a request that was turned down is part of the access record exactly as one that was granted is, and deleting it would leave a queue that only ever shows the decisions somebody liked.  A request that was already answered is refused rather than answered twice. Only an admin of the org may call it, and the request is resolved in that org's own store, so another org's request id is not found.
1028pub async fn post_dataroom_trust_requests_by_id_refuse(configuration: &configuration::Configuration, id: &str, trust_decision: models::TrustDecision) -> Result<models::TrustRefused, Error<PostDataroomTrustRequestsByIdRefuseError>> {
1029    // add a prefix to parameters to efficiently prevent name collisions
1030    let p_id = id;
1031    let p_trust_decision = trust_decision;
1032
1033    let uri_str = format!("{}/v1/dataroom/trust/requests/{id}/refuse", configuration.base_path, id=crate::apis::urlencode(p_id));
1034    let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
1035
1036    if let Some(ref user_agent) = configuration.user_agent {
1037        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1038    }
1039    if let Some(ref token) = configuration.bearer_access_token {
1040        req_builder = req_builder.bearer_auth(token.to_owned());
1041    };
1042    req_builder = req_builder.json(&p_trust_decision);
1043
1044    let req = req_builder.build()?;
1045    let resp = configuration.client.execute(req).await?;
1046
1047    let status = resp.status();
1048    let content_type = resp
1049        .headers()
1050        .get("content-type")
1051        .and_then(|v| v.to_str().ok())
1052        .unwrap_or("application/octet-stream");
1053    let content_type = super::ContentType::from(content_type);
1054
1055    if !status.is_client_error() && !status.is_server_error() {
1056        let content = resp.text().await?;
1057        match content_type {
1058            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1059            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::TrustRefused`"))),
1060            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::TrustRefused`")))),
1061        }
1062    } else {
1063        let content = resp.text().await?;
1064        let entity: Option<PostDataroomTrustRequestsByIdRefuseError> = serde_json::from_str(&content).ok();
1065        Err(Error::ResponseError(ResponseContent { status, content, entity }))
1066    }
1067}
1068
1069/// Clears the link's access controls and answers with the viewing session — a `viewId`, whether download is permitted, and the documents behind the link — which every later viewer call is authorised by.  No principal: the visitor is whoever holds the link id, and the org is resolved from it. The gates run in a fixed order and each is a flat refusal, never a hint. An archived or unknown link is 404 and an expired one 403. A missing address on an email-protected link is 401. An address on the deny list is 403, checked BEFORE the allow list so deny always wins. An address the allow list does not admit is 403 — an EMPTY allow list admits everyone, so a link with no list enforces the email gate alone. A wrong or absent password is 401, decided against the stored bcrypt hash.  The address is taken as stated and recorded UNVERIFIED: it names a viewer for analytics and repeat visits from it reuse one viewer record, but it proves nothing about who is on the other end. A link gated only by email is openable by anyone the link reaches.
1070pub async fn post_dataroom_view_by_linkid_authenticate(configuration: &configuration::Configuration, link_id: &str) -> Result<(), Error<PostDataroomViewByLinkidAuthenticateError>> {
1071    // add a prefix to parameters to efficiently prevent name collisions
1072    let p_link_id = link_id;
1073
1074    let uri_str = format!("{}/v1/dataroom/view/{linkId}/authenticate", configuration.base_path, linkId=crate::apis::urlencode(p_link_id));
1075    let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
1076
1077    if let Some(ref user_agent) = configuration.user_agent {
1078        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1079    }
1080    if let Some(ref token) = configuration.bearer_access_token {
1081        req_builder = req_builder.bearer_auth(token.to_owned());
1082    };
1083
1084    let req = req_builder.build()?;
1085    let resp = configuration.client.execute(req).await?;
1086
1087    let status = resp.status();
1088
1089    if !status.is_client_error() && !status.is_server_error() {
1090        Ok(())
1091    } else {
1092        let content = resp.text().await?;
1093        let entity: Option<PostDataroomViewByLinkidAuthenticateError> = serde_json::from_str(&content).ok();
1094        Err(Error::ResponseError(ResponseContent { status, content, entity }))
1095    }
1096}
1097
1098/// Appends a single per-page analytics event — {viewId, pageNumber, documentId, versionNumber, duration} — and answers with its id. These events are what the owner's analytics count.  No principal: the `viewId` from the authenticate step IS the authorisation, and it must belong to THIS link or the call is 404, so a session opened on one link cannot write events onto another. `pageNumber` is required (400 without it); `documentId` falls back to the document the session was opened on, and `duration` is the caller's own dwell measure, summed per page by analytics.  Events are additive: the same page reported twice is two views, which is the metric's whole point.
1099pub async fn post_dataroom_view_by_linkid_pageview(configuration: &configuration::Configuration, link_id: &str) -> Result<(), Error<PostDataroomViewByLinkidPageviewError>> {
1100    // add a prefix to parameters to efficiently prevent name collisions
1101    let p_link_id = link_id;
1102
1103    let uri_str = format!("{}/v1/dataroom/view/{linkId}/pageview", configuration.base_path, linkId=crate::apis::urlencode(p_link_id));
1104    let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
1105
1106    if let Some(ref user_agent) = configuration.user_agent {
1107        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1108    }
1109    if let Some(ref token) = configuration.bearer_access_token {
1110        req_builder = req_builder.bearer_auth(token.to_owned());
1111    };
1112
1113    let req = req_builder.build()?;
1114    let resp = configuration.client.execute(req).await?;
1115
1116    let status = resp.status();
1117
1118    if !status.is_client_error() && !status.is_server_error() {
1119        Ok(())
1120    } else {
1121        let content = resp.text().await?;
1122        let entity: Option<PostDataroomViewByLinkidPageviewError> = serde_json::from_str(&content).ok();
1123        Err(Error::ResponseError(ResponseContent { status, content, entity }))
1124    }
1125}
1126
1127/// SetCenter opens, publishes or withdraws the caller org's trust centre and answers with the centre as it now stands.  Publishing requires a name and an address, and the address must be free: another org already answering there is a conflict, never a takeover. Withdrawing closes the public endpoint only — items, grants and the access record are untouched, so an org can go quiet and come back without losing anything.  Only an admin of the org may call it. The org is the caller's own, so there is no field naming one and no way to point this at another tenant.
1128pub async fn put_dataroom_trust(configuration: &configuration::Configuration, trust_settings: models::TrustSettings) -> Result<models::TrustDesk, Error<PutDataroomTrustError>> {
1129    // add a prefix to parameters to efficiently prevent name collisions
1130    let p_trust_settings = trust_settings;
1131
1132    let uri_str = format!("{}/v1/dataroom/trust", configuration.base_path);
1133    let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str);
1134
1135    if let Some(ref user_agent) = configuration.user_agent {
1136        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1137    }
1138    if let Some(ref token) = configuration.bearer_access_token {
1139        req_builder = req_builder.bearer_auth(token.to_owned());
1140    };
1141    req_builder = req_builder.json(&p_trust_settings);
1142
1143    let req = req_builder.build()?;
1144    let resp = configuration.client.execute(req).await?;
1145
1146    let status = resp.status();
1147    let content_type = resp
1148        .headers()
1149        .get("content-type")
1150        .and_then(|v| v.to_str().ok())
1151        .unwrap_or("application/octet-stream");
1152    let content_type = super::ContentType::from(content_type);
1153
1154    if !status.is_client_error() && !status.is_server_error() {
1155        let content = resp.text().await?;
1156        match content_type {
1157            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1158            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::TrustDesk`"))),
1159            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::TrustDesk`")))),
1160        }
1161    } else {
1162        let content = resp.text().await?;
1163        let entity: Option<PutDataroomTrustError> = serde_json::from_str(&content).ok();
1164        Err(Error::ResponseError(ResponseContent { status, content, entity }))
1165    }
1166}
1167