1use reqwest;
13use serde::{Deserialize, Serialize, de::Error as _};
14use crate::{apis::ResponseContent, models};
15use super::{Error, configuration, ContentType};
16
17
18#[derive(Debug, Clone, Serialize, Deserialize)]
20#[serde(untagged)]
21pub enum GetLicensingDownloadByReleaseError {
22 UnknownValue(serde_json::Value),
23}
24
25#[derive(Debug, Clone, Serialize, Deserialize)]
27#[serde(untagged)]
28pub enum GetLicensingHealthzError {
29 UnknownValue(serde_json::Value),
30}
31
32#[derive(Debug, Clone, Serialize, Deserialize)]
34#[serde(untagged)]
35pub enum GetLicensingJwksError {
36 UnknownValue(serde_json::Value),
37}
38
39#[derive(Debug, Clone, Serialize, Deserialize)]
41#[serde(untagged)]
42pub enum GetLicensingPubkeyError {
43 UnknownValue(serde_json::Value),
44}
45
46#[derive(Debug, Clone, Serialize, Deserialize)]
48#[serde(untagged)]
49pub enum GetLicensingReleasesError {
50 UnknownValue(serde_json::Value),
51}
52
53#[derive(Debug, Clone, Serialize, Deserialize)]
55#[serde(untagged)]
56pub enum GetLicensingReleasesByReleaseError {
57 UnknownValue(serde_json::Value),
58}
59
60#[derive(Debug, Clone, Serialize, Deserialize)]
62#[serde(untagged)]
63pub enum PostLicensingFingerprintError {
64 UnknownValue(serde_json::Value),
65}
66
67#[derive(Debug, Clone, Serialize, Deserialize)]
69#[serde(untagged)]
70pub enum PostLicensingIssueError {
71 UnknownValue(serde_json::Value),
72}
73
74#[derive(Debug, Clone, Serialize, Deserialize)]
76#[serde(untagged)]
77pub enum PostLicensingReleasesError {
78 UnknownValue(serde_json::Value),
79}
80
81#[derive(Debug, Clone, Serialize, Deserialize)]
83#[serde(untagged)]
84pub enum PostLicensingRevokeError {
85 UnknownValue(serde_json::Value),
86}
87
88#[derive(Debug, Clone, Serialize, Deserialize)]
90#[serde(untagged)]
91pub enum PostLicensingVerifyError {
92 UnknownValue(serde_json::Value),
93}
94
95
96pub async fn get_licensing_download_by_release(configuration: &configuration::Configuration, release: &str, x_license_token: Option<&str>, token: Option<&str>) -> Result<models::LicensingPeriodReleaseAsset, Error<GetLicensingDownloadByReleaseError>> {
98 let p_release = release;
100 let p_x_license_token = x_license_token;
101 let p_token = token;
102
103 let uri_str = format!("{}/v1/licensing/download/{release}", configuration.base_path, release=crate::apis::urlencode(p_release));
104 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
105
106 if let Some(ref param_value) = p_token {
107 req_builder = req_builder.query(&[("token", ¶m_value.to_string())]);
108 }
109 if let Some(ref user_agent) = configuration.user_agent {
110 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
111 }
112 if let Some(param_value) = p_x_license_token {
113 req_builder = req_builder.header("X-License-Token", param_value.to_string());
114 }
115 if let Some(ref token) = configuration.bearer_access_token {
116 req_builder = req_builder.bearer_auth(token.to_owned());
117 };
118
119 let req = req_builder.build()?;
120 let resp = configuration.client.execute(req).await?;
121
122 let status = resp.status();
123 let content_type = resp
124 .headers()
125 .get("content-type")
126 .and_then(|v| v.to_str().ok())
127 .unwrap_or("application/octet-stream");
128 let content_type = super::ContentType::from(content_type);
129
130 if !status.is_client_error() && !status.is_server_error() {
131 let content = resp.text().await?;
132 match content_type {
133 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
134 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::LicensingPeriodReleaseAsset`"))),
135 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::LicensingPeriodReleaseAsset`")))),
136 }
137 } else {
138 let content = resp.text().await?;
139 let entity: Option<GetLicensingDownloadByReleaseError> = serde_json::from_str(&content).ok();
140 Err(Error::ResponseError(ResponseContent { status, content, entity }))
141 }
142}
143
144pub async fn get_licensing_healthz(configuration: &configuration::Configuration, ) -> Result<models::LicensingPeriodHealthView, Error<GetLicensingHealthzError>> {
146
147 let uri_str = format!("{}/v1/licensing/healthz", configuration.base_path);
148 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
149
150 if let Some(ref user_agent) = configuration.user_agent {
151 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
152 }
153 if let Some(ref token) = configuration.bearer_access_token {
154 req_builder = req_builder.bearer_auth(token.to_owned());
155 };
156
157 let req = req_builder.build()?;
158 let resp = configuration.client.execute(req).await?;
159
160 let status = resp.status();
161 let content_type = resp
162 .headers()
163 .get("content-type")
164 .and_then(|v| v.to_str().ok())
165 .unwrap_or("application/octet-stream");
166 let content_type = super::ContentType::from(content_type);
167
168 if !status.is_client_error() && !status.is_server_error() {
169 let content = resp.text().await?;
170 match content_type {
171 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
172 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::LicensingPeriodHealthView`"))),
173 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::LicensingPeriodHealthView`")))),
174 }
175 } else {
176 let content = resp.text().await?;
177 let entity: Option<GetLicensingHealthzError> = serde_json::from_str(&content).ok();
178 Err(Error::ResponseError(ResponseContent { status, content, entity }))
179 }
180}
181
182pub async fn get_licensing_jwks(configuration: &configuration::Configuration, ) -> Result<models::LicensingPeriodPubkeyView, Error<GetLicensingJwksError>> {
184
185 let uri_str = format!("{}/v1/licensing/jwks", configuration.base_path);
186 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
187
188 if let Some(ref user_agent) = configuration.user_agent {
189 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
190 }
191 if let Some(ref token) = configuration.bearer_access_token {
192 req_builder = req_builder.bearer_auth(token.to_owned());
193 };
194
195 let req = req_builder.build()?;
196 let resp = configuration.client.execute(req).await?;
197
198 let status = resp.status();
199 let content_type = resp
200 .headers()
201 .get("content-type")
202 .and_then(|v| v.to_str().ok())
203 .unwrap_or("application/octet-stream");
204 let content_type = super::ContentType::from(content_type);
205
206 if !status.is_client_error() && !status.is_server_error() {
207 let content = resp.text().await?;
208 match content_type {
209 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
210 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::LicensingPeriodPubkeyView`"))),
211 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::LicensingPeriodPubkeyView`")))),
212 }
213 } else {
214 let content = resp.text().await?;
215 let entity: Option<GetLicensingJwksError> = serde_json::from_str(&content).ok();
216 Err(Error::ResponseError(ResponseContent { status, content, entity }))
217 }
218}
219
220pub async fn get_licensing_pubkey(configuration: &configuration::Configuration, ) -> Result<models::LicensingPeriodPubkeyView, Error<GetLicensingPubkeyError>> {
222
223 let uri_str = format!("{}/v1/licensing/pubkey", configuration.base_path);
224 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
225
226 if let Some(ref user_agent) = configuration.user_agent {
227 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
228 }
229 if let Some(ref token) = configuration.bearer_access_token {
230 req_builder = req_builder.bearer_auth(token.to_owned());
231 };
232
233 let req = req_builder.build()?;
234 let resp = configuration.client.execute(req).await?;
235
236 let status = resp.status();
237 let content_type = resp
238 .headers()
239 .get("content-type")
240 .and_then(|v| v.to_str().ok())
241 .unwrap_or("application/octet-stream");
242 let content_type = super::ContentType::from(content_type);
243
244 if !status.is_client_error() && !status.is_server_error() {
245 let content = resp.text().await?;
246 match content_type {
247 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
248 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::LicensingPeriodPubkeyView`"))),
249 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::LicensingPeriodPubkeyView`")))),
250 }
251 } else {
252 let content = resp.text().await?;
253 let entity: Option<GetLicensingPubkeyError> = serde_json::from_str(&content).ok();
254 Err(Error::ResponseError(ResponseContent { status, content, entity }))
255 }
256}
257
258pub async fn get_licensing_releases(configuration: &configuration::Configuration, ) -> Result<models::LicensingPeriodReleaseList, Error<GetLicensingReleasesError>> {
260
261 let uri_str = format!("{}/v1/licensing/releases", configuration.base_path);
262 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
263
264 if let Some(ref user_agent) = configuration.user_agent {
265 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
266 }
267 if let Some(ref token) = configuration.bearer_access_token {
268 req_builder = req_builder.bearer_auth(token.to_owned());
269 };
270
271 let req = req_builder.build()?;
272 let resp = configuration.client.execute(req).await?;
273
274 let status = resp.status();
275 let content_type = resp
276 .headers()
277 .get("content-type")
278 .and_then(|v| v.to_str().ok())
279 .unwrap_or("application/octet-stream");
280 let content_type = super::ContentType::from(content_type);
281
282 if !status.is_client_error() && !status.is_server_error() {
283 let content = resp.text().await?;
284 match content_type {
285 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
286 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::LicensingPeriodReleaseList`"))),
287 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::LicensingPeriodReleaseList`")))),
288 }
289 } else {
290 let content = resp.text().await?;
291 let entity: Option<GetLicensingReleasesError> = serde_json::from_str(&content).ok();
292 Err(Error::ResponseError(ResponseContent { status, content, entity }))
293 }
294}
295
296pub async fn get_licensing_releases_by_release(configuration: &configuration::Configuration, release: &str) -> Result<models::LicensingPeriodRelease, Error<GetLicensingReleasesByReleaseError>> {
298 let p_release = release;
300
301 let uri_str = format!("{}/v1/licensing/releases/{release}", configuration.base_path, release=crate::apis::urlencode(p_release));
302 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
303
304 if let Some(ref user_agent) = configuration.user_agent {
305 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
306 }
307 if let Some(ref token) = configuration.bearer_access_token {
308 req_builder = req_builder.bearer_auth(token.to_owned());
309 };
310
311 let req = req_builder.build()?;
312 let resp = configuration.client.execute(req).await?;
313
314 let status = resp.status();
315 let content_type = resp
316 .headers()
317 .get("content-type")
318 .and_then(|v| v.to_str().ok())
319 .unwrap_or("application/octet-stream");
320 let content_type = super::ContentType::from(content_type);
321
322 if !status.is_client_error() && !status.is_server_error() {
323 let content = resp.text().await?;
324 match content_type {
325 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
326 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::LicensingPeriodRelease`"))),
327 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::LicensingPeriodRelease`")))),
328 }
329 } else {
330 let content = resp.text().await?;
331 let entity: Option<GetLicensingReleasesByReleaseError> = serde_json::from_str(&content).ok();
332 Err(Error::ResponseError(ResponseContent { status, content, entity }))
333 }
334}
335
336pub async fn post_licensing_fingerprint(configuration: &configuration::Configuration, licensing_period_fingerprint_request: models::LicensingPeriodFingerprintRequest) -> Result<models::LicensingPeriodFingerprintResponse, Error<PostLicensingFingerprintError>> {
338 let p_licensing_period_fingerprint_request = licensing_period_fingerprint_request;
340
341 let uri_str = format!("{}/v1/licensing/fingerprint", configuration.base_path);
342 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
343
344 if let Some(ref user_agent) = configuration.user_agent {
345 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
346 }
347 if let Some(ref token) = configuration.bearer_access_token {
348 req_builder = req_builder.bearer_auth(token.to_owned());
349 };
350 req_builder = req_builder.json(&p_licensing_period_fingerprint_request);
351
352 let req = req_builder.build()?;
353 let resp = configuration.client.execute(req).await?;
354
355 let status = resp.status();
356 let content_type = resp
357 .headers()
358 .get("content-type")
359 .and_then(|v| v.to_str().ok())
360 .unwrap_or("application/octet-stream");
361 let content_type = super::ContentType::from(content_type);
362
363 if !status.is_client_error() && !status.is_server_error() {
364 let content = resp.text().await?;
365 match content_type {
366 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
367 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::LicensingPeriodFingerprintResponse`"))),
368 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::LicensingPeriodFingerprintResponse`")))),
369 }
370 } else {
371 let content = resp.text().await?;
372 let entity: Option<PostLicensingFingerprintError> = serde_json::from_str(&content).ok();
373 Err(Error::ResponseError(ResponseContent { status, content, entity }))
374 }
375}
376
377pub async fn post_licensing_issue(configuration: &configuration::Configuration, licensing_period_issue_request: models::LicensingPeriodIssueRequest) -> Result<models::LicensingPeriodIssueResponse, Error<PostLicensingIssueError>> {
379 let p_licensing_period_issue_request = licensing_period_issue_request;
381
382 let uri_str = format!("{}/v1/licensing/issue", configuration.base_path);
383 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
384
385 if let Some(ref user_agent) = configuration.user_agent {
386 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
387 }
388 if let Some(ref token) = configuration.bearer_access_token {
389 req_builder = req_builder.bearer_auth(token.to_owned());
390 };
391 req_builder = req_builder.json(&p_licensing_period_issue_request);
392
393 let req = req_builder.build()?;
394 let resp = configuration.client.execute(req).await?;
395
396 let status = resp.status();
397 let content_type = resp
398 .headers()
399 .get("content-type")
400 .and_then(|v| v.to_str().ok())
401 .unwrap_or("application/octet-stream");
402 let content_type = super::ContentType::from(content_type);
403
404 if !status.is_client_error() && !status.is_server_error() {
405 let content = resp.text().await?;
406 match content_type {
407 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
408 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::LicensingPeriodIssueResponse`"))),
409 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::LicensingPeriodIssueResponse`")))),
410 }
411 } else {
412 let content = resp.text().await?;
413 let entity: Option<PostLicensingIssueError> = serde_json::from_str(&content).ok();
414 Err(Error::ResponseError(ResponseContent { status, content, entity }))
415 }
416}
417
418pub async fn post_licensing_releases(configuration: &configuration::Configuration, licensing_period_release: models::LicensingPeriodRelease) -> Result<models::LicensingPeriodRelease, Error<PostLicensingReleasesError>> {
420 let p_licensing_period_release = licensing_period_release;
422
423 let uri_str = format!("{}/v1/licensing/releases", configuration.base_path);
424 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
425
426 if let Some(ref user_agent) = configuration.user_agent {
427 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
428 }
429 if let Some(ref token) = configuration.bearer_access_token {
430 req_builder = req_builder.bearer_auth(token.to_owned());
431 };
432 req_builder = req_builder.json(&p_licensing_period_release);
433
434 let req = req_builder.build()?;
435 let resp = configuration.client.execute(req).await?;
436
437 let status = resp.status();
438 let content_type = resp
439 .headers()
440 .get("content-type")
441 .and_then(|v| v.to_str().ok())
442 .unwrap_or("application/octet-stream");
443 let content_type = super::ContentType::from(content_type);
444
445 if !status.is_client_error() && !status.is_server_error() {
446 let content = resp.text().await?;
447 match content_type {
448 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
449 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::LicensingPeriodRelease`"))),
450 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::LicensingPeriodRelease`")))),
451 }
452 } else {
453 let content = resp.text().await?;
454 let entity: Option<PostLicensingReleasesError> = serde_json::from_str(&content).ok();
455 Err(Error::ResponseError(ResponseContent { status, content, entity }))
456 }
457}
458
459pub async fn post_licensing_revoke(configuration: &configuration::Configuration, licensing_period_revoke_request: models::LicensingPeriodRevokeRequest) -> Result<models::LicensingPeriodRevokeResponse, Error<PostLicensingRevokeError>> {
461 let p_licensing_period_revoke_request = licensing_period_revoke_request;
463
464 let uri_str = format!("{}/v1/licensing/revoke", configuration.base_path);
465 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
466
467 if let Some(ref user_agent) = configuration.user_agent {
468 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
469 }
470 if let Some(ref token) = configuration.bearer_access_token {
471 req_builder = req_builder.bearer_auth(token.to_owned());
472 };
473 req_builder = req_builder.json(&p_licensing_period_revoke_request);
474
475 let req = req_builder.build()?;
476 let resp = configuration.client.execute(req).await?;
477
478 let status = resp.status();
479 let content_type = resp
480 .headers()
481 .get("content-type")
482 .and_then(|v| v.to_str().ok())
483 .unwrap_or("application/octet-stream");
484 let content_type = super::ContentType::from(content_type);
485
486 if !status.is_client_error() && !status.is_server_error() {
487 let content = resp.text().await?;
488 match content_type {
489 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
490 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::LicensingPeriodRevokeResponse`"))),
491 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::LicensingPeriodRevokeResponse`")))),
492 }
493 } else {
494 let content = resp.text().await?;
495 let entity: Option<PostLicensingRevokeError> = serde_json::from_str(&content).ok();
496 Err(Error::ResponseError(ResponseContent { status, content, entity }))
497 }
498}
499
500pub async fn post_licensing_verify(configuration: &configuration::Configuration, licensing_period_verify_request: models::LicensingPeriodVerifyRequest) -> Result<models::LicensingPeriodVerifyResponse, Error<PostLicensingVerifyError>> {
502 let p_licensing_period_verify_request = licensing_period_verify_request;
504
505 let uri_str = format!("{}/v1/licensing/verify", configuration.base_path);
506 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
507
508 if let Some(ref user_agent) = configuration.user_agent {
509 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
510 }
511 if let Some(ref token) = configuration.bearer_access_token {
512 req_builder = req_builder.bearer_auth(token.to_owned());
513 };
514 req_builder = req_builder.json(&p_licensing_period_verify_request);
515
516 let req = req_builder.build()?;
517 let resp = configuration.client.execute(req).await?;
518
519 let status = resp.status();
520 let content_type = resp
521 .headers()
522 .get("content-type")
523 .and_then(|v| v.to_str().ok())
524 .unwrap_or("application/octet-stream");
525 let content_type = super::ContentType::from(content_type);
526
527 if !status.is_client_error() && !status.is_server_error() {
528 let content = resp.text().await?;
529 match content_type {
530 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
531 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::LicensingPeriodVerifyResponse`"))),
532 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::LicensingPeriodVerifyResponse`")))),
533 }
534 } else {
535 let content = resp.text().await?;
536 let entity: Option<PostLicensingVerifyError> = serde_json::from_str(&content).ok();
537 Err(Error::ResponseError(ResponseContent { status, content, entity }))
538 }
539}
540