npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@bluelinklabs/ctzn-api-client

v0.0.1

Published

API client to CTZN servers.

Downloads

4

Readme

CTZN API Client

In nodeJS:

npm i @bluelinklabs/ctzn-api-client

Then

import { create } from '@bluelinklabs/ctzn-api-client'
const api = create()

In the browser with ESM, copy ctzn-api-client.build.js into your project and then:

import { create } from '/vendor/ctzn-api-client.build.js'
const api = create()

Table of contents

API Reference

All methods are async unless specified otherwise.

Getters

api.getProfile(dbId)

  • dbId String.
  • Returns object.

api.listUserFeed(dbId[, opts])

  • dbId String.
  • opts Optional object.
  • Returns object.

api.getPost(dbId, postKey)

  • dbId String.
  • postKey String.
  • Returns object.

api.getComment(dbId, commentKey)

  • dbId String.
  • commentKey String.
  • Returns object.

api.getThread(dbUrl)

  • dbUrl String.
  • Returns object.

api.listFollowers(dbId)

  • dbId String.
  • Returns object.

Views and methods

api.method(path[, params])

  • path String.
  • params Optional object.
  • Returns an object.

api.view.get(path[, params])

  • path String.
  • params Optional object.
  • Returns an object.

Tables

api.db(dbId).table(schemaId).list([opts])

api.table.list(dbId, schemaId[, opts])

  • dbId String.
  • schemaId String.
  • opts Optional object.
  • Returns an object.

api.db(dbId).table(schemaId).get(key)

api.table.get(dbId, schemaId, key)

  • dbId String.
  • schemaId String.
  • key String.
  • Returns an object.

api.db(dbId).table(schemaId).create(value)

api.table.create(dbId, schemaId, value)

  • dbId String.
  • schemaId String.
  • value Object.
  • Returns an object.

api.db(dbId).table(schemaId).createWithBlobs(value, blobs)

api.table.createWithBlobs(dbId, schemaId, value, blobs)

  • dbId String.
  • schemaId String.
  • value Object.
  • blobs Object. A map of blobnames to objects with the following attributes:
    • base64buf String.
    • mimeType String.
  • Returns an object.

api.db(dbId).table(schemaId).update(key, value)

api.table.update(dbId, schemaId, key, value)

  • dbId String.
  • schemaId String.
  • key String.
  • value Object.
  • Returns an object.

api.db(dbId).table(schemaId).delete(key)

api.table.delete(dbId, schemaId, key)

  • dbId String.
  • schemaId String.
  • key String.
  • Returns an object.

api.db(dbId).table(schemaId).getBlob(key, blobName)

api.table.getBlob(dbId, schemaId, key, blobName)

  • dbId String.
  • schemaId String.
  • key String.
  • blobName String.
  • Returns an ArrayBuffer.

api.db(dbId).table(schemaId).putBlob(key, blobName, buf, mimeType)

api.table.putBlob(dbId, schemaId, key, blobName, buf, mimeType)

  • dbId String.
  • schemaId String.
  • key String.
  • blobName String.
  • buf String or ArrayBuffer. If a string, must be base64-encoded.
  • mimeType String.
  • Returns an object.

api.db(dbId).table(schemaId).delBlob(key, blobName)

api.table.delBlob(dbId, schemaId, key, blobName)

  • dbId String.
  • schemaId String.
  • key String.
  • blobName String.
  • Returns an object.

Session

api.user

An alias to api.db(api.session.info.dbKey)

api.session.info

The current session's information. Contains:

  • hasSession Boolean.
  • url String.
  • dbKey String.
  • username String.

api.session.isActive()

  • Returns boolean.

api.session.onChange(cb)

Calls cb any time the current session changes (login / logout).

  • cb Function.

api.session.setup()

Sets up the current session. Must be called before accessing any of the api.session api.

api.session.login({username, password})

  • username String.
  • password String.
  • Returns object.

api.session.logout()

  • Returns object.

api.session.signup({username, displayName, description, email, password})

  • email String.
  • username String.
  • password String.
  • displayName String.
  • description String.
  • Returns object.

api.session.requestPasswordChangeCode({username})

  • username String.
  • Returns object.

api.session.changePassword({username, code, newPassword})

  • username String.
  • code String.
  • newPassword String.
  • Returns object.

Utility

api.get(path[, query])

  • path String.
  • query Optional object.
  • Returns an object.

api.getBuf(path[, query])

  • path String.
  • query Optional object.
  • Returns an ArrayBuffer.

api.post(path, body)

  • path String.
  • body Object.
  • Returns an object.

api.postMultipart(path, parts)

  • path String.
  • parts. Object. An object mapping keys to Blobs.
  • Returns an object.

api.put(path, body)

  • path String.
  • body Object.
  • Returns an object.

api.putBuf(path, body, mimeType)

  • path String.
  • body ArrayBuffer.
  • mimeType String.
  • Returns an object.

api.delete(path)

  • path String.