Skip to main content
Module

x/kd_clients/mod.ts>PullRequestClient

Various HTTP clients for miscellaneous use.
Go to Latest
class PullRequestClient
extends GitHubClient
import { PullRequestClient } from "https://deno.land/x/kd_clients@v1.0.0-preview.5/mod.ts";

Provides a client for interacting with pull requests.

Constructors

new
PullRequestClient(
ownerName: string,
repoName: string,
token?: string,
)

Initializes a new instance of the PullRequestClient class.

Properties

private
readonly
labelClient: LabelClient

Methods

private
openOrClosedPullRequestExists(prNumber: number, state: IssueOrPRState): Promise<boolean>

Checks if a pull request with the given prNumber exists with the given state in a repository with a name that matches the given PullRequestClient.repoName.

addLabel(prNumber: number, label: string): Promise<void>

Adds the given label to a pull request with a number that matches the given prNumber, in a repository with a name that matches the given PullRequestClient.repoName.

closedPullRequestExists(prNumber: number): Promise<boolean>

Returns a value indicating whether or not a closed pull request with the given prNumber exists in a repository that matches the given PullRequestClient.repoName.

createPullRequest(
title: string,
headBranch: string,
baseBranch: string,
description?,
maintainerCanModify?,
isDraft?,
): Promise<PullRequestModel>

Creates a new pull request in a repository with a name that matches the given PullRequestClient.repoName, using the given title, headBranch, baseBranch, and description.

getAllClosedPullRequests(): Promise<PullRequestModel[]>

Gets all of the closed pull requests for a repository with a name that matches the given PullRequestClient.repoName.

getAllOpenPullRequests(): Promise<PullRequestModel[]>

Gets all of the open pull requests for a repository with a name that matches the givenPullRequestClient.repoName.

getLabels(prNumber: number): Promise<string[]>

Gets all of the labels for a pull request with a number that matches the given prNumber, in a repository with a name that matches the given PullRequestClient.repoName.

getPullRequest(prNumber: number): Promise<PullRequestModel>

Gets a pull request with a number that matches the given prNumber in a repository with a name that matches the given PullRequestClient.repoName.

getPullRequests(
page?,
qtyPerPage?,
state?: IssueOrPRState,
mergeState?: MergeState,
labels?: string[] | null,
milestoneNumber?: number,
): Promise<[PullRequestModel[], Response]>

Gets a page of pull requests where the quantity for each page matches the given qtyPerPage, where the pull request has the given state and labels, for a repository with a name that matches the given PullRequestClient.repoName.

openPullRequestExists(prNumber: number): Promise<boolean>

Returns a value indicating whether or not an open pull request with the given prNumber exists in a repository that matches the given PullRequestClient.repoName.

pullRequestExists(prNumber: number): Promise<boolean>

Checks if a pull request with the given prNumber exists in a repository with a name that matches the given PullRequestClient.repoName.

requestReviewers(prNumber: number, reviewers: string | string[]): Promise<void>

Requests a review from a reviewer with a GitHub login name that matches the given reviewers, for a pull request that matches the given prNumber in a repository where the name matches the given PullRequestClient.repoName.

updatePullRequest(prNumber: number, prRequestData: IssueOrPRRequestData): Promise<void>

Updates a pull request with a number that matches the given prNumber, using the given prRequestData, in a repository with a name that matches the given PullRequestClient.repoName.