@eventcatalog/create-eventcatalog 4.3.12-beta.1 → 4.3.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (58) hide show
  1. package/dist/index.js +1 -1
  2. package/package.json +1 -1
  3. package/templates/default/domains/Catalog/systems/product-catalog-system/services/ProductAPI/commands/CreateProduct/examples/index.mdx +194 -0
  4. package/templates/default/domains/Catalog/systems/product-catalog-system/services/ProductAPI/commands/DeleteProduct/examples/index.mdx +161 -0
  5. package/templates/default/domains/Catalog/systems/product-catalog-system/services/ProductAPI/commands/UpdateProduct/examples/index.mdx +182 -0
  6. package/templates/default/domains/Catalog/systems/product-catalog-system/services/ProductAPI/events/ProductCreated/examples/index.mdx +227 -0
  7. package/templates/default/domains/Catalog/systems/product-catalog-system/services/ProductAPI/events/ProductDeleted/examples/index.mdx +175 -0
  8. package/templates/default/domains/Catalog/systems/product-catalog-system/services/ProductAPI/events/ProductUpdated/examples/index.mdx +205 -0
  9. package/templates/default/domains/Catalog/systems/product-catalog-system/services/ProductAPI/queries/GetProduct/examples/index.mdx +205 -0
  10. package/templates/default/domains/Catalog/systems/search-system/services/SearchAPI/queries/SearchProducts/examples/index.mdx +369 -0
  11. package/templates/default/domains/Customer/systems/customer-management-system/services/CustomerAPI/commands/RegisterCustomer/examples/index.mdx +168 -0
  12. package/templates/default/domains/Customer/systems/customer-management-system/services/CustomerAPI/commands/UpdateCustomer/examples/index.mdx +168 -0
  13. package/templates/default/domains/Customer/systems/customer-management-system/services/CustomerAPI/events/CustomerRegistered/examples/index.mdx +201 -0
  14. package/templates/default/domains/Customer/systems/customer-management-system/services/CustomerAPI/events/CustomerUpdated/examples/index.mdx +194 -0
  15. package/templates/default/domains/Customer/systems/customer-management-system/services/CustomerAPI/queries/GetCustomer/examples/index.mdx +194 -0
  16. package/templates/default/domains/Customer/systems/identity-provider/services/OAuthAPI/commands/AuthenticateCustomer/examples/index.mdx +198 -0
  17. package/templates/default/domains/Customer/systems/identity-provider/services/OAuthAPI/events/CustomerAuthenticated/examples/index.mdx +276 -0
  18. package/templates/default/domains/Fulfilment/systems/carrier/services/CarrierTrackingAPI/events/ShipmentCreated/examples/index.mdx +184 -0
  19. package/templates/default/domains/Fulfilment/systems/carrier/services/CarrierTrackingAPI/events/ShipmentDelivered/examples/index.mdx +173 -0
  20. package/templates/default/domains/Fulfilment/systems/carrier/services/CarrierTrackingAPI/events/ShipmentFailed/examples/index.mdx +265 -0
  21. package/templates/default/domains/Fulfilment/systems/inventory-system/services/InventoryService/commands/ReleaseInventory/examples/index.mdx +246 -0
  22. package/templates/default/domains/Fulfilment/systems/inventory-system/services/InventoryService/events/InventoryReserved/examples/index.mdx +227 -0
  23. package/templates/default/domains/Fulfilment/systems/inventory-system/services/InventoryService/events/InventoryUnavailable/examples/index.mdx +229 -0
  24. package/templates/default/domains/Fulfilment/systems/inventory-system/services/InventoryService/queries/GetStockLevel/examples/index.mdx +186 -0
  25. package/templates/default/domains/Fulfilment/systems/shipping-system/services/CarrierAdapter/commands/CreateShipment/examples/index.mdx +206 -0
  26. package/templates/default/domains/Fulfilment/systems/warehouse-system/services/PickingWorker/events/OrderPacked/examples/index.mdx +172 -0
  27. package/templates/default/domains/Fulfilment/systems/warehouse-system/services/WarehouseService/events/OrderReadyForShipping/examples/index.mdx +208 -0
  28. package/templates/default/domains/Ordering/systems/checkout-system/services/CheckoutOrchestrator/commands/AuthorizePayment/examples/index.mdx +179 -0
  29. package/templates/default/domains/Ordering/systems/checkout-system/services/CheckoutOrchestrator/commands/ReserveInventory/examples/index.mdx +215 -0
  30. package/templates/default/domains/Ordering/systems/order-management-system/services/OrderService/commands/CancelOrder/examples/index.mdx +163 -0
  31. package/templates/default/domains/Ordering/systems/order-management-system/services/OrderService/commands/CreateOrder/examples/index.mdx +246 -0
  32. package/templates/default/domains/Ordering/systems/order-management-system/services/OrderService/events/OrderCancelled/examples/index.mdx +267 -0
  33. package/templates/default/domains/Ordering/systems/order-management-system/services/OrderService/events/OrderCompleted/examples/index.mdx +171 -0
  34. package/templates/default/domains/Ordering/systems/order-management-system/services/OrderService/events/OrderCreated/examples/index.mdx +190 -0
  35. package/templates/default/domains/Ordering/systems/order-management-system/services/OrderService/queries/GetOrder/examples/index.mdx +343 -0
  36. package/templates/default/domains/Payments/systems/fraud-detection/services/FraudAPI/events/FraudCheckFailed/examples/index.mdx +271 -0
  37. package/templates/default/domains/Payments/systems/fraud-detection/services/FraudAPI/events/FraudCheckPassed/examples/index.mdx +173 -0
  38. package/templates/default/domains/Payments/systems/payment-processing-system/services/PaymentWorker/events/PaymentRequested/examples/index.mdx +191 -0
  39. package/templates/default/domains/Payments/systems/payment-processing-system/services/PaymentWorker/events/RefundRequested/examples/index.mdx +194 -0
  40. package/templates/default/domains/Payments/systems/stripe/services/StripeWebhookEndpoint/events/PaymentFailed/examples/index.mdx +265 -0
  41. package/templates/default/domains/Payments/systems/stripe/services/StripeWebhookEndpoint/events/PaymentSucceeded/examples/index.mdx +190 -0
  42. package/templates/default/domains/Payments/systems/stripe/services/StripeWebhookEndpoint/events/RefundProcessed/examples/index.mdx +186 -0
  43. package/templates/default/domains/Reviews/services/RatingAggregator/events/rating-updated/examples/index.mdx +183 -0
  44. package/templates/default/domains/Reviews/services/ReviewAPI/commands/flag-review/examples/index.mdx +183 -0
  45. package/templates/default/domains/Reviews/services/ReviewAPI/commands/submit-review/examples/index.mdx +195 -0
  46. package/templates/default/domains/Reviews/services/ReviewAPI/commands/vote-review-helpful/examples/index.mdx +178 -0
  47. package/templates/default/domains/Reviews/services/ReviewAPI/events/review-flagged/examples/index.mdx +186 -0
  48. package/templates/default/domains/Reviews/services/ReviewAPI/events/review-helpful-voted/examples/index.mdx +177 -0
  49. package/templates/default/domains/Reviews/services/ReviewAPI/events/review-submitted/examples/index.mdx +194 -0
  50. package/templates/default/domains/Reviews/services/ReviewAPI/queries/get-product-reviews/examples/index.mdx +259 -0
  51. package/templates/default/domains/Reviews/services/ReviewModerationWorker/events/review-published/examples/index.mdx +183 -0
  52. package/templates/default/domains/Reviews/services/ReviewModerationWorker/events/review-rejected/examples/index.mdx +178 -0
  53. package/templates/default/domains/Shopping/systems/cart-system/services/CartAPI/commands/AddItemToCart/examples/index.mdx +171 -0
  54. package/templates/default/domains/Shopping/systems/cart-system/services/CartAPI/commands/CheckoutCart/examples/index.mdx +168 -0
  55. package/templates/default/domains/Shopping/systems/cart-system/services/CartAPI/commands/RemoveItemFromCart/examples/index.mdx +170 -0
  56. package/templates/default/domains/Shopping/systems/cart-system/services/CartAPI/events/CartCheckedOut/examples/index.mdx +275 -0
  57. package/templates/default/domains/Shopping/systems/promotion-system/services/PromotionService/commands/CalculateDiscount/examples/index.mdx +207 -0
  58. package/templates/default/domains/Shopping/systems/promotion-system/services/PromotionService/events/DiscountCalculated/examples/index.mdx +190 -0
@@ -0,0 +1,186 @@
1
+ <Columns cols={2}>
2
+
3
+ <Column>
4
+
5
+ ## 1. Confirm a full refund
6
+
7
+ Stripe completes the full refund for the cancelled T-shirt and cap order. The StripeWebhookEndpoint publishes `RefundProcessed` and the PaymentWorker records the refund as complete.
8
+
9
+ ### Payload details
10
+
11
+ - `refundId` matches the `RefundRequested` event that started the refund.
12
+ - `paymentId` is the original charge that was refunded.
13
+ - `amount` is the full original charge, in pence.
14
+
15
+ The customer received **4,298 pence (£42.98)**.
16
+
17
+ ### Using this example
18
+
19
+ Consumers should match `refundId` to the pending refund and mark it complete. Tests can assert that `amount` equals the requested refund.
20
+
21
+ The examples use a **fictional Acme Events SDK** to publish a payload matching the RefundProcessed schema. The package names and publish methods are illustrative.
22
+
23
+ </Column>
24
+
25
+ <Column>
26
+
27
+ <CodeGroup dropdown>
28
+
29
+ ```typescript publish-refund-processed.ts
30
+ import { EventsClient } from '@acme/events';
31
+ import type { RefundProcessed } from './schemas/refund-processed';
32
+
33
+ const client = new EventsClient({
34
+ apiKey: process.env.ACME_API_KEY!,
35
+ });
36
+
37
+ const event: RefundProcessed = {
38
+ refundId: 'b5e477d7-f910-43f5-a371-e9f3f53cfaa2',
39
+ paymentId: '586e57ab-77a9-406a-945d-4619c76a582e',
40
+ amount: 4298,
41
+ currency: 'GBP',
42
+ processedAt: '2026-09-11T14:05:31Z',
43
+ };
44
+
45
+ await client.publish('RefundProcessed', event);
46
+ ```
47
+
48
+ ```python publish_refund_processed.py
49
+ import os
50
+ from acme_events import EventsClient
51
+
52
+ client = EventsClient(api_key=os.environ["ACME_API_KEY"])
53
+
54
+ event = {
55
+ "refundId": "b5e477d7-f910-43f5-a371-e9f3f53cfaa2",
56
+ "paymentId": "586e57ab-77a9-406a-945d-4619c76a582e",
57
+ "amount": 4298,
58
+ "currency": "GBP",
59
+ "processedAt": "2026-09-11T14:05:31Z",
60
+ }
61
+
62
+ client.publish("RefundProcessed", event)
63
+ ```
64
+
65
+ ```java PublishRefundProcessed.java
66
+ import com.acme.events.EventsClient;
67
+ import java.util.Map;
68
+
69
+ public class PublishRefundProcessed {
70
+ public static void main(String[] args) {
71
+ var client = new EventsClient(
72
+ System.getenv("ACME_API_KEY")
73
+ );
74
+
75
+ var event = Map.of(
76
+ "refundId", "b5e477d7-f910-43f5-a371-e9f3f53cfaa2",
77
+ "paymentId", "586e57ab-77a9-406a-945d-4619c76a582e",
78
+ "amount", 4298,
79
+ "currency", "GBP",
80
+ "processedAt", "2026-09-11T14:05:31Z"
81
+ );
82
+
83
+ client.publish("RefundProcessed", event);
84
+ }
85
+ }
86
+ ```
87
+
88
+ </CodeGroup>
89
+
90
+ </Column>
91
+
92
+ </Columns>
93
+
94
+ ---
95
+
96
+ <Columns cols={2}>
97
+
98
+ <Column>
99
+
100
+ ## 2. Confirm a partial refund
101
+
102
+ Stripe refunds one returned hoodie from the guest order. Only part of the original €164.97 payment is returned.
103
+
104
+ ### Payload details
105
+
106
+ - `amount` is one hoodie at €54.99, in cents.
107
+ - `currency` is `EUR`, the same as the original charge.
108
+
109
+ The customer received **5,499 cents (€54.99)**; 10,998 cents (€109.98) stays charged.
110
+
111
+ ### Using this example
112
+
113
+ Use this payload to check that consumers record a partial refund without marking the whole payment as refunded.
114
+
115
+ The examples use a **fictional Acme Events SDK** to publish a payload matching the RefundProcessed schema. The package names and publish methods are illustrative.
116
+
117
+ </Column>
118
+
119
+ <Column>
120
+
121
+ <CodeGroup dropdown>
122
+
123
+ ```typescript publish-refund-processed.ts
124
+ import { EventsClient } from '@acme/events';
125
+ import type { RefundProcessed } from './schemas/refund-processed';
126
+
127
+ const client = new EventsClient({
128
+ apiKey: process.env.ACME_API_KEY!,
129
+ });
130
+
131
+ const event: RefundProcessed = {
132
+ refundId: 'f57e3268-60d1-4b1d-96e9-c27d47992d47',
133
+ paymentId: '41651c3f-fa8e-40fc-a217-a83929d15081',
134
+ amount: 5499,
135
+ currency: 'EUR',
136
+ processedAt: '2026-09-21T09:40:22Z',
137
+ };
138
+
139
+ await client.publish('RefundProcessed', event);
140
+ ```
141
+
142
+ ```python publish_refund_processed.py
143
+ import os
144
+ from acme_events import EventsClient
145
+
146
+ client = EventsClient(api_key=os.environ["ACME_API_KEY"])
147
+
148
+ event = {
149
+ "refundId": "f57e3268-60d1-4b1d-96e9-c27d47992d47",
150
+ "paymentId": "41651c3f-fa8e-40fc-a217-a83929d15081",
151
+ "amount": 5499,
152
+ "currency": "EUR",
153
+ "processedAt": "2026-09-21T09:40:22Z",
154
+ }
155
+
156
+ client.publish("RefundProcessed", event)
157
+ ```
158
+
159
+ ```java PublishRefundProcessed.java
160
+ import com.acme.events.EventsClient;
161
+ import java.util.Map;
162
+
163
+ public class PublishRefundProcessed {
164
+ public static void main(String[] args) {
165
+ var client = new EventsClient(
166
+ System.getenv("ACME_API_KEY")
167
+ );
168
+
169
+ var event = Map.of(
170
+ "refundId", "f57e3268-60d1-4b1d-96e9-c27d47992d47",
171
+ "paymentId", "41651c3f-fa8e-40fc-a217-a83929d15081",
172
+ "amount", 5499,
173
+ "currency", "EUR",
174
+ "processedAt", "2026-09-21T09:40:22Z"
175
+ );
176
+
177
+ client.publish("RefundProcessed", event);
178
+ }
179
+ }
180
+ ```
181
+
182
+ </CodeGroup>
183
+
184
+ </Column>
185
+
186
+ </Columns>
@@ -0,0 +1,183 @@
1
+ <Columns cols={2}>
2
+
3
+ <Column>
4
+
5
+ ## 1. Publish a small rise in a product's rating
6
+
7
+ A five-star review for the classic white T-shirt has just been published. The Rating Aggregator recalculates the product's rating and publishes this event so the storefront and search can refresh it.
8
+
9
+ ### Payload details
10
+
11
+ - `productId` is `prod_tshirt_classic_white`.
12
+ - `reviewCount` is `128`: the 127 earlier published reviews plus the new one.
13
+ - `averageRating` is `4.6`, rounded to two decimal places and within the 0 to 5 range.
14
+ - `updatedAt` is when the aggregate was recalculated.
15
+
16
+ The product now has **589 stars across 128 reviews**, so the average is 589 / 128 = **4.60** (up from 584 / 127 = 4.598).
17
+
18
+ ### Using this example
19
+
20
+ Consumers should replace any cached rating for this `productId` with `averageRating` and `reviewCount` rather than trying to apply a delta.
21
+
22
+ The examples use a **fictional Acme Events SDK** to publish a payload matching the RatingUpdated schema. The package names and publish methods are illustrative.
23
+
24
+ </Column>
25
+
26
+ <Column>
27
+
28
+ <CodeGroup dropdown>
29
+
30
+ ```typescript publish-rating-updated.ts
31
+ import { EventsClient } from '@acme/events';
32
+ import type { RatingUpdated } from './schemas/rating-updated';
33
+
34
+ const client = new EventsClient({
35
+ apiKey: process.env.ACME_API_KEY!,
36
+ });
37
+
38
+ const event: RatingUpdated = {
39
+ productId: 'prod_tshirt_classic_white',
40
+ averageRating: 4.6,
41
+ reviewCount: 128,
42
+ updatedAt: '2026-09-14T18:23:05Z',
43
+ };
44
+
45
+ await client.publish('RatingUpdated', event);
46
+ ```
47
+
48
+ ```python publish_rating_updated.py
49
+ import os
50
+ from acme_events import EventsClient
51
+
52
+ client = EventsClient(api_key=os.environ["ACME_API_KEY"])
53
+
54
+ event = {
55
+ "productId": "prod_tshirt_classic_white",
56
+ "averageRating": 4.6,
57
+ "reviewCount": 128,
58
+ "updatedAt": "2026-09-14T18:23:05Z",
59
+ }
60
+
61
+ client.publish("RatingUpdated", event)
62
+ ```
63
+
64
+ ```java PublishRatingUpdated.java
65
+ import com.acme.events.EventsClient;
66
+ import java.util.Map;
67
+
68
+ public class PublishRatingUpdated {
69
+ public static void main(String[] args) {
70
+ var client = new EventsClient(
71
+ System.getenv("ACME_API_KEY")
72
+ );
73
+
74
+ var event = Map.of(
75
+ "productId", "prod_tshirt_classic_white",
76
+ "averageRating", 4.6,
77
+ "reviewCount", 128,
78
+ "updatedAt", "2026-09-14T18:23:05Z"
79
+ );
80
+
81
+ client.publish("RatingUpdated", event);
82
+ }
83
+ }
84
+ ```
85
+
86
+ </CodeGroup>
87
+
88
+ </Column>
89
+
90
+ </Columns>
91
+
92
+ ---
93
+
94
+ <Columns cols={2}>
95
+
96
+ <Column>
97
+
98
+ ## 2. Publish a drop in a product's rating
99
+
100
+ A two-star review for the oversized grey hoodie has been published. With only a few reviews, one low rating moves the average noticeably.
101
+
102
+ ### Payload details
103
+
104
+ - `productId` is `prod_hoodie_oversized_grey`.
105
+ - `reviewCount` is `7`: six earlier reviews plus the new two-star review.
106
+ - `averageRating` is `4.14`, rounded to two decimal places.
107
+ - `updatedAt` is when the aggregate was recalculated.
108
+
109
+ The six earlier reviews had **27 stars** (average 4.50). Adding 2 gives **29 stars across 7 reviews**, so the average is 29 / 7 = **4.14**.
110
+
111
+ ### Using this example
112
+
113
+ Use this payload to check that product pages and search results show the lower rating, and that any "4.5 stars and up" filter no longer includes this product.
114
+
115
+ The examples use a **fictional Acme Events SDK** to publish a payload matching the RatingUpdated schema. The package names and publish methods are illustrative.
116
+
117
+ </Column>
118
+
119
+ <Column>
120
+
121
+ <CodeGroup dropdown>
122
+
123
+ ```typescript publish-rating-updated.ts
124
+ import { EventsClient } from '@acme/events';
125
+ import type { RatingUpdated } from './schemas/rating-updated';
126
+
127
+ const client = new EventsClient({
128
+ apiKey: process.env.ACME_API_KEY!,
129
+ });
130
+
131
+ const event: RatingUpdated = {
132
+ productId: 'prod_hoodie_oversized_grey',
133
+ averageRating: 4.14,
134
+ reviewCount: 7,
135
+ updatedAt: '2026-09-15T09:05:41Z',
136
+ };
137
+
138
+ await client.publish('RatingUpdated', event);
139
+ ```
140
+
141
+ ```python publish_rating_updated.py
142
+ import os
143
+ from acme_events import EventsClient
144
+
145
+ client = EventsClient(api_key=os.environ["ACME_API_KEY"])
146
+
147
+ event = {
148
+ "productId": "prod_hoodie_oversized_grey",
149
+ "averageRating": 4.14,
150
+ "reviewCount": 7,
151
+ "updatedAt": "2026-09-15T09:05:41Z",
152
+ }
153
+
154
+ client.publish("RatingUpdated", event)
155
+ ```
156
+
157
+ ```java PublishRatingUpdated.java
158
+ import com.acme.events.EventsClient;
159
+ import java.util.Map;
160
+
161
+ public class PublishRatingUpdated {
162
+ public static void main(String[] args) {
163
+ var client = new EventsClient(
164
+ System.getenv("ACME_API_KEY")
165
+ );
166
+
167
+ var event = Map.of(
168
+ "productId", "prod_hoodie_oversized_grey",
169
+ "averageRating", 4.14,
170
+ "reviewCount", 7,
171
+ "updatedAt", "2026-09-15T09:05:41Z"
172
+ );
173
+
174
+ client.publish("RatingUpdated", event);
175
+ }
176
+ }
177
+ ```
178
+
179
+ </CodeGroup>
180
+
181
+ </Column>
182
+
183
+ </Columns>
@@ -0,0 +1,183 @@
1
+ <Columns cols={2}>
2
+
3
+ <Column>
4
+
5
+ ## 1. Flag an off-topic review with notes
6
+
7
+ A shopper reading reviews for the navy baseball cap reports one that only complains about delivery times. The storefront sends this command to the Review API, which records the flag and publishes `ReviewFlagged`.
8
+
9
+ ### Payload details
10
+
11
+ - `reviewId` is the published review being reported.
12
+ - `flaggedBy` is the customer id `cust_2290`.
13
+ - `reason` is `off_topic`, one of `spam`, `abuse`, `off_topic`, `inappropriate` or `other`.
14
+ - `notes` (optional, max 1,000 characters) gives the moderator some context.
15
+ - `flaggedAt` is when the customer sent the report.
16
+
17
+ ### Using this example
18
+
19
+ Check that the Review API stores the flag and publishes `ReviewFlagged` with the same `reviewId` and `reason`.
20
+
21
+ The examples use a **fictional Acme Events SDK** to send a payload matching the FlagReview schema. The package names and send methods are illustrative.
22
+
23
+ </Column>
24
+
25
+ <Column>
26
+
27
+ <CodeGroup dropdown>
28
+
29
+ ```typescript send-flag-review.ts
30
+ import { EventsClient } from '@acme/events';
31
+ import type { FlagReview } from './schemas/flag-review';
32
+
33
+ const client = new EventsClient({
34
+ apiKey: process.env.ACME_API_KEY!,
35
+ });
36
+
37
+ const command: FlagReview = {
38
+ reviewId: 'b2d6f8a1-4c3e-4a9b-9f7d-5e1c3a8b0d24',
39
+ flaggedBy: 'cust_2290',
40
+ reason: 'off_topic',
41
+ notes: 'This is about delivery times, not the cap itself.',
42
+ flaggedAt: '2026-09-16T12:40:18Z',
43
+ };
44
+
45
+ await client.send('FlagReview', command);
46
+ ```
47
+
48
+ ```python send_flag_review.py
49
+ import os
50
+ from acme_events import EventsClient
51
+
52
+ client = EventsClient(api_key=os.environ["ACME_API_KEY"])
53
+
54
+ command = {
55
+ "reviewId": "b2d6f8a1-4c3e-4a9b-9f7d-5e1c3a8b0d24",
56
+ "flaggedBy": "cust_2290",
57
+ "reason": "off_topic",
58
+ "notes": "This is about delivery times, not the cap itself.",
59
+ "flaggedAt": "2026-09-16T12:40:18Z",
60
+ }
61
+
62
+ client.send("FlagReview", command)
63
+ ```
64
+
65
+ ```java SendFlagReview.java
66
+ import com.acme.events.EventsClient;
67
+ import java.util.Map;
68
+
69
+ public class SendFlagReview {
70
+ public static void main(String[] args) {
71
+ var client = new EventsClient(
72
+ System.getenv("ACME_API_KEY")
73
+ );
74
+
75
+ var command = Map.of(
76
+ "reviewId", "b2d6f8a1-4c3e-4a9b-9f7d-5e1c3a8b0d24",
77
+ "flaggedBy", "cust_2290",
78
+ "reason", "off_topic",
79
+ "notes", "This is about delivery times, not the cap itself.",
80
+ "flaggedAt", "2026-09-16T12:40:18Z"
81
+ );
82
+
83
+ client.send("FlagReview", command);
84
+ }
85
+ }
86
+ ```
87
+
88
+ </CodeGroup>
89
+
90
+ </Column>
91
+
92
+ </Columns>
93
+
94
+ ---
95
+
96
+ <Columns cols={2}>
97
+
98
+ <Column>
99
+
100
+ ## 2. Flag an abusive review as a moderator
101
+
102
+ A moderator doing a routine check spots an abusive review on the sunset graphic T-shirt and flags it from the moderation console, without adding notes.
103
+
104
+ ### Payload details
105
+
106
+ - `flaggedBy` is the moderator id `mod_017`; the same field holds customer or moderator ids.
107
+ - `reason` is `abuse`.
108
+ - `notes` is omitted because it is optional.
109
+ - `flaggedAt` is the UTC time of the flag.
110
+
111
+ ### Using this example
112
+
113
+ Use this payload to test that flags from moderators and customers follow the same path, and that a missing `notes` field is accepted.
114
+
115
+ The examples use a **fictional Acme Events SDK** to send a payload matching the FlagReview schema. The package names and send methods are illustrative.
116
+
117
+ </Column>
118
+
119
+ <Column>
120
+
121
+ <CodeGroup dropdown>
122
+
123
+ ```typescript send-flag-review.ts
124
+ import { EventsClient } from '@acme/events';
125
+ import type { FlagReview } from './schemas/flag-review';
126
+
127
+ const client = new EventsClient({
128
+ apiKey: process.env.ACME_API_KEY!,
129
+ });
130
+
131
+ const command: FlagReview = {
132
+ reviewId: 'd8a3c5e7-2f1b-4e9d-b4a6-7c0e3f5a1b82',
133
+ flaggedBy: 'mod_017',
134
+ reason: 'abuse',
135
+ flaggedAt: '2026-09-17T08:15:00Z',
136
+ };
137
+
138
+ await client.send('FlagReview', command);
139
+ ```
140
+
141
+ ```python send_flag_review.py
142
+ import os
143
+ from acme_events import EventsClient
144
+
145
+ client = EventsClient(api_key=os.environ["ACME_API_KEY"])
146
+
147
+ command = {
148
+ "reviewId": "d8a3c5e7-2f1b-4e9d-b4a6-7c0e3f5a1b82",
149
+ "flaggedBy": "mod_017",
150
+ "reason": "abuse",
151
+ "flaggedAt": "2026-09-17T08:15:00Z",
152
+ }
153
+
154
+ client.send("FlagReview", command)
155
+ ```
156
+
157
+ ```java SendFlagReview.java
158
+ import com.acme.events.EventsClient;
159
+ import java.util.Map;
160
+
161
+ public class SendFlagReview {
162
+ public static void main(String[] args) {
163
+ var client = new EventsClient(
164
+ System.getenv("ACME_API_KEY")
165
+ );
166
+
167
+ var command = Map.of(
168
+ "reviewId", "d8a3c5e7-2f1b-4e9d-b4a6-7c0e3f5a1b82",
169
+ "flaggedBy", "mod_017",
170
+ "reason", "abuse",
171
+ "flaggedAt", "2026-09-17T08:15:00Z"
172
+ );
173
+
174
+ client.send("FlagReview", command);
175
+ }
176
+ }
177
+ ```
178
+
179
+ </CodeGroup>
180
+
181
+ </Column>
182
+
183
+ </Columns>