jira/gen/apis/
issue_security_schemes_api.rs1use super::{configuration, Error};
12use crate::gen::apis::ResponseContent;
13use crate::gen::models;
14
15#[derive(Clone, Debug)]
17pub struct GetIssueSecuritySchemeParams {
18 pub id: i64,
20}
21
22#[derive(Debug, Clone, Serialize, Deserialize)]
24#[serde(untagged)]
25pub enum GetIssueSecuritySchemeError {
26 Status401(),
27 Status403(),
28 UnknownValue(serde_json::Value),
29}
30
31#[derive(Debug, Clone, Serialize, Deserialize)]
33#[serde(untagged)]
34pub enum GetIssueSecuritySchemesError {
35 Status401(),
36 Status403(),
37 UnknownValue(serde_json::Value),
38}
39
40pub async fn get_issue_security_scheme(
42 configuration: &configuration::Configuration,
43 params: GetIssueSecuritySchemeParams,
44) -> Result<models::SecurityScheme, Error<GetIssueSecuritySchemeError>> {
45 let id = params.id;
47
48 let local_var_client = &configuration.client;
49
50 let local_var_uri_str = format!(
51 "{}/rest/api/3/issuesecurityschemes/{id}",
52 configuration.base_path,
53 id = id
54 );
55 let mut local_var_req_builder = local_var_client.get(local_var_uri_str.as_str());
56
57 if let Some(ref local_var_user_agent) = configuration.user_agent {
58 local_var_req_builder =
59 local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
60 }
61 if let Some(ref local_var_token) = configuration.oauth_access_token {
62 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
63 };
64 if let Some(ref local_var_auth_conf) = configuration.basic_auth {
65 local_var_req_builder = local_var_req_builder.basic_auth(
66 local_var_auth_conf.0.to_owned(),
67 local_var_auth_conf.1.to_owned(),
68 );
69 };
70
71 let local_var_req = local_var_req_builder.build()?;
72 let local_var_resp = local_var_client.execute(local_var_req).await?;
73
74 let local_var_status = local_var_resp.status();
75 let local_var_content = local_var_resp.text().await?;
76
77 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
78 serde_json::from_str(&local_var_content).map_err(Error::from)
79 } else {
80 let local_var_entity: Option<GetIssueSecuritySchemeError> =
81 serde_json::from_str(&local_var_content).ok();
82 let local_var_error = ResponseContent {
83 status: local_var_status,
84 content: local_var_content,
85 entity: local_var_entity,
86 };
87 Err(Error::ResponseError(local_var_error))
88 }
89}
90
91pub async fn get_issue_security_schemes(
93 configuration: &configuration::Configuration,
94) -> Result<models::SecuritySchemes, Error<GetIssueSecuritySchemesError>> {
95 let local_var_client = &configuration.client;
98
99 let local_var_uri_str = format!(
100 "{}/rest/api/3/issuesecurityschemes",
101 configuration.base_path
102 );
103 let mut local_var_req_builder = local_var_client.get(local_var_uri_str.as_str());
104
105 if let Some(ref local_var_user_agent) = configuration.user_agent {
106 local_var_req_builder =
107 local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
108 }
109 if let Some(ref local_var_token) = configuration.oauth_access_token {
110 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
111 };
112 if let Some(ref local_var_auth_conf) = configuration.basic_auth {
113 local_var_req_builder = local_var_req_builder.basic_auth(
114 local_var_auth_conf.0.to_owned(),
115 local_var_auth_conf.1.to_owned(),
116 );
117 };
118
119 let local_var_req = local_var_req_builder.build()?;
120 let local_var_resp = local_var_client.execute(local_var_req).await?;
121
122 let local_var_status = local_var_resp.status();
123 let local_var_content = local_var_resp.text().await?;
124
125 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
126 serde_json::from_str(&local_var_content).map_err(Error::from)
127 } else {
128 let local_var_entity: Option<GetIssueSecuritySchemesError> =
129 serde_json::from_str(&local_var_content).ok();
130 let local_var_error = ResponseContent {
131 status: local_var_status,
132 content: local_var_content,
133 entity: local_var_entity,
134 };
135 Err(Error::ResponseError(local_var_error))
136 }
137}