add: source endpoint for editing through masto api
This commit is contained in:
parent
e32b03a048
commit
a12d1c52dd
5 changed files with 37 additions and 5 deletions
|
@ -1295,11 +1295,15 @@ export default class Misskey implements MegalodonInterface {
|
|||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* GET /api/notes/show
|
||||
*/
|
||||
public async getStatusSource(_id: string): Promise<Response<Entity.StatusSource>> {
|
||||
return new Promise((_, reject) => {
|
||||
const err = new NoImplementedError('misskey does not support')
|
||||
reject(err)
|
||||
})
|
||||
return this.client
|
||||
.post<MisskeyAPI.Entity.Note>('/api/notes/show', {
|
||||
noteId: _id
|
||||
})
|
||||
.then(res => ({ ...res, data: MisskeyAPI.Converter.notesource(res.data) }))
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -305,6 +305,14 @@ namespace MisskeyAPI {
|
|||
}
|
||||
}
|
||||
|
||||
export const notesource = (n: Entity.Note): MegalodonEntity.StatusSource => {
|
||||
return {
|
||||
id: n.id,
|
||||
text: n.text ?? '',
|
||||
spoiler_text: n.cw ? n.cw : ''
|
||||
}
|
||||
}
|
||||
|
||||
const mapEmojis = (e: Array<Entity.Emoji> | { [key: string]: string }): Array<MegalodonEntity.Emoji> => {
|
||||
if (Array.isArray(e)) {
|
||||
return e.map(e => emoji(e))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue