feat: global platform v2 update
This commit is contained in:
61
lib/api/purchase-plan.ts
Normal file
61
lib/api/purchase-plan.ts
Normal file
@@ -0,0 +1,61 @@
|
||||
// ============================================================================
|
||||
// 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<PaginatedResponse<PurchasePlanChannel>>(
|
||||
buildPath(workspaceId, projectId),
|
||||
{ params }
|
||||
),
|
||||
|
||||
/**
|
||||
* Add channel to purchase plan
|
||||
*/
|
||||
create: (
|
||||
workspaceId: string,
|
||||
projectId: string,
|
||||
data: PurchasePlanChannelCreateRequest
|
||||
) =>
|
||||
api.post<PurchasePlanChannel>(buildPath(workspaceId, projectId), data),
|
||||
|
||||
/**
|
||||
* Update channel in purchase plan
|
||||
*/
|
||||
update: (
|
||||
workspaceId: string,
|
||||
projectId: string,
|
||||
channelId: string,
|
||||
data: PurchasePlanChannelUpdateRequest
|
||||
) =>
|
||||
api.patch<PurchasePlanChannel>(
|
||||
`${buildPath(workspaceId, projectId)}/${channelId}`,
|
||||
data
|
||||
),
|
||||
|
||||
/**
|
||||
* Remove channel from purchase plan
|
||||
*/
|
||||
delete: (workspaceId: string, projectId: string, channelId: string) =>
|
||||
api.delete<void>(`${buildPath(workspaceId, projectId)}/${channelId}`),
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user