openapi_github/apis/
billing_api.rs1use reqwest;
13use serde::{Deserialize, Serialize};
14use crate::{apis::ResponseContent, models};
15use super::{Error, configuration};
16
17
18#[derive(Debug, Clone, Serialize, Deserialize)]
20#[serde(untagged)]
21pub enum BillingSlashGetGithubActionsBillingOrgError {
22 UnknownValue(serde_json::Value),
23}
24
25#[derive(Debug, Clone, Serialize, Deserialize)]
27#[serde(untagged)]
28pub enum BillingSlashGetGithubActionsBillingUserError {
29 UnknownValue(serde_json::Value),
30}
31
32#[derive(Debug, Clone, Serialize, Deserialize)]
34#[serde(untagged)]
35pub enum BillingSlashGetGithubPackagesBillingOrgError {
36 UnknownValue(serde_json::Value),
37}
38
39#[derive(Debug, Clone, Serialize, Deserialize)]
41#[serde(untagged)]
42pub enum BillingSlashGetGithubPackagesBillingUserError {
43 UnknownValue(serde_json::Value),
44}
45
46#[derive(Debug, Clone, Serialize, Deserialize)]
48#[serde(untagged)]
49pub enum BillingSlashGetSharedStorageBillingOrgError {
50 UnknownValue(serde_json::Value),
51}
52
53#[derive(Debug, Clone, Serialize, Deserialize)]
55#[serde(untagged)]
56pub enum BillingSlashGetSharedStorageBillingUserError {
57 UnknownValue(serde_json::Value),
58}
59
60
61pub async fn billing_slash_get_github_actions_billing_org(configuration: &configuration::Configuration, org: &str) -> Result<models::ActionsBillingUsage, Error<BillingSlashGetGithubActionsBillingOrgError>> {
63 let local_var_configuration = configuration;
64
65 let local_var_client = &local_var_configuration.client;
66
67 let local_var_uri_str = format!("{}/orgs/{org}/settings/billing/actions", local_var_configuration.base_path, org=crate::apis::urlencode(org));
68 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
69
70 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
71 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
72 }
73
74 let local_var_req = local_var_req_builder.build()?;
75 let local_var_resp = local_var_client.execute(local_var_req).await?;
76
77 let local_var_status = local_var_resp.status();
78 let local_var_content = local_var_resp.text().await?;
79
80 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
81 serde_json::from_str(&local_var_content).map_err(Error::from)
82 } else {
83 let local_var_entity: Option<BillingSlashGetGithubActionsBillingOrgError> = serde_json::from_str(&local_var_content).ok();
84 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
85 Err(Error::ResponseError(local_var_error))
86 }
87}
88
89pub async fn billing_slash_get_github_actions_billing_user(configuration: &configuration::Configuration, username: &str) -> Result<models::ActionsBillingUsage, Error<BillingSlashGetGithubActionsBillingUserError>> {
91 let local_var_configuration = configuration;
92
93 let local_var_client = &local_var_configuration.client;
94
95 let local_var_uri_str = format!("{}/users/{username}/settings/billing/actions", local_var_configuration.base_path, username=crate::apis::urlencode(username));
96 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
97
98 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
99 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
100 }
101
102 let local_var_req = local_var_req_builder.build()?;
103 let local_var_resp = local_var_client.execute(local_var_req).await?;
104
105 let local_var_status = local_var_resp.status();
106 let local_var_content = local_var_resp.text().await?;
107
108 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
109 serde_json::from_str(&local_var_content).map_err(Error::from)
110 } else {
111 let local_var_entity: Option<BillingSlashGetGithubActionsBillingUserError> = serde_json::from_str(&local_var_content).ok();
112 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
113 Err(Error::ResponseError(local_var_error))
114 }
115}
116
117pub async fn billing_slash_get_github_packages_billing_org(configuration: &configuration::Configuration, org: &str) -> Result<models::PackagesBillingUsage, Error<BillingSlashGetGithubPackagesBillingOrgError>> {
119 let local_var_configuration = configuration;
120
121 let local_var_client = &local_var_configuration.client;
122
123 let local_var_uri_str = format!("{}/orgs/{org}/settings/billing/packages", local_var_configuration.base_path, org=crate::apis::urlencode(org));
124 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
125
126 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
127 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
128 }
129
130 let local_var_req = local_var_req_builder.build()?;
131 let local_var_resp = local_var_client.execute(local_var_req).await?;
132
133 let local_var_status = local_var_resp.status();
134 let local_var_content = local_var_resp.text().await?;
135
136 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
137 serde_json::from_str(&local_var_content).map_err(Error::from)
138 } else {
139 let local_var_entity: Option<BillingSlashGetGithubPackagesBillingOrgError> = serde_json::from_str(&local_var_content).ok();
140 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
141 Err(Error::ResponseError(local_var_error))
142 }
143}
144
145pub async fn billing_slash_get_github_packages_billing_user(configuration: &configuration::Configuration, username: &str) -> Result<models::PackagesBillingUsage, Error<BillingSlashGetGithubPackagesBillingUserError>> {
147 let local_var_configuration = configuration;
148
149 let local_var_client = &local_var_configuration.client;
150
151 let local_var_uri_str = format!("{}/users/{username}/settings/billing/packages", local_var_configuration.base_path, username=crate::apis::urlencode(username));
152 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
153
154 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
155 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
156 }
157
158 let local_var_req = local_var_req_builder.build()?;
159 let local_var_resp = local_var_client.execute(local_var_req).await?;
160
161 let local_var_status = local_var_resp.status();
162 let local_var_content = local_var_resp.text().await?;
163
164 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
165 serde_json::from_str(&local_var_content).map_err(Error::from)
166 } else {
167 let local_var_entity: Option<BillingSlashGetGithubPackagesBillingUserError> = serde_json::from_str(&local_var_content).ok();
168 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
169 Err(Error::ResponseError(local_var_error))
170 }
171}
172
173pub async fn billing_slash_get_shared_storage_billing_org(configuration: &configuration::Configuration, org: &str) -> Result<models::CombinedBillingUsage, Error<BillingSlashGetSharedStorageBillingOrgError>> {
175 let local_var_configuration = configuration;
176
177 let local_var_client = &local_var_configuration.client;
178
179 let local_var_uri_str = format!("{}/orgs/{org}/settings/billing/shared-storage", local_var_configuration.base_path, org=crate::apis::urlencode(org));
180 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
181
182 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
183 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
184 }
185
186 let local_var_req = local_var_req_builder.build()?;
187 let local_var_resp = local_var_client.execute(local_var_req).await?;
188
189 let local_var_status = local_var_resp.status();
190 let local_var_content = local_var_resp.text().await?;
191
192 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
193 serde_json::from_str(&local_var_content).map_err(Error::from)
194 } else {
195 let local_var_entity: Option<BillingSlashGetSharedStorageBillingOrgError> = serde_json::from_str(&local_var_content).ok();
196 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
197 Err(Error::ResponseError(local_var_error))
198 }
199}
200
201pub async fn billing_slash_get_shared_storage_billing_user(configuration: &configuration::Configuration, username: &str) -> Result<models::CombinedBillingUsage, Error<BillingSlashGetSharedStorageBillingUserError>> {
203 let local_var_configuration = configuration;
204
205 let local_var_client = &local_var_configuration.client;
206
207 let local_var_uri_str = format!("{}/users/{username}/settings/billing/shared-storage", local_var_configuration.base_path, username=crate::apis::urlencode(username));
208 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
209
210 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
211 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
212 }
213
214 let local_var_req = local_var_req_builder.build()?;
215 let local_var_resp = local_var_client.execute(local_var_req).await?;
216
217 let local_var_status = local_var_resp.status();
218 let local_var_content = local_var_resp.text().await?;
219
220 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
221 serde_json::from_str(&local_var_content).map_err(Error::from)
222 } else {
223 let local_var_entity: Option<BillingSlashGetSharedStorageBillingUserError> = serde_json::from_str(&local_var_content).ok();
224 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
225 Err(Error::ResponseError(local_var_error))
226 }
227}
228