feat: placements update
This commit is contained in:
@@ -9,10 +9,32 @@ import type {
|
||||
PaginatedResponse,
|
||||
} from "@/lib/types/api";
|
||||
|
||||
interface CreateChannelInput {
|
||||
username?: string;
|
||||
invite_link?: string;
|
||||
}
|
||||
|
||||
interface CreateChannelResult {
|
||||
channel: {
|
||||
id: string;
|
||||
};
|
||||
}
|
||||
|
||||
interface CreateChannelsResponse {
|
||||
results: CreateChannelResult[];
|
||||
}
|
||||
|
||||
export const channelsApi = {
|
||||
/**
|
||||
* Get catalog of channels for placements
|
||||
*/
|
||||
list: (params?: ChannelsQueryParams) =>
|
||||
api.get<PaginatedResponse<Channel>>("/channels", { params }),
|
||||
|
||||
/**
|
||||
* Create channels by username or invite_link
|
||||
* Returns channel IDs for use in placement creation
|
||||
*/
|
||||
create: (channels: CreateChannelInput[]) =>
|
||||
api.post<CreateChannelsResponse>("/channels", { channels }),
|
||||
};
|
||||
|
||||
@@ -14,6 +14,18 @@ import type {
|
||||
PaginatedResponse,
|
||||
} from "@/lib/types/api";
|
||||
|
||||
type UpdatePlacementInProjectRequest = Partial<{
|
||||
status: string;
|
||||
comment: string | null;
|
||||
creative_id: string | null;
|
||||
placement_at: string | null;
|
||||
payment_at: string | null;
|
||||
cost: { type: "fixed"; value: number } | null;
|
||||
cost_before_bargain: number | null;
|
||||
placement_type: string | null;
|
||||
format: string | null;
|
||||
}>;
|
||||
|
||||
export const placementsApi = {
|
||||
/**
|
||||
* Get list of placements for workspace
|
||||
@@ -96,6 +108,21 @@ export const placementsApi = {
|
||||
data
|
||||
),
|
||||
|
||||
/**
|
||||
* Update placement within project (Purchase Plans UI)
|
||||
* PATCH /workspaces/{workspace_id}/projects/{project_id}/placements/{placement_id}
|
||||
*/
|
||||
updateInProject: (
|
||||
workspaceId: string,
|
||||
projectId: string,
|
||||
placementId: string,
|
||||
data: UpdatePlacementInProjectRequest
|
||||
) =>
|
||||
api.patch<Placement>(
|
||||
`/workspaces/${workspaceId}/projects/${projectId}/placements/${placementId}`,
|
||||
data
|
||||
),
|
||||
|
||||
/**
|
||||
* Delete (archive) placement
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user