UNPKG

@atomist/cortex

Version:

Atomist Cortex model TypeScript typings

278 lines (250 loc) 7.74 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 reviewApi from "../Review"; import { Comment } from "./Comment"; import { Commit } from "./Commit"; import { GitHubId } from "./GitHubId"; import { PullRequest } from "./PullRequest"; export { Review }; /** * Type Review * Generated class exposing Atomist Cortex. * Fluent builder style class for use in testing and query by example. */ class Review implements reviewApi.Review { private _body: string; private _by: GitHubId[]; private _comments: Comment[]; private _commit: Commit; private _gitHubId: string; private _htmlUrl: string; private _id: string; private _pullRequest: PullRequest; private _state: "requested" | "pending" | "approved"; private _submittedAt: string; private _nodeName = "Review"; private _nodeTags = [ "Review", "-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 ` + `[Review] 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 - Review -> 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 ` + `[Review] before accessing it. It's probably called [withBy]`); } return this._by; } /** * Fluent builder method to add an element to the by array */ public addBy(...by_: GitHubId[]) { if (this._by === undefined) { this._by = []; } this._by = this._by.concat(by_); return this; } /** * comments - Review -> Comment * * @property {Comment[]} comments */ get comments(): Comment[] { if (this._comments === undefined) { throw new Error(`Please use the relevant builder method to set property [comments] on stub ` + `[Review] before accessing it. It's probably called [withComments]`); } return this._comments; } /** * Fluent builder method to add an element to the comments array */ public addComments(...comments_: Comment[]) { if (this._comments === undefined) { this._comments = []; } this._comments = this._comments.concat(comments_); return this; } /** * commit - Review -> 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 ` + `[Review] 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; } /** * 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 ` + `[Review] 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 ` + `[Review] 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 ` + `[Review] 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; } /** * pullRequest - Review -> 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 ` + `[Review] 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; } /** * state * * @property {"requested" | "pending" | "approved"} state */ get state(): "requested" | "pending" | "approved" { if (this._state === undefined) { throw new Error(`Please use the relevant builder method to set property [state] on stub ` + `[Review] before accessing it. It's probably called [withState]`); } return this._state; } /** * Fluent builder method to set the state property */ public withState(state_: "requested" | "pending" | "approved") { this._state = state_; return this; } /** * submittedAt * * @property {string} submittedAt */ get submittedAt(): string { if (this._submittedAt === undefined) { throw new Error(`Please use the relevant builder method to set property [submittedAt] on stub ` + `[Review] before accessing it. It's probably called [withSubmittedAt]`); } return this._submittedAt; } /** * Fluent builder method to set the submittedAt property */ public withSubmittedAt(submittedAt_: string) { this._submittedAt = submittedAt_; return this; } }