@azure/core-client
Version:
Core library for interfacing with AutoRest generated code
39 lines • 1.27 kB
JavaScript
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
import { MapperTypeNames } from "./serializer.js";
/**
* Gets the list of status codes for streaming responses.
* @internal
*/
export function getStreamingResponseStatusCodes(operationSpec) {
const result = new Set();
for (const statusCode in operationSpec.responses) {
const operationResponse = operationSpec.responses[statusCode];
if (operationResponse.bodyMapper &&
operationResponse.bodyMapper.type.name === MapperTypeNames.Stream) {
result.add(Number(statusCode));
}
}
return result;
}
/**
* Get the path to this parameter's value as a dotted string (a.b.c).
* @param parameter - The parameter to get the path string for.
* @returns The path to this parameter's value as a dotted string.
* @internal
*/
export function getPathStringFromParameter(parameter) {
const { parameterPath, mapper } = parameter;
let result;
if (typeof parameterPath === "string") {
result = parameterPath;
}
else if (Array.isArray(parameterPath)) {
result = parameterPath.join(".");
}
else {
result = mapper.serializedName;
}
return result;
}
//# sourceMappingURL=interfaceHelpers.js.map