Skip to content

Commit d56ffcd

Browse files
committed
Gateway: setに対応するget関数を追加
1 parent 64b2142 commit d56ffcd

File tree

1 file changed

+23
-3
lines changed

1 file changed

+23
-3
lines changed

src/client/Gateway.ts

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,13 @@ export abstract class Gateway {
1717
/** ユーザーのアクセストークンです */
1818
protected token = '';
1919

20-
/** APIバージョンを示すロケーションです */
20+
/** APIバージョンを示すパスです */
2121
protected version = '/api/v2';
2222

2323
/**
2424
* @param options オプショナルなパラメーター
2525
* @param options.url Qiitaのホストです
26-
* @param options.version APIバージョンを示すロケーションです
26+
* @param options.version APIバージョンを示すパスです
2727
* @param options.token ユーザーのアクセストークンです
2828
*/
2929
constructor (options?: { url?: string, token?: string, version?: string }) {
@@ -50,7 +50,7 @@ export abstract class Gateway {
5050
}
5151

5252
/**
53-
* Qiita Teamへのエンドポイントを設定します
53+
* QiitaへのURLを設定します
5454
* @param url Qiitaのホスト
5555
* @return 何も返しません
5656
*/
@@ -69,6 +69,26 @@ export abstract class Gateway {
6969
this.version = version.replace(/\/$/, '');
7070
}
7171

72+
/**
73+
* APIクライアントに設定されたトークンを返します
74+
* トークンの取得を行うには `Qiita.fetchAccessToken` をご利用ください。
75+
* @return 設定されたトークン
76+
*/
77+
public getToken = () => this.token;
78+
79+
/**
80+
* APIクライアントに設定されたURLを返します
81+
* @return 設定されたURL
82+
*/
83+
public getUrl = () => this.url;
84+
85+
/**
86+
* APIクライアントに設定されたバージョンを示すパスを返します
87+
* @return 設定されたパス
88+
*/
89+
public getVersion = () => this.version;
90+
91+
7292
/**
7393
* Fetch APIのラッパー関数です
7494
* @param url リクエストするURLです

0 commit comments

Comments
 (0)