even more strongly typed returns
This commit is contained in:
parent
8cf3213267
commit
3f1458e1be
4 changed files with 177 additions and 61 deletions
|
@ -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 repository’s 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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue