Skip to content

Commit 4996682

Browse files
committed
Experimental: タグ検索をサポート
1 parent 7986b39 commit 4996682

File tree

2 files changed

+17
-9
lines changed

2 files changed

+17
-9
lines changed

src/client/Qiita.ts

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { Gateway } from './Gateway';
2+
import * as options from './options';
23

34
import { AccessToken } from '../entities/AccessToken';
45
import { AuthenticatedUser } from '../entities/AuthenticatedUser';
@@ -125,17 +126,14 @@ export class Qiita extends Gateway {
125126

126127
/**
127128
* タグ一覧を作成日時の降順で返します。
128-
* @param page ページ番号 (1から100まで)
129-
* @param perPage 1ページあたりに含まれる要素数 (1から100まで)
130-
* @param sort 並び順 (countで投稿数順、nameで名前順)
129+
* @param options.page ページ番号 (1から100まで)
130+
* @param options.perPage 1ページあたりに含まれる要素数 (1から100まで)
131+
* @param options.sort 並び順 (countで投稿数順、nameで名前順)
132+
* @param options.q [ドキュメント記載無し]
131133
* @return タグ一覧を返す非同期反復可能オブジェクト
132134
*/
133-
public fetchTags = (page: string, perPage: string, sort: string) => {
134-
return this.paginationGenerator<Tag[]>(`${this.url}${this.version}/tags`, {
135-
page,
136-
per_page: perPage,
137-
sort,
138-
});
135+
public fetchTags = (options?: options.FetchTagsOptions) => {
136+
return this.paginationGenerator<Tag[]>(`${this.url}${this.version}/tags`, options);
139137
}
140138

141139
/**

src/client/options.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
export interface FetchTagsOptions {
2+
/** ページ番号 (1から100まで) */
3+
page?: string;
4+
/** 1ページあたりに含まれる要素数 (1から100まで) */
5+
perPage?: string;
6+
/** 並び順 (countで投稿数順、nameで名前順) */
7+
sort?: 'count'|'name';
8+
/** [ドキュメント記載無し] */
9+
q?: string;
10+
}

0 commit comments

Comments
 (0)