Skip to content
Snippets Groups Projects
Commit b062a067 authored by michael.minelli's avatar michael.minelli
Browse files

GitlabManager => Add get repo function

parent 8841a7dc
No related branches found
No related tags found
No related merge requests found
......@@ -3,7 +3,7 @@ import LocalConfigKeys from '../types/LocalConfigKeys';
import axios from 'axios';
import Config from '../config/Config';
import ora from 'ora';
import GitlabUser from '../models/GitlabUser';
import GitlabUser from '../shared/types/Gitlab/GitlabUser';
class GitlabManager {
......@@ -133,10 +133,10 @@ class GitlabManager {
}
const params: any = {};
params[paramName] = param;
const user = await axios.get(`${ Config.gitlab.apiURL }/users`, { params: params });
const user = await axios.get<Array<GitlabUser>>(`${ Config.gitlab.apiURL }/users`, { params: params });
if ( user.data[0] ) {
const gitlabUser = GitlabUser.createFromJson(user.data[0]);
const gitlabUser = user.data[0];
if ( verbose ) {
spinner.succeed(`${ gitlabUser.username } (${ gitlabUser.id })`);
......@@ -160,6 +160,10 @@ class GitlabManager {
public async getUsersByUsername(usernames: Array<string>, verbose: boolean = false, verboseIndent: number = 0): Promise<Array<GitlabUser | undefined>> {
return await this.getGitlabUser(usernames, 'search', verbose, verboseIndent);
}
public async getRepository(repoId: number): Promise<any> {
return await axios.get(`${ Config.gitlab.apiURL }/projects/${ repoId }`);
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment