@atomist/cortex
Version:
Atomist Cortex model TypeScript typings
164 lines (146 loc) • 4.53 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 personApi from "../Person";
import { ChatId } from "./ChatId";
import { Email } from "./Email";
import { GitHubId } from "./GitHubId";
export { Person };
/**
* Type Person
* Generated class exposing Atomist Cortex.
* Fluent builder style class for use in testing and query by example.
*/
class Person implements personApi.Person {
private _chatId: ChatId;
private _emails: Email[];
private _forename: string;
private _gitHubId: GitHubId;
private _surname: string;
private _nodeName = "Person";
private _nodeTags = [ "Person", "-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;
}
/**
* chatId - Person -> ChatId
*
* @property {ChatId} chatId
*/
get chatId(): ChatId {
if (this._chatId === undefined) {
throw new Error(`Please use the relevant builder method to set property [chatId] on stub ` +
`[Person] before accessing it. It's probably called [withChatId]`);
}
return this._chatId;
}
/**
* Fluent builder method to set the chatId property
*/
public withChatId(chatId_: ChatId) {
this._chatId = chatId_;
return this;
}
/**
* emails - Person -> Email
*
* @property {Email[]} emails
*/
get emails(): Email[] {
if (this._emails === undefined) {
throw new Error(`Please use the relevant builder method to set property [emails] on stub ` +
`[Person] before accessing it. It's probably called [withEmails]`);
}
return this._emails;
}
/**
* Fluent builder method to add an element to the emails array
*/
public addEmails(...emails_: Email[]) {
if (this._emails === undefined) {
this._emails = [];
}
this._emails = this._emails.concat(emails_);
return this;
}
/**
* forename
*
* @property {string} forename
*/
get forename(): string {
if (this._forename === undefined) {
throw new Error(`Please use the relevant builder method to set property [forename] on stub ` +
`[Person] before accessing it. It's probably called [withForename]`);
}
return this._forename;
}
/**
* Fluent builder method to set the forename property
*/
public withForename(forename_: string) {
this._forename = forename_;
return this;
}
/**
* gitHubId - Person -> GitHubId
*
* @property {GitHubId} gitHubId
*/
get gitHubId(): GitHubId {
if (this._gitHubId === undefined) {
throw new Error(`Please use the relevant builder method to set property [gitHubId] on stub ` +
`[Person] before accessing it. It's probably called [withGitHubId]`);
}
return this._gitHubId;
}
/**
* Fluent builder method to set the gitHubId property
*/
public withGitHubId(gitHubId_: GitHubId) {
this._gitHubId = gitHubId_;
return this;
}
/**
* surname
*
* @property {string} surname
*/
get surname(): string {
if (this._surname === undefined) {
throw new Error(`Please use the relevant builder method to set property [surname] on stub ` +
`[Person] before accessing it. It's probably called [withSurname]`);
}
return this._surname;
}
/**
* Fluent builder method to set the surname property
*/
public withSurname(surname_: string) {
this._surname = surname_;
return this;
}
}