Refactor API calls to use unified request structure

- Updated MicrosoftTeams and Slack classes to use the new API.post structure with url and data properties.
- Refactored API utility methods to accept a single options object for HTTP requests, improving consistency across the codebase.
- Modified various service and utility classes (e.g., CopilotPullRequestService, CodeRepositoryUtil, and ApiMonitor) to align with the new API request format.
- Enhanced error handling and logging for API responses.
- Updated tests to accommodate changes in API method signatures.
This commit is contained in:
Nawaz Dhandala
2025-09-19 20:57:54 +01:00
parent 2985b7675d
commit 11894d0ba5
29 changed files with 632 additions and 362 deletions

View File

@@ -38,14 +38,13 @@ router.get(
const requestBody: JSONObject = ProbeAPIRequest.getDefaultRequestBody();
const result: HTTPResponse<JSONObject> | HTTPErrorResponse =
await API.fetch<JSONObject>(
HTTPMethod.POST,
queueSizeUrl,
requestBody,
{},
undefined,
{ ...ProxyConfig.getRequestProxyAgents() },
);
await API.fetch<JSONObject>({
method: HTTPMethod.POST,
url: queueSizeUrl,
data: requestBody,
headers: {},
options: { ...ProxyConfig.getRequestProxyAgents() },
});
if (result instanceof HTTPErrorResponse) {
logger.error("Error fetching queue size from ProbeIngest API");