// types import type { TInboxIssue, TIssue, TInboxIssueWithPagination } from "@plane/types"; import { API_BASE_URL } from "@/helpers/common.helper"; import { APIService } from "@/services/api.service"; // helpers export class InboxIssueService extends APIService { constructor() { super(API_BASE_URL); } async list(workspaceSlug: string, projectId: string, params = {}): Promise { return this.get(`/api/workspaces/${workspaceSlug}/projects/${projectId}/inbox-issues/`, { params, }) .then((response) => response?.data) .catch((error) => { throw error?.response?.data; }); } async retrieve(workspaceSlug: string, projectId: string, inboxIssueId: string): Promise { return this.get( `/api/workspaces/${workspaceSlug}/projects/${projectId}/inbox-issues/${inboxIssueId}/?expand=issue_inbox` ) .then((response) => response?.data) .catch((error) => { throw error?.response?.data; }); } async create(workspaceSlug: string, projectId: string, data: Partial): Promise { return this.post(`/api/workspaces/${workspaceSlug}/projects/${projectId}/inbox-issues/`, { source: "IN_APP", issue: data, }) .then((response) => response?.data) .catch((error) => { throw error?.response?.data; }); } async update( workspaceSlug: string, projectId: string, inboxIssueId: string, data: Partial ): Promise { return this.patch(`/api/workspaces/${workspaceSlug}/projects/${projectId}/inbox-issues/${inboxIssueId}/`, data) .then((response) => response?.data) .catch((error) => { throw error?.response?.data; }); } async updateIssue( workspaceSlug: string, projectId: string, inboxIssueId: string, data: Partial ): Promise { return this.patch(`/api/workspaces/${workspaceSlug}/projects/${projectId}/inbox-issues/${inboxIssueId}/`, { issue: data, }) .then((response) => response?.data) .catch((error) => { throw error?.response?.data; }); } async destroy(workspaceSlug: string, projectId: string, inboxIssueId: string): Promise { return this.delete(`/api/workspaces/${workspaceSlug}/projects/${projectId}/inbox-issues/${inboxIssueId}/`) .then((response) => response?.data) .catch((error) => { throw error?.response?.data; }); } }