@atomist/cortex
Version:
Atomist Cortex model TypeScript typings
167 lines (149 loc) • 4.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 gitHubIdApi from "../GitHubId";
import { Email } from "./Email";
import { GitHubProvider } from "./GitHubProvider";
import { Person } from "./Person";
export { GitHubId };
/**
* Type GitHubId
* Generated class exposing Atomist Cortex.
* Fluent builder style class for use in testing and query by example.
*/
class GitHubId implements gitHubIdApi.GitHubId {
private _emails: Email[];
private _login: string;
private _name: string;
private _person: Person;
private _provider: GitHubProvider[];
private _nodeName = "GitHubId";
private _nodeTags = [ "GitHubId", "-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;
}
/**
* emails - GitHubId -> 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 ` +
`[GitHubId] 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;
}
/**
* login
*
* @property {string} login
*/
get login(): string {
if (this._login === undefined) {
throw new Error(`Please use the relevant builder method to set property [login] on stub ` +
`[GitHubId] before accessing it. It's probably called [withLogin]`);
}
return this._login;
}
/**
* Fluent builder method to set the login property
*/
public withLogin(login_: string) {
this._login = login_;
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 ` +
`[GitHubId] 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;
}
/**
* person - GitHubId -> Person
*
* @property {Person} person
*/
get person(): Person {
if (this._person === undefined) {
throw new Error(`Please use the relevant builder method to set property [person] on stub ` +
`[GitHubId] before accessing it. It's probably called [withPerson]`);
}
return this._person;
}
/**
* Fluent builder method to set the person property
*/
public withPerson(person_: Person) {
this._person = person_;
return this;
}
/**
* provider - GitHubId -> GitHubProvider
*
* @property {GitHubProvider[]} provider
*/
get provider(): GitHubProvider[] {
if (this._provider === undefined) {
throw new Error(`Please use the relevant builder method to set property [provider] on stub ` +
`[GitHubId] before accessing it. It's probably called [withProvider]`);
}
return this._provider;
}
/**
* Fluent builder method to add an element to the provider array
*/
public addProvider(...provider_: GitHubProvider[]) {
if (this._provider === undefined) {
this._provider = [];
}
this._provider = this._provider.concat(provider_);
return this;
}
}