klok-mail-v1

Property Value
Repository klok/datamodel/public/klok-mail-v1
Tenant / domain klok / public
Version 1.0.0-build.261123141730
Built from f6aba628, pipeline
Schema schema-definition-xsd/klok-mail-v1.xsd
Namespace dev.klok.klok.public
Root element KlokMail_v1, type KlokMail_v1
Types 10 complex, 1 simple (1 enumerations)
Java class dev.klok.klok.datamodel.public_.klok_mail_v1.KlokMail_v1
Artifact dev.klok.klok.datamodel:klok-mail-v1:1.0.0-build.261123141730
Used by the projects that use it

Overview

KlokMail_v1 defines the contract for Klok's shared mail service. It describes three things: a mail received for an account, a mail an account wants sent, and the outcome of a send request. The model is provider neutral. Postmark formats live inside klok-postmark-ingress and klok-postmark-egress, not in the model, so a client never sees them. A field a provider cannot express is ignored by that provider's egress.

The model is class A, public, owned by the Klok platform as part of solution KLK006 Messaging Services. The services that publish and consume it, klok-postmark-ingress, klok-postmark-egress and klok-api-mail, are designed but not built yet, so nothing publishes or consumes the model today. When they are, an ingress receives provider webhooks and publishes inbound mail, a client publishes a send request, the egress sends it and answers with the result, and klok-api-mail routes Klok AI's mail to mailboxes and writes Klok Svar's drafts.

Traffic is split across two namespaces. In klok/mail the account, the provider server the mail came in on or the result belongs to, decides the purpose; the topic decides the account, never a field. In klok/mailbox, Klok AI's mail routed by address to mailboxes by klok-api-mail, the purpose is the reader the mail belongs to. A routed mail carries its mailbox and its threadId; a notice to a person's ordinary address carries neither.

What travels is one of three records: KlokMailInboundV1 (keyed by providerMessageId), KlokMailOutboundV1 and KlokMailSendResultV1 (both keyed by sendKey), each on its own topic. A fourth record, KlokMailDraftV1, holds a Klok Svar draft and a person's decision about it. The root KlokMail_v1 only ties the schema together; clients inspect which child element is populated to tell the records apart.

Types

Type Description
KlokMail_v1 –
KlokMailInboundV1 A mail received for an account, published on KlokMailInboundV1_account keyed by providerMessageId.
KlokMailOutboundV1 A mail the account wants sent, published on KlokMailOutboundV1_account keyed by sendKey.
KlokMailSendResultV1 The outcome of one KlokMailOutboundV1, published on KlokMailSendResultV1_account keyed by sendKey.
KlokMailDraftV1 Klok Svar's draft answer to the newest mail of a thread of a SVAR mailbox, and what a person decided about it (KLK006A13, published on klok/mailbox/KlokMailDraftV1_svar keyed by draftId).
KlokMailAddressV1 One mailbox: the address and the optional display name.
KlokMailHeaderV1 One mail header, name and value as they appear in the message.
KlokMailAttachmentV1 One attachment.
KlokMailMailboxRefV1 The mailbox a routed mail belongs to (KLK006).
KlokMailKeyValueV1 Client metadata: sent with the mail where the provider supports it, and always echoed in the send result.

Where this documentation comes from

This site is written by KlokDocumentationEgress from the project's code, its hand written klok-docs/ folder and the tenant's documentation generation settings, on every main pipeline of klok/datamodel/public/klok-mail-v1. Nobody edits it by hand.

To change Edit
Hand written pages, their order, and where a generated section appears in them klok-docs/ in klok/datamodel/public/klok-mail-v1
What is generated and how: chapters, sections, prompts, languages, model klok.dev, Tenant Administration, Documentation generation