urbit/pkg/npm/api
2021-08-19 16:09:28 -07:00
..
contacts Revert "Revert "Merge naive/aggregator into poprox/naive-tests"" 2021-08-19 16:09:28 -07:00
graph Revert "Revert "Merge naive/aggregator into poprox/naive-tests"" 2021-08-19 16:09:28 -07:00
groups Revert "Revert "Merge naive/aggregator into poprox/naive-tests"" 2021-08-19 16:09:28 -07:00
hark Revert "Revert "Merge naive/aggregator into poprox/naive-tests"" 2021-08-19 16:09:28 -07:00
invite api: brought to parity with livenet 2021-02-24 19:54:00 -08:00
lib Revert "Revert "Merge naive/aggregator into poprox/naive-tests"" 2021-08-19 16:09:28 -07:00
metadata Revert "Revert "Merge naive/aggregator into poprox/naive-tests"" 2021-08-19 16:09:28 -07:00
s3 Revert "Revert "Merge naive/aggregator into poprox/naive-tests"" 2021-08-19 16:09:28 -07:00
settings Revert "Revert "Merge naive/aggregator into poprox/naive-tests"" 2021-08-19 16:09:28 -07:00
.eslintrc.js added NPM packages 2021-01-26 21:45:18 -08:00
index.ts Revert "Revert "Merge naive/aggregator into poprox/naive-tests"" 2021-08-19 16:09:28 -07:00
package-lock.json Revert "Revert "Merge naive/aggregator into poprox/naive-tests"" 2021-08-19 16:09:28 -07:00
package.json Revert "Revert "Merge naive/aggregator into poprox/naive-tests"" 2021-08-19 16:09:28 -07:00
README.md Revert "Revert "Merge naive/aggregator into poprox/naive-tests"" 2021-08-19 16:09:28 -07:00
tsconfig.json Revert "Revert "Merge naive/aggregator into poprox/naive-tests"" 2021-08-19 16:09:28 -07: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.