From 507cb112f293ad7e6dca8d5fd5c590acc283e36b Mon Sep 17 00:00:00 2001 From: ivan katliarchuk Date: Sat, 1 Oct 2022 10:02:31 +0100 Subject: [PATCH] move code to @gitbeaker/node --- package.json | 1 + scripts/danger-dts.ts | 2 +- source/dsl/GitLabDSL.ts | 2 +- source/platforms/gitlab/GitLabAPI.ts | 7 ++++--- 4 files changed, 7 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index f379bee8f..ee1105dce 100644 --- a/package.json +++ b/package.json @@ -150,6 +150,7 @@ "debug": "^4.1.1", "fast-json-patch": "^3.0.0-1", "get-stdin": "^6.0.0", + "@gitbeaker/node": "21.3.0", "gitlab": "^10.0.1", "http-proxy-agent": "^2.1.0", "https-proxy-agent": "^2.2.1", diff --git a/scripts/danger-dts.ts b/scripts/danger-dts.ts index 8a4f4545e..7e8b1c497 100644 --- a/scripts/danger-dts.ts +++ b/scripts/danger-dts.ts @@ -9,7 +9,7 @@ const createDTS = () => { // import { Octokit as GitHub } from "@octokit/rest" -import { Gitlab } from "gitlab" +import { Gitlab } from "@gitbeaker/node" import { File } from "parse-diff" ` diff --git a/source/dsl/GitLabDSL.ts b/source/dsl/GitLabDSL.ts index 79e73196a..47c6f253c 100644 --- a/source/dsl/GitLabDSL.ts +++ b/source/dsl/GitLabDSL.ts @@ -1,7 +1,7 @@ // Please don't have includes in here that aren't inside the DSL folder, or the d.ts/flow defs break // TODO: extract out from BitBucket specifically, or create our own type -import { Gitlab } from "gitlab" +import { Gitlab } from "@gitbeaker/node" import { RepoMetaData } from "./BitBucketServerDSL" // getPlatformReviewDSLRepresentation diff --git a/source/platforms/gitlab/GitLabAPI.ts b/source/platforms/gitlab/GitLabAPI.ts index 95b30cd38..32ff5b27d 100644 --- a/source/platforms/gitlab/GitLabAPI.ts +++ b/source/platforms/gitlab/GitLabAPI.ts @@ -14,7 +14,7 @@ import { GitLabApproval, } from "../../dsl/GitLabDSL" -import { Gitlab } from "gitlab" +import { Gitlab } from "@gitbeaker/node" import { Env } from "../../ci_source/ci_source" import { debug } from "../../debug" @@ -107,7 +107,7 @@ class GitLabAPI { getMergeRequestApprovals = async (): Promise => { this.d(`getMergeRequestApprovals for repo: ${this.repoMetadata.repoSlug} pr: ${this.repoMetadata.pullRequestID}`) const approvals = (await this.api.MergeRequests.approvals(this.repoMetadata.repoSlug, { - mergerequestIId: Number(this.repoMetadata.pullRequestID), + mergerequestIid: Number(this.repoMetadata.pullRequestID), })) as GitLabApproval this.d("getMergeRequestApprovals", approvals) return approvals @@ -137,7 +137,8 @@ class GitLabAPI { getMergeRequestNotes = async (): Promise => { this.d("getMergeRequestNotes", this.repoMetadata.repoSlug, this.repoMetadata.pullRequestID) const api = this.api.MergeRequestNotes - const notes = (await api.all(this.repoMetadata.repoSlug, this.repoMetadata.pullRequestID)) as GitLabNote[] + // TODO: add pagination + const notes = (await api.all(this.repoMetadata.repoSlug, this.repoMetadata.pullRequestID, {})) as GitLabNote[] this.d("getMergeRequestNotes", notes) return notes }