urbit/pkg/npm/api
2021-05-17 16:07:09 +10:00
..
contacts npm: Updated http-api and api packages 2021-04-22 07:17:39 -07:00
graph npm: Updated http-api and api packages 2021-04-22 07:17:39 -07:00
groups npm: Updated http-api and api packages 2021-04-22 07:17:39 -07:00
hark Merge remote-tracking branch 'origin/release/next-userspace' into release/2021-5-27 2021-05-17 16:07:09 +10:00
invite api: brought to parity with livenet 2021-02-24 19:54:00 -08:00
lib Merge remote-tracking branch 'origin/release/next-js' into lf/keybinds 2021-05-10 15:54:47 +10:00
metadata Merge remote-tracking branch 'origin/release/next-userspace' into release/2021-5-27 2021-05-17 16:07:09 +10:00
s3 npm: Updated http-api and api packages 2021-04-22 07:17:39 -07:00
settings interface, npm/api: type checking, round 2 2021-04-28 17:18:30 -04:00
.eslintrc.js added NPM packages 2021-01-26 21:45:18 -08:00
index.ts npm: Updated http-api and api packages 2021-04-22 07:17:39 -07:00
package-lock.json npm: change package-lock to ver@1 2021-05-05 19:18:37 -04:00
package.json npm: Updated http-api and api packages 2021-04-22 07:17:39 -07:00
README.md npm: Updated http-api and api packages 2021-04-22 07:17:39 -07:00
tsconfig.json interface: type fixes, part 4 2021-05-05 17:20:29 -04:00

Urbit API in JavaScript

This package simplifies the process of working with Urbit's APIs into fluent, typed functions organized by app. Pairs well with @urbit/http-api. Compare:

Without:

import UrbitInterface from '@urbit/http-api';
const api: UrbitInterface = useApi();
api.poke({
  app: 'settings-store',
  mark: 'settings-event',
  json: {
    'put-entry': {
      'bucket-key': bucket,
      'entry-key': key,
      'value': value
    }
  }
});

With:

import UrbitInterface from '@urbit/http-api';
import { settings } from '@urbit/api';
const api: UrbitInterface = useApi();
api.poke(setings.putEntry(bucket, key, value));

You may import single functions

import { putEntry } from '@urbit/api';

or whole apps:

import { settings } from '@urbit/api';

This package also provides types and utilities for working with Urbit's internal data structures, such as Nouns, Das, Tas, and so forth.

This package was originally developed as part of Tlon's Landscape client and therefore the best reference material exists there.