@@ -225,7 +225,6 @@ export namespace Qiita {
225
225
226
226
}
227
227
228
-
229
228
export class Qiita {
230
229
231
230
private token = '' ;
@@ -237,7 +236,7 @@ export class Qiita {
237
236
* @param token トークン文字列
238
237
* @return 何も返しません
239
238
*/
240
- public setToken ( token : string ) : void {
239
+ public setToken ( token : string ) : void {
241
240
this . token = token ;
242
241
}
243
242
@@ -246,7 +245,7 @@ export class Qiita {
246
245
* @param endpoint エンドポイントへのURI
247
246
* @return 何も返しません
248
247
*/
249
- public setEndpoint ( endpoint : string ) : void {
248
+ public setEndpoint ( endpoint : string ) : void {
250
249
this . endpoint = endpoint ;
251
250
}
252
251
@@ -255,7 +254,7 @@ export class Qiita {
255
254
* @param version APIへのパスの文字列 (e.g. `/api/v2`)
256
255
* @return 何も返しません
257
256
*/
258
- public setVersion ( version : string ) : void {
257
+ public setVersion ( version : string ) : void {
259
258
this . version = version ;
260
259
}
261
260
@@ -274,7 +273,7 @@ export class Qiita {
274
273
}
275
274
276
275
if ( this . token ) {
277
- options . headers [ ' Authorization' ] = `Bearer ${ this . token } ` ;
276
+ options . headers . Authorization = `Bearer ${ this . token } ` ;
278
277
}
279
278
280
279
options . headers [ 'Content-Type' ] = 'application/json' ;
@@ -291,8 +290,8 @@ export class Qiita {
291
290
const data = await response . json ( ) ;
292
291
293
292
if ( response . ok ) {
294
- return data
295
- } ;
293
+ return data ;
294
+ }
296
295
297
296
throw data ;
298
297
} catch ( error ) {
@@ -381,7 +380,6 @@ export class Qiita {
381
380
return this . delete ( `${ this . endpoint } ${ this . version } /access_tokens/${ token } ` ) ;
382
381
}
383
382
384
-
385
383
/**
386
384
* コメントを取得します。
387
385
* @param commentId コメントのID
@@ -414,7 +412,7 @@ export class Qiita {
414
412
* @param commentId コメントID
415
413
* @return 絵文字リアクション
416
414
*/
417
- public fetchCommentReactions = ( commentId : string , name : string ) : Promise < Qiita . Reaction [ ] > => {
415
+ public fetchCommentReactions = ( commentId : string ) : Promise < Qiita . Reaction [ ] > => {
418
416
return this . get ( `${ this . endpoint } ${ this . version } /comments/${ commentId } /reactions` ) ;
419
417
}
420
418
@@ -438,7 +436,6 @@ export class Qiita {
438
436
return this . delete ( `${ this . endpoint } ${ this . version } /comments/${ commentId } /reactions` , { name } ) ;
439
437
}
440
438
441
-
442
439
/**
443
440
* タグ一覧を作成日時の降順で返します。
444
441
* @param page ページ番号 (1から100まで)
@@ -504,7 +501,6 @@ export class Qiita {
504
501
} ) ;
505
502
}
506
503
507
-
508
504
/**
509
505
* チーム内のテンプレート一覧を返します。
510
506
* @param page ページ番号 (1から100まで)
@@ -560,7 +556,6 @@ export class Qiita {
560
556
return this . delete ( `${ this . endpoint } ${ this . version } /templates/${ templateId } ` ) ;
561
557
}
562
558
563
-
564
559
/**
565
560
* チーム内に存在するプロジェクト一覧をプロジェクト作成日時の降順で返します。
566
561
* @param page ページ番号 (1から100まで)
@@ -664,7 +659,6 @@ export class Qiita {
664
659
return this . delete ( `${ this . endpoint } ${ this . version } /projects/${ projectId } /reactions` , { name } ) ;
665
660
}
666
661
667
-
668
662
/**
669
663
* 全てのユーザの一覧を作成日時の降順で取得します。
670
664
* @param page ページ番号 (1から100まで)
@@ -698,7 +692,7 @@ export class Qiita {
698
692
return this . get ( `${ this . endpoint } ${ this . version } /users/${ userId } /followees` , {
699
693
page,
700
694
per_page : perPage ,
701
- } )
695
+ } ) ;
702
696
}
703
697
704
698
/**
@@ -712,7 +706,7 @@ export class Qiita {
712
706
return this . get ( `${ this . endpoint } ${ this . version } /users/${ userId } /followers` , {
713
707
page,
714
708
per_page : perPage ,
715
- } )
709
+ } ) ;
716
710
}
717
711
718
712
/**
@@ -792,7 +786,11 @@ export class Qiita {
792
786
* @return 投稿一覧
793
787
*/
794
788
public fetchItems = ( page : string , perPage : string , query : string ) : Promise < Qiita . Item [ ] > => {
795
- return this . get ( `${ this . endpoint } ${ this . version } /items` ) ;
789
+ return this . get ( `${ this . endpoint } ${ this . version } /items` , {
790
+ page,
791
+ per_page : perPage ,
792
+ query,
793
+ } ) ;
796
794
}
797
795
798
796
/**
@@ -999,7 +997,6 @@ export class Qiita {
999
997
return this . post ( `${ this . endpoint } ${ this . version } /items/${ itemId } /comments` , { body } ) ;
1000
998
}
1001
999
1002
-
1003
1000
/**
1004
1001
* 投稿にタグを追加します。Qiita:Teamでのみ有効です。
1005
1002
* @param itemId 投稿のID
@@ -1013,14 +1010,13 @@ export class Qiita {
1013
1010
/**
1014
1011
* 投稿から指定されたタグを取り除きます。Qiita:Teamでのみ有効です。
1015
1012
* @param itemId 投稿のID
1016
- * @param taggingId タギングのID
1013
+ * @param tagId タギングのID
1017
1014
* @return 空のオブジェクト
1018
1015
*/
1019
- public removeItemTag = ( itemId , taggingId ) : Promise < { } > => {
1020
- return this . delete ( `${ this . endpoint } ${ this . version } /items/${ itemId } /taggings/${ taggingId } ` ) ;
1016
+ public removeItemTag = ( itemId : string , tagId : string ) : Promise < { } > => {
1017
+ return this . delete ( `${ this . endpoint } ${ this . version } /items/${ itemId } /taggings/${ tagId } ` ) ;
1021
1018
}
1022
1019
1023
-
1024
1020
/**
1025
1021
* ユーザが所属している全てのチームを、チーム作成日時の降順で返します。
1026
1022
* @return チーム一覧
@@ -1068,6 +1064,9 @@ export class Qiita {
1068
1064
* @return 投稿一覧
1069
1065
*/
1070
1066
public fetchMyItems = ( page : string , perPage : string ) : Promise < Qiita . Item [ ] > => {
1071
- return this . get ( `${ this . endpoint } ${ this . version } /authenticated_user/items` ) ;
1067
+ return this . get ( `${ this . endpoint } ${ this . version } /authenticated_user/items` , {
1068
+ page,
1069
+ per_page : perPage ,
1070
+ } ) ;
1072
1071
}
1073
1072
}
0 commit comments