chore: sync GovOPlaN module split state
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import type { ApiSettings } from "../types";
|
||||
import type { ApiSettings, DeltaDeletedItem } from "../types";
|
||||
import { apiFetch } from "./client";
|
||||
|
||||
export type MailSecurity = "plain" | "tls" | "starttls";
|
||||
@@ -95,6 +95,10 @@ export type MailMailboxMessageListResponse = {
|
||||
total_count?: number;
|
||||
offset?: number;
|
||||
limit?: number;
|
||||
cursor?: string | null;
|
||||
next_cursor?: string | null;
|
||||
cursor_stable?: boolean;
|
||||
full?: boolean;
|
||||
messages: MailMailboxMessageSummary[];
|
||||
};
|
||||
|
||||
@@ -127,6 +131,16 @@ export type MailServerProfile = {
|
||||
|
||||
export type MailServerProfileListResponse = { profiles: MailServerProfile[] };
|
||||
|
||||
export type MailSettingsDeltaResponse = {
|
||||
profiles: MailServerProfile[];
|
||||
policy?: MailProfilePolicyResponse | null;
|
||||
changed_sections?: string[];
|
||||
deleted: DeltaDeletedItem[];
|
||||
watermark?: string | null;
|
||||
has_more: boolean;
|
||||
full: boolean;
|
||||
};
|
||||
|
||||
export const mailProfilePatternKeys = [
|
||||
"smtp_hosts",
|
||||
"imap_hosts",
|
||||
@@ -215,6 +229,28 @@ export async function listMailServerProfiles(settings: ApiSettings, includeInact
|
||||
return response.profiles ?? [];
|
||||
}
|
||||
|
||||
export async function fetchMailSettingsDelta(
|
||||
settings: ApiSettings,
|
||||
params: {
|
||||
scope_type?: MailProfileScope;
|
||||
scope_id?: string | null;
|
||||
include_inactive?: boolean;
|
||||
campaign_id?: string | null;
|
||||
since?: string | null;
|
||||
limit?: number;
|
||||
} = {}
|
||||
): Promise<MailSettingsDeltaResponse> {
|
||||
const search = new URLSearchParams();
|
||||
if (params.scope_type) search.set("scope_type", params.scope_type);
|
||||
if (params.scope_id) search.set("scope_id", params.scope_id);
|
||||
if (params.include_inactive) search.set("include_inactive", "true");
|
||||
if (params.campaign_id) search.set("campaign_id", params.campaign_id);
|
||||
if (params.since) search.set("since", params.since);
|
||||
if (params.limit) search.set("limit", String(params.limit));
|
||||
const suffix = search.toString() ? `?${search.toString()}` : "";
|
||||
return apiFetch<MailSettingsDeltaResponse>(settings, `/api/v1/mail/settings/delta${suffix}`);
|
||||
}
|
||||
|
||||
export async function createMailServerProfile(settings: ApiSettings, payload: MailServerProfilePayload): Promise<MailServerProfile> {
|
||||
return apiFetch<MailServerProfile>(settings, "/api/v1/mail/profiles", {
|
||||
method: "POST",
|
||||
@@ -284,9 +320,11 @@ export async function listMailboxMessages(
|
||||
profileId: string,
|
||||
folder = "INBOX",
|
||||
limit = 50,
|
||||
offset = 0
|
||||
offset = 0,
|
||||
cursor?: string | null
|
||||
): Promise<MailMailboxMessageListResponse> {
|
||||
const params = new URLSearchParams({ folder, limit: String(limit), offset: String(offset) });
|
||||
if (cursor) params.set("cursor", cursor);
|
||||
return apiFetch<MailMailboxMessageListResponse>(settings, `/api/v1/mail/profiles/${encodeURIComponent(profileId)}/mailbox/messages?${params.toString()}`);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user