πEnglish | π‘ζ₯ζ¬θͺ |
---|
Note for node.js example, coming soon...β¨
π How to use
- Deno
// See example.ts
import { MiAuth, UrlParam, Permissions } from "./mod.ts"
const origin = "https://misskey.io"
const permission = [Permissions.AccountRead]
const session = crypto.randomUUID();
const param: UrlParam = {
name: "MyApp",
permission: permission
}
const miauth = new MiAuth(origin, param, session)
// access to the this url, do authentication
console.log(miauth.authUrl())
// call when done authentication
// console.log(await miauth.getToken())
This module keeps in mind on alignment with misskey.js. like this
- Deno
// this snippets omit module imports
const origin = "https://misskey.io"
const permission: Array<string> = [Permissions.AccountRead]
const param: UrlParam = {
name: "MyApp",
permission: permission
}
const miauth = quickAuth(origin, param)
console.log("Let's authentication to this URLβ¨\n", miauth.authUrl())
// wait for press enter
console.log("\nβ Push enter for restart process")
for await (const line of readLines(Deno.stdin)) {
if ( line == "" ) {
break
}
}
const token = await miauth.getToken()
const cli = new Misskey.api.APIClient({
origin: origin,
credential: token,
});
const i = await cli.request('i', {});
console.log(`Show your profile\n${i.name}@${i.username}\n${i.description}`)
β¬οΈ Install
- Deno
import { MiAuth, UrlParam, Permissions } from "./mod.ts"
const origin = "https://misskey.io"
const permission: Array<string> = [Permissions.AccountRead, Permissions.NotesRead]
const param: UrlParam = {
name: "MyApp",
permission: permission
}
const miauth = new MiAuth(origin, param, session)
const token = miauth.getToken()
const apiParam = {
origin: origin,
credential: token
}
const cli = new Misskey.api.APIClient(apiParam);
const meta = await cli.request('meta', { detail: true });
console.log(meta)
- Node.js
βοΈ Development
this project use velociraptor
# See all task
vr
# use deno vender
deno vender mod.ts
# running on vender
vr dev
# run testing
vr dev-test
π License
MIT