Permalink
Browse files

feat(api): Include ticketer configuration. JS-17

  • Loading branch information...
mvrueden committed Aug 10, 2017
1 parent 027182f commit 272873415e3977caac9599a38cc465c137fbd94b
Showing with 25 additions and 0 deletions.
  1. +9 −0 src/Client.ts
  2. +4 −0 src/api/ServerMetadata.ts
  3. +12 −0 src/api/TicketerConfig.ts
View
@@ -12,6 +12,7 @@ import {OnmsError} from './api/OnmsError';
import {OnmsResult} from './api/OnmsResult';
import {OnmsVersion} from './api/OnmsVersion';
import {ServerType, ServerTypes} from './api/ServerType';
import {TicketerConfig} from './api/TicketerConfig';
import {OnmsServer} from './api/OnmsServer';
import {ServerMetadata} from './api/ServerMetadata';
@@ -83,6 +84,14 @@ export class Client implements IHasHTTP {
metadata.type = ServerTypes.MERIDIAN;
}
}
if (version.ge('21.0.0')) {
metadata.ticketerConfig = new TicketerConfig();
metadata.ticketerConfig.enabled = false;
if (response.data.ticketerConfig) {
metadata.ticketerConfig.plugin = response.data.ticketerConfig.plugin;
metadata.ticketerConfig.enabled = response.data.ticketerConfig.enabled === true;
}
}
return metadata;
}
@@ -1,5 +1,6 @@
import {OnmsVersion} from '../api/OnmsVersion';
import {ServerType, ServerTypes} from '../api/ServerType';
import {TicketerConfig} from './TicketerConfig';
/**
* A class that represents the capabilities an OpenNMS server has and other information about it.
@@ -12,6 +13,9 @@ export class ServerMetadata {
/** The type of server (Horizon, Meridian). */
public type: ServerType;
/** The ticketer config. Requires at least version 21.0.0 of OpenNMS. */
public ticketerConfig: TicketerConfig;
/**
* Construct a ServerMetadata object.
* @constructor
View
@@ -0,0 +1,12 @@
/**
* States the current ticket configuration.
*/
export class TicketerConfig {
/** The name of the ticketer plugin currently in use. */
public plugin: string;
/** Defines if the ticketer integration is enabled. True if enabled, False otherwise. */
public enabled: boolean;
}

0 comments on commit 2728734

Please sign in to comment.