Updates for http-api verified commits change

Signed-off-by: Alexis Sellier <self@cloudhead.io>
This commit is contained in:
Alexis Sellier
2022-04-07 13:29:59 +02:00
parent 101d6d329f
commit efb91c7e73
5 changed files with 31 additions and 9 deletions
+20 -5
View File
@@ -274,11 +274,26 @@ export class Project implements ProjectInfo {
return api.get(`projects/${urn}/remotes`, {}, host);
}
static async getCommits(urn: string, host: api.Host, parent?: string, since?: string, until?: string, perPage?: string, page?: string): Promise<CommitsHistory> {
const params: Record<string, string | undefined> = { parent, since, until, "per-page": perPage, page };
// Removes the undefined params.
Object.keys(params).forEach(key => params[key] === undefined && delete params[key]);
static async getCommits(
urn: string,
host: api.Host,
opts?: {
parent?: string | null;
since?: string;
until?: string;
perPage?: number;
page?: number;
verified?: boolean;
}
): Promise<CommitsHistory> {
const params: Record<string, any> = {
"parent": opts?.parent,
"since": opts?.since,
"until": opts?.until,
"per-page": opts?.perPage,
"page": opts?.page,
"verified": opts?.verified
};
return api.get(`projects/${urn}/commits`, params, host);
}