34 lines
1.2 KiB
Rust
34 lines
1.2 KiB
Rust
use crate::{ApiResponse, error::ApiError};
|
|
use actix_web::{HttpResponse, Result, web};
|
|
use service::AppService;
|
|
use service::git::contributors::{ContributorsQuery, ContributorsResponse};
|
|
use session::Session;
|
|
|
|
#[utoipa::path(
|
|
get,
|
|
path = "/api/repos/{namespace}/{repo}/git/contributors",
|
|
params(
|
|
("namespace" = String, Path, description = "Repository namespace"),
|
|
("repo" = String, Path, description = "Repository name"),
|
|
),
|
|
responses(
|
|
(status = 200, description = "List of contributors", body = ApiResponse<ContributorsResponse>),
|
|
(status = 401, description = "Unauthorized", body = ApiResponse<crate::error::ApiError>),
|
|
(status = 404, description = "Not found", body = ApiResponse<crate::error::ApiError>),
|
|
),
|
|
tag = "Git"
|
|
|
|
)]
|
|
pub async fn git_contributors(
|
|
service: web::Data<AppService>,
|
|
session: Session,
|
|
path: web::Path<(String, String)>,
|
|
query: web::Query<ContributorsQuery>,
|
|
) -> Result<HttpResponse, ApiError> {
|
|
let (namespace, repo_name) = path.into_inner();
|
|
let resp = service
|
|
.git_contributors(namespace, repo_name, query.into_inner(), &session)
|
|
.await?;
|
|
Ok(ApiResponse::ok(resp).to_response())
|
|
}
|