mirror of
https://github.com/gitbucket/gitbucket.git
synced 2026-02-10 16:47:01 +01:00
Add list-public-repositories API (#2529)
This commit is contained in:
@@ -54,11 +54,15 @@ trait ApiRepositoryControllerBase extends ControllerBase {
|
||||
})
|
||||
}
|
||||
|
||||
/*
|
||||
/**
|
||||
* iv. List all public repositories
|
||||
* https://developer.github.com/v3/repos/#list-all-public-repositories
|
||||
* Not implemented
|
||||
* https://developer.github.com/v3/repos/#list-public-repositories
|
||||
*/
|
||||
get("/api/v3/repositories") {
|
||||
JsonFormat(getPublicRepositories().map { r =>
|
||||
ApiRepository(r, getAccountByUserName(r.owner).get)
|
||||
})
|
||||
}
|
||||
|
||||
/*
|
||||
* v. Create
|
||||
|
||||
@@ -380,6 +380,21 @@ trait RepositoryService {
|
||||
.list
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the all public repositories.
|
||||
*
|
||||
* @return the repository information list
|
||||
*/
|
||||
def getPublicRepositories(withoutPhysicalInfo: Boolean = false)(implicit s: Session): List[RepositoryInfo] = {
|
||||
Repositories
|
||||
.filter { t1 =>
|
||||
t1.isPrivate === false.bind
|
||||
}
|
||||
.sortBy(_.lastActivityDate desc)
|
||||
.list
|
||||
.map(createRepositoryInfo(_, withoutPhysicalInfo))
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the list of repositories which are owned by the specified user.
|
||||
* This list includes group repositories if the specified user is a member of the group.
|
||||
|
||||
Reference in New Issue
Block a user