Skip to content

Commit

Permalink
Add type annotation for parameters #90
Browse files Browse the repository at this point in the history
  • Loading branch information
mmktomato committed Jul 17, 2024
1 parent ec93aaa commit 1fc50aa
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 4 deletions.
4 changes: 2 additions & 2 deletions dist/types/backlog.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -550,7 +550,7 @@ export default class Backlog extends Request {
/**
* https://developer.nulab.com/docs/backlog/api/2/add-watching
*/
postWatchingListItem(params: any): Promise<Entity.WatchingList.WatchingListItem>;
postWatchingListItem(params: Option.WatchingList.PostWatchingListItemParams): Promise<Entity.WatchingList.WatchingListItem>;
/**
* https://developer.nulab.com/docs/backlog/api/2/update-watching
*/
Expand All @@ -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<Entity.Group.Group>;
postProjectGroup(projectIdOrKey: string | number, params: Option.Group.PostProjectGroupParams): Promise<Entity.Group.Group>;
/**
* https://developer.nulab.com/docs/backlog/api/2/delete-project-group
* @deprecated
Expand Down
9 changes: 9 additions & 0 deletions dist/types/option.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -75,6 +81,9 @@ export declare namespace Group {
name?: string;
members?: string[];
}
interface PostProjectGroupParams {
groupId: number;
}
}
export declare namespace Team {
interface GetTeamsParams {
Expand Down
9 changes: 7 additions & 2 deletions src/backlog.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<Entity.WatchingList.WatchingListItem> {
public postWatchingListItem(
params: Option.WatchingList.PostWatchingListItemParams,
): Promise<Entity.WatchingList.WatchingListItem> {
return this.post(`watchings`, params);
}

Expand Down Expand Up @@ -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<Entity.Group.Group> {
public postProjectGroup(
projectIdOrKey: string | number,
params: Option.Group.PostProjectGroupParams,
): Promise<Entity.Group.Group> {
console.warn("Deprecated: Use postProjectTeam instead.");
return this.post(`projects/${projectIdOrKey}/groups`, params);
}
Expand Down
10 changes: 10 additions & 0 deletions src/option.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,13 @@

}

export namespace WatchingList {
export interface PostWatchingListItemParams {
issueIdOrKey: string | number;
note: string;
}
}

export namespace Group {

export interface GetGroupsParams {
Expand All @@ -97,6 +104,9 @@
members?: string[];
}

export interface PostProjectGroupParams {
groupId: number;
}
}

export namespace Team {
Expand Down

0 comments on commit 1fc50aa

Please sign in to comment.