Skip to main content

windmill_api/apis/
native_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.638.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_native_trigger`]
19#[derive(Debug, Clone, Serialize, Deserialize)]
20#[serde(untagged)]
21pub enum CreateNativeTriggerError {
22    UnknownValue(serde_json::Value),
23}
24
25/// struct for typed errors of method [`delete_native_trigger`]
26#[derive(Debug, Clone, Serialize, Deserialize)]
27#[serde(untagged)]
28pub enum DeleteNativeTriggerError {
29    UnknownValue(serde_json::Value),
30}
31
32/// struct for typed errors of method [`exists_native_trigger`]
33#[derive(Debug, Clone, Serialize, Deserialize)]
34#[serde(untagged)]
35pub enum ExistsNativeTriggerError {
36    UnknownValue(serde_json::Value),
37}
38
39/// struct for typed errors of method [`get_native_trigger`]
40#[derive(Debug, Clone, Serialize, Deserialize)]
41#[serde(untagged)]
42pub enum GetNativeTriggerError {
43    UnknownValue(serde_json::Value),
44}
45
46/// struct for typed errors of method [`list_google_calendars`]
47#[derive(Debug, Clone, Serialize, Deserialize)]
48#[serde(untagged)]
49pub enum ListGoogleCalendarsError {
50    UnknownValue(serde_json::Value),
51}
52
53/// struct for typed errors of method [`list_google_drive_files`]
54#[derive(Debug, Clone, Serialize, Deserialize)]
55#[serde(untagged)]
56pub enum ListGoogleDriveFilesError {
57    UnknownValue(serde_json::Value),
58}
59
60/// struct for typed errors of method [`list_google_shared_drives`]
61#[derive(Debug, Clone, Serialize, Deserialize)]
62#[serde(untagged)]
63pub enum ListGoogleSharedDrivesError {
64    UnknownValue(serde_json::Value),
65}
66
67/// struct for typed errors of method [`list_native_triggers`]
68#[derive(Debug, Clone, Serialize, Deserialize)]
69#[serde(untagged)]
70pub enum ListNativeTriggersError {
71    UnknownValue(serde_json::Value),
72}
73
74/// struct for typed errors of method [`list_next_cloud_events`]
75#[derive(Debug, Clone, Serialize, Deserialize)]
76#[serde(untagged)]
77pub enum ListNextCloudEventsError {
78    UnknownValue(serde_json::Value),
79}
80
81/// struct for typed errors of method [`native_trigger_webhook`]
82#[derive(Debug, Clone, Serialize, Deserialize)]
83#[serde(untagged)]
84pub enum NativeTriggerWebhookError {
85    UnknownValue(serde_json::Value),
86}
87
88/// struct for typed errors of method [`sync_native_triggers`]
89#[derive(Debug, Clone, Serialize, Deserialize)]
90#[serde(untagged)]
91pub enum SyncNativeTriggersError {
92    UnknownValue(serde_json::Value),
93}
94
95/// struct for typed errors of method [`update_native_trigger`]
96#[derive(Debug, Clone, Serialize, Deserialize)]
97#[serde(untagged)]
98pub enum UpdateNativeTriggerError {
99    UnknownValue(serde_json::Value),
100}
101
102
103/// Creates a new native trigger for the specified service. Requires write access to the script or flow that the trigger will be associated with. 
104pub async fn create_native_trigger(configuration: &configuration::Configuration, workspace: &str, service_name: models::NativeServiceName, native_trigger_data: models::NativeTriggerData) -> Result<models::CreateTriggerResponse, Error<CreateNativeTriggerError>> {
105    let local_var_configuration = configuration;
106
107    let local_var_client = &local_var_configuration.client;
108
109    let local_var_uri_str = format!("{}/w/{workspace}/native_triggers/{service_name}/create", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace), service_name=service_name.to_string());
110    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
111
112    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
113        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
114    }
115    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
116        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
117    };
118    local_var_req_builder = local_var_req_builder.json(&native_trigger_data);
119
120    let local_var_req = local_var_req_builder.build()?;
121    let local_var_resp = local_var_client.execute(local_var_req).await?;
122
123    let local_var_status = local_var_resp.status();
124    let local_var_content = local_var_resp.text().await?;
125
126    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
127        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
128    } else {
129        let local_var_entity: Option<CreateNativeTriggerError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
130        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
131        Err(Error::ResponseError(local_var_error))
132    }
133}
134
135/// Deletes a native trigger by its external ID. Requires write access to the script or flow that the trigger is associated with. 
136pub async fn delete_native_trigger(configuration: &configuration::Configuration, workspace: &str, service_name: models::NativeServiceName, external_id: &str) -> Result<String, Error<DeleteNativeTriggerError>> {
137    let local_var_configuration = configuration;
138
139    let local_var_client = &local_var_configuration.client;
140
141    let local_var_uri_str = format!("{}/w/{workspace}/native_triggers/{service_name}/delete/{external_id}", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace), service_name=service_name.to_string(), external_id=crate::apis::urlencode(external_id));
142    let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str());
143
144    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
145        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
146    }
147    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
148        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
149    };
150
151    let local_var_req = local_var_req_builder.build()?;
152    let local_var_resp = local_var_client.execute(local_var_req).await?;
153
154    let local_var_status = local_var_resp.status();
155    let local_var_content = local_var_resp.text().await?;
156
157    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
158        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
159    } else {
160        let local_var_entity: Option<DeleteNativeTriggerError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
161        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
162        Err(Error::ResponseError(local_var_error))
163    }
164}
165
166/// Checks if a native trigger with the given external ID exists.
167pub async fn exists_native_trigger(configuration: &configuration::Configuration, workspace: &str, service_name: models::NativeServiceName, external_id: &str) -> Result<bool, Error<ExistsNativeTriggerError>> {
168    let local_var_configuration = configuration;
169
170    let local_var_client = &local_var_configuration.client;
171
172    let local_var_uri_str = format!("{}/w/{workspace}/native_triggers/{service_name}/exists/{external_id}", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace), service_name=service_name.to_string(), external_id=crate::apis::urlencode(external_id));
173    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
174
175    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
176        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
177    }
178    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
179        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
180    };
181
182    let local_var_req = local_var_req_builder.build()?;
183    let local_var_resp = local_var_client.execute(local_var_req).await?;
184
185    let local_var_status = local_var_resp.status();
186    let local_var_content = local_var_resp.text().await?;
187
188    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
189        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
190    } else {
191        let local_var_entity: Option<ExistsNativeTriggerError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
192        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
193        Err(Error::ResponseError(local_var_error))
194    }
195}
196
197/// Retrieves a native trigger by its external ID. Requires write access to the script or flow that the trigger is associated with. 
198pub async fn get_native_trigger(configuration: &configuration::Configuration, workspace: &str, service_name: models::NativeServiceName, external_id: &str) -> Result<models::NativeTriggerWithExternal, Error<GetNativeTriggerError>> {
199    let local_var_configuration = configuration;
200
201    let local_var_client = &local_var_configuration.client;
202
203    let local_var_uri_str = format!("{}/w/{workspace}/native_triggers/{service_name}/get/{external_id}", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace), service_name=service_name.to_string(), external_id=crate::apis::urlencode(external_id));
204    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
205
206    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
207        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
208    }
209    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
210        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
211    };
212
213    let local_var_req = local_var_req_builder.build()?;
214    let local_var_resp = local_var_client.execute(local_var_req).await?;
215
216    let local_var_status = local_var_resp.status();
217    let local_var_content = local_var_resp.text().await?;
218
219    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
220        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
221    } else {
222        let local_var_entity: Option<GetNativeTriggerError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
223        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
224        Err(Error::ResponseError(local_var_error))
225    }
226}
227
228pub async fn list_google_calendars(configuration: &configuration::Configuration, workspace: &str) -> Result<Vec<models::GoogleCalendarEntry>, Error<ListGoogleCalendarsError>> {
229    let local_var_configuration = configuration;
230
231    let local_var_client = &local_var_configuration.client;
232
233    let local_var_uri_str = format!("{}/w/{workspace}/native_triggers/google/calendars", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace));
234    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
235
236    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
237        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
238    }
239    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
240        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
241    };
242
243    let local_var_req = local_var_req_builder.build()?;
244    let local_var_resp = local_var_client.execute(local_var_req).await?;
245
246    let local_var_status = local_var_resp.status();
247    let local_var_content = local_var_resp.text().await?;
248
249    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
250        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
251    } else {
252        let local_var_entity: Option<ListGoogleCalendarsError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
253        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
254        Err(Error::ResponseError(local_var_error))
255    }
256}
257
258pub async fn list_google_drive_files(configuration: &configuration::Configuration, workspace: &str, q: Option<&str>, parent_id: Option<&str>, page_token: Option<&str>, shared_with_me: Option<bool>) -> Result<models::GoogleDriveFilesResponse, Error<ListGoogleDriveFilesError>> {
259    let local_var_configuration = configuration;
260
261    let local_var_client = &local_var_configuration.client;
262
263    let local_var_uri_str = format!("{}/w/{workspace}/native_triggers/google/drive/files", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace));
264    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
265
266    if let Some(ref local_var_str) = q {
267        local_var_req_builder = local_var_req_builder.query(&[("q", &local_var_str.to_string())]);
268    }
269    if let Some(ref local_var_str) = parent_id {
270        local_var_req_builder = local_var_req_builder.query(&[("parent_id", &local_var_str.to_string())]);
271    }
272    if let Some(ref local_var_str) = page_token {
273        local_var_req_builder = local_var_req_builder.query(&[("page_token", &local_var_str.to_string())]);
274    }
275    if let Some(ref local_var_str) = shared_with_me {
276        local_var_req_builder = local_var_req_builder.query(&[("shared_with_me", &local_var_str.to_string())]);
277    }
278    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
279        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
280    }
281    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
282        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
283    };
284
285    let local_var_req = local_var_req_builder.build()?;
286    let local_var_resp = local_var_client.execute(local_var_req).await?;
287
288    let local_var_status = local_var_resp.status();
289    let local_var_content = local_var_resp.text().await?;
290
291    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
292        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
293    } else {
294        let local_var_entity: Option<ListGoogleDriveFilesError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
295        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
296        Err(Error::ResponseError(local_var_error))
297    }
298}
299
300pub async fn list_google_shared_drives(configuration: &configuration::Configuration, workspace: &str) -> Result<Vec<models::SharedDriveEntry>, Error<ListGoogleSharedDrivesError>> {
301    let local_var_configuration = configuration;
302
303    let local_var_client = &local_var_configuration.client;
304
305    let local_var_uri_str = format!("{}/w/{workspace}/native_triggers/google/drive/shared_drives", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace));
306    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
307
308    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
309        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
310    }
311    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
312        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
313    };
314
315    let local_var_req = local_var_req_builder.build()?;
316    let local_var_resp = local_var_client.execute(local_var_req).await?;
317
318    let local_var_status = local_var_resp.status();
319    let local_var_content = local_var_resp.text().await?;
320
321    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
322        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
323    } else {
324        let local_var_entity: Option<ListGoogleSharedDrivesError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
325        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
326        Err(Error::ResponseError(local_var_error))
327    }
328}
329
330/// Lists all native triggers for the specified service in the workspace.
331pub async fn list_native_triggers(configuration: &configuration::Configuration, workspace: &str, service_name: models::NativeServiceName, page: Option<i32>, per_page: Option<i32>, path: Option<&str>, is_flow: Option<bool>) -> Result<Vec<models::NativeTrigger>, Error<ListNativeTriggersError>> {
332    let local_var_configuration = configuration;
333
334    let local_var_client = &local_var_configuration.client;
335
336    let local_var_uri_str = format!("{}/w/{workspace}/native_triggers/{service_name}/list", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace), service_name=service_name.to_string());
337    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
338
339    if let Some(ref local_var_str) = page {
340        local_var_req_builder = local_var_req_builder.query(&[("page", &local_var_str.to_string())]);
341    }
342    if let Some(ref local_var_str) = per_page {
343        local_var_req_builder = local_var_req_builder.query(&[("per_page", &local_var_str.to_string())]);
344    }
345    if let Some(ref local_var_str) = path {
346        local_var_req_builder = local_var_req_builder.query(&[("path", &local_var_str.to_string())]);
347    }
348    if let Some(ref local_var_str) = is_flow {
349        local_var_req_builder = local_var_req_builder.query(&[("is_flow", &local_var_str.to_string())]);
350    }
351    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
352        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
353    }
354    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
355        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
356    };
357
358    let local_var_req = local_var_req_builder.build()?;
359    let local_var_resp = local_var_client.execute(local_var_req).await?;
360
361    let local_var_status = local_var_resp.status();
362    let local_var_content = local_var_resp.text().await?;
363
364    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
365        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
366    } else {
367        let local_var_entity: Option<ListNativeTriggersError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
368        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
369        Err(Error::ResponseError(local_var_error))
370    }
371}
372
373pub async fn list_next_cloud_events(configuration: &configuration::Configuration, workspace: &str) -> Result<Vec<models::NextCloudEventType>, Error<ListNextCloudEventsError>> {
374    let local_var_configuration = configuration;
375
376    let local_var_client = &local_var_configuration.client;
377
378    let local_var_uri_str = format!("{}/w/{workspace}/native_triggers/nextcloud/events", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace));
379    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
380
381    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
382        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
383    }
384    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
385        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
386    };
387
388    let local_var_req = local_var_req_builder.build()?;
389    let local_var_resp = local_var_client.execute(local_var_req).await?;
390
391    let local_var_status = local_var_resp.status();
392    let local_var_content = local_var_resp.text().await?;
393
394    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
395        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
396    } else {
397        let local_var_entity: Option<ListNextCloudEventsError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
398        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
399        Err(Error::ResponseError(local_var_error))
400    }
401}
402
403pub async fn native_trigger_webhook(configuration: &configuration::Configuration, service_name: models::NativeServiceName, workspace_id: &str, internal_id: i64, request_body: Option<std::collections::HashMap<String, serde_json::Value>>) -> Result<String, Error<NativeTriggerWebhookError>> {
404    let local_var_configuration = configuration;
405
406    let local_var_client = &local_var_configuration.client;
407
408    let local_var_uri_str = format!("{}/native_triggers/{service_name}/w/{workspace_id}/webhook/{internal_id}", local_var_configuration.base_path, service_name=service_name.to_string(), workspace_id=crate::apis::urlencode(workspace_id), internal_id=internal_id);
409    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
410
411    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
412        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
413    }
414    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
415        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
416    };
417    local_var_req_builder = local_var_req_builder.json(&request_body);
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<NativeTriggerWebhookError> = 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 sync_native_triggers(configuration: &configuration::Configuration, workspace: &str, service_name: models::NativeServiceName) -> Result<(), Error<SyncNativeTriggersError>> {
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}/native_triggers/{service_name}/sync", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace), service_name=service_name.to_string());
440    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
441
442    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
443        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
444    }
445    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
446        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
447    };
448
449    let local_var_req = local_var_req_builder.build()?;
450    let local_var_resp = local_var_client.execute(local_var_req).await?;
451
452    let local_var_status = local_var_resp.status();
453    let local_var_content = local_var_resp.text().await?;
454
455    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
456        Ok(())
457    } else {
458        let local_var_entity: Option<SyncNativeTriggersError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
459        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
460        Err(Error::ResponseError(local_var_error))
461    }
462}
463
464/// Updates an existing native trigger. Requires write access to the script or flow that the trigger is associated with. 
465pub async fn update_native_trigger(configuration: &configuration::Configuration, workspace: &str, service_name: models::NativeServiceName, external_id: &str, native_trigger_data: models::NativeTriggerData) -> Result<String, Error<UpdateNativeTriggerError>> {
466    let local_var_configuration = configuration;
467
468    let local_var_client = &local_var_configuration.client;
469
470    let local_var_uri_str = format!("{}/w/{workspace}/native_triggers/{service_name}/update/{external_id}", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace), service_name=service_name.to_string(), external_id=crate::apis::urlencode(external_id));
471    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
472
473    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
474        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
475    }
476    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
477        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
478    };
479    local_var_req_builder = local_var_req_builder.json(&native_trigger_data);
480
481    let local_var_req = local_var_req_builder.build()?;
482    let local_var_resp = local_var_client.execute(local_var_req).await?;
483
484    let local_var_status = local_var_resp.status();
485    let local_var_content = local_var_resp.text().await?;
486
487    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
488        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
489    } else {
490        let local_var_entity: Option<UpdateNativeTriggerError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
491        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
492        Err(Error::ResponseError(local_var_error))
493    }
494}
495