gitbundle_sdk/apis/
actions_api.rs

1/*
2 * GitBundle API
3 *
4 * GitBundle API documentation.
5 *
6 * The version of the OpenAPI document: 3.0.0
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_actions`]
74#[derive(Debug, Clone, Serialize, Deserialize)]
75#[serde(untagged)]
76pub enum GetActionsError {
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_step_log_stream`]
88#[derive(Debug, Clone, Serialize, Deserialize)]
89#[serde(untagged)]
90pub enum GetStepLogStreamError {
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_logs`]
102#[derive(Debug, Clone, Serialize, Deserialize)]
103#[serde(untagged)]
104pub enum GetStepLogsError {
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_workflow`]
116#[derive(Debug, Clone, Serialize, Deserialize)]
117#[serde(untagged)]
118pub enum GetWorkflowError {
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_workflows`]
130#[derive(Debug, Clone, Serialize, Deserialize)]
131#[serde(untagged)]
132pub enum GetWorkflowsError {
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 [`patch_action`]
144#[derive(Debug, Clone, Serialize, Deserialize)]
145#[serde(untagged)]
146pub enum PatchActionError {
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_stage`]
158#[derive(Debug, Clone, Serialize, Deserialize)]
159#[serde(untagged)]
160pub enum PatchStageError {
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_step`]
172#[derive(Debug, Clone, Serialize, Deserialize)]
173#[serde(untagged)]
174pub enum PatchStepError {
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_workflow`]
186#[derive(Debug, Clone, Serialize, Deserialize)]
187#[serde(untagged)]
188pub enum PatchWorkflowError {
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 [`post_action`]
200#[derive(Debug, Clone, Serialize, Deserialize)]
201#[serde(untagged)]
202pub enum PostActionError {
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_step`]
214#[derive(Debug, Clone, Serialize, Deserialize)]
215#[serde(untagged)]
216pub enum PostStepError {
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_step_log`]
228#[derive(Debug, Clone, Serialize, Deserialize)]
229#[serde(untagged)]
230pub enum PostStepLogError {
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_log_stream`]
242#[derive(Debug, Clone, Serialize, Deserialize)]
243#[serde(untagged)]
244pub enum PostStepLogStreamError {
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_workflow`]
256#[derive(Debug, Clone, Serialize, Deserialize)]
257#[serde(untagged)]
258pub enum PostWorkflowError {
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
269pub async fn cancel_workflow(
270    configuration: &configuration::Configuration,
271    repo_ref: &str,
272    action_identifier: &str,
273    workflow_idn: i64,
274) -> Result<models::WorkflowStages, Error<CancelWorkflowError>> {
275    // add a prefix to parameters to efficiently prevent name collisions
276    let p_path_repo_ref = repo_ref;
277    let p_path_action_identifier = action_identifier;
278    let p_path_workflow_idn = workflow_idn;
279
280    let uri_str = format!(
281        "{}/repos/{repo_ref}/+/actions/{action_identifier}/workflows/{workflow_idn}/cancel",
282        configuration.base_path,
283        repo_ref = crate::apis::urlencode(p_path_repo_ref),
284        action_identifier = crate::apis::urlencode(p_path_action_identifier),
285        workflow_idn = p_path_workflow_idn
286    );
287    let mut req_builder = configuration
288        .client
289        .request(reqwest::Method::POST, &uri_str);
290
291    if let Some(ref apikey) = configuration.api_key {
292        let key = apikey.key.clone();
293        let value = match apikey.prefix {
294            Some(ref prefix) => format!("{} {}", prefix, key),
295            None => key,
296        };
297        req_builder = req_builder.query(&[("access_token", value)]);
298    }
299    if let Some(ref user_agent) = configuration.user_agent {
300        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
301    }
302    if let Some(ref auth_conf) = configuration.basic_auth {
303        req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
304    };
305    if let Some(ref token) = configuration.bearer_access_token {
306        req_builder = req_builder.bearer_auth(token.to_owned());
307    };
308
309    let req = req_builder.build()?;
310    let resp = configuration.client.execute(req).await?;
311
312    let status = resp.status();
313    let content_type = resp
314        .headers()
315        .get("content-type")
316        .and_then(|v| v.to_str().ok())
317        .unwrap_or("application/octet-stream");
318    let content_type = super::ContentType::from(content_type);
319
320    if !status.is_client_error() && !status.is_server_error() {
321        let content = resp.text().await?;
322        match content_type {
323            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
324            ContentType::Text => Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::WorkflowStages`"))),
325            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`")))),
326        }
327    } else {
328        let content = resp.text().await?;
329        let entity: Option<CancelWorkflowError> = serde_json::from_str(&content).ok();
330        Err(Error::ResponseError(ResponseContent {
331            status,
332            content,
333            entity,
334        }))
335    }
336}
337
338pub async fn delete_action(
339    configuration: &configuration::Configuration,
340    repo_ref: &str,
341    action_identifier: &str,
342) -> Result<(), Error<DeleteActionError>> {
343    // add a prefix to parameters to efficiently prevent name collisions
344    let p_path_repo_ref = repo_ref;
345    let p_path_action_identifier = action_identifier;
346
347    let uri_str = format!(
348        "{}/repos/{repo_ref}/+/actions/{action_identifier}",
349        configuration.base_path,
350        repo_ref = crate::apis::urlencode(p_path_repo_ref),
351        action_identifier = crate::apis::urlencode(p_path_action_identifier)
352    );
353    let mut req_builder = configuration
354        .client
355        .request(reqwest::Method::DELETE, &uri_str);
356
357    if let Some(ref apikey) = configuration.api_key {
358        let key = apikey.key.clone();
359        let value = match apikey.prefix {
360            Some(ref prefix) => format!("{} {}", prefix, key),
361            None => key,
362        };
363        req_builder = req_builder.query(&[("access_token", value)]);
364    }
365    if let Some(ref user_agent) = configuration.user_agent {
366        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
367    }
368    if let Some(ref auth_conf) = configuration.basic_auth {
369        req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
370    };
371    if let Some(ref token) = configuration.bearer_access_token {
372        req_builder = req_builder.bearer_auth(token.to_owned());
373    };
374
375    let req = req_builder.build()?;
376    let resp = configuration.client.execute(req).await?;
377
378    let status = resp.status();
379
380    if !status.is_client_error() && !status.is_server_error() {
381        Ok(())
382    } else {
383        let content = resp.text().await?;
384        let entity: Option<DeleteActionError> = serde_json::from_str(&content).ok();
385        Err(Error::ResponseError(ResponseContent {
386            status,
387            content,
388            entity,
389        }))
390    }
391}
392
393pub async fn delete_workflow(
394    configuration: &configuration::Configuration,
395    repo_ref: &str,
396    action_identifier: &str,
397    workflow_idn: i64,
398) -> Result<(), Error<DeleteWorkflowError>> {
399    // add a prefix to parameters to efficiently prevent name collisions
400    let p_path_repo_ref = repo_ref;
401    let p_path_action_identifier = action_identifier;
402    let p_path_workflow_idn = workflow_idn;
403
404    let uri_str = format!(
405        "{}/repos/{repo_ref}/+/actions/{action_identifier}/workflows/{workflow_idn}",
406        configuration.base_path,
407        repo_ref = crate::apis::urlencode(p_path_repo_ref),
408        action_identifier = crate::apis::urlencode(p_path_action_identifier),
409        workflow_idn = p_path_workflow_idn
410    );
411    let mut req_builder = configuration
412        .client
413        .request(reqwest::Method::DELETE, &uri_str);
414
415    if let Some(ref apikey) = configuration.api_key {
416        let key = apikey.key.clone();
417        let value = match apikey.prefix {
418            Some(ref prefix) => format!("{} {}", prefix, key),
419            None => key,
420        };
421        req_builder = req_builder.query(&[("access_token", value)]);
422    }
423    if let Some(ref user_agent) = configuration.user_agent {
424        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
425    }
426    if let Some(ref auth_conf) = configuration.basic_auth {
427        req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
428    };
429    if let Some(ref token) = configuration.bearer_access_token {
430        req_builder = req_builder.bearer_auth(token.to_owned());
431    };
432
433    let req = req_builder.build()?;
434    let resp = configuration.client.execute(req).await?;
435
436    let status = resp.status();
437
438    if !status.is_client_error() && !status.is_server_error() {
439        Ok(())
440    } else {
441        let content = resp.text().await?;
442        let entity: Option<DeleteWorkflowError> = serde_json::from_str(&content).ok();
443        Err(Error::ResponseError(ResponseContent {
444            status,
445            content,
446            entity,
447        }))
448    }
449}
450
451pub async fn get_action(
452    configuration: &configuration::Configuration,
453    repo_ref: &str,
454    action_identifier: &str,
455) -> Result<models::ActionModel, Error<GetActionError>> {
456    // add a prefix to parameters to efficiently prevent name collisions
457    let p_path_repo_ref = repo_ref;
458    let p_path_action_identifier = action_identifier;
459
460    let uri_str = format!(
461        "{}/repos/{repo_ref}/+/actions/{action_identifier}",
462        configuration.base_path,
463        repo_ref = crate::apis::urlencode(p_path_repo_ref),
464        action_identifier = crate::apis::urlencode(p_path_action_identifier)
465    );
466    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
467
468    if let Some(ref apikey) = configuration.api_key {
469        let key = apikey.key.clone();
470        let value = match apikey.prefix {
471            Some(ref prefix) => format!("{} {}", prefix, key),
472            None => key,
473        };
474        req_builder = req_builder.query(&[("access_token", value)]);
475    }
476    if let Some(ref user_agent) = configuration.user_agent {
477        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
478    }
479    if let Some(ref auth_conf) = configuration.basic_auth {
480        req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
481    };
482    if let Some(ref token) = configuration.bearer_access_token {
483        req_builder = req_builder.bearer_auth(token.to_owned());
484    };
485
486    let req = req_builder.build()?;
487    let resp = configuration.client.execute(req).await?;
488
489    let status = resp.status();
490    let content_type = resp
491        .headers()
492        .get("content-type")
493        .and_then(|v| v.to_str().ok())
494        .unwrap_or("application/octet-stream");
495    let content_type = super::ContentType::from(content_type);
496
497    if !status.is_client_error() && !status.is_server_error() {
498        let content = resp.text().await?;
499        match content_type {
500            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
501            ContentType::Text => Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::ActionModel`"))),
502            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`")))),
503        }
504    } else {
505        let content = resp.text().await?;
506        let entity: Option<GetActionError> = serde_json::from_str(&content).ok();
507        Err(Error::ResponseError(ResponseContent {
508            status,
509            content,
510            entity,
511        }))
512    }
513}
514
515pub async fn get_actions(
516    configuration: &configuration::Configuration,
517    repo_ref: &str,
518    page: Option<i64>,
519    size: Option<i64>,
520    query: Option<&str>,
521    latest: Option<bool>,
522) -> Result<Vec<models::ActionWorkflow>, Error<GetActionsError>> {
523    // add a prefix to parameters to efficiently prevent name collisions
524    let p_path_repo_ref = repo_ref;
525    let p_query_page = page;
526    let p_query_size = size;
527    let p_query_query = query;
528    let p_query_latest = latest;
529
530    let uri_str = format!(
531        "{}/repos/{repo_ref}/+/actions",
532        configuration.base_path,
533        repo_ref = crate::apis::urlencode(p_path_repo_ref)
534    );
535    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
536
537    if let Some(ref param_value) = p_query_page {
538        req_builder = req_builder.query(&[("page", &param_value.to_string())]);
539    }
540    if let Some(ref param_value) = p_query_size {
541        req_builder = req_builder.query(&[("size", &param_value.to_string())]);
542    }
543    if let Some(ref param_value) = p_query_query {
544        req_builder = req_builder.query(&[("query", &param_value.to_string())]);
545    }
546    if let Some(ref param_value) = p_query_latest {
547        req_builder = req_builder.query(&[("latest", &param_value.to_string())]);
548    }
549    if let Some(ref apikey) = configuration.api_key {
550        let key = apikey.key.clone();
551        let value = match apikey.prefix {
552            Some(ref prefix) => format!("{} {}", prefix, key),
553            None => key,
554        };
555        req_builder = req_builder.query(&[("access_token", value)]);
556    }
557    if let Some(ref user_agent) = configuration.user_agent {
558        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
559    }
560    if let Some(ref auth_conf) = configuration.basic_auth {
561        req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
562    };
563    if let Some(ref token) = configuration.bearer_access_token {
564        req_builder = req_builder.bearer_auth(token.to_owned());
565    };
566
567    let req = req_builder.build()?;
568    let resp = configuration.client.execute(req).await?;
569
570    let status = resp.status();
571    let content_type = resp
572        .headers()
573        .get("content-type")
574        .and_then(|v| v.to_str().ok())
575        .unwrap_or("application/octet-stream");
576    let content_type = super::ContentType::from(content_type);
577
578    if !status.is_client_error() && !status.is_server_error() {
579        let content = resp.text().await?;
580        match content_type {
581            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
582            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;`"))),
583            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;`")))),
584        }
585    } else {
586        let content = resp.text().await?;
587        let entity: Option<GetActionsError> = serde_json::from_str(&content).ok();
588        Err(Error::ResponseError(ResponseContent {
589            status,
590            content,
591            entity,
592        }))
593    }
594}
595
596pub async fn get_step_log_stream(
597    configuration: &configuration::Configuration,
598    repo_ref: &str,
599    action_identifier: &str,
600    workflow_idn: i64,
601    stage_number: i64,
602    step_number: i64,
603) -> Result<Vec<models::LiveLogLine>, Error<GetStepLogStreamError>> {
604    // add a prefix to parameters to efficiently prevent name collisions
605    let p_path_repo_ref = repo_ref;
606    let p_path_action_identifier = action_identifier;
607    let p_path_workflow_idn = workflow_idn;
608    let p_path_stage_number = stage_number;
609    let p_path_step_number = step_number;
610
611    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);
612    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
613
614    if let Some(ref apikey) = configuration.api_key {
615        let key = apikey.key.clone();
616        let value = match apikey.prefix {
617            Some(ref prefix) => format!("{} {}", prefix, key),
618            None => key,
619        };
620        req_builder = req_builder.query(&[("access_token", value)]);
621    }
622    if let Some(ref user_agent) = configuration.user_agent {
623        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
624    }
625    if let Some(ref auth_conf) = configuration.basic_auth {
626        req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
627    };
628    if let Some(ref token) = configuration.bearer_access_token {
629        req_builder = req_builder.bearer_auth(token.to_owned());
630    };
631
632    let req = req_builder.build()?;
633    let resp = configuration.client.execute(req).await?;
634
635    let status = resp.status();
636    let content_type = resp
637        .headers()
638        .get("content-type")
639        .and_then(|v| v.to_str().ok())
640        .unwrap_or("application/octet-stream");
641    let content_type = super::ContentType::from(content_type);
642
643    if !status.is_client_error() && !status.is_server_error() {
644        let content = resp.text().await?;
645        match content_type {
646            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
647            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;`"))),
648            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;`")))),
649        }
650    } else {
651        let content = resp.text().await?;
652        let entity: Option<GetStepLogStreamError> = serde_json::from_str(&content).ok();
653        Err(Error::ResponseError(ResponseContent {
654            status,
655            content,
656            entity,
657        }))
658    }
659}
660
661pub async fn get_step_logs(
662    configuration: &configuration::Configuration,
663    repo_ref: &str,
664    action_identifier: &str,
665    workflow_idn: i64,
666    stage_number: i64,
667    step_number: i64,
668) -> Result<Vec<models::LiveLogLine>, Error<GetStepLogsError>> {
669    // add a prefix to parameters to efficiently prevent name collisions
670    let p_path_repo_ref = repo_ref;
671    let p_path_action_identifier = action_identifier;
672    let p_path_workflow_idn = workflow_idn;
673    let p_path_stage_number = stage_number;
674    let p_path_step_number = step_number;
675
676    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);
677    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
678
679    if let Some(ref apikey) = configuration.api_key {
680        let key = apikey.key.clone();
681        let value = match apikey.prefix {
682            Some(ref prefix) => format!("{} {}", prefix, key),
683            None => key,
684        };
685        req_builder = req_builder.query(&[("access_token", value)]);
686    }
687    if let Some(ref user_agent) = configuration.user_agent {
688        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
689    }
690    if let Some(ref auth_conf) = configuration.basic_auth {
691        req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
692    };
693    if let Some(ref token) = configuration.bearer_access_token {
694        req_builder = req_builder.bearer_auth(token.to_owned());
695    };
696
697    let req = req_builder.build()?;
698    let resp = configuration.client.execute(req).await?;
699
700    let status = resp.status();
701    let content_type = resp
702        .headers()
703        .get("content-type")
704        .and_then(|v| v.to_str().ok())
705        .unwrap_or("application/octet-stream");
706    let content_type = super::ContentType::from(content_type);
707
708    if !status.is_client_error() && !status.is_server_error() {
709        let content = resp.text().await?;
710        match content_type {
711            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
712            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;`"))),
713            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;`")))),
714        }
715    } else {
716        let content = resp.text().await?;
717        let entity: Option<GetStepLogsError> = serde_json::from_str(&content).ok();
718        Err(Error::ResponseError(ResponseContent {
719            status,
720            content,
721            entity,
722        }))
723    }
724}
725
726pub async fn get_workflow(
727    configuration: &configuration::Configuration,
728    repo_ref: &str,
729    action_identifier: &str,
730    workflow_idn: i64,
731) -> Result<models::WorkflowStages, Error<GetWorkflowError>> {
732    // add a prefix to parameters to efficiently prevent name collisions
733    let p_path_repo_ref = repo_ref;
734    let p_path_action_identifier = action_identifier;
735    let p_path_workflow_idn = workflow_idn;
736
737    let uri_str = format!(
738        "{}/repos/{repo_ref}/+/actions/{action_identifier}/workflows/{workflow_idn}",
739        configuration.base_path,
740        repo_ref = crate::apis::urlencode(p_path_repo_ref),
741        action_identifier = crate::apis::urlencode(p_path_action_identifier),
742        workflow_idn = p_path_workflow_idn
743    );
744    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
745
746    if let Some(ref apikey) = configuration.api_key {
747        let key = apikey.key.clone();
748        let value = match apikey.prefix {
749            Some(ref prefix) => format!("{} {}", prefix, key),
750            None => key,
751        };
752        req_builder = req_builder.query(&[("access_token", value)]);
753    }
754    if let Some(ref user_agent) = configuration.user_agent {
755        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
756    }
757    if let Some(ref auth_conf) = configuration.basic_auth {
758        req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
759    };
760    if let Some(ref token) = configuration.bearer_access_token {
761        req_builder = req_builder.bearer_auth(token.to_owned());
762    };
763
764    let req = req_builder.build()?;
765    let resp = configuration.client.execute(req).await?;
766
767    let status = resp.status();
768    let content_type = resp
769        .headers()
770        .get("content-type")
771        .and_then(|v| v.to_str().ok())
772        .unwrap_or("application/octet-stream");
773    let content_type = super::ContentType::from(content_type);
774
775    if !status.is_client_error() && !status.is_server_error() {
776        let content = resp.text().await?;
777        match content_type {
778            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
779            ContentType::Text => Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::WorkflowStages`"))),
780            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`")))),
781        }
782    } else {
783        let content = resp.text().await?;
784        let entity: Option<GetWorkflowError> = serde_json::from_str(&content).ok();
785        Err(Error::ResponseError(ResponseContent {
786            status,
787            content,
788            entity,
789        }))
790    }
791}
792
793pub async fn get_workflows(
794    configuration: &configuration::Configuration,
795    repo_ref: &str,
796    action_identifier: &str,
797    page: Option<i64>,
798    size: Option<i64>,
799) -> Result<Vec<models::WorkflowModel>, Error<GetWorkflowsError>> {
800    // add a prefix to parameters to efficiently prevent name collisions
801    let p_path_repo_ref = repo_ref;
802    let p_path_action_identifier = action_identifier;
803    let p_query_page = page;
804    let p_query_size = size;
805
806    let uri_str = format!(
807        "{}/repos/{repo_ref}/+/actions/{action_identifier}/workflows",
808        configuration.base_path,
809        repo_ref = crate::apis::urlencode(p_path_repo_ref),
810        action_identifier = crate::apis::urlencode(p_path_action_identifier)
811    );
812    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
813
814    if let Some(ref param_value) = p_query_page {
815        req_builder = req_builder.query(&[("page", &param_value.to_string())]);
816    }
817    if let Some(ref param_value) = p_query_size {
818        req_builder = req_builder.query(&[("size", &param_value.to_string())]);
819    }
820    if let Some(ref apikey) = configuration.api_key {
821        let key = apikey.key.clone();
822        let value = match apikey.prefix {
823            Some(ref prefix) => format!("{} {}", prefix, key),
824            None => key,
825        };
826        req_builder = req_builder.query(&[("access_token", value)]);
827    }
828    if let Some(ref user_agent) = configuration.user_agent {
829        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
830    }
831    if let Some(ref auth_conf) = configuration.basic_auth {
832        req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
833    };
834    if let Some(ref token) = configuration.bearer_access_token {
835        req_builder = req_builder.bearer_auth(token.to_owned());
836    };
837
838    let req = req_builder.build()?;
839    let resp = configuration.client.execute(req).await?;
840
841    let status = resp.status();
842    let content_type = resp
843        .headers()
844        .get("content-type")
845        .and_then(|v| v.to_str().ok())
846        .unwrap_or("application/octet-stream");
847    let content_type = super::ContentType::from(content_type);
848
849    if !status.is_client_error() && !status.is_server_error() {
850        let content = resp.text().await?;
851        match content_type {
852            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
853            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;`"))),
854            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;`")))),
855        }
856    } else {
857        let content = resp.text().await?;
858        let entity: Option<GetWorkflowsError> = serde_json::from_str(&content).ok();
859        Err(Error::ResponseError(ResponseContent {
860            status,
861            content,
862            entity,
863        }))
864    }
865}
866
867pub async fn patch_action(
868    configuration: &configuration::Configuration,
869    repo_ref: &str,
870    action_identifier: &str,
871    action_update_input: models::ActionUpdateInput,
872) -> Result<models::ActionModel, Error<PatchActionError>> {
873    // add a prefix to parameters to efficiently prevent name collisions
874    let p_path_repo_ref = repo_ref;
875    let p_path_action_identifier = action_identifier;
876    let p_body_action_update_input = action_update_input;
877
878    let uri_str = format!(
879        "{}/repos/{repo_ref}/+/actions/{action_identifier}",
880        configuration.base_path,
881        repo_ref = crate::apis::urlencode(p_path_repo_ref),
882        action_identifier = crate::apis::urlencode(p_path_action_identifier)
883    );
884    let mut req_builder = configuration
885        .client
886        .request(reqwest::Method::PATCH, &uri_str);
887
888    if let Some(ref apikey) = configuration.api_key {
889        let key = apikey.key.clone();
890        let value = match apikey.prefix {
891            Some(ref prefix) => format!("{} {}", prefix, key),
892            None => key,
893        };
894        req_builder = req_builder.query(&[("access_token", value)]);
895    }
896    if let Some(ref user_agent) = configuration.user_agent {
897        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
898    }
899    if let Some(ref auth_conf) = configuration.basic_auth {
900        req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
901    };
902    if let Some(ref token) = configuration.bearer_access_token {
903        req_builder = req_builder.bearer_auth(token.to_owned());
904    };
905    req_builder = req_builder.json(&p_body_action_update_input);
906
907    let req = req_builder.build()?;
908    let resp = configuration.client.execute(req).await?;
909
910    let status = resp.status();
911    let content_type = resp
912        .headers()
913        .get("content-type")
914        .and_then(|v| v.to_str().ok())
915        .unwrap_or("application/octet-stream");
916    let content_type = super::ContentType::from(content_type);
917
918    if !status.is_client_error() && !status.is_server_error() {
919        let content = resp.text().await?;
920        match content_type {
921            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
922            ContentType::Text => Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::ActionModel`"))),
923            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`")))),
924        }
925    } else {
926        let content = resp.text().await?;
927        let entity: Option<PatchActionError> = serde_json::from_str(&content).ok();
928        Err(Error::ResponseError(ResponseContent {
929            status,
930            content,
931            entity,
932        }))
933    }
934}
935
936pub async fn patch_stage(
937    configuration: &configuration::Configuration,
938    repo_ref: &str,
939    action_identifier: &str,
940    workflow_idn: i64,
941    stage_number: i64,
942    stage_update_input: models::StageUpdateInput,
943) -> Result<models::StageModel, Error<PatchStageError>> {
944    // add a prefix to parameters to efficiently prevent name collisions
945    let p_path_repo_ref = repo_ref;
946    let p_path_action_identifier = action_identifier;
947    let p_path_workflow_idn = workflow_idn;
948    let p_path_stage_number = stage_number;
949    let p_body_stage_update_input = stage_update_input;
950
951    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);
952    let mut req_builder = configuration
953        .client
954        .request(reqwest::Method::PATCH, &uri_str);
955
956    if let Some(ref apikey) = configuration.api_key {
957        let key = apikey.key.clone();
958        let value = match apikey.prefix {
959            Some(ref prefix) => format!("{} {}", prefix, key),
960            None => key,
961        };
962        req_builder = req_builder.query(&[("access_token", value)]);
963    }
964    if let Some(ref user_agent) = configuration.user_agent {
965        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
966    }
967    if let Some(ref auth_conf) = configuration.basic_auth {
968        req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
969    };
970    if let Some(ref token) = configuration.bearer_access_token {
971        req_builder = req_builder.bearer_auth(token.to_owned());
972    };
973    req_builder = req_builder.json(&p_body_stage_update_input);
974
975    let req = req_builder.build()?;
976    let resp = configuration.client.execute(req).await?;
977
978    let status = resp.status();
979    let content_type = resp
980        .headers()
981        .get("content-type")
982        .and_then(|v| v.to_str().ok())
983        .unwrap_or("application/octet-stream");
984    let content_type = super::ContentType::from(content_type);
985
986    if !status.is_client_error() && !status.is_server_error() {
987        let content = resp.text().await?;
988        match content_type {
989            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
990            ContentType::Text => Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::StageModel`"))),
991            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`")))),
992        }
993    } else {
994        let content = resp.text().await?;
995        let entity: Option<PatchStageError> = serde_json::from_str(&content).ok();
996        Err(Error::ResponseError(ResponseContent {
997            status,
998            content,
999            entity,
1000        }))
1001    }
1002}
1003
1004pub async fn patch_step(
1005    configuration: &configuration::Configuration,
1006    repo_ref: &str,
1007    action_identifier: &str,
1008    workflow_idn: i64,
1009    stage_number: i64,
1010    step_number: i64,
1011    step_update_input: models::StepUpdateInput,
1012) -> Result<models::StepModel, Error<PatchStepError>> {
1013    // add a prefix to parameters to efficiently prevent name collisions
1014    let p_path_repo_ref = repo_ref;
1015    let p_path_action_identifier = action_identifier;
1016    let p_path_workflow_idn = workflow_idn;
1017    let p_path_stage_number = stage_number;
1018    let p_path_step_number = step_number;
1019    let p_body_step_update_input = step_update_input;
1020
1021    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);
1022    let mut req_builder = configuration
1023        .client
1024        .request(reqwest::Method::PATCH, &uri_str);
1025
1026    if let Some(ref apikey) = configuration.api_key {
1027        let key = apikey.key.clone();
1028        let value = match apikey.prefix {
1029            Some(ref prefix) => format!("{} {}", prefix, key),
1030            None => key,
1031        };
1032        req_builder = req_builder.query(&[("access_token", value)]);
1033    }
1034    if let Some(ref user_agent) = configuration.user_agent {
1035        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1036    }
1037    if let Some(ref auth_conf) = configuration.basic_auth {
1038        req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
1039    };
1040    if let Some(ref token) = configuration.bearer_access_token {
1041        req_builder = req_builder.bearer_auth(token.to_owned());
1042    };
1043    req_builder = req_builder.json(&p_body_step_update_input);
1044
1045    let req = req_builder.build()?;
1046    let resp = configuration.client.execute(req).await?;
1047
1048    let status = resp.status();
1049    let content_type = resp
1050        .headers()
1051        .get("content-type")
1052        .and_then(|v| v.to_str().ok())
1053        .unwrap_or("application/octet-stream");
1054    let content_type = super::ContentType::from(content_type);
1055
1056    if !status.is_client_error() && !status.is_server_error() {
1057        let content = resp.text().await?;
1058        match content_type {
1059            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1060            ContentType::Text => Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::StepModel`"))),
1061            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`")))),
1062        }
1063    } else {
1064        let content = resp.text().await?;
1065        let entity: Option<PatchStepError> = serde_json::from_str(&content).ok();
1066        Err(Error::ResponseError(ResponseContent {
1067            status,
1068            content,
1069            entity,
1070        }))
1071    }
1072}
1073
1074pub async fn patch_workflow(
1075    configuration: &configuration::Configuration,
1076    repo_ref: &str,
1077    action_identifier: &str,
1078    workflow_idn: i64,
1079    workflow_update_input: models::WorkflowUpdateInput,
1080) -> Result<models::WorkflowModel, Error<PatchWorkflowError>> {
1081    // add a prefix to parameters to efficiently prevent name collisions
1082    let p_path_repo_ref = repo_ref;
1083    let p_path_action_identifier = action_identifier;
1084    let p_path_workflow_idn = workflow_idn;
1085    let p_body_workflow_update_input = workflow_update_input;
1086
1087    let uri_str = format!(
1088        "{}/repos/{repo_ref}/+/actions/{action_identifier}/workflows/{workflow_idn}",
1089        configuration.base_path,
1090        repo_ref = crate::apis::urlencode(p_path_repo_ref),
1091        action_identifier = crate::apis::urlencode(p_path_action_identifier),
1092        workflow_idn = p_path_workflow_idn
1093    );
1094    let mut req_builder = configuration
1095        .client
1096        .request(reqwest::Method::PATCH, &uri_str);
1097
1098    if let Some(ref apikey) = configuration.api_key {
1099        let key = apikey.key.clone();
1100        let value = match apikey.prefix {
1101            Some(ref prefix) => format!("{} {}", prefix, key),
1102            None => key,
1103        };
1104        req_builder = req_builder.query(&[("access_token", value)]);
1105    }
1106    if let Some(ref user_agent) = configuration.user_agent {
1107        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1108    }
1109    if let Some(ref auth_conf) = configuration.basic_auth {
1110        req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
1111    };
1112    if let Some(ref token) = configuration.bearer_access_token {
1113        req_builder = req_builder.bearer_auth(token.to_owned());
1114    };
1115    req_builder = req_builder.json(&p_body_workflow_update_input);
1116
1117    let req = req_builder.build()?;
1118    let resp = configuration.client.execute(req).await?;
1119
1120    let status = resp.status();
1121    let content_type = resp
1122        .headers()
1123        .get("content-type")
1124        .and_then(|v| v.to_str().ok())
1125        .unwrap_or("application/octet-stream");
1126    let content_type = super::ContentType::from(content_type);
1127
1128    if !status.is_client_error() && !status.is_server_error() {
1129        let content = resp.text().await?;
1130        match content_type {
1131            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1132            ContentType::Text => Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::WorkflowModel`"))),
1133            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`")))),
1134        }
1135    } else {
1136        let content = resp.text().await?;
1137        let entity: Option<PatchWorkflowError> = serde_json::from_str(&content).ok();
1138        Err(Error::ResponseError(ResponseContent {
1139            status,
1140            content,
1141            entity,
1142        }))
1143    }
1144}
1145
1146pub async fn post_action(
1147    configuration: &configuration::Configuration,
1148    repo_ref: &str,
1149    action_create_input: models::ActionCreateInput,
1150) -> Result<models::ActionModel, Error<PostActionError>> {
1151    // add a prefix to parameters to efficiently prevent name collisions
1152    let p_path_repo_ref = repo_ref;
1153    let p_body_action_create_input = action_create_input;
1154
1155    let uri_str = format!(
1156        "{}/repos/{repo_ref}/+/actions",
1157        configuration.base_path,
1158        repo_ref = crate::apis::urlencode(p_path_repo_ref)
1159    );
1160    let mut req_builder = configuration
1161        .client
1162        .request(reqwest::Method::POST, &uri_str);
1163
1164    if let Some(ref apikey) = configuration.api_key {
1165        let key = apikey.key.clone();
1166        let value = match apikey.prefix {
1167            Some(ref prefix) => format!("{} {}", prefix, key),
1168            None => key,
1169        };
1170        req_builder = req_builder.query(&[("access_token", value)]);
1171    }
1172    if let Some(ref user_agent) = configuration.user_agent {
1173        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1174    }
1175    if let Some(ref auth_conf) = configuration.basic_auth {
1176        req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
1177    };
1178    if let Some(ref token) = configuration.bearer_access_token {
1179        req_builder = req_builder.bearer_auth(token.to_owned());
1180    };
1181    req_builder = req_builder.json(&p_body_action_create_input);
1182
1183    let req = req_builder.build()?;
1184    let resp = configuration.client.execute(req).await?;
1185
1186    let status = resp.status();
1187    let content_type = resp
1188        .headers()
1189        .get("content-type")
1190        .and_then(|v| v.to_str().ok())
1191        .unwrap_or("application/octet-stream");
1192    let content_type = super::ContentType::from(content_type);
1193
1194    if !status.is_client_error() && !status.is_server_error() {
1195        let content = resp.text().await?;
1196        match content_type {
1197            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1198            ContentType::Text => Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::ActionModel`"))),
1199            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`")))),
1200        }
1201    } else {
1202        let content = resp.text().await?;
1203        let entity: Option<PostActionError> = serde_json::from_str(&content).ok();
1204        Err(Error::ResponseError(ResponseContent {
1205            status,
1206            content,
1207            entity,
1208        }))
1209    }
1210}
1211
1212pub async fn post_step(
1213    configuration: &configuration::Configuration,
1214    repo_ref: &str,
1215    action_identifier: &str,
1216    workflow_idn: i64,
1217    stage_number: i64,
1218    step_create_input: models::StepCreateInput,
1219) -> Result<models::StepModel, Error<PostStepError>> {
1220    // add a prefix to parameters to efficiently prevent name collisions
1221    let p_path_repo_ref = repo_ref;
1222    let p_path_action_identifier = action_identifier;
1223    let p_path_workflow_idn = workflow_idn;
1224    let p_path_stage_number = stage_number;
1225    let p_body_step_create_input = step_create_input;
1226
1227    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);
1228    let mut req_builder = configuration
1229        .client
1230        .request(reqwest::Method::POST, &uri_str);
1231
1232    if let Some(ref apikey) = configuration.api_key {
1233        let key = apikey.key.clone();
1234        let value = match apikey.prefix {
1235            Some(ref prefix) => format!("{} {}", prefix, key),
1236            None => key,
1237        };
1238        req_builder = req_builder.query(&[("access_token", value)]);
1239    }
1240    if let Some(ref user_agent) = configuration.user_agent {
1241        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1242    }
1243    if let Some(ref auth_conf) = configuration.basic_auth {
1244        req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
1245    };
1246    if let Some(ref token) = configuration.bearer_access_token {
1247        req_builder = req_builder.bearer_auth(token.to_owned());
1248    };
1249    req_builder = req_builder.json(&p_body_step_create_input);
1250
1251    let req = req_builder.build()?;
1252    let resp = configuration.client.execute(req).await?;
1253
1254    let status = resp.status();
1255    let content_type = resp
1256        .headers()
1257        .get("content-type")
1258        .and_then(|v| v.to_str().ok())
1259        .unwrap_or("application/octet-stream");
1260    let content_type = super::ContentType::from(content_type);
1261
1262    if !status.is_client_error() && !status.is_server_error() {
1263        let content = resp.text().await?;
1264        match content_type {
1265            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1266            ContentType::Text => Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::StepModel`"))),
1267            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`")))),
1268        }
1269    } else {
1270        let content = resp.text().await?;
1271        let entity: Option<PostStepError> = serde_json::from_str(&content).ok();
1272        Err(Error::ResponseError(ResponseContent {
1273            status,
1274            content,
1275            entity,
1276        }))
1277    }
1278}
1279
1280/// Upload workflow step json log
1281pub async fn post_step_log(
1282    configuration: &configuration::Configuration,
1283    repo_ref: &str,
1284    action_identifier: &str,
1285    workflow_idn: i64,
1286    stage_number: i64,
1287    step_number: i64,
1288    live_log_line: models::LiveLogLine,
1289) -> Result<(), Error<PostStepLogError>> {
1290    // add a prefix to parameters to efficiently prevent name collisions
1291    let p_path_repo_ref = repo_ref;
1292    let p_path_action_identifier = action_identifier;
1293    let p_path_workflow_idn = workflow_idn;
1294    let p_path_stage_number = stage_number;
1295    let p_path_step_number = step_number;
1296    let p_body_live_log_line = live_log_line;
1297
1298    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);
1299    let mut req_builder = configuration
1300        .client
1301        .request(reqwest::Method::POST, &uri_str);
1302
1303    if let Some(ref apikey) = configuration.api_key {
1304        let key = apikey.key.clone();
1305        let value = match apikey.prefix {
1306            Some(ref prefix) => format!("{} {}", prefix, key),
1307            None => key,
1308        };
1309        req_builder = req_builder.query(&[("access_token", value)]);
1310    }
1311    if let Some(ref user_agent) = configuration.user_agent {
1312        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1313    }
1314    if let Some(ref auth_conf) = configuration.basic_auth {
1315        req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
1316    };
1317    if let Some(ref token) = configuration.bearer_access_token {
1318        req_builder = req_builder.bearer_auth(token.to_owned());
1319    };
1320    req_builder = req_builder.json(&p_body_live_log_line);
1321
1322    let req = req_builder.build()?;
1323    let resp = configuration.client.execute(req).await?;
1324
1325    let status = resp.status();
1326
1327    if !status.is_client_error() && !status.is_server_error() {
1328        Ok(())
1329    } else {
1330        let content = resp.text().await?;
1331        let entity: Option<PostStepLogError> = serde_json::from_str(&content).ok();
1332        Err(Error::ResponseError(ResponseContent {
1333            status,
1334            content,
1335            entity,
1336        }))
1337    }
1338}
1339
1340/// Upload workflow step json log by stream, unsupported yet.
1341pub async fn post_step_log_stream(
1342    configuration: &configuration::Configuration,
1343    repo_ref: &str,
1344    action_identifier: &str,
1345    workflow_idn: i64,
1346    stage_number: i64,
1347    step_number: i64,
1348    request_body: Vec<i32>,
1349) -> Result<(), Error<PostStepLogStreamError>> {
1350    // add a prefix to parameters to efficiently prevent name collisions
1351    let p_path_repo_ref = repo_ref;
1352    let p_path_action_identifier = action_identifier;
1353    let p_path_workflow_idn = workflow_idn;
1354    let p_path_stage_number = stage_number;
1355    let p_path_step_number = step_number;
1356    let p_body_request_body = request_body;
1357
1358    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);
1359    let mut req_builder = configuration
1360        .client
1361        .request(reqwest::Method::POST, &uri_str);
1362
1363    if let Some(ref apikey) = configuration.api_key {
1364        let key = apikey.key.clone();
1365        let value = match apikey.prefix {
1366            Some(ref prefix) => format!("{} {}", prefix, key),
1367            None => key,
1368        };
1369        req_builder = req_builder.query(&[("access_token", value)]);
1370    }
1371    if let Some(ref user_agent) = configuration.user_agent {
1372        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1373    }
1374    if let Some(ref auth_conf) = configuration.basic_auth {
1375        req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
1376    };
1377    if let Some(ref token) = configuration.bearer_access_token {
1378        req_builder = req_builder.bearer_auth(token.to_owned());
1379    };
1380    req_builder = req_builder.json(&p_body_request_body);
1381
1382    let req = req_builder.build()?;
1383    let resp = configuration.client.execute(req).await?;
1384
1385    let status = resp.status();
1386
1387    if !status.is_client_error() && !status.is_server_error() {
1388        Ok(())
1389    } else {
1390        let content = resp.text().await?;
1391        let entity: Option<PostStepLogStreamError> = serde_json::from_str(&content).ok();
1392        Err(Error::ResponseError(ResponseContent {
1393            status,
1394            content,
1395            entity,
1396        }))
1397    }
1398}
1399
1400pub async fn post_workflow(
1401    configuration: &configuration::Configuration,
1402    repo_ref: &str,
1403    action_identifier: &str,
1404    workflow_create_input: models::WorkflowCreateInput,
1405) -> Result<(), Error<PostWorkflowError>> {
1406    // add a prefix to parameters to efficiently prevent name collisions
1407    let p_path_repo_ref = repo_ref;
1408    let p_path_action_identifier = action_identifier;
1409    let p_body_workflow_create_input = workflow_create_input;
1410
1411    let uri_str = format!(
1412        "{}/repos/{repo_ref}/+/actions/{action_identifier}/workflows",
1413        configuration.base_path,
1414        repo_ref = crate::apis::urlencode(p_path_repo_ref),
1415        action_identifier = crate::apis::urlencode(p_path_action_identifier)
1416    );
1417    let mut req_builder = configuration
1418        .client
1419        .request(reqwest::Method::POST, &uri_str);
1420
1421    if let Some(ref apikey) = configuration.api_key {
1422        let key = apikey.key.clone();
1423        let value = match apikey.prefix {
1424            Some(ref prefix) => format!("{} {}", prefix, key),
1425            None => key,
1426        };
1427        req_builder = req_builder.query(&[("access_token", value)]);
1428    }
1429    if let Some(ref user_agent) = configuration.user_agent {
1430        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1431    }
1432    if let Some(ref auth_conf) = configuration.basic_auth {
1433        req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
1434    };
1435    if let Some(ref token) = configuration.bearer_access_token {
1436        req_builder = req_builder.bearer_auth(token.to_owned());
1437    };
1438    req_builder = req_builder.json(&p_body_workflow_create_input);
1439
1440    let req = req_builder.build()?;
1441    let resp = configuration.client.execute(req).await?;
1442
1443    let status = resp.status();
1444
1445    if !status.is_client_error() && !status.is_server_error() {
1446        Ok(())
1447    } else {
1448        let content = resp.text().await?;
1449        let entity: Option<PostWorkflowError> = serde_json::from_str(&content).ok();
1450        Err(Error::ResponseError(ResponseContent {
1451            status,
1452            content,
1453            entity,
1454        }))
1455    }
1456}