From 1854f38190bd6d146b55c127a2294187653beb02 Mon Sep 17 00:00:00 2001 From: Karl-Philipp Wulfert Date: Mon, 28 Jan 2019 16:14:14 +0100 Subject: [PATCH] feat: add method to get subgroups --- src/api.ts | 23 ++++++++++++++++++++++- src/types.ts | 20 ++++++++++++++++++++ 2 files changed, 42 insertions(+), 1 deletion(-) diff --git a/src/api.ts b/src/api.ts index 55e8b41e..f2b4f7f3 100644 --- a/src/api.ts +++ b/src/api.ts @@ -14,7 +14,19 @@ */ import {Logger} from '@openstapps/logger'; 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(); @@ -375,6 +387,15 @@ export class Api { 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 { + return this.makeGitLabAPIRequest(`/groups/${groupId}/subgroups`); + } + /** * Get tags of a project * diff --git a/src/types.ts b/src/types.ts index 484d4e12..1e55b244 100644 --- a/src/types.ts +++ b/src/types.ts @@ -239,3 +239,23 @@ export interface ThingWithTimeStats { 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; +}