@collabland/sdk
TypeScript icon, indicating that this package has built-in type declarations

0.64.1 • Public • Published

@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

  1. Get an oAuth2 access token from Discord

  2. For Node.js, run the following command:

npm run build
node dist/examples/get-user <discord-oauth2-access-token>
  1. 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

Package Sidebar

Install

npm i @collabland/sdk

Weekly Downloads

14

Version

0.64.1

License

MIT

Unpacked Size

2.92 MB

Total Files

1226

Last publish

Collaborators

  • jamesyoung
  • alokt
  • rfeng