1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
// @generated DO NOT EDIT.
//
// Generated from the CNB OpenAPI specification by `cnb-codegen`.
// Run `cargo run -p cnb-codegen --manifest-path codegen/Cargo.toml \
// -- --spec codegen/spec/swagger.json --out src` to refresh.
#![allow(clippy::all)]
#![allow(missing_docs)]
#![allow(unused_imports)]
#![allow(unused_mut)]
use reqwest::Method;
use serde::Serialize;
use crate::error::{ApiError, Result};
use crate::http::HttpInner;
use crate::models;
// `Security` resource client (generated, 1 operations).
/// Resource client.
#[derive(Debug, Clone)]
pub struct SecurityClient {
inner: HttpInner,
}
impl SecurityClient {
/// Construct a new resource client. Normally obtained
/// via [`crate::ApiClient`] rather than directly.
pub fn new(inner: HttpInner) -> Self {
Self { inner }
}
/// 查询仓库安全模块概览数据。Query the security overview data of a repository
///
/// `GET /{repo}/-/security/overview`
pub async fn get_repo_security_overview(
&self,
repo: String,
query: &GetRepoSecurityOverviewQuery,
) -> Result<crate::models::RepoSecurityOverview> {
let path = format!("/{}/-/security/overview", repo);
let mut url = self.inner.url(&path)?;
{
let mut pairs = url.query_pairs_mut();
if let Some(ref v) = query.types {
pairs.append_pair("types", v);
}
if let Some(ref v) = query.tab {
pairs.append_pair("tab", v);
}
drop(pairs);
}
self.inner
.execute::<crate::models::RepoSecurityOverview>(Method::GET, url)
.await
}
}
/// Query parameters for the matching method on the resource client.
#[derive(Debug, Clone, Default, Serialize)]
pub struct GetRepoSecurityOverviewQuery {
/// 类型,多个类型用逗号分隔code_sensitive,code_vulnerability,code_issue,code_license 为空默认查询所有类型
#[serde(default, skip_serializing_if = "Option::is_none")]
pub types: Option<String>,
/// 查询类型下开启或忽略的各风险类型概览数量,可选值:open,ignore,all,默认all
#[serde(default, skip_serializing_if = "Option::is_none")]
pub tab: Option<String>,
}
impl GetRepoSecurityOverviewQuery {
/// Construct an empty query.
pub fn new() -> Self {
Self::default()
}
/// Set `types` query parameter.
pub fn types(mut self, v: impl Into<String>) -> Self {
self.types = Some(v.into());
self
}
/// Set `tab` query parameter.
pub fn tab(mut self, v: impl Into<String>) -> Self {
self.tab = Some(v.into());
self
}
}