Add bulk wipe

This commit is contained in:
Aleks Rutins 2025-06-09 13:32:53 -04:00
parent 4721569c5d
commit b24a5bb612
No known key found for this signature in database
6 changed files with 119 additions and 2 deletions

25
mosyle.js Normal file
View file

@ -0,0 +1,25 @@
export function call(endpoint, data, auth) {
const headers = {
"Content-Type": "application/json",
};
if (auth) headers.Authorization = `Bearer ${auth}`;
return fetch("https://managerapi.mosyle.com/v2" + endpoint, {
method: "POST",
headers,
body: JSON.stringify(data),
});
}
export async function authenticate(email, password, token) {
const response = await call("/login", {
email,
password,
accessToken: token,
});
if (!response.ok) throw new Error("Authentication failed");
return response.headers.get("Authorization").replace(/^Bearer\s/, "");
}
export function bulk(data, auth) {
return call("/bulkops", data, auth);
}