UNPKG

@atomist/cortex

Version:

Atomist Cortex model TypeScript typings

405 lines (365 loc) 11.6 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 buildApi from "../Build"; import { Commit } from "./Commit"; import { PullRequest } from "./PullRequest"; import { Push } from "./Push"; import { Repo } from "./Repo"; import { SpinnakerPipeline } from "./SpinnakerPipeline"; export { Build }; /** * Type Build * Generated class exposing Atomist Cortex. * Fluent builder style class for use in testing and query by example. */ class Build implements buildApi.Build { private _buildUrl: string; private _commit: Commit; private _compareUrl: string; private _finishedAt: string; private _id: string; private _name: string; private _provider: string; private _pullRequest: PullRequest; private _pullRequestNumber: number; private _push: Push; private _repo: Repo; private _spinnakerPipeline: SpinnakerPipeline; private _startedAt: string; private _status: "passed" | "broken" | "failed" | "started" | "canceled"; private _timestamp: string; private _trigger: "pull_request" | "push"; private _nodeName = "Build"; private _nodeTags = [ "Build", "-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; } /** * buildUrl * * @property {string} buildUrl */ get buildUrl(): string { if (this._buildUrl === undefined) { throw new Error(`Please use the relevant builder method to set property [buildUrl] on stub ` + `[Build] before accessing it. It's probably called [withBuildUrl]`); } return this._buildUrl; } /** * Fluent builder method to set the buildUrl property */ public withBuildUrl(buildUrl_: string) { this._buildUrl = buildUrl_; return this; } /** * commit - Build -> 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 ` + `[Build] 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; } /** * compareUrl * * @property {string} compareUrl */ get compareUrl(): string { if (this._compareUrl === undefined) { throw new Error(`Please use the relevant builder method to set property [compareUrl] on stub ` + `[Build] before accessing it. It's probably called [withCompareUrl]`); } return this._compareUrl; } /** * Fluent builder method to set the compareUrl property */ public withCompareUrl(compareUrl_: string) { this._compareUrl = compareUrl_; return this; } /** * finishedAt * * @property {string} finishedAt */ get finishedAt(): string { if (this._finishedAt === undefined) { throw new Error(`Please use the relevant builder method to set property [finishedAt] on stub ` + `[Build] before accessing it. It's probably called [withFinishedAt]`); } return this._finishedAt; } /** * Fluent builder method to set the finishedAt property */ public withFinishedAt(finishedAt_: string) { this._finishedAt = finishedAt_; 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 ` + `[Build] 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 ` + `[Build] 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; } /** * provider * * @property {string} provider */ get provider(): string { if (this._provider === undefined) { throw new Error(`Please use the relevant builder method to set property [provider] on stub ` + `[Build] before accessing it. It's probably called [withProvider]`); } return this._provider; } /** * Fluent builder method to set the provider property */ public withProvider(provider_: string) { this._provider = provider_; return this; } /** * pullRequest - Build -> 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 ` + `[Build] before accessing it. It's probably called [withPullRequest]`); } return this._pullRequest; } /** * Fluent builder method to set the pullRequest property */ public withPullRequest(pullRequest_: PullRequest) { this._pullRequest = pullRequest_; return this; } /** * pullRequestNumber * * @property {number} pullRequestNumber */ get pullRequestNumber(): number { if (this._pullRequestNumber === undefined) { throw new Error(`Please use the relevant builder method to set property [pullRequestNumber] on stub ` + `[Build] before accessing it. It's probably called [withPullRequestNumber]`); } return this._pullRequestNumber; } /** * Fluent builder method to set the pullRequestNumber property */ public withPullRequestNumber(pullRequestNumber_: number) { this._pullRequestNumber = pullRequestNumber_; return this; } /** * push - Build -> Push * * @property {Push} push */ get push(): Push { if (this._push === undefined) { throw new Error(`Please use the relevant builder method to set property [push] on stub ` + `[Build] before accessing it. It's probably called [withPush]`); } return this._push; } /** * Fluent builder method to set the push property */ public withPush(push_: Push) { this._push = push_; return this; } /** * repo - Build -> 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 ` + `[Build] 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; } /** * spinnakerPipeline - Build -> SpinnakerPipeline * * @property {SpinnakerPipeline} spinnakerPipeline */ get spinnakerPipeline(): SpinnakerPipeline { if (this._spinnakerPipeline === undefined) { throw new Error(`Please use the relevant builder method to set property [spinnakerPipeline] on stub ` + `[Build] before accessing it. It's probably called [withSpinnakerPipeline]`); } return this._spinnakerPipeline; } /** * Fluent builder method to set the spinnakerPipeline property */ public withSpinnakerPipeline(spinnakerPipeline_: SpinnakerPipeline) { this._spinnakerPipeline = spinnakerPipeline_; return this; } /** * startedAt * * @property {string} startedAt */ get startedAt(): string { if (this._startedAt === undefined) { throw new Error(`Please use the relevant builder method to set property [startedAt] on stub ` + `[Build] before accessing it. It's probably called [withStartedAt]`); } return this._startedAt; } /** * Fluent builder method to set the startedAt property */ public withStartedAt(startedAt_: string) { this._startedAt = startedAt_; return this; } /** * status * * @property {"passed" | "broken" | "failed" | "started" | "canceled"} status */ get status(): "passed" | "broken" | "failed" | "started" | "canceled" { if (this._status === undefined) { throw new Error(`Please use the relevant builder method to set property [status] on stub ` + `[Build] before accessing it. It's probably called [withStatus]`); } return this._status; } /** * Fluent builder method to set the status property */ public withStatus(status_: "passed" | "broken" | "failed" | "started" | "canceled") { this._status = status_; 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 ` + `[Build] 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; } /** * trigger * * @property {"pull_request" | "push"} trigger */ get trigger(): "pull_request" | "push" { if (this._trigger === undefined) { throw new Error(`Please use the relevant builder method to set property [trigger] on stub ` + `[Build] before accessing it. It's probably called [withTrigger]`); } return this._trigger; } /** * Fluent builder method to set the trigger property */ public withTrigger(trigger_: "pull_request" | "push") { this._trigger = trigger_; return this; } }