feat: Add Group.projects (#494)

This commit also introduces a minimal typed response as a first step
towards #384.
This commit is contained in:
Simon A. Eugster 2019-11-20 15:53:46 +01:00 committed by Justin Dalrymple
parent 24cc494f63
commit 9def4e7f8e
2 changed files with 30 additions and 0 deletions

View File

@ -5,6 +5,7 @@ import {
RequestHelper,
Sudo,
} from '../infrastructure';
import { ProjectSchema } from './Projects';
export class Groups extends BaseService {
all(options?: PaginatedRequestOptions) {
@ -32,6 +33,12 @@ export class Groups extends BaseService {
return RequestHelper.put(this, `groups/${gId}`, options);
}
projects(groupId: string | number, options?: BaseRequestOptions): Promise<ProjectSchema[]> {
const gId = encodeURIComponent(groupId);
return RequestHelper.get(this, `groups/${gId}/projects`, options) as Promise<ProjectSchema[]>;
}
remove(groupId: string | number, options?: Sudo) {
const gId = encodeURIComponent(groupId);

View File

@ -9,6 +9,29 @@ import {
import { EventOptions } from './Events';
import { UploadMetadata } from './ProjectImportExport';
export interface NamespaceInfoSchema {
id: number;
name: string;
path: string;
kind: string;
full_path: string;
}
export interface ProjectSchema {
id: number;
name: string;
name_with_namespace: string;
path: string;
path_with_namespace: string;
namespace: NamespaceInfoSchema;
ssh_url_to_repo: string;
http_url_to_repo: string;
archived: boolean;
}
export class Projects extends BaseService {
all(options?: PaginatedRequestOptions) {
return RequestHelper.get(this, 'projects', options);