2021-05-14 02:54:41 +00:00
|
|
|
# misskey.js
|
|
|
|
|
2021-05-14 03:00:58 +00:00
|
|
|
## Install
|
|
|
|
coming soon
|
|
|
|
|
2021-05-14 02:54:41 +00:00
|
|
|
# Usage
|
2021-05-16 09:30:42 +00:00
|
|
|
## Authenticate
|
|
|
|
todo
|
|
|
|
|
2021-05-14 02:54:41 +00:00
|
|
|
## API request
|
2021-05-16 09:27:21 +00:00
|
|
|
都度インスタンスやトークンを指定する場合
|
|
|
|
``` ts
|
|
|
|
import * as Misskey from 'misskey-js';
|
|
|
|
|
|
|
|
const meta = await Misskey.api.request('https://misskey.test', 'meta', { detail: true }, 'TOKEN');
|
|
|
|
```
|
|
|
|
|
|
|
|
最初にインスタンスやトークンを指定し、以後のリクエストでその情報を使いまわす場合
|
|
|
|
``` ts
|
|
|
|
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 });
|
|
|
|
```
|
2021-05-14 02:54:41 +00:00
|
|
|
|
|
|
|
## Streaming
|
2021-05-16 09:33:08 +00:00
|
|
|
``` ts
|
|
|
|
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);
|
|
|
|
});
|
|
|
|
```
|
2021-05-14 03:00:10 +00:00
|
|
|
|
2021-05-14 03:00:58 +00:00
|
|
|
---
|
|
|
|
|
2021-05-14 03:00:10 +00:00
|
|
|
<div align="center">
|
|
|
|
<a href="https://github.com/misskey-dev/misskey/blob/develop/CONTRIBUTING.md"><img src="./i-want-you.png" width="300"></a>
|
|
|
|
</div>
|