Skip to main content

gitea_sdk_rs/options/
action.rs

1// Copyright 2026 infinitete. All rights reserved.
2// Use of this source code is governed by a MIT-style
3// license that can be found in the LICENSE file.
4
5//! Request option types for CI/CD action API endpoints.
6
7use crate::pagination::{ListOptions, QueryEncode};
8
9#[derive(Debug, Clone, Default)]
10/// Options for List Repo Action Runs Option.
11pub struct ListRepoActionRunsOptions {
12    pub list_options: ListOptions,
13    pub branch: Option<String>,
14    pub event: Option<String>,
15    pub status: Option<String>,
16    pub actor: Option<String>,
17    pub head_sha: Option<String>,
18}
19
20impl QueryEncode for ListRepoActionRunsOptions {
21    fn query_encode(&self) -> String {
22        let mut out = self.list_options.query_encode();
23        if let Some(ref branch) = self.branch {
24            out.push_str(&format!("&branch={branch}"));
25        }
26        if let Some(ref event) = self.event {
27            out.push_str(&format!("&event={event}"));
28        }
29        if let Some(ref status) = self.status {
30            out.push_str(&format!("&status={status}"));
31        }
32        if let Some(ref actor) = self.actor {
33            out.push_str(&format!("&actor={actor}"));
34        }
35        if let Some(ref head_sha) = self.head_sha {
36            out.push_str(&format!("&head_sha={head_sha}"));
37        }
38        out
39    }
40}
41
42#[derive(Debug, Clone, Default)]
43/// Options for List Repo Action Jobs Option.
44pub struct ListRepoActionJobsOptions {
45    pub list_options: ListOptions,
46    pub status: Option<String>,
47}
48
49impl QueryEncode for ListRepoActionJobsOptions {
50    fn query_encode(&self) -> String {
51        let mut out = self.list_options.query_encode();
52        if let Some(ref status) = self.status {
53            out.push_str(&format!("&status={status}"));
54        }
55        out
56    }
57}