1use reqwest;
13use serde::{Deserialize, Serialize, de::Error as _};
14use crate::{apis::ResponseContent, models};
15use super::{Error, configuration, ContentType};
16
17#[derive(Clone, Debug)]
19pub struct AddLabelParams {
20 pub project_name: String,
22 pub repository_name: String,
24 pub reference: String,
26 pub label: models::Label,
28 pub x_request_id: Option<String>
30}
31
32#[derive(Clone, Debug)]
34pub struct CopyArtifactParams {
35 pub project_name: String,
37 pub repository_name: String,
39 pub from: String,
41 pub x_request_id: Option<String>
43}
44
45#[derive(Clone, Debug)]
47pub struct CreateTagParams {
48 pub project_name: String,
50 pub repository_name: String,
52 pub reference: String,
54 pub tag: models::Tag,
56 pub x_request_id: Option<String>
58}
59
60#[derive(Clone, Debug)]
62pub struct DeleteArtifactParams {
63 pub project_name: String,
65 pub repository_name: String,
67 pub reference: String,
69 pub x_request_id: Option<String>
71}
72
73#[derive(Clone, Debug)]
75pub struct DeleteTagParams {
76 pub project_name: String,
78 pub repository_name: String,
80 pub reference: String,
82 pub tag_name: String,
84 pub x_request_id: Option<String>
86}
87
88#[derive(Clone, Debug)]
90pub struct GetAdditionParams {
91 pub project_name: String,
93 pub repository_name: String,
95 pub reference: String,
97 pub addition: String,
99 pub x_request_id: Option<String>
101}
102
103#[derive(Clone, Debug)]
105pub struct GetArtifactParams {
106 pub project_name: String,
108 pub repository_name: String,
110 pub reference: String,
112 pub x_request_id: Option<String>,
114 pub page: Option<i64>,
116 pub page_size: Option<i64>,
118 pub x_accept_vulnerabilities: Option<String>,
120 pub with_tag: Option<bool>,
122 pub with_label: Option<bool>,
124 pub with_scan_overview: Option<bool>,
126 pub with_sbom_overview: Option<bool>,
128 pub with_accessory: Option<bool>,
130 pub with_signature: Option<bool>,
132 pub with_immutable_status: Option<bool>
134}
135
136#[derive(Clone, Debug)]
138pub struct GetVulnerabilitiesAdditionParams {
139 pub project_name: String,
141 pub repository_name: String,
143 pub reference: String,
145 pub x_request_id: Option<String>,
147 pub x_accept_vulnerabilities: Option<String>
149}
150
151#[derive(Clone, Debug)]
153pub struct ListAccessoriesParams {
154 pub project_name: String,
156 pub repository_name: String,
158 pub reference: String,
160 pub x_request_id: Option<String>,
162 pub q: Option<String>,
164 pub sort: Option<String>,
166 pub page: Option<i64>,
168 pub page_size: Option<i64>
170}
171
172#[derive(Clone, Debug)]
174pub struct ListArtifactsParams {
175 pub project_name: String,
177 pub repository_name: String,
179 pub x_request_id: Option<String>,
181 pub q: Option<String>,
183 pub sort: Option<String>,
185 pub page: Option<i64>,
187 pub page_size: Option<i64>,
189 pub x_accept_vulnerabilities: Option<String>,
191 pub with_tag: Option<bool>,
193 pub with_label: Option<bool>,
195 pub with_scan_overview: Option<bool>,
197 pub with_sbom_overview: Option<bool>,
199 pub with_signature: Option<bool>,
201 pub with_immutable_status: Option<bool>,
203 pub with_accessory: Option<bool>
205}
206
207#[derive(Clone, Debug)]
209pub struct ListTagsParams {
210 pub project_name: String,
212 pub repository_name: String,
214 pub reference: String,
216 pub x_request_id: Option<String>,
218 pub q: Option<String>,
220 pub sort: Option<String>,
222 pub page: Option<i64>,
224 pub page_size: Option<i64>,
226 pub with_signature: Option<bool>,
228 pub with_immutable_status: Option<bool>
230}
231
232#[derive(Clone, Debug)]
234pub struct RemoveLabelParams {
235 pub project_name: String,
237 pub repository_name: String,
239 pub reference: String,
241 pub label_id: i64,
243 pub x_request_id: Option<String>
245}
246
247
248#[derive(Debug, Clone, Serialize, Deserialize)]
250#[serde(untagged)]
251pub enum AddLabelError {
252 Status400(models::Errors),
253 Status401(models::Errors),
254 Status403(models::Errors),
255 Status404(models::Errors),
256 Status409(models::Errors),
257 Status500(models::Errors),
258 UnknownValue(serde_json::Value),
259}
260
261#[derive(Debug, Clone, Serialize, Deserialize)]
263#[serde(untagged)]
264pub enum CopyArtifactError {
265 Status400(models::Errors),
266 Status401(models::Errors),
267 Status403(models::Errors),
268 Status404(models::Errors),
269 Status405(models::Errors),
270 Status500(models::Errors),
271 UnknownValue(serde_json::Value),
272}
273
274#[derive(Debug, Clone, Serialize, Deserialize)]
276#[serde(untagged)]
277pub enum CreateTagError {
278 Status400(models::Errors),
279 Status401(models::Errors),
280 Status403(models::Errors),
281 Status404(models::Errors),
282 Status405(models::Errors),
283 Status409(models::Errors),
284 Status500(models::Errors),
285 UnknownValue(serde_json::Value),
286}
287
288#[derive(Debug, Clone, Serialize, Deserialize)]
290#[serde(untagged)]
291pub enum DeleteArtifactError {
292 Status401(models::Errors),
293 Status403(models::Errors),
294 Status404(models::Errors),
295 Status500(models::Errors),
296 UnknownValue(serde_json::Value),
297}
298
299#[derive(Debug, Clone, Serialize, Deserialize)]
301#[serde(untagged)]
302pub enum DeleteTagError {
303 Status401(models::Errors),
304 Status403(models::Errors),
305 Status404(models::Errors),
306 Status500(models::Errors),
307 UnknownValue(serde_json::Value),
308}
309
310#[derive(Debug, Clone, Serialize, Deserialize)]
312#[serde(untagged)]
313pub enum GetAdditionError {
314 Status400(models::Errors),
315 Status401(models::Errors),
316 Status403(models::Errors),
317 Status404(models::Errors),
318 Status422(models::Errors),
319 Status500(models::Errors),
320 UnknownValue(serde_json::Value),
321}
322
323#[derive(Debug, Clone, Serialize, Deserialize)]
325#[serde(untagged)]
326pub enum GetArtifactError {
327 Status400(models::Errors),
328 Status401(models::Errors),
329 Status403(models::Errors),
330 Status404(models::Errors),
331 Status500(models::Errors),
332 UnknownValue(serde_json::Value),
333}
334
335#[derive(Debug, Clone, Serialize, Deserialize)]
337#[serde(untagged)]
338pub enum GetVulnerabilitiesAdditionError {
339 Status400(models::Errors),
340 Status401(models::Errors),
341 Status403(models::Errors),
342 Status404(models::Errors),
343 Status500(models::Errors),
344 UnknownValue(serde_json::Value),
345}
346
347#[derive(Debug, Clone, Serialize, Deserialize)]
349#[serde(untagged)]
350pub enum ListAccessoriesError {
351 Status400(models::Errors),
352 Status401(models::Errors),
353 Status403(models::Errors),
354 Status404(models::Errors),
355 Status500(models::Errors),
356 UnknownValue(serde_json::Value),
357}
358
359#[derive(Debug, Clone, Serialize, Deserialize)]
361#[serde(untagged)]
362pub enum ListArtifactsError {
363 Status400(models::Errors),
364 Status401(models::Errors),
365 Status403(models::Errors),
366 Status404(models::Errors),
367 Status500(models::Errors),
368 UnknownValue(serde_json::Value),
369}
370
371#[derive(Debug, Clone, Serialize, Deserialize)]
373#[serde(untagged)]
374pub enum ListTagsError {
375 Status400(models::Errors),
376 Status401(models::Errors),
377 Status403(models::Errors),
378 Status404(models::Errors),
379 Status500(models::Errors),
380 UnknownValue(serde_json::Value),
381}
382
383#[derive(Debug, Clone, Serialize, Deserialize)]
385#[serde(untagged)]
386pub enum RemoveLabelError {
387 Status401(models::Errors),
388 Status403(models::Errors),
389 Status404(models::Errors),
390 Status409(models::Errors),
391 Status500(models::Errors),
392 UnknownValue(serde_json::Value),
393}
394
395
396pub async fn add_label(configuration: &configuration::Configuration, params: AddLabelParams) -> Result<(), Error<AddLabelError>> {
398
399 let uri_str = format!("{}/projects/{project_name}/repositories/{repository_name}/artifacts/{reference}/labels", configuration.base_path, project_name=crate::apis::urlencode(params.project_name), repository_name=crate::apis::urlencode(params.repository_name), reference=crate::apis::urlencode(params.reference));
400 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
401
402 if let Some(ref user_agent) = configuration.user_agent {
403 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
404 }
405 if let Some(param_value) = params.x_request_id {
406 req_builder = req_builder.header("X-Request-Id", param_value.to_string());
407 }
408 if let Some(ref auth_conf) = configuration.basic_auth {
409 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
410 };
411 req_builder = req_builder.json(¶ms.label);
412
413 let req = req_builder.build()?;
414 let resp = configuration.client.execute(req).await?;
415
416 let status = resp.status();
417
418 if !status.is_client_error() && !status.is_server_error() {
419 Ok(())
420 } else {
421 let content = resp.text().await?;
422 let entity: Option<AddLabelError> = serde_json::from_str(&content).ok();
423 Err(Error::ResponseError(ResponseContent { status, content, entity }))
424 }
425}
426
427pub async fn copy_artifact(configuration: &configuration::Configuration, params: CopyArtifactParams) -> Result<(), Error<CopyArtifactError>> {
429
430 let uri_str = format!("{}/projects/{project_name}/repositories/{repository_name}/artifacts", configuration.base_path, project_name=crate::apis::urlencode(params.project_name), repository_name=crate::apis::urlencode(params.repository_name));
431 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
432
433 req_builder = req_builder.query(&[("from", ¶ms.from.to_string())]);
434 if let Some(ref user_agent) = configuration.user_agent {
435 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
436 }
437 if let Some(param_value) = params.x_request_id {
438 req_builder = req_builder.header("X-Request-Id", param_value.to_string());
439 }
440 if let Some(ref auth_conf) = configuration.basic_auth {
441 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
442 };
443
444 let req = req_builder.build()?;
445 let resp = configuration.client.execute(req).await?;
446
447 let status = resp.status();
448
449 if !status.is_client_error() && !status.is_server_error() {
450 Ok(())
451 } else {
452 let content = resp.text().await?;
453 let entity: Option<CopyArtifactError> = serde_json::from_str(&content).ok();
454 Err(Error::ResponseError(ResponseContent { status, content, entity }))
455 }
456}
457
458pub async fn create_tag(configuration: &configuration::Configuration, params: CreateTagParams) -> Result<(), Error<CreateTagError>> {
460
461 let uri_str = format!("{}/projects/{project_name}/repositories/{repository_name}/artifacts/{reference}/tags", configuration.base_path, project_name=crate::apis::urlencode(params.project_name), repository_name=crate::apis::urlencode(params.repository_name), reference=crate::apis::urlencode(params.reference));
462 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
463
464 if let Some(ref user_agent) = configuration.user_agent {
465 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
466 }
467 if let Some(param_value) = params.x_request_id {
468 req_builder = req_builder.header("X-Request-Id", param_value.to_string());
469 }
470 if let Some(ref auth_conf) = configuration.basic_auth {
471 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
472 };
473 req_builder = req_builder.json(¶ms.tag);
474
475 let req = req_builder.build()?;
476 let resp = configuration.client.execute(req).await?;
477
478 let status = resp.status();
479
480 if !status.is_client_error() && !status.is_server_error() {
481 Ok(())
482 } else {
483 let content = resp.text().await?;
484 let entity: Option<CreateTagError> = serde_json::from_str(&content).ok();
485 Err(Error::ResponseError(ResponseContent { status, content, entity }))
486 }
487}
488
489pub async fn delete_artifact(configuration: &configuration::Configuration, params: DeleteArtifactParams) -> Result<(), Error<DeleteArtifactError>> {
491
492 let uri_str = format!("{}/projects/{project_name}/repositories/{repository_name}/artifacts/{reference}", configuration.base_path, project_name=crate::apis::urlencode(params.project_name), repository_name=crate::apis::urlencode(params.repository_name), reference=crate::apis::urlencode(params.reference));
493 let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str);
494
495 if let Some(ref user_agent) = configuration.user_agent {
496 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
497 }
498 if let Some(param_value) = params.x_request_id {
499 req_builder = req_builder.header("X-Request-Id", param_value.to_string());
500 }
501 if let Some(ref auth_conf) = configuration.basic_auth {
502 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
503 };
504
505 let req = req_builder.build()?;
506 let resp = configuration.client.execute(req).await?;
507
508 let status = resp.status();
509
510 if !status.is_client_error() && !status.is_server_error() {
511 Ok(())
512 } else {
513 let content = resp.text().await?;
514 let entity: Option<DeleteArtifactError> = serde_json::from_str(&content).ok();
515 Err(Error::ResponseError(ResponseContent { status, content, entity }))
516 }
517}
518
519pub async fn delete_tag(configuration: &configuration::Configuration, params: DeleteTagParams) -> Result<(), Error<DeleteTagError>> {
521
522 let uri_str = format!("{}/projects/{project_name}/repositories/{repository_name}/artifacts/{reference}/tags/{tag_name}", configuration.base_path, project_name=crate::apis::urlencode(params.project_name), repository_name=crate::apis::urlencode(params.repository_name), reference=crate::apis::urlencode(params.reference), tag_name=crate::apis::urlencode(params.tag_name));
523 let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str);
524
525 if let Some(ref user_agent) = configuration.user_agent {
526 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
527 }
528 if let Some(param_value) = params.x_request_id {
529 req_builder = req_builder.header("X-Request-Id", param_value.to_string());
530 }
531 if let Some(ref auth_conf) = configuration.basic_auth {
532 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
533 };
534
535 let req = req_builder.build()?;
536 let resp = configuration.client.execute(req).await?;
537
538 let status = resp.status();
539
540 if !status.is_client_error() && !status.is_server_error() {
541 Ok(())
542 } else {
543 let content = resp.text().await?;
544 let entity: Option<DeleteTagError> = serde_json::from_str(&content).ok();
545 Err(Error::ResponseError(ResponseContent { status, content, entity }))
546 }
547}
548
549pub async fn get_addition(configuration: &configuration::Configuration, params: GetAdditionParams) -> Result<String, Error<GetAdditionError>> {
551
552 let uri_str = format!("{}/projects/{project_name}/repositories/{repository_name}/artifacts/{reference}/additions/{addition}", configuration.base_path, project_name=crate::apis::urlencode(params.project_name), repository_name=crate::apis::urlencode(params.repository_name), reference=crate::apis::urlencode(params.reference), addition=crate::apis::urlencode(params.addition));
553 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
554
555 if let Some(ref user_agent) = configuration.user_agent {
556 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
557 }
558 if let Some(param_value) = params.x_request_id {
559 req_builder = req_builder.header("X-Request-Id", param_value.to_string());
560 }
561 if let Some(ref auth_conf) = configuration.basic_auth {
562 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
563 };
564
565 let req = req_builder.build()?;
566 let resp = configuration.client.execute(req).await?;
567
568 let status = resp.status();
569 let content_type = resp
570 .headers()
571 .get("content-type")
572 .and_then(|v| v.to_str().ok())
573 .unwrap_or("application/octet-stream");
574 let content_type = super::ContentType::from(content_type);
575
576 if !status.is_client_error() && !status.is_server_error() {
577 let content = resp.text().await?;
578 match content_type {
579 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
580 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `String`"))),
581 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `String`")))),
582 }
583 } else {
584 let content = resp.text().await?;
585 let entity: Option<GetAdditionError> = serde_json::from_str(&content).ok();
586 Err(Error::ResponseError(ResponseContent { status, content, entity }))
587 }
588}
589
590pub async fn get_artifact(configuration: &configuration::Configuration, params: GetArtifactParams) -> Result<models::Artifact, Error<GetArtifactError>> {
592
593 let uri_str = format!("{}/projects/{project_name}/repositories/{repository_name}/artifacts/{reference}", configuration.base_path, project_name=crate::apis::urlencode(params.project_name), repository_name=crate::apis::urlencode(params.repository_name), reference=crate::apis::urlencode(params.reference));
594 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
595
596 if let Some(ref param_value) = params.page {
597 req_builder = req_builder.query(&[("page", ¶m_value.to_string())]);
598 }
599 if let Some(ref param_value) = params.page_size {
600 req_builder = req_builder.query(&[("page_size", ¶m_value.to_string())]);
601 }
602 if let Some(ref param_value) = params.with_tag {
603 req_builder = req_builder.query(&[("with_tag", ¶m_value.to_string())]);
604 }
605 if let Some(ref param_value) = params.with_label {
606 req_builder = req_builder.query(&[("with_label", ¶m_value.to_string())]);
607 }
608 if let Some(ref param_value) = params.with_scan_overview {
609 req_builder = req_builder.query(&[("with_scan_overview", ¶m_value.to_string())]);
610 }
611 if let Some(ref param_value) = params.with_sbom_overview {
612 req_builder = req_builder.query(&[("with_sbom_overview", ¶m_value.to_string())]);
613 }
614 if let Some(ref param_value) = params.with_accessory {
615 req_builder = req_builder.query(&[("with_accessory", ¶m_value.to_string())]);
616 }
617 if let Some(ref param_value) = params.with_signature {
618 req_builder = req_builder.query(&[("with_signature", ¶m_value.to_string())]);
619 }
620 if let Some(ref param_value) = params.with_immutable_status {
621 req_builder = req_builder.query(&[("with_immutable_status", ¶m_value.to_string())]);
622 }
623 if let Some(ref user_agent) = configuration.user_agent {
624 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
625 }
626 if let Some(param_value) = params.x_request_id {
627 req_builder = req_builder.header("X-Request-Id", param_value.to_string());
628 }
629 if let Some(param_value) = params.x_accept_vulnerabilities {
630 req_builder = req_builder.header("X-Accept-Vulnerabilities", param_value.to_string());
631 }
632 if let Some(ref auth_conf) = configuration.basic_auth {
633 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
634 };
635
636 let req = req_builder.build()?;
637 let resp = configuration.client.execute(req).await?;
638
639 let status = resp.status();
640 let content_type = resp
641 .headers()
642 .get("content-type")
643 .and_then(|v| v.to_str().ok())
644 .unwrap_or("application/octet-stream");
645 let content_type = super::ContentType::from(content_type);
646
647 if !status.is_client_error() && !status.is_server_error() {
648 let content = resp.text().await?;
649 match content_type {
650 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
651 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::Artifact`"))),
652 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::Artifact`")))),
653 }
654 } else {
655 let content = resp.text().await?;
656 let entity: Option<GetArtifactError> = serde_json::from_str(&content).ok();
657 Err(Error::ResponseError(ResponseContent { status, content, entity }))
658 }
659}
660
661pub async fn get_vulnerabilities_addition(configuration: &configuration::Configuration, params: GetVulnerabilitiesAdditionParams) -> Result<String, Error<GetVulnerabilitiesAdditionError>> {
663
664 let uri_str = format!("{}/projects/{project_name}/repositories/{repository_name}/artifacts/{reference}/additions/vulnerabilities", configuration.base_path, project_name=crate::apis::urlencode(params.project_name), repository_name=crate::apis::urlencode(params.repository_name), reference=crate::apis::urlencode(params.reference));
665 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
666
667 if let Some(ref user_agent) = configuration.user_agent {
668 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
669 }
670 if let Some(param_value) = params.x_request_id {
671 req_builder = req_builder.header("X-Request-Id", param_value.to_string());
672 }
673 if let Some(param_value) = params.x_accept_vulnerabilities {
674 req_builder = req_builder.header("X-Accept-Vulnerabilities", param_value.to_string());
675 }
676 if let Some(ref auth_conf) = configuration.basic_auth {
677 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
678 };
679
680 let req = req_builder.build()?;
681 let resp = configuration.client.execute(req).await?;
682
683 let status = resp.status();
684 let content_type = resp
685 .headers()
686 .get("content-type")
687 .and_then(|v| v.to_str().ok())
688 .unwrap_or("application/octet-stream");
689 let content_type = super::ContentType::from(content_type);
690
691 if !status.is_client_error() && !status.is_server_error() {
692 let content = resp.text().await?;
693 match content_type {
694 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
695 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `String`"))),
696 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `String`")))),
697 }
698 } else {
699 let content = resp.text().await?;
700 let entity: Option<GetVulnerabilitiesAdditionError> = serde_json::from_str(&content).ok();
701 Err(Error::ResponseError(ResponseContent { status, content, entity }))
702 }
703}
704
705pub async fn list_accessories(configuration: &configuration::Configuration, params: ListAccessoriesParams) -> Result<Vec<models::Accessory>, Error<ListAccessoriesError>> {
707
708 let uri_str = format!("{}/projects/{project_name}/repositories/{repository_name}/artifacts/{reference}/accessories", configuration.base_path, project_name=crate::apis::urlencode(params.project_name), repository_name=crate::apis::urlencode(params.repository_name), reference=crate::apis::urlencode(params.reference));
709 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
710
711 if let Some(ref param_value) = params.q {
712 req_builder = req_builder.query(&[("q", ¶m_value.to_string())]);
713 }
714 if let Some(ref param_value) = params.sort {
715 req_builder = req_builder.query(&[("sort", ¶m_value.to_string())]);
716 }
717 if let Some(ref param_value) = params.page {
718 req_builder = req_builder.query(&[("page", ¶m_value.to_string())]);
719 }
720 if let Some(ref param_value) = params.page_size {
721 req_builder = req_builder.query(&[("page_size", ¶m_value.to_string())]);
722 }
723 if let Some(ref user_agent) = configuration.user_agent {
724 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
725 }
726 if let Some(param_value) = params.x_request_id {
727 req_builder = req_builder.header("X-Request-Id", param_value.to_string());
728 }
729 if let Some(ref auth_conf) = configuration.basic_auth {
730 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
731 };
732
733 let req = req_builder.build()?;
734 let resp = configuration.client.execute(req).await?;
735
736 let status = resp.status();
737 let content_type = resp
738 .headers()
739 .get("content-type")
740 .and_then(|v| v.to_str().ok())
741 .unwrap_or("application/octet-stream");
742 let content_type = super::ContentType::from(content_type);
743
744 if !status.is_client_error() && !status.is_server_error() {
745 let content = resp.text().await?;
746 match content_type {
747 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
748 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::Accessory>`"))),
749 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `Vec<models::Accessory>`")))),
750 }
751 } else {
752 let content = resp.text().await?;
753 let entity: Option<ListAccessoriesError> = serde_json::from_str(&content).ok();
754 Err(Error::ResponseError(ResponseContent { status, content, entity }))
755 }
756}
757
758pub async fn list_artifacts(configuration: &configuration::Configuration, params: ListArtifactsParams) -> Result<Vec<models::Artifact>, Error<ListArtifactsError>> {
760
761 let uri_str = format!("{}/projects/{project_name}/repositories/{repository_name}/artifacts", configuration.base_path, project_name=crate::apis::urlencode(params.project_name), repository_name=crate::apis::urlencode(params.repository_name));
762 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
763
764 if let Some(ref param_value) = params.q {
765 req_builder = req_builder.query(&[("q", ¶m_value.to_string())]);
766 }
767 if let Some(ref param_value) = params.sort {
768 req_builder = req_builder.query(&[("sort", ¶m_value.to_string())]);
769 }
770 if let Some(ref param_value) = params.page {
771 req_builder = req_builder.query(&[("page", ¶m_value.to_string())]);
772 }
773 if let Some(ref param_value) = params.page_size {
774 req_builder = req_builder.query(&[("page_size", ¶m_value.to_string())]);
775 }
776 if let Some(ref param_value) = params.with_tag {
777 req_builder = req_builder.query(&[("with_tag", ¶m_value.to_string())]);
778 }
779 if let Some(ref param_value) = params.with_label {
780 req_builder = req_builder.query(&[("with_label", ¶m_value.to_string())]);
781 }
782 if let Some(ref param_value) = params.with_scan_overview {
783 req_builder = req_builder.query(&[("with_scan_overview", ¶m_value.to_string())]);
784 }
785 if let Some(ref param_value) = params.with_sbom_overview {
786 req_builder = req_builder.query(&[("with_sbom_overview", ¶m_value.to_string())]);
787 }
788 if let Some(ref param_value) = params.with_signature {
789 req_builder = req_builder.query(&[("with_signature", ¶m_value.to_string())]);
790 }
791 if let Some(ref param_value) = params.with_immutable_status {
792 req_builder = req_builder.query(&[("with_immutable_status", ¶m_value.to_string())]);
793 }
794 if let Some(ref param_value) = params.with_accessory {
795 req_builder = req_builder.query(&[("with_accessory", ¶m_value.to_string())]);
796 }
797 if let Some(ref user_agent) = configuration.user_agent {
798 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
799 }
800 if let Some(param_value) = params.x_request_id {
801 req_builder = req_builder.header("X-Request-Id", param_value.to_string());
802 }
803 if let Some(param_value) = params.x_accept_vulnerabilities {
804 req_builder = req_builder.header("X-Accept-Vulnerabilities", param_value.to_string());
805 }
806 if let Some(ref auth_conf) = configuration.basic_auth {
807 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
808 };
809
810 let req = req_builder.build()?;
811 let resp = configuration.client.execute(req).await?;
812
813 let status = resp.status();
814 let content_type = resp
815 .headers()
816 .get("content-type")
817 .and_then(|v| v.to_str().ok())
818 .unwrap_or("application/octet-stream");
819 let content_type = super::ContentType::from(content_type);
820
821 if !status.is_client_error() && !status.is_server_error() {
822 let content = resp.text().await?;
823 match content_type {
824 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
825 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::Artifact>`"))),
826 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `Vec<models::Artifact>`")))),
827 }
828 } else {
829 let content = resp.text().await?;
830 let entity: Option<ListArtifactsError> = serde_json::from_str(&content).ok();
831 Err(Error::ResponseError(ResponseContent { status, content, entity }))
832 }
833}
834
835pub async fn list_tags(configuration: &configuration::Configuration, params: ListTagsParams) -> Result<Vec<models::Tag>, Error<ListTagsError>> {
837
838 let uri_str = format!("{}/projects/{project_name}/repositories/{repository_name}/artifacts/{reference}/tags", configuration.base_path, project_name=crate::apis::urlencode(params.project_name), repository_name=crate::apis::urlencode(params.repository_name), reference=crate::apis::urlencode(params.reference));
839 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
840
841 if let Some(ref param_value) = params.q {
842 req_builder = req_builder.query(&[("q", ¶m_value.to_string())]);
843 }
844 if let Some(ref param_value) = params.sort {
845 req_builder = req_builder.query(&[("sort", ¶m_value.to_string())]);
846 }
847 if let Some(ref param_value) = params.page {
848 req_builder = req_builder.query(&[("page", ¶m_value.to_string())]);
849 }
850 if let Some(ref param_value) = params.page_size {
851 req_builder = req_builder.query(&[("page_size", ¶m_value.to_string())]);
852 }
853 if let Some(ref param_value) = params.with_signature {
854 req_builder = req_builder.query(&[("with_signature", ¶m_value.to_string())]);
855 }
856 if let Some(ref param_value) = params.with_immutable_status {
857 req_builder = req_builder.query(&[("with_immutable_status", ¶m_value.to_string())]);
858 }
859 if let Some(ref user_agent) = configuration.user_agent {
860 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
861 }
862 if let Some(param_value) = params.x_request_id {
863 req_builder = req_builder.header("X-Request-Id", param_value.to_string());
864 }
865 if let Some(ref auth_conf) = configuration.basic_auth {
866 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
867 };
868
869 let req = req_builder.build()?;
870 let resp = configuration.client.execute(req).await?;
871
872 let status = resp.status();
873 let content_type = resp
874 .headers()
875 .get("content-type")
876 .and_then(|v| v.to_str().ok())
877 .unwrap_or("application/octet-stream");
878 let content_type = super::ContentType::from(content_type);
879
880 if !status.is_client_error() && !status.is_server_error() {
881 let content = resp.text().await?;
882 match content_type {
883 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
884 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::Tag>`"))),
885 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `Vec<models::Tag>`")))),
886 }
887 } else {
888 let content = resp.text().await?;
889 let entity: Option<ListTagsError> = serde_json::from_str(&content).ok();
890 Err(Error::ResponseError(ResponseContent { status, content, entity }))
891 }
892}
893
894pub async fn remove_label(configuration: &configuration::Configuration, params: RemoveLabelParams) -> Result<(), Error<RemoveLabelError>> {
896
897 let uri_str = format!("{}/projects/{project_name}/repositories/{repository_name}/artifacts/{reference}/labels/{label_id}", configuration.base_path, project_name=crate::apis::urlencode(params.project_name), repository_name=crate::apis::urlencode(params.repository_name), reference=crate::apis::urlencode(params.reference), label_id=params.label_id);
898 let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str);
899
900 if let Some(ref user_agent) = configuration.user_agent {
901 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
902 }
903 if let Some(param_value) = params.x_request_id {
904 req_builder = req_builder.header("X-Request-Id", param_value.to_string());
905 }
906 if let Some(ref auth_conf) = configuration.basic_auth {
907 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
908 };
909
910 let req = req_builder.build()?;
911 let resp = configuration.client.execute(req).await?;
912
913 let status = resp.status();
914
915 if !status.is_client_error() && !status.is_server_error() {
916 Ok(())
917 } else {
918 let content = resp.text().await?;
919 let entity: Option<RemoveLabelError> = serde_json::from_str(&content).ok();
920 Err(Error::ResponseError(ResponseContent { status, content, entity }))
921 }
922}
923