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