megalodon
start Misskey support in version 3.0.0.
In this update, there are few breaking changes, so please read this migration guide if you are using megalodon v2.x.
There are three changes,
- Move class methods in Mastodon
- I prepare methods to call each Mastodon APIs
- Changed default export function
In #180, these methods are moved and changed to instance methods:
registerApp
createApp
generateAuthUrl
fetchAccessToken
refreshToken
So please call these methods from Mastodon like:
import { Mastodon } from 'megalodon'
const client = new Mastodon(...)
client.registerApp('TestApp')
In v2.x, probably you use megalodon
like:
import Mastodon from 'megalodon'
const client = new Mastodon(...)
client.get('/api/v1/timelines/home')
But these methods are deprecated, and are not exported from megalodon
package.
I prepared methods instead of these.
There are all methods to call Mastodon APIs, so please use it.
import { Mastodon } from 'megalodon'
const client = new Mastodon(...)
client.getHomeTimeline()
Please refer megalodon
document for methods.
megalodon
export generator
function as default.
This function generate Client API instance for specified SNS.
import generator from 'megalodon'
const client = generator(sns_name, url, access_token)
Now support mastodon
, pleroma
and misskey
as sns parameter.
And detector function is defined.
This function detect which SNS's URL is provided.
It returns SNS name, mastodon
, pleroma
or misskey
.
import { detector } from 'megalodon'
const sns = await detector('https://mastodon.social')
These functions are necessary to treat multiple SNS. The smart way to call multiple SNS endpoint in same interface is:
import generator, { detector } from 'megalodon'
const sns = await detector(url)
const client = generator(sns, url, access_token)
client.getHomeTimeline()