//native
// Should return an XML document on success
type Nextcloud = {
baseUrl: string;
username: string;
password: string;
};
export async function main(nextcloud_res: Nextcloud) {
const resp = await fetch(`${nextcloud_res.baseUrl}/ocs/v1.php/cloud/users`, {
headers: {
Authorization:
"Basic " + btoa(nextcloud_res.username + ":" + nextcloud_res.password),
"OCS-APIRequest": "true",
},
});
if (!resp.ok) {
throw Error(`HTTP Error ${resp.status} - ${await resp.text()}`);
}
return await resp.text();
}
Submitted by hugo989 9 days ago