@atomist/cortex
Version:
Atomist Cortex model TypeScript typings
316 lines (284 loc) • 8.66 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 commentApi from "../Comment";
import { GitHubId } from "./GitHubId";
import { Issue } from "./Issue";
import { PullRequest } from "./PullRequest";
import { Review } from "./Review";
export { Comment };
/**
* Type Comment
* Generated class exposing Atomist Cortex.
* Fluent builder style class for use in testing and query by example.
*/
class Comment implements commentApi.Comment {
private _body: string;
private _by: GitHubId;
private _commentType: "review" | "pullRequest" | "issue";
private _gitHubId: string;
private _htmlUrl: string;
private _id: string;
private _issue: Issue;
private _path: string;
private _position: string;
private _pullRequest: PullRequest;
private _review: Review;
private _timestamp: string;
private _nodeName = "Comment";
private _nodeTags = [ "Comment", "-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;
}
/**
* body
*
* @property {string} body
*/
get body(): string {
if (this._body === undefined) {
throw new Error(`Please use the relevant builder method to set property [body] on stub ` +
`[Comment] before accessing it. It's probably called [withBody]`);
}
return this._body;
}
/**
* Fluent builder method to set the body property
*/
public withBody(body_: string) {
this._body = body_;
return this;
}
/**
* by - Comment -> GitHubId
*
* @property {GitHubId} by
*/
get by(): GitHubId {
if (this._by === undefined) {
throw new Error(`Please use the relevant builder method to set property [by] on stub ` +
`[Comment] before accessing it. It's probably called [withBy]`);
}
return this._by;
}
/**
* Fluent builder method to set the by property
*/
public withBy(by_: GitHubId) {
this._by = by_;
return this;
}
/**
* commentType
*
* @property {"review" | "pullRequest" | "issue"} commentType
*/
get commentType(): "review" | "pullRequest" | "issue" {
if (this._commentType === undefined) {
throw new Error(`Please use the relevant builder method to set property [commentType] on stub ` +
`[Comment] before accessing it. It's probably called [withCommentType]`);
}
return this._commentType;
}
/**
* Fluent builder method to set the commentType property
*/
public withCommentType(commentType_: "review" | "pullRequest" | "issue") {
this._commentType = commentType_;
return this;
}
/**
* gitHubId
*
* @property {string} gitHubId
*/
get gitHubId(): string {
if (this._gitHubId === undefined) {
throw new Error(`Please use the relevant builder method to set property [gitHubId] on stub ` +
`[Comment] before accessing it. It's probably called [withGitHubId]`);
}
return this._gitHubId;
}
/**
* Fluent builder method to set the gitHubId property
*/
public withGitHubId(gitHubId_: string) {
this._gitHubId = gitHubId_;
return this;
}
/**
* htmlUrl
*
* @property {string} htmlUrl
*/
get htmlUrl(): string {
if (this._htmlUrl === undefined) {
throw new Error(`Please use the relevant builder method to set property [htmlUrl] on stub ` +
`[Comment] before accessing it. It's probably called [withHtmlUrl]`);
}
return this._htmlUrl;
}
/**
* Fluent builder method to set the htmlUrl property
*/
public withHtmlUrl(htmlUrl_: string) {
this._htmlUrl = htmlUrl_;
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 ` +
`[Comment] 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;
}
/**
* issue - Comment -> 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 ` +
`[Comment] before accessing it. It's probably called [withIssue]`);
}
return this._issue;
}
/**
* Fluent builder method to set the issue property
*/
public withIssue(issue_: Issue) {
this._issue = issue_;
return this;
}
/**
* path
*
* @property {string} path
*/
get path(): string {
if (this._path === undefined) {
throw new Error(`Please use the relevant builder method to set property [path] on stub ` +
`[Comment] before accessing it. It's probably called [withPath]`);
}
return this._path;
}
/**
* Fluent builder method to set the path property
*/
public withPath(path_: string) {
this._path = path_;
return this;
}
/**
* position
*
* @property {string} position
*/
get position(): string {
if (this._position === undefined) {
throw new Error(`Please use the relevant builder method to set property [position] on stub ` +
`[Comment] before accessing it. It's probably called [withPosition]`);
}
return this._position;
}
/**
* Fluent builder method to set the position property
*/
public withPosition(position_: string) {
this._position = position_;
return this;
}
/**
* pullRequest - Comment -> 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 ` +
`[Comment] 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;
}
/**
* review - Comment -> Review
*
* @property {Review} review
*/
get review(): Review {
if (this._review === undefined) {
throw new Error(`Please use the relevant builder method to set property [review] on stub ` +
`[Comment] before accessing it. It's probably called [withReview]`);
}
return this._review;
}
/**
* Fluent builder method to set the review property
*/
public withReview(review_: Review) {
this._review = review_;
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 ` +
`[Comment] 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;
}
}