Skip to content

Commit 940b191

Browse files
committed
Add emoji reaction
1 parent 7690461 commit 940b191

File tree

1 file changed

+87
-2
lines changed

1 file changed

+87
-2
lines changed

src/qiita.ts

Lines changed: 87 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -409,6 +409,35 @@ export class Qiita {
409409
return this.delete(`${this.endpoint}${this.version}/comments/${commentId}`);
410410
}
411411

412+
/**
413+
* コメントに付けられた絵文字リアクション一覧を作成日時の降順で返します。
414+
* @param commentId コメントID
415+
* @return 絵文字リアクション
416+
*/
417+
public fetchCommentReactions = (commentId: string, name: string): Promise<Qiita.Reaction[]> => {
418+
return this.get(`${this.endpoint}${this.version}/comments/${commentId}/reactions`);
419+
}
420+
421+
/**
422+
* コメントに絵文字リアクションを付けます。
423+
* @param commentId コメントID
424+
* @param name 絵文字の識別子
425+
* @return 絵文字リアクション
426+
*/
427+
public createCommentReaction = (commentId: string, name: string): Promise<Qiita.Reaction> => {
428+
return this.post(`${this.endpoint}${this.version}/comments/${commentId}/reactions`, { name });
429+
}
430+
431+
/**
432+
* コメントから絵文字リアクションを削除します。
433+
* @param commentId コメントID
434+
* @param name 絵文字の識別子
435+
* @return 絵文字リアクション
436+
*/
437+
public deleteCommentReaction = (commentId: string, name: string): Promise<Qiita.Reaction> => {
438+
return this.delete(`${this.endpoint}${this.version}/comments/${commentId}/reactions`, { name });
439+
}
440+
412441

413442
/**
414443
* タグ一覧を作成日時の降順で返します。
@@ -606,6 +635,35 @@ export class Qiita {
606635
return this.post(`${this.endpoint}${this.version}/projects/${projectId}/comments`, { body });
607636
}
608637

638+
/**
639+
* プロジェクトに付けられた絵文字リアクション一覧を作成日時の降順で返します。
640+
* @param projectId プロジェクトID
641+
* @return 絵文字リアクション一覧
642+
*/
643+
public fetchProjectReactions = (projectId: string): Promise<Qiita.Reaction[]> => {
644+
return this.get(`${this.endpoint}${this.version}/projects/${projectId}/reactions`);
645+
}
646+
647+
/**
648+
* プロジェクトに絵文字リアクションを付けます。
649+
* @param projectId プロジェクトID
650+
* @param name 絵文字の識別子
651+
* @return 絵文字リアクション
652+
*/
653+
public createProjectReaction = (projectId: string, name: string): Promise<Qiita.Reaction> => {
654+
return this.post(`${this.endpoint}${this.version}/projects/${projectId}/reactions`, { name });
655+
}
656+
657+
/**
658+
* プロジェクトから絵文字リアクションを削除します。
659+
* @param projectId プロジェクトID
660+
* @param name 絵文字の識別子
661+
* @return 絵文字リアクション
662+
*/
663+
public deleteProjectReaction = (projectId: string, name: string): Promise<Qiita.Reaction> => {
664+
return this.delete(`${this.endpoint}${this.version}/projects/${projectId}/reactions`, { name });
665+
}
666+
609667

610668
/**
611669
* 全てのユーザの一覧を作成日時の降順で取得します。
@@ -871,6 +929,35 @@ export class Qiita {
871929
return this.delete(`${this.endpoint}${this.version}/items/${itemId}/stock`);
872930
}
873931

932+
/**
933+
* 記事に付けられた絵文字リアクション一覧を作成日時の降順で返します。
934+
* @param itemId 投稿ID
935+
* @return 絵文字リアクション
936+
*/
937+
public fetchItemReactions = (itemId: string): Promise<Qiita.Reaction[]> => {
938+
return this.post(`${this.endpoint}${this.version}/items/${itemId}/reactions`);
939+
}
940+
941+
/**
942+
* 記事に絵文字リアクションを付けます。
943+
* @param itemId 投稿ID
944+
* @param name 絵文字の識別子
945+
* @return 絵文字リアクション
946+
*/
947+
public createItemReaction = (itemId: string, name: string): Promise<Qiita.Reaction> => {
948+
return this.post(`${this.endpoint}${this.version}/items/${itemId}/reactions`, { name });
949+
}
950+
951+
/**
952+
* 記事から絵文字リアクションを削除します。
953+
* @param itemId 投稿ID
954+
* @param name 絵文字の識別子
955+
* @return 絵文字リアクション
956+
*/
957+
public deleteItemReaction = (itemId: string, name: string): Promise<Qiita.Reaction> => {
958+
return this.delete(`${this.endpoint}${this.version}/items/${itemId}/reactions`, { name });
959+
}
960+
874961
/**
875962
* 投稿につけられた「いいね!」を作成日時の降順で返します。
876963
* @param itemId 投稿のID
@@ -966,8 +1053,6 @@ export class Qiita {
9661053
return this.delete(`${this.endpoint}${this.version}/team_invitations`);
9671054
}
9681055

969-
// todo emoji reaction
970-
9711056
/**
9721057
* アクセストークンに紐付いたユーザを返します。
9731058
* @return 認証中のユーザ

0 commit comments

Comments
 (0)