repository-provider
Version:
abstract interface to git repository providers like github, bitbucket and gitlab
142 lines (140 loc) • 4.22 kB
text/typescript
/**
* Abstract pull request.
* {@link Repository#addPullRequest}
* @param {Branch} source merge source
* @param {Branch} owner merge target
* @param {string} name
* @param {Object} [options]
* @param {string} [options.title]
* @param {string} [options.state]
* @param {boolean} [options.merged]
* @param {boolean} [options.locked]
* @property {string} name
* @property {Branch} source
* @property {Branch} destination
* @property {string} [title]
* @property {string} [state]
* @property {boolean} [merged]
* @property {boolean} [locked]
* @property {string} url
*/
export class PullRequest extends OwnedObject {
/**
* States to list pull request by default
* @return {Set<string>} states to list by default
*/
static defaultListStates: Set<string>;
/**
* possible states
* @enum {string}
*/
static states: Set<string>;
/**
* All valid merge methods
* @return {Set<string>} valid merge methods.
* @enum {string}
*/
static validMergeMethods: Set<any>;
/**
* List all pull request for a given repo.
* Result will be filtered by source branch, destination branch and states
* @param {Repository} repository
* @param {Object} [filter]
* @param {Branch?} [filter.source]
* @param {Branch?} [filter.destination]
* @param {Set<string>} [filter.states]
* @return {AsyncIterable<PullRequest>}
*/
static list(repository: Repository, filter?: {
source?: Branch | null;
destination?: Branch | null;
states?: Set<string>;
}): AsyncIterable<PullRequest>;
/**
* Open a pull request
*
* @param {Branch} source
* @param {Branch} destination
* @param {Object} [options]
*/
static open(source: Branch, destination: Branch, options?: any): Promise<PullRequest>;
static get attributes(): {
body: import("pacc").AttributeDefinition;
title: import("pacc").AttributeDefinition;
url: import("pacc").AttributeDefinition;
/**
* state of the pull request.
* - OPEN
* - MERGED
* - CLOSED
* @return {string}
*/
state: {
default: string;
values: Set<string>;
type: string;
isKey: boolean;
writable: boolean;
mandatory: boolean;
private?: boolean;
depends?: string;
additionalAttributes: string[];
description?: string;
set?: Function;
get?: Function;
env?: string[] | string;
};
/**
* Locked state of the pull request.
* @return {boolean}
*/
locked: import("pacc").AttributeDefinition;
/**
* Merged state of the pull request.
* @return {boolean}
*/
merged: import("pacc").AttributeDefinition;
/**
* Draft state of the pull request.
* @return {boolean}
*/
draft: import("pacc").AttributeDefinition;
dry: import("pacc").AttributeDefinition;
empty: import("pacc").AttributeDefinition;
id: import("pacc").AttributeDefinition;
name: import("pacc").AttributeDefinition;
description: import("pacc").AttributeDefinition;
};
/** @type {Branch} */ source: Branch;
get destination(): any;
get number(): string;
get dry(): boolean;
/**
* @return {Repository} destination repository
*/
get repository(): Repository;
/**
* Delete the pull request from the {@link Repository}.
* @see {@link Repository#deletePullRequest}
* @return {Promise}
*/
delete(): Promise<any>;
/**
* Merge the pull request.
* @param {string} method
*/
merge(method?: string): Promise<void>;
merged: boolean;
/**
* Decline the pull request.
*/
decline(): Promise<void>;
/**
* @return {AsyncIterable<Review>}
*/
reviews(): AsyncIterable<Review>;
}
import { OwnedObject } from "./owned-object.mjs";
import { Branch } from "./branch.mjs";
import { Repository } from "./repository.mjs";
import { Review } from "./review.mjs";