Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@makeplane/plane-node-sdk",
"version": "0.2.2",
"version": "0.2.3",
"description": "Node SDK for Plane",
"author": "Plane <engineering@plane.so>",
"repository": {
Expand Down
60 changes: 55 additions & 5 deletions src/api/WorkItemProperties/Values.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { BaseResource } from '../BaseResource';
import { Configuration } from '../../Configuration';
import { BaseResource } from "../BaseResource";
import { Configuration } from "../../Configuration";
import {
UpdateWorkItemPropertyValue,
ListWorkItemPropertyValuesParams,
WorkItemPropertyValues,
} from '../../models/WorkItemProperty';
} from "../../models/WorkItemProperty";

/**
* WorkItemPropertyValues API resource
Expand All @@ -22,7 +22,7 @@ export class Values extends BaseResource {
workspaceSlug: string,
projectId: string,
workItemId: string,
propertyId: string,
propertyId: string
): Promise<WorkItemPropertyValues> {
const propertyValues = await this.get<WorkItemPropertyValues>(
`/workspaces/${workspaceSlug}/projects/${projectId}/work-items/${workItemId}/work-item-properties/${propertyId}/values/`
Expand All @@ -45,9 +45,16 @@ export class Values extends BaseResource {
);
}


/**
* Create/update a property value
*
* For single-value properties:
* - Acts as an upsert operation (create or update)
* - Returns a single WorkItemPropertyValues
*
* For multi-value properties (is_multi=True):
* - Replaces all existing values with the new ones (sync operation)
* - Returns a list of values
*/
async create(
workspaceSlug: string,
Expand All @@ -61,4 +68,47 @@ export class Values extends BaseResource {
updateData
);
}

/**
* Update an existing property value(s) (partial update)
*
* For single-value properties:
* - Updates the existing value
* - Returns a single WorkItemPropertyValues
*
* For multi-value properties (is_multi=True):
* - Replaces all existing values with the new ones (sync operation)
* - Returns a list of values
*
* @throws {HttpError} If the property value does not exist (404)
*/
async update(
workspaceSlug: string,
projectId: string,
workItemId: string,
propertyId: string,
updateData: UpdateWorkItemPropertyValue
): Promise<WorkItemPropertyValues> {
return this.patch<WorkItemPropertyValues>(
`/workspaces/${workspaceSlug}/projects/${projectId}/work-items/${workItemId}/work-item-properties/${propertyId}/values/`,
updateData
);
}

/**
* Delete the property value(s) for a work item
*
* For single-value properties:
* - Deletes the single value
*
* For multi-value properties (is_multi=True):
* - Deletes all values for that property
*
* @throws {HttpError} If the property value does not exist (404)
*/
async delete(workspaceSlug: string, projectId: string, workItemId: string, propertyId: string): Promise<void> {
return this.httpDelete(
`/workspaces/${workspaceSlug}/projects/${projectId}/work-items/${workItemId}/work-item-properties/${propertyId}/values/`
);
}
}
25 changes: 24 additions & 1 deletion src/models/WorkItemProperty.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ export type TextSettings = {
*/
export interface WorkItemPropertyOption extends BaseModel {
name: string;
description?: string;
property: string;
is_active?: boolean;
sort_order?: number;
Expand Down Expand Up @@ -137,8 +138,30 @@ export type WorkItemPropertyValues = {
values: any[];
}[];

/**
* UpdateWorkItemPropertyValue model interface
* Request model for creating/updating a work item property value.
*
* The value type depends on the property type:
* - TEXT/URL/EMAIL/FILE: string
* - DATETIME: string (YYYY-MM-DD or YYYY-MM-DD HH:MM:SS)
* - DECIMAL: number (int or float)
* - BOOLEAN: boolean (true/false)
* - OPTION/RELATION (single): string (UUID)
* - OPTION/RELATION (multi, when is_multi=True): list of strings (UUIDs) or single string
*
* For multi-value properties (is_multi=True):
* - Accept either a single UUID string or a list of UUID strings
* - Multiple IssuePropertyValue records are created
* - Response will be a list of values
*
* For single-value properties:
* - Only one value is allowed per work item/property combination
*/
export type UpdateWorkItemPropertyValue = {
values: [{ value: any }];
value: string | boolean | number | string[];
external_id?: string;
external_source?: string;
};

export interface ListWorkItemPropertyValuesParams {
Expand Down
5 changes: 5 additions & 0 deletions tests/e2e/project.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,11 @@ describe("End to End Project Test", () => {
name: projectName,
id: projectName.slice(0, 5).toUpperCase(),
});

await client.projects.updateFeatures(e2eConfig.workspaceSlug, project.id, {
cycles: true,
modules: true,
});
});

it("should create and list cycles", async () => {
Expand Down
Loading
Loading