agentscript
Version:
AgentScript Model in Model/View architecture
45 lines (40 loc) • 1.46 kB
HTML
<html>
<head>
<meta charset="utf-8" />
<title>examples-webdav</title>
</head>
<body>
<h1>examples-webdav</h1>
<pre id="log"></pre>
<script type="module">
import {
AuthType,
createClient,
} from 'https://santafe.alert.live/webdav.js'
const log = (...args) => {
const line = args
.map(a => (typeof a === 'object' ? JSON.stringify(a) : a))
.join(' ')
document.getElementById('log').textContent += line + '\n'
console.log(...args)
}
const randomUser = 'user_' + Math.floor(Math.random() * 100000)
const token = 'placeholder-token-for-demo' // Replace with real token if needed
const client = createClient(
'https://agentscript.webdav.acequia.io:3334/',
{
authType: AuthType.Token,
token,
}
)
log('New session for', randomUser)
log('Client created:', client)
// Example operation (noop)
client
.getDirectoryContents('/agentscript/users/' + randomUser)
.then(contents => log('Directory contents:', contents))
.catch(err => log('Error:', err.message))
</script>
</body>
</html>