@atomist/cortex
Version:
Atomist Cortex model TypeScript typings
284 lines (256 loc) • 8.04 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 chatTeamApi from "../ChatTeam";
import { ChatChannel } from "./ChatChannel";
import { ChatId } from "./ChatId";
import { GitHubProvider } from "./GitHubProvider";
import { Org } from "./Org";
export { ChatTeam };
/**
* Type ChatTeam
* Generated class exposing Atomist Cortex.
* Fluent builder style class for use in testing and query by example.
*/
class ChatTeam implements chatTeamApi.ChatTeam {
private _channels: ChatChannel[];
private _domain: string;
private _emailDomain: string;
private _id: string;
private _members: ChatId[];
private _messageCount: number;
private _name: string;
private _orgs: Org[];
private _provider: string;
private _providers: GitHubProvider[];
private _nodeName = "ChatTeam";
private _nodeTags = [ "ChatTeam", "-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;
}
/**
* channels - ChatTeam -> ChatChannel
*
* @property {ChatChannel[]} channels
*/
get channels(): ChatChannel[] {
if (this._channels === undefined) {
throw new Error(`Please use the relevant builder method to set property [channels] on stub ` +
`[ChatTeam] before accessing it. It's probably called [withChannels]`);
}
return this._channels;
}
/**
* Fluent builder method to add an element to the channels array
*/
public addChannels(...channels_: ChatChannel[]) {
if (this._channels === undefined) {
this._channels = [];
}
this._channels = this._channels.concat(channels_);
return this;
}
/**
* domain
*
* @property {string} domain
*/
get domain(): string {
if (this._domain === undefined) {
throw new Error(`Please use the relevant builder method to set property [domain] on stub ` +
`[ChatTeam] before accessing it. It's probably called [withDomain]`);
}
return this._domain;
}
/**
* Fluent builder method to set the domain property
*/
public withDomain(domain_: string) {
this._domain = domain_;
return this;
}
/**
* emailDomain
*
* @property {string} emailDomain
*/
get emailDomain(): string {
if (this._emailDomain === undefined) {
throw new Error(`Please use the relevant builder method to set property [emailDomain] on stub ` +
`[ChatTeam] before accessing it. It's probably called [withEmailDomain]`);
}
return this._emailDomain;
}
/**
* Fluent builder method to set the emailDomain property
*/
public withEmailDomain(emailDomain_: string) {
this._emailDomain = emailDomain_;
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 ` +
`[ChatTeam] 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;
}
/**
* members - ChatTeam -> ChatId
*
* @property {ChatId[]} members
*/
get members(): ChatId[] {
if (this._members === undefined) {
throw new Error(`Please use the relevant builder method to set property [members] on stub ` +
`[ChatTeam] before accessing it. It's probably called [withMembers]`);
}
return this._members;
}
/**
* Fluent builder method to add an element to the members array
*/
public addMembers(...members_: ChatId[]) {
if (this._members === undefined) {
this._members = [];
}
this._members = this._members.concat(members_);
return this;
}
/**
* messageCount
*
* @property {number} messageCount
*/
get messageCount(): number {
if (this._messageCount === undefined) {
throw new Error(`Please use the relevant builder method to set property [messageCount] on stub ` +
`[ChatTeam] before accessing it. It's probably called [withMessageCount]`);
}
return this._messageCount;
}
/**
* Fluent builder method to set the messageCount property
*/
public withMessageCount(messageCount_: number) {
this._messageCount = messageCount_;
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 ` +
`[ChatTeam] 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;
}
/**
* orgs - ChatTeam -> Org
*
* @property {Org[]} orgs
*/
get orgs(): Org[] {
if (this._orgs === undefined) {
throw new Error(`Please use the relevant builder method to set property [orgs] on stub ` +
`[ChatTeam] before accessing it. It's probably called [withOrgs]`);
}
return this._orgs;
}
/**
* Fluent builder method to add an element to the orgs array
*/
public addOrgs(...orgs_: Org[]) {
if (this._orgs === undefined) {
this._orgs = [];
}
this._orgs = this._orgs.concat(orgs_);
return this;
}
/**
* provider
*
* @property {string} provider
*/
get provider(): string {
if (this._provider === undefined) {
throw new Error(`Please use the relevant builder method to set property [provider] on stub ` +
`[ChatTeam] before accessing it. It's probably called [withProvider]`);
}
return this._provider;
}
/**
* Fluent builder method to set the provider property
*/
public withProvider(provider_: string) {
this._provider = provider_;
return this;
}
/**
* providers - ChatTeam -> GitHubProvider
*
* @property {GitHubProvider[]} providers
*/
get providers(): GitHubProvider[] {
if (this._providers === undefined) {
throw new Error(`Please use the relevant builder method to set property [providers] on stub ` +
`[ChatTeam] before accessing it. It's probably called [withProviders]`);
}
return this._providers;
}
/**
* Fluent builder method to add an element to the providers array
*/
public addProviders(...providers_: GitHubProvider[]) {
if (this._providers === undefined) {
this._providers = [];
}
this._providers = this._providers.concat(providers_);
return this;
}
}