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.8",
"version": "0.2.9",
"description": "Node SDK for Plane",
"author": "Plane <engineering@plane.so>",
"repository": {
Expand Down
14 changes: 14 additions & 0 deletions src/api/Projects.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,4 +84,18 @@ export class Projects extends BaseResource {
): Promise<ProjectFeatures> {
return this.patch<ProjectFeatures>(`/workspaces/${workspaceSlug}/projects/${projectId}/features/`, updateFeatures);
}

/**
* Archive a project
*/
async archive(workspaceSlug: string, projectId: string): Promise<void> {
return this.post<void>(`/workspaces/${workspaceSlug}/projects/${projectId}/archive/`);
}

/**
* Unarchive a project
*/
async unArchive(workspaceSlug: string, projectId: string): Promise<void> {
return this.httpDelete(`/workspaces/${workspaceSlug}/projects/${projectId}/archive/`);
}
}
20 changes: 17 additions & 3 deletions tests/unit/project.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,20 @@ describe(!!config.workspaceSlug, "Project API Tests", () => {
expect(foundProject?.name).toBe("Updated Test Project");
});

it("should archive and unarchive a project", async () => {
await client.projects.archive(workspaceSlug, project.id);

const archivedProject = await client.projects.retrieve(workspaceSlug, project.id);
expect(archivedProject).toBeDefined();
expect(archivedProject.archived_at).toBeTruthy();

await client.projects.unArchive(workspaceSlug, project.id);

const unarchivedProject = await client.projects.retrieve(workspaceSlug, project.id);
expect(unarchivedProject).toBeDefined();
expect(unarchivedProject.archived_at).toBeFalsy();
});

it("should get project members", async () => {
const members = await client.projects.getMembers(workspaceSlug, project.id);

Expand All @@ -99,17 +113,17 @@ describe(!!config.workspaceSlug, "Project API Tests", () => {
const originalFeatures = await client.projects.retrieveFeatures(workspaceSlug, project.id);

const updatedFeatures = await client.projects.updateFeatures(workspaceSlug, project.id, {
epics: !originalFeatures.epics,
pages: !originalFeatures.pages,
modules: !originalFeatures.modules,
});

expect(updatedFeatures).toBeDefined();
expect(updatedFeatures.epics).toBe(!originalFeatures.epics);
expect(updatedFeatures.pages).toBe(!originalFeatures.pages);
expect(updatedFeatures.modules).toBe(!originalFeatures.modules);

// Restore original values
await client.projects.updateFeatures(workspaceSlug, project.id, {
epics: originalFeatures.epics,
pages: originalFeatures.pages,
modules: originalFeatures.modules,
});
});
Expand Down
Loading