@iflow-mcp/alibabacloud-devops-mcp-server
Version:
MCP Server for using the alibabacloud-devops API: allows AI assistants to directly participate in development collaboration, helping teams optimize development processes and improve efficiency.
27 lines (26 loc) • 989 B
JavaScript
import { yunxiaoRequest, buildUrl, handleRepositoryIdEncoding } from "../../common/utils.js";
import { CompareSchema } from "../../common/types.js";
export async function getCompareFunc(organizationId, repositoryId, from, to, sourceType, // Possible values: branch, tag
targetType, // Possible values: branch, tag
straight) {
const encodedRepoId = handleRepositoryIdEncoding(repositoryId);
const baseUrl = `/oapi/v1/codeup/organizations/${organizationId}/repositories/${encodedRepoId}/compares`;
const queryParams = {
from,
to
};
if (sourceType !== undefined) {
queryParams.sourceType = sourceType;
}
if (targetType !== undefined) {
queryParams.targetType = targetType;
}
if (straight !== undefined) {
queryParams.straight = straight;
}
const url = buildUrl(baseUrl, queryParams);
const response = await yunxiaoRequest(url, {
method: "GET",
});
return CompareSchema.parse(response);
}