Skip to content

Commit 556e2dc

Browse files
committed
実験的に searchTags 関数を追加
1 parent 043ac8d commit 556e2dc

File tree

2 files changed

+17
-1
lines changed

2 files changed

+17
-1
lines changed

src/client/Qiita.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import { Item } from '../entities/Item';
88
import { Like } from '../entities/Like';
99
import { Project } from '../entities/Project';
1010
import { Reaction } from '../entities/Reaction';
11-
import { Tag } from '../entities/Tag';
11+
import { SearchTagResult, Tag } from '../entities/Tag';
1212
import { Tagging } from '../entities/Tagging';
1313
import { Team } from '../entities/Team';
1414
import { TeamInvitation } from '../entities/TeamInvitation';
@@ -201,6 +201,15 @@ export class Qiita extends Gateway {
201201
return this.get<Template>(`${this.url}${this.version}/templates/${template_id}`);
202202
}
203203

204+
/**
205+
* [実験的] タグを検索します
206+
* @param q 検索クエリ文字列
207+
* @return タグの配列
208+
*/
209+
public searchTags = (q: string) => {
210+
return this.get<SearchTagResult>(`${this.url}/api/tags`, { q });
211+
}
212+
204213
/**
205214
* 新しくテンプレートを作成します。
206215
* @param options.body テンプレートの本文

src/entities/Tag.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,10 @@ export interface Tag {
88
/** このタグが付けられた投稿の数 */
99
items_count: number;
1010
}
11+
12+
export interface SearchTagResult extends Pick<Tag, 'icon_url'> {
13+
name: string;
14+
url_name: string;
15+
follower_count: number;
16+
item_count: number;
17+
}

0 commit comments

Comments
 (0)