Skip to content

Commit

Permalink
Merge pull request #2152 from h3poteto/feat/emoji-shortcode
Browse files Browse the repository at this point in the history
Receive emoji name (not shortcode) in custom emoji reaction API
  • Loading branch information
h3poteto authored Feb 8, 2024
2 parents 9938533 + abd68aa commit 835d3bb
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 9 deletions.
5 changes: 4 additions & 1 deletion megalodon/src/firefish.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2300,7 +2300,7 @@ export default class Firefish implements MegalodonInterface {
* POST /api/notes/reactions/create
*
* @param {string} id Target note ID.
* @param {string} emoji Reaction emoji string. This string is raw unicode emoji.
* @param {string} emoji Reaction emoji string. This string is raw unicode emoji or custom emoji name (not shortcode).
*/
public async createEmojiReaction(id: string, emoji: string): Promise<Response<Entity.Status>> {
await this.client.post<Record<never, never>>('/api/notes/reactions/create', {
Expand All @@ -2316,6 +2316,9 @@ export default class Firefish implements MegalodonInterface {

/**
* POST /api/notes/reactions/delete
*
* @param {string} id Target note ID.
* @param {string} emoji Reaction emoji string. This string is raw unicode emoji or custom emoji name (not shortcode).
*/
public async deleteEmojiReaction(id: string, emoji: string): Promise<Response<Entity.Status>> {
await this.client.post<Record<never, never>>('/api/notes/reactions/delete', {
Expand Down
4 changes: 2 additions & 2 deletions megalodon/src/megalodon.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1338,8 +1338,8 @@ export interface MegalodonInterface {
/**
* React to a post with a unicode emoji.
*
* @param id Target status ID.
* @param emoji A unicode emoj.
* @param {string} id Target status ID.
* @param {string} emoji Reaction emoji string. This string is raw unicode emoji or custom emoji name (not shortcode).
* @return Status.
**/
createEmojiReaction(id: string, emoji: string): Promise<Response<Entity.Status>>
Expand Down
12 changes: 6 additions & 6 deletions megalodon/src/pleroma.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3136,10 +3136,10 @@ export default class Pleroma implements MegalodonInterface {
* PUT /api/v1/pleroma/statuses/:status_id/reactions/:emoji
*
* @param {string} id Target status ID.
* @param {string} emoji Reaction emoji string. This string is raw unicode emoji.
* @param {string} emoji Reaction emoji string. This string is raw unicode emoji or custom emoji name (not shortcode).
*/
public async createEmojiReaction(id: string, emoji: string): Promise<Response<Entity.Status>> {
return this.client.put<PleromaAPI.Entity.Status>(`/api/v1/pleroma/statuses/${id}/reactions/${encodeURI(emoji)}`).then(res => {
return this.client.put<PleromaAPI.Entity.Status>(`/api/v1/pleroma/statuses/${id}/reactions/:${encodeURI(emoji)}:`).then(res => {
return Object.assign(res, {
data: PleromaAPI.Converter.status(res.data)
})
Expand All @@ -3150,10 +3150,10 @@ export default class Pleroma implements MegalodonInterface {
* DELETE /api/v1/pleroma/statuses/:status_id/reactions/:emoji
*
* @param {string} id Target status ID.
* @param {string} emoji Reaction emoji string. This string is raw unicode emoji.
* @param {string} emoji Reaction emoji string. This string is raw unicode emoji or custom emoji name (not shortcode).
*/
public async deleteEmojiReaction(id: string, emoji: string): Promise<Response<Entity.Status>> {
return this.client.del<PleromaAPI.Entity.Status>(`/api/v1/pleroma/statuses/${id}/reactions/${encodeURI(emoji)}`).then(res => {
return this.client.del<PleromaAPI.Entity.Status>(`/api/v1/pleroma/statuses/${id}/reactions/:${encodeURI(emoji)}:`).then(res => {
return Object.assign(res, {
data: PleromaAPI.Converter.status(res.data)
})
Expand All @@ -3177,10 +3177,10 @@ export default class Pleroma implements MegalodonInterface {
* GET /api/v1/pleroma/statuses/:status_id/reactions/:emoji
*
* @param {string} id Target status ID.
* @param {string} emoji Reaction emoji string. This string is url encoded unicode emoji.
* @param {string} emoji Reaction emoji string. This string is raw unicode emoji or custom emoji name (not shortcode).
*/
public async getEmojiReaction(id: string, emoji: string): Promise<Response<Entity.Reaction>> {
return this.client.get<PleromaAPI.Entity.Reaction>(`/api/v1/pleroma/statuses/${id}/reactions/${encodeURI(emoji)}`).then(res => {
return this.client.get<PleromaAPI.Entity.Reaction>(`/api/v1/pleroma/statuses/${id}/reactions/:${encodeURI(emoji)}:`).then(res => {
return Object.assign(res, {
data: PleromaAPI.Converter.reaction(res.data)
})
Expand Down

0 comments on commit 835d3bb

Please sign in to comment.