u
This commit is contained in:
commit
c570ec514c
550 files changed
+152597
No files matched your search
@@ -0,0 +1,90 @@
|
||||
import { httpGet, httpPostJson, httpDownloadFile, httpPostUpload } from "@/utils/http";
|
||||
import type { EmailFolder, EmailSummary, EmailDetail, EmailFile } from "@/types/email";
|
||||
import type { AxiosResponse, AxiosProgressEvent } from "axios";
|
||||
|
||||
export const getEmailFolderApi = () => {
|
||||
return httpGet<EmailFolder[]>("/email/getFolder");
|
||||
};
|
||||
|
||||
export interface GetEmailSummaryPageParams extends BasePageParams {
|
||||
folderId: string;
|
||||
}
|
||||
|
||||
export const getEmailSummaryPageApi = (params: GetEmailSummaryPageParams) => {
|
||||
return httpPostJson<BasePageResult<EmailSummary>>("/email/summary", params);
|
||||
};
|
||||
|
||||
export const getEmailDetailApi = (emailId: string) => {
|
||||
return httpGet<EmailDetail>(`/email/detail/${emailId}`);
|
||||
};
|
||||
|
||||
export interface DownloadEmailFileParams {
|
||||
uid: string;
|
||||
folderName: string;
|
||||
partIndex: number;
|
||||
}
|
||||
|
||||
export const downloadEmailFileApi = (params: DownloadEmailFileParams): Promise<AxiosResponse<Blob>> => {
|
||||
return httpDownloadFile("/email/download", params);
|
||||
};
|
||||
|
||||
export const initEmailAllDataApi = () => {
|
||||
return httpGet("/email/init");
|
||||
};
|
||||
|
||||
export const uploadTempFile = (file: File, onUploadProgress?: (progressEvent: AxiosProgressEvent) => void) => {
|
||||
const formData = new FormData();
|
||||
formData.append("file", file);
|
||||
|
||||
return httpPostUpload<EmailFile>("/email/upload-temp", formData, onUploadProgress);
|
||||
};
|
||||
|
||||
export const deleteTempFile = (id: string) => {
|
||||
return httpPostJson<void>("/email/delete-temp", {
|
||||
id: id
|
||||
});
|
||||
};
|
||||
|
||||
export interface EmailSentDTO {
|
||||
emailId: string;
|
||||
subject: string; // 邮件主题
|
||||
body: string;
|
||||
from: string;
|
||||
fromName: string;
|
||||
isSingSent: number;
|
||||
isHtml: number;
|
||||
|
||||
toRecipients: string[]; // 收件人
|
||||
ccRecipients: string[]; // 抄送
|
||||
bccRecipients: string[]; // 密送
|
||||
|
||||
attachments: EmailFile[];
|
||||
inlines: EmailFile[];
|
||||
|
||||
isSent: number;
|
||||
}
|
||||
export const sentEmailApi = (params: EmailSentDTO) => {
|
||||
return httpPostJson<EmailSummary>("/email/sent", params);
|
||||
};
|
||||
|
||||
export const testErrorApi = (params: { name: string; age: number }) => {
|
||||
return httpGet<void>("/test", params);
|
||||
};
|
||||
|
||||
export interface UpdateEmailSeenDTO {
|
||||
folderId: string;
|
||||
emailIds: string[];
|
||||
isSeen: number;
|
||||
}
|
||||
|
||||
export const updateEmailSeenApi = (params: UpdateEmailSeenDTO) => {
|
||||
return httpPostJson<void>("/email/updateSeen", params);
|
||||
};
|
||||
|
||||
export interface DeleteEmailParams {
|
||||
folderId: string;
|
||||
emailIds: string[];
|
||||
}
|
||||
export const deleteEmailApi = (params: DeleteEmailParams) => {
|
||||
return httpPostJson<void>("/email/delete", params);
|
||||
};
|
||||
Reference in new issue
Block a user