SDK for CollabLand APIs - https://api.collab.land.
By default, dependencies were installed when this application was generated.
Whenever dependencies in package.json
are changed, run the following command:
npm install
To only install resolved dependencies in package-lock.json
:
npm ci
-
Get an oAuth2 access token from Discord
-
For Node.js, run the following command:
npm run build
node dist/examples/get-user <discord-oauth2-access-token>
- For browsers, open index.html
<!doctype html>
<html>
<head>
<title>CollabLand SDK Demo</title>
<script src="https://unpkg.com/@collabland/sdk" charset="utf-8"></script>
<script>
async function main() {
const accessToken = document.getElementById('token').value;
const client = new collabland.CollabLandClient(accessToken);
await client.connect();
try {
const user = await client.account.getUserProfile();
alert(JSON.stringify(user));
} catch (err) {
alert(err);
}
}
</script>
</head>
<body>
<h1>CollabLand SDK Demo</h1>
<form>
<label for="token">Discord oAuth2 Token:</label><br />
<input type="password" id="token" name="accessToken" />
<p>
<input type="button" onClick="main()" value="Submit" />
</p>
</form>
</body>
</html>
To incrementally build the project:
npm run build
To force a full build by cleaning up cached artifacts:
npm run rebuild
npm run lint
To automatically fix such issues:
npm run lint:fix