Skip to content

Commit

Permalink
feat(api): add metadata call to detect ticketer config support
Browse files Browse the repository at this point in the history
  • Loading branch information
Benjamin Reed committed Aug 10, 2017
1 parent a948c04 commit bf0255b
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/Client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ export class Client implements IHasHTTP {
metadata.type = ServerTypes.MERIDIAN;
}
}
if (version.ge('21.0.0')) {
if (metadata.ticketer()) {
metadata.ticketerConfig = new TicketerConfig();
metadata.ticketerConfig.enabled = false;
if (response.data.ticketerConfig) {
Expand Down
11 changes: 11 additions & 0 deletions src/api/ServerMetadata.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,15 @@ export class ServerMetadata {
}
}

/** Does this server support ticketer configuration metadata? */
public ticketer() {
if (this.type && this.type === ServerTypes.MERIDIAN) {
return this.version.ge('2017.0.0');
} else {
return this.version.ge('21.0.0');
}
}

/** What version of the ReST API does this server support? */
public apiVersion() {
if (this.type && this.type === ServerTypes.MERIDIAN) {
Expand All @@ -81,6 +90,7 @@ export class ServerMetadata {
graphs: this.graphs(),
outageSummaries: this.outageSummaries(),
setNodeLocation: this.setNodeLocation(),
ticketer: this.ticketer(),
type: (this.type === ServerTypes.MERIDIAN ? 'Meridian' : 'Horizon'),
};
}
Expand All @@ -94,6 +104,7 @@ export class ServerMetadata {
+ ',graphs=' + this.graphs()
+ ',outageSummaries=' + this.outageSummaries()
+ ',setNodeLocation=' + this.setNodeLocation()
+ ',ticketer=' + this.ticketer()
+ ']';
}

Expand Down

0 comments on commit bf0255b

Please sign in to comment.