Skip to content

Commit

Permalink
Add responce types for Wiki, WikiListItem, RecentlyViewedIssue, Recen…
Browse files Browse the repository at this point in the history
…tlyViewedWiki, RecentlyViewedProject #28
  • Loading branch information
Makoto Motohashi committed May 23, 2023
1 parent 53da8fb commit df00e8d
Show file tree
Hide file tree
Showing 4 changed files with 93 additions and 16 deletions.
16 changes: 8 additions & 8 deletions dist/types/backlog.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,15 +79,15 @@ export default class Backlog extends Request {
/**
* https://developer.nulab.com/docs/backlog/api/2/get-list-of-recently-viewed-issues/
*/
getRecentlyViewedIssues(params: Option.User.GetRecentlyViewedParams): Promise<Entity.Issue.Issue[]>;
getRecentlyViewedIssues(params: Option.User.GetRecentlyViewedParams): Promise<Entity.Issue.RecentlyViewedIssue[]>;
/**
* https://developer.nulab.com/docs/backlog/api/2/get-list-of-recently-viewed-projects/
*/
getRecentlyViewedProjects(params: Option.User.GetRecentlyViewedParams): Promise<any>;
getRecentlyViewedProjects(params: Option.User.GetRecentlyViewedParams): Promise<Entity.Project.RecentlyViewedProject[]>;
/**
* https://developer.nulab.com/docs/backlog/api/2/get-list-of-recently-viewed-wikis/
*/
getRecentlyViewedWikis(params: Option.User.GetRecentlyViewedParams): Promise<any>;
getRecentlyViewedWikis(params: Option.User.GetRecentlyViewedParams): Promise<Entity.Wiki.RecentlyViewedWiki[]>;
/**
* https://developer.nulab.com/docs/backlog/api/2/get-list-of-groups/
* @deprecated
Expand Down Expand Up @@ -393,7 +393,7 @@ export default class Backlog extends Request {
/**
* https://developer.nulab.com/docs/backlog/api/2/get-wiki-page-list/
*/
getWikis(params: Option.Wiki.GetWikiParams): Promise<any>;
getWikis(params: Option.Wiki.GetWikiParams): Promise<Entity.Wiki.WikiListItem[]>;
/**
* https://developer.nulab.com/docs/backlog/api/2/count-wiki-page/
*/
Expand All @@ -405,19 +405,19 @@ export default class Backlog extends Request {
/**
* https://developer.nulab.com/docs/backlog/api/2/add-wiki-page/
*/
postWiki(params: Option.Wiki.PostWikiParams): Promise<any>;
postWiki(params: Option.Wiki.PostWikiParams): Promise<Entity.Wiki.Wiki>;
/**
* https://developer.nulab.com/docs/backlog/api/2/get-wiki-page/
*/
getWiki(wikiId: number): Promise<any>;
getWiki(wikiId: number): Promise<Entity.Wiki.Wiki>;
/**
* https://developer.nulab.com/docs/backlog/api/2/update-wiki-page/
*/
patchWiki(wikiId: number, params: Option.Wiki.PatchWikiParams): Promise<any>;
patchWiki(wikiId: number, params: Option.Wiki.PatchWikiParams): Promise<Entity.Wiki.Wiki>;
/**
* https://developer.nulab.com/docs/backlog/api/2/delete-wiki-page/
*/
deleteWiki(wikiId: number, mailNotify: boolean): Promise<any>;
deleteWiki(wikiId: number, mailNotify: boolean): Promise<Entity.Wiki.Wiki>;
/**
* https://developer.nulab.com/docs/backlog/api/2/get-list-of-wiki-attachments/
*/
Expand Down
36 changes: 36 additions & 0 deletions dist/types/entity.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,10 @@ export declare namespace Project {
displayOrder: number;
useDevAttributes: boolean;
}
interface RecentlyViewedProject {
project: Project;
updated: string;
}
interface Status {
id: number;
name: string;
Expand Down Expand Up @@ -208,6 +212,10 @@ export declare namespace Issue {
sharedFiles: Project.SharedFile[];
stars: Star.Star[];
}
interface RecentlyViewedIssue {
issue: Issue;
updated: string;
}
interface IssueCount {
count: number;
}
Expand Down Expand Up @@ -238,6 +246,34 @@ export declare namespace Wiki {
createdUser: User.User;
created: string;
}
interface WikiListItem {
id: number;
projectId: number;
name: string;
tags: Tag[];
createdUser: User.User;
created: string;
updatedUser: User.User;
updated: string;
}
interface Wiki {
id: number;
projectId: number;
name: string;
content: string;
tags: Tag[];
attachments: File.WikiFileInfo[];
sharedFiles: Project.SharedFile[];
stars: Star.Star[];
createdUser: User.User;
created: string;
updatedUser: User.User;
updated: string;
}
interface RecentlyViewedWiki {
page: WikiListItem;
updated: string;
}
interface WikiCount {
count: number;
}
Expand Down
16 changes: 8 additions & 8 deletions src/backlog.ts
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ export default class Backlog extends Request {
*/
public getRecentlyViewedIssues(
params: Option.User.GetRecentlyViewedParams
): Promise<Entity.Issue.Issue[]> {
): Promise<Entity.Issue.RecentlyViewedIssue[]> {
return this.get('users/myself/recentlyViewedIssues', params);
}

Expand All @@ -155,7 +155,7 @@ export default class Backlog extends Request {
*/
public getRecentlyViewedProjects(
params: Option.User.GetRecentlyViewedParams
): Promise<any> {
): Promise<Entity.Project.RecentlyViewedProject[]> {
return this.get('users/myself/recentlyViewedProjects', params);
}

Expand All @@ -164,7 +164,7 @@ export default class Backlog extends Request {
*/
public getRecentlyViewedWikis(
params: Option.User.GetRecentlyViewedParams
): Promise<any> {
): Promise<Entity.Wiki.RecentlyViewedWiki[]> {
return this.get('users/myself/recentlyViewedWikis', params);
}

Expand Down Expand Up @@ -782,7 +782,7 @@ export default class Backlog extends Request {
/**
* https://developer.nulab.com/docs/backlog/api/2/get-wiki-page-list/
*/
public getWikis(params: Option.Wiki.GetWikiParams): Promise<any> {
public getWikis(params: Option.Wiki.GetWikiParams): Promise<Entity.Wiki.WikiListItem[]> {
return this.get(`wikis`, params);
}

Expand All @@ -803,14 +803,14 @@ export default class Backlog extends Request {
/**
* https://developer.nulab.com/docs/backlog/api/2/add-wiki-page/
*/
public postWiki(params: Option.Wiki.PostWikiParams): Promise<any> {
public postWiki(params: Option.Wiki.PostWikiParams): Promise<Entity.Wiki.Wiki> {
return this.post(`wikis`, params);
}

/**
* https://developer.nulab.com/docs/backlog/api/2/get-wiki-page/
*/
public getWiki(wikiId: number): Promise<any> {
public getWiki(wikiId: number): Promise<Entity.Wiki.Wiki> {
return this.get(`wikis/${wikiId}`);
}

Expand All @@ -819,14 +819,14 @@ export default class Backlog extends Request {
*/
public patchWiki(
wikiId: number, params: Option.Wiki.PatchWikiParams
): Promise<any> {
): Promise<Entity.Wiki.Wiki> {
return this.patch(`wikis/${wikiId}`, params);
}

/**
* https://developer.nulab.com/docs/backlog/api/2/delete-wiki-page/
*/
public deleteWiki(wikiId: number, mailNotify: boolean): Promise<any> {
public deleteWiki(wikiId: number, mailNotify: boolean): Promise<Entity.Wiki.Wiki> {
return this.delete(`wikis/${wikiId}`, { mailNotify });
}

Expand Down
41 changes: 41 additions & 0 deletions src/entity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,11 @@ export namespace Project {
useDevAttributes: boolean;
}

export interface RecentlyViewedProject {
project: Project;
updated: string;
}

/*
* @deprecated
*/
Expand Down Expand Up @@ -240,6 +245,11 @@ export namespace Issue {
stars: Star.Star[];
}

export interface RecentlyViewedIssue {
issue: Issue;
updated: string;
}

export interface IssueCount {
count: number;
}
Expand Down Expand Up @@ -275,6 +285,37 @@ export namespace Wiki {
created: string;
}

export interface WikiListItem {
id: number;
projectId: number;
name: string;
tags: Tag[];
createdUser: User.User;
created: string;
updatedUser: User.User;
updated: string;
}

export interface Wiki {
id: number;
projectId: number;
name: string;
content: string;
tags: Tag[];
attachments: File.WikiFileInfo[];
sharedFiles: Project.SharedFile[];
stars: Star.Star[];
createdUser: User.User;
created: string;
updatedUser: User.User;
updated: string;
}

export interface RecentlyViewedWiki {
page: WikiListItem;
updated: string;
}

export interface WikiCount {
count: number;
}
Expand Down

0 comments on commit df00e8d

Please sign in to comment.