Some checks failed
Branch Build CE / Build Setup (push) Has been cancelled
Branch Build CE / Build-Push Admin Docker Image (push) Has been cancelled
Branch Build CE / Build-Push Web Docker Image (push) Has been cancelled
Branch Build CE / Build-Push Space Docker Image (push) Has been cancelled
Branch Build CE / Build-Push Live Collaboration Docker Image (push) Has been cancelled
Branch Build CE / Build-Push API Server Docker Image (push) Has been cancelled
Branch Build CE / Build-Push Proxy Docker Image (push) Has been cancelled
Branch Build CE / Build-Push AIO Docker Image (push) Has been cancelled
Branch Build CE / Upload Build Assets (push) Has been cancelled
Branch Build CE / Build Release (push) Has been cancelled
CodeQL / Analyze (javascript) (push) Has been cancelled
CodeQL / Analyze (python) (push) Has been cancelled
Codespell / Check for spelling errors (push) Has been cancelled
Sync Repositories / sync_changes (push) Has been cancelled
Synced from upstream: 8853637e981ed7d8a6cff32bd98e7afe20f54362
63 lines
1.7 KiB
TypeScript
63 lines
1.7 KiB
TypeScript
// helpers
|
|
import { STICKIES_PER_PAGE, API_BASE_URL } from "@plane/constants";
|
|
import type { TSticky } from "@plane/types";
|
|
// services
|
|
import { APIService } from "@/services/api.service";
|
|
|
|
export class StickyService extends APIService {
|
|
constructor() {
|
|
super(API_BASE_URL);
|
|
}
|
|
|
|
async createSticky(workspaceSlug: string, payload: Partial<TSticky>) {
|
|
return this.post(`/api/workspaces/${workspaceSlug}/stickies/`, payload)
|
|
.then((res) => res?.data)
|
|
.catch((err) => {
|
|
throw err?.response?.data;
|
|
});
|
|
}
|
|
|
|
async getStickies(
|
|
workspaceSlug: string,
|
|
cursor: string,
|
|
query?: string,
|
|
per_page?: number
|
|
): Promise<{ results: TSticky[]; total_pages: number }> {
|
|
return this.get(`/api/workspaces/${workspaceSlug}/stickies/`, {
|
|
params: {
|
|
cursor,
|
|
per_page: per_page || STICKIES_PER_PAGE,
|
|
query,
|
|
},
|
|
})
|
|
.then((res) => res?.data)
|
|
.catch((err) => {
|
|
throw err?.response?.data;
|
|
});
|
|
}
|
|
|
|
async getSticky(workspaceSlug: string, id: string) {
|
|
return this.get(`/api/workspaces/${workspaceSlug}/stickies/${id}`)
|
|
.then((res) => res?.data)
|
|
.catch((err) => {
|
|
throw err?.response?.data;
|
|
});
|
|
}
|
|
|
|
async updateSticky(workspaceSlug: string, id: string, data: Partial<TSticky>) {
|
|
return await this.patch(`/api/workspaces/${workspaceSlug}/stickies/${id}/`, data)
|
|
.then((res) => res?.data)
|
|
.catch((err) => {
|
|
throw err?.response?.data;
|
|
});
|
|
}
|
|
|
|
async deleteSticky(workspaceSlug: string, id: string) {
|
|
return await this.delete(`/api/workspaces/${workspaceSlug}/stickies/${id}`)
|
|
.then((res) => res?.data)
|
|
.catch((err) => {
|
|
throw err?.response?.data;
|
|
});
|
|
}
|
|
}
|