Skip to content

Commit

Permalink
Add responce types for IssueType, Priority, Resolution, Start #28
Browse files Browse the repository at this point in the history
  • Loading branch information
Makoto Motohashi committed May 15, 2023
1 parent 3758ad2 commit 59e3e89
Show file tree
Hide file tree
Showing 8 changed files with 106 additions and 37 deletions.
20 changes: 10 additions & 10 deletions dist/types/backlog.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,11 +71,11 @@ export default class Backlog extends Request {
/**
* https://developer.nulab.com/docs/backlog/api/2/get-received-star-list/
*/
getUserStars(userId: number, params: Option.User.GetUserStarsParams): Promise<any>;
getUserStars(userId: number, params: Option.User.GetUserStarsParams): Promise<Entity.Star.Star[]>;
/**
* https://developer.nulab.com/docs/backlog/api/2/count-user-received-stars/
*/
getUserStarsCount(userId: number, params: Option.User.GetUserStarsCountParams): Promise<any>;
getUserStarsCount(userId: number, params: Option.User.GetUserStarsCountParams): Promise<Entity.Star.StarCount>;
/**
* https://developer.nulab.com/docs/backlog/api/2/get-list-of-recently-viewed-issues/
*/
Expand Down Expand Up @@ -125,11 +125,11 @@ export default class Backlog extends Request {
/**
* https://developer.nulab.com/docs/backlog/api/2/get-resolution-list/
*/
getResolutions(): Promise<any>;
getResolutions(): Promise<Entity.Issue.Resolution[]>;
/**
* https://developer.nulab.com/docs/backlog/api/2/get-priority-list/
*/
getPriorities(): Promise<any>;
getPriorities(): Promise<Entity.Issue.Priority[]>;
/**
* https://developer.nulab.com/docs/backlog/api/2/get-project-list/
*/
Expand Down Expand Up @@ -201,19 +201,19 @@ export default class Backlog extends Request {
/**
* https://developer.nulab.com/docs/backlog/api/2/get-issue-type-list/
*/
getIssueTypes(projectIdOrKey: string | number): Promise<any>;
getIssueTypes(projectIdOrKey: string | number): Promise<Entity.Issue.IssueType[]>;
/**
* https://developer.nulab.com/docs/backlog/api/2/add-issue-type/
*/
postIssueType(projectIdOrKey: string | number, params: Option.Project.PostIssueTypeParams): Promise<any>;
postIssueType(projectIdOrKey: string | number, params: Option.Project.PostIssueTypeParams): Promise<Entity.Issue.IssueType>;
/**
* https://developer.nulab.com/docs/backlog/api/2/update-issue-type/
*/
patchIssueType(projectIdOrKey: string | number, id: number, params: Option.Project.PatchIssueTypeParams): Promise<any>;
patchIssueType(projectIdOrKey: string | number, id: number, params: Option.Project.PatchIssueTypeParams): Promise<Entity.Issue.IssueType>;
/**
* https://developer.nulab.com/docs/backlog/api/2/delete-issue-type/
*/
deleteIssueType(projectIdOrKey: string | number, id: number, params: Option.Project.DeleteIssueTypeParams): Promise<any>;
deleteIssueType(projectIdOrKey: string | number, id: number, params: Option.Project.DeleteIssueTypeParams): Promise<Entity.Issue.IssueType>;
/**
* https://developer.nulab.com/docs/backlog/api/2/get-category-list/
*/
Expand Down Expand Up @@ -453,11 +453,11 @@ export default class Backlog extends Request {
/**
* https://developer.nulab.com/docs/backlog/api/2/get-wiki-page-star/
*/
getWikisStars(wikiId: number): Promise<any>;
getWikisStars(wikiId: number): Promise<Entity.Star.Star[]>;
/**
* https://developer.nulab.com/docs/backlog/api/2/add-star/
*/
postStar(params: Option.Project.PostStarParams): Promise<any>;
postStar(params: Option.Project.PostStarParams): Promise<void>;
/**
* https://developer.nulab.com/docs/backlog/api/2/get-notification/
*/
Expand Down
32 changes: 32 additions & 0 deletions dist/types/entity.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -112,3 +112,35 @@ export declare namespace DiskUsage {
details: ProjectDiskUsage[];
}
}
export declare namespace Issue {
interface IssueType {
id: number;
projectId: number;
name: string;
color: Types.IssueTypeColor;
displayOrder: number;
templateSummary?: string;
templateDescription?: string;
}
interface Priority {
id: number;
name: string;
}
interface Resolution {
id: number;
name: string;
}
}
export declare namespace Star {
interface Star {
id: number;
comment?: string;
url: string;
title: string;
presenter: User.User;
created: string;
}
interface StarCount {
count: number;
}
}
5 changes: 2 additions & 3 deletions dist/types/option.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -118,14 +118,13 @@ export declare namespace Project {
interface DeleteProjectAdministrators {
userId: number;
}
type IssueTypeColor = "#e30000" | "#990000" | "#934981" | "#814fbc" | "#2779ca" | "#007e9a" | "#7ea800" | "#ff9200" | "#ff3265" | "#666665";
interface PostIssueTypeParams {
name: string;
color: IssueTypeColor;
color: Types.IssueTypeColor;
}
interface PatchIssueTypeParams {
name?: string;
color?: IssueTypeColor;
color?: Types.IssueTypeColor;
}
interface DeleteIssueTypeParams {
substituteIssueTypeId: number;
Expand Down
1 change: 1 addition & 0 deletions dist/types/types.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,3 +44,4 @@ export declare enum ActivityType {
ProjectGroupAdded = 25,
ProjectGroupDeleted = 26
}
export declare type IssueTypeColor = "#e30000" | "#990000" | "#934981" | "#814fbc" | "#2779ca" | "#007e9a" | "#7ea800" | "#ff9200" | "#ff3265" | "#666665";
20 changes: 10 additions & 10 deletions src/backlog.ts
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ export default class Backlog extends Request {
*/
public getUserStars(
userId: number, params: Option.User.GetUserStarsParams
): Promise<any> {
): Promise<Entity.Star.Star[]> {
return this.get(`users/${userId}/stars`, params);
}

Expand All @@ -137,7 +137,7 @@ export default class Backlog extends Request {
*/
public getUserStarsCount(
userId: number, params: Option.User.GetUserStarsCountParams
): Promise<any> {
): Promise<Entity.Star.StarCount> {
return this.get(`users/${userId}/stars/count`, params);
}

Expand Down Expand Up @@ -234,14 +234,14 @@ export default class Backlog extends Request {
/**
* https://developer.nulab.com/docs/backlog/api/2/get-resolution-list/
*/
public getResolutions(): Promise<any> {
public getResolutions(): Promise<Entity.Issue.Resolution[]> {
return this.get('resolutions');
}

/**
* https://developer.nulab.com/docs/backlog/api/2/get-priority-list/
*/
public getPriorities(): Promise<any> {
public getPriorities(): Promise<Entity.Issue.Priority[]> {
return this.get('priorities');
}

Expand Down Expand Up @@ -384,7 +384,7 @@ export default class Backlog extends Request {
/**
* https://developer.nulab.com/docs/backlog/api/2/get-issue-type-list/
*/
public getIssueTypes(projectIdOrKey: string | number): Promise<any> {
public getIssueTypes(projectIdOrKey: string | number): Promise<Entity.Issue.IssueType[]> {
return this.get(`projects/${projectIdOrKey}/issueTypes`);
}

Expand All @@ -393,7 +393,7 @@ export default class Backlog extends Request {
*/
public postIssueType(
projectIdOrKey: string | number, params: Option.Project.PostIssueTypeParams
): Promise<any> {
): Promise<Entity.Issue.IssueType> {
return this.post(`projects/${projectIdOrKey}/issueTypes`, params);
}

Expand All @@ -402,7 +402,7 @@ export default class Backlog extends Request {
*/
public patchIssueType(
projectIdOrKey: string | number, id: number, params: Option.Project.PatchIssueTypeParams
): Promise<any> {
): Promise<Entity.Issue.IssueType> {
return this.patch(`projects/${projectIdOrKey}/issueTypes/${id}`, params);
}

Expand All @@ -411,7 +411,7 @@ export default class Backlog extends Request {
*/
public deleteIssueType(
projectIdOrKey: string | number, id: number, params: Option.Project.DeleteIssueTypeParams
): Promise<any> {
): Promise<Entity.Issue.IssueType> {
return this.delete(`projects/${projectIdOrKey}/issueTypes/${id}`, params);
}

Expand Down Expand Up @@ -891,14 +891,14 @@ export default class Backlog extends Request {
/**
* https://developer.nulab.com/docs/backlog/api/2/get-wiki-page-star/
*/
public getWikisStars(wikiId: number): Promise<any> {
public getWikisStars(wikiId: number): Promise<Entity.Star.Star[]> {
return this.get(`wikis/${wikiId}/stars`);
}

/**
* https://developer.nulab.com/docs/backlog/api/2/add-star/
*/
public postStar(params: Option.Project.PostStarParams): Promise<any> {
public postStar(params: Option.Project.PostStarParams): Promise<void> {
return this.post('stars', params);
}

Expand Down
37 changes: 37 additions & 0 deletions src/entity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -128,4 +128,41 @@ export namespace DiskUsage {
capacity: number;
details: ProjectDiskUsage[];
}
}

export namespace Issue {
export interface IssueType {
id: number;
projectId: number;
name: string;
color: Types.IssueTypeColor;
displayOrder: number;
templateSummary?: string;
templateDescription?: string;
}

export interface Priority {
id: number;
name: string;
}

export interface Resolution {
id: number;
name: string;
}
}

export namespace Star {
export interface Star {
id: number;
comment?: string;
url: string;
title: string;
presenter: User.User;
created: string;
}

export interface StarCount {
count: number;
}
}
16 changes: 2 additions & 14 deletions src/option.ts
Original file line number Diff line number Diff line change
Expand Up @@ -152,26 +152,14 @@
userId: number;
}

export type IssueTypeColor =
"#e30000" |
"#990000" |
"#934981" |
"#814fbc" |
"#2779ca" |
"#007e9a" |
"#7ea800" |
"#ff9200" |
"#ff3265" |
"#666665";

export interface PostIssueTypeParams {
name: string;
color: IssueTypeColor;
color: Types.IssueTypeColor;
}

export interface PatchIssueTypeParams {
name?: string;
color?: IssueTypeColor;
color?: Types.IssueTypeColor;
}

export interface DeleteIssueTypeParams {
Expand Down
12 changes: 12 additions & 0 deletions src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,3 +49,15 @@ export enum ActivityType {
ProjectGroupAdded = 25,
ProjectGroupDeleted = 26,
}

export type IssueTypeColor =
"#e30000" |
"#990000" |
"#934981" |
"#814fbc" |
"#2779ca" |
"#007e9a" |
"#7ea800" |
"#ff9200" |
"#ff3265" |
"#666665";

0 comments on commit 59e3e89

Please sign in to comment.