Merge pull request #749 from bluewave-labs/feat/pause-monitors

Add pause routes and controller, implement functionality
This commit is contained in:
Alexander Holliday
2024-08-29 16:02:27 -07:00
committed by GitHub
10 changed files with 295 additions and 81 deletions
+43
View File
@@ -17,6 +17,27 @@ class NetworkService {
);
}
/**
*
* ************************************
* Create a new monitor
* ************************************
*
* @async
* @param {string} authToken - The authorization token to be used in the request header.
* @param {string} monitorId - The monitor ID to be sent in the param.
* @returns {Promise<AxiosResponse>} The response from the axios GET request.
*/
async getMonitorByid(authToken, monitorId) {
return this.axiosInstance.get(`/monitors/${monitorId}`, {
headers: {
Authorization: `Bearer ${authToken}`,
"Content-Type": "application/json",
},
});
}
/**
*
* ************************************
@@ -163,6 +184,28 @@ class NetworkService {
},
});
}
/**
* ************************************
* Pauses a single monitor by its ID
* ************************************
*
* @async
* @param {string} authToken - The authorization token to be used in the request header.
* @param {string} monitorId - The ID of the monitor to be paused.
* @returns {Promise<AxiosResponse>} The response from the axios POST request.
*/
async pauseMonitorById(authToken, monitorId) {
return this.axiosInstance.post(
`/monitors/pause/${monitorId}`,
{},
{
headers: {
Authorization: `Bearer ${authToken}`,
"Content-Type": "application/json",
},
}
);
}
/**
* ************************************