using Arcus.EventGrid.Publishing;
// Initialize the publisher with the topic endpoint and authentication key
var eventGridPublisher = EventGridPublisher.Create(topicEndpoint, endpointKey);
// Define event details
string licensePlate = "1-TOM-337";
string eventSubject = $"/cars/{licensePlate}";
string eventId = Guid.NewGuid().ToString();
// Create the event payload
var @event = new NewCarRegistered(eventId, eventSubject, licensePlate);
// Publish the event
await eventGridPublisher.Publish(
eventSubject,
eventType: "NewCarRegistered",
data: new [] { @event },
id: eventId
);