Fix entity for typescript example

This commit is contained in:
AkiraFukushima 2020-02-10 00:58:58 +09:00
parent 421eb70f5c
commit 9997e1341c
11 changed files with 26 additions and 26 deletions

View file

@ -1,4 +1,4 @@
import { Mastodon, Response, Results, isCancel } from 'megalodon'
import { Mastodon, Response, Entity, isCancel } from 'megalodon'
const BASE_URL: string = 'https://pleroma.io'
@ -8,7 +8,7 @@ const client = new Mastodon(BASE_URL, access_token)
client
.search('whalebird', 'hashtags', null, null, null, true)
.then((resp: Response<Results>) => {
.then((resp: Response<Entity.Results>) => {
console.log(resp.data.hashtags)
})
.catch((err: Error) => {

View file

@ -1,4 +1,4 @@
import { Mastodon, Status, Response } from 'megalodon'
import { Mastodon, Entity, Response } from 'megalodon'
declare var process: {
env: {
@ -12,7 +12,7 @@ const access_token: string = process.env.MASTODON_ACCESS_TOKEN
const client = new Mastodon(BASE_URL, access_token)
client.getFavourites().then((res: Response<Array<Status>>) => {
client.getFavourites().then((res: Response<Array<Entity.Status>>) => {
console.log(res.headers)
console.log(res.data)
})

View file

@ -1,9 +1,9 @@
import { Mastodon, Instance, Response } from 'megalodon'
import { Mastodon, Entity, Response } from 'megalodon'
const BASE_URL: string = 'http://mastodon.social'
const client = new Mastodon(BASE_URL)
client.getInstance().then((res: Response<Instance>) => {
client.getInstance().then((res: Response<Entity.Instance>) => {
console.log(res)
})

View file

@ -1,4 +1,4 @@
import { Mastodon, Instance, ProxyConfig, Response } from 'megalodon'
import { Mastodon, Entity, ProxyConfig, Response } from 'megalodon'
declare var process: {
env: {
@ -18,6 +18,6 @@ const proxy: ProxyConfig = {
const client = new Mastodon(BASE_URL, '', null, proxy)
client.getInstance().then((res: Response<Instance>) => {
client.getInstance().then((res: Response<Entity.Instance>) => {
console.log(res)
})

View file

@ -1,4 +1,4 @@
import { Mastodon, Status, Notification, StreamListener, ProxyConfig } from 'megalodon'
import { Mastodon, Entity, StreamListener, ProxyConfig } from 'megalodon'
declare var process: {
env: {
@ -30,11 +30,11 @@ stream.on('not-event-stream', (mes: string) => {
console.log(mes)
})
stream.on('update', (status: Status) => {
stream.on('update', (status: Entity.Status) => {
console.log(status)
})
stream.on('notification', (notification: Notification) => {
stream.on('notification', (notification: Entity.Notification) => {
console.log(notification)
})

View file

@ -1,4 +1,4 @@
import { Mastodon, Status, Response, ProxyConfig } from 'megalodon'
import { Mastodon, Entity, Response, ProxyConfig } from 'megalodon'
declare var process: {
env: {
@ -21,6 +21,6 @@ const proxy: ProxyConfig = {
const client = new Mastodon(BASE_URL, access_token, null, proxy)
client.getPublicTimeline().then((resp: Response<Array<Status>>) => {
client.getPublicTimeline().then((resp: Response<Array<Entity.Status>>) => {
console.log(resp.data)
})

View file

@ -1,4 +1,4 @@
import { Mastodon, Status, Notification, WebSocket, ProxyConfig } from 'megalodon'
import { Mastodon, Entity, WebSocket, ProxyConfig } from 'megalodon'
import log4js from 'log4js'
declare var process: {
@ -35,11 +35,11 @@ stream.on('pong', () => {
logger.debug('pong')
})
stream.on('update', (status: Status) => {
stream.on('update', (status: Entity.Status) => {
logger.debug(status)
})
stream.on('notification', (notification: Notification) => {
stream.on('notification', (notification: Entity.Notification) => {
logger.debug(notification)
})

View file

@ -1,4 +1,4 @@
import { Mastodon, Status, Notification, StreamListener } from 'megalodon'
import { Mastodon, Entity, StreamListener } from 'megalodon'
declare var process: {
env: {
@ -21,11 +21,11 @@ stream.on('not-event-stream', (mes: string) => {
console.log(mes)
})
stream.on('update', (status: Status) => {
stream.on('update', (status: Entity.Status) => {
console.log(status)
})
stream.on('notification', (notification: Notification) => {
stream.on('notification', (notification: Entity.Notification) => {
console.log(notification)
})

View file

@ -1,4 +1,4 @@
import { Mastodon, Status, Response } from 'megalodon'
import { Mastodon, Entity, Response } from 'megalodon'
declare var process: {
env: {
@ -12,6 +12,6 @@ const access_token: string = process.env.MASTODON_ACCESS_TOKEN
const client = new Mastodon(BASE_URL, access_token)
client.getPublicTimeline().then((resp: Response<Array<Status>>) => {
client.getPublicTimeline().then((resp: Response<Array<Entity.Status>>) => {
console.log(resp.data)
})

View file

@ -1,5 +1,5 @@
import * as readline from 'readline'
import { Mastodon, Status, Response } from 'megalodon'
import { Mastodon, Entity, Response } from 'megalodon'
const rl: readline.ReadLine = readline.createInterface({
input: process.stdin,
@ -16,7 +16,7 @@ new Promise(resolve => {
rl.question('Toot: ', status => {
client
.postStatus(status)
.then((res: Response<Status>) => {
.then((res: Response<Entity.Status>) => {
console.log(res)
rl.close()
resolve(res)

View file

@ -1,4 +1,4 @@
import { Mastodon, Status, Notification, WebSocket } from 'megalodon'
import { Mastodon, Entity, WebSocket } from 'megalodon'
import log4js from 'log4js'
declare var process: {
@ -26,11 +26,11 @@ stream.on('pong', () => {
logger.debug('pong')
})
stream.on('update', (status: Status) => {
stream.on('update', (status: Entity.Status) => {
logger.debug(status.url)
})
stream.on('notification', (notification: Notification) => {
stream.on('notification', (notification: Entity.Notification) => {
logger.debug(notification)
})