bitwarden_api_api/apis/
slack_integration_api.rs1use reqwest;
12use serde::{de::Error as _, Deserialize, Serialize};
13
14use super::{configuration, ContentType, Error};
15use crate::{apis::ResponseContent, models};
16
17#[derive(Debug, Clone, Serialize, Deserialize)]
19#[serde(untagged)]
20pub enum CreateAsyncError {
21 UnknownValue(serde_json::Value),
22}
23
24#[derive(Debug, Clone, Serialize, Deserialize)]
27#[serde(untagged)]
28pub enum OrganizationsOrganizationIdIntegrationsSlackRedirectGetError {
29 UnknownValue(serde_json::Value),
30}
31
32pub async fn create_async(
33 configuration: &configuration::Configuration,
34 organization_id: uuid::Uuid,
35 code: Option<&str>,
36) -> Result<(), Error<CreateAsyncError>> {
37 let p_organization_id = organization_id;
39 let p_code = code;
40
41 let uri_str = format!(
42 "{}/organizations/{organizationId}/integrations/slack/create",
43 configuration.base_path,
44 organizationId = crate::apis::urlencode(p_organization_id.to_string())
45 );
46 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
47
48 if let Some(ref param_value) = p_code {
49 req_builder = req_builder.query(&[("code", ¶m_value.to_string())]);
50 }
51 if let Some(ref user_agent) = configuration.user_agent {
52 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
53 }
54 if let Some(ref token) = configuration.oauth_access_token {
55 req_builder = req_builder.bearer_auth(token.to_owned());
56 };
57
58 let req = req_builder.build()?;
59 let resp = configuration.client.execute(req).await?;
60
61 let status = resp.status();
62
63 if !status.is_client_error() && !status.is_server_error() {
64 Ok(())
65 } else {
66 let content = resp.text().await?;
67 let entity: Option<CreateAsyncError> = serde_json::from_str(&content).ok();
68 Err(Error::ResponseError(ResponseContent {
69 status,
70 content,
71 entity,
72 }))
73 }
74}
75
76pub async fn organizations_organization_id_integrations_slack_redirect_get(
77 configuration: &configuration::Configuration,
78 organization_id: uuid::Uuid,
79) -> Result<(), Error<OrganizationsOrganizationIdIntegrationsSlackRedirectGetError>> {
80 let p_organization_id = organization_id;
82
83 let uri_str = format!(
84 "{}/organizations/{organizationId}/integrations/slack/redirect",
85 configuration.base_path,
86 organizationId = crate::apis::urlencode(p_organization_id.to_string())
87 );
88 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
89
90 if let Some(ref user_agent) = configuration.user_agent {
91 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
92 }
93 if let Some(ref token) = configuration.oauth_access_token {
94 req_builder = req_builder.bearer_auth(token.to_owned());
95 };
96
97 let req = req_builder.build()?;
98 let resp = configuration.client.execute(req).await?;
99
100 let status = resp.status();
101
102 if !status.is_client_error() && !status.is_server_error() {
103 Ok(())
104 } else {
105 let content = resp.text().await?;
106 let entity: Option<OrganizationsOrganizationIdIntegrationsSlackRedirectGetError> =
107 serde_json::from_str(&content).ok();
108 Err(Error::ResponseError(ResponseContent {
109 status,
110 content,
111 entity,
112 }))
113 }
114}