Release v0.1.4
This commit is contained in:
@@ -92,6 +92,38 @@ export type CampaignWorkspaceQuery = {
|
||||
includeVersions?: boolean;
|
||||
};
|
||||
|
||||
export type RecipientImportColumnKind = "ignore" | "id" | "active" | "name" | "from" | "to" | "cc" | "bcc" | "reply_to" | "field" | "new_field" | "attachment_pattern";
|
||||
|
||||
export type RecipientImportColumnMappingProfileItem = {
|
||||
columnIndex: number;
|
||||
kind: RecipientImportColumnKind;
|
||||
fieldName?: string | null;
|
||||
newFieldName?: string | null;
|
||||
};
|
||||
|
||||
export type RecipientImportMappingProfile = {
|
||||
id: string;
|
||||
name: string;
|
||||
createdAt: string;
|
||||
updatedAt: string;
|
||||
columnCount: number;
|
||||
headers: string[];
|
||||
normalizedHeaders: string[];
|
||||
orderedHeaderFingerprint: string;
|
||||
unorderedHeaderFingerprint: string;
|
||||
delimiter: "," | ";" | "\t";
|
||||
headerRows: number;
|
||||
quoted: boolean;
|
||||
valueSeparators: string;
|
||||
mappings: RecipientImportColumnMappingProfileItem[];
|
||||
};
|
||||
|
||||
export type RecipientImportMappingProfilePayload = Omit<RecipientImportMappingProfile, "id" | "createdAt" | "updatedAt">;
|
||||
|
||||
export type RecipientImportMappingProfileListResponse = {
|
||||
profiles: RecipientImportMappingProfile[];
|
||||
};
|
||||
|
||||
export type CampaignVersionUpdatePayload = {
|
||||
campaign_json?: Record<string, unknown> | null;
|
||||
current_flow?: string | null;
|
||||
@@ -298,6 +330,36 @@ export async function listCampaigns(settings: ApiSettings): Promise<CampaignList
|
||||
return response.campaigns ?? response.items ?? response.results ?? [];
|
||||
}
|
||||
|
||||
export async function listRecipientImportMappingProfiles(settings: ApiSettings): Promise<RecipientImportMappingProfile[]> {
|
||||
const response = await apiFetch<RecipientImportMappingProfileListResponse>(settings, "/api/v1/campaigns/recipient-import/mapping-profiles");
|
||||
return response.profiles ?? [];
|
||||
}
|
||||
|
||||
export async function createRecipientImportMappingProfile(
|
||||
settings: ApiSettings,
|
||||
payload: RecipientImportMappingProfilePayload
|
||||
): Promise<RecipientImportMappingProfile> {
|
||||
return apiFetch<RecipientImportMappingProfile>(settings, "/api/v1/campaigns/recipient-import/mapping-profiles", {
|
||||
method: "POST",
|
||||
body: JSON.stringify(payload)
|
||||
});
|
||||
}
|
||||
|
||||
export async function updateRecipientImportMappingProfile(
|
||||
settings: ApiSettings,
|
||||
profileId: string,
|
||||
payload: RecipientImportMappingProfilePayload
|
||||
): Promise<RecipientImportMappingProfile> {
|
||||
return apiFetch<RecipientImportMappingProfile>(settings, `/api/v1/campaigns/recipient-import/mapping-profiles/${encodeURIComponent(profileId)}`, {
|
||||
method: "PUT",
|
||||
body: JSON.stringify(payload)
|
||||
});
|
||||
}
|
||||
|
||||
export async function deleteRecipientImportMappingProfile(settings: ApiSettings, profileId: string): Promise<void> {
|
||||
await apiFetch<void>(settings, `/api/v1/campaigns/recipient-import/mapping-profiles/${encodeURIComponent(profileId)}`, { method: "DELETE" });
|
||||
}
|
||||
|
||||
export async function getCampaign(settings: ApiSettings, campaignId: string): Promise<CampaignListItem> {
|
||||
return apiFetch<CampaignListItem>(settings, `/api/v1/campaigns/${campaignId}`);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user