Skip to main content

gitbundle_sdk/apis/
actions_api.rs

1/*
2 * GitBundle API
3 *
4 * GitBundle API documentation.
5 *
6 * The version of the OpenAPI document: 3.4.1
7 *
8 * Generated by: https://openapi-generator.tech
9 */
10
11use reqwest;
12use serde::{de::Error as _, Deserialize, Serialize};
13
14use super::{configuration, ContentType, Error};
15use crate::{apis::ResponseContent, models};
16
17/// struct for typed errors of method [`cancel_workflow`]
18#[derive(Debug, Clone, Serialize, Deserialize)]
19#[serde(untagged)]
20pub enum CancelWorkflowError {
21    Status400(models::JsonErrorResponseNull),
22    Status401(models::JsonErrorResponseNull),
23    Status403(models::JsonErrorResponseNull),
24    Status404(models::JsonErrorResponseNull),
25    Status409(models::JsonErrorResponseNull),
26    Status429(models::JsonErrorResponseNull),
27    Status500(models::JsonErrorResponseNull),
28    UnknownValue(serde_json::Value),
29}
30
31/// struct for typed errors of method [`delete_action`]
32#[derive(Debug, Clone, Serialize, Deserialize)]
33#[serde(untagged)]
34pub enum DeleteActionError {
35    Status400(models::JsonErrorResponseNull),
36    Status401(models::JsonErrorResponseNull),
37    Status403(models::JsonErrorResponseNull),
38    Status404(models::JsonErrorResponseNull),
39    Status409(models::JsonErrorResponseNull),
40    Status429(models::JsonErrorResponseNull),
41    Status500(models::JsonErrorResponseNull),
42    UnknownValue(serde_json::Value),
43}
44
45/// struct for typed errors of method [`delete_workflow`]
46#[derive(Debug, Clone, Serialize, Deserialize)]
47#[serde(untagged)]
48pub enum DeleteWorkflowError {
49    Status400(models::JsonErrorResponseNull),
50    Status401(models::JsonErrorResponseNull),
51    Status403(models::JsonErrorResponseNull),
52    Status404(models::JsonErrorResponseNull),
53    Status409(models::JsonErrorResponseNull),
54    Status429(models::JsonErrorResponseNull),
55    Status500(models::JsonErrorResponseNull),
56    UnknownValue(serde_json::Value),
57}
58
59/// struct for typed errors of method [`get_action`]
60#[derive(Debug, Clone, Serialize, Deserialize)]
61#[serde(untagged)]
62pub enum GetActionError {
63    Status400(models::JsonErrorResponseNull),
64    Status401(models::JsonErrorResponseNull),
65    Status403(models::JsonErrorResponseNull),
66    Status404(models::JsonErrorResponseNull),
67    Status409(models::JsonErrorResponseNull),
68    Status429(models::JsonErrorResponseNull),
69    Status500(models::JsonErrorResponseNull),
70    UnknownValue(serde_json::Value),
71}
72
73/// struct for typed errors of method [`get_action_inputs`]
74#[derive(Debug, Clone, Serialize, Deserialize)]
75#[serde(untagged)]
76pub enum GetActionInputsError {
77    Status400(models::JsonErrorResponseNull),
78    Status401(models::JsonErrorResponseNull),
79    Status403(models::JsonErrorResponseNull),
80    Status404(models::JsonErrorResponseNull),
81    Status409(models::JsonErrorResponseNull),
82    Status429(models::JsonErrorResponseNull),
83    Status500(models::JsonErrorResponseNull),
84    UnknownValue(serde_json::Value),
85}
86
87/// struct for typed errors of method [`get_actions`]
88#[derive(Debug, Clone, Serialize, Deserialize)]
89#[serde(untagged)]
90pub enum GetActionsError {
91    Status400(models::JsonErrorResponseNull),
92    Status401(models::JsonErrorResponseNull),
93    Status403(models::JsonErrorResponseNull),
94    Status404(models::JsonErrorResponseNull),
95    Status409(models::JsonErrorResponseNull),
96    Status429(models::JsonErrorResponseNull),
97    Status500(models::JsonErrorResponseNull),
98    UnknownValue(serde_json::Value),
99}
100
101/// struct for typed errors of method [`get_step_log_stream`]
102#[derive(Debug, Clone, Serialize, Deserialize)]
103#[serde(untagged)]
104pub enum GetStepLogStreamError {
105    Status400(models::JsonErrorResponseNull),
106    Status401(models::JsonErrorResponseNull),
107    Status403(models::JsonErrorResponseNull),
108    Status404(models::JsonErrorResponseNull),
109    Status409(models::JsonErrorResponseNull),
110    Status429(models::JsonErrorResponseNull),
111    Status500(models::JsonErrorResponseNull),
112    UnknownValue(serde_json::Value),
113}
114
115/// struct for typed errors of method [`get_step_logs`]
116#[derive(Debug, Clone, Serialize, Deserialize)]
117#[serde(untagged)]
118pub enum GetStepLogsError {
119    Status400(models::JsonErrorResponseNull),
120    Status401(models::JsonErrorResponseNull),
121    Status403(models::JsonErrorResponseNull),
122    Status404(models::JsonErrorResponseNull),
123    Status409(models::JsonErrorResponseNull),
124    Status429(models::JsonErrorResponseNull),
125    Status500(models::JsonErrorResponseNull),
126    UnknownValue(serde_json::Value),
127}
128
129/// struct for typed errors of method [`get_workflow`]
130#[derive(Debug, Clone, Serialize, Deserialize)]
131#[serde(untagged)]
132pub enum GetWorkflowError {
133    Status400(models::JsonErrorResponseNull),
134    Status401(models::JsonErrorResponseNull),
135    Status403(models::JsonErrorResponseNull),
136    Status404(models::JsonErrorResponseNull),
137    Status409(models::JsonErrorResponseNull),
138    Status429(models::JsonErrorResponseNull),
139    Status500(models::JsonErrorResponseNull),
140    UnknownValue(serde_json::Value),
141}
142
143/// struct for typed errors of method [`get_workflows`]
144#[derive(Debug, Clone, Serialize, Deserialize)]
145#[serde(untagged)]
146pub enum GetWorkflowsError {
147    Status400(models::JsonErrorResponseNull),
148    Status401(models::JsonErrorResponseNull),
149    Status403(models::JsonErrorResponseNull),
150    Status404(models::JsonErrorResponseNull),
151    Status409(models::JsonErrorResponseNull),
152    Status429(models::JsonErrorResponseNull),
153    Status500(models::JsonErrorResponseNull),
154    UnknownValue(serde_json::Value),
155}
156
157/// struct for typed errors of method [`patch_action`]
158#[derive(Debug, Clone, Serialize, Deserialize)]
159#[serde(untagged)]
160pub enum PatchActionError {
161    Status400(models::JsonErrorResponseNull),
162    Status401(models::JsonErrorResponseNull),
163    Status403(models::JsonErrorResponseNull),
164    Status404(models::JsonErrorResponseNull),
165    Status409(models::JsonErrorResponseNull),
166    Status429(models::JsonErrorResponseNull),
167    Status500(models::JsonErrorResponseNull),
168    UnknownValue(serde_json::Value),
169}
170
171/// struct for typed errors of method [`patch_stage`]
172#[derive(Debug, Clone, Serialize, Deserialize)]
173#[serde(untagged)]
174pub enum PatchStageError {
175    Status400(models::JsonErrorResponseNull),
176    Status401(models::JsonErrorResponseNull),
177    Status403(models::JsonErrorResponseNull),
178    Status404(models::JsonErrorResponseNull),
179    Status409(models::JsonErrorResponseNull),
180    Status429(models::JsonErrorResponseNull),
181    Status500(models::JsonErrorResponseNull),
182    UnknownValue(serde_json::Value),
183}
184
185/// struct for typed errors of method [`patch_step`]
186#[derive(Debug, Clone, Serialize, Deserialize)]
187#[serde(untagged)]
188pub enum PatchStepError {
189    Status400(models::JsonErrorResponseNull),
190    Status401(models::JsonErrorResponseNull),
191    Status403(models::JsonErrorResponseNull),
192    Status404(models::JsonErrorResponseNull),
193    Status409(models::JsonErrorResponseNull),
194    Status429(models::JsonErrorResponseNull),
195    Status500(models::JsonErrorResponseNull),
196    UnknownValue(serde_json::Value),
197}
198
199/// struct for typed errors of method [`patch_workflow`]
200#[derive(Debug, Clone, Serialize, Deserialize)]
201#[serde(untagged)]
202pub enum PatchWorkflowError {
203    Status400(models::JsonErrorResponseNull),
204    Status401(models::JsonErrorResponseNull),
205    Status403(models::JsonErrorResponseNull),
206    Status404(models::JsonErrorResponseNull),
207    Status409(models::JsonErrorResponseNull),
208    Status429(models::JsonErrorResponseNull),
209    Status500(models::JsonErrorResponseNull),
210    UnknownValue(serde_json::Value),
211}
212
213/// struct for typed errors of method [`post_action`]
214#[derive(Debug, Clone, Serialize, Deserialize)]
215#[serde(untagged)]
216pub enum PostActionError {
217    Status400(models::JsonErrorResponseNull),
218    Status401(models::JsonErrorResponseNull),
219    Status403(models::JsonErrorResponseNull),
220    Status404(models::JsonErrorResponseNull),
221    Status409(models::JsonErrorResponseNull),
222    Status429(models::JsonErrorResponseNull),
223    Status500(models::JsonErrorResponseNull),
224    UnknownValue(serde_json::Value),
225}
226
227/// struct for typed errors of method [`post_action_inputs`]
228#[derive(Debug, Clone, Serialize, Deserialize)]
229#[serde(untagged)]
230pub enum PostActionInputsError {
231    Status400(models::JsonErrorResponseNull),
232    Status401(models::JsonErrorResponseNull),
233    Status403(models::JsonErrorResponseNull),
234    Status404(models::JsonErrorResponseNull),
235    Status409(models::JsonErrorResponseNull),
236    Status429(models::JsonErrorResponseNull),
237    Status500(models::JsonErrorResponseNull),
238    UnknownValue(serde_json::Value),
239}
240
241/// struct for typed errors of method [`post_step`]
242#[derive(Debug, Clone, Serialize, Deserialize)]
243#[serde(untagged)]
244pub enum PostStepError {
245    Status400(models::JsonErrorResponseNull),
246    Status401(models::JsonErrorResponseNull),
247    Status403(models::JsonErrorResponseNull),
248    Status404(models::JsonErrorResponseNull),
249    Status409(models::JsonErrorResponseNull),
250    Status429(models::JsonErrorResponseNull),
251    Status500(models::JsonErrorResponseNull),
252    UnknownValue(serde_json::Value),
253}
254
255/// struct for typed errors of method [`post_step_log`]
256#[derive(Debug, Clone, Serialize, Deserialize)]
257#[serde(untagged)]
258pub enum PostStepLogError {
259    Status400(models::JsonErrorResponseNull),
260    Status401(models::JsonErrorResponseNull),
261    Status403(models::JsonErrorResponseNull),
262    Status404(models::JsonErrorResponseNull),
263    Status409(models::JsonErrorResponseNull),
264    Status429(models::JsonErrorResponseNull),
265    Status500(models::JsonErrorResponseNull),
266    UnknownValue(serde_json::Value),
267}
268
269/// struct for typed errors of method [`post_step_log_stream`]
270#[derive(Debug, Clone, Serialize, Deserialize)]
271#[serde(untagged)]
272pub enum PostStepLogStreamError {
273    Status400(models::JsonErrorResponseNull),
274    Status401(models::JsonErrorResponseNull),
275    Status403(models::JsonErrorResponseNull),
276    Status404(models::JsonErrorResponseNull),
277    Status409(models::JsonErrorResponseNull),
278    Status429(models::JsonErrorResponseNull),
279    Status500(models::JsonErrorResponseNull),
280    UnknownValue(serde_json::Value),
281}
282
283/// struct for typed errors of method [`rerun_workflow`]
284#[derive(Debug, Clone, Serialize, Deserialize)]
285#[serde(untagged)]
286pub enum RerunWorkflowError {
287    Status400(models::JsonErrorResponseNull),
288    Status401(models::JsonErrorResponseNull),
289    Status403(models::JsonErrorResponseNull),
290    Status404(models::JsonErrorResponseNull),
291    Status409(models::JsonErrorResponseNull),
292    Status429(models::JsonErrorResponseNull),
293    Status500(models::JsonErrorResponseNull),
294    UnknownValue(serde_json::Value),
295}
296
297pub async fn cancel_workflow(
298    configuration: &configuration::Configuration,
299    repo_ref: &str,
300    action_identifier: &str,
301    workflow_idn: i64,
302) -> Result<models::WorkflowStages, Error<CancelWorkflowError>> {
303    // add a prefix to parameters to efficiently prevent name collisions
304    let p_path_repo_ref = repo_ref;
305    let p_path_action_identifier = action_identifier;
306    let p_path_workflow_idn = workflow_idn;
307
308    let uri_str = format!(
309        "{}/repos/{repo_ref}/+/actions/{action_identifier}/workflows/{workflow_idn}/cancel",
310        configuration.base_path,
311        repo_ref = crate::apis::urlencode(p_path_repo_ref),
312        action_identifier = crate::apis::urlencode(p_path_action_identifier),
313        workflow_idn = p_path_workflow_idn
314    );
315    let mut req_builder = configuration
316        .client
317        .request(reqwest::Method::POST, &uri_str);
318
319    if let Some(ref apikey) = configuration.api_key {
320        let key = apikey.key.clone();
321        let value = match apikey.prefix {
322            Some(ref prefix) => format!("{} {}", prefix, key),
323            None => key,
324        };
325        req_builder = req_builder.query(&[("access_token", value)]);
326    }
327    if let Some(ref user_agent) = configuration.user_agent {
328        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
329    }
330    if let Some(ref auth_conf) = configuration.basic_auth {
331        req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
332    };
333    if let Some(ref token) = configuration.bearer_access_token {
334        req_builder = req_builder.bearer_auth(token.to_owned());
335    };
336
337    let req = req_builder.build()?;
338    let resp = configuration.client.execute(req).await?;
339
340    let status = resp.status();
341    let content_type = resp
342        .headers()
343        .get("content-type")
344        .and_then(|v| v.to_str().ok())
345        .unwrap_or("application/octet-stream");
346    let content_type = super::ContentType::from(content_type);
347
348    if !status.is_client_error() && !status.is_server_error() {
349        let content = resp.text().await?;
350        match content_type {
351            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
352            ContentType::Text => Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::WorkflowStages`"))),
353            ContentType::Unsupported(unknown_type) => Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::WorkflowStages`")))),
354        }
355    } else {
356        let content = resp.text().await?;
357        let entity: Option<CancelWorkflowError> = serde_json::from_str(&content).ok();
358        Err(Error::ResponseError(ResponseContent {
359            status,
360            content,
361            entity,
362        }))
363    }
364}
365
366pub async fn delete_action(
367    configuration: &configuration::Configuration,
368    repo_ref: &str,
369    action_identifier: &str,
370) -> Result<(), Error<DeleteActionError>> {
371    // add a prefix to parameters to efficiently prevent name collisions
372    let p_path_repo_ref = repo_ref;
373    let p_path_action_identifier = action_identifier;
374
375    let uri_str = format!(
376        "{}/repos/{repo_ref}/+/actions/{action_identifier}",
377        configuration.base_path,
378        repo_ref = crate::apis::urlencode(p_path_repo_ref),
379        action_identifier = crate::apis::urlencode(p_path_action_identifier)
380    );
381    let mut req_builder = configuration
382        .client
383        .request(reqwest::Method::DELETE, &uri_str);
384
385    if let Some(ref apikey) = configuration.api_key {
386        let key = apikey.key.clone();
387        let value = match apikey.prefix {
388            Some(ref prefix) => format!("{} {}", prefix, key),
389            None => key,
390        };
391        req_builder = req_builder.query(&[("access_token", value)]);
392    }
393    if let Some(ref user_agent) = configuration.user_agent {
394        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
395    }
396    if let Some(ref auth_conf) = configuration.basic_auth {
397        req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
398    };
399    if let Some(ref token) = configuration.bearer_access_token {
400        req_builder = req_builder.bearer_auth(token.to_owned());
401    };
402
403    let req = req_builder.build()?;
404    let resp = configuration.client.execute(req).await?;
405
406    let status = resp.status();
407
408    if !status.is_client_error() && !status.is_server_error() {
409        Ok(())
410    } else {
411        let content = resp.text().await?;
412        let entity: Option<DeleteActionError> = serde_json::from_str(&content).ok();
413        Err(Error::ResponseError(ResponseContent {
414            status,
415            content,
416            entity,
417        }))
418    }
419}
420
421pub async fn delete_workflow(
422    configuration: &configuration::Configuration,
423    repo_ref: &str,
424    action_identifier: &str,
425    workflow_idn: i64,
426) -> Result<(), Error<DeleteWorkflowError>> {
427    // add a prefix to parameters to efficiently prevent name collisions
428    let p_path_repo_ref = repo_ref;
429    let p_path_action_identifier = action_identifier;
430    let p_path_workflow_idn = workflow_idn;
431
432    let uri_str = format!(
433        "{}/repos/{repo_ref}/+/actions/{action_identifier}/workflows/{workflow_idn}",
434        configuration.base_path,
435        repo_ref = crate::apis::urlencode(p_path_repo_ref),
436        action_identifier = crate::apis::urlencode(p_path_action_identifier),
437        workflow_idn = p_path_workflow_idn
438    );
439    let mut req_builder = configuration
440        .client
441        .request(reqwest::Method::DELETE, &uri_str);
442
443    if let Some(ref apikey) = configuration.api_key {
444        let key = apikey.key.clone();
445        let value = match apikey.prefix {
446            Some(ref prefix) => format!("{} {}", prefix, key),
447            None => key,
448        };
449        req_builder = req_builder.query(&[("access_token", value)]);
450    }
451    if let Some(ref user_agent) = configuration.user_agent {
452        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
453    }
454    if let Some(ref auth_conf) = configuration.basic_auth {
455        req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
456    };
457    if let Some(ref token) = configuration.bearer_access_token {
458        req_builder = req_builder.bearer_auth(token.to_owned());
459    };
460
461    let req = req_builder.build()?;
462    let resp = configuration.client.execute(req).await?;
463
464    let status = resp.status();
465
466    if !status.is_client_error() && !status.is_server_error() {
467        Ok(())
468    } else {
469        let content = resp.text().await?;
470        let entity: Option<DeleteWorkflowError> = serde_json::from_str(&content).ok();
471        Err(Error::ResponseError(ResponseContent {
472            status,
473            content,
474            entity,
475        }))
476    }
477}
478
479pub async fn get_action(
480    configuration: &configuration::Configuration,
481    repo_ref: &str,
482    action_identifier: &str,
483) -> Result<models::ActionModel, Error<GetActionError>> {
484    // add a prefix to parameters to efficiently prevent name collisions
485    let p_path_repo_ref = repo_ref;
486    let p_path_action_identifier = action_identifier;
487
488    let uri_str = format!(
489        "{}/repos/{repo_ref}/+/actions/{action_identifier}",
490        configuration.base_path,
491        repo_ref = crate::apis::urlencode(p_path_repo_ref),
492        action_identifier = crate::apis::urlencode(p_path_action_identifier)
493    );
494    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
495
496    if let Some(ref apikey) = configuration.api_key {
497        let key = apikey.key.clone();
498        let value = match apikey.prefix {
499            Some(ref prefix) => format!("{} {}", prefix, key),
500            None => key,
501        };
502        req_builder = req_builder.query(&[("access_token", value)]);
503    }
504    if let Some(ref user_agent) = configuration.user_agent {
505        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
506    }
507    if let Some(ref auth_conf) = configuration.basic_auth {
508        req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
509    };
510    if let Some(ref token) = configuration.bearer_access_token {
511        req_builder = req_builder.bearer_auth(token.to_owned());
512    };
513
514    let req = req_builder.build()?;
515    let resp = configuration.client.execute(req).await?;
516
517    let status = resp.status();
518    let content_type = resp
519        .headers()
520        .get("content-type")
521        .and_then(|v| v.to_str().ok())
522        .unwrap_or("application/octet-stream");
523    let content_type = super::ContentType::from(content_type);
524
525    if !status.is_client_error() && !status.is_server_error() {
526        let content = resp.text().await?;
527        match content_type {
528            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
529            ContentType::Text => Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::ActionModel`"))),
530            ContentType::Unsupported(unknown_type) => Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::ActionModel`")))),
531        }
532    } else {
533        let content = resp.text().await?;
534        let entity: Option<GetActionError> = serde_json::from_str(&content).ok();
535        Err(Error::ResponseError(ResponseContent {
536            status,
537            content,
538            entity,
539        }))
540    }
541}
542
543pub async fn get_action_inputs(
544    configuration: &configuration::Configuration,
545    repo_ref: &str,
546    action_identifier: &str,
547) -> Result<Vec<Vec<serde_json::Value>>, Error<GetActionInputsError>> {
548    // add a prefix to parameters to efficiently prevent name collisions
549    let p_path_repo_ref = repo_ref;
550    let p_path_action_identifier = action_identifier;
551
552    let uri_str = format!(
553        "{}/repos/{repo_ref}/+/actions/{action_identifier}/inputs",
554        configuration.base_path,
555        repo_ref = crate::apis::urlencode(p_path_repo_ref),
556        action_identifier = crate::apis::urlencode(p_path_action_identifier)
557    );
558    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
559
560    if let Some(ref apikey) = configuration.api_key {
561        let key = apikey.key.clone();
562        let value = match apikey.prefix {
563            Some(ref prefix) => format!("{} {}", prefix, key),
564            None => key,
565        };
566        req_builder = req_builder.query(&[("access_token", value)]);
567    }
568    if let Some(ref user_agent) = configuration.user_agent {
569        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
570    }
571    if let Some(ref auth_conf) = configuration.basic_auth {
572        req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
573    };
574    if let Some(ref token) = configuration.bearer_access_token {
575        req_builder = req_builder.bearer_auth(token.to_owned());
576    };
577
578    let req = req_builder.build()?;
579    let resp = configuration.client.execute(req).await?;
580
581    let status = resp.status();
582    let content_type = resp
583        .headers()
584        .get("content-type")
585        .and_then(|v| v.to_str().ok())
586        .unwrap_or("application/octet-stream");
587    let content_type = super::ContentType::from(content_type);
588
589    if !status.is_client_error() && !status.is_server_error() {
590        let content = resp.text().await?;
591        match content_type {
592            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
593            ContentType::Text => Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec&lt;Vec&lt;serde_json::Value&gt;&gt;`"))),
594            ContentType::Unsupported(unknown_type) => Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `Vec&lt;Vec&lt;serde_json::Value&gt;&gt;`")))),
595        }
596    } else {
597        let content = resp.text().await?;
598        let entity: Option<GetActionInputsError> = serde_json::from_str(&content).ok();
599        Err(Error::ResponseError(ResponseContent {
600            status,
601            content,
602            entity,
603        }))
604    }
605}
606
607pub async fn get_actions(
608    configuration: &configuration::Configuration,
609    repo_ref: &str,
610    page: Option<i64>,
611    size: Option<i64>,
612    query: Option<&str>,
613    latest: Option<bool>,
614) -> Result<Vec<models::ActionWorkflow>, Error<GetActionsError>> {
615    // add a prefix to parameters to efficiently prevent name collisions
616    let p_path_repo_ref = repo_ref;
617    let p_query_page = page;
618    let p_query_size = size;
619    let p_query_query = query;
620    let p_query_latest = latest;
621
622    let uri_str = format!(
623        "{}/repos/{repo_ref}/+/actions",
624        configuration.base_path,
625        repo_ref = crate::apis::urlencode(p_path_repo_ref)
626    );
627    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
628
629    if let Some(ref param_value) = p_query_page {
630        req_builder = req_builder.query(&[("page", &param_value.to_string())]);
631    }
632    if let Some(ref param_value) = p_query_size {
633        req_builder = req_builder.query(&[("size", &param_value.to_string())]);
634    }
635    if let Some(ref param_value) = p_query_query {
636        req_builder = req_builder.query(&[("query", &param_value.to_string())]);
637    }
638    if let Some(ref param_value) = p_query_latest {
639        req_builder = req_builder.query(&[("latest", &param_value.to_string())]);
640    }
641    if let Some(ref apikey) = configuration.api_key {
642        let key = apikey.key.clone();
643        let value = match apikey.prefix {
644            Some(ref prefix) => format!("{} {}", prefix, key),
645            None => key,
646        };
647        req_builder = req_builder.query(&[("access_token", value)]);
648    }
649    if let Some(ref user_agent) = configuration.user_agent {
650        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
651    }
652    if let Some(ref auth_conf) = configuration.basic_auth {
653        req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
654    };
655    if let Some(ref token) = configuration.bearer_access_token {
656        req_builder = req_builder.bearer_auth(token.to_owned());
657    };
658
659    let req = req_builder.build()?;
660    let resp = configuration.client.execute(req).await?;
661
662    let status = resp.status();
663    let content_type = resp
664        .headers()
665        .get("content-type")
666        .and_then(|v| v.to_str().ok())
667        .unwrap_or("application/octet-stream");
668    let content_type = super::ContentType::from(content_type);
669
670    if !status.is_client_error() && !status.is_server_error() {
671        let content = resp.text().await?;
672        match content_type {
673            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
674            ContentType::Text => Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec&lt;models::ActionWorkflow&gt;`"))),
675            ContentType::Unsupported(unknown_type) => Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `Vec&lt;models::ActionWorkflow&gt;`")))),
676        }
677    } else {
678        let content = resp.text().await?;
679        let entity: Option<GetActionsError> = serde_json::from_str(&content).ok();
680        Err(Error::ResponseError(ResponseContent {
681            status,
682            content,
683            entity,
684        }))
685    }
686}
687
688pub async fn get_step_log_stream(
689    configuration: &configuration::Configuration,
690    repo_ref: &str,
691    action_identifier: &str,
692    workflow_idn: i64,
693    stage_number: i64,
694    step_number: i64,
695) -> Result<Vec<models::LiveLogLine>, Error<GetStepLogStreamError>> {
696    // add a prefix to parameters to efficiently prevent name collisions
697    let p_path_repo_ref = repo_ref;
698    let p_path_action_identifier = action_identifier;
699    let p_path_workflow_idn = workflow_idn;
700    let p_path_stage_number = stage_number;
701    let p_path_step_number = step_number;
702
703    let uri_str = format!("{}/repos/{repo_ref}/+/actions/{action_identifier}/workflows/{workflow_idn}/stages/{stage_number}/{step_number}/logstream", configuration.base_path, repo_ref=crate::apis::urlencode(p_path_repo_ref), action_identifier=crate::apis::urlencode(p_path_action_identifier), workflow_idn=p_path_workflow_idn, stage_number=p_path_stage_number, step_number=p_path_step_number);
704    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
705
706    if let Some(ref apikey) = configuration.api_key {
707        let key = apikey.key.clone();
708        let value = match apikey.prefix {
709            Some(ref prefix) => format!("{} {}", prefix, key),
710            None => key,
711        };
712        req_builder = req_builder.query(&[("access_token", value)]);
713    }
714    if let Some(ref user_agent) = configuration.user_agent {
715        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
716    }
717    if let Some(ref auth_conf) = configuration.basic_auth {
718        req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
719    };
720    if let Some(ref token) = configuration.bearer_access_token {
721        req_builder = req_builder.bearer_auth(token.to_owned());
722    };
723
724    let req = req_builder.build()?;
725    let resp = configuration.client.execute(req).await?;
726
727    let status = resp.status();
728    let content_type = resp
729        .headers()
730        .get("content-type")
731        .and_then(|v| v.to_str().ok())
732        .unwrap_or("application/octet-stream");
733    let content_type = super::ContentType::from(content_type);
734
735    if !status.is_client_error() && !status.is_server_error() {
736        let content = resp.text().await?;
737        match content_type {
738            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
739            ContentType::Text => Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec&lt;models::LiveLogLine&gt;`"))),
740            ContentType::Unsupported(unknown_type) => Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `Vec&lt;models::LiveLogLine&gt;`")))),
741        }
742    } else {
743        let content = resp.text().await?;
744        let entity: Option<GetStepLogStreamError> = serde_json::from_str(&content).ok();
745        Err(Error::ResponseError(ResponseContent {
746            status,
747            content,
748            entity,
749        }))
750    }
751}
752
753pub async fn get_step_logs(
754    configuration: &configuration::Configuration,
755    repo_ref: &str,
756    action_identifier: &str,
757    workflow_idn: i64,
758    stage_number: i64,
759    step_number: i64,
760) -> Result<Vec<models::LiveLogLine>, Error<GetStepLogsError>> {
761    // add a prefix to parameters to efficiently prevent name collisions
762    let p_path_repo_ref = repo_ref;
763    let p_path_action_identifier = action_identifier;
764    let p_path_workflow_idn = workflow_idn;
765    let p_path_stage_number = stage_number;
766    let p_path_step_number = step_number;
767
768    let uri_str = format!("{}/repos/{repo_ref}/+/actions/{action_identifier}/workflows/{workflow_idn}/stages/{stage_number}/{step_number}/logs", configuration.base_path, repo_ref=crate::apis::urlencode(p_path_repo_ref), action_identifier=crate::apis::urlencode(p_path_action_identifier), workflow_idn=p_path_workflow_idn, stage_number=p_path_stage_number, step_number=p_path_step_number);
769    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
770
771    if let Some(ref apikey) = configuration.api_key {
772        let key = apikey.key.clone();
773        let value = match apikey.prefix {
774            Some(ref prefix) => format!("{} {}", prefix, key),
775            None => key,
776        };
777        req_builder = req_builder.query(&[("access_token", value)]);
778    }
779    if let Some(ref user_agent) = configuration.user_agent {
780        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
781    }
782    if let Some(ref auth_conf) = configuration.basic_auth {
783        req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
784    };
785    if let Some(ref token) = configuration.bearer_access_token {
786        req_builder = req_builder.bearer_auth(token.to_owned());
787    };
788
789    let req = req_builder.build()?;
790    let resp = configuration.client.execute(req).await?;
791
792    let status = resp.status();
793    let content_type = resp
794        .headers()
795        .get("content-type")
796        .and_then(|v| v.to_str().ok())
797        .unwrap_or("application/octet-stream");
798    let content_type = super::ContentType::from(content_type);
799
800    if !status.is_client_error() && !status.is_server_error() {
801        let content = resp.text().await?;
802        match content_type {
803            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
804            ContentType::Text => Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec&lt;models::LiveLogLine&gt;`"))),
805            ContentType::Unsupported(unknown_type) => Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `Vec&lt;models::LiveLogLine&gt;`")))),
806        }
807    } else {
808        let content = resp.text().await?;
809        let entity: Option<GetStepLogsError> = serde_json::from_str(&content).ok();
810        Err(Error::ResponseError(ResponseContent {
811            status,
812            content,
813            entity,
814        }))
815    }
816}
817
818pub async fn get_workflow(
819    configuration: &configuration::Configuration,
820    repo_ref: &str,
821    action_identifier: &str,
822    workflow_idn: i64,
823) -> Result<models::WorkflowStages, Error<GetWorkflowError>> {
824    // add a prefix to parameters to efficiently prevent name collisions
825    let p_path_repo_ref = repo_ref;
826    let p_path_action_identifier = action_identifier;
827    let p_path_workflow_idn = workflow_idn;
828
829    let uri_str = format!(
830        "{}/repos/{repo_ref}/+/actions/{action_identifier}/workflows/{workflow_idn}",
831        configuration.base_path,
832        repo_ref = crate::apis::urlencode(p_path_repo_ref),
833        action_identifier = crate::apis::urlencode(p_path_action_identifier),
834        workflow_idn = p_path_workflow_idn
835    );
836    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
837
838    if let Some(ref apikey) = configuration.api_key {
839        let key = apikey.key.clone();
840        let value = match apikey.prefix {
841            Some(ref prefix) => format!("{} {}", prefix, key),
842            None => key,
843        };
844        req_builder = req_builder.query(&[("access_token", value)]);
845    }
846    if let Some(ref user_agent) = configuration.user_agent {
847        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
848    }
849    if let Some(ref auth_conf) = configuration.basic_auth {
850        req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
851    };
852    if let Some(ref token) = configuration.bearer_access_token {
853        req_builder = req_builder.bearer_auth(token.to_owned());
854    };
855
856    let req = req_builder.build()?;
857    let resp = configuration.client.execute(req).await?;
858
859    let status = resp.status();
860    let content_type = resp
861        .headers()
862        .get("content-type")
863        .and_then(|v| v.to_str().ok())
864        .unwrap_or("application/octet-stream");
865    let content_type = super::ContentType::from(content_type);
866
867    if !status.is_client_error() && !status.is_server_error() {
868        let content = resp.text().await?;
869        match content_type {
870            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
871            ContentType::Text => Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::WorkflowStages`"))),
872            ContentType::Unsupported(unknown_type) => Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::WorkflowStages`")))),
873        }
874    } else {
875        let content = resp.text().await?;
876        let entity: Option<GetWorkflowError> = serde_json::from_str(&content).ok();
877        Err(Error::ResponseError(ResponseContent {
878            status,
879            content,
880            entity,
881        }))
882    }
883}
884
885pub async fn get_workflows(
886    configuration: &configuration::Configuration,
887    repo_ref: &str,
888    action_identifier: &str,
889    page: Option<i64>,
890    size: Option<i64>,
891) -> Result<Vec<models::WorkflowModel>, Error<GetWorkflowsError>> {
892    // add a prefix to parameters to efficiently prevent name collisions
893    let p_path_repo_ref = repo_ref;
894    let p_path_action_identifier = action_identifier;
895    let p_query_page = page;
896    let p_query_size = size;
897
898    let uri_str = format!(
899        "{}/repos/{repo_ref}/+/actions/{action_identifier}/workflows",
900        configuration.base_path,
901        repo_ref = crate::apis::urlencode(p_path_repo_ref),
902        action_identifier = crate::apis::urlencode(p_path_action_identifier)
903    );
904    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
905
906    if let Some(ref param_value) = p_query_page {
907        req_builder = req_builder.query(&[("page", &param_value.to_string())]);
908    }
909    if let Some(ref param_value) = p_query_size {
910        req_builder = req_builder.query(&[("size", &param_value.to_string())]);
911    }
912    if let Some(ref apikey) = configuration.api_key {
913        let key = apikey.key.clone();
914        let value = match apikey.prefix {
915            Some(ref prefix) => format!("{} {}", prefix, key),
916            None => key,
917        };
918        req_builder = req_builder.query(&[("access_token", value)]);
919    }
920    if let Some(ref user_agent) = configuration.user_agent {
921        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
922    }
923    if let Some(ref auth_conf) = configuration.basic_auth {
924        req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
925    };
926    if let Some(ref token) = configuration.bearer_access_token {
927        req_builder = req_builder.bearer_auth(token.to_owned());
928    };
929
930    let req = req_builder.build()?;
931    let resp = configuration.client.execute(req).await?;
932
933    let status = resp.status();
934    let content_type = resp
935        .headers()
936        .get("content-type")
937        .and_then(|v| v.to_str().ok())
938        .unwrap_or("application/octet-stream");
939    let content_type = super::ContentType::from(content_type);
940
941    if !status.is_client_error() && !status.is_server_error() {
942        let content = resp.text().await?;
943        match content_type {
944            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
945            ContentType::Text => Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec&lt;models::WorkflowModel&gt;`"))),
946            ContentType::Unsupported(unknown_type) => Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `Vec&lt;models::WorkflowModel&gt;`")))),
947        }
948    } else {
949        let content = resp.text().await?;
950        let entity: Option<GetWorkflowsError> = serde_json::from_str(&content).ok();
951        Err(Error::ResponseError(ResponseContent {
952            status,
953            content,
954            entity,
955        }))
956    }
957}
958
959pub async fn patch_action(
960    configuration: &configuration::Configuration,
961    repo_ref: &str,
962    action_identifier: &str,
963    action_update_input: models::ActionUpdateInput,
964) -> Result<models::ActionModel, Error<PatchActionError>> {
965    // add a prefix to parameters to efficiently prevent name collisions
966    let p_path_repo_ref = repo_ref;
967    let p_path_action_identifier = action_identifier;
968    let p_body_action_update_input = action_update_input;
969
970    let uri_str = format!(
971        "{}/repos/{repo_ref}/+/actions/{action_identifier}",
972        configuration.base_path,
973        repo_ref = crate::apis::urlencode(p_path_repo_ref),
974        action_identifier = crate::apis::urlencode(p_path_action_identifier)
975    );
976    let mut req_builder = configuration
977        .client
978        .request(reqwest::Method::PATCH, &uri_str);
979
980    if let Some(ref apikey) = configuration.api_key {
981        let key = apikey.key.clone();
982        let value = match apikey.prefix {
983            Some(ref prefix) => format!("{} {}", prefix, key),
984            None => key,
985        };
986        req_builder = req_builder.query(&[("access_token", value)]);
987    }
988    if let Some(ref user_agent) = configuration.user_agent {
989        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
990    }
991    if let Some(ref auth_conf) = configuration.basic_auth {
992        req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
993    };
994    if let Some(ref token) = configuration.bearer_access_token {
995        req_builder = req_builder.bearer_auth(token.to_owned());
996    };
997    req_builder = req_builder.json(&p_body_action_update_input);
998
999    let req = req_builder.build()?;
1000    let resp = configuration.client.execute(req).await?;
1001
1002    let status = resp.status();
1003    let content_type = resp
1004        .headers()
1005        .get("content-type")
1006        .and_then(|v| v.to_str().ok())
1007        .unwrap_or("application/octet-stream");
1008    let content_type = super::ContentType::from(content_type);
1009
1010    if !status.is_client_error() && !status.is_server_error() {
1011        let content = resp.text().await?;
1012        match content_type {
1013            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1014            ContentType::Text => Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::ActionModel`"))),
1015            ContentType::Unsupported(unknown_type) => Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::ActionModel`")))),
1016        }
1017    } else {
1018        let content = resp.text().await?;
1019        let entity: Option<PatchActionError> = serde_json::from_str(&content).ok();
1020        Err(Error::ResponseError(ResponseContent {
1021            status,
1022            content,
1023            entity,
1024        }))
1025    }
1026}
1027
1028pub async fn patch_stage(
1029    configuration: &configuration::Configuration,
1030    repo_ref: &str,
1031    action_identifier: &str,
1032    workflow_idn: i64,
1033    stage_number: i64,
1034    stage_update_input: models::StageUpdateInput,
1035) -> Result<models::StageModel, Error<PatchStageError>> {
1036    // add a prefix to parameters to efficiently prevent name collisions
1037    let p_path_repo_ref = repo_ref;
1038    let p_path_action_identifier = action_identifier;
1039    let p_path_workflow_idn = workflow_idn;
1040    let p_path_stage_number = stage_number;
1041    let p_body_stage_update_input = stage_update_input;
1042
1043    let uri_str = format!("{}/repos/{repo_ref}/+/actions/{action_identifier}/workflows/{workflow_idn}/stages/{stage_number}", configuration.base_path, repo_ref=crate::apis::urlencode(p_path_repo_ref), action_identifier=crate::apis::urlencode(p_path_action_identifier), workflow_idn=p_path_workflow_idn, stage_number=p_path_stage_number);
1044    let mut req_builder = configuration
1045        .client
1046        .request(reqwest::Method::PATCH, &uri_str);
1047
1048    if let Some(ref apikey) = configuration.api_key {
1049        let key = apikey.key.clone();
1050        let value = match apikey.prefix {
1051            Some(ref prefix) => format!("{} {}", prefix, key),
1052            None => key,
1053        };
1054        req_builder = req_builder.query(&[("access_token", value)]);
1055    }
1056    if let Some(ref user_agent) = configuration.user_agent {
1057        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1058    }
1059    if let Some(ref auth_conf) = configuration.basic_auth {
1060        req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
1061    };
1062    if let Some(ref token) = configuration.bearer_access_token {
1063        req_builder = req_builder.bearer_auth(token.to_owned());
1064    };
1065    req_builder = req_builder.json(&p_body_stage_update_input);
1066
1067    let req = req_builder.build()?;
1068    let resp = configuration.client.execute(req).await?;
1069
1070    let status = resp.status();
1071    let content_type = resp
1072        .headers()
1073        .get("content-type")
1074        .and_then(|v| v.to_str().ok())
1075        .unwrap_or("application/octet-stream");
1076    let content_type = super::ContentType::from(content_type);
1077
1078    if !status.is_client_error() && !status.is_server_error() {
1079        let content = resp.text().await?;
1080        match content_type {
1081            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1082            ContentType::Text => Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::StageModel`"))),
1083            ContentType::Unsupported(unknown_type) => Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::StageModel`")))),
1084        }
1085    } else {
1086        let content = resp.text().await?;
1087        let entity: Option<PatchStageError> = serde_json::from_str(&content).ok();
1088        Err(Error::ResponseError(ResponseContent {
1089            status,
1090            content,
1091            entity,
1092        }))
1093    }
1094}
1095
1096pub async fn patch_step(
1097    configuration: &configuration::Configuration,
1098    repo_ref: &str,
1099    action_identifier: &str,
1100    workflow_idn: i64,
1101    stage_number: i64,
1102    step_number: i64,
1103    step_update_input: models::StepUpdateInput,
1104) -> Result<models::StepModel, Error<PatchStepError>> {
1105    // add a prefix to parameters to efficiently prevent name collisions
1106    let p_path_repo_ref = repo_ref;
1107    let p_path_action_identifier = action_identifier;
1108    let p_path_workflow_idn = workflow_idn;
1109    let p_path_stage_number = stage_number;
1110    let p_path_step_number = step_number;
1111    let p_body_step_update_input = step_update_input;
1112
1113    let uri_str = format!("{}/repos/{repo_ref}/+/actions/{action_identifier}/workflows/{workflow_idn}/stages/{stage_number}/{step_number}", configuration.base_path, repo_ref=crate::apis::urlencode(p_path_repo_ref), action_identifier=crate::apis::urlencode(p_path_action_identifier), workflow_idn=p_path_workflow_idn, stage_number=p_path_stage_number, step_number=p_path_step_number);
1114    let mut req_builder = configuration
1115        .client
1116        .request(reqwest::Method::PATCH, &uri_str);
1117
1118    if let Some(ref apikey) = configuration.api_key {
1119        let key = apikey.key.clone();
1120        let value = match apikey.prefix {
1121            Some(ref prefix) => format!("{} {}", prefix, key),
1122            None => key,
1123        };
1124        req_builder = req_builder.query(&[("access_token", value)]);
1125    }
1126    if let Some(ref user_agent) = configuration.user_agent {
1127        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1128    }
1129    if let Some(ref auth_conf) = configuration.basic_auth {
1130        req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
1131    };
1132    if let Some(ref token) = configuration.bearer_access_token {
1133        req_builder = req_builder.bearer_auth(token.to_owned());
1134    };
1135    req_builder = req_builder.json(&p_body_step_update_input);
1136
1137    let req = req_builder.build()?;
1138    let resp = configuration.client.execute(req).await?;
1139
1140    let status = resp.status();
1141    let content_type = resp
1142        .headers()
1143        .get("content-type")
1144        .and_then(|v| v.to_str().ok())
1145        .unwrap_or("application/octet-stream");
1146    let content_type = super::ContentType::from(content_type);
1147
1148    if !status.is_client_error() && !status.is_server_error() {
1149        let content = resp.text().await?;
1150        match content_type {
1151            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1152            ContentType::Text => Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::StepModel`"))),
1153            ContentType::Unsupported(unknown_type) => Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::StepModel`")))),
1154        }
1155    } else {
1156        let content = resp.text().await?;
1157        let entity: Option<PatchStepError> = serde_json::from_str(&content).ok();
1158        Err(Error::ResponseError(ResponseContent {
1159            status,
1160            content,
1161            entity,
1162        }))
1163    }
1164}
1165
1166pub async fn patch_workflow(
1167    configuration: &configuration::Configuration,
1168    repo_ref: &str,
1169    action_identifier: &str,
1170    workflow_idn: i64,
1171    workflow_update_input: models::WorkflowUpdateInput,
1172) -> Result<models::WorkflowModel, Error<PatchWorkflowError>> {
1173    // add a prefix to parameters to efficiently prevent name collisions
1174    let p_path_repo_ref = repo_ref;
1175    let p_path_action_identifier = action_identifier;
1176    let p_path_workflow_idn = workflow_idn;
1177    let p_body_workflow_update_input = workflow_update_input;
1178
1179    let uri_str = format!(
1180        "{}/repos/{repo_ref}/+/actions/{action_identifier}/workflows/{workflow_idn}",
1181        configuration.base_path,
1182        repo_ref = crate::apis::urlencode(p_path_repo_ref),
1183        action_identifier = crate::apis::urlencode(p_path_action_identifier),
1184        workflow_idn = p_path_workflow_idn
1185    );
1186    let mut req_builder = configuration
1187        .client
1188        .request(reqwest::Method::PATCH, &uri_str);
1189
1190    if let Some(ref apikey) = configuration.api_key {
1191        let key = apikey.key.clone();
1192        let value = match apikey.prefix {
1193            Some(ref prefix) => format!("{} {}", prefix, key),
1194            None => key,
1195        };
1196        req_builder = req_builder.query(&[("access_token", value)]);
1197    }
1198    if let Some(ref user_agent) = configuration.user_agent {
1199        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1200    }
1201    if let Some(ref auth_conf) = configuration.basic_auth {
1202        req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
1203    };
1204    if let Some(ref token) = configuration.bearer_access_token {
1205        req_builder = req_builder.bearer_auth(token.to_owned());
1206    };
1207    req_builder = req_builder.json(&p_body_workflow_update_input);
1208
1209    let req = req_builder.build()?;
1210    let resp = configuration.client.execute(req).await?;
1211
1212    let status = resp.status();
1213    let content_type = resp
1214        .headers()
1215        .get("content-type")
1216        .and_then(|v| v.to_str().ok())
1217        .unwrap_or("application/octet-stream");
1218    let content_type = super::ContentType::from(content_type);
1219
1220    if !status.is_client_error() && !status.is_server_error() {
1221        let content = resp.text().await?;
1222        match content_type {
1223            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1224            ContentType::Text => Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::WorkflowModel`"))),
1225            ContentType::Unsupported(unknown_type) => Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::WorkflowModel`")))),
1226        }
1227    } else {
1228        let content = resp.text().await?;
1229        let entity: Option<PatchWorkflowError> = serde_json::from_str(&content).ok();
1230        Err(Error::ResponseError(ResponseContent {
1231            status,
1232            content,
1233            entity,
1234        }))
1235    }
1236}
1237
1238pub async fn post_action(
1239    configuration: &configuration::Configuration,
1240    repo_ref: &str,
1241    action_create_input: models::ActionCreateInput,
1242) -> Result<models::ActionModel, Error<PostActionError>> {
1243    // add a prefix to parameters to efficiently prevent name collisions
1244    let p_path_repo_ref = repo_ref;
1245    let p_body_action_create_input = action_create_input;
1246
1247    let uri_str = format!(
1248        "{}/repos/{repo_ref}/+/actions",
1249        configuration.base_path,
1250        repo_ref = crate::apis::urlencode(p_path_repo_ref)
1251    );
1252    let mut req_builder = configuration
1253        .client
1254        .request(reqwest::Method::POST, &uri_str);
1255
1256    if let Some(ref apikey) = configuration.api_key {
1257        let key = apikey.key.clone();
1258        let value = match apikey.prefix {
1259            Some(ref prefix) => format!("{} {}", prefix, key),
1260            None => key,
1261        };
1262        req_builder = req_builder.query(&[("access_token", value)]);
1263    }
1264    if let Some(ref user_agent) = configuration.user_agent {
1265        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1266    }
1267    if let Some(ref auth_conf) = configuration.basic_auth {
1268        req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
1269    };
1270    if let Some(ref token) = configuration.bearer_access_token {
1271        req_builder = req_builder.bearer_auth(token.to_owned());
1272    };
1273    req_builder = req_builder.json(&p_body_action_create_input);
1274
1275    let req = req_builder.build()?;
1276    let resp = configuration.client.execute(req).await?;
1277
1278    let status = resp.status();
1279    let content_type = resp
1280        .headers()
1281        .get("content-type")
1282        .and_then(|v| v.to_str().ok())
1283        .unwrap_or("application/octet-stream");
1284    let content_type = super::ContentType::from(content_type);
1285
1286    if !status.is_client_error() && !status.is_server_error() {
1287        let content = resp.text().await?;
1288        match content_type {
1289            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1290            ContentType::Text => Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::ActionModel`"))),
1291            ContentType::Unsupported(unknown_type) => Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::ActionModel`")))),
1292        }
1293    } else {
1294        let content = resp.text().await?;
1295        let entity: Option<PostActionError> = serde_json::from_str(&content).ok();
1296        Err(Error::ResponseError(ResponseContent {
1297            status,
1298            content,
1299            entity,
1300        }))
1301    }
1302}
1303
1304pub async fn post_action_inputs(
1305    configuration: &configuration::Configuration,
1306    repo_ref: &str,
1307    action_identifier: &str,
1308    request_body: std::collections::HashMap<String, serde_json::Value>,
1309) -> Result<(), Error<PostActionInputsError>> {
1310    // add a prefix to parameters to efficiently prevent name collisions
1311    let p_path_repo_ref = repo_ref;
1312    let p_path_action_identifier = action_identifier;
1313    let p_body_request_body = request_body;
1314
1315    let uri_str = format!(
1316        "{}/repos/{repo_ref}/+/actions/{action_identifier}/inputs",
1317        configuration.base_path,
1318        repo_ref = crate::apis::urlencode(p_path_repo_ref),
1319        action_identifier = crate::apis::urlencode(p_path_action_identifier)
1320    );
1321    let mut req_builder = configuration
1322        .client
1323        .request(reqwest::Method::POST, &uri_str);
1324
1325    if let Some(ref apikey) = configuration.api_key {
1326        let key = apikey.key.clone();
1327        let value = match apikey.prefix {
1328            Some(ref prefix) => format!("{} {}", prefix, key),
1329            None => key,
1330        };
1331        req_builder = req_builder.query(&[("access_token", value)]);
1332    }
1333    if let Some(ref user_agent) = configuration.user_agent {
1334        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1335    }
1336    if let Some(ref auth_conf) = configuration.basic_auth {
1337        req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
1338    };
1339    if let Some(ref token) = configuration.bearer_access_token {
1340        req_builder = req_builder.bearer_auth(token.to_owned());
1341    };
1342    req_builder = req_builder.json(&p_body_request_body);
1343
1344    let req = req_builder.build()?;
1345    let resp = configuration.client.execute(req).await?;
1346
1347    let status = resp.status();
1348
1349    if !status.is_client_error() && !status.is_server_error() {
1350        Ok(())
1351    } else {
1352        let content = resp.text().await?;
1353        let entity: Option<PostActionInputsError> = serde_json::from_str(&content).ok();
1354        Err(Error::ResponseError(ResponseContent {
1355            status,
1356            content,
1357            entity,
1358        }))
1359    }
1360}
1361
1362pub async fn post_step(
1363    configuration: &configuration::Configuration,
1364    repo_ref: &str,
1365    action_identifier: &str,
1366    workflow_idn: i64,
1367    stage_number: i64,
1368    step_create_input: models::StepCreateInput,
1369) -> Result<models::StepModel, Error<PostStepError>> {
1370    // add a prefix to parameters to efficiently prevent name collisions
1371    let p_path_repo_ref = repo_ref;
1372    let p_path_action_identifier = action_identifier;
1373    let p_path_workflow_idn = workflow_idn;
1374    let p_path_stage_number = stage_number;
1375    let p_body_step_create_input = step_create_input;
1376
1377    let uri_str = format!("{}/repos/{repo_ref}/+/actions/{action_identifier}/workflows/{workflow_idn}/stages/{stage_number}", configuration.base_path, repo_ref=crate::apis::urlencode(p_path_repo_ref), action_identifier=crate::apis::urlencode(p_path_action_identifier), workflow_idn=p_path_workflow_idn, stage_number=p_path_stage_number);
1378    let mut req_builder = configuration
1379        .client
1380        .request(reqwest::Method::POST, &uri_str);
1381
1382    if let Some(ref apikey) = configuration.api_key {
1383        let key = apikey.key.clone();
1384        let value = match apikey.prefix {
1385            Some(ref prefix) => format!("{} {}", prefix, key),
1386            None => key,
1387        };
1388        req_builder = req_builder.query(&[("access_token", value)]);
1389    }
1390    if let Some(ref user_agent) = configuration.user_agent {
1391        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1392    }
1393    if let Some(ref auth_conf) = configuration.basic_auth {
1394        req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
1395    };
1396    if let Some(ref token) = configuration.bearer_access_token {
1397        req_builder = req_builder.bearer_auth(token.to_owned());
1398    };
1399    req_builder = req_builder.json(&p_body_step_create_input);
1400
1401    let req = req_builder.build()?;
1402    let resp = configuration.client.execute(req).await?;
1403
1404    let status = resp.status();
1405    let content_type = resp
1406        .headers()
1407        .get("content-type")
1408        .and_then(|v| v.to_str().ok())
1409        .unwrap_or("application/octet-stream");
1410    let content_type = super::ContentType::from(content_type);
1411
1412    if !status.is_client_error() && !status.is_server_error() {
1413        let content = resp.text().await?;
1414        match content_type {
1415            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1416            ContentType::Text => Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::StepModel`"))),
1417            ContentType::Unsupported(unknown_type) => Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::StepModel`")))),
1418        }
1419    } else {
1420        let content = resp.text().await?;
1421        let entity: Option<PostStepError> = serde_json::from_str(&content).ok();
1422        Err(Error::ResponseError(ResponseContent {
1423            status,
1424            content,
1425            entity,
1426        }))
1427    }
1428}
1429
1430/// Upload workflow step json log
1431pub async fn post_step_log(
1432    configuration: &configuration::Configuration,
1433    repo_ref: &str,
1434    action_identifier: &str,
1435    workflow_idn: i64,
1436    stage_number: i64,
1437    step_number: i64,
1438    live_log_line: models::LiveLogLine,
1439) -> Result<(), Error<PostStepLogError>> {
1440    // add a prefix to parameters to efficiently prevent name collisions
1441    let p_path_repo_ref = repo_ref;
1442    let p_path_action_identifier = action_identifier;
1443    let p_path_workflow_idn = workflow_idn;
1444    let p_path_stage_number = stage_number;
1445    let p_path_step_number = step_number;
1446    let p_body_live_log_line = live_log_line;
1447
1448    let uri_str = format!("{}/repos/{repo_ref}/+/actions/{action_identifier}/workflows/{workflow_idn}/stages/{stage_number}/{step_number}/logs", configuration.base_path, repo_ref=crate::apis::urlencode(p_path_repo_ref), action_identifier=crate::apis::urlencode(p_path_action_identifier), workflow_idn=p_path_workflow_idn, stage_number=p_path_stage_number, step_number=p_path_step_number);
1449    let mut req_builder = configuration
1450        .client
1451        .request(reqwest::Method::POST, &uri_str);
1452
1453    if let Some(ref apikey) = configuration.api_key {
1454        let key = apikey.key.clone();
1455        let value = match apikey.prefix {
1456            Some(ref prefix) => format!("{} {}", prefix, key),
1457            None => key,
1458        };
1459        req_builder = req_builder.query(&[("access_token", value)]);
1460    }
1461    if let Some(ref user_agent) = configuration.user_agent {
1462        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1463    }
1464    if let Some(ref auth_conf) = configuration.basic_auth {
1465        req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
1466    };
1467    if let Some(ref token) = configuration.bearer_access_token {
1468        req_builder = req_builder.bearer_auth(token.to_owned());
1469    };
1470    req_builder = req_builder.json(&p_body_live_log_line);
1471
1472    let req = req_builder.build()?;
1473    let resp = configuration.client.execute(req).await?;
1474
1475    let status = resp.status();
1476
1477    if !status.is_client_error() && !status.is_server_error() {
1478        Ok(())
1479    } else {
1480        let content = resp.text().await?;
1481        let entity: Option<PostStepLogError> = serde_json::from_str(&content).ok();
1482        Err(Error::ResponseError(ResponseContent {
1483            status,
1484            content,
1485            entity,
1486        }))
1487    }
1488}
1489
1490/// Upload workflow step json log by stream, unsupported yet.
1491pub async fn post_step_log_stream(
1492    configuration: &configuration::Configuration,
1493    repo_ref: &str,
1494    action_identifier: &str,
1495    workflow_idn: i64,
1496    stage_number: i64,
1497    step_number: i64,
1498    request_body: Vec<i32>,
1499) -> Result<(), Error<PostStepLogStreamError>> {
1500    // add a prefix to parameters to efficiently prevent name collisions
1501    let p_path_repo_ref = repo_ref;
1502    let p_path_action_identifier = action_identifier;
1503    let p_path_workflow_idn = workflow_idn;
1504    let p_path_stage_number = stage_number;
1505    let p_path_step_number = step_number;
1506    let p_body_request_body = request_body;
1507
1508    let uri_str = format!("{}/repos/{repo_ref}/+/actions/{action_identifier}/workflows/{workflow_idn}/stages/{stage_number}/{step_number}/logstream", configuration.base_path, repo_ref=crate::apis::urlencode(p_path_repo_ref), action_identifier=crate::apis::urlencode(p_path_action_identifier), workflow_idn=p_path_workflow_idn, stage_number=p_path_stage_number, step_number=p_path_step_number);
1509    let mut req_builder = configuration
1510        .client
1511        .request(reqwest::Method::POST, &uri_str);
1512
1513    if let Some(ref apikey) = configuration.api_key {
1514        let key = apikey.key.clone();
1515        let value = match apikey.prefix {
1516            Some(ref prefix) => format!("{} {}", prefix, key),
1517            None => key,
1518        };
1519        req_builder = req_builder.query(&[("access_token", value)]);
1520    }
1521    if let Some(ref user_agent) = configuration.user_agent {
1522        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1523    }
1524    if let Some(ref auth_conf) = configuration.basic_auth {
1525        req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
1526    };
1527    if let Some(ref token) = configuration.bearer_access_token {
1528        req_builder = req_builder.bearer_auth(token.to_owned());
1529    };
1530    req_builder = req_builder.json(&p_body_request_body);
1531
1532    let req = req_builder.build()?;
1533    let resp = configuration.client.execute(req).await?;
1534
1535    let status = resp.status();
1536
1537    if !status.is_client_error() && !status.is_server_error() {
1538        Ok(())
1539    } else {
1540        let content = resp.text().await?;
1541        let entity: Option<PostStepLogStreamError> = serde_json::from_str(&content).ok();
1542        Err(Error::ResponseError(ResponseContent {
1543            status,
1544            content,
1545            entity,
1546        }))
1547    }
1548}
1549
1550pub async fn rerun_workflow(
1551    configuration: &configuration::Configuration,
1552    repo_ref: &str,
1553    action_identifier: &str,
1554    workflow_idn: i64,
1555    workflow_rerun_input: models::WorkflowRerunInput,
1556) -> Result<(), Error<RerunWorkflowError>> {
1557    // add a prefix to parameters to efficiently prevent name collisions
1558    let p_path_repo_ref = repo_ref;
1559    let p_path_action_identifier = action_identifier;
1560    let p_path_workflow_idn = workflow_idn;
1561    let p_body_workflow_rerun_input = workflow_rerun_input;
1562
1563    let uri_str = format!(
1564        "{}/repos/{repo_ref}/+/actions/{action_identifier}/workflows/{workflow_idn}/rerun",
1565        configuration.base_path,
1566        repo_ref = crate::apis::urlencode(p_path_repo_ref),
1567        action_identifier = crate::apis::urlencode(p_path_action_identifier),
1568        workflow_idn = p_path_workflow_idn
1569    );
1570    let mut req_builder = configuration
1571        .client
1572        .request(reqwest::Method::POST, &uri_str);
1573
1574    if let Some(ref apikey) = configuration.api_key {
1575        let key = apikey.key.clone();
1576        let value = match apikey.prefix {
1577            Some(ref prefix) => format!("{} {}", prefix, key),
1578            None => key,
1579        };
1580        req_builder = req_builder.query(&[("access_token", value)]);
1581    }
1582    if let Some(ref user_agent) = configuration.user_agent {
1583        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1584    }
1585    if let Some(ref auth_conf) = configuration.basic_auth {
1586        req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
1587    };
1588    if let Some(ref token) = configuration.bearer_access_token {
1589        req_builder = req_builder.bearer_auth(token.to_owned());
1590    };
1591    req_builder = req_builder.json(&p_body_workflow_rerun_input);
1592
1593    let req = req_builder.build()?;
1594    let resp = configuration.client.execute(req).await?;
1595
1596    let status = resp.status();
1597
1598    if !status.is_client_error() && !status.is_server_error() {
1599        Ok(())
1600    } else {
1601        let content = resp.text().await?;
1602        let entity: Option<RerunWorkflowError> = serde_json::from_str(&content).ok();
1603        Err(Error::ResponseError(ResponseContent {
1604            status,
1605            content,
1606            entity,
1607        }))
1608    }
1609}