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 CreateBlockError {
22 Status400(models::ApiError),
23 Status401(models::ApiError),
24 Status404(models::ApiError),
25 UnknownValue(serde_json::Value),
26}
27
28#[derive(Debug, Clone, Serialize, Deserialize)]
30#[serde(untagged)]
31pub enum CreateNoteError {
32 Status400(models::CreateNote400Response),
33 Status401(models::ApiError),
34 Status500(models::ApiError),
35 UnknownValue(serde_json::Value),
36}
37
38#[derive(Debug, Clone, Serialize, Deserialize)]
40#[serde(untagged)]
41pub enum CreateNoteCommentError {
42 Status400(models::ApiError),
43 Status401(models::ApiError),
44 UnknownValue(serde_json::Value),
45}
46
47#[derive(Debug, Clone, Serialize, Deserialize)]
49#[serde(untagged)]
50pub enum DeleteBlockError {
51 Status401(models::ApiError),
52 Status404(models::ApiError),
53 UnknownValue(serde_json::Value),
54}
55
56#[derive(Debug, Clone, Serialize, Deserialize)]
58#[serde(untagged)]
59pub enum DeleteNoteError {
60 Status401(models::ApiError),
61 Status404(models::ApiError),
62 UnknownValue(serde_json::Value),
63}
64
65#[derive(Debug, Clone, Serialize, Deserialize)]
67#[serde(untagged)]
68pub enum DeleteNoteCommentError {
69 Status400(models::ApiError),
70 Status401(models::ApiError),
71 Status403(models::ApiError),
72 Status404(models::ApiError),
73 UnknownValue(serde_json::Value),
74}
75
76#[derive(Debug, Clone, Serialize, Deserialize)]
78#[serde(untagged)]
79pub enum DisableNoteShareError {
80 Status401(models::ApiError),
81 Status403(models::ApiError),
82 Status404(models::ApiError),
83 UnknownValue(serde_json::Value),
84}
85
86#[derive(Debug, Clone, Serialize, Deserialize)]
88#[serde(untagged)]
89pub enum EnableNoteShareError {
90 Status400(models::ApiError),
91 Status401(models::ApiError),
92 Status403(models::ApiError),
93 Status404(models::ApiError),
94 UnknownValue(serde_json::Value),
95}
96
97#[derive(Debug, Clone, Serialize, Deserialize)]
99#[serde(untagged)]
100pub enum GetBlockError {
101 Status400(models::ApiError),
102 Status401(models::ApiError),
103 Status404(models::ApiError),
104 UnknownValue(serde_json::Value),
105}
106
107#[derive(Debug, Clone, Serialize, Deserialize)]
109#[serde(untagged)]
110pub enum GetNoteError {
111 Status400(models::CreateNote400Response),
112 Status401(models::ApiError),
113 Status404(models::ApiError),
114 UnknownValue(serde_json::Value),
115}
116
117#[derive(Debug, Clone, Serialize, Deserialize)]
119#[serde(untagged)]
120pub enum GetNoteCommentError {
121 Status400(models::ApiError),
122 Status401(models::ApiError),
123 Status404(models::ApiError),
124 UnknownValue(serde_json::Value),
125}
126
127#[derive(Debug, Clone, Serialize, Deserialize)]
129#[serde(untagged)]
130pub enum GetNoteShareSettingsError {
131 Status401(models::ApiError),
132 Status403(models::ApiError),
133 Status404(models::ApiError),
134 UnknownValue(serde_json::Value),
135}
136
137#[derive(Debug, Clone, Serialize, Deserialize)]
139#[serde(untagged)]
140pub enum GetPublicNoteError {
141 Status400(models::ApiError),
142 Status401(models::PasswordRequiredError),
143 Status404(models::ApiError),
144 Status500(models::ApiError),
145 UnknownValue(serde_json::Value),
146}
147
148#[derive(Debug, Clone, Serialize, Deserialize)]
150#[serde(untagged)]
151pub enum ListBlocksError {
152 Status401(models::ApiError),
153 Status404(models::ApiError),
154 UnknownValue(serde_json::Value),
155}
156
157#[derive(Debug, Clone, Serialize, Deserialize)]
159#[serde(untagged)]
160pub enum ListNoteCommentsError {
161 Status400(models::ApiError),
162 Status401(models::ApiError),
163 UnknownValue(serde_json::Value),
164}
165
166#[derive(Debug, Clone, Serialize, Deserialize)]
168#[serde(untagged)]
169pub enum ListNotesError {
170 Status401(models::ApiError),
171 Status500(models::ApiError),
172 UnknownValue(serde_json::Value),
173}
174
175#[derive(Debug, Clone, Serialize, Deserialize)]
177#[serde(untagged)]
178pub enum MoveBlockError {
179 Status400(models::ApiError),
180 Status401(models::ApiError),
181 Status404(models::ApiError),
182 UnknownValue(serde_json::Value),
183}
184
185#[derive(Debug, Clone, Serialize, Deserialize)]
187#[serde(untagged)]
188pub enum RotateNoteShareTokenError {
189 Status401(models::ApiError),
190 Status403(models::ApiError),
191 Status404(models::ApiError),
192 UnknownValue(serde_json::Value),
193}
194
195#[derive(Debug, Clone, Serialize, Deserialize)]
197#[serde(untagged)]
198pub enum UpdateBlockError {
199 Status400(models::ApiError),
200 Status401(models::ApiError),
201 Status404(models::ApiError),
202 UnknownValue(serde_json::Value),
203}
204
205#[derive(Debug, Clone, Serialize, Deserialize)]
207#[serde(untagged)]
208pub enum UpdateNoteError {
209 Status400(models::ApiError),
210 Status401(models::ApiError),
211 Status404(models::ApiError),
212 UnknownValue(serde_json::Value),
213}
214
215#[derive(Debug, Clone, Serialize, Deserialize)]
217#[serde(untagged)]
218pub enum UpdateNoteCommentError {
219 Status400(models::ApiError),
220 Status401(models::ApiError),
221 Status403(models::ApiError),
222 Status404(models::ApiError),
223 UnknownValue(serde_json::Value),
224}
225
226#[derive(Debug, Clone, Serialize, Deserialize)]
228#[serde(untagged)]
229pub enum WorkspaceCreateNoteError {
230 Status401(models::ApiError),
231 Status403(models::ApiError),
232 UnknownValue(serde_json::Value),
233}
234
235#[derive(Debug, Clone, Serialize, Deserialize)]
237#[serde(untagged)]
238pub enum WorkspaceCreateNoteBlockError {
239 Status401(models::ApiError),
240 Status403(models::ApiError),
241 UnknownValue(serde_json::Value),
242}
243
244#[derive(Debug, Clone, Serialize, Deserialize)]
246#[serde(untagged)]
247pub enum WorkspaceDeleteNoteError {
248 Status401(models::ApiError),
249 Status403(models::ApiError),
250 UnknownValue(serde_json::Value),
251}
252
253#[derive(Debug, Clone, Serialize, Deserialize)]
255#[serde(untagged)]
256pub enum WorkspaceDeleteNoteBlockError {
257 Status401(models::ApiError),
258 Status403(models::ApiError),
259 UnknownValue(serde_json::Value),
260}
261
262#[derive(Debug, Clone, Serialize, Deserialize)]
264#[serde(untagged)]
265pub enum WorkspaceGetNoteError {
266 Status401(models::ApiError),
267 Status403(models::ApiError),
268 Status404(models::ApiError),
269 UnknownValue(serde_json::Value),
270}
271
272#[derive(Debug, Clone, Serialize, Deserialize)]
274#[serde(untagged)]
275pub enum WorkspaceGetNoteBlockError {
276 Status401(models::ApiError),
277 Status403(models::ApiError),
278 Status404(models::ApiError),
279 UnknownValue(serde_json::Value),
280}
281
282#[derive(Debug, Clone, Serialize, Deserialize)]
284#[serde(untagged)]
285pub enum WorkspaceListNoteBlocksError {
286 Status401(models::ApiError),
287 Status403(models::ApiError),
288 UnknownValue(serde_json::Value),
289}
290
291#[derive(Debug, Clone, Serialize, Deserialize)]
293#[serde(untagged)]
294pub enum WorkspaceListNotesError {
295 Status401(models::ApiError),
296 Status403(models::ApiError),
297 UnknownValue(serde_json::Value),
298}
299
300#[derive(Debug, Clone, Serialize, Deserialize)]
302#[serde(untagged)]
303pub enum WorkspaceMoveNoteBlockError {
304 Status401(models::ApiError),
305 Status403(models::ApiError),
306 UnknownValue(serde_json::Value),
307}
308
309#[derive(Debug, Clone, Serialize, Deserialize)]
311#[serde(untagged)]
312pub enum WorkspaceUpdateNoteError {
313 Status401(models::ApiError),
314 Status403(models::ApiError),
315 UnknownValue(serde_json::Value),
316}
317
318#[derive(Debug, Clone, Serialize, Deserialize)]
320#[serde(untagged)]
321pub enum WorkspaceUpdateNoteBlockError {
322 Status401(models::ApiError),
323 Status403(models::ApiError),
324 UnknownValue(serde_json::Value),
325}
326
327
328pub async fn create_block(configuration: &configuration::Configuration, id: &str, create_block_request: models::CreateBlockRequest, account_id: Option<&str>, x_workspace_id: Option<&str>) -> Result<models::Block, Error<CreateBlockError>> {
329 let p_path_id = id;
331 let p_body_create_block_request = create_block_request;
332 let p_query_account_id = account_id;
333 let p_header_x_workspace_id = x_workspace_id;
334
335 let uri_str = format!("{}/v1/notes/{id}/blocks", configuration.base_path, id=crate::apis::urlencode(p_path_id));
336 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
337
338 if let Some(ref param_value) = p_query_account_id {
339 req_builder = req_builder.query(&[("accountId", ¶m_value.to_string())]);
340 }
341 if let Some(ref user_agent) = configuration.user_agent {
342 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
343 }
344 if let Some(param_value) = p_header_x_workspace_id {
345 req_builder = req_builder.header("X-Workspace-ID", param_value.to_string());
346 }
347 if let Some(ref token) = configuration.bearer_access_token {
348 req_builder = req_builder.bearer_auth(token.to_owned());
349 };
350 req_builder = req_builder.json(&p_body_create_block_request);
351
352 let req = req_builder.build()?;
353 let resp = configuration.client.execute(req).await?;
354
355 let status = resp.status();
356 let content_type = resp
357 .headers()
358 .get("content-type")
359 .and_then(|v| v.to_str().ok())
360 .unwrap_or("application/octet-stream");
361 let content_type = super::ContentType::from(content_type);
362
363 if !status.is_client_error() && !status.is_server_error() {
364 let content = resp.text().await?;
365 match content_type {
366 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
367 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::Block`"))),
368 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::Block`")))),
369 }
370 } else {
371 let content = resp.text().await?;
372 let entity: Option<CreateBlockError> = serde_json::from_str(&content).ok();
373 Err(Error::ResponseError(ResponseContent { status, content, entity }))
374 }
375}
376
377pub async fn create_note(configuration: &configuration::Configuration, create_note_request: models::CreateNoteRequest, account_id: Option<&str>, provider: Option<&str>, x_workspace_id: Option<&str>) -> Result<models::Note, Error<CreateNoteError>> {
379 let p_body_create_note_request = create_note_request;
381 let p_query_account_id = account_id;
382 let p_query_provider = provider;
383 let p_header_x_workspace_id = x_workspace_id;
384
385 let uri_str = format!("{}/v1/notes", configuration.base_path);
386 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
387
388 if let Some(ref param_value) = p_query_account_id {
389 req_builder = req_builder.query(&[("accountId", ¶m_value.to_string())]);
390 }
391 if let Some(ref param_value) = p_query_provider {
392 req_builder = req_builder.query(&[("provider", ¶m_value.to_string())]);
393 }
394 if let Some(ref user_agent) = configuration.user_agent {
395 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
396 }
397 if let Some(param_value) = p_header_x_workspace_id {
398 req_builder = req_builder.header("X-Workspace-ID", param_value.to_string());
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_body_create_note_request);
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::Note`"))),
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::Note`")))),
422 }
423 } else {
424 let content = resp.text().await?;
425 let entity: Option<CreateNoteError> = serde_json::from_str(&content).ok();
426 Err(Error::ResponseError(ResponseContent { status, content, entity }))
427 }
428}
429
430pub async fn create_note_comment(configuration: &configuration::Configuration, id: &str, create_comment_request: models::CreateCommentRequest, account_id: Option<&str>, x_workspace_id: Option<&str>) -> Result<models::CommentMutationResponse, Error<CreateNoteCommentError>> {
431 let p_path_id = id;
433 let p_body_create_comment_request = create_comment_request;
434 let p_query_account_id = account_id;
435 let p_header_x_workspace_id = x_workspace_id;
436
437 let uri_str = format!("{}/v1/notes/{id}/comments", configuration.base_path, id=crate::apis::urlencode(p_path_id));
438 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
439
440 if let Some(ref param_value) = p_query_account_id {
441 req_builder = req_builder.query(&[("accountId", ¶m_value.to_string())]);
442 }
443 if let Some(ref user_agent) = configuration.user_agent {
444 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
445 }
446 if let Some(param_value) = p_header_x_workspace_id {
447 req_builder = req_builder.header("X-Workspace-ID", param_value.to_string());
448 }
449 if let Some(ref token) = configuration.bearer_access_token {
450 req_builder = req_builder.bearer_auth(token.to_owned());
451 };
452 req_builder = req_builder.json(&p_body_create_comment_request);
453
454 let req = req_builder.build()?;
455 let resp = configuration.client.execute(req).await?;
456
457 let status = resp.status();
458 let content_type = resp
459 .headers()
460 .get("content-type")
461 .and_then(|v| v.to_str().ok())
462 .unwrap_or("application/octet-stream");
463 let content_type = super::ContentType::from(content_type);
464
465 if !status.is_client_error() && !status.is_server_error() {
466 let content = resp.text().await?;
467 match content_type {
468 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
469 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::CommentMutationResponse`"))),
470 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::CommentMutationResponse`")))),
471 }
472 } else {
473 let content = resp.text().await?;
474 let entity: Option<CreateNoteCommentError> = serde_json::from_str(&content).ok();
475 Err(Error::ResponseError(ResponseContent { status, content, entity }))
476 }
477}
478
479pub async fn delete_block(configuration: &configuration::Configuration, id: &str, account_id: Option<&str>, x_workspace_id: Option<&str>) -> Result<models::SuccessFlag, Error<DeleteBlockError>> {
480 let p_path_id = id;
482 let p_query_account_id = account_id;
483 let p_header_x_workspace_id = x_workspace_id;
484
485 let uri_str = format!("{}/v1/notes/blocks/{id}", configuration.base_path, id=crate::apis::urlencode(p_path_id));
486 let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str);
487
488 if let Some(ref param_value) = p_query_account_id {
489 req_builder = req_builder.query(&[("accountId", ¶m_value.to_string())]);
490 }
491 if let Some(ref user_agent) = configuration.user_agent {
492 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
493 }
494 if let Some(param_value) = p_header_x_workspace_id {
495 req_builder = req_builder.header("X-Workspace-ID", param_value.to_string());
496 }
497 if let Some(ref token) = configuration.bearer_access_token {
498 req_builder = req_builder.bearer_auth(token.to_owned());
499 };
500
501 let req = req_builder.build()?;
502 let resp = configuration.client.execute(req).await?;
503
504 let status = resp.status();
505 let content_type = resp
506 .headers()
507 .get("content-type")
508 .and_then(|v| v.to_str().ok())
509 .unwrap_or("application/octet-stream");
510 let content_type = super::ContentType::from(content_type);
511
512 if !status.is_client_error() && !status.is_server_error() {
513 let content = resp.text().await?;
514 match content_type {
515 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
516 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::SuccessFlag`"))),
517 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::SuccessFlag`")))),
518 }
519 } else {
520 let content = resp.text().await?;
521 let entity: Option<DeleteBlockError> = serde_json::from_str(&content).ok();
522 Err(Error::ResponseError(ResponseContent { status, content, entity }))
523 }
524}
525
526pub async fn delete_note(configuration: &configuration::Configuration, id: &str, account_id: Option<&str>, x_workspace_id: Option<&str>) -> Result<models::SuccessFlag, Error<DeleteNoteError>> {
527 let p_path_id = id;
529 let p_query_account_id = account_id;
530 let p_header_x_workspace_id = x_workspace_id;
531
532 let uri_str = format!("{}/v1/notes/{id}", configuration.base_path, id=crate::apis::urlencode(p_path_id));
533 let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str);
534
535 if let Some(ref param_value) = p_query_account_id {
536 req_builder = req_builder.query(&[("accountId", ¶m_value.to_string())]);
537 }
538 if let Some(ref user_agent) = configuration.user_agent {
539 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
540 }
541 if let Some(param_value) = p_header_x_workspace_id {
542 req_builder = req_builder.header("X-Workspace-ID", param_value.to_string());
543 }
544 if let Some(ref token) = configuration.bearer_access_token {
545 req_builder = req_builder.bearer_auth(token.to_owned());
546 };
547
548 let req = req_builder.build()?;
549 let resp = configuration.client.execute(req).await?;
550
551 let status = resp.status();
552 let content_type = resp
553 .headers()
554 .get("content-type")
555 .and_then(|v| v.to_str().ok())
556 .unwrap_or("application/octet-stream");
557 let content_type = super::ContentType::from(content_type);
558
559 if !status.is_client_error() && !status.is_server_error() {
560 let content = resp.text().await?;
561 match content_type {
562 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
563 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::SuccessFlag`"))),
564 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::SuccessFlag`")))),
565 }
566 } else {
567 let content = resp.text().await?;
568 let entity: Option<DeleteNoteError> = serde_json::from_str(&content).ok();
569 Err(Error::ResponseError(ResponseContent { status, content, entity }))
570 }
571}
572
573pub async fn delete_note_comment(configuration: &configuration::Configuration, id: &str, comment_id: &str, account_id: Option<&str>, x_workspace_id: Option<&str>) -> Result<models::SuccessFlag, Error<DeleteNoteCommentError>> {
575 let p_path_id = id;
577 let p_path_comment_id = comment_id;
578 let p_query_account_id = account_id;
579 let p_header_x_workspace_id = x_workspace_id;
580
581 let uri_str = format!("{}/v1/notes/{id}/comments/{commentId}", configuration.base_path, id=crate::apis::urlencode(p_path_id), commentId=crate::apis::urlencode(p_path_comment_id));
582 let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str);
583
584 if let Some(ref param_value) = p_query_account_id {
585 req_builder = req_builder.query(&[("accountId", ¶m_value.to_string())]);
586 }
587 if let Some(ref user_agent) = configuration.user_agent {
588 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
589 }
590 if let Some(param_value) = p_header_x_workspace_id {
591 req_builder = req_builder.header("X-Workspace-ID", param_value.to_string());
592 }
593 if let Some(ref token) = configuration.bearer_access_token {
594 req_builder = req_builder.bearer_auth(token.to_owned());
595 };
596
597 let req = req_builder.build()?;
598 let resp = configuration.client.execute(req).await?;
599
600 let status = resp.status();
601 let content_type = resp
602 .headers()
603 .get("content-type")
604 .and_then(|v| v.to_str().ok())
605 .unwrap_or("application/octet-stream");
606 let content_type = super::ContentType::from(content_type);
607
608 if !status.is_client_error() && !status.is_server_error() {
609 let content = resp.text().await?;
610 match content_type {
611 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
612 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::SuccessFlag`"))),
613 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::SuccessFlag`")))),
614 }
615 } else {
616 let content = resp.text().await?;
617 let entity: Option<DeleteNoteCommentError> = serde_json::from_str(&content).ok();
618 Err(Error::ResponseError(ResponseContent { status, content, entity }))
619 }
620}
621
622pub async fn disable_note_share(configuration: &configuration::Configuration, id: &str, account_id: Option<&str>, x_workspace_id: Option<&str>) -> Result<(), Error<DisableNoteShareError>> {
624 let p_path_id = id;
626 let p_query_account_id = account_id;
627 let p_header_x_workspace_id = x_workspace_id;
628
629 let uri_str = format!("{}/v1/notes/{id}/share", configuration.base_path, id=crate::apis::urlencode(p_path_id));
630 let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str);
631
632 if let Some(ref param_value) = p_query_account_id {
633 req_builder = req_builder.query(&[("accountId", ¶m_value.to_string())]);
634 }
635 if let Some(ref user_agent) = configuration.user_agent {
636 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
637 }
638 if let Some(param_value) = p_header_x_workspace_id {
639 req_builder = req_builder.header("X-Workspace-ID", param_value.to_string());
640 }
641 if let Some(ref token) = configuration.bearer_access_token {
642 req_builder = req_builder.bearer_auth(token.to_owned());
643 };
644
645 let req = req_builder.build()?;
646 let resp = configuration.client.execute(req).await?;
647
648 let status = resp.status();
649
650 if !status.is_client_error() && !status.is_server_error() {
651 Ok(())
652 } else {
653 let content = resp.text().await?;
654 let entity: Option<DisableNoteShareError> = serde_json::from_str(&content).ok();
655 Err(Error::ResponseError(ResponseContent { status, content, entity }))
656 }
657}
658
659pub async fn enable_note_share(configuration: &configuration::Configuration, id: &str, account_id: Option<&str>, x_workspace_id: Option<&str>, enable_share_request: Option<models::EnableShareRequest>) -> Result<models::ShareSettings, Error<EnableNoteShareError>> {
661 let p_path_id = id;
663 let p_query_account_id = account_id;
664 let p_header_x_workspace_id = x_workspace_id;
665 let p_body_enable_share_request = enable_share_request;
666
667 let uri_str = format!("{}/v1/notes/{id}/share", configuration.base_path, id=crate::apis::urlencode(p_path_id));
668 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
669
670 if let Some(ref param_value) = p_query_account_id {
671 req_builder = req_builder.query(&[("accountId", ¶m_value.to_string())]);
672 }
673 if let Some(ref user_agent) = configuration.user_agent {
674 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
675 }
676 if let Some(param_value) = p_header_x_workspace_id {
677 req_builder = req_builder.header("X-Workspace-ID", param_value.to_string());
678 }
679 if let Some(ref token) = configuration.bearer_access_token {
680 req_builder = req_builder.bearer_auth(token.to_owned());
681 };
682 req_builder = req_builder.json(&p_body_enable_share_request);
683
684 let req = req_builder.build()?;
685 let resp = configuration.client.execute(req).await?;
686
687 let status = resp.status();
688 let content_type = resp
689 .headers()
690 .get("content-type")
691 .and_then(|v| v.to_str().ok())
692 .unwrap_or("application/octet-stream");
693 let content_type = super::ContentType::from(content_type);
694
695 if !status.is_client_error() && !status.is_server_error() {
696 let content = resp.text().await?;
697 match content_type {
698 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
699 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::ShareSettings`"))),
700 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::ShareSettings`")))),
701 }
702 } else {
703 let content = resp.text().await?;
704 let entity: Option<EnableNoteShareError> = serde_json::from_str(&content).ok();
705 Err(Error::ResponseError(ResponseContent { status, content, entity }))
706 }
707}
708
709pub async fn get_block(configuration: &configuration::Configuration, id: &str, account_id: Option<&str>, x_workspace_id: Option<&str>) -> Result<models::Block, Error<GetBlockError>> {
710 let p_path_id = id;
712 let p_query_account_id = account_id;
713 let p_header_x_workspace_id = x_workspace_id;
714
715 let uri_str = format!("{}/v1/notes/blocks/{id}", configuration.base_path, id=crate::apis::urlencode(p_path_id));
716 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
717
718 if let Some(ref param_value) = p_query_account_id {
719 req_builder = req_builder.query(&[("accountId", ¶m_value.to_string())]);
720 }
721 if let Some(ref user_agent) = configuration.user_agent {
722 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
723 }
724 if let Some(param_value) = p_header_x_workspace_id {
725 req_builder = req_builder.header("X-Workspace-ID", param_value.to_string());
726 }
727 if let Some(ref token) = configuration.bearer_access_token {
728 req_builder = req_builder.bearer_auth(token.to_owned());
729 };
730
731 let req = req_builder.build()?;
732 let resp = configuration.client.execute(req).await?;
733
734 let status = resp.status();
735 let content_type = resp
736 .headers()
737 .get("content-type")
738 .and_then(|v| v.to_str().ok())
739 .unwrap_or("application/octet-stream");
740 let content_type = super::ContentType::from(content_type);
741
742 if !status.is_client_error() && !status.is_server_error() {
743 let content = resp.text().await?;
744 match content_type {
745 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
746 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::Block`"))),
747 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::Block`")))),
748 }
749 } else {
750 let content = resp.text().await?;
751 let entity: Option<GetBlockError> = serde_json::from_str(&content).ok();
752 Err(Error::ResponseError(ResponseContent { status, content, entity }))
753 }
754}
755
756pub async fn get_note(configuration: &configuration::Configuration, id: &str, account_id: Option<&str>, x_workspace_id: Option<&str>) -> Result<models::Note, Error<GetNoteError>> {
757 let p_path_id = id;
759 let p_query_account_id = account_id;
760 let p_header_x_workspace_id = x_workspace_id;
761
762 let uri_str = format!("{}/v1/notes/{id}", configuration.base_path, id=crate::apis::urlencode(p_path_id));
763 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
764
765 if let Some(ref param_value) = p_query_account_id {
766 req_builder = req_builder.query(&[("accountId", ¶m_value.to_string())]);
767 }
768 if let Some(ref user_agent) = configuration.user_agent {
769 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
770 }
771 if let Some(param_value) = p_header_x_workspace_id {
772 req_builder = req_builder.header("X-Workspace-ID", param_value.to_string());
773 }
774 if let Some(ref token) = configuration.bearer_access_token {
775 req_builder = req_builder.bearer_auth(token.to_owned());
776 };
777
778 let req = req_builder.build()?;
779 let resp = configuration.client.execute(req).await?;
780
781 let status = resp.status();
782 let content_type = resp
783 .headers()
784 .get("content-type")
785 .and_then(|v| v.to_str().ok())
786 .unwrap_or("application/octet-stream");
787 let content_type = super::ContentType::from(content_type);
788
789 if !status.is_client_error() && !status.is_server_error() {
790 let content = resp.text().await?;
791 match content_type {
792 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
793 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::Note`"))),
794 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::Note`")))),
795 }
796 } else {
797 let content = resp.text().await?;
798 let entity: Option<GetNoteError> = serde_json::from_str(&content).ok();
799 Err(Error::ResponseError(ResponseContent { status, content, entity }))
800 }
801}
802
803pub async fn get_note_comment(configuration: &configuration::Configuration, id: &str, comment_id: &str, account_id: Option<&str>, x_workspace_id: Option<&str>) -> Result<models::CommentResponse, Error<GetNoteCommentError>> {
805 let p_path_id = id;
807 let p_path_comment_id = comment_id;
808 let p_query_account_id = account_id;
809 let p_header_x_workspace_id = x_workspace_id;
810
811 let uri_str = format!("{}/v1/notes/{id}/comments/{commentId}", configuration.base_path, id=crate::apis::urlencode(p_path_id), commentId=crate::apis::urlencode(p_path_comment_id));
812 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
813
814 if let Some(ref param_value) = p_query_account_id {
815 req_builder = req_builder.query(&[("accountId", ¶m_value.to_string())]);
816 }
817 if let Some(ref user_agent) = configuration.user_agent {
818 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
819 }
820 if let Some(param_value) = p_header_x_workspace_id {
821 req_builder = req_builder.header("X-Workspace-ID", param_value.to_string());
822 }
823 if let Some(ref token) = configuration.bearer_access_token {
824 req_builder = req_builder.bearer_auth(token.to_owned());
825 };
826
827 let req = req_builder.build()?;
828 let resp = configuration.client.execute(req).await?;
829
830 let status = resp.status();
831 let content_type = resp
832 .headers()
833 .get("content-type")
834 .and_then(|v| v.to_str().ok())
835 .unwrap_or("application/octet-stream");
836 let content_type = super::ContentType::from(content_type);
837
838 if !status.is_client_error() && !status.is_server_error() {
839 let content = resp.text().await?;
840 match content_type {
841 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
842 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::CommentResponse`"))),
843 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::CommentResponse`")))),
844 }
845 } else {
846 let content = resp.text().await?;
847 let entity: Option<GetNoteCommentError> = serde_json::from_str(&content).ok();
848 Err(Error::ResponseError(ResponseContent { status, content, entity }))
849 }
850}
851
852pub async fn get_note_share_settings(configuration: &configuration::Configuration, id: &str, account_id: Option<&str>, x_workspace_id: Option<&str>) -> Result<models::ShareSettings, Error<GetNoteShareSettingsError>> {
854 let p_path_id = id;
856 let p_query_account_id = account_id;
857 let p_header_x_workspace_id = x_workspace_id;
858
859 let uri_str = format!("{}/v1/notes/{id}/share", configuration.base_path, id=crate::apis::urlencode(p_path_id));
860 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
861
862 if let Some(ref param_value) = p_query_account_id {
863 req_builder = req_builder.query(&[("accountId", ¶m_value.to_string())]);
864 }
865 if let Some(ref user_agent) = configuration.user_agent {
866 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
867 }
868 if let Some(param_value) = p_header_x_workspace_id {
869 req_builder = req_builder.header("X-Workspace-ID", param_value.to_string());
870 }
871 if let Some(ref token) = configuration.bearer_access_token {
872 req_builder = req_builder.bearer_auth(token.to_owned());
873 };
874
875 let req = req_builder.build()?;
876 let resp = configuration.client.execute(req).await?;
877
878 let status = resp.status();
879 let content_type = resp
880 .headers()
881 .get("content-type")
882 .and_then(|v| v.to_str().ok())
883 .unwrap_or("application/octet-stream");
884 let content_type = super::ContentType::from(content_type);
885
886 if !status.is_client_error() && !status.is_server_error() {
887 let content = resp.text().await?;
888 match content_type {
889 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
890 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::ShareSettings`"))),
891 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::ShareSettings`")))),
892 }
893 } else {
894 let content = resp.text().await?;
895 let entity: Option<GetNoteShareSettingsError> = serde_json::from_str(&content).ok();
896 Err(Error::ResponseError(ResponseContent { status, content, entity }))
897 }
898}
899
900pub async fn get_public_note(configuration: &configuration::Configuration, token: &str, password: Option<&str>) -> Result<std::collections::HashMap<String, serde_json::Value>, Error<GetPublicNoteError>> {
902 let p_path_token = token;
904 let p_query_password = password;
905
906 let uri_str = format!("{}/public/notes/{token}", configuration.base_path, token=crate::apis::urlencode(p_path_token));
907 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
908
909 if let Some(ref param_value) = p_query_password {
910 req_builder = req_builder.query(&[("password", ¶m_value.to_string())]);
911 }
912 if let Some(ref user_agent) = configuration.user_agent {
913 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
914 }
915
916 let req = req_builder.build()?;
917 let resp = configuration.client.execute(req).await?;
918
919 let status = resp.status();
920 let content_type = resp
921 .headers()
922 .get("content-type")
923 .and_then(|v| v.to_str().ok())
924 .unwrap_or("application/octet-stream");
925 let content_type = super::ContentType::from(content_type);
926
927 if !status.is_client_error() && !status.is_server_error() {
928 let content = resp.text().await?;
929 match content_type {
930 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
931 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `std::collections::HashMap<String, serde_json::Value>`"))),
932 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `std::collections::HashMap<String, serde_json::Value>`")))),
933 }
934 } else {
935 let content = resp.text().await?;
936 let entity: Option<GetPublicNoteError> = serde_json::from_str(&content).ok();
937 Err(Error::ResponseError(ResponseContent { status, content, entity }))
938 }
939}
940
941pub async fn list_blocks(configuration: &configuration::Configuration, id: &str, account_id: Option<&str>, x_workspace_id: Option<&str>, parent_id: Option<&str>, limit: Option<i32>, offset: Option<i32>) -> Result<models::BlockListResponse, Error<ListBlocksError>> {
943 let p_path_id = id;
945 let p_query_account_id = account_id;
946 let p_header_x_workspace_id = x_workspace_id;
947 let p_query_parent_id = parent_id;
948 let p_query_limit = limit;
949 let p_query_offset = offset;
950
951 let uri_str = format!("{}/v1/notes/{id}/blocks", configuration.base_path, id=crate::apis::urlencode(p_path_id));
952 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
953
954 if let Some(ref param_value) = p_query_account_id {
955 req_builder = req_builder.query(&[("accountId", ¶m_value.to_string())]);
956 }
957 if let Some(ref param_value) = p_query_parent_id {
958 req_builder = req_builder.query(&[("parent_id", ¶m_value.to_string())]);
959 }
960 if let Some(ref param_value) = p_query_limit {
961 req_builder = req_builder.query(&[("limit", ¶m_value.to_string())]);
962 }
963 if let Some(ref param_value) = p_query_offset {
964 req_builder = req_builder.query(&[("offset", ¶m_value.to_string())]);
965 }
966 if let Some(ref user_agent) = configuration.user_agent {
967 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
968 }
969 if let Some(param_value) = p_header_x_workspace_id {
970 req_builder = req_builder.header("X-Workspace-ID", param_value.to_string());
971 }
972 if let Some(ref token) = configuration.bearer_access_token {
973 req_builder = req_builder.bearer_auth(token.to_owned());
974 };
975
976 let req = req_builder.build()?;
977 let resp = configuration.client.execute(req).await?;
978
979 let status = resp.status();
980 let content_type = resp
981 .headers()
982 .get("content-type")
983 .and_then(|v| v.to_str().ok())
984 .unwrap_or("application/octet-stream");
985 let content_type = super::ContentType::from(content_type);
986
987 if !status.is_client_error() && !status.is_server_error() {
988 let content = resp.text().await?;
989 match content_type {
990 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
991 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::BlockListResponse`"))),
992 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::BlockListResponse`")))),
993 }
994 } else {
995 let content = resp.text().await?;
996 let entity: Option<ListBlocksError> = serde_json::from_str(&content).ok();
997 Err(Error::ResponseError(ResponseContent { status, content, entity }))
998 }
999}
1000
1001pub async fn list_note_comments(configuration: &configuration::Configuration, id: &str, account_id: Option<&str>, x_workspace_id: Option<&str>) -> Result<models::CommentListResponse, Error<ListNoteCommentsError>> {
1003 let p_path_id = id;
1005 let p_query_account_id = account_id;
1006 let p_header_x_workspace_id = x_workspace_id;
1007
1008 let uri_str = format!("{}/v1/notes/{id}/comments", configuration.base_path, id=crate::apis::urlencode(p_path_id));
1009 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
1010
1011 if let Some(ref param_value) = p_query_account_id {
1012 req_builder = req_builder.query(&[("accountId", ¶m_value.to_string())]);
1013 }
1014 if let Some(ref user_agent) = configuration.user_agent {
1015 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1016 }
1017 if let Some(param_value) = p_header_x_workspace_id {
1018 req_builder = req_builder.header("X-Workspace-ID", param_value.to_string());
1019 }
1020 if let Some(ref token) = configuration.bearer_access_token {
1021 req_builder = req_builder.bearer_auth(token.to_owned());
1022 };
1023
1024 let req = req_builder.build()?;
1025 let resp = configuration.client.execute(req).await?;
1026
1027 let status = resp.status();
1028 let content_type = resp
1029 .headers()
1030 .get("content-type")
1031 .and_then(|v| v.to_str().ok())
1032 .unwrap_or("application/octet-stream");
1033 let content_type = super::ContentType::from(content_type);
1034
1035 if !status.is_client_error() && !status.is_server_error() {
1036 let content = resp.text().await?;
1037 match content_type {
1038 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1039 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::CommentListResponse`"))),
1040 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::CommentListResponse`")))),
1041 }
1042 } else {
1043 let content = resp.text().await?;
1044 let entity: Option<ListNoteCommentsError> = serde_json::from_str(&content).ok();
1045 Err(Error::ResponseError(ResponseContent { status, content, entity }))
1046 }
1047}
1048
1049pub async fn list_notes(configuration: &configuration::Configuration, account_id: Option<&str>, provider: Option<&str>, x_workspace_id: Option<&str>, archived: Option<bool>, parent_id: Option<&str>, tags: Option<Vec<String>>, limit: Option<i32>, offset: Option<i32>, sort_by: Option<&str>, sort_order: Option<&str>) -> Result<models::NoteListEnvelope, Error<ListNotesError>> {
1051 let p_query_account_id = account_id;
1053 let p_query_provider = provider;
1054 let p_header_x_workspace_id = x_workspace_id;
1055 let p_query_archived = archived;
1056 let p_query_parent_id = parent_id;
1057 let p_query_tags = tags;
1058 let p_query_limit = limit;
1059 let p_query_offset = offset;
1060 let p_query_sort_by = sort_by;
1061 let p_query_sort_order = sort_order;
1062
1063 let uri_str = format!("{}/v1/notes", configuration.base_path);
1064 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
1065
1066 if let Some(ref param_value) = p_query_account_id {
1067 req_builder = req_builder.query(&[("accountId", ¶m_value.to_string())]);
1068 }
1069 if let Some(ref param_value) = p_query_provider {
1070 req_builder = req_builder.query(&[("provider", ¶m_value.to_string())]);
1071 }
1072 if let Some(ref param_value) = p_query_archived {
1073 req_builder = req_builder.query(&[("archived", ¶m_value.to_string())]);
1074 }
1075 if let Some(ref param_value) = p_query_parent_id {
1076 req_builder = req_builder.query(&[("parent_id", ¶m_value.to_string())]);
1077 }
1078 if let Some(ref param_value) = p_query_tags {
1079 req_builder = match "multi" {
1080 "multi" => req_builder.query(¶m_value.into_iter().map(|p| ("tags".to_owned(), p.to_string())).collect::<Vec<(std::string::String, std::string::String)>>()),
1081 _ => req_builder.query(&[("tags", ¶m_value.into_iter().map(|p| p.to_string()).collect::<Vec<String>>().join(",").to_string())]),
1082 };
1083 }
1084 if let Some(ref param_value) = p_query_limit {
1085 req_builder = req_builder.query(&[("limit", ¶m_value.to_string())]);
1086 }
1087 if let Some(ref param_value) = p_query_offset {
1088 req_builder = req_builder.query(&[("offset", ¶m_value.to_string())]);
1089 }
1090 if let Some(ref param_value) = p_query_sort_by {
1091 req_builder = req_builder.query(&[("sort_by", ¶m_value.to_string())]);
1092 }
1093 if let Some(ref param_value) = p_query_sort_order {
1094 req_builder = req_builder.query(&[("sort_order", ¶m_value.to_string())]);
1095 }
1096 if let Some(ref user_agent) = configuration.user_agent {
1097 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1098 }
1099 if let Some(param_value) = p_header_x_workspace_id {
1100 req_builder = req_builder.header("X-Workspace-ID", param_value.to_string());
1101 }
1102 if let Some(ref token) = configuration.bearer_access_token {
1103 req_builder = req_builder.bearer_auth(token.to_owned());
1104 };
1105
1106 let req = req_builder.build()?;
1107 let resp = configuration.client.execute(req).await?;
1108
1109 let status = resp.status();
1110 let content_type = resp
1111 .headers()
1112 .get("content-type")
1113 .and_then(|v| v.to_str().ok())
1114 .unwrap_or("application/octet-stream");
1115 let content_type = super::ContentType::from(content_type);
1116
1117 if !status.is_client_error() && !status.is_server_error() {
1118 let content = resp.text().await?;
1119 match content_type {
1120 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1121 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::NoteListEnvelope`"))),
1122 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::NoteListEnvelope`")))),
1123 }
1124 } else {
1125 let content = resp.text().await?;
1126 let entity: Option<ListNotesError> = serde_json::from_str(&content).ok();
1127 Err(Error::ResponseError(ResponseContent { status, content, entity }))
1128 }
1129}
1130
1131pub async fn move_block(configuration: &configuration::Configuration, id: &str, move_block_request: models::MoveBlockRequest, account_id: Option<&str>, x_workspace_id: Option<&str>) -> Result<models::SuccessFlag, Error<MoveBlockError>> {
1132 let p_path_id = id;
1134 let p_body_move_block_request = move_block_request;
1135 let p_query_account_id = account_id;
1136 let p_header_x_workspace_id = x_workspace_id;
1137
1138 let uri_str = format!("{}/v1/notes/blocks/{id}/move", configuration.base_path, id=crate::apis::urlencode(p_path_id));
1139 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
1140
1141 if let Some(ref param_value) = p_query_account_id {
1142 req_builder = req_builder.query(&[("accountId", ¶m_value.to_string())]);
1143 }
1144 if let Some(ref user_agent) = configuration.user_agent {
1145 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1146 }
1147 if let Some(param_value) = p_header_x_workspace_id {
1148 req_builder = req_builder.header("X-Workspace-ID", param_value.to_string());
1149 }
1150 if let Some(ref token) = configuration.bearer_access_token {
1151 req_builder = req_builder.bearer_auth(token.to_owned());
1152 };
1153 req_builder = req_builder.json(&p_body_move_block_request);
1154
1155 let req = req_builder.build()?;
1156 let resp = configuration.client.execute(req).await?;
1157
1158 let status = resp.status();
1159 let content_type = resp
1160 .headers()
1161 .get("content-type")
1162 .and_then(|v| v.to_str().ok())
1163 .unwrap_or("application/octet-stream");
1164 let content_type = super::ContentType::from(content_type);
1165
1166 if !status.is_client_error() && !status.is_server_error() {
1167 let content = resp.text().await?;
1168 match content_type {
1169 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1170 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::SuccessFlag`"))),
1171 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::SuccessFlag`")))),
1172 }
1173 } else {
1174 let content = resp.text().await?;
1175 let entity: Option<MoveBlockError> = serde_json::from_str(&content).ok();
1176 Err(Error::ResponseError(ResponseContent { status, content, entity }))
1177 }
1178}
1179
1180pub async fn rotate_note_share_token(configuration: &configuration::Configuration, id: &str, account_id: Option<&str>, x_workspace_id: Option<&str>) -> Result<models::ShareSettings, Error<RotateNoteShareTokenError>> {
1181 let p_path_id = id;
1183 let p_query_account_id = account_id;
1184 let p_header_x_workspace_id = x_workspace_id;
1185
1186 let uri_str = format!("{}/v1/notes/{id}/share/rotate", configuration.base_path, id=crate::apis::urlencode(p_path_id));
1187 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
1188
1189 if let Some(ref param_value) = p_query_account_id {
1190 req_builder = req_builder.query(&[("accountId", ¶m_value.to_string())]);
1191 }
1192 if let Some(ref user_agent) = configuration.user_agent {
1193 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1194 }
1195 if let Some(param_value) = p_header_x_workspace_id {
1196 req_builder = req_builder.header("X-Workspace-ID", param_value.to_string());
1197 }
1198 if let Some(ref token) = configuration.bearer_access_token {
1199 req_builder = req_builder.bearer_auth(token.to_owned());
1200 };
1201
1202 let req = req_builder.build()?;
1203 let resp = configuration.client.execute(req).await?;
1204
1205 let status = resp.status();
1206 let content_type = resp
1207 .headers()
1208 .get("content-type")
1209 .and_then(|v| v.to_str().ok())
1210 .unwrap_or("application/octet-stream");
1211 let content_type = super::ContentType::from(content_type);
1212
1213 if !status.is_client_error() && !status.is_server_error() {
1214 let content = resp.text().await?;
1215 match content_type {
1216 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1217 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::ShareSettings`"))),
1218 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::ShareSettings`")))),
1219 }
1220 } else {
1221 let content = resp.text().await?;
1222 let entity: Option<RotateNoteShareTokenError> = serde_json::from_str(&content).ok();
1223 Err(Error::ResponseError(ResponseContent { status, content, entity }))
1224 }
1225}
1226
1227pub async fn update_block(configuration: &configuration::Configuration, id: &str, update_block_request: models::UpdateBlockRequest, account_id: Option<&str>, x_workspace_id: Option<&str>) -> Result<models::Block, Error<UpdateBlockError>> {
1228 let p_path_id = id;
1230 let p_body_update_block_request = update_block_request;
1231 let p_query_account_id = account_id;
1232 let p_header_x_workspace_id = x_workspace_id;
1233
1234 let uri_str = format!("{}/v1/notes/blocks/{id}", configuration.base_path, id=crate::apis::urlencode(p_path_id));
1235 let mut req_builder = configuration.client.request(reqwest::Method::PATCH, &uri_str);
1236
1237 if let Some(ref param_value) = p_query_account_id {
1238 req_builder = req_builder.query(&[("accountId", ¶m_value.to_string())]);
1239 }
1240 if let Some(ref user_agent) = configuration.user_agent {
1241 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1242 }
1243 if let Some(param_value) = p_header_x_workspace_id {
1244 req_builder = req_builder.header("X-Workspace-ID", param_value.to_string());
1245 }
1246 if let Some(ref token) = configuration.bearer_access_token {
1247 req_builder = req_builder.bearer_auth(token.to_owned());
1248 };
1249 req_builder = req_builder.json(&p_body_update_block_request);
1250
1251 let req = req_builder.build()?;
1252 let resp = configuration.client.execute(req).await?;
1253
1254 let status = resp.status();
1255 let content_type = resp
1256 .headers()
1257 .get("content-type")
1258 .and_then(|v| v.to_str().ok())
1259 .unwrap_or("application/octet-stream");
1260 let content_type = super::ContentType::from(content_type);
1261
1262 if !status.is_client_error() && !status.is_server_error() {
1263 let content = resp.text().await?;
1264 match content_type {
1265 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1266 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::Block`"))),
1267 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::Block`")))),
1268 }
1269 } else {
1270 let content = resp.text().await?;
1271 let entity: Option<UpdateBlockError> = serde_json::from_str(&content).ok();
1272 Err(Error::ResponseError(ResponseContent { status, content, entity }))
1273 }
1274}
1275
1276pub async fn update_note(configuration: &configuration::Configuration, id: &str, update_note_request: models::UpdateNoteRequest, account_id: Option<&str>, x_workspace_id: Option<&str>) -> Result<models::Note, Error<UpdateNoteError>> {
1277 let p_path_id = id;
1279 let p_body_update_note_request = update_note_request;
1280 let p_query_account_id = account_id;
1281 let p_header_x_workspace_id = x_workspace_id;
1282
1283 let uri_str = format!("{}/v1/notes/{id}", configuration.base_path, id=crate::apis::urlencode(p_path_id));
1284 let mut req_builder = configuration.client.request(reqwest::Method::PATCH, &uri_str);
1285
1286 if let Some(ref param_value) = p_query_account_id {
1287 req_builder = req_builder.query(&[("accountId", ¶m_value.to_string())]);
1288 }
1289 if let Some(ref user_agent) = configuration.user_agent {
1290 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1291 }
1292 if let Some(param_value) = p_header_x_workspace_id {
1293 req_builder = req_builder.header("X-Workspace-ID", param_value.to_string());
1294 }
1295 if let Some(ref token) = configuration.bearer_access_token {
1296 req_builder = req_builder.bearer_auth(token.to_owned());
1297 };
1298 req_builder = req_builder.json(&p_body_update_note_request);
1299
1300 let req = req_builder.build()?;
1301 let resp = configuration.client.execute(req).await?;
1302
1303 let status = resp.status();
1304 let content_type = resp
1305 .headers()
1306 .get("content-type")
1307 .and_then(|v| v.to_str().ok())
1308 .unwrap_or("application/octet-stream");
1309 let content_type = super::ContentType::from(content_type);
1310
1311 if !status.is_client_error() && !status.is_server_error() {
1312 let content = resp.text().await?;
1313 match content_type {
1314 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1315 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::Note`"))),
1316 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::Note`")))),
1317 }
1318 } else {
1319 let content = resp.text().await?;
1320 let entity: Option<UpdateNoteError> = serde_json::from_str(&content).ok();
1321 Err(Error::ResponseError(ResponseContent { status, content, entity }))
1322 }
1323}
1324
1325pub async fn update_note_comment(configuration: &configuration::Configuration, id: &str, comment_id: &str, update_comment_request: models::UpdateCommentRequest, account_id: Option<&str>, x_workspace_id: Option<&str>) -> Result<models::CommentMutationResponse, Error<UpdateNoteCommentError>> {
1327 let p_path_id = id;
1329 let p_path_comment_id = comment_id;
1330 let p_body_update_comment_request = update_comment_request;
1331 let p_query_account_id = account_id;
1332 let p_header_x_workspace_id = x_workspace_id;
1333
1334 let uri_str = format!("{}/v1/notes/{id}/comments/{commentId}", configuration.base_path, id=crate::apis::urlencode(p_path_id), commentId=crate::apis::urlencode(p_path_comment_id));
1335 let mut req_builder = configuration.client.request(reqwest::Method::PATCH, &uri_str);
1336
1337 if let Some(ref param_value) = p_query_account_id {
1338 req_builder = req_builder.query(&[("accountId", ¶m_value.to_string())]);
1339 }
1340 if let Some(ref user_agent) = configuration.user_agent {
1341 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1342 }
1343 if let Some(param_value) = p_header_x_workspace_id {
1344 req_builder = req_builder.header("X-Workspace-ID", param_value.to_string());
1345 }
1346 if let Some(ref token) = configuration.bearer_access_token {
1347 req_builder = req_builder.bearer_auth(token.to_owned());
1348 };
1349 req_builder = req_builder.json(&p_body_update_comment_request);
1350
1351 let req = req_builder.build()?;
1352 let resp = configuration.client.execute(req).await?;
1353
1354 let status = resp.status();
1355 let content_type = resp
1356 .headers()
1357 .get("content-type")
1358 .and_then(|v| v.to_str().ok())
1359 .unwrap_or("application/octet-stream");
1360 let content_type = super::ContentType::from(content_type);
1361
1362 if !status.is_client_error() && !status.is_server_error() {
1363 let content = resp.text().await?;
1364 match content_type {
1365 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1366 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::CommentMutationResponse`"))),
1367 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::CommentMutationResponse`")))),
1368 }
1369 } else {
1370 let content = resp.text().await?;
1371 let entity: Option<UpdateNoteCommentError> = serde_json::from_str(&content).ok();
1372 Err(Error::ResponseError(ResponseContent { status, content, entity }))
1373 }
1374}
1375
1376pub async fn workspace_create_note(configuration: &configuration::Configuration, org: &str, workspace: &str, request_body: std::collections::HashMap<String, serde_json::Value>) -> Result<std::collections::HashMap<String, serde_json::Value>, Error<WorkspaceCreateNoteError>> {
1377 let p_path_org = org;
1379 let p_path_workspace = workspace;
1380 let p_body_request_body = request_body;
1381
1382 let uri_str = format!("{}/v1/organizations/{org}/workspaces/{workspace}/notes", configuration.base_path, org=crate::apis::urlencode(p_path_org), workspace=crate::apis::urlencode(p_path_workspace));
1383 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
1384
1385 if let Some(ref user_agent) = configuration.user_agent {
1386 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1387 }
1388 if let Some(ref token) = configuration.bearer_access_token {
1389 req_builder = req_builder.bearer_auth(token.to_owned());
1390 };
1391 req_builder = req_builder.json(&p_body_request_body);
1392
1393 let req = req_builder.build()?;
1394 let resp = configuration.client.execute(req).await?;
1395
1396 let status = resp.status();
1397 let content_type = resp
1398 .headers()
1399 .get("content-type")
1400 .and_then(|v| v.to_str().ok())
1401 .unwrap_or("application/octet-stream");
1402 let content_type = super::ContentType::from(content_type);
1403
1404 if !status.is_client_error() && !status.is_server_error() {
1405 let content = resp.text().await?;
1406 match content_type {
1407 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1408 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `std::collections::HashMap<String, serde_json::Value>`"))),
1409 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `std::collections::HashMap<String, serde_json::Value>`")))),
1410 }
1411 } else {
1412 let content = resp.text().await?;
1413 let entity: Option<WorkspaceCreateNoteError> = serde_json::from_str(&content).ok();
1414 Err(Error::ResponseError(ResponseContent { status, content, entity }))
1415 }
1416}
1417
1418pub async fn workspace_create_note_block(configuration: &configuration::Configuration, org: &str, workspace: &str, id: &str, request_body: std::collections::HashMap<String, serde_json::Value>) -> Result<std::collections::HashMap<String, serde_json::Value>, Error<WorkspaceCreateNoteBlockError>> {
1419 let p_path_org = org;
1421 let p_path_workspace = workspace;
1422 let p_path_id = id;
1423 let p_body_request_body = request_body;
1424
1425 let uri_str = format!("{}/v1/organizations/{org}/workspaces/{workspace}/notes/{id}/blocks", configuration.base_path, org=crate::apis::urlencode(p_path_org), workspace=crate::apis::urlencode(p_path_workspace), id=crate::apis::urlencode(p_path_id));
1426 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
1427
1428 if let Some(ref user_agent) = configuration.user_agent {
1429 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1430 }
1431 if let Some(ref token) = configuration.bearer_access_token {
1432 req_builder = req_builder.bearer_auth(token.to_owned());
1433 };
1434 req_builder = req_builder.json(&p_body_request_body);
1435
1436 let req = req_builder.build()?;
1437 let resp = configuration.client.execute(req).await?;
1438
1439 let status = resp.status();
1440 let content_type = resp
1441 .headers()
1442 .get("content-type")
1443 .and_then(|v| v.to_str().ok())
1444 .unwrap_or("application/octet-stream");
1445 let content_type = super::ContentType::from(content_type);
1446
1447 if !status.is_client_error() && !status.is_server_error() {
1448 let content = resp.text().await?;
1449 match content_type {
1450 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1451 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `std::collections::HashMap<String, serde_json::Value>`"))),
1452 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `std::collections::HashMap<String, serde_json::Value>`")))),
1453 }
1454 } else {
1455 let content = resp.text().await?;
1456 let entity: Option<WorkspaceCreateNoteBlockError> = serde_json::from_str(&content).ok();
1457 Err(Error::ResponseError(ResponseContent { status, content, entity }))
1458 }
1459}
1460
1461pub async fn workspace_delete_note(configuration: &configuration::Configuration, org: &str, workspace: &str, id: &str) -> Result<(), Error<WorkspaceDeleteNoteError>> {
1462 let p_path_org = org;
1464 let p_path_workspace = workspace;
1465 let p_path_id = id;
1466
1467 let uri_str = format!("{}/v1/organizations/{org}/workspaces/{workspace}/notes/{id}", configuration.base_path, org=crate::apis::urlencode(p_path_org), workspace=crate::apis::urlencode(p_path_workspace), id=crate::apis::urlencode(p_path_id));
1468 let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str);
1469
1470 if let Some(ref user_agent) = configuration.user_agent {
1471 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1472 }
1473 if let Some(ref token) = configuration.bearer_access_token {
1474 req_builder = req_builder.bearer_auth(token.to_owned());
1475 };
1476
1477 let req = req_builder.build()?;
1478 let resp = configuration.client.execute(req).await?;
1479
1480 let status = resp.status();
1481
1482 if !status.is_client_error() && !status.is_server_error() {
1483 Ok(())
1484 } else {
1485 let content = resp.text().await?;
1486 let entity: Option<WorkspaceDeleteNoteError> = serde_json::from_str(&content).ok();
1487 Err(Error::ResponseError(ResponseContent { status, content, entity }))
1488 }
1489}
1490
1491pub async fn workspace_delete_note_block(configuration: &configuration::Configuration, org: &str, workspace: &str, id: &str) -> Result<(), Error<WorkspaceDeleteNoteBlockError>> {
1492 let p_path_org = org;
1494 let p_path_workspace = workspace;
1495 let p_path_id = id;
1496
1497 let uri_str = format!("{}/v1/organizations/{org}/workspaces/{workspace}/notes/blocks/{id}", configuration.base_path, org=crate::apis::urlencode(p_path_org), workspace=crate::apis::urlencode(p_path_workspace), id=crate::apis::urlencode(p_path_id));
1498 let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str);
1499
1500 if let Some(ref user_agent) = configuration.user_agent {
1501 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1502 }
1503 if let Some(ref token) = configuration.bearer_access_token {
1504 req_builder = req_builder.bearer_auth(token.to_owned());
1505 };
1506
1507 let req = req_builder.build()?;
1508 let resp = configuration.client.execute(req).await?;
1509
1510 let status = resp.status();
1511
1512 if !status.is_client_error() && !status.is_server_error() {
1513 Ok(())
1514 } else {
1515 let content = resp.text().await?;
1516 let entity: Option<WorkspaceDeleteNoteBlockError> = serde_json::from_str(&content).ok();
1517 Err(Error::ResponseError(ResponseContent { status, content, entity }))
1518 }
1519}
1520
1521pub async fn workspace_get_note(configuration: &configuration::Configuration, org: &str, workspace: &str, id: &str) -> Result<std::collections::HashMap<String, serde_json::Value>, Error<WorkspaceGetNoteError>> {
1522 let p_path_org = org;
1524 let p_path_workspace = workspace;
1525 let p_path_id = id;
1526
1527 let uri_str = format!("{}/v1/organizations/{org}/workspaces/{workspace}/notes/{id}", configuration.base_path, org=crate::apis::urlencode(p_path_org), workspace=crate::apis::urlencode(p_path_workspace), id=crate::apis::urlencode(p_path_id));
1528 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
1529
1530 if let Some(ref user_agent) = configuration.user_agent {
1531 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1532 }
1533 if let Some(ref token) = configuration.bearer_access_token {
1534 req_builder = req_builder.bearer_auth(token.to_owned());
1535 };
1536
1537 let req = req_builder.build()?;
1538 let resp = configuration.client.execute(req).await?;
1539
1540 let status = resp.status();
1541 let content_type = resp
1542 .headers()
1543 .get("content-type")
1544 .and_then(|v| v.to_str().ok())
1545 .unwrap_or("application/octet-stream");
1546 let content_type = super::ContentType::from(content_type);
1547
1548 if !status.is_client_error() && !status.is_server_error() {
1549 let content = resp.text().await?;
1550 match content_type {
1551 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1552 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `std::collections::HashMap<String, serde_json::Value>`"))),
1553 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `std::collections::HashMap<String, serde_json::Value>`")))),
1554 }
1555 } else {
1556 let content = resp.text().await?;
1557 let entity: Option<WorkspaceGetNoteError> = serde_json::from_str(&content).ok();
1558 Err(Error::ResponseError(ResponseContent { status, content, entity }))
1559 }
1560}
1561
1562pub async fn workspace_get_note_block(configuration: &configuration::Configuration, org: &str, workspace: &str, id: &str) -> Result<std::collections::HashMap<String, serde_json::Value>, Error<WorkspaceGetNoteBlockError>> {
1563 let p_path_org = org;
1565 let p_path_workspace = workspace;
1566 let p_path_id = id;
1567
1568 let uri_str = format!("{}/v1/organizations/{org}/workspaces/{workspace}/notes/blocks/{id}", configuration.base_path, org=crate::apis::urlencode(p_path_org), workspace=crate::apis::urlencode(p_path_workspace), id=crate::apis::urlencode(p_path_id));
1569 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
1570
1571 if let Some(ref user_agent) = configuration.user_agent {
1572 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1573 }
1574 if let Some(ref token) = configuration.bearer_access_token {
1575 req_builder = req_builder.bearer_auth(token.to_owned());
1576 };
1577
1578 let req = req_builder.build()?;
1579 let resp = configuration.client.execute(req).await?;
1580
1581 let status = resp.status();
1582 let content_type = resp
1583 .headers()
1584 .get("content-type")
1585 .and_then(|v| v.to_str().ok())
1586 .unwrap_or("application/octet-stream");
1587 let content_type = super::ContentType::from(content_type);
1588
1589 if !status.is_client_error() && !status.is_server_error() {
1590 let content = resp.text().await?;
1591 match content_type {
1592 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1593 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `std::collections::HashMap<String, serde_json::Value>`"))),
1594 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `std::collections::HashMap<String, serde_json::Value>`")))),
1595 }
1596 } else {
1597 let content = resp.text().await?;
1598 let entity: Option<WorkspaceGetNoteBlockError> = serde_json::from_str(&content).ok();
1599 Err(Error::ResponseError(ResponseContent { status, content, entity }))
1600 }
1601}
1602
1603pub async fn workspace_list_note_blocks(configuration: &configuration::Configuration, org: &str, workspace: &str, id: &str) -> Result<std::collections::HashMap<String, serde_json::Value>, Error<WorkspaceListNoteBlocksError>> {
1604 let p_path_org = org;
1606 let p_path_workspace = workspace;
1607 let p_path_id = id;
1608
1609 let uri_str = format!("{}/v1/organizations/{org}/workspaces/{workspace}/notes/{id}/blocks", configuration.base_path, org=crate::apis::urlencode(p_path_org), workspace=crate::apis::urlencode(p_path_workspace), id=crate::apis::urlencode(p_path_id));
1610 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
1611
1612 if let Some(ref user_agent) = configuration.user_agent {
1613 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1614 }
1615 if let Some(ref token) = configuration.bearer_access_token {
1616 req_builder = req_builder.bearer_auth(token.to_owned());
1617 };
1618
1619 let req = req_builder.build()?;
1620 let resp = configuration.client.execute(req).await?;
1621
1622 let status = resp.status();
1623 let content_type = resp
1624 .headers()
1625 .get("content-type")
1626 .and_then(|v| v.to_str().ok())
1627 .unwrap_or("application/octet-stream");
1628 let content_type = super::ContentType::from(content_type);
1629
1630 if !status.is_client_error() && !status.is_server_error() {
1631 let content = resp.text().await?;
1632 match content_type {
1633 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1634 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `std::collections::HashMap<String, serde_json::Value>`"))),
1635 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `std::collections::HashMap<String, serde_json::Value>`")))),
1636 }
1637 } else {
1638 let content = resp.text().await?;
1639 let entity: Option<WorkspaceListNoteBlocksError> = serde_json::from_str(&content).ok();
1640 Err(Error::ResponseError(ResponseContent { status, content, entity }))
1641 }
1642}
1643
1644pub async fn workspace_list_notes(configuration: &configuration::Configuration, org: &str, workspace: &str) -> Result<std::collections::HashMap<String, serde_json::Value>, Error<WorkspaceListNotesError>> {
1645 let p_path_org = org;
1647 let p_path_workspace = workspace;
1648
1649 let uri_str = format!("{}/v1/organizations/{org}/workspaces/{workspace}/notes", configuration.base_path, org=crate::apis::urlencode(p_path_org), workspace=crate::apis::urlencode(p_path_workspace));
1650 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
1651
1652 if let Some(ref user_agent) = configuration.user_agent {
1653 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1654 }
1655 if let Some(ref token) = configuration.bearer_access_token {
1656 req_builder = req_builder.bearer_auth(token.to_owned());
1657 };
1658
1659 let req = req_builder.build()?;
1660 let resp = configuration.client.execute(req).await?;
1661
1662 let status = resp.status();
1663 let content_type = resp
1664 .headers()
1665 .get("content-type")
1666 .and_then(|v| v.to_str().ok())
1667 .unwrap_or("application/octet-stream");
1668 let content_type = super::ContentType::from(content_type);
1669
1670 if !status.is_client_error() && !status.is_server_error() {
1671 let content = resp.text().await?;
1672 match content_type {
1673 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1674 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `std::collections::HashMap<String, serde_json::Value>`"))),
1675 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `std::collections::HashMap<String, serde_json::Value>`")))),
1676 }
1677 } else {
1678 let content = resp.text().await?;
1679 let entity: Option<WorkspaceListNotesError> = serde_json::from_str(&content).ok();
1680 Err(Error::ResponseError(ResponseContent { status, content, entity }))
1681 }
1682}
1683
1684pub async fn workspace_move_note_block(configuration: &configuration::Configuration, org: &str, workspace: &str, id: &str, request_body: std::collections::HashMap<String, serde_json::Value>) -> Result<std::collections::HashMap<String, serde_json::Value>, Error<WorkspaceMoveNoteBlockError>> {
1685 let p_path_org = org;
1687 let p_path_workspace = workspace;
1688 let p_path_id = id;
1689 let p_body_request_body = request_body;
1690
1691 let uri_str = format!("{}/v1/organizations/{org}/workspaces/{workspace}/notes/blocks/{id}/move", configuration.base_path, org=crate::apis::urlencode(p_path_org), workspace=crate::apis::urlencode(p_path_workspace), id=crate::apis::urlencode(p_path_id));
1692 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
1693
1694 if let Some(ref user_agent) = configuration.user_agent {
1695 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1696 }
1697 if let Some(ref token) = configuration.bearer_access_token {
1698 req_builder = req_builder.bearer_auth(token.to_owned());
1699 };
1700 req_builder = req_builder.json(&p_body_request_body);
1701
1702 let req = req_builder.build()?;
1703 let resp = configuration.client.execute(req).await?;
1704
1705 let status = resp.status();
1706 let content_type = resp
1707 .headers()
1708 .get("content-type")
1709 .and_then(|v| v.to_str().ok())
1710 .unwrap_or("application/octet-stream");
1711 let content_type = super::ContentType::from(content_type);
1712
1713 if !status.is_client_error() && !status.is_server_error() {
1714 let content = resp.text().await?;
1715 match content_type {
1716 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1717 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `std::collections::HashMap<String, serde_json::Value>`"))),
1718 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `std::collections::HashMap<String, serde_json::Value>`")))),
1719 }
1720 } else {
1721 let content = resp.text().await?;
1722 let entity: Option<WorkspaceMoveNoteBlockError> = serde_json::from_str(&content).ok();
1723 Err(Error::ResponseError(ResponseContent { status, content, entity }))
1724 }
1725}
1726
1727pub async fn workspace_update_note(configuration: &configuration::Configuration, org: &str, workspace: &str, id: &str, request_body: std::collections::HashMap<String, serde_json::Value>) -> Result<std::collections::HashMap<String, serde_json::Value>, Error<WorkspaceUpdateNoteError>> {
1728 let p_path_org = org;
1730 let p_path_workspace = workspace;
1731 let p_path_id = id;
1732 let p_body_request_body = request_body;
1733
1734 let uri_str = format!("{}/v1/organizations/{org}/workspaces/{workspace}/notes/{id}", configuration.base_path, org=crate::apis::urlencode(p_path_org), workspace=crate::apis::urlencode(p_path_workspace), id=crate::apis::urlencode(p_path_id));
1735 let mut req_builder = configuration.client.request(reqwest::Method::PATCH, &uri_str);
1736
1737 if let Some(ref user_agent) = configuration.user_agent {
1738 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1739 }
1740 if let Some(ref token) = configuration.bearer_access_token {
1741 req_builder = req_builder.bearer_auth(token.to_owned());
1742 };
1743 req_builder = req_builder.json(&p_body_request_body);
1744
1745 let req = req_builder.build()?;
1746 let resp = configuration.client.execute(req).await?;
1747
1748 let status = resp.status();
1749 let content_type = resp
1750 .headers()
1751 .get("content-type")
1752 .and_then(|v| v.to_str().ok())
1753 .unwrap_or("application/octet-stream");
1754 let content_type = super::ContentType::from(content_type);
1755
1756 if !status.is_client_error() && !status.is_server_error() {
1757 let content = resp.text().await?;
1758 match content_type {
1759 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1760 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `std::collections::HashMap<String, serde_json::Value>`"))),
1761 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `std::collections::HashMap<String, serde_json::Value>`")))),
1762 }
1763 } else {
1764 let content = resp.text().await?;
1765 let entity: Option<WorkspaceUpdateNoteError> = serde_json::from_str(&content).ok();
1766 Err(Error::ResponseError(ResponseContent { status, content, entity }))
1767 }
1768}
1769
1770pub async fn workspace_update_note_block(configuration: &configuration::Configuration, org: &str, workspace: &str, id: &str, request_body: std::collections::HashMap<String, serde_json::Value>) -> Result<std::collections::HashMap<String, serde_json::Value>, Error<WorkspaceUpdateNoteBlockError>> {
1771 let p_path_org = org;
1773 let p_path_workspace = workspace;
1774 let p_path_id = id;
1775 let p_body_request_body = request_body;
1776
1777 let uri_str = format!("{}/v1/organizations/{org}/workspaces/{workspace}/notes/blocks/{id}", configuration.base_path, org=crate::apis::urlencode(p_path_org), workspace=crate::apis::urlencode(p_path_workspace), id=crate::apis::urlencode(p_path_id));
1778 let mut req_builder = configuration.client.request(reqwest::Method::PATCH, &uri_str);
1779
1780 if let Some(ref user_agent) = configuration.user_agent {
1781 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1782 }
1783 if let Some(ref token) = configuration.bearer_access_token {
1784 req_builder = req_builder.bearer_auth(token.to_owned());
1785 };
1786 req_builder = req_builder.json(&p_body_request_body);
1787
1788 let req = req_builder.build()?;
1789 let resp = configuration.client.execute(req).await?;
1790
1791 let status = resp.status();
1792 let content_type = resp
1793 .headers()
1794 .get("content-type")
1795 .and_then(|v| v.to_str().ok())
1796 .unwrap_or("application/octet-stream");
1797 let content_type = super::ContentType::from(content_type);
1798
1799 if !status.is_client_error() && !status.is_server_error() {
1800 let content = resp.text().await?;
1801 match content_type {
1802 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1803 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `std::collections::HashMap<String, serde_json::Value>`"))),
1804 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `std::collections::HashMap<String, serde_json::Value>`")))),
1805 }
1806 } else {
1807 let content = resp.text().await?;
1808 let entity: Option<WorkspaceUpdateNoteBlockError> = serde_json::from_str(&content).ok();
1809 Err(Error::ResponseError(ResponseContent { status, content, entity }))
1810 }
1811}
1812