gitea_sdk/api/users/get.rs
1use crate::error::Result;
2use crate::model::user::User;
3
4pub struct GetUserBuilder {
5 username: String,
6}
7
8impl GetUserBuilder {
9 pub fn new(username: impl ToString) -> Self {
10 Self {
11 username: username.to_string(),
12 }
13 }
14 pub async fn send(&self, client: &crate::Client) -> Result<User> {
15 let req = client.get(format!("users/{}", self.username)).build()?;
16 let res = client.make_request(req).await?;
17 client.parse_response(res).await
18 }
19}