memos_api/apis/
identity_provider_service_api.rs1use reqwest;
13use serde::{Deserialize, Serialize};
14use crate::{apis::ResponseContent, models};
15use super::{Error, configuration};
16
17
18#[derive(Debug, Clone, Serialize, Deserialize)]
20#[serde(untagged)]
21pub enum IdentityProviderServiceCreateIdentityProviderError {
22 DefaultResponse(models::GooglerpcStatus),
23 UnknownValue(serde_json::Value),
24}
25
26#[derive(Debug, Clone, Serialize, Deserialize)]
28#[serde(untagged)]
29pub enum IdentityProviderServiceDeleteIdentityProviderError {
30 DefaultResponse(models::GooglerpcStatus),
31 UnknownValue(serde_json::Value),
32}
33
34#[derive(Debug, Clone, Serialize, Deserialize)]
36#[serde(untagged)]
37pub enum IdentityProviderServiceGetIdentityProviderError {
38 DefaultResponse(models::GooglerpcStatus),
39 UnknownValue(serde_json::Value),
40}
41
42#[derive(Debug, Clone, Serialize, Deserialize)]
44#[serde(untagged)]
45pub enum IdentityProviderServiceListIdentityProvidersError {
46 DefaultResponse(models::GooglerpcStatus),
47 UnknownValue(serde_json::Value),
48}
49
50#[derive(Debug, Clone, Serialize, Deserialize)]
52#[serde(untagged)]
53pub enum IdentityProviderServiceUpdateIdentityProviderError {
54 DefaultResponse(models::GooglerpcStatus),
55 UnknownValue(serde_json::Value),
56}
57
58
59pub fn identity_provider_service_create_identity_provider(configuration: &configuration::Configuration, identity_provider: models::Apiv1IdentityProvider) -> Result<models::Apiv1IdentityProvider, Error<IdentityProviderServiceCreateIdentityProviderError>> {
60 let local_var_configuration = configuration;
61
62 let local_var_client = &local_var_configuration.client;
63
64 let local_var_uri_str = format!("{}/api/v1/identityProviders", local_var_configuration.base_path);
65 let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
66
67 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
68 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
69 }
70 local_var_req_builder = local_var_req_builder.json(&identity_provider);
71
72 let local_var_req = local_var_req_builder.build()?;
73 let local_var_resp = local_var_client.execute(local_var_req)?;
74
75 let local_var_status = local_var_resp.status();
76 let local_var_content = local_var_resp.text()?;
77
78 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
79 serde_json::from_str(&local_var_content).map_err(Error::from)
80 } else {
81 let local_var_entity: Option<IdentityProviderServiceCreateIdentityProviderError> = serde_json::from_str(&local_var_content).ok();
82 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
83 Err(Error::ResponseError(local_var_error))
84 }
85}
86
87pub fn identity_provider_service_delete_identity_provider(configuration: &configuration::Configuration, name_1: &str) -> Result<serde_json::Value, Error<IdentityProviderServiceDeleteIdentityProviderError>> {
88 let local_var_configuration = configuration;
89
90 let local_var_client = &local_var_configuration.client;
91
92 let local_var_uri_str = format!("{}/api/v1/{name_1}", local_var_configuration.base_path, name_1=crate::apis::urlencode(name_1));
93 let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str());
94
95 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
96 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
97 }
98
99 let local_var_req = local_var_req_builder.build()?;
100 let local_var_resp = local_var_client.execute(local_var_req)?;
101
102 let local_var_status = local_var_resp.status();
103 let local_var_content = local_var_resp.text()?;
104
105 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
106 serde_json::from_str(&local_var_content).map_err(Error::from)
107 } else {
108 let local_var_entity: Option<IdentityProviderServiceDeleteIdentityProviderError> = serde_json::from_str(&local_var_content).ok();
109 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
110 Err(Error::ResponseError(local_var_error))
111 }
112}
113
114pub fn identity_provider_service_get_identity_provider(configuration: &configuration::Configuration, name_2: &str) -> Result<models::Apiv1IdentityProvider, Error<IdentityProviderServiceGetIdentityProviderError>> {
115 let local_var_configuration = configuration;
116
117 let local_var_client = &local_var_configuration.client;
118
119 let local_var_uri_str = format!("{}/api/v1/{name_2}", local_var_configuration.base_path, name_2=crate::apis::urlencode(name_2));
120 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
121
122 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
123 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
124 }
125
126 let local_var_req = local_var_req_builder.build()?;
127 let local_var_resp = local_var_client.execute(local_var_req)?;
128
129 let local_var_status = local_var_resp.status();
130 let local_var_content = local_var_resp.text()?;
131
132 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
133 serde_json::from_str(&local_var_content).map_err(Error::from)
134 } else {
135 let local_var_entity: Option<IdentityProviderServiceGetIdentityProviderError> = serde_json::from_str(&local_var_content).ok();
136 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
137 Err(Error::ResponseError(local_var_error))
138 }
139}
140
141pub fn identity_provider_service_list_identity_providers(configuration: &configuration::Configuration, ) -> Result<models::V1ListIdentityProvidersResponse, Error<IdentityProviderServiceListIdentityProvidersError>> {
142 let local_var_configuration = configuration;
143
144 let local_var_client = &local_var_configuration.client;
145
146 let local_var_uri_str = format!("{}/api/v1/identityProviders", local_var_configuration.base_path);
147 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
148
149 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
150 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
151 }
152
153 let local_var_req = local_var_req_builder.build()?;
154 let local_var_resp = local_var_client.execute(local_var_req)?;
155
156 let local_var_status = local_var_resp.status();
157 let local_var_content = local_var_resp.text()?;
158
159 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
160 serde_json::from_str(&local_var_content).map_err(Error::from)
161 } else {
162 let local_var_entity: Option<IdentityProviderServiceListIdentityProvidersError> = serde_json::from_str(&local_var_content).ok();
163 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
164 Err(Error::ResponseError(local_var_error))
165 }
166}
167
168pub fn identity_provider_service_update_identity_provider(configuration: &configuration::Configuration, identity_provider_name: &str, identity_provider: models::TheIdentityProviderToUpdate) -> Result<models::Apiv1IdentityProvider, Error<IdentityProviderServiceUpdateIdentityProviderError>> {
169 let local_var_configuration = configuration;
170
171 let local_var_client = &local_var_configuration.client;
172
173 let local_var_uri_str = format!("{}/api/v1/{identityProvider_name}", local_var_configuration.base_path, identityProvider_name=crate::apis::urlencode(identity_provider_name));
174 let mut local_var_req_builder = local_var_client.request(reqwest::Method::PATCH, local_var_uri_str.as_str());
175
176 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
177 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
178 }
179 local_var_req_builder = local_var_req_builder.json(&identity_provider);
180
181 let local_var_req = local_var_req_builder.build()?;
182 let local_var_resp = local_var_client.execute(local_var_req)?;
183
184 let local_var_status = local_var_resp.status();
185 let local_var_content = local_var_resp.text()?;
186
187 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
188 serde_json::from_str(&local_var_content).map_err(Error::from)
189 } else {
190 let local_var_entity: Option<IdentityProviderServiceUpdateIdentityProviderError> = serde_json::from_str(&local_var_content).ok();
191 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
192 Err(Error::ResponseError(local_var_error))
193 }
194}
195