1
0
Fork 0

even more strongly typed returns

This commit is contained in:
Cyborus 2024-02-09 22:39:32 -05:00
parent 8cf3213267
commit 3f1458e1be
No known key found for this signature in database
4 changed files with 177 additions and 61 deletions

View file

@ -1162,7 +1162,7 @@ impl crate::Forgejo {
&self,
org: &str,
query: TeamSearchQuery,
) -> Result<serde_json::Map<String, serde_json::Value>, ForgejoError> {
) -> Result<TeamSearchResponse, ForgejoError> {
let request = self
.get(&format!("orgs/{org}/teams/search?{query}"))
.build()?;
@ -4117,7 +4117,7 @@ impl crate::Forgejo {
&self,
owner: &str,
repo: &str,
) -> Result<serde_json::Map<String, serde_json::Value>, ForgejoError> {
) -> Result<RepoGetLanguagesResponse, ForgejoError> {
let request = self
.get(&format!("repos/{owner}/{repo}/languages"))
.build()?;
@ -6918,7 +6918,7 @@ impl crate::Forgejo {
pub async fn user_search(
&self,
query: UserSearchQuery,
) -> Result<serde_json::Map<String, serde_json::Value>, ForgejoError> {
) -> Result<UserSearchResponse, ForgejoError> {
let request = self.get(&format!("users/search?{query}")).build()?;
let response = self.execute(request).await?;
match response.status().as_u16() {
@ -10392,6 +10392,11 @@ pub mod structs {
})
}
}
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
pub struct LanguageStatisticsResponse {
#[serde(flatten)]
pub additional: std::collections::BTreeMap<String, u64>,
}
pub struct ErrorHeaders {
pub message: Option<String>,
@ -11119,6 +11124,11 @@ pub mod structs {
Ok(())
}
}
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
pub struct TeamSearchResponse {
pub data: Option<Vec<Team>>,
pub ok: Option<bool>,
}
pub struct ListPackagesQuery {
/// page number of results to return (1-based)
@ -12363,6 +12373,11 @@ pub mod structs {
Ok(())
}
}
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
pub struct RepoGetLanguagesResponse {
#[serde(flatten)]
pub additional: std::collections::BTreeMap<String, u64>,
}
pub struct RepoGetRawFileOrLfsQuery {
/// The name of the commit/branch/tag. Default the repositorys default branch (usually master)
@ -13622,6 +13637,11 @@ pub mod structs {
Ok(())
}
}
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
pub struct UserSearchResponse {
pub data: Option<Vec<User>>,
pub ok: Option<bool>,
}
pub struct UserListActivityFeedsQuery {
/// if true, only show actions performed by the requested user