@atomist/cortex
Version:
Atomist Cortex model TypeScript typings
293 lines (265 loc) • 8.32 kB
text/typescript
/*
* Copyright 2015-2017 Atomist Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import * as repoApi from "../Repo";
import { Branch } from "./Branch";
import { ChannelLink } from "./ChannelLink";
import { ChatChannel } from "./ChatChannel";
import { Issue } from "./Issue";
import { Label } from "./Label";
import { Org } from "./Org";
import { PullRequest } from "./PullRequest";
export { Repo };
/**
* Type Repo
* Generated class exposing Atomist Cortex.
* Fluent builder style class for use in testing and query by example.
*/
class Repo implements repoApi.Repo {
private _branches: Branch[];
private _channels: ChatChannel[];
private _defaultBranch: string;
private _issue: Issue[];
private _labels: Label[];
private _links: ChannelLink[];
private _name: string;
private _org: Org;
private _owner: string;
private _pullRequest: PullRequest[];
private _nodeName = "Repo";
private _nodeTags = [ "Repo", "-dynamic" ];
/**
* Implementation of GraphNode interface method.
* For infrastructure, not user use
*/
public nodeName(): string {
return this._nodeName;
}
/**
* Implementation of GraphNode interface method.
* For infrastructure, not user use
*/
public nodeTags(): string[] {
return this._nodeTags;
}
/**
* branches - Repo -> Branch
*
* @property {Branch[]} branches
*/
get branches(): Branch[] {
if (this._branches === undefined) {
throw new Error(`Please use the relevant builder method to set property [branches] on stub ` +
`[Repo] before accessing it. It's probably called [withBranches]`);
}
return this._branches;
}
/**
* Fluent builder method to add an element to the branches array
*/
public addBranches(...branches_: Branch[]) {
if (this._branches === undefined) {
this._branches = [];
}
this._branches = this._branches.concat(branches_);
return this;
}
/**
* channels - Repo -> ChatChannel
*
* @property {ChatChannel[]} channels
*/
get channels(): ChatChannel[] {
if (this._channels === undefined) {
throw new Error(`Please use the relevant builder method to set property [channels] on stub ` +
`[Repo] before accessing it. It's probably called [withChannels]`);
}
return this._channels;
}
/**
* Fluent builder method to add an element to the channels array
*/
public addChannels(...channels_: ChatChannel[]) {
if (this._channels === undefined) {
this._channels = [];
}
this._channels = this._channels.concat(channels_);
return this;
}
/**
* defaultBranch
*
* @property {string} defaultBranch
*/
get defaultBranch(): string {
if (this._defaultBranch === undefined) {
throw new Error(`Please use the relevant builder method to set property [defaultBranch] on stub ` +
`[Repo] before accessing it. It's probably called [withDefaultBranch]`);
}
return this._defaultBranch;
}
/**
* Fluent builder method to set the defaultBranch property
*/
public withDefaultBranch(defaultBranch_: string) {
this._defaultBranch = defaultBranch_;
return this;
}
/**
* issue - Repo -> Issue
*
* @property {Issue[]} issue
*/
get issue(): Issue[] {
if (this._issue === undefined) {
throw new Error(`Please use the relevant builder method to set property [issue] on stub ` +
`[Repo] before accessing it. It's probably called [withIssue]`);
}
return this._issue;
}
/**
* Fluent builder method to add an element to the issue array
*/
public addIssue(...issue_: Issue[]) {
if (this._issue === undefined) {
this._issue = [];
}
this._issue = this._issue.concat(issue_);
return this;
}
/**
* labels - Repo -> Label
*
* @property {Label[]} labels
*/
get labels(): Label[] {
if (this._labels === undefined) {
throw new Error(`Please use the relevant builder method to set property [labels] on stub ` +
`[Repo] before accessing it. It's probably called [withLabels]`);
}
return this._labels;
}
/**
* Fluent builder method to add an element to the labels array
*/
public addLabels(...labels_: Label[]) {
if (this._labels === undefined) {
this._labels = [];
}
this._labels = this._labels.concat(labels_);
return this;
}
/**
* links - Repo -> ChannelLink
*
* @property {ChannelLink[]} links
*/
get links(): ChannelLink[] {
if (this._links === undefined) {
throw new Error(`Please use the relevant builder method to set property [links] on stub ` +
`[Repo] before accessing it. It's probably called [withLinks]`);
}
return this._links;
}
/**
* Fluent builder method to add an element to the links array
*/
public addLinks(...links_: ChannelLink[]) {
if (this._links === undefined) {
this._links = [];
}
this._links = this._links.concat(links_);
return this;
}
/**
* name
*
* @property {string} name
*/
get name(): string {
if (this._name === undefined) {
throw new Error(`Please use the relevant builder method to set property [name] on stub ` +
`[Repo] before accessing it. It's probably called [withName]`);
}
return this._name;
}
/**
* Fluent builder method to set the name property
*/
public withName(name_: string) {
this._name = name_;
return this;
}
/**
* org - Repo -> Org
*
* @property {Org} org
*/
get org(): Org {
if (this._org === undefined) {
throw new Error(`Please use the relevant builder method to set property [org] on stub ` +
`[Repo] before accessing it. It's probably called [withOrg]`);
}
return this._org;
}
/**
* Fluent builder method to set the org property
*/
public withOrg(org_: Org) {
this._org = org_;
return this;
}
/**
* owner
*
* @property {string} owner
*/
get owner(): string {
if (this._owner === undefined) {
throw new Error(`Please use the relevant builder method to set property [owner] on stub ` +
`[Repo] before accessing it. It's probably called [withOwner]`);
}
return this._owner;
}
/**
* Fluent builder method to set the owner property
*/
public withOwner(owner_: string) {
this._owner = owner_;
return this;
}
/**
* pullRequest - Repo -> PullRequest
*
* @property {PullRequest[]} pullRequest
*/
get pullRequest(): PullRequest[] {
if (this._pullRequest === undefined) {
throw new Error(`Please use the relevant builder method to set property [pullRequest] on stub ` +
`[Repo] before accessing it. It's probably called [withPullRequest]`);
}
return this._pullRequest;
}
/**
* Fluent builder method to add an element to the pullRequest array
*/
public addPullRequest(...pullRequest_: PullRequest[]) {
if (this._pullRequest === undefined) {
this._pullRequest = [];
}
this._pullRequest = this._pullRequest.concat(pullRequest_);
return this;
}
}