feat: add method to get subgroups

This commit is contained in:
Karl-Philipp Wulfert
2019-01-28 16:14:14 +01:00
parent 4f1ab517c6
commit 1854f38190
2 changed files with 42 additions and 1 deletions

View File

@@ -14,7 +14,19 @@
*/ */
import {Logger} from '@openstapps/logger'; import {Logger} from '@openstapps/logger';
import * as request from 'request-promise-native'; import * as request from 'request-promise-native';
import {AccessLevel, Branch, Issue, Label, Member, MergeRequest, Milestone, Project, Tag, TreeFile} from './types'; import {
AccessLevel,
Branch,
Group,
Issue,
Label,
Member,
MergeRequest,
Milestone,
Project,
Tag,
TreeFile
} from './types';
export const logger = new Logger(); export const logger = new Logger();
@@ -375,6 +387,15 @@ export class Api {
return this.makeGitLabAPIRequest('groups/' + groupId + '/projects'); return this.makeGitLabAPIRequest('groups/' + groupId + '/projects');
} }
/**
* Get sub groups of a group
*
* @param groupId Group ID to get subgroups for
*/
public getSubGroupsForGroup(groupId: number): Promise<Group[]> {
return this.makeGitLabAPIRequest(`/groups/${groupId}/subgroups`);
}
/** /**
* Get tags of a project * Get tags of a project
* *

View File

@@ -239,3 +239,23 @@ export interface ThingWithTimeStats {
total_time_spent: number; total_time_spent: number;
}; };
} }
/**
* A GitLab group
*/
export interface Group {
id: number;
web_url: string;
name: string;
path: string;
description: string;
visibility: string;
lfs_enabled: boolean;
avatar_url: string;
request_access_enabled: boolean;
full_name: string;
full_path: string;
parent_id: number;
ldap_cn: string;
ldap_access: string;
}