1
0
mirror of https://github.com/MisskeyIO/misskey synced 2024-12-16 15:48:19 +09:00
MisskeyIO/README.md
2021-05-16 18:33:08 +09:00

1.1 KiB

misskey.js

Install

coming soon

Usage

Authenticate

todo

API request

都度インスタンスやトークンを指定する場合

import * as Misskey from 'misskey-js';

const meta = await Misskey.api.request('https://misskey.test', 'meta', { detail: true }, 'TOKEN');

最初にインスタンスやトークンを指定し、以後のリクエストでその情報を使いまわす場合

import * as Misskey from 'misskey-js';

const cli = new Misskey.api.APIClient({
	origin: 'https://misskey.test'
});
cli.i = { token: 'TOKEN' };

const meta = await cli.request('meta', { detail: true });

Streaming

import * as Misskey from 'misskey-js';

const stream = new Misskey.Stream('https://misskey.test', { token: 'TOKEN' });
const mainChannel = stream.useSharedConnection('main');
mainChannel.on('notification', notification => {
	console.log('notification received', notification);
});