Skip to content

Commit

Permalink
Merge pull request #93 from nulab/90/Add-type-annotation-for-parameters
Browse files Browse the repository at this point in the history
Add type annotation for parameters
  • Loading branch information
mmktomato authored Jul 17, 2024
2 parents ec93aaa + 77b7b43 commit b71e874
Show file tree
Hide file tree
Showing 4 changed files with 52 additions and 5 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
21 changes: 21 additions & 0 deletions dist/types/option.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,20 +61,41 @@ export declare namespace User {
count?: number;
}
}
export declare namespace WatchingList {
interface PostWatchingListItemParams {
issueIdOrKey: string | number;
note: string;
}
}
export declare namespace Group {
/**
* @deprecated
*/
interface GetGroupsParams {
order?: Order;
offset?: number;
count?: number;
}
/**
* @deprecated
*/
interface PostGroupsParams {
name: string;
members?: string[];
}
/**
* @deprecated
*/
interface PatchGroupParams {
name?: string;
members?: string[];
}
/**
* @deprecated
*/
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
23 changes: 22 additions & 1 deletion src/option.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,24 +79,45 @@

}

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

export namespace Group {
/**
* @deprecated
*/
export interface GetGroupsParams {
order?: Order;
offset?: number;
count?: number;
}

/**
* @deprecated
*/
export interface PostGroupsParams {
name: string;
members?: string[];
}

/**
* @deprecated
*/
export interface PatchGroupParams {
name?: string;
members?: string[];
}

/**
* @deprecated
*/
export interface PostProjectGroupParams {
groupId: number;
}
}

export namespace Team {
Expand Down

0 comments on commit b71e874

Please sign in to comment.