@atomist/cortex
Version:
Atomist Cortex model TypeScript typings
211 lines (189 loc) • 5.73 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 pushApi from "../Push";
import { Build } from "./Build";
import { Commit } from "./Commit";
import { Repo } from "./Repo";
export { Push };
/**
* Type Push
* Generated class exposing Atomist Cortex.
* Fluent builder style class for use in testing and query by example.
*/
class Push implements pushApi.Push {
private _after: Commit;
private _before: Commit;
private _branch: string;
private _builds: Build[];
private _commits: Commit[];
private _repo: Repo;
private _timestamp: string;
private _nodeName = "Push";
private _nodeTags = [ "Push", "-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;
}
/**
* after - Push -> Commit
*
* @property {Commit} after
*/
get after(): Commit {
if (this._after === undefined) {
throw new Error(`Please use the relevant builder method to set property [after] on stub ` +
`[Push] before accessing it. It's probably called [withAfter]`);
}
return this._after;
}
/**
* Fluent builder method to set the after property
*/
public withAfter(after_: Commit) {
this._after = after_;
return this;
}
/**
* before - Push -> Commit
*
* @property {Commit} before
*/
get before(): Commit {
if (this._before === undefined) {
throw new Error(`Please use the relevant builder method to set property [before] on stub ` +
`[Push] before accessing it. It's probably called [withBefore]`);
}
return this._before;
}
/**
* Fluent builder method to set the before property
*/
public withBefore(before_: Commit) {
this._before = before_;
return this;
}
/**
* branch
*
* @property {string} branch
*/
get branch(): string {
if (this._branch === undefined) {
throw new Error(`Please use the relevant builder method to set property [branch] on stub ` +
`[Push] before accessing it. It's probably called [withBranch]`);
}
return this._branch;
}
/**
* Fluent builder method to set the branch property
*/
public withBranch(branch_: string) {
this._branch = branch_;
return this;
}
/**
* builds - Push -> Build
*
* @property {Build[]} builds
*/
get builds(): Build[] {
if (this._builds === undefined) {
throw new Error(`Please use the relevant builder method to set property [builds] on stub ` +
`[Push] before accessing it. It's probably called [withBuilds]`);
}
return this._builds;
}
/**
* Fluent builder method to add an element to the builds array
*/
public addBuilds(...builds_: Build[]) {
if (this._builds === undefined) {
this._builds = [];
}
this._builds = this._builds.concat(builds_);
return this;
}
/**
* commits - Push -> Commit
*
* @property {Commit[]} commits
*/
get commits(): Commit[] {
if (this._commits === undefined) {
throw new Error(`Please use the relevant builder method to set property [commits] on stub ` +
`[Push] before accessing it. It's probably called [withCommits]`);
}
return this._commits;
}
/**
* Fluent builder method to add an element to the commits array
*/
public addCommits(...commits_: Commit[]) {
if (this._commits === undefined) {
this._commits = [];
}
this._commits = this._commits.concat(commits_);
return this;
}
/**
* repo - Push -> Repo
*
* @property {Repo} repo
*/
get repo(): Repo {
if (this._repo === undefined) {
throw new Error(`Please use the relevant builder method to set property [repo] on stub ` +
`[Push] before accessing it. It's probably called [withRepo]`);
}
return this._repo;
}
/**
* Fluent builder method to set the repo property
*/
public withRepo(repo_: Repo) {
this._repo = repo_;
return this;
}
/**
* timestamp
*
* @property {string} timestamp
*/
get timestamp(): string {
if (this._timestamp === undefined) {
throw new Error(`Please use the relevant builder method to set property [timestamp] on stub ` +
`[Push] before accessing it. It's probably called [withTimestamp]`);
}
return this._timestamp;
}
/**
* Fluent builder method to set the timestamp property
*/
public withTimestamp(timestamp_: string) {
this._timestamp = timestamp_;
return this;
}
}