@atomist/cortex
Version:
Atomist Cortex model TypeScript typings
159 lines (141 loc) • 4.48 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 statusApi from "../Status";
import { Commit } from "./Commit";
export { Status };
/**
* Type Status
* Generated class exposing Atomist Cortex.
* Fluent builder style class for use in testing and query by example.
*/
class Status implements statusApi.Status {
private _commit: Commit;
private _context: string;
private _description: string;
private _state: "pending" | "success" | "error" | "failure";
private _targetUrl: string;
private _nodeName = "Status";
private _nodeTags = [ "Status", "-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 - Status -> 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 ` +
`[Status] 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;
}
/**
* context
*
* @property {string} context
*/
get context(): string {
if (this._context === undefined) {
throw new Error(`Please use the relevant builder method to set property [context] on stub ` +
`[Status] before accessing it. It's probably called [withContext]`);
}
return this._context;
}
/**
* Fluent builder method to set the context property
*/
public withContext(context_: string) {
this._context = context_;
return this;
}
/**
* description
*
* @property {string} description
*/
get description(): string {
if (this._description === undefined) {
throw new Error(`Please use the relevant builder method to set property [description] on stub ` +
`[Status] before accessing it. It's probably called [withDescription]`);
}
return this._description;
}
/**
* Fluent builder method to set the description property
*/
public withDescription(description_: string) {
this._description = description_;
return this;
}
/**
* state
*
* @property {"pending" | "success" | "error" | "failure"} state
*/
get state(): "pending" | "success" | "error" | "failure" {
if (this._state === undefined) {
throw new Error(`Please use the relevant builder method to set property [state] on stub ` +
`[Status] before accessing it. It's probably called [withState]`);
}
return this._state;
}
/**
* Fluent builder method to set the state property
*/
public withState(state_: "pending" | "success" | "error" | "failure") {
this._state = state_;
return this;
}
/**
* targetUrl
*
* @property {string} targetUrl
*/
get targetUrl(): string {
if (this._targetUrl === undefined) {
throw new Error(`Please use the relevant builder method to set property [targetUrl] on stub ` +
`[Status] before accessing it. It's probably called [withTargetUrl]`);
}
return this._targetUrl;
}
/**
* Fluent builder method to set the targetUrl property
*/
public withTargetUrl(targetUrl_: string) {
this._targetUrl = targetUrl_;
return this;
}
}