in powershell/llcsharp/operation/method.ts [361:385]
export function ResolveResponseType(opMethod?: OperationMethod, operation?: Operation, state?: State,): EnhancedTypeDeclaration | undefined {
let typeCount = 0;
let responseType: EnhancedTypeDeclaration | undefined = undefined;
if (opMethod) {
opMethod.callbacks.filter(each => each.name !== 'onDefault').forEach(each => {
if (each.responseType && responseType && each.responseType !== responseType) {
typeCount++;
} else if (each.responseType && !responseType) {
responseType = each.responseType;
typeCount = 1;
}
});
} else if (operation && state) {
for (const response of [...values(operation.responses), ...values(operation.exceptions)].filter(each => each.language?.csharp?.name !== 'onDefault')) {
const eachResponseType = (<BinaryResponse>response).binary ? new Binary(new BinarySchema(''), true) : ((<SchemaResponse>response).schema ? state.project.modelsNamespace.NewResolveTypeDeclaration(<NewSchema>((<SchemaResponse>response).schema), true, state) : undefined);
if (eachResponseType && responseType && eachResponseType !== responseType) {
typeCount++;
} else if (eachResponseType && !responseType) {
responseType = eachResponseType;
typeCount = 1;
}
}
}
return typeCount === 1 ? responseType : undefined;
}