Skip to main content

windmill_api/apis/
postgres_trigger_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.725.1
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 [`create_postgres_publication`]
19#[derive(Debug, Clone, Serialize, Deserialize)]
20#[serde(untagged)]
21pub enum CreatePostgresPublicationError {
22    UnknownValue(serde_json::Value),
23}
24
25/// struct for typed errors of method [`create_postgres_replication_slot`]
26#[derive(Debug, Clone, Serialize, Deserialize)]
27#[serde(untagged)]
28pub enum CreatePostgresReplicationSlotError {
29    UnknownValue(serde_json::Value),
30}
31
32/// struct for typed errors of method [`create_postgres_trigger`]
33#[derive(Debug, Clone, Serialize, Deserialize)]
34#[serde(untagged)]
35pub enum CreatePostgresTriggerError {
36    UnknownValue(serde_json::Value),
37}
38
39/// struct for typed errors of method [`create_template_script`]
40#[derive(Debug, Clone, Serialize, Deserialize)]
41#[serde(untagged)]
42pub enum CreateTemplateScriptError {
43    UnknownValue(serde_json::Value),
44}
45
46/// struct for typed errors of method [`delete_postgres_publication`]
47#[derive(Debug, Clone, Serialize, Deserialize)]
48#[serde(untagged)]
49pub enum DeletePostgresPublicationError {
50    UnknownValue(serde_json::Value),
51}
52
53/// struct for typed errors of method [`delete_postgres_replication_slot`]
54#[derive(Debug, Clone, Serialize, Deserialize)]
55#[serde(untagged)]
56pub enum DeletePostgresReplicationSlotError {
57    UnknownValue(serde_json::Value),
58}
59
60/// struct for typed errors of method [`delete_postgres_trigger`]
61#[derive(Debug, Clone, Serialize, Deserialize)]
62#[serde(untagged)]
63pub enum DeletePostgresTriggerError {
64    UnknownValue(serde_json::Value),
65}
66
67/// struct for typed errors of method [`exists_postgres_trigger`]
68#[derive(Debug, Clone, Serialize, Deserialize)]
69#[serde(untagged)]
70pub enum ExistsPostgresTriggerError {
71    UnknownValue(serde_json::Value),
72}
73
74/// struct for typed errors of method [`get_postgres_publication`]
75#[derive(Debug, Clone, Serialize, Deserialize)]
76#[serde(untagged)]
77pub enum GetPostgresPublicationError {
78    UnknownValue(serde_json::Value),
79}
80
81/// struct for typed errors of method [`get_postgres_trigger`]
82#[derive(Debug, Clone, Serialize, Deserialize)]
83#[serde(untagged)]
84pub enum GetPostgresTriggerError {
85    UnknownValue(serde_json::Value),
86}
87
88/// struct for typed errors of method [`get_postgres_version`]
89#[derive(Debug, Clone, Serialize, Deserialize)]
90#[serde(untagged)]
91pub enum GetPostgresVersionError {
92    UnknownValue(serde_json::Value),
93}
94
95/// struct for typed errors of method [`get_template_script`]
96#[derive(Debug, Clone, Serialize, Deserialize)]
97#[serde(untagged)]
98pub enum GetTemplateScriptError {
99    UnknownValue(serde_json::Value),
100}
101
102/// struct for typed errors of method [`is_valid_postgres_configuration`]
103#[derive(Debug, Clone, Serialize, Deserialize)]
104#[serde(untagged)]
105pub enum IsValidPostgresConfigurationError {
106    UnknownValue(serde_json::Value),
107}
108
109/// struct for typed errors of method [`list_postgres_publication`]
110#[derive(Debug, Clone, Serialize, Deserialize)]
111#[serde(untagged)]
112pub enum ListPostgresPublicationError {
113    UnknownValue(serde_json::Value),
114}
115
116/// struct for typed errors of method [`list_postgres_replication_slot`]
117#[derive(Debug, Clone, Serialize, Deserialize)]
118#[serde(untagged)]
119pub enum ListPostgresReplicationSlotError {
120    UnknownValue(serde_json::Value),
121}
122
123/// struct for typed errors of method [`list_postgres_triggers`]
124#[derive(Debug, Clone, Serialize, Deserialize)]
125#[serde(untagged)]
126pub enum ListPostgresTriggersError {
127    UnknownValue(serde_json::Value),
128}
129
130/// struct for typed errors of method [`set_postgres_trigger_mode`]
131#[derive(Debug, Clone, Serialize, Deserialize)]
132#[serde(untagged)]
133pub enum SetPostgresTriggerModeError {
134    UnknownValue(serde_json::Value),
135}
136
137/// struct for typed errors of method [`test_postgres_connection`]
138#[derive(Debug, Clone, Serialize, Deserialize)]
139#[serde(untagged)]
140pub enum TestPostgresConnectionError {
141    UnknownValue(serde_json::Value),
142}
143
144/// struct for typed errors of method [`update_postgres_publication`]
145#[derive(Debug, Clone, Serialize, Deserialize)]
146#[serde(untagged)]
147pub enum UpdatePostgresPublicationError {
148    UnknownValue(serde_json::Value),
149}
150
151/// struct for typed errors of method [`update_postgres_trigger`]
152#[derive(Debug, Clone, Serialize, Deserialize)]
153#[serde(untagged)]
154pub enum UpdatePostgresTriggerError {
155    UnknownValue(serde_json::Value),
156}
157
158
159pub async fn create_postgres_publication(configuration: &configuration::Configuration, workspace: &str, path: &str, publication: &str, publication_data: models::PublicationData) -> Result<String, Error<CreatePostgresPublicationError>> {
160    let local_var_configuration = configuration;
161
162    let local_var_client = &local_var_configuration.client;
163
164    let local_var_uri_str = format!("{}/w/{workspace}/postgres_triggers/publication/create/{publication}/{path}", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace), path=crate::apis::urlencode(path), publication=crate::apis::urlencode(publication));
165    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
166
167    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
168        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
169    }
170    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
171        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
172    };
173    local_var_req_builder = local_var_req_builder.json(&publication_data);
174
175    let local_var_req = local_var_req_builder.build()?;
176    let local_var_resp = local_var_client.execute(local_var_req).await?;
177
178    let local_var_status = local_var_resp.status();
179    let local_var_content = local_var_resp.text().await?;
180
181    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
182        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
183    } else {
184        let local_var_entity: Option<CreatePostgresPublicationError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
185        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
186        Err(Error::ResponseError(local_var_error))
187    }
188}
189
190pub async fn create_postgres_replication_slot(configuration: &configuration::Configuration, workspace: &str, path: &str, slot: models::Slot) -> Result<String, Error<CreatePostgresReplicationSlotError>> {
191    let local_var_configuration = configuration;
192
193    let local_var_client = &local_var_configuration.client;
194
195    let local_var_uri_str = format!("{}/w/{workspace}/postgres_triggers/slot/create/{path}", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace), path=crate::apis::urlencode(path));
196    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
197
198    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
199        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
200    }
201    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
202        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
203    };
204    local_var_req_builder = local_var_req_builder.json(&slot);
205
206    let local_var_req = local_var_req_builder.build()?;
207    let local_var_resp = local_var_client.execute(local_var_req).await?;
208
209    let local_var_status = local_var_resp.status();
210    let local_var_content = local_var_resp.text().await?;
211
212    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
213        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
214    } else {
215        let local_var_entity: Option<CreatePostgresReplicationSlotError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
216        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
217        Err(Error::ResponseError(local_var_error))
218    }
219}
220
221pub async fn create_postgres_trigger(configuration: &configuration::Configuration, workspace: &str, new_postgres_trigger: models::NewPostgresTrigger) -> Result<String, Error<CreatePostgresTriggerError>> {
222    let local_var_configuration = configuration;
223
224    let local_var_client = &local_var_configuration.client;
225
226    let local_var_uri_str = format!("{}/w/{workspace}/postgres_triggers/create", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace));
227    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
228
229    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
230        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
231    }
232    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
233        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
234    };
235    local_var_req_builder = local_var_req_builder.json(&new_postgres_trigger);
236
237    let local_var_req = local_var_req_builder.build()?;
238    let local_var_resp = local_var_client.execute(local_var_req).await?;
239
240    let local_var_status = local_var_resp.status();
241    let local_var_content = local_var_resp.text().await?;
242
243    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
244        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
245    } else {
246        let local_var_entity: Option<CreatePostgresTriggerError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
247        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
248        Err(Error::ResponseError(local_var_error))
249    }
250}
251
252pub async fn create_template_script(configuration: &configuration::Configuration, workspace: &str, template_script: models::TemplateScript) -> Result<String, Error<CreateTemplateScriptError>> {
253    let local_var_configuration = configuration;
254
255    let local_var_client = &local_var_configuration.client;
256
257    let local_var_uri_str = format!("{}/w/{workspace}/postgres_triggers/create_template_script", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace));
258    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
259
260    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
261        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
262    }
263    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
264        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
265    };
266    local_var_req_builder = local_var_req_builder.json(&template_script);
267
268    let local_var_req = local_var_req_builder.build()?;
269    let local_var_resp = local_var_client.execute(local_var_req).await?;
270
271    let local_var_status = local_var_resp.status();
272    let local_var_content = local_var_resp.text().await?;
273
274    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
275        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
276    } else {
277        let local_var_entity: Option<CreateTemplateScriptError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
278        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
279        Err(Error::ResponseError(local_var_error))
280    }
281}
282
283pub async fn delete_postgres_publication(configuration: &configuration::Configuration, workspace: &str, path: &str, publication: &str) -> Result<String, Error<DeletePostgresPublicationError>> {
284    let local_var_configuration = configuration;
285
286    let local_var_client = &local_var_configuration.client;
287
288    let local_var_uri_str = format!("{}/w/{workspace}/postgres_triggers/publication/delete/{publication}/{path}", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace), path=crate::apis::urlencode(path), publication=crate::apis::urlencode(publication));
289    let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str());
290
291    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
292        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
293    }
294    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
295        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
296    };
297
298    let local_var_req = local_var_req_builder.build()?;
299    let local_var_resp = local_var_client.execute(local_var_req).await?;
300
301    let local_var_status = local_var_resp.status();
302    let local_var_content = local_var_resp.text().await?;
303
304    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
305        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
306    } else {
307        let local_var_entity: Option<DeletePostgresPublicationError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
308        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
309        Err(Error::ResponseError(local_var_error))
310    }
311}
312
313pub async fn delete_postgres_replication_slot(configuration: &configuration::Configuration, workspace: &str, path: &str, slot: models::Slot) -> Result<String, Error<DeletePostgresReplicationSlotError>> {
314    let local_var_configuration = configuration;
315
316    let local_var_client = &local_var_configuration.client;
317
318    let local_var_uri_str = format!("{}/w/{workspace}/postgres_triggers/slot/delete/{path}", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace), path=crate::apis::urlencode(path));
319    let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str());
320
321    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
322        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
323    }
324    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
325        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
326    };
327    local_var_req_builder = local_var_req_builder.json(&slot);
328
329    let local_var_req = local_var_req_builder.build()?;
330    let local_var_resp = local_var_client.execute(local_var_req).await?;
331
332    let local_var_status = local_var_resp.status();
333    let local_var_content = local_var_resp.text().await?;
334
335    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
336        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
337    } else {
338        let local_var_entity: Option<DeletePostgresReplicationSlotError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
339        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
340        Err(Error::ResponseError(local_var_error))
341    }
342}
343
344pub async fn delete_postgres_trigger(configuration: &configuration::Configuration, workspace: &str, path: &str) -> Result<String, Error<DeletePostgresTriggerError>> {
345    let local_var_configuration = configuration;
346
347    let local_var_client = &local_var_configuration.client;
348
349    let local_var_uri_str = format!("{}/w/{workspace}/postgres_triggers/delete/{path}", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace), path=crate::apis::urlencode(path));
350    let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str());
351
352    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
353        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
354    }
355    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
356        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
357    };
358
359    let local_var_req = local_var_req_builder.build()?;
360    let local_var_resp = local_var_client.execute(local_var_req).await?;
361
362    let local_var_status = local_var_resp.status();
363    let local_var_content = local_var_resp.text().await?;
364
365    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
366        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
367    } else {
368        let local_var_entity: Option<DeletePostgresTriggerError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
369        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
370        Err(Error::ResponseError(local_var_error))
371    }
372}
373
374pub async fn exists_postgres_trigger(configuration: &configuration::Configuration, workspace: &str, path: &str) -> Result<bool, Error<ExistsPostgresTriggerError>> {
375    let local_var_configuration = configuration;
376
377    let local_var_client = &local_var_configuration.client;
378
379    let local_var_uri_str = format!("{}/w/{workspace}/postgres_triggers/exists/{path}", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace), path=crate::apis::urlencode(path));
380    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
381
382    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
383        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
384    }
385    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
386        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
387    };
388
389    let local_var_req = local_var_req_builder.build()?;
390    let local_var_resp = local_var_client.execute(local_var_req).await?;
391
392    let local_var_status = local_var_resp.status();
393    let local_var_content = local_var_resp.text().await?;
394
395    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
396        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
397    } else {
398        let local_var_entity: Option<ExistsPostgresTriggerError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
399        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
400        Err(Error::ResponseError(local_var_error))
401    }
402}
403
404pub async fn get_postgres_publication(configuration: &configuration::Configuration, workspace: &str, path: &str, publication: &str) -> Result<models::PublicationData, Error<GetPostgresPublicationError>> {
405    let local_var_configuration = configuration;
406
407    let local_var_client = &local_var_configuration.client;
408
409    let local_var_uri_str = format!("{}/w/{workspace}/postgres_triggers/publication/get/{publication}/{path}", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace), path=crate::apis::urlencode(path), publication=crate::apis::urlencode(publication));
410    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
411
412    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
413        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
414    }
415    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
416        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
417    };
418
419    let local_var_req = local_var_req_builder.build()?;
420    let local_var_resp = local_var_client.execute(local_var_req).await?;
421
422    let local_var_status = local_var_resp.status();
423    let local_var_content = local_var_resp.text().await?;
424
425    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
426        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
427    } else {
428        let local_var_entity: Option<GetPostgresPublicationError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
429        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
430        Err(Error::ResponseError(local_var_error))
431    }
432}
433
434pub async fn get_postgres_trigger(configuration: &configuration::Configuration, workspace: &str, path: &str, get_draft: Option<bool>) -> Result<models::GetPostgresTrigger200Response, Error<GetPostgresTriggerError>> {
435    let local_var_configuration = configuration;
436
437    let local_var_client = &local_var_configuration.client;
438
439    let local_var_uri_str = format!("{}/w/{workspace}/postgres_triggers/get/{path}", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace), path=crate::apis::urlencode(path));
440    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
441
442    if let Some(ref local_var_str) = get_draft {
443        local_var_req_builder = local_var_req_builder.query(&[("get_draft", &local_var_str.to_string())]);
444    }
445    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
446        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
447    }
448    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
449        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
450    };
451
452    let local_var_req = local_var_req_builder.build()?;
453    let local_var_resp = local_var_client.execute(local_var_req).await?;
454
455    let local_var_status = local_var_resp.status();
456    let local_var_content = local_var_resp.text().await?;
457
458    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
459        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
460    } else {
461        let local_var_entity: Option<GetPostgresTriggerError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
462        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
463        Err(Error::ResponseError(local_var_error))
464    }
465}
466
467pub async fn get_postgres_version(configuration: &configuration::Configuration, workspace: &str, path: &str) -> Result<String, Error<GetPostgresVersionError>> {
468    let local_var_configuration = configuration;
469
470    let local_var_client = &local_var_configuration.client;
471
472    let local_var_uri_str = format!("{}/w/{workspace}/postgres_triggers/postgres/version/{path}", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace), path=crate::apis::urlencode(path));
473    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
474
475    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
476        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
477    }
478    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
479        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
480    };
481
482    let local_var_req = local_var_req_builder.build()?;
483    let local_var_resp = local_var_client.execute(local_var_req).await?;
484
485    let local_var_status = local_var_resp.status();
486    let local_var_content = local_var_resp.text().await?;
487
488    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
489        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
490    } else {
491        let local_var_entity: Option<GetPostgresVersionError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
492        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
493        Err(Error::ResponseError(local_var_error))
494    }
495}
496
497pub async fn get_template_script(configuration: &configuration::Configuration, workspace: &str, id: &str) -> Result<String, Error<GetTemplateScriptError>> {
498    let local_var_configuration = configuration;
499
500    let local_var_client = &local_var_configuration.client;
501
502    let local_var_uri_str = format!("{}/w/{workspace}/postgres_triggers/get_template_script/{id}", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace), id=crate::apis::urlencode(id));
503    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
504
505    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
506        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
507    }
508    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
509        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
510    };
511
512    let local_var_req = local_var_req_builder.build()?;
513    let local_var_resp = local_var_client.execute(local_var_req).await?;
514
515    let local_var_status = local_var_resp.status();
516    let local_var_content = local_var_resp.text().await?;
517
518    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
519        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
520    } else {
521        let local_var_entity: Option<GetTemplateScriptError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
522        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
523        Err(Error::ResponseError(local_var_error))
524    }
525}
526
527pub async fn is_valid_postgres_configuration(configuration: &configuration::Configuration, workspace: &str, path: &str) -> Result<bool, Error<IsValidPostgresConfigurationError>> {
528    let local_var_configuration = configuration;
529
530    let local_var_client = &local_var_configuration.client;
531
532    let local_var_uri_str = format!("{}/w/{workspace}/postgres_triggers/is_valid_postgres_configuration/{path}", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace), path=crate::apis::urlencode(path));
533    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
534
535    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
536        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
537    }
538    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
539        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
540    };
541
542    let local_var_req = local_var_req_builder.build()?;
543    let local_var_resp = local_var_client.execute(local_var_req).await?;
544
545    let local_var_status = local_var_resp.status();
546    let local_var_content = local_var_resp.text().await?;
547
548    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
549        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
550    } else {
551        let local_var_entity: Option<IsValidPostgresConfigurationError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
552        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
553        Err(Error::ResponseError(local_var_error))
554    }
555}
556
557pub async fn list_postgres_publication(configuration: &configuration::Configuration, workspace: &str, path: &str) -> Result<Vec<String>, Error<ListPostgresPublicationError>> {
558    let local_var_configuration = configuration;
559
560    let local_var_client = &local_var_configuration.client;
561
562    let local_var_uri_str = format!("{}/w/{workspace}/postgres_triggers/publication/list/{path}", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace), path=crate::apis::urlencode(path));
563    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
564
565    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
566        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
567    }
568    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
569        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
570    };
571
572    let local_var_req = local_var_req_builder.build()?;
573    let local_var_resp = local_var_client.execute(local_var_req).await?;
574
575    let local_var_status = local_var_resp.status();
576    let local_var_content = local_var_resp.text().await?;
577
578    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
579        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
580    } else {
581        let local_var_entity: Option<ListPostgresPublicationError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
582        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
583        Err(Error::ResponseError(local_var_error))
584    }
585}
586
587pub async fn list_postgres_replication_slot(configuration: &configuration::Configuration, workspace: &str, path: &str) -> Result<Vec<models::SlotList>, Error<ListPostgresReplicationSlotError>> {
588    let local_var_configuration = configuration;
589
590    let local_var_client = &local_var_configuration.client;
591
592    let local_var_uri_str = format!("{}/w/{workspace}/postgres_triggers/slot/list/{path}", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace), path=crate::apis::urlencode(path));
593    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
594
595    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
596        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
597    }
598    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
599        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
600    };
601
602    let local_var_req = local_var_req_builder.build()?;
603    let local_var_resp = local_var_client.execute(local_var_req).await?;
604
605    let local_var_status = local_var_resp.status();
606    let local_var_content = local_var_resp.text().await?;
607
608    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
609        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
610    } else {
611        let local_var_entity: Option<ListPostgresReplicationSlotError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
612        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
613        Err(Error::ResponseError(local_var_error))
614    }
615}
616
617pub async fn list_postgres_triggers(configuration: &configuration::Configuration, workspace: &str, page: Option<i32>, per_page: Option<i32>, path: Option<&str>, is_flow: Option<bool>, path_start: Option<&str>, label: Option<&str>, include_draft_only: Option<bool>) -> Result<Vec<models::PostgresTrigger>, Error<ListPostgresTriggersError>> {
618    let local_var_configuration = configuration;
619
620    let local_var_client = &local_var_configuration.client;
621
622    let local_var_uri_str = format!("{}/w/{workspace}/postgres_triggers/list", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace));
623    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
624
625    if let Some(ref local_var_str) = page {
626        local_var_req_builder = local_var_req_builder.query(&[("page", &local_var_str.to_string())]);
627    }
628    if let Some(ref local_var_str) = per_page {
629        local_var_req_builder = local_var_req_builder.query(&[("per_page", &local_var_str.to_string())]);
630    }
631    if let Some(ref local_var_str) = path {
632        local_var_req_builder = local_var_req_builder.query(&[("path", &local_var_str.to_string())]);
633    }
634    if let Some(ref local_var_str) = is_flow {
635        local_var_req_builder = local_var_req_builder.query(&[("is_flow", &local_var_str.to_string())]);
636    }
637    if let Some(ref local_var_str) = path_start {
638        local_var_req_builder = local_var_req_builder.query(&[("path_start", &local_var_str.to_string())]);
639    }
640    if let Some(ref local_var_str) = label {
641        local_var_req_builder = local_var_req_builder.query(&[("label", &local_var_str.to_string())]);
642    }
643    if let Some(ref local_var_str) = include_draft_only {
644        local_var_req_builder = local_var_req_builder.query(&[("include_draft_only", &local_var_str.to_string())]);
645    }
646    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
647        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
648    }
649    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
650        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
651    };
652
653    let local_var_req = local_var_req_builder.build()?;
654    let local_var_resp = local_var_client.execute(local_var_req).await?;
655
656    let local_var_status = local_var_resp.status();
657    let local_var_content = local_var_resp.text().await?;
658
659    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
660        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
661    } else {
662        let local_var_entity: Option<ListPostgresTriggersError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
663        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
664        Err(Error::ResponseError(local_var_error))
665    }
666}
667
668pub async fn set_postgres_trigger_mode(configuration: &configuration::Configuration, workspace: &str, path: &str, set_http_trigger_mode_request: models::SetHttpTriggerModeRequest) -> Result<String, Error<SetPostgresTriggerModeError>> {
669    let local_var_configuration = configuration;
670
671    let local_var_client = &local_var_configuration.client;
672
673    let local_var_uri_str = format!("{}/w/{workspace}/postgres_triggers/setmode/{path}", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace), path=crate::apis::urlencode(path));
674    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
675
676    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
677        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
678    }
679    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
680        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
681    };
682    local_var_req_builder = local_var_req_builder.json(&set_http_trigger_mode_request);
683
684    let local_var_req = local_var_req_builder.build()?;
685    let local_var_resp = local_var_client.execute(local_var_req).await?;
686
687    let local_var_status = local_var_resp.status();
688    let local_var_content = local_var_resp.text().await?;
689
690    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
691        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
692    } else {
693        let local_var_entity: Option<SetPostgresTriggerModeError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
694        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
695        Err(Error::ResponseError(local_var_error))
696    }
697}
698
699pub async fn test_postgres_connection(configuration: &configuration::Configuration, workspace: &str, test_postgres_connection_request: models::TestPostgresConnectionRequest) -> Result<String, Error<TestPostgresConnectionError>> {
700    let local_var_configuration = configuration;
701
702    let local_var_client = &local_var_configuration.client;
703
704    let local_var_uri_str = format!("{}/w/{workspace}/postgres_triggers/test", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace));
705    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
706
707    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
708        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
709    }
710    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
711        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
712    };
713    local_var_req_builder = local_var_req_builder.json(&test_postgres_connection_request);
714
715    let local_var_req = local_var_req_builder.build()?;
716    let local_var_resp = local_var_client.execute(local_var_req).await?;
717
718    let local_var_status = local_var_resp.status();
719    let local_var_content = local_var_resp.text().await?;
720
721    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
722        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
723    } else {
724        let local_var_entity: Option<TestPostgresConnectionError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
725        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
726        Err(Error::ResponseError(local_var_error))
727    }
728}
729
730pub async fn update_postgres_publication(configuration: &configuration::Configuration, workspace: &str, path: &str, publication: &str, publication_data: models::PublicationData) -> Result<String, Error<UpdatePostgresPublicationError>> {
731    let local_var_configuration = configuration;
732
733    let local_var_client = &local_var_configuration.client;
734
735    let local_var_uri_str = format!("{}/w/{workspace}/postgres_triggers/publication/update/{publication}/{path}", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace), path=crate::apis::urlencode(path), publication=crate::apis::urlencode(publication));
736    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
737
738    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
739        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
740    }
741    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
742        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
743    };
744    local_var_req_builder = local_var_req_builder.json(&publication_data);
745
746    let local_var_req = local_var_req_builder.build()?;
747    let local_var_resp = local_var_client.execute(local_var_req).await?;
748
749    let local_var_status = local_var_resp.status();
750    let local_var_content = local_var_resp.text().await?;
751
752    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
753        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
754    } else {
755        let local_var_entity: Option<UpdatePostgresPublicationError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
756        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
757        Err(Error::ResponseError(local_var_error))
758    }
759}
760
761pub async fn update_postgres_trigger(configuration: &configuration::Configuration, workspace: &str, path: &str, edit_postgres_trigger: models::EditPostgresTrigger) -> Result<String, Error<UpdatePostgresTriggerError>> {
762    let local_var_configuration = configuration;
763
764    let local_var_client = &local_var_configuration.client;
765
766    let local_var_uri_str = format!("{}/w/{workspace}/postgres_triggers/update/{path}", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace), path=crate::apis::urlencode(path));
767    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
768
769    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
770        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
771    }
772    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
773        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
774    };
775    local_var_req_builder = local_var_req_builder.json(&edit_postgres_trigger);
776
777    let local_var_req = local_var_req_builder.build()?;
778    let local_var_resp = local_var_client.execute(local_var_req).await?;
779
780    let local_var_status = local_var_resp.status();
781    let local_var_content = local_var_resp.text().await?;
782
783    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
784        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
785    } else {
786        let local_var_entity: Option<UpdatePostgresTriggerError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
787        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
788        Err(Error::ResponseError(local_var_error))
789    }
790}
791