import { RpcMethod } from './commonTypes'; export type DeliverabilityCheckerService_CreateSandboxCheck = RpcMethod; export type DeliverabilityCheckerService_GetSandboxResult = RpcMethod; export interface DeliverabilityCheckerService { /** Starts an email deliverability sandbox check: sends the email preset (preset code) as a real test email to a test device (HWID) and runs compliance and content checks. Returns a message code to poll with get_deliverability_result; run before a broadcast to catch spam-score, broken-link and unsubscribe issues. */ CreateSandboxCheck: DeliverabilityCheckerService_CreateSandboxCheck; /** Returns the state and, when finished, the delivery result and deliverability report (spam score, broken links, unsubscribe health) for a sandbox check by message code. Poll after create_deliverability_check until state is SANDBOX_DONE or SANDBOX_FAILED. */ GetSandboxResult: DeliverabilityCheckerService_GetSandboxResult; } export type CreateSandboxCheckRequest = { /** Pushwoosh application code (XXXXX-XXXXX) that owns the preset and test device. */ applicationCode?: string; /** Email preset code whose content is checked; required. */ presetCode?: string; /** Test device HWID that receives the sandbox test email; required. */ testDeviceHwid?: string; /** Optional from / reply-to / subject overrides applied to the preset before sending. */ overrides?: EmailOverrides; }; export type EmailOverrides = { from: EmailAddress; replyTo: EmailAddress; subjects: Record; }; export type EmailAddress = { name: string; email: string; }; export type CreateSandboxCheckResponse = { messageCode: string; }; export type GetSandboxResultRequest = { /** Message code returned by create_deliverability_check identifying the sandbox check to fetch. */ messageCode?: string; }; export type GetSandboxResultResponse = { state: SandboxState; recipient: string; /** Populated when state == SANDBOX_DONE. */ delivery: DeliveryResult; report: DeliverabilityReport; /** Populated when state == SANDBOX_FAILED. */ errorMessage: string; }; export type SandboxState = 'SANDBOX_STATE_UNSPECIFIED' | 'SANDBOX_PENDING' | 'SANDBOX_DONE' | 'SANDBOX_FAILED' | 'SANDBOX_NOT_FOUND'; export type DeliveryResult = { delivered: boolean; smtpStatus: number; smtpMessage: string; }; export type DeliverabilityReport = { groups: CheckGroup[]; summary: Summary; }; export type Summary = { level: Level; errors: number; warnings: number; }; export type CheckGroup = { groupId: GroupId; level: Level; checks: Check[]; }; export type GroupId = 'GROUP_ID_UNSPECIFIED' | 'GROUP_ID_COMPLIANCE' | 'GROUP_ID_CONTENT'; export type Check_details_size = { type: 'size'; data: SizeDetails; }; export type Check_details_listUnsubscribe = { type: 'listUnsubscribe'; data: ListUnsubscribeDetails; }; export type Check_details_unsubscribeUrlHealth = { type: 'unsubscribeUrlHealth'; data: UnsubscribeUrlHealthDetails; }; export type Check_details_visibleUnsubscribeLink = { type: 'visibleUnsubscribeLink'; data: VisibleUnsubLinkDetails; }; export type Check_details_physicalAddress = { type: 'physicalAddress'; data: PhysicalAddressDetails; }; export type Check_details_brokenLinks = { type: 'brokenLinks'; data: BrokenLinksDetails; }; export type Check_details_safeBrowsing = { type: 'safeBrowsing'; data: SafeBrowsingDetails; }; export type Check_details_trackerConsistency = { type: 'trackerConsistency'; data: TrackerConsistencyDetails; }; export type Check_details_spamScore = { type: 'spamScore'; data: SpamScoreDetails; }; export type Check_details_subjectLine = { type: 'subjectLine'; data: SubjectLineDetails; }; export type Check_details = Check_details_size | Check_details_listUnsubscribe | Check_details_unsubscribeUrlHealth | Check_details_visibleUnsubscribeLink | Check_details_physicalAddress | Check_details_brokenLinks | Check_details_safeBrowsing | Check_details_trackerConsistency | Check_details_spamScore | Check_details_subjectLine; export type Check = { ruleId: string; level: Level; status: CheckStatus; message: string; errorCount: number; warningCount: number; details: Check_details; }; export type SizeDetails = { actualBytes: number; limitWarning: number; limitError: number; }; export type ListUnsubscribeDetails = { missingHeader: boolean; missingHttps: boolean; missingPostOneClick: boolean; }; export type UnsubscribeUrlHealthDetails = { url: string; statusCode: number; timeout: boolean; reason: string; }; export type VisibleUnsubLinkDetails = { found: boolean; }; export type PhysicalAddressDetails = { found: boolean; matchedPattern: string; }; export type BrokenLinksDetails = { items: BrokenLinkItem[]; timeouts: number; }; export type BrokenLinkItem = { url: string; reason: string; statusCode: number; redirects: number; level: Level; }; export type SafeBrowsingDetails = { items: SafeBrowsingItem[]; malwareCheckStatus: string; }; export type SafeBrowsingItem = { url: string; category: string; source: string; level: Level; }; export type TrackerConsistencyDetails = { unwrappedCount: number; totalCount: number; unwrappedUrls: string[]; }; export type SpamScoreDetails = { score: number; action: string; breakdown: SpamScoreSymbol[]; disclaimer: string; }; export type SpamScoreSymbol = { rule: string; weight: number; }; export type SubjectLineDetails = { filledLocales: string[]; emptyLocales: string[]; }; export type Level = 'UNSPECIFIED' | 'INFO' | 'WARNING' | 'ERROR'; export type CheckStatus = 'CHECK_STATUS_UNSPECIFIED' | 'CHECK_STATUS_OK' | 'CHECK_STATUS_UNAVAILABLE' | 'CHECK_STATUS_TIMEOUT';