diff --git a/package.json b/package.json index 79adc6e..5433828 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@makeplane/plane-node-sdk", - "version": "0.2.11", + "version": "0.2.12", "description": "Node SDK for Plane", "author": "Plane ", "repository": { diff --git a/src/api/Projects.ts b/src/api/Projects.ts index 6983ad6..f06937d 100644 --- a/src/api/Projects.ts +++ b/src/api/Projects.ts @@ -2,7 +2,7 @@ import { BaseResource } from "./BaseResource"; import { Configuration } from "../Configuration"; import { Project, CreateProject, UpdateProject, ListProjectsParams } from "../models/Project"; import { PaginatedResponse } from "../models/common"; -import { User } from "../models/User"; +import { ProjectMember } from "../models/Member"; import { ProjectFeatures, UpdateProjectFeatures } from "../models/ProjectFeatures"; /** @@ -54,10 +54,10 @@ export class Projects extends BaseResource { } /** - * Get project members + * Get project members with their role information. */ - async getMembers(workspaceSlug: string, projectId: string): Promise { - return this.get(`/workspaces/${workspaceSlug}/projects/${projectId}/members/`); + async getMembers(workspaceSlug: string, projectId: string): Promise { + return this.get(`/workspaces/${workspaceSlug}/projects/${projectId}/members/`); } /** diff --git a/src/api/WorkItemTypes.ts b/src/api/WorkItemTypes.ts index 6b61584..4a679b0 100644 --- a/src/api/WorkItemTypes.ts +++ b/src/api/WorkItemTypes.ts @@ -68,4 +68,17 @@ export class WorkItemTypes extends BaseResource { async list(workspaceSlug: string, projectId: string, params?: ListWorkItemTypesParams): Promise { return this.get(`/workspaces/${workspaceSlug}/projects/${projectId}/work-item-types/`, params); } + + /** + * Import workspace-level work item types into a project. + * + * @param workItemTypeIds - IDs of the workspace work item types to import. + * @returns The resulting project-level work item types after import. + */ + async importToProject(workspaceSlug: string, projectId: string, workItemTypeIds: string[]): Promise { + return this.post( + `/workspaces/${workspaceSlug}/projects/${projectId}/work-item-types/import-work-item-types/`, + { work_item_type_ids: workItemTypeIds } + ); + } } diff --git a/src/api/Workspace.ts b/src/api/Workspace.ts index 11968f0..06bc6c7 100644 --- a/src/api/Workspace.ts +++ b/src/api/Workspace.ts @@ -1,6 +1,6 @@ import { BaseResource } from "./BaseResource"; import { Configuration } from "../Configuration"; -import { User } from "../models/User"; +import { WorkspaceMember } from "../models/Member"; import { UpdateWorkspaceFeatures, WorkspaceFeatures } from "../models/WorkspaceFeatures"; /** @@ -13,10 +13,10 @@ export class Workspace extends BaseResource { } /** - * Get workspace members + * Get workspace members with their role information. */ - async getMembers(workspaceSlug: string): Promise { - return this.get(`/workspaces/${workspaceSlug}/members/`); + async getMembers(workspaceSlug: string): Promise { + return this.get(`/workspaces/${workspaceSlug}/members/`); } /** diff --git a/src/models/Member.ts b/src/models/Member.ts new file mode 100644 index 0000000..7e2611c --- /dev/null +++ b/src/models/Member.ts @@ -0,0 +1,23 @@ +import { User } from "./User"; + +/** + * A project member — a User with an additional role and role_slug field. + * + * Returned by Projects.getMembers(). The role field is the numeric role value + * (e.g. 20 = Member, 15 = Viewer, 10 = Guest, 5 = Viewer), role_slug is the + * human-readable equivalent (e.g. "member", "viewer"). + */ +export interface ProjectMember extends User { + role: number | null; + role_slug: string | null; +} + +/** + * A workspace member — a User with an additional role and role_slug field. + * + * Returned by Workspace.getMembers(). + */ +export interface WorkspaceMember extends User { + role: number | null; + role_slug: string | null; +} diff --git a/src/models/index.ts b/src/models/index.ts index ce61a01..198dc76 100644 --- a/src/models/index.ts +++ b/src/models/index.ts @@ -10,6 +10,7 @@ export * from "./InitiativeLabel"; export * from "./Intake"; export * from "./Label"; export * from "./Link"; +export * from "./Member"; export * from "./Milestone"; export * from "./Module"; export * from "./OAuth";