curl -X POST https://api.iterationlayer.com/document-generation/v1/generate \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"format": "epub",
"document": {
"metadata": {
"title": "Practical Guide to Event-Driven Architecture",
"author": "Sarah Chen"
},
"page": {
"size": { "preset": "A5" },
"margins": {
"top_in_pt": 54,
"right_in_pt": 54,
"bottom_in_pt": 54,
"left_in_pt": 54
}
},
"styles": {
"text": {
"font_family": "Helvetica",
"font_size_in_pt": 11.0,
"line_height": 1.5,
"color": "#333333"
},
"headline": {
"font_family": "Helvetica",
"font_size_in_pt": 24.0,
"color": "#111111",
"spacing_before_in_pt": 12.0,
"spacing_after_in_pt": 6.0,
"is_bold": true
},
"link": {
"color": "#0066CC",
"is_underlined": true
},
"list": {
"text_style": {
"font_family": "Helvetica",
"font_size_in_pt": 11.0,
"line_height": 1.5,
"color": "#333333"
},
"marker_color": "#333333",
"marker_gap_in_pt": 8.0
},
"table": {
"header": {
"background_color": "#333333",
"text_color": "#FFFFFF",
"font_size_in_pt": 11.0,
"is_bold": true
},
"body": {
"background_color": "#FFFFFF",
"text_color": "#333333",
"font_size_in_pt": 11.0
},
"border": {
"outer": {
"top": { "color": "#CCCCCC", "width_in_pt": 1.0 },
"right": { "color": "#CCCCCC", "width_in_pt": 1.0 },
"bottom": { "color": "#CCCCCC", "width_in_pt": 1.0 },
"left": { "color": "#CCCCCC", "width_in_pt": 1.0 }
},
"inner": {
"horizontal": { "color": "#EEEEEE", "width_in_pt": 0.5 },
"vertical": { "color": "#EEEEEE", "width_in_pt": 0.5 }
}
}
},
"grid": {
"background_color": "#FFFFFF",
"border_color": "#CCCCCC",
"border_width_in_pt": 0.0,
"gap_in_pt": 12.0
},
"separator": {
"color": "#CCCCCC",
"thickness_in_pt": 1.0,
"spacing_before_in_pt": 12.0,
"spacing_after_in_pt": 12.0
},
"image": {
"border_color": "#000000",
"border_width_in_pt": 0.0
}
},
"content": [
{ "type": "headline", "level": "h1", "text": "Practical Guide to Event-Driven Architecture" },
{ "type": "paragraph", "markdown": "*By Sarah Chen*" },
{ "type": "separator" },
{ "type": "table-of-contents", "levels": ["h1", "h2"], "leader": "dots" },
{ "type": "page-break" },
{ "type": "headline", "level": "h1", "text": "Chapter 1: Core Concepts" },
{ "type": "paragraph", "markdown": "Event-driven architecture (EDA) is a software design pattern in which the flow of the program is determined by **events** — significant changes in state that the system needs to react to. Unlike traditional request-response models, EDA decouples producers from consumers, enabling systems to scale independently." },
{ "type": "paragraph", "markdown": "At its core, every event-driven system consists of three parts: **event producers**, which detect and publish state changes; **event channels**, which transport events between components; and **event consumers**, which react to incoming events by executing business logic." },
{ "type": "list", "variant": "unordered", "items": [
{ "text": "Loose coupling between services" },
{ "text": "Independent scalability of producers and consumers" },
{ "text": "Natural audit trail through event logs" },
{ "text": "Resilience through asynchronous processing" }
]},
{ "type": "page-break" },
{ "type": "headline", "level": "h1", "text": "Chapter 2: Messaging Patterns" },
{ "type": "paragraph", "markdown": "Choosing the right messaging pattern is critical to building a reliable event-driven system. The two most common approaches are **publish-subscribe** and **event streaming**. Publish-subscribe delivers events to all interested subscribers in real time, while event streaming persists events in an ordered log that consumers can replay at their own pace." },
{ "type": "paragraph", "markdown": "A robust messaging layer must handle **at-least-once delivery**, **idempotency**, and **ordering guarantees**. Without these properties, consumers may process duplicate events, miss events entirely, or see them out of order — all of which can corrupt downstream state." },
{
"type": "table",
"column_widths_in_percent": [30, 35, 35],
"header": {
"cells": [
{ "text": "Pattern" },
{ "text": "Best For" },
{ "text": "Trade-off" }
]
},
"rows": [
{ "cells": [
{ "text": "Publish-Subscribe" },
{ "text": "Real-time notifications" },
{ "text": "No replay capability" }
]},
{ "cells": [
{ "text": "Event Streaming" },
{ "text": "Audit logs, replay" },
{ "text": "Higher storage cost" }
]},
{ "cells": [
{ "text": "Request-Reply" },
{ "text": "Synchronous workflows" },
{ "text": "Tight coupling" }
]}
]
},
{ "type": "page-break" },
{ "type": "headline", "level": "h1", "text": "Chapter 3: Implementation Strategies" },
{ "type": "paragraph", "markdown": "When implementing event-driven architecture in production, start with a **single event bus** and a small number of well-defined event types. Resist the temptation to model every state change as an event. Instead, focus on domain events that carry business meaning — an order was placed, a payment was processed, a shipment was dispatched." },
{ "type": "paragraph", "markdown": "Adopt a **schema registry** early to enforce contracts between producers and consumers. Versioned schemas prevent breaking changes from propagating through the system and make it safe for teams to evolve their events independently." },
{ "type": "list", "variant": "ordered", "items": [
{ "text": "Define your domain events and their schemas" },
{ "text": "Set up a message broker with dead-letter queues" },
{ "text": "Implement idempotent consumers with deduplication" },
{ "text": "Add monitoring and alerting for consumer lag" },
{ "text": "Introduce event versioning and a schema registry" }
]}
]
}
}'{
"success": true,
"data": {
"buffer": "UEsDBBQAAAAIAA...",
"mime_type": "application/epub+zip"
}
}import { IterationLayer } from "iterationlayer";
const client = new IterationLayer({ apiKey: "YOUR_API_KEY" });
const result = await client.generateDocument({
format: "epub",
document: {
metadata: {
title: "Practical Guide to Event-Driven Architecture",
author: "Sarah Chen",
},
page: {
size: { preset: "A5" },
margins: {
top_in_pt: 54,
right_in_pt: 54,
bottom_in_pt: 54,
left_in_pt: 54,
},
},
styles: {
text: {
font_family: "Helvetica",
font_size_in_pt: 11.0,
line_height: 1.5,
color: "#333333",
},
headline: {
font_family: "Helvetica",
font_size_in_pt: 24.0,
color: "#111111",
spacing_before_in_pt: 12.0,
spacing_after_in_pt: 6.0,
is_bold: true,
},
link: {
color: "#0066CC",
is_underlined: true,
},
list: {
text_style: {
font_family: "Helvetica",
font_size_in_pt: 11.0,
line_height: 1.5,
color: "#333333",
},
marker_color: "#333333",
marker_gap_in_pt: 8.0,
},
table: {
header: {
background_color: "#333333",
text_color: "#FFFFFF",
font_size_in_pt: 11.0,
is_bold: true,
},
body: {
background_color: "#FFFFFF",
text_color: "#333333",
font_size_in_pt: 11.0,
},
border: {
outer: {
top: { color: "#CCCCCC", width_in_pt: 1.0 },
right: { color: "#CCCCCC", width_in_pt: 1.0 },
bottom: { color: "#CCCCCC", width_in_pt: 1.0 },
left: { color: "#CCCCCC", width_in_pt: 1.0 },
},
inner: {
horizontal: { color: "#EEEEEE", width_in_pt: 0.5 },
vertical: { color: "#EEEEEE", width_in_pt: 0.5 },
},
},
},
grid: {
background_color: "#FFFFFF",
border_color: "#CCCCCC",
border_width_in_pt: 0.0,
gap_in_pt: 12.0,
},
separator: {
color: "#CCCCCC",
thickness_in_pt: 1.0,
spacing_before_in_pt: 12.0,
spacing_after_in_pt: 12.0,
},
image: {
border_color: "#000000",
border_width_in_pt: 0.0,
},
},
content: [
{ type: "headline", level: "h1", text: "Practical Guide to Event-Driven Architecture" },
{ type: "paragraph", markdown: "*By Sarah Chen*" },
{ type: "separator" },
{ type: "table-of-contents", levels: ["h1", "h2"], leader: "dots" },
{ type: "page-break" },
{ type: "headline", level: "h1", text: "Chapter 1: Core Concepts" },
{ type: "paragraph", markdown: "Event-driven architecture (EDA) is a software design pattern in which the flow of the program is determined by **events** — significant changes in state that the system needs to react to. Unlike traditional request-response models, EDA decouples producers from consumers, enabling systems to scale independently." },
{ type: "paragraph", markdown: "At its core, every event-driven system consists of three parts: **event producers**, which detect and publish state changes; **event channels**, which transport events between components; and **event consumers**, which react to incoming events by executing business logic." },
{ type: "list", variant: "unordered", items: [
{ text: "Loose coupling between services" },
{ text: "Independent scalability of producers and consumers" },
{ text: "Natural audit trail through event logs" },
{ text: "Resilience through asynchronous processing" },
]},
{ type: "page-break" },
{ type: "headline", level: "h1", text: "Chapter 2: Messaging Patterns" },
{ type: "paragraph", markdown: "Choosing the right messaging pattern is critical to building a reliable event-driven system. The two most common approaches are **publish-subscribe** and **event streaming**. Publish-subscribe delivers events to all interested subscribers in real time, while event streaming persists events in an ordered log that consumers can replay at their own pace." },
{ type: "paragraph", markdown: "A robust messaging layer must handle **at-least-once delivery**, **idempotency**, and **ordering guarantees**. Without these properties, consumers may process duplicate events, miss events entirely, or see them out of order — all of which can corrupt downstream state." },
{
type: "table",
column_widths_in_percent: [30, 35, 35],
header: {
cells: [
{ text: "Pattern" },
{ text: "Best For" },
{ text: "Trade-off" },
],
},
rows: [
{ cells: [
{ text: "Publish-Subscribe" },
{ text: "Real-time notifications" },
{ text: "No replay capability" },
]},
{ cells: [
{ text: "Event Streaming" },
{ text: "Audit logs, replay" },
{ text: "Higher storage cost" },
]},
{ cells: [
{ text: "Request-Reply" },
{ text: "Synchronous workflows" },
{ text: "Tight coupling" },
]},
],
},
{ type: "page-break" },
{ type: "headline", level: "h1", text: "Chapter 3: Implementation Strategies" },
{ type: "paragraph", markdown: "When implementing event-driven architecture in production, start with a **single event bus** and a small number of well-defined event types. Resist the temptation to model every state change as an event. Instead, focus on domain events that carry business meaning — an order was placed, a payment was processed, a shipment was dispatched." },
{ type: "paragraph", markdown: "Adopt a **schema registry** early to enforce contracts between producers and consumers. Versioned schemas prevent breaking changes from propagating through the system and make it safe for teams to evolve their events independently." },
{ type: "list", variant: "ordered", items: [
{ text: "Define your domain events and their schemas" },
{ text: "Set up a message broker with dead-letter queues" },
{ text: "Implement idempotent consumers with deduplication" },
{ text: "Add monitoring and alerting for consumer lag" },
{ text: "Introduce event versioning and a schema registry" },
]},
],
},
});
console.log(result);{
"success": true,
"data": {
"buffer": "UEsDBBQAAAAIAA...",
"mime_type": "application/epub+zip"
}
}from iterationlayer import IterationLayer
client = IterationLayer(api_key="YOUR_API_KEY")
result = client.generate_document(
format="epub",
document={
"metadata": {
"title": "Practical Guide to Event-Driven Architecture",
"author": "Sarah Chen",
},
"page": {
"size": {"preset": "A5"},
"margins": {
"top_in_pt": 54,
"right_in_pt": 54,
"bottom_in_pt": 54,
"left_in_pt": 54,
},
},
"styles": {
"text": {
"font_family": "Helvetica",
"font_size_in_pt": 11.0,
"line_height": 1.5,
"color": "#333333",
},
"headline": {
"font_family": "Helvetica",
"font_size_in_pt": 24.0,
"color": "#111111",
"spacing_before_in_pt": 12.0,
"spacing_after_in_pt": 6.0,
"is_bold": True,
},
"link": {
"color": "#0066CC",
"is_underlined": True,
},
"list": {
"text_style": {
"font_family": "Helvetica",
"font_size_in_pt": 11.0,
"line_height": 1.5,
"color": "#333333",
},
"marker_color": "#333333",
"marker_gap_in_pt": 8.0,
},
"table": {
"header": {
"background_color": "#333333",
"text_color": "#FFFFFF",
"font_size_in_pt": 11.0,
"is_bold": True,
},
"body": {
"background_color": "#FFFFFF",
"text_color": "#333333",
"font_size_in_pt": 11.0,
},
"border": {
"outer": {
"top": {"color": "#CCCCCC", "width_in_pt": 1.0},
"right": {"color": "#CCCCCC", "width_in_pt": 1.0},
"bottom": {"color": "#CCCCCC", "width_in_pt": 1.0},
"left": {"color": "#CCCCCC", "width_in_pt": 1.0},
},
"inner": {
"horizontal": {"color": "#EEEEEE", "width_in_pt": 0.5},
"vertical": {"color": "#EEEEEE", "width_in_pt": 0.5},
},
},
},
"grid": {
"background_color": "#FFFFFF",
"border_color": "#CCCCCC",
"border_width_in_pt": 0.0,
"gap_in_pt": 12.0,
},
"separator": {
"color": "#CCCCCC",
"thickness_in_pt": 1.0,
"spacing_before_in_pt": 12.0,
"spacing_after_in_pt": 12.0,
},
"image": {
"border_color": "#000000",
"border_width_in_pt": 0.0,
},
},
"content": [
{"type": "headline", "level": "h1", "text": "Practical Guide to Event-Driven Architecture"},
{"type": "paragraph", "markdown": "*By Sarah Chen*"},
{"type": "separator"},
{"type": "table-of-contents", "levels": ["h1", "h2"], "leader": "dots"},
{"type": "page-break"},
{"type": "headline", "level": "h1", "text": "Chapter 1: Core Concepts"},
{"type": "paragraph", "markdown": "Event-driven architecture (EDA) is a software design pattern in which the flow of the program is determined by **events** — significant changes in state that the system needs to react to. Unlike traditional request-response models, EDA decouples producers from consumers, enabling systems to scale independently."},
{"type": "paragraph", "markdown": "At its core, every event-driven system consists of three parts: **event producers**, which detect and publish state changes; **event channels**, which transport events between components; and **event consumers**, which react to incoming events by executing business logic."},
{"type": "list", "variant": "unordered", "items": [
{"text": "Loose coupling between services"},
{"text": "Independent scalability of producers and consumers"},
{"text": "Natural audit trail through event logs"},
{"text": "Resilience through asynchronous processing"},
]},
{"type": "page-break"},
{"type": "headline", "level": "h1", "text": "Chapter 2: Messaging Patterns"},
{"type": "paragraph", "markdown": "Choosing the right messaging pattern is critical to building a reliable event-driven system. The two most common approaches are **publish-subscribe** and **event streaming**. Publish-subscribe delivers events to all interested subscribers in real time, while event streaming persists events in an ordered log that consumers can replay at their own pace."},
{"type": "paragraph", "markdown": "A robust messaging layer must handle **at-least-once delivery**, **idempotency**, and **ordering guarantees**. Without these properties, consumers may process duplicate events, miss events entirely, or see them out of order — all of which can corrupt downstream state."},
{
"type": "table",
"column_widths_in_percent": [30, 35, 35],
"header": {
"cells": [
{"text": "Pattern"},
{"text": "Best For"},
{"text": "Trade-off"},
],
},
"rows": [
{"cells": [
{"text": "Publish-Subscribe"},
{"text": "Real-time notifications"},
{"text": "No replay capability"},
]},
{"cells": [
{"text": "Event Streaming"},
{"text": "Audit logs, replay"},
{"text": "Higher storage cost"},
]},
{"cells": [
{"text": "Request-Reply"},
{"text": "Synchronous workflows"},
{"text": "Tight coupling"},
]},
],
},
{"type": "page-break"},
{"type": "headline", "level": "h1", "text": "Chapter 3: Implementation Strategies"},
{"type": "paragraph", "markdown": "When implementing event-driven architecture in production, start with a **single event bus** and a small number of well-defined event types. Resist the temptation to model every state change as an event. Instead, focus on domain events that carry business meaning — an order was placed, a payment was processed, a shipment was dispatched."},
{"type": "paragraph", "markdown": "Adopt a **schema registry** early to enforce contracts between producers and consumers. Versioned schemas prevent breaking changes from propagating through the system and make it safe for teams to evolve their events independently."},
{"type": "list", "variant": "ordered", "items": [
{"text": "Define your domain events and their schemas"},
{"text": "Set up a message broker with dead-letter queues"},
{"text": "Implement idempotent consumers with deduplication"},
{"text": "Add monitoring and alerting for consumer lag"},
{"text": "Introduce event versioning and a schema registry"},
]},
],
},
)
print(result){
"success": true,
"data": {
"buffer": "UEsDBBQAAAAIAA...",
"mime_type": "application/epub+zip"
}
}package main
import il "github.com/iterationlayer/sdk-go"
client := il.NewClient("YOUR_API_KEY")
result, err := client.GenerateDocument(il.GenerateDocumentRequest{
Format: "epub",
Document: il.DocumentDefinition{
Metadata: il.DocumentMetadata{
Title: "Practical Guide to Event-Driven Architecture",
Author: "Sarah Chen",
},
Content: []il.ContentBlock{
il.NewHeadlineBlock("h1", "Practical Guide to Event-Driven Architecture"),
il.ParagraphBlock{Type: "paragraph", Markdown: "*By Sarah Chen*"},
il.NewSeparatorBlock(),
il.NewPageBreakBlock(),
il.NewHeadlineBlock("h1", "Chapter 1: Core Concepts"),
il.ParagraphBlock{Type: "paragraph", Markdown: "Event-driven architecture (EDA) is a software design pattern..."},
il.NewHeadlineBlock("h1", "Chapter 2: Messaging Patterns"),
il.ParagraphBlock{Type: "paragraph", Markdown: "Choosing the right messaging pattern is critical..."},
il.NewHeadlineBlock("h1", "Chapter 3: Implementation Strategies"),
il.ParagraphBlock{Type: "paragraph", Markdown: "When implementing event-driven architecture in production..."},
},
},
}){
"success": true,
"data": {
"buffer": "UEsDBBQAAAAIAA...",
"mime_type": "application/epub+zip"
}
}