feat: implement browser extension for media publishing and add backend support for media management
This commit is contained in:
@@ -9,6 +9,10 @@ import type {
|
||||
BrandRequest,
|
||||
Competitor,
|
||||
CompetitorRequest,
|
||||
CreatePluginSessionRequest,
|
||||
CreatePluginSessionResponse,
|
||||
CreatePublishBatchRequest,
|
||||
CreatePublishBatchResponse,
|
||||
GenerateFromRuleRequest,
|
||||
GenerateFromRuleResponse,
|
||||
InstantTaskListParams,
|
||||
@@ -18,6 +22,11 @@ import type {
|
||||
KeywordRequest,
|
||||
LoginRequest,
|
||||
LoginResponse,
|
||||
MediaPlatform,
|
||||
PlatformAccount,
|
||||
PublishRecord,
|
||||
RegisterPluginInstallationRequest,
|
||||
RegisterPluginInstallationResponse,
|
||||
PromptRule,
|
||||
PromptRuleGroup,
|
||||
PromptRuleGroupRequest,
|
||||
@@ -68,6 +77,16 @@ const generationStreamEnabled = import.meta.env.VITE_GENERATION_STREAM_ENABLED =
|
||||
|
||||
const publicClient = createApiClient({ baseURL });
|
||||
|
||||
export function getApiBaseURL(): string {
|
||||
if (baseURL) {
|
||||
return baseURL;
|
||||
}
|
||||
if (typeof window !== "undefined") {
|
||||
return window.location.origin;
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
export const apiClient = createApiClient({
|
||||
baseURL,
|
||||
auth: {
|
||||
@@ -192,6 +211,15 @@ export const articlesApi = {
|
||||
versions(id: number) {
|
||||
return apiClient.get<ArticleVersion[]>(`/api/tenant/articles/${id}/versions`);
|
||||
},
|
||||
publishBatch(id: number, payload: CreatePublishBatchRequest) {
|
||||
return apiClient.post<CreatePublishBatchResponse, CreatePublishBatchRequest>(
|
||||
`/api/tenant/articles/${id}/publish-batches`,
|
||||
payload,
|
||||
);
|
||||
},
|
||||
publishRecords(id: number) {
|
||||
return apiClient.get<PublishRecord[]>(`/api/tenant/articles/${id}/publish-records`);
|
||||
},
|
||||
remove(id: number) {
|
||||
return apiClient.remove<null>(`/api/tenant/articles/${id}`);
|
||||
},
|
||||
@@ -340,6 +368,30 @@ export const brandsApi = {
|
||||
},
|
||||
};
|
||||
|
||||
export const mediaApi = {
|
||||
platforms() {
|
||||
return apiClient.get<MediaPlatform[]>("/api/tenant/media/platforms");
|
||||
},
|
||||
accounts() {
|
||||
return apiClient.get<PlatformAccount[]>("/api/tenant/media/platform-accounts");
|
||||
},
|
||||
createPluginSession(payload: CreatePluginSessionRequest) {
|
||||
return apiClient.post<CreatePluginSessionResponse, CreatePluginSessionRequest>(
|
||||
"/api/tenant/media/plugin-sessions",
|
||||
payload,
|
||||
);
|
||||
},
|
||||
registerPluginInstallation(payload: RegisterPluginInstallationRequest) {
|
||||
return apiClient.post<RegisterPluginInstallationResponse, RegisterPluginInstallationRequest>(
|
||||
"/api/tenant/media/plugin-installations/register",
|
||||
payload,
|
||||
);
|
||||
},
|
||||
unbindAccount(id: number) {
|
||||
return apiClient.remove<null>(`/api/tenant/media/platform-accounts/${id}`);
|
||||
},
|
||||
};
|
||||
|
||||
export const promptRulesApi = {
|
||||
list(params?: PromptRuleListParams) {
|
||||
return apiClient.get<PromptRuleListResponse>("/api/tenant/prompt-rules", { params });
|
||||
|
||||
Reference in New Issue
Block a user