Skip to content

Let's use AI to Earn!

feat: 快手发布流程调试完成

gaoSir1b467c381b98
diff --git a/src/app/[lng]/publish/components/PubAccountDetModule/PubAccountDetModule.tsx b/src/app/[lng]/publish/components/PubAccountDetModule/PubAccountDetModule.tsx
index 6ff3c33d..613211d0 100644
--- a/src/app/[lng]/publish/components/PubAccountDetModule/PubAccountDetModule.tsx
+++ b/src/app/[lng]/publish/components/PubAccountDetModule/PubAccountDetModule.tsx
@@ -133,6 +133,10 @@ const PubAccountDetModule = memo(
const imperative: IPubAccountDetModuleRef = {
async startDet() {
+ setOpen(true);
+ if (onDetFinish) {
+ onDetFinish(accounts);
+ }
// TODO 账户检测
// setProxyInvalidAccountMap(new Map());
// setDisabledIdSet(new Set([]));
diff --git a/src/app/[lng]/publish/videoPage/components/VideoPubSetModal/VideoPubSetModal.tsx b/src/app/[lng]/publish/videoPage/components/VideoPubSetModal/VideoPubSetModal.tsx
index 0113c3e2..cfe25113 100644
--- a/src/app/[lng]/publish/videoPage/components/VideoPubSetModal/VideoPubSetModal.tsx
+++ b/src/app/[lng]/publish/videoPage/components/VideoPubSetModal/VideoPubSetModal.tsx
@@ -7,11 +7,25 @@ import React, {
useRef,
useState,
} from "react";
-import { Alert, Avatar, message, Modal, Switch, Tabs, Tooltip } from "antd";
+import {
+ Alert,
+ Avatar,
+ Button,
+ message,
+ Modal,
+ Space,
+ Switch,
+ Tabs,
+ Tooltip,
+} from "antd";
import { useVideoPageStore } from "@/app/[lng]/publish/videoPage/useVideoPageStore";
import { useShallow } from "zustand/react/shallow";
import styles from "./videoPubSetModal.module.scss";
-import { useBellMessageStroe } from "@/store/bellMessageStroe";
+import {
+ NoticeItem,
+ NoticeType,
+ useBellMessageStroe,
+} from "@/store/bellMessageStroe";
import { AccountPlatInfoMap, PlatType } from "@/app/config/platConfig";
import VideoCoverSeting from "@/app/[lng]/publish/videoPage/components/VideoCoverSeting";
import PubAccountDetModule, {
@@ -29,6 +43,12 @@ import usePubParamsVerify, {
import { IVideoFile } from "@/app/[lng]/publish/components/Choose/VideoChoose";
import { useRouter } from "next/navigation";
import { useSystemStore } from "@/store/system";
+import { signInApi } from "@/api/signIn";
+import { generateUUID } from "@/utils";
+import { PubStatus } from "@/app/config/publishConfig";
+import { platManage } from "@/app/plat/PlatManage";
+import { useCommontStore } from "@/store/commont";
+import { PublishVideoParams } from "@/app/plat/plat.type";
export interface IVideoPubSetModalRef {}
@@ -129,7 +149,6 @@ const VideoPubSetModal = memo(
},
},
);
- const recordId = useRef(-1);
useEffect(() => {
if (!currChooseAccountId)
@@ -158,115 +177,100 @@ const VideoPubSetModal = memo(
}, [currChooseAccount, videoListChoose]);
const pubCore = async () => {
- // TODO 发布
- // setLoading(false);
- //
+ setLoading(false);
+
// await signInApi.createSignInRecord();
- // const err = () => {
- // setLoading(false);
- // message.error("网络繁忙,请稍后重试!");
- // };
- // // 创建一级记录
- // const recordRes = await icpCreatePubRecord({
- // title: commonPubParams.title,
- // desc: commonPubParams.describe,
- // type: PubType.VIDEO,
- // timingTime: commonPubParams.timingTime,
- // videoPath: videoListChoose[0].video?.videoPath,
- // coverPath: videoListChoose[0].pubParams.cover?.imgPath,
- // commonCoverPath: commonPubParams.cover?.imgPath,
- // });
- // recordId.current = recordRes.id;
- // if (!recordRes) return err();
- //
- // setPubProgressModuleOpen(true);
- // setLoading(true);
- //
- // // 发布记录通知消息初始化
- // const initialNotice: NoticeItem = {
- // title:
- // [
- // ...new Set(
- // videoListChoose.map(
- // (v) => AccountPlatInfoMap.get(v.account!.type)!.name,
- // ),
- // ),
- // ].join("、") + "发布任务",
- // time: recordRes.createTime!,
- // id: recordRes.id,
- // pub: {
- // status: PubStatus.UNPUBLISH,
- // progressList: [],
- // },
- // };
- //
- // for (const vData of videoListChoose) {
- // const account = vData.account!;
- // const video = vData.video!;
- // // 创建二级记录
- // await icpCreateVideoPubRecord({
- // ...vData.pubParams,
- // type: account.type,
- // accountId: account.id,
- // pubRecordId: recordRes.id,
- // publishTime: new Date(),
- // desc: vData.pubParams.describe,
- // videoPath: video.videoPath,
- // coverPath: vData.pubParams.cover?.imgPath,
- // });
- //
- // initialNotice.pub!.progressList.push({
- // account: vData.account!,
- // progress: 0,
- // msg: "加载中...",
- // id: vData.account!.id!,
- // });
- // }
- // const noticeList = noticeMap.get(NoticeType.PubNotice) || [];
- // noticeList.unshift(initialNotice);
- // addNotice(NoticeType.PubNotice, noticeList);
- //
- // // 发布
- // const okRes = await icpPubVideo(recordRes.id);
- // setLoading(false);
- // close();
- // setPubProgressModuleOpen(false);
- //
- // // 成功数据
- // const successList = okRes.filter((v) => v.code === 1);
- //
- // initialNotice.pub!.status =
- // successList.length === okRes.length
- // ? PubStatus.RELEASED
- // : PubStatus.PartSuccess;
- // addNotice(NoticeType.PubNotice, noticeList);
- //
- // setTimeout(() => {
- // useCommontStore.getState().notification!.open({
- // message: "发布结果",
- // description: (
- // <>
- // 一共发布 {okRes.length} 条数据,成功 {successList.length}{" "}
- // 条,失败 {okRes.length - successList.length} 条
- // </>
- // ),
- // showProgress: true,
- // btn: (
- // <Space>
- // <Button
- // type="primary"
- // size="small"
- // onClick={() => {
- // router.push("/publish/pubRecord");
- // }}
- // >
- // 查看发布记录
- // </Button>
- // </Space>
- // ),
- // key: Date.now(),
- // });
- // }, 10);
+ const err = () => {
+ setLoading(false);
+ message.error("网络繁忙,请稍后重试!");
+ };
+
+ const operateId = generateUUID();
+ // 发布记录通知消息初始化
+ const initialNotice: NoticeItem = {
+ title:
+ [
+ ...new Set(
+ videoListChoose.map(
+ (v) => AccountPlatInfoMap.get(v.account!.type)!.name,
+ ),
+ ),
+ ].join("、") + "发布任务",
+ time: new Date(),
+ id: operateId,
+ pub: {
+ status: PubStatus.UNPUBLISH,
+ progressList: [],
+ },
+ };
+
+ const publishVideoParamsArr: PublishVideoParams[] = [];
+ for (const vData of videoListChoose) {
+ initialNotice.pub!.progressList.push({
+ account: vData.account!,
+ progress: 0,
+ msg: "加载中...",
+ id: vData.account!.id!,
+ });
+
+ publishVideoParamsArr.push({
+ videoPubParams: {
+ ...vData.pubParams,
+ video: vData.video!,
+ },
+ account: vData.account!,
+ access_token: vData.account!.access_token!,
+ refresh_token: vData.account!.refresh_token!,
+ });
+ }
+ const noticeList = noticeMap.get(NoticeType.PubNotice) || [];
+ noticeList.unshift(initialNotice);
+ addNotice(NoticeType.PubNotice, noticeList);
+
+ // 发布
+ const okRes = await platManage.publishVideo(
+ publishVideoParamsArr,
+ operateId,
+ );
+ setLoading(false);
+ close();
+ setPubProgressModuleOpen(false);
+
+ // 成功数据
+ const successList = okRes.filter((v) => v.success);
+
+ initialNotice.pub!.status =
+ successList.length === okRes.length
+ ? PubStatus.RELEASED
+ : PubStatus.PartSuccess;
+ addNotice(NoticeType.PubNotice, noticeList);
+
+ setTimeout(() => {
+ useCommontStore.getState().notification!.open({
+ message: "发布结果",
+ description: (
+ <>
+ 一共发布 {okRes.length} 条数据,成功 {successList.length}{" "}
+ 条,失败 {okRes.length - successList.length} 条
+ </>
+ ),
+ showProgress: true,
+ btn: (
+ <Space>
+ <Button
+ type="primary"
+ size="small"
+ onClick={() => {
+ router.push("/publish/pubRecord");
+ }}
+ >
+ 查看发布记录
+ </Button>
+ </Space>
+ ),
+ key: Date.now(),
+ });
+ }, 10);
};
const handleOk = async () => {
diff --git a/src/app/layout/Providers.tsx b/src/app/layout/Providers.tsx
index 12260e48..022de00f 100644
--- a/src/app/layout/Providers.tsx
+++ b/src/app/layout/Providers.tsx
@@ -1,9 +1,9 @@
"use client";
import { GoogleOAuthProvider } from "@react-oauth/google";
-import { ConfigProvider, App } from "antd";
+import { ConfigProvider, App, notification } from "antd";
import { AntdRegistry } from "@ant-design/nextjs-registry";
-import {Suspense, useEffect} from "react";
+import { Suspense, useEffect } from "react";
import type { Locale } from "antd/es/locale";
import zh_CN from "antd/es/locale/zh_CN";
import en_US from "antd/es/locale/en_US";
@@ -11,6 +11,7 @@ import { fallbackLng } from "@/app/i18n/settings";
import useCssVariables from "@/app/hooks/useCssVariables";
import { useAccountStore } from "@/store/account";
import { useUserStore } from "@/store/user";
+import { useCommontStore } from "@/store/commont";
// antd 语言获取
const getAntdLang = (lang: string): Locale => {
@@ -31,6 +32,13 @@ export function Providers({
lng: string;
}) {
const cssVariables = useCssVariables();
+ const [api, contextHolder] = notification.useNotification({
+ top: 74,
+ });
+
+ useEffect(() => {
+ useCommontStore.getState().setNotification(api);
+ }, [api]);
if (useUserStore.getState().token) {
useAccountStore.getState().accountInit();
@@ -52,7 +60,10 @@ export function Providers({
>
<App component={false}>
<Suspense>
- <AntdRegistry>{children}</AntdRegistry>
+ <AntdRegistry>
+ {contextHolder}
+ {children}
+ </AntdRegistry>
</Suspense>
</App>
</ConfigProvider>
diff --git a/src/app/plat/PlatManage.ts b/src/app/plat/PlatManage.ts
index 031a28bf..a3422130 100644
--- a/src/app/plat/PlatManage.ts
+++ b/src/app/plat/PlatManage.ts
@@ -4,8 +4,9 @@ import { PlatBase } from "@/app/plat/PlatBase";
import {
IPlatConstrParams,
IPublishResult,
- IVideoPublishItem,
+ PublishVideoParams,
} from "@/app/plat/plat.type";
+import { useBellMessageStroe } from "@/store/bellMessageStroe";
class PlatManage {
private getPlat(type: PlatType, params: IPlatConstrParams): PlatBase {
@@ -16,27 +17,34 @@ class PlatManage {
return new KwaiPlat(params);
}
+ /**
+ * 发布视频
+ * @param pubArr 发布参数数组
+ * @param id 本次操作的唯一标识
+ */
public async publishVideo(
- pubArr: {
- videoPubParams: IVideoPublishItem;
- platType: PlatType;
- access_token: string;
- refresh_token: string;
- }[],
- ) {
+ pubArr: PublishVideoParams[],
+ id: string,
+ ): Promise<IPublishResult[]> {
const task: Promise<IPublishResult>[] = [];
for (const pub of pubArr) {
task.push(
- this.getPlat(pub.platType, {
+ this.getPlat(pub.account.type, {
access_token: pub.access_token,
refresh_token: pub.refresh_token,
}).publishVideo(pub.videoPubParams, (progress, msg) => {
- console.log(progress, msg);
+ useBellMessageStroe.getState().publishProgressSet({
+ id,
+ account: pub.account,
+ progress,
+ msg,
+ });
}),
);
}
const pubRes = await Promise.all(task);
console.log(pubRes);
+ return pubRes;
}
}
export const platManage = new PlatManage();
diff --git a/src/app/plat/plat.type.ts b/src/app/plat/plat.type.ts
index 5f7a6c16..7cdfc988 100644
--- a/src/app/plat/plat.type.ts
+++ b/src/app/plat/plat.type.ts
@@ -2,6 +2,7 @@
import { SocialAccount } from "@/api/types/account.type";
import { IPubParams } from "@/app/[lng]/publish/videoPage/videoPage.type";
import { IVideoFile } from "@/app/[lng]/publish/components/Choose/VideoChoose";
+import { PlatType } from "@/app/config/platConfig";
export interface IPlatConstrParams {
access_token: string;
@@ -26,21 +27,13 @@ export interface IUsersItem {
follower_count?: number;
}
-// 视频发布进度返回值
+// 发布进度返回值
export interface PublishProgressRes {
// 为 -1 表示失败
progress: number;
msg: string;
account: SocialAccount;
- id: number;
-}
-
-// 视频发布返回值
-export interface PublishRes {
- // 作品ID
- worksId: string;
- // 作品链接
- worksUrl: string;
+ id: string;
}
// 视频发布
@@ -60,3 +53,12 @@ export interface IPublishResult {
worksId: string;
worksUrl: string;
}
+
+// 视频发布参数
+export interface PublishVideoParams {
+ videoPubParams: IVideoPublishItem;
+ access_token: string;
+ refresh_token: string;
+ // 账户
+ account: SocialAccount;
+}
diff --git a/src/app/plat/platChildren/kwai/KwaiPlat.ts b/src/app/plat/platChildren/kwai/KwaiPlat.ts
index 9cf8009a..a80607e6 100644
--- a/src/app/plat/platChildren/kwai/KwaiPlat.ts
+++ b/src/app/plat/platChildren/kwai/KwaiPlat.ts
@@ -5,7 +5,11 @@ import { requestPlatApi } from "@/utils/otherRequest";
import { KwaiApiProxyUrl } from "@/constant";
import { kwaiAppId } from "@/app/[lng]/accounts/plat/kwaiLogin";
import { PlatType } from "@/app/config/platConfig";
-import {IPublishResult, IVideoPublishItem, PubProgressType} from "@/app/plat/plat.type";
+import {
+ IPublishResult,
+ IVideoPublishItem,
+ PubProgressType,
+} from "@/app/plat/plat.type";
import { KwaiPubCore } from "@/app/plat/platChildren/kwai/KwaiPubCore";
export class KwaiPlat extends PlatBase {
@@ -25,8 +29,8 @@ export class KwaiPlat extends PlatBase {
};
}
- request(params: RequestParams) {
- params.url = `${KwaiApiProxyUrl}${params.url}`;
+ request(params: RequestParams, isPrefix = true) {
+ params.url = `${(isPrefix && KwaiApiProxyUrl) || ""}${params.url}`;
params.params = {
access_token: this.access_token,
app_id: kwaiAppId,
@@ -41,10 +45,13 @@ export class KwaiPlat extends PlatBase {
): Promise<IPublishResult> {
const kwaiPubCore = new KwaiPubCore(this, videoPubParams, onProgress);
const pubRes = await kwaiPubCore.publishVideo();
- return {
- worksId: pubRes.worksId,
- worksUrl: pubRes.worksUrl,
- success: true,
- };
+
+ if (pubRes.success) {
+ onProgress(100, "视频发布完成");
+ } else {
+ onProgress(-1, "视频发布失败");
+ }
+
+ return pubRes;
}
}
diff --git a/src/app/plat/platChildren/kwai/KwaiPubCore.ts b/src/app/plat/platChildren/kwai/KwaiPubCore.ts
index 33b69875..815c3a6d 100644
--- a/src/app/plat/platChildren/kwai/KwaiPubCore.ts
+++ b/src/app/plat/platChildren/kwai/KwaiPubCore.ts
@@ -1,10 +1,11 @@
import { KwaiPlat } from "@/app/plat/platChildren/kwai/KwaiPlat";
import {
+ IPublishResult,
IVideoPublishItem,
- PublishRes,
PubProgressType,
} from "@/app/plat/plat.type";
import { calculateChunks, readBlobRange } from "@/app/plat/plat.util";
+import { KwaiApiUploadProxyUrl } from "@/constant";
export class KwaiPubCore {
private kwaiPlat: KwaiPlat;
@@ -24,87 +25,109 @@ export class KwaiPubCore {
}
// 视频发布
- async publishVideo(): Promise<PublishRes> {
- const startUploadInfo = await this._startUploadVideo();
- this.onProgress(10, "发起上传完成...");
+ async publishVideo(): Promise<IPublishResult> {
+ try {
+ const startUploadInfo = await this._startUploadVideo();
+ this.onProgress(10, "发起上传完成...");
- // 获取分片的大小
- const chunkRange = calculateChunks(
- this.videoPubParams.video.size,
- this.fileBlockSize,
- );
- this.onProgress(20, "分片大小获取完成...");
+ // 获取分片的大小
+ const chunkRange = calculateChunks(
+ this.videoPubParams.video.size,
+ this.fileBlockSize,
+ );
+ this.onProgress(20, "分片大小获取完成...");
+
+ // 分片上传
+ for (let i = 0; i < chunkRange.length; i++) {
+ this.onProgress(50, `正在分片上传视频:${i} / ${chunkRange.length}`);
- // 分片上传
- for (let i = 0; i < chunkRange.length; i++) {
- this.onProgress(50, `正在分片上传视频:${i} / ${chunkRange.length}`);
+ const range = chunkRange[i];
+ // 获取要上传的视频分片
+ const chunk = await readBlobRange(
+ this.videoPubParams.video.file,
+ range.start,
+ range.end,
+ );
+ // 发起分片上传
+ const chunkUploadRes = await this.kwaiPlat.request(
+ {
+ url: `${KwaiApiUploadProxyUrl}api/upload/fragment`,
+ method: "POST",
+ headers: {
+ "Content-Type": "application/octet-stream",
+ },
+ params: {
+ fragment_id: i,
+ upload_token: startUploadInfo.upload_token,
+ },
+ body: chunk,
+ },
+ false,
+ );
+ if (chunkUploadRes.result !== 1) {
+ throw new Error("分片上传失败!");
+ }
+ console.log(
+ `${i} / ${chunkRange.length} 分片上传结果:${chunkUploadRes}`,
+ );
+ }
- const range = chunkRange[i];
- // 获取要上传的视频分片
- const chunk = await readBlobRange(
- this.videoPubParams.video.file,
- range.start,
- range.end,
+ // 分片上传完成
+ const completeRes = await this.kwaiPlat.request(
+ {
+ url: `${KwaiApiUploadProxyUrl}api/upload/complete`,
+ method: "POST",
+ params: {
+ fragment_count: chunkRange.length,
+ upload_token: startUploadInfo.upload_token,
+ },
+ },
+ false,
);
- // 发起分片上传
- const chunkUploadRes = await this.kwaiPlat.request({
- url: `/kuaishoUploadApi/api/upload/fragment`,
+ this.onProgress(70, `正在发布视频...`);
+ if (completeRes.result !== 1) {
+ throw new Error("分片合并失败!");
+ }
+ console.log("分片上传完成:", completeRes);
+
+ const formData = new FormData();
+ formData.append("caption", " #分享转发 标题1 #推广昨品 ");
+ formData.append("cover", this.videoPubParams.cover!.file);
+ const pubRes = await this.kwaiPlat.request({
+ url: "/openapi/photo/publish",
method: "POST",
params: {
- fragment_id: i,
upload_token: startUploadInfo.upload_token,
},
- data: chunk,
+ data: formData,
});
- if (chunkUploadRes.result !== 1) {
- throw new Error("分片上传失败!");
+ if (pubRes.result !== 1) {
+ throw new Error(`视频发布失败:${pubRes.error}`);
}
- console.log(
- `${i} / ${chunkRange.length} 分片上传结果:${chunkUploadRes}`,
- );
- }
- // 分片上传完成
- const completeRes = await this.kwaiPlat.request({
- url: `/kuaishoUploadApi/api/upload/complete`,
- method: "POST",
- params: {
- fragment_count: chunkRange.length,
- upload_token: startUploadInfo.upload_token,
- },
- });
- this.onProgress(70, `正在发布视频...`);
- console.log("分片上传完成:", completeRes);
-
- const formData = new FormData();
- formData.append("caption", " #分享转发 标题1 #推广昨品 ");
- formData.append("cover", this.videoPubParams.cover!.file);
- const pubRes = await this.kwaiPlat.request({
- url: "/kuaishoApi/openapi/photo/publish",
- method: "POST",
- headers: {
- "Content-Type": "multipart/form-data",
- },
- params: {
- upload_token: startUploadInfo.upload_token,
- },
- data: formData,
- });
- console.log(pubRes);
-
- return {
- worksId: "",
- worksUrl: "",
- };
+ return {
+ worksId: "",
+ worksUrl: "",
+ success: true,
+ };
+ } catch (e) {
+ console.error(e);
+ return {
+ worksId: "",
+ worksUrl: "",
+ success: false,
+ failMsg: e instanceof Error ? e.message : "未知错误",
+ };
+ }
}
// 发起上传
private async _startUploadVideo() {
const res = await this.kwaiPlat.request({
url: "openapi/photo/start_upload",
- method: "GET",
+ method: "POST",
});
- return res.data as {
+ return res as {
result: number;
upload_token: string;
endpoint: string;
diff --git a/src/store/bellMessageStroe.ts b/src/store/bellMessageStroe.ts
index 82ff1564..b8d80b4e 100644
--- a/src/store/bellMessageStroe.ts
+++ b/src/store/bellMessageStroe.ts
@@ -4,6 +4,7 @@ import lodash from "lodash";
// import { PublishProgressRes } from "../../electron/main/plat/pub/PubItemVideo";
// import { onVideoPublishProgress } from "../icp/receiveMsg";
import { PubStatus } from "@/app/config/publishConfig";
+import { PublishProgressRes } from "@/app/plat/plat.type";
export interface NoticeItem {
title: string;
@@ -53,22 +54,20 @@ export const useBellMessageStroe = create(
set({ noticeMap });
},
- // 发布进度监听
- videoPublishProgressInit() {
- // onVideoPublishProgress((progressData) => {
- // const noticeMap = new Map(get().noticeMap);
- // const noticeList = noticeMap.get(NoticeType.PubNotice) || [];
- // const noticeItem = noticeList.find((v) => v.id === progressData.id);
- //
- // noticeItem?.pub?.progressList.find((v, i) => {
- // if (v.account.id === progressData.account.id) {
- // noticeItem!.pub!.progressList[i] = progressData;
- // return true;
- // }
- // });
- //
- // set({ noticeMap });
- // });
+ // 发布进度设置
+ publishProgressSet(progressData: PublishProgressRes) {
+ const noticeMap = new Map(get().noticeMap);
+ const noticeList = noticeMap.get(NoticeType.PubNotice) || [];
+ const noticeItem = noticeList.find((v) => v.id === progressData.id);
+
+ noticeItem?.pub?.progressList.find((v, i) => {
+ if (v.account.id === progressData.account.id) {
+ noticeItem!.pub!.progressList[i] = progressData;
+ return true;
+ }
+ });
+
+ set({ noticeMap });
},
};
return methods;
diff --git a/src/utils/FetchService/FetchService.ts b/src/utils/FetchService/FetchService.ts
index ee5877ff..8f4ce237 100644
--- a/src/utils/FetchService/FetchService.ts
+++ b/src/utils/FetchService/FetchService.ts
@@ -40,7 +40,9 @@ class FetchService<T = Response> {
}
// body 参数处理
- const fetchURL = requestParams.url.startsWith('http') ? requestParams.url : this.baseURL + requestParams.url;
+ const fetchURL = requestParams.url.startsWith("http")
+ ? requestParams.url
+ : this.baseURL + requestParams.url;
if (!requestParams.body && requestParams.data) {
// 检查是否为FormData
if (requestParams.data instanceof FormData) {
@@ -55,10 +57,14 @@ class FetchService<T = Response> {
requestParams.data = this._filterDictUndefined(requestParams.data);
requestParams = {
...requestParams,
- body: JSON.stringify(requestParams.data),
+ body: requestParams.body
+ ? requestParams.body
+ : JSON.stringify(requestParams.data),
headers: {
...(requestParams["headers"] || {}),
- "content-type": "application/json",
+ "content-type":
+ // @ts-ignore
+ requestParams["headers"]["Content-Type"] ?? "application/json",
},
};
}