Use Forgejo-compatible repository contents API
This commit is contained in:
@@ -6,7 +6,7 @@ use std::{
|
||||
use tokio::task::JoinSet;
|
||||
|
||||
use crate::{
|
||||
Client, Error, Result,
|
||||
Client, Error, Method, Result,
|
||||
domain::{DEFAULT_PAGE_SIZE, HistoryCommit, Page, RepositoryId},
|
||||
models, validate_page,
|
||||
};
|
||||
@@ -95,17 +95,17 @@ impl Client {
|
||||
.await
|
||||
.map_err(Error::generated)
|
||||
} else {
|
||||
apis::repository_api::repo_get_contents_ext(
|
||||
&configuration,
|
||||
&repository.owner,
|
||||
&repository.repository,
|
||||
path,
|
||||
None,
|
||||
None,
|
||||
)
|
||||
.await
|
||||
.map(|contents| contents.dir_contents.unwrap_or_default())
|
||||
.map_err(Error::generated)
|
||||
let endpoint = format!(
|
||||
"repos/{}/{}/contents/{}",
|
||||
apis::urlencode(&repository.owner),
|
||||
apis::urlencode(&repository.repository),
|
||||
apis::urlencode(path),
|
||||
);
|
||||
self.execute(self.request(Method::GET, &endpoint)?)
|
||||
.await?
|
||||
.json()
|
||||
.await
|
||||
.map_err(Into::into)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user