@@ -659,4 +659,94 @@ export class Qiita {
659
659
return this . patch ( `${ this . endpoint } ${ this . version } /projects` , { archived, body, name, tags } ) ;
660
660
}
661
661
662
+ /**
663
+ * 投稿をストックしているユーザ一覧を、ストックした日時の降順で返します。
664
+ * @param page ページ番号 (1から100まで)
665
+ * @param perPage 1ページあたりに含まれる要素数 (1から100まで)
666
+ * @return ユーザー一覧
667
+ */
668
+ public fetchStockersFromItem = ( itemId : string , page : string , perPage : string ) : Promise < Qiita . User [ ] > => {
669
+ return this . get ( `${ this . endpoint } ${ this . version } /items/${ itemId } /stockers` , {
670
+ page,
671
+ per_page : perPage ,
672
+ } ) ;
673
+ }
674
+
675
+ /**
676
+ * 全てのユーザの一覧を作成日時の降順で取得します。
677
+ * @param page ページ番号 (1から100まで)
678
+ * @param perPage 1ページあたりに含まれる要素数 (1から100まで)
679
+ * @return ユーザー一覧
680
+ */
681
+ public fetchUsers = ( page : string , perPage : string ) : Promise < Qiita . User [ ] > => {
682
+ return this . get ( `${ this . endpoint } ${ this . version } /users` , {
683
+ page,
684
+ per_page : perPage ,
685
+ } ) ;
686
+ }
687
+
688
+ /**
689
+ * ユーザを取得します。
690
+ * @param userId ユーザーID
691
+ * @return ユーザー
692
+ */
693
+ public fetchUser = ( userId : string ) : Promise < Qiita . User > => {
694
+ return this . get ( `${ this . endpoint } ${ this . version } /users/${ userId } ` ) ;
695
+ }
696
+
697
+ /**
698
+ * ユーザがフォローしているユーザ一覧を取得します。
699
+ * @param userId ユーザーID
700
+ * @param page ページ番号 (1から100まで)
701
+ * @param perPage 1ページあたりに含まれる要素数 (1から100まで)
702
+ * @return ユーザー一覧
703
+ */
704
+ public fetchFolloweesFromUser = ( userId : string , page : string , perPage : string ) : Promise < Qiita . User [ ] > => {
705
+ return this . get ( `${ this . endpoint } ${ this . version } /users/${ userId } /followees` , {
706
+ page,
707
+ per_page : perPage ,
708
+ } )
709
+ }
710
+
711
+ /**
712
+ * ユーザをフォローしているユーザ一覧を取得します。
713
+ * @param userId ユーザーID
714
+ * @param page ページ番号 (1から100まで)
715
+ * @param perPage 1ページあたりに含まれる要素数 (1から100まで)
716
+ * @return ユーザー一覧
717
+ */
718
+ public fetchFollowersFromUser = ( userId : string , page : string , perPage : string ) : Promise < Qiita . User [ ] > => {
719
+ return this . get ( `${ this . endpoint } ${ this . version } /users/${ userId } /followers` , {
720
+ page,
721
+ per_page : perPage ,
722
+ } )
723
+ }
724
+
725
+ /**
726
+ * ユーザをフォローしているユーザ一覧を取得します。
727
+ * @param userId ユーザーID
728
+ * @return 空のオブジェクト
729
+ */
730
+ public unfollowUser = ( userId : string ) : Promise < { } > => {
731
+ return this . delete ( `${ this . endpoint } ${ this . version } /users/${ userId } /following` ) ;
732
+ }
733
+
734
+ /**
735
+ * ユーザへのフォローを外します。
736
+ * @param userId ユーザーID
737
+ * @return 空のオブジェクト
738
+ */
739
+ public fetchIfFollowUser = ( userId : string ) : Promise < { } > => {
740
+ return this . get ( `${ this . endpoint } ${ this . version } /users/${ userId } /following` ) ;
741
+ }
742
+
743
+ /**
744
+ * ユーザをフォローしている場合に204を返します。
745
+ * @param userId ユーザーID
746
+ * @return 空のオブジェクト
747
+ */
748
+ public followUser = ( userId : string ) : Promise < { } > => {
749
+ return this . put ( `${ this . endpoint } ${ this . version } /users/${ userId } /following` ) ;
750
+ }
751
+
662
752
}
0 commit comments