// ============================================================================ // Purchase Plan API // ============================================================================ import { api } from "./client"; import type { PurchasePlanChannel, PurchasePlanChannelCreateRequest, PurchasePlanChannelUpdateRequest, PaginatedResponse, PaginationParams, } from "@/lib/types/api"; const buildPath = (workspaceId: string, projectId: string) => `/workspaces/${workspaceId}/projects/${projectId}/purchase-plan/channels`; export const purchasePlanApi = { /** * Get list of channels in purchase plan */ list: ( workspaceId: string, projectId: string, params?: PaginationParams ) => api.get>( buildPath(workspaceId, projectId), { params } ), /** * Add channel to purchase plan */ create: ( workspaceId: string, projectId: string, data: PurchasePlanChannelCreateRequest ) => api.post(buildPath(workspaceId, projectId), data), /** * Update channel in purchase plan */ update: ( workspaceId: string, projectId: string, channelId: string, data: PurchasePlanChannelUpdateRequest ) => api.patch( `${buildPath(workspaceId, projectId)}/${channelId}`, data ), /** * Remove channel from purchase plan */ delete: (workspaceId: string, projectId: string, channelId: string) => api.delete(`${buildPath(workspaceId, projectId)}/${channelId}`), };