1use reqwest;
13use serde::{Deserialize, Serialize, de::Error as _};
14use crate::{apis::ResponseContent, models};
15use super::{Error, configuration, ContentType};
16
17
18#[derive(Debug, Clone, Serialize, Deserialize)]
20#[serde(untagged)]
21pub enum GetEsignDocumentsError {
22 UnknownValue(serde_json::Value),
23}
24
25#[derive(Debug, Clone, Serialize, Deserialize)]
27#[serde(untagged)]
28pub enum GetEsignDocumentsByIdError {
29 UnknownValue(serde_json::Value),
30}
31
32#[derive(Debug, Clone, Serialize, Deserialize)]
34#[serde(untagged)]
35pub enum GetEsignDocumentsByIdAuditError {
36 UnknownValue(serde_json::Value),
37}
38
39#[derive(Debug, Clone, Serialize, Deserialize)]
41#[serde(untagged)]
42pub enum GetEsignDocumentsByIdDownloadError {
43 UnknownValue(serde_json::Value),
44}
45
46#[derive(Debug, Clone, Serialize, Deserialize)]
48#[serde(untagged)]
49pub enum GetEsignHealthError {
50 UnknownValue(serde_json::Value),
51}
52
53#[derive(Debug, Clone, Serialize, Deserialize)]
55#[serde(untagged)]
56pub enum GetEsignObyOrgSignByTokenError {
57 UnknownValue(serde_json::Value),
58}
59
60#[derive(Debug, Clone, Serialize, Deserialize)]
62#[serde(untagged)]
63pub enum PostEsignDocumentsError {
64 UnknownValue(serde_json::Value),
65}
66
67#[derive(Debug, Clone, Serialize, Deserialize)]
69#[serde(untagged)]
70pub enum PostEsignDocumentsByIdFieldsError {
71 UnknownValue(serde_json::Value),
72}
73
74#[derive(Debug, Clone, Serialize, Deserialize)]
76#[serde(untagged)]
77pub enum PostEsignDocumentsByIdRecipientsError {
78 UnknownValue(serde_json::Value),
79}
80
81#[derive(Debug, Clone, Serialize, Deserialize)]
83#[serde(untagged)]
84pub enum PostEsignDocumentsByIdSendError {
85 UnknownValue(serde_json::Value),
86}
87
88#[derive(Debug, Clone, Serialize, Deserialize)]
90#[serde(untagged)]
91pub enum PostEsignObyOrgSignByTokenCompleteError {
92 UnknownValue(serde_json::Value),
93}
94
95#[derive(Debug, Clone, Serialize, Deserialize)]
97#[serde(untagged)]
98pub enum PostEsignObyOrgSignByTokenFieldsByFieldidError {
99 UnknownValue(serde_json::Value),
100}
101
102#[derive(Debug, Clone, Serialize, Deserialize)]
104#[serde(untagged)]
105pub enum PostEsignObyOrgSignByTokenRejectError {
106 UnknownValue(serde_json::Value),
107}
108
109
110pub async fn get_esign_documents(configuration: &configuration::Configuration, ) -> Result<models::EsignDocuments, Error<GetEsignDocumentsError>> {
112
113 let uri_str = format!("{}/v1/esign/documents", configuration.base_path);
114 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
115
116 if let Some(ref user_agent) = configuration.user_agent {
117 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
118 }
119 if let Some(ref token) = configuration.bearer_access_token {
120 req_builder = req_builder.bearer_auth(token.to_owned());
121 };
122
123 let req = req_builder.build()?;
124 let resp = configuration.client.execute(req).await?;
125
126 let status = resp.status();
127 let content_type = resp
128 .headers()
129 .get("content-type")
130 .and_then(|v| v.to_str().ok())
131 .unwrap_or("application/octet-stream");
132 let content_type = super::ContentType::from(content_type);
133
134 if !status.is_client_error() && !status.is_server_error() {
135 let content = resp.text().await?;
136 match content_type {
137 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
138 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::EsignDocuments`"))),
139 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::EsignDocuments`")))),
140 }
141 } else {
142 let content = resp.text().await?;
143 let entity: Option<GetEsignDocumentsError> = serde_json::from_str(&content).ok();
144 Err(Error::ResponseError(ResponseContent { status, content, entity }))
145 }
146}
147
148pub async fn get_esign_documents_by_id(configuration: &configuration::Configuration, id: &str) -> Result<models::EsignDocument, Error<GetEsignDocumentsByIdError>> {
150 let p_id = id;
152
153 let uri_str = format!("{}/v1/esign/documents/{id}", configuration.base_path, id=crate::apis::urlencode(p_id));
154 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
155
156 if let Some(ref user_agent) = configuration.user_agent {
157 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
158 }
159 if let Some(ref token) = configuration.bearer_access_token {
160 req_builder = req_builder.bearer_auth(token.to_owned());
161 };
162
163 let req = req_builder.build()?;
164 let resp = configuration.client.execute(req).await?;
165
166 let status = resp.status();
167 let content_type = resp
168 .headers()
169 .get("content-type")
170 .and_then(|v| v.to_str().ok())
171 .unwrap_or("application/octet-stream");
172 let content_type = super::ContentType::from(content_type);
173
174 if !status.is_client_error() && !status.is_server_error() {
175 let content = resp.text().await?;
176 match content_type {
177 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
178 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::EsignDocument`"))),
179 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::EsignDocument`")))),
180 }
181 } else {
182 let content = resp.text().await?;
183 let entity: Option<GetEsignDocumentsByIdError> = serde_json::from_str(&content).ok();
184 Err(Error::ResponseError(ResponseContent { status, content, entity }))
185 }
186}
187
188pub async fn get_esign_documents_by_id_audit(configuration: &configuration::Configuration, id: &str) -> Result<models::EsignTrail, Error<GetEsignDocumentsByIdAuditError>> {
190 let p_id = id;
192
193 let uri_str = format!("{}/v1/esign/documents/{id}/audit", configuration.base_path, id=crate::apis::urlencode(p_id));
194 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
195
196 if let Some(ref user_agent) = configuration.user_agent {
197 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
198 }
199 if let Some(ref token) = configuration.bearer_access_token {
200 req_builder = req_builder.bearer_auth(token.to_owned());
201 };
202
203 let req = req_builder.build()?;
204 let resp = configuration.client.execute(req).await?;
205
206 let status = resp.status();
207 let content_type = resp
208 .headers()
209 .get("content-type")
210 .and_then(|v| v.to_str().ok())
211 .unwrap_or("application/octet-stream");
212 let content_type = super::ContentType::from(content_type);
213
214 if !status.is_client_error() && !status.is_server_error() {
215 let content = resp.text().await?;
216 match content_type {
217 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
218 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::EsignTrail`"))),
219 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::EsignTrail`")))),
220 }
221 } else {
222 let content = resp.text().await?;
223 let entity: Option<GetEsignDocumentsByIdAuditError> = serde_json::from_str(&content).ok();
224 Err(Error::ResponseError(ResponseContent { status, content, entity }))
225 }
226}
227
228pub async fn get_esign_documents_by_id_download(configuration: &configuration::Configuration, id: &str) -> Result<models::EsignPdf, Error<GetEsignDocumentsByIdDownloadError>> {
230 let p_id = id;
232
233 let uri_str = format!("{}/v1/esign/documents/{id}/download", configuration.base_path, id=crate::apis::urlencode(p_id));
234 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
235
236 if let Some(ref user_agent) = configuration.user_agent {
237 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
238 }
239 if let Some(ref token) = configuration.bearer_access_token {
240 req_builder = req_builder.bearer_auth(token.to_owned());
241 };
242
243 let req = req_builder.build()?;
244 let resp = configuration.client.execute(req).await?;
245
246 let status = resp.status();
247 let content_type = resp
248 .headers()
249 .get("content-type")
250 .and_then(|v| v.to_str().ok())
251 .unwrap_or("application/octet-stream");
252 let content_type = super::ContentType::from(content_type);
253
254 if !status.is_client_error() && !status.is_server_error() {
255 let content = resp.text().await?;
256 match content_type {
257 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
258 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::EsignPdf`"))),
259 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::EsignPdf`")))),
260 }
261 } else {
262 let content = resp.text().await?;
263 let entity: Option<GetEsignDocumentsByIdDownloadError> = serde_json::from_str(&content).ok();
264 Err(Error::ResponseError(ResponseContent { status, content, entity }))
265 }
266}
267
268pub async fn get_esign_health(configuration: &configuration::Configuration, ) -> Result<models::EsignHealth, Error<GetEsignHealthError>> {
270
271 let uri_str = format!("{}/v1/esign/health", configuration.base_path);
272 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
273
274 if let Some(ref user_agent) = configuration.user_agent {
275 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
276 }
277 if let Some(ref token) = configuration.bearer_access_token {
278 req_builder = req_builder.bearer_auth(token.to_owned());
279 };
280
281 let req = req_builder.build()?;
282 let resp = configuration.client.execute(req).await?;
283
284 let status = resp.status();
285 let content_type = resp
286 .headers()
287 .get("content-type")
288 .and_then(|v| v.to_str().ok())
289 .unwrap_or("application/octet-stream");
290 let content_type = super::ContentType::from(content_type);
291
292 if !status.is_client_error() && !status.is_server_error() {
293 let content = resp.text().await?;
294 match content_type {
295 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
296 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::EsignHealth`"))),
297 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::EsignHealth`")))),
298 }
299 } else {
300 let content = resp.text().await?;
301 let entity: Option<GetEsignHealthError> = serde_json::from_str(&content).ok();
302 Err(Error::ResponseError(ResponseContent { status, content, entity }))
303 }
304}
305
306pub async fn get_esign_oby_org_sign_by_token(configuration: &configuration::Configuration, org: &str, token: &str) -> Result<models::EsignSession, Error<GetEsignObyOrgSignByTokenError>> {
308 let p_org = org;
310 let p_token = token;
311
312 let uri_str = format!("{}/v1/esign/o/{org}/sign/{token}", configuration.base_path, org=crate::apis::urlencode(p_org), token=crate::apis::urlencode(p_token));
313 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
314
315 if let Some(ref user_agent) = configuration.user_agent {
316 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
317 }
318 if let Some(ref token) = configuration.bearer_access_token {
319 req_builder = req_builder.bearer_auth(token.to_owned());
320 };
321
322 let req = req_builder.build()?;
323 let resp = configuration.client.execute(req).await?;
324
325 let status = resp.status();
326 let content_type = resp
327 .headers()
328 .get("content-type")
329 .and_then(|v| v.to_str().ok())
330 .unwrap_or("application/octet-stream");
331 let content_type = super::ContentType::from(content_type);
332
333 if !status.is_client_error() && !status.is_server_error() {
334 let content = resp.text().await?;
335 match content_type {
336 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
337 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::EsignSession`"))),
338 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::EsignSession`")))),
339 }
340 } else {
341 let content = resp.text().await?;
342 let entity: Option<GetEsignObyOrgSignByTokenError> = serde_json::from_str(&content).ok();
343 Err(Error::ResponseError(ResponseContent { status, content, entity }))
344 }
345}
346
347pub async fn post_esign_documents(configuration: &configuration::Configuration, esign_upload_in: models::EsignUploadIn) -> Result<models::EsignDocument, Error<PostEsignDocumentsError>> {
349 let p_esign_upload_in = esign_upload_in;
351
352 let uri_str = format!("{}/v1/esign/documents", configuration.base_path);
353 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
354
355 if let Some(ref user_agent) = configuration.user_agent {
356 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
357 }
358 if let Some(ref token) = configuration.bearer_access_token {
359 req_builder = req_builder.bearer_auth(token.to_owned());
360 };
361 req_builder = req_builder.json(&p_esign_upload_in);
362
363 let req = req_builder.build()?;
364 let resp = configuration.client.execute(req).await?;
365
366 let status = resp.status();
367 let content_type = resp
368 .headers()
369 .get("content-type")
370 .and_then(|v| v.to_str().ok())
371 .unwrap_or("application/octet-stream");
372 let content_type = super::ContentType::from(content_type);
373
374 if !status.is_client_error() && !status.is_server_error() {
375 let content = resp.text().await?;
376 match content_type {
377 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
378 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::EsignDocument`"))),
379 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::EsignDocument`")))),
380 }
381 } else {
382 let content = resp.text().await?;
383 let entity: Option<PostEsignDocumentsError> = serde_json::from_str(&content).ok();
384 Err(Error::ResponseError(ResponseContent { status, content, entity }))
385 }
386}
387
388pub async fn post_esign_documents_by_id_fields(configuration: &configuration::Configuration, id: &str, esign_field_in: models::EsignFieldIn) -> Result<models::EsignPlacement, Error<PostEsignDocumentsByIdFieldsError>> {
390 let p_id = id;
392 let p_esign_field_in = esign_field_in;
393
394 let uri_str = format!("{}/v1/esign/documents/{id}/fields", configuration.base_path, id=crate::apis::urlencode(p_id));
395 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
396
397 if let Some(ref user_agent) = configuration.user_agent {
398 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
399 }
400 if let Some(ref token) = configuration.bearer_access_token {
401 req_builder = req_builder.bearer_auth(token.to_owned());
402 };
403 req_builder = req_builder.json(&p_esign_field_in);
404
405 let req = req_builder.build()?;
406 let resp = configuration.client.execute(req).await?;
407
408 let status = resp.status();
409 let content_type = resp
410 .headers()
411 .get("content-type")
412 .and_then(|v| v.to_str().ok())
413 .unwrap_or("application/octet-stream");
414 let content_type = super::ContentType::from(content_type);
415
416 if !status.is_client_error() && !status.is_server_error() {
417 let content = resp.text().await?;
418 match content_type {
419 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
420 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::EsignPlacement`"))),
421 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::EsignPlacement`")))),
422 }
423 } else {
424 let content = resp.text().await?;
425 let entity: Option<PostEsignDocumentsByIdFieldsError> = serde_json::from_str(&content).ok();
426 Err(Error::ResponseError(ResponseContent { status, content, entity }))
427 }
428}
429
430pub async fn post_esign_documents_by_id_recipients(configuration: &configuration::Configuration, id: &str, esign_recipient_in: models::EsignRecipientIn) -> Result<models::EsignInvite, Error<PostEsignDocumentsByIdRecipientsError>> {
432 let p_id = id;
434 let p_esign_recipient_in = esign_recipient_in;
435
436 let uri_str = format!("{}/v1/esign/documents/{id}/recipients", configuration.base_path, id=crate::apis::urlencode(p_id));
437 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
438
439 if let Some(ref user_agent) = configuration.user_agent {
440 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
441 }
442 if let Some(ref token) = configuration.bearer_access_token {
443 req_builder = req_builder.bearer_auth(token.to_owned());
444 };
445 req_builder = req_builder.json(&p_esign_recipient_in);
446
447 let req = req_builder.build()?;
448 let resp = configuration.client.execute(req).await?;
449
450 let status = resp.status();
451 let content_type = resp
452 .headers()
453 .get("content-type")
454 .and_then(|v| v.to_str().ok())
455 .unwrap_or("application/octet-stream");
456 let content_type = super::ContentType::from(content_type);
457
458 if !status.is_client_error() && !status.is_server_error() {
459 let content = resp.text().await?;
460 match content_type {
461 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
462 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::EsignInvite`"))),
463 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::EsignInvite`")))),
464 }
465 } else {
466 let content = resp.text().await?;
467 let entity: Option<PostEsignDocumentsByIdRecipientsError> = serde_json::from_str(&content).ok();
468 Err(Error::ResponseError(ResponseContent { status, content, entity }))
469 }
470}
471
472pub async fn post_esign_documents_by_id_send(configuration: &configuration::Configuration, id: &str) -> Result<models::EsignLinks, Error<PostEsignDocumentsByIdSendError>> {
474 let p_id = id;
476
477 let uri_str = format!("{}/v1/esign/documents/{id}/send", configuration.base_path, id=crate::apis::urlencode(p_id));
478 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
479
480 if let Some(ref user_agent) = configuration.user_agent {
481 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
482 }
483 if let Some(ref token) = configuration.bearer_access_token {
484 req_builder = req_builder.bearer_auth(token.to_owned());
485 };
486
487 let req = req_builder.build()?;
488 let resp = configuration.client.execute(req).await?;
489
490 let status = resp.status();
491 let content_type = resp
492 .headers()
493 .get("content-type")
494 .and_then(|v| v.to_str().ok())
495 .unwrap_or("application/octet-stream");
496 let content_type = super::ContentType::from(content_type);
497
498 if !status.is_client_error() && !status.is_server_error() {
499 let content = resp.text().await?;
500 match content_type {
501 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
502 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::EsignLinks`"))),
503 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::EsignLinks`")))),
504 }
505 } else {
506 let content = resp.text().await?;
507 let entity: Option<PostEsignDocumentsByIdSendError> = serde_json::from_str(&content).ok();
508 Err(Error::ResponseError(ResponseContent { status, content, entity }))
509 }
510}
511
512pub async fn post_esign_oby_org_sign_by_token_complete(configuration: &configuration::Configuration, org: &str, token: &str) -> Result<models::EsignCompletion, Error<PostEsignObyOrgSignByTokenCompleteError>> {
514 let p_org = org;
516 let p_token = token;
517
518 let uri_str = format!("{}/v1/esign/o/{org}/sign/{token}/complete", configuration.base_path, org=crate::apis::urlencode(p_org), token=crate::apis::urlencode(p_token));
519 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
520
521 if let Some(ref user_agent) = configuration.user_agent {
522 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
523 }
524 if let Some(ref token) = configuration.bearer_access_token {
525 req_builder = req_builder.bearer_auth(token.to_owned());
526 };
527
528 let req = req_builder.build()?;
529 let resp = configuration.client.execute(req).await?;
530
531 let status = resp.status();
532 let content_type = resp
533 .headers()
534 .get("content-type")
535 .and_then(|v| v.to_str().ok())
536 .unwrap_or("application/octet-stream");
537 let content_type = super::ContentType::from(content_type);
538
539 if !status.is_client_error() && !status.is_server_error() {
540 let content = resp.text().await?;
541 match content_type {
542 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
543 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::EsignCompletion`"))),
544 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::EsignCompletion`")))),
545 }
546 } else {
547 let content = resp.text().await?;
548 let entity: Option<PostEsignObyOrgSignByTokenCompleteError> = serde_json::from_str(&content).ok();
549 Err(Error::ResponseError(ResponseContent { status, content, entity }))
550 }
551}
552
553pub async fn post_esign_oby_org_sign_by_token_fields_by_fieldid(configuration: &configuration::Configuration, org: &str, token: &str, field_id: &str, esign_value_in: models::EsignValueIn) -> Result<models::EsignInsertion, Error<PostEsignObyOrgSignByTokenFieldsByFieldidError>> {
555 let p_org = org;
557 let p_token = token;
558 let p_field_id = field_id;
559 let p_esign_value_in = esign_value_in;
560
561 let uri_str = format!("{}/v1/esign/o/{org}/sign/{token}/fields/{fieldId}", configuration.base_path, org=crate::apis::urlencode(p_org), token=crate::apis::urlencode(p_token), fieldId=crate::apis::urlencode(p_field_id));
562 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
563
564 if let Some(ref user_agent) = configuration.user_agent {
565 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
566 }
567 if let Some(ref token) = configuration.bearer_access_token {
568 req_builder = req_builder.bearer_auth(token.to_owned());
569 };
570 req_builder = req_builder.json(&p_esign_value_in);
571
572 let req = req_builder.build()?;
573 let resp = configuration.client.execute(req).await?;
574
575 let status = resp.status();
576 let content_type = resp
577 .headers()
578 .get("content-type")
579 .and_then(|v| v.to_str().ok())
580 .unwrap_or("application/octet-stream");
581 let content_type = super::ContentType::from(content_type);
582
583 if !status.is_client_error() && !status.is_server_error() {
584 let content = resp.text().await?;
585 match content_type {
586 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
587 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::EsignInsertion`"))),
588 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::EsignInsertion`")))),
589 }
590 } else {
591 let content = resp.text().await?;
592 let entity: Option<PostEsignObyOrgSignByTokenFieldsByFieldidError> = serde_json::from_str(&content).ok();
593 Err(Error::ResponseError(ResponseContent { status, content, entity }))
594 }
595}
596
597pub async fn post_esign_oby_org_sign_by_token_reject(configuration: &configuration::Configuration, org: &str, token: &str, esign_reject_in: models::EsignRejectIn) -> Result<models::EsignRejection, Error<PostEsignObyOrgSignByTokenRejectError>> {
599 let p_org = org;
601 let p_token = token;
602 let p_esign_reject_in = esign_reject_in;
603
604 let uri_str = format!("{}/v1/esign/o/{org}/sign/{token}/reject", configuration.base_path, org=crate::apis::urlencode(p_org), token=crate::apis::urlencode(p_token));
605 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
606
607 if let Some(ref user_agent) = configuration.user_agent {
608 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
609 }
610 if let Some(ref token) = configuration.bearer_access_token {
611 req_builder = req_builder.bearer_auth(token.to_owned());
612 };
613 req_builder = req_builder.json(&p_esign_reject_in);
614
615 let req = req_builder.build()?;
616 let resp = configuration.client.execute(req).await?;
617
618 let status = resp.status();
619 let content_type = resp
620 .headers()
621 .get("content-type")
622 .and_then(|v| v.to_str().ok())
623 .unwrap_or("application/octet-stream");
624 let content_type = super::ContentType::from(content_type);
625
626 if !status.is_client_error() && !status.is_server_error() {
627 let content = resp.text().await?;
628 match content_type {
629 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
630 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::EsignRejection`"))),
631 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::EsignRejection`")))),
632 }
633 } else {
634 let content = resp.text().await?;
635 let entity: Option<PostEsignObyOrgSignByTokenRejectError> = serde_json::from_str(&content).ok();
636 Err(Error::ResponseError(ResponseContent { status, content, entity }))
637 }
638}
639