Skip to content

Commit

Permalink
feat: Add Group.projects (#494)
Browse files Browse the repository at this point in the history
This commit also introduces a minimal typed response as a first step
towards #384.
  • Loading branch information
Granjow authored and jdalrymple committed Nov 20, 2019
1 parent 24cc494 commit 9def4e7
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/core/services/Groups.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import {
RequestHelper,
Sudo,
} from '../infrastructure';
import { ProjectSchema } from './Projects';

export class Groups extends BaseService {
all(options?: PaginatedRequestOptions) {
Expand Down Expand Up @@ -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);

Expand Down
23 changes: 23 additions & 0 deletions src/core/services/Projects.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 9def4e7

Please sign in to comment.