Skip to content

Commit 96d7b18

Browse files
committed
Add build related spec
1 parent 0aef496 commit 96d7b18

File tree

4 files changed

+60
-22
lines changed

4 files changed

+60
-22
lines changed

.editorconfig

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# EditorConfig is awesome: http://EditorConfig.org
2+
3+
# top-most EditorConfig file
4+
root = true
5+
6+
[*]
7+
end_of_line = lf
8+
insert_final_newline = true
9+
charset = utf-8
10+
indent_style = space
11+
indent_size = 2

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,3 +59,5 @@ typings/
5959

6060
# next.js build output
6161
.next
62+
63+
dist/*

.npmignore

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# Logs
2+
logs
3+
*.log
4+
npm-debug.log*
5+
yarn-debug.log*
6+
yarn-error.log*
7+
8+
# Runtime data
9+
pids
10+
*.pid
11+
*.seed
12+
*.pid.lock
13+
.env
14+
.DS_Store
15+
16+
# Config files
17+
.editorconfig
18+
tsconfig.json
19+
tslint.json
20+
21+
# Documentaitons
22+
docs/
23+
24+
# TS files and maps
25+
src/
26+
*.map

src/qiita.ts

Lines changed: 21 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,6 @@ export namespace Qiita {
225225

226226
}
227227

228-
229228
export class Qiita {
230229

231230
private token = '';
@@ -237,7 +236,7 @@ export class Qiita {
237236
* @param token トークン文字列
238237
* @return 何も返しません
239238
*/
240-
public setToken(token: string): void {
239+
public setToken (token: string): void {
241240
this.token = token;
242241
}
243242

@@ -246,7 +245,7 @@ export class Qiita {
246245
* @param endpoint エンドポイントへのURI
247246
* @return 何も返しません
248247
*/
249-
public setEndpoint(endpoint: string): void {
248+
public setEndpoint (endpoint: string): void {
250249
this.endpoint = endpoint;
251250
}
252251

@@ -255,7 +254,7 @@ export class Qiita {
255254
* @param version APIへのパスの文字列 (e.g. `/api/v2`)
256255
* @return 何も返しません
257256
*/
258-
public setVersion(version: string): void {
257+
public setVersion (version: string): void {
259258
this.version = version;
260259
}
261260

@@ -274,7 +273,7 @@ export class Qiita {
274273
}
275274

276275
if (this.token) {
277-
options.headers['Authorization'] = `Bearer ${this.token}`;
276+
options.headers.Authorization = `Bearer ${this.token}`;
278277
}
279278

280279
options.headers['Content-Type'] = 'application/json';
@@ -291,8 +290,8 @@ export class Qiita {
291290
const data = await response.json();
292291

293292
if (response.ok) {
294-
return data
295-
};
293+
return data;
294+
}
296295

297296
throw data;
298297
} catch (error) {
@@ -381,7 +380,6 @@ export class Qiita {
381380
return this.delete(`${this.endpoint}${this.version}/access_tokens/${token}`);
382381
}
383382

384-
385383
/**
386384
* コメントを取得します。
387385
* @param commentId コメントのID
@@ -414,7 +412,7 @@ export class Qiita {
414412
* @param commentId コメントID
415413
* @return 絵文字リアクション
416414
*/
417-
public fetchCommentReactions = (commentId: string, name: string): Promise<Qiita.Reaction[]> => {
415+
public fetchCommentReactions = (commentId: string): Promise<Qiita.Reaction[]> => {
418416
return this.get(`${this.endpoint}${this.version}/comments/${commentId}/reactions`);
419417
}
420418

@@ -438,7 +436,6 @@ export class Qiita {
438436
return this.delete(`${this.endpoint}${this.version}/comments/${commentId}/reactions`, { name });
439437
}
440438

441-
442439
/**
443440
* タグ一覧を作成日時の降順で返します。
444441
* @param page ページ番号 (1から100まで)
@@ -504,7 +501,6 @@ export class Qiita {
504501
});
505502
}
506503

507-
508504
/**
509505
* チーム内のテンプレート一覧を返します。
510506
* @param page ページ番号 (1から100まで)
@@ -560,7 +556,6 @@ export class Qiita {
560556
return this.delete(`${this.endpoint}${this.version}/templates/${templateId}`);
561557
}
562558

563-
564559
/**
565560
* チーム内に存在するプロジェクト一覧をプロジェクト作成日時の降順で返します。
566561
* @param page ページ番号 (1から100まで)
@@ -664,7 +659,6 @@ export class Qiita {
664659
return this.delete(`${this.endpoint}${this.version}/projects/${projectId}/reactions`, { name });
665660
}
666661

667-
668662
/**
669663
* 全てのユーザの一覧を作成日時の降順で取得します。
670664
* @param page ページ番号 (1から100まで)
@@ -698,7 +692,7 @@ export class Qiita {
698692
return this.get(`${this.endpoint}${this.version}/users/${userId}/followees`, {
699693
page,
700694
per_page: perPage,
701-
})
695+
});
702696
}
703697

704698
/**
@@ -712,7 +706,7 @@ export class Qiita {
712706
return this.get(`${this.endpoint}${this.version}/users/${userId}/followers`, {
713707
page,
714708
per_page: perPage,
715-
})
709+
});
716710
}
717711

718712
/**
@@ -792,7 +786,11 @@ export class Qiita {
792786
* @return 投稿一覧
793787
*/
794788
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+
});
796794
}
797795

798796
/**
@@ -999,7 +997,6 @@ export class Qiita {
999997
return this.post(`${this.endpoint}${this.version}/items/${itemId}/comments`, { body });
1000998
}
1001999

1002-
10031000
/**
10041001
* 投稿にタグを追加します。Qiita:Teamでのみ有効です。
10051002
* @param itemId 投稿のID
@@ -1013,14 +1010,13 @@ export class Qiita {
10131010
/**
10141011
* 投稿から指定されたタグを取り除きます。Qiita:Teamでのみ有効です。
10151012
* @param itemId 投稿のID
1016-
* @param taggingId タギングのID
1013+
* @param tagId タギングのID
10171014
* @return 空のオブジェクト
10181015
*/
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}`);
10211018
}
10221019

1023-
10241020
/**
10251021
* ユーザが所属している全てのチームを、チーム作成日時の降順で返します。
10261022
* @return チーム一覧
@@ -1068,6 +1064,9 @@ export class Qiita {
10681064
* @return 投稿一覧
10691065
*/
10701066
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+
});
10721071
}
10731072
}

0 commit comments

Comments
 (0)