in provisioning/service/src/provisioningserviceclient.ts [27:42]
constructor(config: RestApiClient.TransportConfig, restApiClient?: RestApiClient) {
if (!config) {
/*Codes_SRS_NODE_PROVISIONING_SERVICE_CLIENT_06_001: [The `ProvisioningServiceClient` construction shall throw a `ReferenceError` if the `config` object is falsy.] */
throw new ReferenceError('The \'config\' parameter cannot be \'' + config + '\'');
} else if (!config.host) {
throw new ArgumentError('The \'config\' argument is missing the host property');
} else if (!config.sharedAccessSignature && !config.tokenCredential) {
throw new ArgumentError('The \'config\' argument must define either the sharedAccessSignature or tokenCredential property');
} else if (config.tokenCredential && !config.tokenScope) {
throw new ArgumentError('The \'config\' argument must define the tokenScope property if it defines the tokenCredential property');
}
/*Codes_SRS_NODE_PROVISIONING_SERVICE_CLIENT_06_003: [The `ProvisioningServiceClient` constructor shall use the `restApiClient` provided as a second argument if it is provided.] */
/*Codes_SRS_NODE_PROVISIONING_SERVICE_CLIENT_06_004: [The `ProvisioningServiceClient` constructor shall use `azure-iot-http-base.RestApiClient` if no `restApiClient` argument is provided.] */
this._restApiClient = restApiClient || new RestApiClient(config, packageJson.name + '/' + packageJson.version);
}