From df00e8d305dbb480849cb50c13656c6423bcd2b0 Mon Sep 17 00:00:00 2001 From: Makoto Motohashi Date: Tue, 23 May 2023 11:47:56 +0900 Subject: [PATCH] Add responce types for Wiki, WikiListItem, RecentlyViewedIssue, RecentlyViewedWiki, RecentlyViewedProject #28 --- dist/types/backlog.d.ts | 16 ++++++++-------- dist/types/entity.d.ts | 36 ++++++++++++++++++++++++++++++++++++ src/backlog.ts | 16 ++++++++-------- src/entity.ts | 41 +++++++++++++++++++++++++++++++++++++++++ 4 files changed, 93 insertions(+), 16 deletions(-) diff --git a/dist/types/backlog.d.ts b/dist/types/backlog.d.ts index 18d6c57..33f2a5d 100644 --- a/dist/types/backlog.d.ts +++ b/dist/types/backlog.d.ts @@ -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; + getRecentlyViewedIssues(params: Option.User.GetRecentlyViewedParams): Promise; /** * https://developer.nulab.com/docs/backlog/api/2/get-list-of-recently-viewed-projects/ */ - getRecentlyViewedProjects(params: Option.User.GetRecentlyViewedParams): Promise; + getRecentlyViewedProjects(params: Option.User.GetRecentlyViewedParams): Promise; /** * https://developer.nulab.com/docs/backlog/api/2/get-list-of-recently-viewed-wikis/ */ - getRecentlyViewedWikis(params: Option.User.GetRecentlyViewedParams): Promise; + getRecentlyViewedWikis(params: Option.User.GetRecentlyViewedParams): Promise; /** * https://developer.nulab.com/docs/backlog/api/2/get-list-of-groups/ * @deprecated @@ -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; + getWikis(params: Option.Wiki.GetWikiParams): Promise; /** * https://developer.nulab.com/docs/backlog/api/2/count-wiki-page/ */ @@ -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; + postWiki(params: Option.Wiki.PostWikiParams): Promise; /** * https://developer.nulab.com/docs/backlog/api/2/get-wiki-page/ */ - getWiki(wikiId: number): Promise; + getWiki(wikiId: number): Promise; /** * https://developer.nulab.com/docs/backlog/api/2/update-wiki-page/ */ - patchWiki(wikiId: number, params: Option.Wiki.PatchWikiParams): Promise; + patchWiki(wikiId: number, params: Option.Wiki.PatchWikiParams): Promise; /** * https://developer.nulab.com/docs/backlog/api/2/delete-wiki-page/ */ - deleteWiki(wikiId: number, mailNotify: boolean): Promise; + deleteWiki(wikiId: number, mailNotify: boolean): Promise; /** * https://developer.nulab.com/docs/backlog/api/2/get-list-of-wiki-attachments/ */ diff --git a/dist/types/entity.d.ts b/dist/types/entity.d.ts index edc691d..40d024e 100644 --- a/dist/types/entity.d.ts +++ b/dist/types/entity.d.ts @@ -72,6 +72,10 @@ export declare namespace Project { displayOrder: number; useDevAttributes: boolean; } + interface RecentlyViewedProject { + project: Project; + updated: string; + } interface Status { id: number; name: string; @@ -208,6 +212,10 @@ export declare namespace Issue { sharedFiles: Project.SharedFile[]; stars: Star.Star[]; } + interface RecentlyViewedIssue { + issue: Issue; + updated: string; + } interface IssueCount { count: number; } @@ -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; } diff --git a/src/backlog.ts b/src/backlog.ts index e45f7bf..6faff21 100644 --- a/src/backlog.ts +++ b/src/backlog.ts @@ -146,7 +146,7 @@ export default class Backlog extends Request { */ public getRecentlyViewedIssues( params: Option.User.GetRecentlyViewedParams - ): Promise { + ): Promise { return this.get('users/myself/recentlyViewedIssues', params); } @@ -155,7 +155,7 @@ export default class Backlog extends Request { */ public getRecentlyViewedProjects( params: Option.User.GetRecentlyViewedParams - ): Promise { + ): Promise { return this.get('users/myself/recentlyViewedProjects', params); } @@ -164,7 +164,7 @@ export default class Backlog extends Request { */ public getRecentlyViewedWikis( params: Option.User.GetRecentlyViewedParams - ): Promise { + ): Promise { return this.get('users/myself/recentlyViewedWikis', params); } @@ -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 { + public getWikis(params: Option.Wiki.GetWikiParams): Promise { return this.get(`wikis`, params); } @@ -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 { + public postWiki(params: Option.Wiki.PostWikiParams): Promise { return this.post(`wikis`, params); } /** * https://developer.nulab.com/docs/backlog/api/2/get-wiki-page/ */ - public getWiki(wikiId: number): Promise { + public getWiki(wikiId: number): Promise { return this.get(`wikis/${wikiId}`); } @@ -819,14 +819,14 @@ export default class Backlog extends Request { */ public patchWiki( wikiId: number, params: Option.Wiki.PatchWikiParams - ): Promise { + ): Promise { return this.patch(`wikis/${wikiId}`, params); } /** * https://developer.nulab.com/docs/backlog/api/2/delete-wiki-page/ */ - public deleteWiki(wikiId: number, mailNotify: boolean): Promise { + public deleteWiki(wikiId: number, mailNotify: boolean): Promise { return this.delete(`wikis/${wikiId}`, { mailNotify }); } diff --git a/src/entity.ts b/src/entity.ts index b620fde..661a3f4 100644 --- a/src/entity.ts +++ b/src/entity.ts @@ -85,6 +85,11 @@ export namespace Project { useDevAttributes: boolean; } + export interface RecentlyViewedProject { + project: Project; + updated: string; + } + /* * @deprecated */ @@ -240,6 +245,11 @@ export namespace Issue { stars: Star.Star[]; } + export interface RecentlyViewedIssue { + issue: Issue; + updated: string; + } + export interface IssueCount { count: number; } @@ -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; }