From 59e3e89064e9cbb39c6b301a23e2bf7f3123b49d Mon Sep 17 00:00:00 2001 From: Makoto Motohashi Date: Mon, 15 May 2023 15:52:04 +0900 Subject: [PATCH] Add responce types for IssueType, Priority, Resolution, Start #28 --- dist/types/backlog.d.ts | 20 ++++++++++---------- dist/types/entity.d.ts | 32 ++++++++++++++++++++++++++++++++ dist/types/option.d.ts | 5 ++--- dist/types/types.d.ts | 1 + src/backlog.ts | 20 ++++++++++---------- src/entity.ts | 37 +++++++++++++++++++++++++++++++++++++ src/option.ts | 16 ++-------------- src/types.ts | 12 ++++++++++++ 8 files changed, 106 insertions(+), 37 deletions(-) diff --git a/dist/types/backlog.d.ts b/dist/types/backlog.d.ts index 2cd8c10..1544151 100644 --- a/dist/types/backlog.d.ts +++ b/dist/types/backlog.d.ts @@ -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; + getUserStars(userId: number, params: Option.User.GetUserStarsParams): Promise; /** * https://developer.nulab.com/docs/backlog/api/2/count-user-received-stars/ */ - getUserStarsCount(userId: number, params: Option.User.GetUserStarsCountParams): Promise; + getUserStarsCount(userId: number, params: Option.User.GetUserStarsCountParams): Promise; /** * https://developer.nulab.com/docs/backlog/api/2/get-list-of-recently-viewed-issues/ */ @@ -125,11 +125,11 @@ export default class Backlog extends Request { /** * https://developer.nulab.com/docs/backlog/api/2/get-resolution-list/ */ - getResolutions(): Promise; + getResolutions(): Promise; /** * https://developer.nulab.com/docs/backlog/api/2/get-priority-list/ */ - getPriorities(): Promise; + getPriorities(): Promise; /** * https://developer.nulab.com/docs/backlog/api/2/get-project-list/ */ @@ -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; + getIssueTypes(projectIdOrKey: string | number): Promise; /** * https://developer.nulab.com/docs/backlog/api/2/add-issue-type/ */ - postIssueType(projectIdOrKey: string | number, params: Option.Project.PostIssueTypeParams): Promise; + postIssueType(projectIdOrKey: string | number, params: Option.Project.PostIssueTypeParams): Promise; /** * https://developer.nulab.com/docs/backlog/api/2/update-issue-type/ */ - patchIssueType(projectIdOrKey: string | number, id: number, params: Option.Project.PatchIssueTypeParams): Promise; + patchIssueType(projectIdOrKey: string | number, id: number, params: Option.Project.PatchIssueTypeParams): Promise; /** * https://developer.nulab.com/docs/backlog/api/2/delete-issue-type/ */ - deleteIssueType(projectIdOrKey: string | number, id: number, params: Option.Project.DeleteIssueTypeParams): Promise; + deleteIssueType(projectIdOrKey: string | number, id: number, params: Option.Project.DeleteIssueTypeParams): Promise; /** * https://developer.nulab.com/docs/backlog/api/2/get-category-list/ */ @@ -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; + getWikisStars(wikiId: number): Promise; /** * https://developer.nulab.com/docs/backlog/api/2/add-star/ */ - postStar(params: Option.Project.PostStarParams): Promise; + postStar(params: Option.Project.PostStarParams): Promise; /** * https://developer.nulab.com/docs/backlog/api/2/get-notification/ */ diff --git a/dist/types/entity.d.ts b/dist/types/entity.d.ts index a4cb4e7..89c417c 100644 --- a/dist/types/entity.d.ts +++ b/dist/types/entity.d.ts @@ -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; + } +} diff --git a/dist/types/option.d.ts b/dist/types/option.d.ts index 4c3d589..10a3523 100644 --- a/dist/types/option.d.ts +++ b/dist/types/option.d.ts @@ -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; diff --git a/dist/types/types.d.ts b/dist/types/types.d.ts index 86e83cf..d65a875 100644 --- a/dist/types/types.d.ts +++ b/dist/types/types.d.ts @@ -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"; diff --git a/src/backlog.ts b/src/backlog.ts index a64794a..6ff34d3 100644 --- a/src/backlog.ts +++ b/src/backlog.ts @@ -128,7 +128,7 @@ export default class Backlog extends Request { */ public getUserStars( userId: number, params: Option.User.GetUserStarsParams - ): Promise { + ): Promise { return this.get(`users/${userId}/stars`, params); } @@ -137,7 +137,7 @@ export default class Backlog extends Request { */ public getUserStarsCount( userId: number, params: Option.User.GetUserStarsCountParams - ): Promise { + ): Promise { return this.get(`users/${userId}/stars/count`, params); } @@ -234,14 +234,14 @@ export default class Backlog extends Request { /** * https://developer.nulab.com/docs/backlog/api/2/get-resolution-list/ */ - public getResolutions(): Promise { + public getResolutions(): Promise { return this.get('resolutions'); } /** * https://developer.nulab.com/docs/backlog/api/2/get-priority-list/ */ - public getPriorities(): Promise { + public getPriorities(): Promise { return this.get('priorities'); } @@ -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 { + public getIssueTypes(projectIdOrKey: string | number): Promise { return this.get(`projects/${projectIdOrKey}/issueTypes`); } @@ -393,7 +393,7 @@ export default class Backlog extends Request { */ public postIssueType( projectIdOrKey: string | number, params: Option.Project.PostIssueTypeParams - ): Promise { + ): Promise { return this.post(`projects/${projectIdOrKey}/issueTypes`, params); } @@ -402,7 +402,7 @@ export default class Backlog extends Request { */ public patchIssueType( projectIdOrKey: string | number, id: number, params: Option.Project.PatchIssueTypeParams - ): Promise { + ): Promise { return this.patch(`projects/${projectIdOrKey}/issueTypes/${id}`, params); } @@ -411,7 +411,7 @@ export default class Backlog extends Request { */ public deleteIssueType( projectIdOrKey: string | number, id: number, params: Option.Project.DeleteIssueTypeParams - ): Promise { + ): Promise { return this.delete(`projects/${projectIdOrKey}/issueTypes/${id}`, params); } @@ -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 { + public getWikisStars(wikiId: number): Promise { return this.get(`wikis/${wikiId}/stars`); } /** * https://developer.nulab.com/docs/backlog/api/2/add-star/ */ - public postStar(params: Option.Project.PostStarParams): Promise { + public postStar(params: Option.Project.PostStarParams): Promise { return this.post('stars', params); } diff --git a/src/entity.ts b/src/entity.ts index ca253b1..74e1bec 100644 --- a/src/entity.ts +++ b/src/entity.ts @@ -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; + } } \ No newline at end of file diff --git a/src/option.ts b/src/option.ts index a0dd4a6..b631eab 100644 --- a/src/option.ts +++ b/src/option.ts @@ -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 { diff --git a/src/types.ts b/src/types.ts index 3f58c57..e7238d4 100644 --- a/src/types.ts +++ b/src/types.ts @@ -49,3 +49,15 @@ export enum ActivityType { ProjectGroupAdded = 25, ProjectGroupDeleted = 26, } + +export type IssueTypeColor = + "#e30000" | + "#990000" | + "#934981" | + "#814fbc" | + "#2779ca" | + "#007e9a" | + "#7ea800" | + "#ff9200" | + "#ff3265" | + "#666665"; \ No newline at end of file