Skip to main content

windmill_api/apis/
git_sync_api.rs

1/*
2 * Windmill API
3 *
4 * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
5 *
6 * The version of the OpenAPI document: 1.806.0
7 * Contact: contact@windmill.dev
8 * Generated by: https://openapi-generator.tech
9 */
10
11
12use reqwest;
13use serde::{Deserialize, Serialize};
14use crate::{apis::ResponseContent, models};
15use super::{Error, configuration};
16
17
18/// struct for typed errors of method [`assign_ghes_installation`]
19#[derive(Debug, Clone, Serialize, Deserialize)]
20#[serde(untagged)]
21pub enum AssignGhesInstallationError {
22    UnknownValue(serde_json::Value),
23}
24
25/// struct for typed errors of method [`delete_from_workspace`]
26#[derive(Debug, Clone, Serialize, Deserialize)]
27#[serde(untagged)]
28pub enum DeleteFromWorkspaceError {
29    UnknownValue(serde_json::Value),
30}
31
32/// struct for typed errors of method [`discover_ghes_installations`]
33#[derive(Debug, Clone, Serialize, Deserialize)]
34#[serde(untagged)]
35pub enum DiscoverGhesInstallationsError {
36    UnknownValue(serde_json::Value),
37}
38
39/// struct for typed errors of method [`export_installation`]
40#[derive(Debug, Clone, Serialize, Deserialize)]
41#[serde(untagged)]
42pub enum ExportInstallationError {
43    UnknownValue(serde_json::Value),
44}
45
46/// struct for typed errors of method [`get_credential_origin`]
47#[derive(Debug, Clone, Serialize, Deserialize)]
48#[serde(untagged)]
49pub enum GetCredentialOriginError {
50    UnknownValue(serde_json::Value),
51}
52
53/// struct for typed errors of method [`get_ghes_config`]
54#[derive(Debug, Clone, Serialize, Deserialize)]
55#[serde(untagged)]
56pub enum GetGhesConfigError {
57    UnknownValue(serde_json::Value),
58}
59
60/// struct for typed errors of method [`get_global_connected_repositories`]
61#[derive(Debug, Clone, Serialize, Deserialize)]
62#[serde(untagged)]
63pub enum GetGlobalConnectedRepositoriesError {
64    UnknownValue(serde_json::Value),
65}
66
67/// struct for typed errors of method [`ghes_installation_callback`]
68#[derive(Debug, Clone, Serialize, Deserialize)]
69#[serde(untagged)]
70pub enum GhesInstallationCallbackError {
71    UnknownValue(serde_json::Value),
72}
73
74/// struct for typed errors of method [`import_installation`]
75#[derive(Debug, Clone, Serialize, Deserialize)]
76#[serde(untagged)]
77pub enum ImportInstallationError {
78    UnknownValue(serde_json::Value),
79}
80
81/// struct for typed errors of method [`install_from_workspace`]
82#[derive(Debug, Clone, Serialize, Deserialize)]
83#[serde(untagged)]
84pub enum InstallFromWorkspaceError {
85    UnknownValue(serde_json::Value),
86}
87
88/// struct for typed errors of method [`list_gitlab_projects`]
89#[derive(Debug, Clone, Serialize, Deserialize)]
90#[serde(untagged)]
91pub enum ListGitlabProjectsError {
92    UnknownValue(serde_json::Value),
93}
94
95/// struct for typed errors of method [`set_git_credential`]
96#[derive(Debug, Clone, Serialize, Deserialize)]
97#[serde(untagged)]
98pub enum SetGitCredentialError {
99    UnknownValue(serde_json::Value),
100}
101
102/// struct for typed errors of method [`unassign_ghes_installation`]
103#[derive(Debug, Clone, Serialize, Deserialize)]
104#[serde(untagged)]
105pub enum UnassignGhesInstallationError {
106    UnknownValue(serde_json::Value),
107}
108
109
110/// Assigns a discovered GHES App installation to a workspace. The resulting installation is marked as admin-provisioned, so workspace admins cannot remove it. Super-admin only. 
111pub async fn assign_ghes_installation(configuration: &configuration::Configuration, assign_ghes_installation_request: models::AssignGhesInstallationRequest) -> Result<(), Error<AssignGhesInstallationError>> {
112    let local_var_configuration = configuration;
113
114    let local_var_client = &local_var_configuration.client;
115
116    let local_var_uri_str = format!("{}/github_app/ghes/assign", local_var_configuration.base_path);
117    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
118
119    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
120        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
121    }
122    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
123        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
124    };
125    local_var_req_builder = local_var_req_builder.json(&assign_ghes_installation_request);
126
127    let local_var_req = local_var_req_builder.build()?;
128    let local_var_resp = local_var_client.execute(local_var_req).await?;
129
130    let local_var_status = local_var_resp.status();
131    let local_var_content = local_var_resp.text().await?;
132
133    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
134        Ok(())
135    } else {
136        let local_var_entity: Option<AssignGhesInstallationError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
137        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
138        Err(Error::ResponseError(local_var_error))
139    }
140}
141
142/// Removes a GitHub installation from the specified workspace. Requires admin privileges.
143pub async fn delete_from_workspace(configuration: &configuration::Configuration, workspace: &str, installation_id: i64) -> Result<(), Error<DeleteFromWorkspaceError>> {
144    let local_var_configuration = configuration;
145
146    let local_var_client = &local_var_configuration.client;
147
148    let local_var_uri_str = format!("{}/w/{workspace}/github_app/installation/{installation_id}", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace), installation_id=installation_id);
149    let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str());
150
151    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
152        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
153    }
154    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
155        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
156    };
157
158    let local_var_req = local_var_req_builder.build()?;
159    let local_var_resp = local_var_client.execute(local_var_req).await?;
160
161    let local_var_status = local_var_resp.status();
162    let local_var_content = local_var_resp.text().await?;
163
164    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
165        Ok(())
166    } else {
167        let local_var_entity: Option<DeleteFromWorkspaceError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
168        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
169        Err(Error::ResponseError(local_var_error))
170    }
171}
172
173/// Lists every installation the configured self-managed GitHub App can see, annotated with the workspaces in this Windmill instance the installation is currently assigned to. Super-admin only. 
174pub async fn discover_ghes_installations(configuration: &configuration::Configuration, ) -> Result<Vec<models::DiscoverGhesInstallations200ResponseInner>, Error<DiscoverGhesInstallationsError>> {
175    let local_var_configuration = configuration;
176
177    let local_var_client = &local_var_configuration.client;
178
179    let local_var_uri_str = format!("{}/github_app/ghes/discover", local_var_configuration.base_path);
180    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
181
182    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
183        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
184    }
185    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
186        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
187    };
188
189    let local_var_req = local_var_req_builder.build()?;
190    let local_var_resp = local_var_client.execute(local_var_req).await?;
191
192    let local_var_status = local_var_resp.status();
193    let local_var_content = local_var_resp.text().await?;
194
195    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
196        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
197    } else {
198        let local_var_entity: Option<DiscoverGhesInstallationsError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
199        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
200        Err(Error::ResponseError(local_var_error))
201    }
202}
203
204/// Exports the JWT token for a specific GitHub installation in the workspace
205pub async fn export_installation(configuration: &configuration::Configuration, workspace: &str, installation_id: i32) -> Result<models::ExportInstallation200Response, Error<ExportInstallationError>> {
206    let local_var_configuration = configuration;
207
208    let local_var_client = &local_var_configuration.client;
209
210    let local_var_uri_str = format!("{}/w/{workspace}/github_app/export/{installationId}", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace), installationId=installation_id);
211    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
212
213    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
214        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
215    }
216    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
217        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
218    };
219
220    let local_var_req = local_var_req_builder.build()?;
221    let local_var_resp = local_var_client.execute(local_var_req).await?;
222
223    let local_var_status = local_var_resp.status();
224    let local_var_content = local_var_resp.text().await?;
225
226    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
227        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
228    } else {
229        let local_var_entity: Option<ExportInstallationError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
230        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
231        Err(Error::ResponseError(local_var_error))
232    }
233}
234
235/// Whether Windmill holds this repository's access token, and which host it talks to. `held` means this workspace stores it, `borrowed` means an ancestor does and it is not this workspace's to replace. Both absent means the repository authenticates with whatever its URL carries. Returns no secret. Requires workspace admin.
236pub async fn get_credential_origin(configuration: &configuration::Configuration, workspace: &str, path: &str) -> Result<models::GetCredentialOrigin200Response, Error<GetCredentialOriginError>> {
237    let local_var_configuration = configuration;
238
239    let local_var_client = &local_var_configuration.client;
240
241    let local_var_uri_str = format!("{}/w/{workspace}/git_sync/credential/origin", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace));
242    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
243
244    local_var_req_builder = local_var_req_builder.query(&[("path", &path.to_string())]);
245    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
246        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
247    }
248    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
249        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
250    };
251
252    let local_var_req = local_var_req_builder.build()?;
253    let local_var_resp = local_var_client.execute(local_var_req).await?;
254
255    let local_var_status = local_var_resp.status();
256    let local_var_content = local_var_resp.text().await?;
257
258    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
259        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
260    } else {
261        let local_var_entity: Option<GetCredentialOriginError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
262        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
263        Err(Error::ResponseError(local_var_error))
264    }
265}
266
267/// Returns the GitHub Enterprise Server app configuration (without private key) for constructing the installation URL
268pub async fn get_ghes_config(configuration: &configuration::Configuration, ) -> Result<models::GetGhesConfig200Response, Error<GetGhesConfigError>> {
269    let local_var_configuration = configuration;
270
271    let local_var_client = &local_var_configuration.client;
272
273    let local_var_uri_str = format!("{}/github_app/ghes_config", local_var_configuration.base_path);
274    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
275
276    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
277        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
278    }
279    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
280        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
281    };
282
283    let local_var_req = local_var_req_builder.build()?;
284    let local_var_resp = local_var_client.execute(local_var_req).await?;
285
286    let local_var_status = local_var_resp.status();
287    let local_var_content = local_var_resp.text().await?;
288
289    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
290        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
291    } else {
292        let local_var_entity: Option<GetGhesConfigError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
293        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
294        Err(Error::ResponseError(local_var_error))
295    }
296}
297
298pub async fn get_global_connected_repositories(configuration: &configuration::Configuration, page: Option<i32>) -> Result<Vec<models::GithubInstallationsInner>, Error<GetGlobalConnectedRepositoriesError>> {
299    let local_var_configuration = configuration;
300
301    let local_var_client = &local_var_configuration.client;
302
303    let local_var_uri_str = format!("{}/github_app/connected_repositories", local_var_configuration.base_path);
304    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
305
306    if let Some(ref local_var_str) = page {
307        local_var_req_builder = local_var_req_builder.query(&[("page", &local_var_str.to_string())]);
308    }
309    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
310        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
311    }
312    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
313        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
314    };
315
316    let local_var_req = local_var_req_builder.build()?;
317    let local_var_resp = local_var_client.execute(local_var_req).await?;
318
319    let local_var_status = local_var_resp.status();
320    let local_var_content = local_var_resp.text().await?;
321
322    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
323        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
324    } else {
325        let local_var_entity: Option<GetGlobalConnectedRepositoriesError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
326        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
327        Err(Error::ResponseError(local_var_error))
328    }
329}
330
331/// Register a self-managed GitHub App installation from GitHub Enterprise Server
332pub async fn ghes_installation_callback(configuration: &configuration::Configuration, workspace: &str, ghes_installation_callback_request: models::GhesInstallationCallbackRequest) -> Result<(), Error<GhesInstallationCallbackError>> {
333    let local_var_configuration = configuration;
334
335    let local_var_client = &local_var_configuration.client;
336
337    let local_var_uri_str = format!("{}/w/{workspace}/github_app/ghes_installation_callback", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace));
338    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
339
340    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
341        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
342    }
343    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
344        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
345    };
346    local_var_req_builder = local_var_req_builder.json(&ghes_installation_callback_request);
347
348    let local_var_req = local_var_req_builder.build()?;
349    let local_var_resp = local_var_client.execute(local_var_req).await?;
350
351    let local_var_status = local_var_resp.status();
352    let local_var_content = local_var_resp.text().await?;
353
354    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
355        Ok(())
356    } else {
357        let local_var_entity: Option<GhesInstallationCallbackError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
358        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
359        Err(Error::ResponseError(local_var_error))
360    }
361}
362
363/// Imports a GitHub installation from a JWT token exported from another instance
364pub async fn import_installation(configuration: &configuration::Configuration, workspace: &str, import_installation_request: models::ImportInstallationRequest) -> Result<(), Error<ImportInstallationError>> {
365    let local_var_configuration = configuration;
366
367    let local_var_client = &local_var_configuration.client;
368
369    let local_var_uri_str = format!("{}/w/{workspace}/github_app/import", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace));
370    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
371
372    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
373        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
374    }
375    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
376        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
377    };
378    local_var_req_builder = local_var_req_builder.json(&import_installation_request);
379
380    let local_var_req = local_var_req_builder.build()?;
381    let local_var_resp = local_var_client.execute(local_var_req).await?;
382
383    let local_var_status = local_var_resp.status();
384    let local_var_content = local_var_resp.text().await?;
385
386    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
387        Ok(())
388    } else {
389        let local_var_entity: Option<ImportInstallationError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
390        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
391        Err(Error::ResponseError(local_var_error))
392    }
393}
394
395pub async fn install_from_workspace(configuration: &configuration::Configuration, workspace: &str, install_from_workspace_request: models::InstallFromWorkspaceRequest) -> Result<(), Error<InstallFromWorkspaceError>> {
396    let local_var_configuration = configuration;
397
398    let local_var_client = &local_var_configuration.client;
399
400    let local_var_uri_str = format!("{}/w/{workspace}/github_app/install_from_workspace", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace));
401    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
402
403    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
404        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
405    }
406    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
407        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
408    };
409    local_var_req_builder = local_var_req_builder.json(&install_from_workspace_request);
410
411    let local_var_req = local_var_req_builder.build()?;
412    let local_var_resp = local_var_client.execute(local_var_req).await?;
413
414    let local_var_status = local_var_resp.status();
415    let local_var_content = local_var_resp.text().await?;
416
417    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
418        Ok(())
419    } else {
420        let local_var_entity: Option<InstallFromWorkspaceError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
421        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
422        Err(Error::ResponseError(local_var_error))
423    }
424}
425
426/// Lists the projects the supplied GitLab token can push to, so a git repository resource can be filled in without hand-writing a project path. The token is used for this call only and is never stored. Requires workspace admin.
427pub async fn list_gitlab_projects(configuration: &configuration::Configuration, workspace: &str, list_gitlab_projects_request: models::ListGitlabProjectsRequest) -> Result<Vec<models::GitlabProject>, Error<ListGitlabProjectsError>> {
428    let local_var_configuration = configuration;
429
430    let local_var_client = &local_var_configuration.client;
431
432    let local_var_uri_str = format!("{}/w/{workspace}/git_sync/gitlab/projects", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace));
433    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
434
435    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
436        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
437    }
438    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
439        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
440    };
441    local_var_req_builder = local_var_req_builder.json(&list_gitlab_projects_request);
442
443    let local_var_req = local_var_req_builder.build()?;
444    let local_var_resp = local_var_client.execute(local_var_req).await?;
445
446    let local_var_status = local_var_resp.status();
447    let local_var_content = local_var_resp.text().await?;
448
449    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
450        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
451    } else {
452        let local_var_entity: Option<ListGitlabProjectsError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
453        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
454        Err(Error::ResponseError(local_var_error))
455    }
456}
457
458/// Stores the access token a git repository authenticates with, so it does not have to be written into the repository URL or a workspace variable. The token is write-only: it is served only to a git-sync job that presents its own job token, and a fork of this workspace reads this copy instead of holding one of its own. Requires workspace admin.
459pub async fn set_git_credential(configuration: &configuration::Configuration, workspace: &str, set_git_credential_request: models::SetGitCredentialRequest) -> Result<String, Error<SetGitCredentialError>> {
460    let local_var_configuration = configuration;
461
462    let local_var_client = &local_var_configuration.client;
463
464    let local_var_uri_str = format!("{}/w/{workspace}/git_sync/credential", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace));
465    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
466
467    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
468        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
469    }
470    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
471        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
472    };
473    local_var_req_builder = local_var_req_builder.json(&set_git_credential_request);
474
475    let local_var_req = local_var_req_builder.build()?;
476    let local_var_resp = local_var_client.execute(local_var_req).await?;
477
478    let local_var_status = local_var_resp.status();
479    let local_var_content = local_var_resp.text().await?;
480
481    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
482        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
483    } else {
484        let local_var_entity: Option<SetGitCredentialError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
485        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
486        Err(Error::ResponseError(local_var_error))
487    }
488}
489
490/// Removes an installation (admin-provisioned or otherwise) from a workspace. Super-admin only. Does not affect the installation on the GitHub side. 
491pub async fn unassign_ghes_installation(configuration: &configuration::Configuration, workspace_id: &str, installation_id: i64) -> Result<(), Error<UnassignGhesInstallationError>> {
492    let local_var_configuration = configuration;
493
494    let local_var_client = &local_var_configuration.client;
495
496    let local_var_uri_str = format!("{}/github_app/ghes/assign/{workspace_id}/{installation_id}", local_var_configuration.base_path, workspace_id=crate::apis::urlencode(workspace_id), installation_id=installation_id);
497    let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str());
498
499    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
500        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
501    }
502    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
503        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
504    };
505
506    let local_var_req = local_var_req_builder.build()?;
507    let local_var_resp = local_var_client.execute(local_var_req).await?;
508
509    let local_var_status = local_var_resp.status();
510    let local_var_content = local_var_resp.text().await?;
511
512    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
513        Ok(())
514    } else {
515        let local_var_entity: Option<UnassignGhesInstallationError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
516        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
517        Err(Error::ResponseError(local_var_error))
518    }
519}
520