1use reqwest;
13use serde::{Deserialize, Serialize, de::Error as _};
14use crate::{apis::ResponseContent, models};
15use super::{Error, configuration, ContentType};
16use tokio::fs::File as TokioFile;
17use tokio_util::codec::{BytesCodec, FramedRead};
18
19
20#[derive(Debug, Clone, Serialize, Deserialize)]
22#[serde(untagged)]
23pub enum AcceptOrganizationInvitationError {
24 Status401(models::ApiError),
25 Status410(models::ApiError),
26 UnknownValue(serde_json::Value),
27}
28
29#[derive(Debug, Clone, Serialize, Deserialize)]
31#[serde(untagged)]
32pub enum AddOrganizationMemberError {
33 Status401(models::ApiError),
34 Status402(models::ApiError),
35 Status403(models::ApiError),
36 UnknownValue(serde_json::Value),
37}
38
39#[derive(Debug, Clone, Serialize, Deserialize)]
41#[serde(untagged)]
42pub enum CreateOrganizationError {
43 Status400(models::ApiError),
44 Status401(models::ApiError),
45 UnknownValue(serde_json::Value),
46}
47
48#[derive(Debug, Clone, Serialize, Deserialize)]
50#[serde(untagged)]
51pub enum CreateOrganizationConceptError {
52 Status401(models::ApiError),
53 UnknownValue(serde_json::Value),
54}
55
56#[derive(Debug, Clone, Serialize, Deserialize)]
58#[serde(untagged)]
59pub enum CreateOrganizationCustomRoleError {
60 Status401(models::ApiError),
61 UnknownValue(serde_json::Value),
62}
63
64#[derive(Debug, Clone, Serialize, Deserialize)]
66#[serde(untagged)]
67pub enum CreateOrganizationInvitationError {
68 Status401(models::ApiError),
69 Status402(models::ApiError),
70 UnknownValue(serde_json::Value),
71}
72
73#[derive(Debug, Clone, Serialize, Deserialize)]
75#[serde(untagged)]
76pub enum CreateOrganizationWorkspaceError {
77 Status401(models::ApiError),
78 Status403(models::ApiError),
79 UnknownValue(serde_json::Value),
80}
81
82#[derive(Debug, Clone, Serialize, Deserialize)]
84#[serde(untagged)]
85pub enum DeleteOrganizationError {
86 Status401(models::ApiError),
87 Status403(models::ApiError),
88 UnknownValue(serde_json::Value),
89}
90
91#[derive(Debug, Clone, Serialize, Deserialize)]
93#[serde(untagged)]
94pub enum DeleteOrganizationConceptError {
95 Status401(models::ApiError),
96 UnknownValue(serde_json::Value),
97}
98
99#[derive(Debug, Clone, Serialize, Deserialize)]
101#[serde(untagged)]
102pub enum DeleteOrganizationCustomRoleError {
103 Status401(models::ApiError),
104 UnknownValue(serde_json::Value),
105}
106
107#[derive(Debug, Clone, Serialize, Deserialize)]
109#[serde(untagged)]
110pub enum DeleteOrganizationLogoError {
111 Status401(models::ApiError),
112 UnknownValue(serde_json::Value),
113}
114
115#[derive(Debug, Clone, Serialize, Deserialize)]
117#[serde(untagged)]
118pub enum GetOrganizationError {
119 Status401(models::ApiError),
120 Status403(models::ApiError),
121 Status404(models::ApiError),
122 UnknownValue(serde_json::Value),
123}
124
125#[derive(Debug, Clone, Serialize, Deserialize)]
127#[serde(untagged)]
128pub enum GetOrganizationConceptError {
129 Status401(models::ApiError),
130 Status404(models::ApiError),
131 UnknownValue(serde_json::Value),
132}
133
134#[derive(Debug, Clone, Serialize, Deserialize)]
136#[serde(untagged)]
137pub enum ListMyOrganizationsError {
138 Status401(models::ApiError),
139 UnknownValue(serde_json::Value),
140}
141
142#[derive(Debug, Clone, Serialize, Deserialize)]
144#[serde(untagged)]
145pub enum ListOrganizationAuditLogError {
146 Status401(models::ApiError),
147 UnknownValue(serde_json::Value),
148}
149
150#[derive(Debug, Clone, Serialize, Deserialize)]
152#[serde(untagged)]
153pub enum ListOrganizationConceptsError {
154 Status401(models::ApiError),
155 UnknownValue(serde_json::Value),
156}
157
158#[derive(Debug, Clone, Serialize, Deserialize)]
160#[serde(untagged)]
161pub enum ListOrganizationCustomRolesError {
162 Status401(models::ApiError),
163 UnknownValue(serde_json::Value),
164}
165
166#[derive(Debug, Clone, Serialize, Deserialize)]
168#[serde(untagged)]
169pub enum ListOrganizationInvitationsError {
170 Status401(models::ApiError),
171 UnknownValue(serde_json::Value),
172}
173
174#[derive(Debug, Clone, Serialize, Deserialize)]
176#[serde(untagged)]
177pub enum ListOrganizationMembersError {
178 Status401(models::ApiError),
179 UnknownValue(serde_json::Value),
180}
181
182#[derive(Debug, Clone, Serialize, Deserialize)]
184#[serde(untagged)]
185pub enum ListOrganizationWorkspacesError {
186 Status401(models::ApiError),
187 Status403(models::ApiError),
188 UnknownValue(serde_json::Value),
189}
190
191#[derive(Debug, Clone, Serialize, Deserialize)]
193#[serde(untagged)]
194pub enum RemoveOrganizationMemberError {
195 Status401(models::ApiError),
196 Status403(models::ApiError),
197 UnknownValue(serde_json::Value),
198}
199
200#[derive(Debug, Clone, Serialize, Deserialize)]
202#[serde(untagged)]
203pub enum ResendOrganizationInvitationError {
204 Status401(models::ApiError),
205 Status404(models::ApiError),
206 UnknownValue(serde_json::Value),
207}
208
209#[derive(Debug, Clone, Serialize, Deserialize)]
211#[serde(untagged)]
212pub enum RevokeOrganizationInvitationError {
213 Status401(models::ApiError),
214 Status404(models::ApiError),
215 UnknownValue(serde_json::Value),
216}
217
218#[derive(Debug, Clone, Serialize, Deserialize)]
220#[serde(untagged)]
221pub enum UpdateOrganizationError {
222 Status401(models::ApiError),
223 Status403(models::ApiError),
224 UnknownValue(serde_json::Value),
225}
226
227#[derive(Debug, Clone, Serialize, Deserialize)]
229#[serde(untagged)]
230pub enum UpdateOrganizationConceptError {
231 Status401(models::ApiError),
232 UnknownValue(serde_json::Value),
233}
234
235#[derive(Debug, Clone, Serialize, Deserialize)]
237#[serde(untagged)]
238pub enum UpdateOrganizationCustomRoleError {
239 Status401(models::ApiError),
240 UnknownValue(serde_json::Value),
241}
242
243#[derive(Debug, Clone, Serialize, Deserialize)]
245#[serde(untagged)]
246pub enum UpdateOrganizationMemberError {
247 Status401(models::ApiError),
248 Status403(models::ApiError),
249 UnknownValue(serde_json::Value),
250}
251
252#[derive(Debug, Clone, Serialize, Deserialize)]
254#[serde(untagged)]
255pub enum UploadOrganizationLogoError {
256 Status401(models::ApiError),
257 UnknownValue(serde_json::Value),
258}
259
260
261pub async fn accept_organization_invitation(configuration: &configuration::Configuration, org: &str, accept_organization_invitation_request: models::AcceptOrganizationInvitationRequest) -> Result<std::collections::HashMap<String, serde_json::Value>, Error<AcceptOrganizationInvitationError>> {
262 let p_path_org = org;
264 let p_body_accept_organization_invitation_request = accept_organization_invitation_request;
265
266 let uri_str = format!("{}/v1/organizations/{org}/accept-invitation", configuration.base_path, org=crate::apis::urlencode(p_path_org));
267 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
268
269 if let Some(ref user_agent) = configuration.user_agent {
270 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
271 }
272 if let Some(ref token) = configuration.bearer_access_token {
273 req_builder = req_builder.bearer_auth(token.to_owned());
274 };
275 req_builder = req_builder.json(&p_body_accept_organization_invitation_request);
276
277 let req = req_builder.build()?;
278 let resp = configuration.client.execute(req).await?;
279
280 let status = resp.status();
281 let content_type = resp
282 .headers()
283 .get("content-type")
284 .and_then(|v| v.to_str().ok())
285 .unwrap_or("application/octet-stream");
286 let content_type = super::ContentType::from(content_type);
287
288 if !status.is_client_error() && !status.is_server_error() {
289 let content = resp.text().await?;
290 match content_type {
291 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
292 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>`"))),
293 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>`")))),
294 }
295 } else {
296 let content = resp.text().await?;
297 let entity: Option<AcceptOrganizationInvitationError> = serde_json::from_str(&content).ok();
298 Err(Error::ResponseError(ResponseContent { status, content, entity }))
299 }
300}
301
302pub async fn add_organization_member(configuration: &configuration::Configuration, org: &str, add_organization_member_request: models::AddOrganizationMemberRequest) -> Result<std::collections::HashMap<String, serde_json::Value>, Error<AddOrganizationMemberError>> {
303 let p_path_org = org;
305 let p_body_add_organization_member_request = add_organization_member_request;
306
307 let uri_str = format!("{}/v1/organizations/{org}/members", configuration.base_path, org=crate::apis::urlencode(p_path_org));
308 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
309
310 if let Some(ref user_agent) = configuration.user_agent {
311 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
312 }
313 if let Some(ref token) = configuration.bearer_access_token {
314 req_builder = req_builder.bearer_auth(token.to_owned());
315 };
316 req_builder = req_builder.json(&p_body_add_organization_member_request);
317
318 let req = req_builder.build()?;
319 let resp = configuration.client.execute(req).await?;
320
321 let status = resp.status();
322 let content_type = resp
323 .headers()
324 .get("content-type")
325 .and_then(|v| v.to_str().ok())
326 .unwrap_or("application/octet-stream");
327 let content_type = super::ContentType::from(content_type);
328
329 if !status.is_client_error() && !status.is_server_error() {
330 let content = resp.text().await?;
331 match content_type {
332 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
333 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>`"))),
334 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>`")))),
335 }
336 } else {
337 let content = resp.text().await?;
338 let entity: Option<AddOrganizationMemberError> = serde_json::from_str(&content).ok();
339 Err(Error::ResponseError(ResponseContent { status, content, entity }))
340 }
341}
342
343pub async fn create_organization(configuration: &configuration::Configuration, create_organization_request: models::CreateOrganizationRequest) -> Result<std::collections::HashMap<String, serde_json::Value>, Error<CreateOrganizationError>> {
344 let p_body_create_organization_request = create_organization_request;
346
347 let uri_str = format!("{}/v1/organizations", configuration.base_path);
348 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
349
350 if let Some(ref user_agent) = configuration.user_agent {
351 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
352 }
353 if let Some(ref token) = configuration.bearer_access_token {
354 req_builder = req_builder.bearer_auth(token.to_owned());
355 };
356 req_builder = req_builder.json(&p_body_create_organization_request);
357
358 let req = req_builder.build()?;
359 let resp = configuration.client.execute(req).await?;
360
361 let status = resp.status();
362 let content_type = resp
363 .headers()
364 .get("content-type")
365 .and_then(|v| v.to_str().ok())
366 .unwrap_or("application/octet-stream");
367 let content_type = super::ContentType::from(content_type);
368
369 if !status.is_client_error() && !status.is_server_error() {
370 let content = resp.text().await?;
371 match content_type {
372 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
373 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>`"))),
374 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>`")))),
375 }
376 } else {
377 let content = resp.text().await?;
378 let entity: Option<CreateOrganizationError> = serde_json::from_str(&content).ok();
379 Err(Error::ResponseError(ResponseContent { status, content, entity }))
380 }
381}
382
383pub async fn create_organization_concept(configuration: &configuration::Configuration, org: &str, request_body: std::collections::HashMap<String, serde_json::Value>) -> Result<std::collections::HashMap<String, serde_json::Value>, Error<CreateOrganizationConceptError>> {
384 let p_path_org = org;
386 let p_body_request_body = request_body;
387
388 let uri_str = format!("{}/v1/organizations/{org}/concepts", configuration.base_path, org=crate::apis::urlencode(p_path_org));
389 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
390
391 if let Some(ref user_agent) = configuration.user_agent {
392 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
393 }
394 if let Some(ref token) = configuration.bearer_access_token {
395 req_builder = req_builder.bearer_auth(token.to_owned());
396 };
397 req_builder = req_builder.json(&p_body_request_body);
398
399 let req = req_builder.build()?;
400 let resp = configuration.client.execute(req).await?;
401
402 let status = resp.status();
403 let content_type = resp
404 .headers()
405 .get("content-type")
406 .and_then(|v| v.to_str().ok())
407 .unwrap_or("application/octet-stream");
408 let content_type = super::ContentType::from(content_type);
409
410 if !status.is_client_error() && !status.is_server_error() {
411 let content = resp.text().await?;
412 match content_type {
413 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
414 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>`"))),
415 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>`")))),
416 }
417 } else {
418 let content = resp.text().await?;
419 let entity: Option<CreateOrganizationConceptError> = serde_json::from_str(&content).ok();
420 Err(Error::ResponseError(ResponseContent { status, content, entity }))
421 }
422}
423
424pub async fn create_organization_custom_role(configuration: &configuration::Configuration, org: &str, request_body: std::collections::HashMap<String, serde_json::Value>) -> Result<std::collections::HashMap<String, serde_json::Value>, Error<CreateOrganizationCustomRoleError>> {
425 let p_path_org = org;
427 let p_body_request_body = request_body;
428
429 let uri_str = format!("{}/v1/organizations/{org}/roles", configuration.base_path, org=crate::apis::urlencode(p_path_org));
430 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
431
432 if let Some(ref user_agent) = configuration.user_agent {
433 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
434 }
435 if let Some(ref token) = configuration.bearer_access_token {
436 req_builder = req_builder.bearer_auth(token.to_owned());
437 };
438 req_builder = req_builder.json(&p_body_request_body);
439
440 let req = req_builder.build()?;
441 let resp = configuration.client.execute(req).await?;
442
443 let status = resp.status();
444 let content_type = resp
445 .headers()
446 .get("content-type")
447 .and_then(|v| v.to_str().ok())
448 .unwrap_or("application/octet-stream");
449 let content_type = super::ContentType::from(content_type);
450
451 if !status.is_client_error() && !status.is_server_error() {
452 let content = resp.text().await?;
453 match content_type {
454 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
455 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>`"))),
456 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>`")))),
457 }
458 } else {
459 let content = resp.text().await?;
460 let entity: Option<CreateOrganizationCustomRoleError> = serde_json::from_str(&content).ok();
461 Err(Error::ResponseError(ResponseContent { status, content, entity }))
462 }
463}
464
465pub async fn create_organization_invitation(configuration: &configuration::Configuration, org: &str, create_organization_invitation_request: models::CreateOrganizationInvitationRequest) -> Result<models::OrganizationInvitation, Error<CreateOrganizationInvitationError>> {
467 let p_path_org = org;
469 let p_body_create_organization_invitation_request = create_organization_invitation_request;
470
471 let uri_str = format!("{}/v1/organizations/{org}/invitations", configuration.base_path, org=crate::apis::urlencode(p_path_org));
472 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
473
474 if let Some(ref user_agent) = configuration.user_agent {
475 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
476 }
477 if let Some(ref token) = configuration.bearer_access_token {
478 req_builder = req_builder.bearer_auth(token.to_owned());
479 };
480 req_builder = req_builder.json(&p_body_create_organization_invitation_request);
481
482 let req = req_builder.build()?;
483 let resp = configuration.client.execute(req).await?;
484
485 let status = resp.status();
486 let content_type = resp
487 .headers()
488 .get("content-type")
489 .and_then(|v| v.to_str().ok())
490 .unwrap_or("application/octet-stream");
491 let content_type = super::ContentType::from(content_type);
492
493 if !status.is_client_error() && !status.is_server_error() {
494 let content = resp.text().await?;
495 match content_type {
496 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
497 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::OrganizationInvitation`"))),
498 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::OrganizationInvitation`")))),
499 }
500 } else {
501 let content = resp.text().await?;
502 let entity: Option<CreateOrganizationInvitationError> = serde_json::from_str(&content).ok();
503 Err(Error::ResponseError(ResponseContent { status, content, entity }))
504 }
505}
506
507pub async fn create_organization_workspace(configuration: &configuration::Configuration, org: &str, create_workspace_request: models::CreateWorkspaceRequest) -> Result<models::WorkspaceEnvelope, Error<CreateOrganizationWorkspaceError>> {
509 let p_path_org = org;
511 let p_body_create_workspace_request = create_workspace_request;
512
513 let uri_str = format!("{}/v1/organizations/{org}/workspaces", configuration.base_path, org=crate::apis::urlencode(p_path_org));
514 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
515
516 if let Some(ref user_agent) = configuration.user_agent {
517 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
518 }
519 if let Some(ref token) = configuration.bearer_access_token {
520 req_builder = req_builder.bearer_auth(token.to_owned());
521 };
522 req_builder = req_builder.json(&p_body_create_workspace_request);
523
524 let req = req_builder.build()?;
525 let resp = configuration.client.execute(req).await?;
526
527 let status = resp.status();
528 let content_type = resp
529 .headers()
530 .get("content-type")
531 .and_then(|v| v.to_str().ok())
532 .unwrap_or("application/octet-stream");
533 let content_type = super::ContentType::from(content_type);
534
535 if !status.is_client_error() && !status.is_server_error() {
536 let content = resp.text().await?;
537 match content_type {
538 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
539 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::WorkspaceEnvelope`"))),
540 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::WorkspaceEnvelope`")))),
541 }
542 } else {
543 let content = resp.text().await?;
544 let entity: Option<CreateOrganizationWorkspaceError> = serde_json::from_str(&content).ok();
545 Err(Error::ResponseError(ResponseContent { status, content, entity }))
546 }
547}
548
549pub async fn delete_organization(configuration: &configuration::Configuration, org: &str) -> Result<(), Error<DeleteOrganizationError>> {
550 let p_path_org = org;
552
553 let uri_str = format!("{}/v1/organizations/{org}", configuration.base_path, org=crate::apis::urlencode(p_path_org));
554 let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str);
555
556 if let Some(ref user_agent) = configuration.user_agent {
557 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
558 }
559 if let Some(ref token) = configuration.bearer_access_token {
560 req_builder = req_builder.bearer_auth(token.to_owned());
561 };
562
563 let req = req_builder.build()?;
564 let resp = configuration.client.execute(req).await?;
565
566 let status = resp.status();
567
568 if !status.is_client_error() && !status.is_server_error() {
569 Ok(())
570 } else {
571 let content = resp.text().await?;
572 let entity: Option<DeleteOrganizationError> = serde_json::from_str(&content).ok();
573 Err(Error::ResponseError(ResponseContent { status, content, entity }))
574 }
575}
576
577pub async fn delete_organization_concept(configuration: &configuration::Configuration, org: &str, slug: &str) -> Result<(), Error<DeleteOrganizationConceptError>> {
578 let p_path_org = org;
580 let p_path_slug = slug;
581
582 let uri_str = format!("{}/v1/organizations/{org}/concepts/{slug}", configuration.base_path, org=crate::apis::urlencode(p_path_org), slug=crate::apis::urlencode(p_path_slug));
583 let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str);
584
585 if let Some(ref user_agent) = configuration.user_agent {
586 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
587 }
588 if let Some(ref token) = configuration.bearer_access_token {
589 req_builder = req_builder.bearer_auth(token.to_owned());
590 };
591
592 let req = req_builder.build()?;
593 let resp = configuration.client.execute(req).await?;
594
595 let status = resp.status();
596
597 if !status.is_client_error() && !status.is_server_error() {
598 Ok(())
599 } else {
600 let content = resp.text().await?;
601 let entity: Option<DeleteOrganizationConceptError> = serde_json::from_str(&content).ok();
602 Err(Error::ResponseError(ResponseContent { status, content, entity }))
603 }
604}
605
606pub async fn delete_organization_custom_role(configuration: &configuration::Configuration, org: &str, role_id: &str) -> Result<(), Error<DeleteOrganizationCustomRoleError>> {
607 let p_path_org = org;
609 let p_path_role_id = role_id;
610
611 let uri_str = format!("{}/v1/organizations/{org}/roles/{roleId}", configuration.base_path, org=crate::apis::urlencode(p_path_org), roleId=crate::apis::urlencode(p_path_role_id));
612 let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str);
613
614 if let Some(ref user_agent) = configuration.user_agent {
615 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
616 }
617 if let Some(ref token) = configuration.bearer_access_token {
618 req_builder = req_builder.bearer_auth(token.to_owned());
619 };
620
621 let req = req_builder.build()?;
622 let resp = configuration.client.execute(req).await?;
623
624 let status = resp.status();
625
626 if !status.is_client_error() && !status.is_server_error() {
627 Ok(())
628 } else {
629 let content = resp.text().await?;
630 let entity: Option<DeleteOrganizationCustomRoleError> = serde_json::from_str(&content).ok();
631 Err(Error::ResponseError(ResponseContent { status, content, entity }))
632 }
633}
634
635pub async fn delete_organization_logo(configuration: &configuration::Configuration, org: &str) -> Result<(), Error<DeleteOrganizationLogoError>> {
636 let p_path_org = org;
638
639 let uri_str = format!("{}/v1/organizations/{org}/logo", configuration.base_path, org=crate::apis::urlencode(p_path_org));
640 let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str);
641
642 if let Some(ref user_agent) = configuration.user_agent {
643 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
644 }
645 if let Some(ref token) = configuration.bearer_access_token {
646 req_builder = req_builder.bearer_auth(token.to_owned());
647 };
648
649 let req = req_builder.build()?;
650 let resp = configuration.client.execute(req).await?;
651
652 let status = resp.status();
653
654 if !status.is_client_error() && !status.is_server_error() {
655 Ok(())
656 } else {
657 let content = resp.text().await?;
658 let entity: Option<DeleteOrganizationLogoError> = serde_json::from_str(&content).ok();
659 Err(Error::ResponseError(ResponseContent { status, content, entity }))
660 }
661}
662
663pub async fn get_organization(configuration: &configuration::Configuration, org: &str) -> Result<models::OrganizationDetailLegacy, Error<GetOrganizationError>> {
665 let p_path_org = org;
667
668 let uri_str = format!("{}/v1/organizations/{org}", configuration.base_path, org=crate::apis::urlencode(p_path_org));
669 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
670
671 if let Some(ref user_agent) = configuration.user_agent {
672 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
673 }
674 if let Some(ref token) = configuration.bearer_access_token {
675 req_builder = req_builder.bearer_auth(token.to_owned());
676 };
677
678 let req = req_builder.build()?;
679 let resp = configuration.client.execute(req).await?;
680
681 let status = resp.status();
682 let content_type = resp
683 .headers()
684 .get("content-type")
685 .and_then(|v| v.to_str().ok())
686 .unwrap_or("application/octet-stream");
687 let content_type = super::ContentType::from(content_type);
688
689 if !status.is_client_error() && !status.is_server_error() {
690 let content = resp.text().await?;
691 match content_type {
692 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
693 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::OrganizationDetailLegacy`"))),
694 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::OrganizationDetailLegacy`")))),
695 }
696 } else {
697 let content = resp.text().await?;
698 let entity: Option<GetOrganizationError> = serde_json::from_str(&content).ok();
699 Err(Error::ResponseError(ResponseContent { status, content, entity }))
700 }
701}
702
703pub async fn get_organization_concept(configuration: &configuration::Configuration, org: &str, slug: &str) -> Result<std::collections::HashMap<String, serde_json::Value>, Error<GetOrganizationConceptError>> {
704 let p_path_org = org;
706 let p_path_slug = slug;
707
708 let uri_str = format!("{}/v1/organizations/{org}/concepts/{slug}", configuration.base_path, org=crate::apis::urlencode(p_path_org), slug=crate::apis::urlencode(p_path_slug));
709 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
710
711 if let Some(ref user_agent) = configuration.user_agent {
712 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
713 }
714 if let Some(ref token) = configuration.bearer_access_token {
715 req_builder = req_builder.bearer_auth(token.to_owned());
716 };
717
718 let req = req_builder.build()?;
719 let resp = configuration.client.execute(req).await?;
720
721 let status = resp.status();
722 let content_type = resp
723 .headers()
724 .get("content-type")
725 .and_then(|v| v.to_str().ok())
726 .unwrap_or("application/octet-stream");
727 let content_type = super::ContentType::from(content_type);
728
729 if !status.is_client_error() && !status.is_server_error() {
730 let content = resp.text().await?;
731 match content_type {
732 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
733 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>`"))),
734 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>`")))),
735 }
736 } else {
737 let content = resp.text().await?;
738 let entity: Option<GetOrganizationConceptError> = serde_json::from_str(&content).ok();
739 Err(Error::ResponseError(ResponseContent { status, content, entity }))
740 }
741}
742
743pub async fn list_my_organizations(configuration: &configuration::Configuration, ) -> Result<models::OrganizationListResponse, Error<ListMyOrganizationsError>> {
744
745 let uri_str = format!("{}/v1/organizations", configuration.base_path);
746 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
747
748 if let Some(ref user_agent) = configuration.user_agent {
749 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
750 }
751 if let Some(ref token) = configuration.bearer_access_token {
752 req_builder = req_builder.bearer_auth(token.to_owned());
753 };
754
755 let req = req_builder.build()?;
756 let resp = configuration.client.execute(req).await?;
757
758 let status = resp.status();
759 let content_type = resp
760 .headers()
761 .get("content-type")
762 .and_then(|v| v.to_str().ok())
763 .unwrap_or("application/octet-stream");
764 let content_type = super::ContentType::from(content_type);
765
766 if !status.is_client_error() && !status.is_server_error() {
767 let content = resp.text().await?;
768 match content_type {
769 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
770 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::OrganizationListResponse`"))),
771 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::OrganizationListResponse`")))),
772 }
773 } else {
774 let content = resp.text().await?;
775 let entity: Option<ListMyOrganizationsError> = serde_json::from_str(&content).ok();
776 Err(Error::ResponseError(ResponseContent { status, content, entity }))
777 }
778}
779
780pub async fn list_organization_audit_log(configuration: &configuration::Configuration, org: &str, limit: Option<i32>, cursor: Option<&str>) -> Result<std::collections::HashMap<String, serde_json::Value>, Error<ListOrganizationAuditLogError>> {
781 let p_path_org = org;
783 let p_query_limit = limit;
784 let p_query_cursor = cursor;
785
786 let uri_str = format!("{}/v1/organizations/{org}/audit-log", configuration.base_path, org=crate::apis::urlencode(p_path_org));
787 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
788
789 if let Some(ref param_value) = p_query_limit {
790 req_builder = req_builder.query(&[("limit", ¶m_value.to_string())]);
791 }
792 if let Some(ref param_value) = p_query_cursor {
793 req_builder = req_builder.query(&[("cursor", ¶m_value.to_string())]);
794 }
795 if let Some(ref user_agent) = configuration.user_agent {
796 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
797 }
798 if let Some(ref token) = configuration.bearer_access_token {
799 req_builder = req_builder.bearer_auth(token.to_owned());
800 };
801
802 let req = req_builder.build()?;
803 let resp = configuration.client.execute(req).await?;
804
805 let status = resp.status();
806 let content_type = resp
807 .headers()
808 .get("content-type")
809 .and_then(|v| v.to_str().ok())
810 .unwrap_or("application/octet-stream");
811 let content_type = super::ContentType::from(content_type);
812
813 if !status.is_client_error() && !status.is_server_error() {
814 let content = resp.text().await?;
815 match content_type {
816 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
817 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>`"))),
818 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>`")))),
819 }
820 } else {
821 let content = resp.text().await?;
822 let entity: Option<ListOrganizationAuditLogError> = serde_json::from_str(&content).ok();
823 Err(Error::ResponseError(ResponseContent { status, content, entity }))
824 }
825}
826
827pub async fn list_organization_concepts(configuration: &configuration::Configuration, org: &str) -> Result<std::collections::HashMap<String, serde_json::Value>, Error<ListOrganizationConceptsError>> {
828 let p_path_org = org;
830
831 let uri_str = format!("{}/v1/organizations/{org}/concepts", configuration.base_path, org=crate::apis::urlencode(p_path_org));
832 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
833
834 if let Some(ref user_agent) = configuration.user_agent {
835 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
836 }
837 if let Some(ref token) = configuration.bearer_access_token {
838 req_builder = req_builder.bearer_auth(token.to_owned());
839 };
840
841 let req = req_builder.build()?;
842 let resp = configuration.client.execute(req).await?;
843
844 let status = resp.status();
845 let content_type = resp
846 .headers()
847 .get("content-type")
848 .and_then(|v| v.to_str().ok())
849 .unwrap_or("application/octet-stream");
850 let content_type = super::ContentType::from(content_type);
851
852 if !status.is_client_error() && !status.is_server_error() {
853 let content = resp.text().await?;
854 match content_type {
855 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
856 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>`"))),
857 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>`")))),
858 }
859 } else {
860 let content = resp.text().await?;
861 let entity: Option<ListOrganizationConceptsError> = serde_json::from_str(&content).ok();
862 Err(Error::ResponseError(ResponseContent { status, content, entity }))
863 }
864}
865
866pub async fn list_organization_custom_roles(configuration: &configuration::Configuration, org: &str) -> Result<std::collections::HashMap<String, serde_json::Value>, Error<ListOrganizationCustomRolesError>> {
867 let p_path_org = org;
869
870 let uri_str = format!("{}/v1/organizations/{org}/roles", configuration.base_path, org=crate::apis::urlencode(p_path_org));
871 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
872
873 if let Some(ref user_agent) = configuration.user_agent {
874 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
875 }
876 if let Some(ref token) = configuration.bearer_access_token {
877 req_builder = req_builder.bearer_auth(token.to_owned());
878 };
879
880 let req = req_builder.build()?;
881 let resp = configuration.client.execute(req).await?;
882
883 let status = resp.status();
884 let content_type = resp
885 .headers()
886 .get("content-type")
887 .and_then(|v| v.to_str().ok())
888 .unwrap_or("application/octet-stream");
889 let content_type = super::ContentType::from(content_type);
890
891 if !status.is_client_error() && !status.is_server_error() {
892 let content = resp.text().await?;
893 match content_type {
894 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
895 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>`"))),
896 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>`")))),
897 }
898 } else {
899 let content = resp.text().await?;
900 let entity: Option<ListOrganizationCustomRolesError> = serde_json::from_str(&content).ok();
901 Err(Error::ResponseError(ResponseContent { status, content, entity }))
902 }
903}
904
905pub async fn list_organization_invitations(configuration: &configuration::Configuration, org: &str) -> Result<models::OrganizationInvitationListResponse, Error<ListOrganizationInvitationsError>> {
906 let p_path_org = org;
908
909 let uri_str = format!("{}/v1/organizations/{org}/invitations", configuration.base_path, org=crate::apis::urlencode(p_path_org));
910 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
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 if let Some(ref token) = configuration.bearer_access_token {
916 req_builder = req_builder.bearer_auth(token.to_owned());
917 };
918
919 let req = req_builder.build()?;
920 let resp = configuration.client.execute(req).await?;
921
922 let status = resp.status();
923 let content_type = resp
924 .headers()
925 .get("content-type")
926 .and_then(|v| v.to_str().ok())
927 .unwrap_or("application/octet-stream");
928 let content_type = super::ContentType::from(content_type);
929
930 if !status.is_client_error() && !status.is_server_error() {
931 let content = resp.text().await?;
932 match content_type {
933 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
934 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::OrganizationInvitationListResponse`"))),
935 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::OrganizationInvitationListResponse`")))),
936 }
937 } else {
938 let content = resp.text().await?;
939 let entity: Option<ListOrganizationInvitationsError> = serde_json::from_str(&content).ok();
940 Err(Error::ResponseError(ResponseContent { status, content, entity }))
941 }
942}
943
944pub async fn list_organization_members(configuration: &configuration::Configuration, org: &str) -> Result<models::OrganizationMemberListResponse, Error<ListOrganizationMembersError>> {
945 let p_path_org = org;
947
948 let uri_str = format!("{}/v1/organizations/{org}/members", configuration.base_path, org=crate::apis::urlencode(p_path_org));
949 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
950
951 if let Some(ref user_agent) = configuration.user_agent {
952 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
953 }
954 if let Some(ref token) = configuration.bearer_access_token {
955 req_builder = req_builder.bearer_auth(token.to_owned());
956 };
957
958 let req = req_builder.build()?;
959 let resp = configuration.client.execute(req).await?;
960
961 let status = resp.status();
962 let content_type = resp
963 .headers()
964 .get("content-type")
965 .and_then(|v| v.to_str().ok())
966 .unwrap_or("application/octet-stream");
967 let content_type = super::ContentType::from(content_type);
968
969 if !status.is_client_error() && !status.is_server_error() {
970 let content = resp.text().await?;
971 match content_type {
972 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
973 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::OrganizationMemberListResponse`"))),
974 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::OrganizationMemberListResponse`")))),
975 }
976 } else {
977 let content = resp.text().await?;
978 let entity: Option<ListOrganizationMembersError> = serde_json::from_str(&content).ok();
979 Err(Error::ResponseError(ResponseContent { status, content, entity }))
980 }
981}
982
983pub async fn list_organization_workspaces(configuration: &configuration::Configuration, org: &str) -> Result<models::WorkspaceListResponse, Error<ListOrganizationWorkspacesError>> {
984 let p_path_org = org;
986
987 let uri_str = format!("{}/v1/organizations/{org}/workspaces", configuration.base_path, org=crate::apis::urlencode(p_path_org));
988 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
989
990 if let Some(ref user_agent) = configuration.user_agent {
991 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
992 }
993 if let Some(ref token) = configuration.bearer_access_token {
994 req_builder = req_builder.bearer_auth(token.to_owned());
995 };
996
997 let req = req_builder.build()?;
998 let resp = configuration.client.execute(req).await?;
999
1000 let status = resp.status();
1001 let content_type = resp
1002 .headers()
1003 .get("content-type")
1004 .and_then(|v| v.to_str().ok())
1005 .unwrap_or("application/octet-stream");
1006 let content_type = super::ContentType::from(content_type);
1007
1008 if !status.is_client_error() && !status.is_server_error() {
1009 let content = resp.text().await?;
1010 match content_type {
1011 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1012 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::WorkspaceListResponse`"))),
1013 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::WorkspaceListResponse`")))),
1014 }
1015 } else {
1016 let content = resp.text().await?;
1017 let entity: Option<ListOrganizationWorkspacesError> = serde_json::from_str(&content).ok();
1018 Err(Error::ResponseError(ResponseContent { status, content, entity }))
1019 }
1020}
1021
1022pub async fn remove_organization_member(configuration: &configuration::Configuration, org: &str, member_id: &str) -> Result<(), Error<RemoveOrganizationMemberError>> {
1023 let p_path_org = org;
1025 let p_path_member_id = member_id;
1026
1027 let uri_str = format!("{}/v1/organizations/{org}/members/{memberId}", configuration.base_path, org=crate::apis::urlencode(p_path_org), memberId=crate::apis::urlencode(p_path_member_id));
1028 let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str);
1029
1030 if let Some(ref user_agent) = configuration.user_agent {
1031 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1032 }
1033 if let Some(ref token) = configuration.bearer_access_token {
1034 req_builder = req_builder.bearer_auth(token.to_owned());
1035 };
1036
1037 let req = req_builder.build()?;
1038 let resp = configuration.client.execute(req).await?;
1039
1040 let status = resp.status();
1041
1042 if !status.is_client_error() && !status.is_server_error() {
1043 Ok(())
1044 } else {
1045 let content = resp.text().await?;
1046 let entity: Option<RemoveOrganizationMemberError> = serde_json::from_str(&content).ok();
1047 Err(Error::ResponseError(ResponseContent { status, content, entity }))
1048 }
1049}
1050
1051pub async fn resend_organization_invitation(configuration: &configuration::Configuration, org: &str, invitation_id: &str) -> Result<models::OrganizationInvitation, Error<ResendOrganizationInvitationError>> {
1052 let p_path_org = org;
1054 let p_path_invitation_id = invitation_id;
1055
1056 let uri_str = format!("{}/v1/organizations/{org}/invitations/{invitationId}/resend", configuration.base_path, org=crate::apis::urlencode(p_path_org), invitationId=crate::apis::urlencode(p_path_invitation_id));
1057 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
1058
1059 if let Some(ref user_agent) = configuration.user_agent {
1060 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1061 }
1062 if let Some(ref token) = configuration.bearer_access_token {
1063 req_builder = req_builder.bearer_auth(token.to_owned());
1064 };
1065
1066 let req = req_builder.build()?;
1067 let resp = configuration.client.execute(req).await?;
1068
1069 let status = resp.status();
1070 let content_type = resp
1071 .headers()
1072 .get("content-type")
1073 .and_then(|v| v.to_str().ok())
1074 .unwrap_or("application/octet-stream");
1075 let content_type = super::ContentType::from(content_type);
1076
1077 if !status.is_client_error() && !status.is_server_error() {
1078 let content = resp.text().await?;
1079 match content_type {
1080 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1081 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::OrganizationInvitation`"))),
1082 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::OrganizationInvitation`")))),
1083 }
1084 } else {
1085 let content = resp.text().await?;
1086 let entity: Option<ResendOrganizationInvitationError> = serde_json::from_str(&content).ok();
1087 Err(Error::ResponseError(ResponseContent { status, content, entity }))
1088 }
1089}
1090
1091pub async fn revoke_organization_invitation(configuration: &configuration::Configuration, org: &str, invitation_id: &str) -> Result<(), Error<RevokeOrganizationInvitationError>> {
1092 let p_path_org = org;
1094 let p_path_invitation_id = invitation_id;
1095
1096 let uri_str = format!("{}/v1/organizations/{org}/invitations/{invitationId}", configuration.base_path, org=crate::apis::urlencode(p_path_org), invitationId=crate::apis::urlencode(p_path_invitation_id));
1097 let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str);
1098
1099 if let Some(ref user_agent) = configuration.user_agent {
1100 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
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
1111 if !status.is_client_error() && !status.is_server_error() {
1112 Ok(())
1113 } else {
1114 let content = resp.text().await?;
1115 let entity: Option<RevokeOrganizationInvitationError> = serde_json::from_str(&content).ok();
1116 Err(Error::ResponseError(ResponseContent { status, content, entity }))
1117 }
1118}
1119
1120pub async fn update_organization(configuration: &configuration::Configuration, org: &str, update_organization_request: models::UpdateOrganizationRequest) -> Result<std::collections::HashMap<String, serde_json::Value>, Error<UpdateOrganizationError>> {
1121 let p_path_org = org;
1123 let p_body_update_organization_request = update_organization_request;
1124
1125 let uri_str = format!("{}/v1/organizations/{org}", configuration.base_path, org=crate::apis::urlencode(p_path_org));
1126 let mut req_builder = configuration.client.request(reqwest::Method::PATCH, &uri_str);
1127
1128 if let Some(ref user_agent) = configuration.user_agent {
1129 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1130 }
1131 if let Some(ref token) = configuration.bearer_access_token {
1132 req_builder = req_builder.bearer_auth(token.to_owned());
1133 };
1134 req_builder = req_builder.json(&p_body_update_organization_request);
1135
1136 let req = req_builder.build()?;
1137 let resp = configuration.client.execute(req).await?;
1138
1139 let status = resp.status();
1140 let content_type = resp
1141 .headers()
1142 .get("content-type")
1143 .and_then(|v| v.to_str().ok())
1144 .unwrap_or("application/octet-stream");
1145 let content_type = super::ContentType::from(content_type);
1146
1147 if !status.is_client_error() && !status.is_server_error() {
1148 let content = resp.text().await?;
1149 match content_type {
1150 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1151 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>`"))),
1152 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>`")))),
1153 }
1154 } else {
1155 let content = resp.text().await?;
1156 let entity: Option<UpdateOrganizationError> = serde_json::from_str(&content).ok();
1157 Err(Error::ResponseError(ResponseContent { status, content, entity }))
1158 }
1159}
1160
1161pub async fn update_organization_concept(configuration: &configuration::Configuration, org: &str, slug: &str, request_body: std::collections::HashMap<String, serde_json::Value>) -> Result<std::collections::HashMap<String, serde_json::Value>, Error<UpdateOrganizationConceptError>> {
1162 let p_path_org = org;
1164 let p_path_slug = slug;
1165 let p_body_request_body = request_body;
1166
1167 let uri_str = format!("{}/v1/organizations/{org}/concepts/{slug}", configuration.base_path, org=crate::apis::urlencode(p_path_org), slug=crate::apis::urlencode(p_path_slug));
1168 let mut req_builder = configuration.client.request(reqwest::Method::PATCH, &uri_str);
1169
1170 if let Some(ref user_agent) = configuration.user_agent {
1171 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1172 }
1173 if let Some(ref token) = configuration.bearer_access_token {
1174 req_builder = req_builder.bearer_auth(token.to_owned());
1175 };
1176 req_builder = req_builder.json(&p_body_request_body);
1177
1178 let req = req_builder.build()?;
1179 let resp = configuration.client.execute(req).await?;
1180
1181 let status = resp.status();
1182 let content_type = resp
1183 .headers()
1184 .get("content-type")
1185 .and_then(|v| v.to_str().ok())
1186 .unwrap_or("application/octet-stream");
1187 let content_type = super::ContentType::from(content_type);
1188
1189 if !status.is_client_error() && !status.is_server_error() {
1190 let content = resp.text().await?;
1191 match content_type {
1192 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1193 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>`"))),
1194 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>`")))),
1195 }
1196 } else {
1197 let content = resp.text().await?;
1198 let entity: Option<UpdateOrganizationConceptError> = serde_json::from_str(&content).ok();
1199 Err(Error::ResponseError(ResponseContent { status, content, entity }))
1200 }
1201}
1202
1203pub async fn update_organization_custom_role(configuration: &configuration::Configuration, org: &str, role_id: &str, request_body: std::collections::HashMap<String, serde_json::Value>) -> Result<std::collections::HashMap<String, serde_json::Value>, Error<UpdateOrganizationCustomRoleError>> {
1204 let p_path_org = org;
1206 let p_path_role_id = role_id;
1207 let p_body_request_body = request_body;
1208
1209 let uri_str = format!("{}/v1/organizations/{org}/roles/{roleId}", configuration.base_path, org=crate::apis::urlencode(p_path_org), roleId=crate::apis::urlencode(p_path_role_id));
1210 let mut req_builder = configuration.client.request(reqwest::Method::PATCH, &uri_str);
1211
1212 if let Some(ref user_agent) = configuration.user_agent {
1213 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1214 }
1215 if let Some(ref token) = configuration.bearer_access_token {
1216 req_builder = req_builder.bearer_auth(token.to_owned());
1217 };
1218 req_builder = req_builder.json(&p_body_request_body);
1219
1220 let req = req_builder.build()?;
1221 let resp = configuration.client.execute(req).await?;
1222
1223 let status = resp.status();
1224 let content_type = resp
1225 .headers()
1226 .get("content-type")
1227 .and_then(|v| v.to_str().ok())
1228 .unwrap_or("application/octet-stream");
1229 let content_type = super::ContentType::from(content_type);
1230
1231 if !status.is_client_error() && !status.is_server_error() {
1232 let content = resp.text().await?;
1233 match content_type {
1234 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1235 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>`"))),
1236 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>`")))),
1237 }
1238 } else {
1239 let content = resp.text().await?;
1240 let entity: Option<UpdateOrganizationCustomRoleError> = serde_json::from_str(&content).ok();
1241 Err(Error::ResponseError(ResponseContent { status, content, entity }))
1242 }
1243}
1244
1245pub async fn update_organization_member(configuration: &configuration::Configuration, org: &str, member_id: &str, update_organization_member_request: models::UpdateOrganizationMemberRequest) -> Result<std::collections::HashMap<String, serde_json::Value>, Error<UpdateOrganizationMemberError>> {
1246 let p_path_org = org;
1248 let p_path_member_id = member_id;
1249 let p_body_update_organization_member_request = update_organization_member_request;
1250
1251 let uri_str = format!("{}/v1/organizations/{org}/members/{memberId}", configuration.base_path, org=crate::apis::urlencode(p_path_org), memberId=crate::apis::urlencode(p_path_member_id));
1252 let mut req_builder = configuration.client.request(reqwest::Method::PATCH, &uri_str);
1253
1254 if let Some(ref user_agent) = configuration.user_agent {
1255 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1256 }
1257 if let Some(ref token) = configuration.bearer_access_token {
1258 req_builder = req_builder.bearer_auth(token.to_owned());
1259 };
1260 req_builder = req_builder.json(&p_body_update_organization_member_request);
1261
1262 let req = req_builder.build()?;
1263 let resp = configuration.client.execute(req).await?;
1264
1265 let status = resp.status();
1266 let content_type = resp
1267 .headers()
1268 .get("content-type")
1269 .and_then(|v| v.to_str().ok())
1270 .unwrap_or("application/octet-stream");
1271 let content_type = super::ContentType::from(content_type);
1272
1273 if !status.is_client_error() && !status.is_server_error() {
1274 let content = resp.text().await?;
1275 match content_type {
1276 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1277 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>`"))),
1278 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>`")))),
1279 }
1280 } else {
1281 let content = resp.text().await?;
1282 let entity: Option<UpdateOrganizationMemberError> = serde_json::from_str(&content).ok();
1283 Err(Error::ResponseError(ResponseContent { status, content, entity }))
1284 }
1285}
1286
1287pub async fn upload_organization_logo(configuration: &configuration::Configuration, org: &str, file: Option<std::path::PathBuf>) -> Result<std::collections::HashMap<String, serde_json::Value>, Error<UploadOrganizationLogoError>> {
1288 let p_path_org = org;
1290 let p_form_file = file;
1291
1292 let uri_str = format!("{}/v1/organizations/{org}/logo", configuration.base_path, org=crate::apis::urlencode(p_path_org));
1293 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
1294
1295 if let Some(ref user_agent) = configuration.user_agent {
1296 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1297 }
1298 if let Some(ref token) = configuration.bearer_access_token {
1299 req_builder = req_builder.bearer_auth(token.to_owned());
1300 };
1301 let mut multipart_form = reqwest::multipart::Form::new();
1302 if let Some(ref param_value) = p_form_file {
1303 let file = TokioFile::open(param_value).await?;
1304 let stream = FramedRead::new(file, BytesCodec::new());
1305 let file_name = param_value.file_name().map(|n| n.to_string_lossy().to_string()).unwrap_or_default();
1306 let file_part = reqwest::multipart::Part::stream(reqwest::Body::wrap_stream(stream)).file_name(file_name);
1307 multipart_form = multipart_form.part("file", file_part);
1308 }
1309 req_builder = req_builder.multipart(multipart_form);
1310
1311 let req = req_builder.build()?;
1312 let resp = configuration.client.execute(req).await?;
1313
1314 let status = resp.status();
1315 let content_type = resp
1316 .headers()
1317 .get("content-type")
1318 .and_then(|v| v.to_str().ok())
1319 .unwrap_or("application/octet-stream");
1320 let content_type = super::ContentType::from(content_type);
1321
1322 if !status.is_client_error() && !status.is_server_error() {
1323 let content = resp.text().await?;
1324 match content_type {
1325 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1326 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>`"))),
1327 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>`")))),
1328 }
1329 } else {
1330 let content = resp.text().await?;
1331 let entity: Option<UploadOrganizationLogoError> = serde_json::from_str(&content).ok();
1332 Err(Error::ResponseError(ResponseContent { status, content, entity }))
1333 }
1334}
1335