UNPKG

@atomist/cortex

Version:

Atomist Cortex model TypeScript typings

208 lines (186 loc) 5.68 kB
/* * 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 branchApi from "../Branch"; import { Commit } from "./Commit"; import { PullRequest } from "./PullRequest"; import { Repo } from "./Repo"; export { Branch }; /** * Type Branch * Generated class exposing Atomist Cortex. * Fluent builder style class for use in testing and query by example. */ class Branch implements branchApi.Branch { private _commit: Commit; private _deleted: boolean; private _id: string; private _name: string; private _pullRequests: PullRequest[]; private _repo: Repo; private _timestamp: string; private _nodeName = "Branch"; private _nodeTags = [ "Branch", "-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; } /** * commit - Branch -> Commit * * @property {Commit} commit */ get commit(): Commit { if (this._commit === undefined) { throw new Error(`Please use the relevant builder method to set property [commit] on stub ` + `[Branch] before accessing it. It's probably called [withCommit]`); } return this._commit; } /** * Fluent builder method to set the commit property */ public withCommit(commit_: Commit) { this._commit = commit_; return this; } /** * deleted * * @property {boolean} deleted */ get deleted(): boolean { if (this._deleted === undefined) { throw new Error(`Please use the relevant builder method to set property [deleted] on stub ` + `[Branch] before accessing it. It's probably called [withDeleted]`); } return this._deleted; } /** * Fluent builder method to set the deleted property */ public withDeleted(deleted_: boolean) { this._deleted = deleted_; return this; } /** * id * * @property {string} id */ get id(): string { if (this._id === undefined) { throw new Error(`Please use the relevant builder method to set property [id] on stub ` + `[Branch] before accessing it. It's probably called [withId]`); } return this._id; } /** * Fluent builder method to set the id property */ public withId(id_: string) { this._id = id_; 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 ` + `[Branch] 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; } /** * pullRequests - Branch -> PullRequest * * @property {PullRequest[]} pullRequests */ get pullRequests(): PullRequest[] { if (this._pullRequests === undefined) { throw new Error(`Please use the relevant builder method to set property [pullRequests] on stub ` + `[Branch] before accessing it. It's probably called [withPullRequests]`); } return this._pullRequests; } /** * Fluent builder method to add an element to the pullRequests array */ public addPullRequests(...pullRequests_: PullRequest[]) { if (this._pullRequests === undefined) { this._pullRequests = []; } this._pullRequests = this._pullRequests.concat(pullRequests_); return this; } /** * repo - Branch -> 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 ` + `[Branch] 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 ` + `[Branch] 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; } }