/** * @bunkor/crypto — SecureEmailClient * * Repository-pattern client for the full Bunkor Secure Email API lifecycle: * drafts, send, inbox, sent, trash, actions, attachments, vault-attach. * * Design patterns: * - Repository: clean domain interface over the Bunkor Secure Email API * - Template Method: auth + transport from BaseClient * * Usage: * ```ts * const mail = new SecureEmailClient({ apiUrl: 'https://lockbox-app-…', apiToken: 'sk_…' }); * const draft = await mail.createDraft({ subject: 'Hello', recipients: ['alice@example.com'] }); * await mail.sendDraft(draft.email_id); * ``` * * Licensed under the Apache License, Version 2.0 */ import { BunkorConfig } from '../config'; import { BaseClient } from './base.client'; import { CreateDraftRequest, CreateDraftResponse, UpdateDraftRequest, UpdateDraftResponse, SendDraftResponse, CreateSecureEmailRequest, CreateSecureEmailResponse, AccessSecureEmailResponse, DraftsEmailsResponse, SentEmailsResponse, InboxEmailsResponse, TrashEmailsResponse, EmailDetailResponse, EmailActionResponse, MarkReadResponse, UnreadCountResponse, AddAttachmentRequest, AddAttachmentResponse, InitiateAttachmentUploadRequest, InitiateAttachmentUploadResponse, ConfirmAttachmentUploadRequest, ConfirmAttachmentUploadResponse, AttachVaultFileRequest, AttachVaultFileResponse } from '../models/email.models'; export declare class SecureEmailClient extends BaseClient { private readonly base; constructor(config: BunkorConfig); /** * Create a new email draft. * All fields are optional — drafts can be saved incrementally. */ createDraft(request?: CreateDraftRequest): Promise; /** Update an existing draft (DRAFT status only). */ updateDraft(emailId: string, request: UpdateDraftRequest): Promise; /** Send a draft — transitions it from DRAFT → SENT and notifies recipients. */ sendDraft(emailId: string): Promise; /** * Create and immediately send a secure email (legacy single-step flow). * New code should prefer `createDraft` → `sendDraft` for attachment support. */ createAndSend(request: CreateSecureEmailRequest): Promise; /** List draft emails with pagination. */ listDrafts(params?: { page?: number; page_size?: number; }): Promise; /** List sent emails with pagination. */ listSent(params?: { page?: number; page_size?: number; filter_expired?: boolean; }): Promise; /** List received (inbox) emails with pagination. */ listInbox(params?: { page?: number; page_size?: number; filter_expired?: boolean; }): Promise; /** List trashed emails with pagination. */ listTrash(params?: { page?: number; page_size?: number; }): Promise; /** Get full email detail including encrypted content and attachments. */ getEmail(emailId: string): Promise; /** * Access a secure email via its access token (public, no Bunkor auth). * Returns the encrypted content — caller decrypts with the shared password. */ accessEmail(emailId: string, accessToken: string): Promise; /** Move an email to the trash. */ trashEmail(emailId: string): Promise; /** Restore an email from the trash. */ restoreEmail(emailId: string): Promise; /** Permanently delete an email (must be in TRASH status). */ deleteEmail(emailId: string): Promise; /** Mark an email as read. */ markAsRead(emailId: string): Promise; /** Mark an email as unread. */ markAsUnread(emailId: string): Promise; /** Get the count of unread inbox emails. */ getUnreadCount(): Promise; /** * Initiate a resumable upload for an email attachment. * Returns a session URL for direct provider upload (GCS / S3). */ initiateAttachmentUpload(emailId: string, request: InitiateAttachmentUploadRequest): Promise; /** Confirm a completed resumable attachment upload and register it on the email. */ confirmAttachmentUpload(emailId: string, request: ConfirmAttachmentUploadRequest): Promise; /** * Attach an existing vault file without re-uploading it. * The caller must re-wrap the file's encryption key for the email password. */ attachVaultFile(emailId: string, request: AttachVaultFileRequest): Promise; /** * Add an already-uploaded attachment record to an email (legacy direct upload). * Prefer the resumable upload flow for large files. */ addAttachment(emailId: string, request: AddAttachmentRequest): Promise; /** Delete an attachment from an email. */ deleteAttachment(emailId: string, attachmentId: string): Promise; /** Download an attachment (returns a signed URL or blob). */ downloadAttachment(emailId: string, attachmentId: string, accessToken?: string): Promise<{ download_url: string; }>; private paginationParams; } //# sourceMappingURL=secure-email.client.d.ts.map