repository-provider
Version:
abstract interface to git repository providers like github, bitbucket and gitlab
76 lines (75 loc) • 2.9 kB
text/typescript
/**
* Abstract branch.
* @class Branch
* @see {@link Repository#_addBranch}
* @param {RepositoryOwner} owner
* @param {string} name
* @param {Object} options
*
* @property {Repository} repository
* @property {Provider} provider
* @property {string} name
*/
export class Branch extends Ref {
constructor(owner: any, name: any, options: any);
/**
* Delete the branch from the {@link Repository}.
* @see {@link Repository#deleteBranch}
* @return {Promise<any>}
*/
delete(): Promise<any>;
/**
* Commit entries.
* @param {string} message commit message
* @param {ContentEntry[]} updates content to be commited
* @param {Object} options
* @return {Promise<CommitResult|undefined>}
*/
commit(message: string, updates: ContentEntry[], options: any): Promise<CommitResult | undefined>;
/**
* Add commits into a pull request.
*
* @param {Commit|AsyncGenerator<Commit>} commits to be commited
* @param {Object} options
* @param {Branch|string} options.pullRequestBranch to commit into
* @param {boolean} [options.dry=false] do not create a branch and do not commit only create dummy PR
* @param {boolean} options.skipWithoutCommits do not create a PR if no commits are given
* @param {boolean} options.bodyFromCommitMessages generate body from commit messages
* @param {string} [options.body] body of the PR
* @return {Promise<PullRequest>}
*/
commitIntoPullRequest(commits: Commit | AsyncGenerator<Commit>, options: {
pullRequestBranch: Branch | string;
dry?: boolean;
skipWithoutCommits: boolean;
bodyFromCommitMessages: boolean;
body?: string;
}): Promise<PullRequest>;
/**
* Remove entries form the branch.
* @param {AsyncIterable<ContentEntry>} entries
*/
removeEntries(entries: AsyncIterable<ContentEntry>): Promise<void>;
/**
* Create a pull request.
* @param {Branch} toBranch
* @param {Object} [options]
* @return {Promise<PullRequest>}
*/
createPullRequest(toBranch: Branch, options?: any): Promise<PullRequest>;
_addPullRequest(pullRequest: any): Promise<void>;
deletePullRequest(name: any): Promise<any>;
/**
* Create a new {@link Branch} by cloning a given source branch.
* Simply calls Repository.createBranch() with the receiver as source branch
* @param {string} name the new branch
* @param {Object} [options] passed through
* @return {Promise<Branch>} newly created branch (or already present old one with the same name)
*/
createBranch(name: string, options?: any): Promise<Branch>;
}
import { Ref } from "./ref.mjs";
import { ContentEntry } from "content-entry";
import { CommitResult } from "./commit.mjs";
import { Commit } from "./commit.mjs";
import { PullRequest } from "./pull-request.mjs";