fix(core): update
This commit is contained in:
@ -46,12 +46,16 @@ export class GitlabAccount {
|
||||
for (const link of links) {
|
||||
linkObjects.push({
|
||||
original: link,
|
||||
link: findLinkName(link)
|
||||
link: findLinkName(link),
|
||||
});
|
||||
}
|
||||
const next = linkObjects.find(linkObject => linkObject.original.includes('rel="next"'));
|
||||
const next = linkObjects.find((linkObject) => linkObject.original.includes('rel="next"'));
|
||||
if (next && response.body instanceof Array) {
|
||||
const nextResponse = await this.request(methodArg, next.link.replace('https://gitlab.com/api/v4', ''), {});
|
||||
const nextResponse = await this.request(
|
||||
methodArg,
|
||||
next.link.replace('https://gitlab.com/api/v4', ''),
|
||||
{}
|
||||
);
|
||||
response.body = response.body.concat(nextResponse);
|
||||
}
|
||||
}
|
||||
|
@ -111,7 +111,7 @@ export class GitlabProject {
|
||||
per_page: '100',
|
||||
}
|
||||
);
|
||||
const allProjects: GitlabProject[] = []
|
||||
const allProjects: GitlabProject[] = [];
|
||||
for (const projectData of response) {
|
||||
allProjects.push(new GitlabProject(projectData, gitlabGroupArg));
|
||||
}
|
||||
@ -127,11 +127,21 @@ export class GitlabProject {
|
||||
this.gitlabGroupRef = gitlabGroupRefArg;
|
||||
}
|
||||
|
||||
public async getFileFromProject(filePathArg: string, refArg: string): Promise<plugins.smartfile.Smartfile> {
|
||||
const response = await this.gitlabGroupRef.gitlabAccountRef.request('GET', `/projects/${this.data.id}/repository/files/${filePathArg}`, {
|
||||
ref: refArg
|
||||
});
|
||||
return plugins.smartfile.Smartfile.fromBuffer(filePathArg, Buffer.from(response.content, response.encoding));
|
||||
public async getFileFromProject(
|
||||
filePathArg: string,
|
||||
refArg: string
|
||||
): Promise<plugins.smartfile.Smartfile> {
|
||||
const response = await this.gitlabGroupRef.gitlabAccountRef.request(
|
||||
'GET',
|
||||
`/projects/${this.data.id}/repository/files/${filePathArg}`,
|
||||
{
|
||||
ref: refArg,
|
||||
}
|
||||
);
|
||||
return plugins.smartfile.Smartfile.fromBuffer(
|
||||
filePathArg,
|
||||
Buffer.from(response.content, response.encoding)
|
||||
);
|
||||
}
|
||||
|
||||
public async getReadmeAsMarkdown(refArg: string = 'master'): Promise<string> {
|
||||
|
Reference in New Issue
Block a user