Skip to content

Commit

Permalink
Add responce types for Tag, History, WikiCount #28
Browse files Browse the repository at this point in the history
  • Loading branch information
Makoto Motohashi committed May 22, 2023
1 parent 644fbfa commit 53da8fb
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 6 deletions.
6 changes: 3 additions & 3 deletions dist/types/backlog.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -397,11 +397,11 @@ export default class Backlog extends Request {
/**
* https://developer.nulab.com/docs/backlog/api/2/count-wiki-page/
*/
getWikisCount(projectIdOrKey: string | number): Promise<any>;
getWikisCount(projectIdOrKey: string | number): Promise<Entity.Wiki.WikiCount>;
/**
* https://developer.nulab.com/docs/backlog/api/2/get-wiki-page-tag-list/
*/
getWikisTags(projectIdOrKey: string | number): Promise<any>;
getWikisTags(projectIdOrKey: string | number): Promise<Entity.Wiki.Tag[]>;
/**
* https://developer.nulab.com/docs/backlog/api/2/add-wiki-page/
*/
Expand Down Expand Up @@ -449,7 +449,7 @@ export default class Backlog extends Request {
/**
* https://developer.nulab.com/docs/backlog/api/2/get-wiki-page-history/
*/
getWikisHistory(wikiId: number, params: Option.Wiki.GetWikisHistoryParams): Promise<any>;
getWikisHistory(wikiId: number, params: Option.Wiki.GetWikisHistoryParams): Promise<Entity.Wiki.History[]>;
/**
* https://developer.nulab.com/docs/backlog/api/2/get-wiki-page-star/
*/
Expand Down
17 changes: 17 additions & 0 deletions dist/types/entity.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -225,3 +225,20 @@ export declare namespace Star {
count: number;
}
}
export declare namespace Wiki {
interface Tag {
id: number;
name: string;
}
interface History {
pageId: number;
version: number;
name: string;
content: string;
createdUser: User.User;
created: string;
}
interface WikiCount {
count: number;
}
}
6 changes: 3 additions & 3 deletions src/backlog.ts
Original file line number Diff line number Diff line change
Expand Up @@ -789,14 +789,14 @@ export default class Backlog extends Request {
/**
* https://developer.nulab.com/docs/backlog/api/2/count-wiki-page/
*/
public getWikisCount(projectIdOrKey: string | number): Promise<any> {
public getWikisCount(projectIdOrKey: string | number): Promise<Entity.Wiki.WikiCount> {
return this.get(`wikis/count`, { projectIdOrKey });
}

/**
* https://developer.nulab.com/docs/backlog/api/2/get-wiki-page-tag-list/
*/
public getWikisTags(projectIdOrKey: string | number): Promise<any> {
public getWikisTags(projectIdOrKey: string | number): Promise<Entity.Wiki.Tag[]> {
return this.get(`wikis/tags`, { projectIdOrKey });
}

Expand Down Expand Up @@ -884,7 +884,7 @@ export default class Backlog extends Request {
*/
public getWikisHistory(
wikiId: number, params: Option.Wiki.GetWikisHistoryParams
): Promise<any> {
): Promise<Entity.Wiki.History[]> {
return this.get(`wikis/${wikiId}/history`, params);
}

Expand Down
20 changes: 20 additions & 0 deletions src/entity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -258,4 +258,24 @@ export namespace Star {
export interface StarCount {
count: number;
}
}

export namespace Wiki {
export interface Tag {
id: number;
name: string;
}

export interface History {
pageId: number;
version: number;
name: string;
content: string;
createdUser: User.User;
created: string;
}

export interface WikiCount {
count: number;
}
}

0 comments on commit 53da8fb

Please sign in to comment.