File tree Expand file tree Collapse file tree 2 files changed +20
-2
lines changed
Expand file tree Collapse file tree 2 files changed +20
-2
lines changed Original file line number Diff line number Diff line change @@ -84,6 +84,16 @@ type APIEventFull struct {
8484 Data map [string ]interface {} `json:"data,omitempty"`
8585}
8686
87+ // APIEvent is the API response for retrieving a single event
88+ type APIEvent struct {
89+ ID string `json:"id"`
90+ Topic string `json:"topic"`
91+ Time time.Time `json:"time"`
92+ EligibleForRetry bool `json:"eligible_for_retry"`
93+ Metadata map [string ]string `json:"metadata,omitempty"`
94+ Data map [string ]interface {} `json:"data,omitempty"`
95+ }
96+
8797// ListDeliveriesResponse is the response for ListDeliveries
8898type ListDeliveriesResponse struct {
8999 Data []APIDelivery `json:"data"`
@@ -246,7 +256,14 @@ func (h *LogHandlers) RetrieveEvent(c *gin.Context) {
246256 AbortWithError (c , http .StatusNotFound , NewErrNotFound ("event" ))
247257 return
248258 }
249- c .JSON (http .StatusOK , event )
259+ c .JSON (http .StatusOK , APIEvent {
260+ ID : event .ID ,
261+ Topic : event .Topic ,
262+ Time : event .Time ,
263+ EligibleForRetry : event .EligibleForRetry ,
264+ Metadata : event .Metadata ,
265+ Data : event .Data ,
266+ })
250267}
251268
252269// RetrieveDelivery handles GET /:tenantID/deliveries/:deliveryID
Original file line number Diff line number Diff line change @@ -362,10 +362,11 @@ func TestRetrieveEvent(t *testing.T) {
362362 require .NoError (t , json .Unmarshal (w .Body .Bytes (), & response ))
363363
364364 assert .Equal (t , eventID , response ["id" ])
365- assert .Equal (t , tenantID , response ["tenant_id" ])
366365 assert .Equal (t , "payment.processed" , response ["topic" ])
367366 assert .Equal (t , "stripe" , response ["metadata" ].(map [string ]interface {})["source" ])
368367 assert .Equal (t , 100.50 , response ["data" ].(map [string ]interface {})["amount" ])
368+ // tenant_id is not included in API response (tenant-scoped via URL)
369+ assert .Nil (t , response ["tenant_id" ])
369370 })
370371
371372 t .Run ("should return 404 for non-existent event" , func (t * testing.T ) {
You can’t perform that action at this time.
0 commit comments