Skip to content

Commit d7a4a2f

Browse files
authored
[SILO-1135] feat: add project archive endpoints #35
1 parent b95f025 commit d7a4a2f

File tree

3 files changed

+32
-4
lines changed

3 files changed

+32
-4
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@makeplane/plane-node-sdk",
3-
"version": "0.2.8",
3+
"version": "0.2.9",
44
"description": "Node SDK for Plane",
55
"author": "Plane <engineering@plane.so>",
66
"repository": {

src/api/Projects.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,4 +84,18 @@ export class Projects extends BaseResource {
8484
): Promise<ProjectFeatures> {
8585
return this.patch<ProjectFeatures>(`/workspaces/${workspaceSlug}/projects/${projectId}/features/`, updateFeatures);
8686
}
87+
88+
/**
89+
* Archive a project
90+
*/
91+
async archive(workspaceSlug: string, projectId: string): Promise<void> {
92+
return this.post<void>(`/workspaces/${workspaceSlug}/projects/${projectId}/archive/`);
93+
}
94+
95+
/**
96+
* Unarchive a project
97+
*/
98+
async unArchive(workspaceSlug: string, projectId: string): Promise<void> {
99+
return this.httpDelete(`/workspaces/${workspaceSlug}/projects/${projectId}/archive/`);
100+
}
87101
}

tests/unit/project.test.ts

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,20 @@ describe(!!config.workspaceSlug, "Project API Tests", () => {
7474
expect(foundProject?.name).toBe("Updated Test Project");
7575
});
7676

77+
it("should archive and unarchive a project", async () => {
78+
await client.projects.archive(workspaceSlug, project.id);
79+
80+
const archivedProject = await client.projects.retrieve(workspaceSlug, project.id);
81+
expect(archivedProject).toBeDefined();
82+
expect(archivedProject.archived_at).toBeTruthy();
83+
84+
await client.projects.unArchive(workspaceSlug, project.id);
85+
86+
const unarchivedProject = await client.projects.retrieve(workspaceSlug, project.id);
87+
expect(unarchivedProject).toBeDefined();
88+
expect(unarchivedProject.archived_at).toBeFalsy();
89+
});
90+
7791
it("should get project members", async () => {
7892
const members = await client.projects.getMembers(workspaceSlug, project.id);
7993

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

101115
const updatedFeatures = await client.projects.updateFeatures(workspaceSlug, project.id, {
102-
epics: !originalFeatures.epics,
116+
pages: !originalFeatures.pages,
103117
modules: !originalFeatures.modules,
104118
});
105119

106120
expect(updatedFeatures).toBeDefined();
107-
expect(updatedFeatures.epics).toBe(!originalFeatures.epics);
121+
expect(updatedFeatures.pages).toBe(!originalFeatures.pages);
108122
expect(updatedFeatures.modules).toBe(!originalFeatures.modules);
109123

110124
// Restore original values
111125
await client.projects.updateFeatures(workspaceSlug, project.id, {
112-
epics: originalFeatures.epics,
126+
pages: originalFeatures.pages,
113127
modules: originalFeatures.modules,
114128
});
115129
});

0 commit comments

Comments
 (0)