From 1fc50aa5ac08433c8548c4e6d51d728bb097982e Mon Sep 17 00:00:00 2001 From: mmktomato Date: Wed, 17 Jul 2024 13:59:48 +0900 Subject: [PATCH] Add type annotation for parameters #90 --- dist/types/backlog.d.ts | 4 ++-- dist/types/option.d.ts | 9 +++++++++ src/backlog.ts | 9 +++++++-- src/option.ts | 10 ++++++++++ 4 files changed, 28 insertions(+), 4 deletions(-) diff --git a/dist/types/backlog.d.ts b/dist/types/backlog.d.ts index 112ab30..8eb7d7c 100644 --- a/dist/types/backlog.d.ts +++ b/dist/types/backlog.d.ts @@ -550,7 +550,7 @@ export default class Backlog extends Request { /** * https://developer.nulab.com/docs/backlog/api/2/add-watching */ - postWatchingListItem(params: any): Promise; + postWatchingListItem(params: Option.WatchingList.PostWatchingListItemParams): Promise; /** * https://developer.nulab.com/docs/backlog/api/2/update-watching */ @@ -572,7 +572,7 @@ export default class Backlog extends Request { * https://developer.nulab.com/docs/backlog/api/2/add-project-group * @deprecated */ - postProjectGroup(projectIdOrKey: string | number, params: any): Promise; + postProjectGroup(projectIdOrKey: string | number, params: Option.Group.PostProjectGroupParams): Promise; /** * https://developer.nulab.com/docs/backlog/api/2/delete-project-group * @deprecated diff --git a/dist/types/option.d.ts b/dist/types/option.d.ts index 65d5fb2..d19c37c 100644 --- a/dist/types/option.d.ts +++ b/dist/types/option.d.ts @@ -61,6 +61,12 @@ export declare namespace User { count?: number; } } +export declare namespace WatchingList { + interface PostWatchingListItemParams { + issueIdOrKey: string | number; + note: string; + } +} export declare namespace Group { interface GetGroupsParams { order?: Order; @@ -75,6 +81,9 @@ export declare namespace Group { name?: string; members?: string[]; } + interface PostProjectGroupParams { + groupId: number; + } } export declare namespace Team { interface GetTeamsParams { diff --git a/src/backlog.ts b/src/backlog.ts index 1d48883..1e27cb8 100644 --- a/src/backlog.ts +++ b/src/backlog.ts @@ -1109,7 +1109,9 @@ export default class Backlog extends Request { /** * https://developer.nulab.com/docs/backlog/api/2/add-watching */ - public postWatchingListItem(params: any): Promise { + public postWatchingListItem( + params: Option.WatchingList.PostWatchingListItemParams, + ): Promise { return this.post(`watchings`, params); } @@ -1147,7 +1149,10 @@ export default class Backlog extends Request { * https://developer.nulab.com/docs/backlog/api/2/add-project-group * @deprecated */ - public postProjectGroup(projectIdOrKey: string | number, params: any): Promise { + public postProjectGroup( + projectIdOrKey: string | number, + params: Option.Group.PostProjectGroupParams, + ): Promise { console.warn("Deprecated: Use postProjectTeam instead."); return this.post(`projects/${projectIdOrKey}/groups`, params); } diff --git a/src/option.ts b/src/option.ts index 7aa32a5..9d652ee 100644 --- a/src/option.ts +++ b/src/option.ts @@ -79,6 +79,13 @@ } + export namespace WatchingList { + export interface PostWatchingListItemParams { + issueIdOrKey: string | number; + note: string; + } + } + export namespace Group { export interface GetGroupsParams { @@ -97,6 +104,9 @@ members?: string[]; } + export interface PostProjectGroupParams { + groupId: number; + } } export namespace Team {