Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
rest (version = 2, extraOpts = {}) {
if (version !== 1 && version !== 2) {
throw new Error(`invalid http API version: ${version}`)
}
const key = `${version}|${JSON.stringify(extraOpts)}`
if (!this._transportCache.rest[key]) {
Object.assign(extraOpts, this._restArgs)
const payload = this._getTransportPayload(extraOpts)
this._transportCache.rest[key] = version === 2
? new RESTv2(payload)
: new RESTv1(payload)
}
return this._transportCache.rest[key]
}
rest (version = 2, extraOpts = {}) {
if (version !== 1 && version !== 2) {
throw new Error(`invalid http API version: ${version}`)
}
const key = `${version}|${JSON.stringify(extraOpts)}`
if (!this._transportCache.rest[key]) {
Object.assign(extraOpts, this._restArgs)
const payload = this._getTransportPayload(extraOpts)
this._transportCache.rest[key] = version === 2
? new RESTv2(payload)
: new RESTv1(payload)
}
return this._transportCache.rest[key]
}