cbp-lib
Version:
Libraries for cbp
21 lines (19 loc) • 663 B
JavaScript
import {Manager} from './Manager'
import {httpRequest} from '../_helpers/http'
import {ArgumentError} from '../_helpers/custom-error'
import {Schema, validateSchema} from '../_helpers/types'
export class ManagementClient {
constructor(options) {
if (typeof options !== 'object') {
throw new ArgumentError('argument options must be type \'object\'')
}
this.options = options
// validate options
validateSchema(Schema.mgmtClientOptions, options)
.catch(error => {
throw new ArgumentError(error)
})
this.user = new Manager(options)
}
}