Sanitize usage of delete

This commit is contained in:
Steve Faulkner 2020-07-23 18:17:30 -05:00
parent f4f2d00d7f
commit 155aacdf63

View File

@ -207,7 +207,7 @@ async function main() {
const methodParameters = parametersFromPath(path).filter(p => !constructorParameters.includes(p));
outputClient.push(`
/* ${operation.description} */
async ${camelize(methodName)} (
async ${sanitize(camelize(methodName))} (
${methodParameters.map(p => `${p}: string`).join(",\n")}
${bodyParam(bodyParameter, "Types")}
) : Promise<${responseType(operation, "Types")}> {
@ -217,18 +217,6 @@ async function main() {
} }).then((response) => response.json())
}
`);
// clients[clientName].functions.push(`
// /* ${operation.description} */
// async ${camelize(methodName)} (
// ${parametersFromPath(path)}
// ${bodyParam(bodyParameter, "Types")}
// ) : Promise<${responseType(operation, "Types")}> {
// return window.fetch(\`https://management.azure.com${path.replace(/{/g, "${")}\`, { method: "${method}", ${
// bodyParameter ? "body: JSON.stringify(body)" : ""
// } }).then((response) => response.json())
// }
// `);
// outputClient.push(clients[client].join("\n\n"));
}
}
outputClient.push(`}`);
@ -250,6 +238,13 @@ function buildBasePath(strings: string[]) {
return arrFirstElem.substring(0, i);
}
function sanitize(name: string) {
if (name === "delete") {
return "destroy";
}
return name;
}
function buildConstructor(client: Client) {
const params = constructorParams(client);
if (params.length === 0) {