import {Extension, HttpMethod, IServiceCall, ISession, SessionRequirement} from "@chaosinsight/portalclient" import {hasError, IPortalResponse} from "../index" export default class Session extends Extension { protected readonly extensionName = "Session" public getGet(): IServiceCall> { return this.call("Get", null, HttpMethod.Get, SessionRequirement.basic) } public createGet(): IServiceCall> { const call: IServiceCall> = this.call("Create", null, HttpMethod.Get, SessionRequirement.none) call.response.then(response => { if (!hasError(response)) this.client.updateSession(response.Body.Results[0]) }) return call } } Extension.add(Session, "session") declare module "@chaosinsight/portalclient" { // tslint:disable-next-line interface ExtensionHandler { session: Session } }