Module

x/kd_clients/mod.ts>PullRequestClient

Various HTTP clients for miscellaneous use.
Go to Latest
class PullRequestClient
extends GitHubClient
import { PullRequestClient } from "https://dotland.deno.dev/x/kd_clients@v1.0.0-preview.9/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 {@link prNumber} exists with the given {@link state} in a repository with a name that matches the given PullRequestClient.{@link repoName}.

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

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

closedPullRequestExists(prNumber: number): Promise<boolean>

Returns a value indicating whether or not a closed pull request with the given {@link prNumber} exists in a repository that matches the given PullRequestClient.{@link 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.{@link repoName}, using the given {@link title}, {@link headBranch}, {@link baseBranch}, and {@link description}.

getAllClosedPullRequests(): Promise<PullRequestModel[]>

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

getAllOpenPullRequests(): Promise<PullRequestModel[]>

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

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

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

getPullRequest(prNumber: number): Promise<PullRequestModel>

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

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

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

openPullRequestExists(prNumber: number): Promise<boolean>

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

pullRequestExists(prNumber: number): Promise<boolean>

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

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

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

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

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