Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
constructor(auth: AuthConfig, serviceSid: string, environmentSid: string) {
super(auth, `${ServiceClient.getBaseUrl()}/Services/${serviceSid}/Environments/${environmentSid}`);
if (!isSidOfType(serviceSid, 'ZS')) {
throw new Error(`ServiceSid ${serviceSid} is not valid`);
}
if (!isSidOfType(environmentSid, 'ZE')) {
throw new Error(`EnvironmentSid ${environmentSid} is not valid`);
}
}
public remove = (sid: string): Promise => {
if (!isSidOfType(sid, SidPrefix.EnvironmentSid)) {
throw new Error(`${sid} is not of type ${SidPrefix.EnvironmentSid}`);
}
return this.http
.delete(`${EnvironmentClient.BaseUri}/${sid}`);
}
protected constructor(auth: AuthConfig, fileType: FileTypes, serviceSid: string) {
super(auth, `${ServiceClient.getBaseUrl()}/Services/${serviceSid}`);
if (!isSidOfType(serviceSid, 'ZS')) {
throw new Error(`ServiceSid ${serviceSid} is not valid`);
}
this.fileType = fileType;
this.serviceSid = serviceSid;
}
constructor(auth: AuthConfig, serviceSid: string, environmentSid: string) {
super(auth, `${ServiceClient.getBaseUrl()}/Services/${serviceSid}/Environments/${environmentSid}`);
if (!isSidOfType(serviceSid, 'ZS')) {
throw new Error(`ServiceSid ${serviceSid} is not valid`);
}
if (!isSidOfType(environmentSid, 'ZE')) {
throw new Error(`EnvironmentSid ${environmentSid} is not valid`);
}
}
constructor(auth: AuthConfig, serviceSid: string) {
super(auth, `${ServiceClient.getBaseUrl()}/Services/${serviceSid}`);
if (!isSidOfType(serviceSid, 'ZS')) {
throw new Error(`ServiceSid ${serviceSid} is not valid`);
}
}
const validate = async (config: FlexPluginArguments): Promise => {
config.name = config.name || '';
if (!isValidPluginName(config.name)) {
const coloredName = logger.coloredStrings.name;
const msg = `Invalid plugin name ${coloredName(config.name)}; plugin name must start with plugin-`;
throw new ValidationError(msg);
}
if (config.accountSid && !isSidOfType(config.accountSid, SidPrefix.AccountSid)) {
config.accountSid = await _promptForAccountSid();
}
if (config.template && !isValidUrl(config.template)) {
config.template = await _promptForTemplateUrl();
}
return config;
};
constructor(auth: AuthConfig, serviceSid: string) {
super(auth, `${ServiceClient.getBaseUrl()}/Services/${serviceSid}`);
if (!isSidOfType(serviceSid, SidPrefix.ServiceSid)) {
throw new Error(`ServiceSid ${serviceSid} is not valid`);
}
}