|
1 | 1 | use crate::Config; |
2 | 2 | use anyhow::anyhow; |
3 | 3 | use reqwest::{header, multipart, StatusCode}; |
4 | | -use spa_server::admin_server::request::{ |
5 | | - DeleteDomainVersionOption, DomainWithOptVersionOption, GetDomainOption, |
6 | | - UpdateUploadingStatusOption, |
7 | | -}; |
8 | | -use spa_server::domain_storage::{DomainInfo, ShortMetaData, UploadDomainPosition}; |
| 4 | +use spa_server::admin_server::request::{DeleteDomainVersionOption, DomainWithOptVersionOption, DomainWithVersionOption, GetDomainOption, UpdateUploadingStatusOption}; |
| 5 | +use spa_server::domain_storage::{CertInfo, DomainInfo, ShortMetaData, UploadDomainPosition}; |
9 | 6 | use std::borrow::Cow; |
10 | 7 | use std::path::PathBuf; |
11 | 8 |
|
@@ -129,6 +126,19 @@ impl API { |
129 | 126 | handle!(resp) |
130 | 127 | } |
131 | 128 |
|
| 129 | + pub async fn revoke_version(&self, domain:String, version:u32) -> anyhow::Result<()> { |
| 130 | + let resp = self |
| 131 | + .async_client |
| 132 | + .post(self.url("files/revoke_version")) |
| 133 | + .json(&DomainWithVersionOption { |
| 134 | + domain, |
| 135 | + version, |
| 136 | + }) |
| 137 | + .send() |
| 138 | + .await?; |
| 139 | + handle!(resp) |
| 140 | + } |
| 141 | + |
132 | 142 | //TODO: use thiserror instead of anyhow |
133 | 143 | pub async fn upload_file<T: Into<Cow<'static, str>>>( |
134 | 144 | &self, |
@@ -185,6 +195,12 @@ impl API { |
185 | 195 | .await?; |
186 | 196 | json_resp!(resp, UploadDomainPosition) |
187 | 197 | } |
| 198 | + |
| 199 | + pub async fn get_acme_cert_info(&self, domain: Option<String>) -> anyhow::Result<Vec<CertInfo>> { |
| 200 | + let resp = self.async_client.get(self.url("cert/acme")) |
| 201 | + .query(&GetDomainOption{domain}).send().await?; |
| 202 | + json_resp!(resp, Vec<CertInfo>) |
| 203 | + } |
188 | 204 | } |
189 | 205 | #[cfg(test)] |
190 | 206 | mod test { |
|
0 commit comments