@collabland/sdk
v0.64.1
Published
SDK for CollabLand APIs
Downloads
59
Readme
@collabland/sdk
SDK for CollabLand APIs - https://api.collab.land.
Install dependencies
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
Try it out
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
Use it in browsers
<!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>
Rebuild the project
To incrementally build the project:
npm run build
To force a full build by cleaning up cached artifacts:
npm run rebuild
Fix code style and formatting issues
npm run lint
To automatically fix such issues:
npm run lint:fix