Skip to content

Commit e27525c

Browse files
committed
fix typo in sequence param, add support for orphan_events API
1 parent fef833f commit e27525c

File tree

2 files changed

+38
-1
lines changed

2 files changed

+38
-1
lines changed

framework/clclient/client.go

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1445,7 +1445,23 @@ func (c *ChainlinkClient) ReadWorkflowEvents(workflowID string, sequence int64,
14451445
"sequence": strconv.FormatInt(sequence, 10),
14461446
"limit": strconv.Itoa(limit),
14471447
}).
1448-
Get("/v2/debug/workflow/{id}/events?sequence={sequenceg}")
1448+
Get("/v2/debug/workflow/{id}/events?sequence={sequence}&limit={limit}")
1449+
if err != nil {
1450+
return nil, nil, err
1451+
}
1452+
return specObj, resp.RawResponse, err
1453+
}
1454+
1455+
func (c *ChainlinkClient) ReadOrphanEvents(sequence int64, limit int) (*WorkflowOrphanEvents, *http.Response, error) {
1456+
specObj := &WorkflowOrphanEvents{}
1457+
framework.L.Info().Str(NodeURL, c.Config.URL).Int64("sequence", sequence).Int("limit", limit).Msg("Reading Workflow Orphan Events")
1458+
resp, err := c.APIClient.R().
1459+
SetResult(&specObj).
1460+
SetQueryParams(map[string]string{
1461+
"sequence": strconv.FormatInt(sequence, 10),
1462+
"limit": strconv.Itoa(limit),
1463+
}).
1464+
Get("/v2/debug/workflow/orphan_events?sequence={sequence}&limit={limit}")
14491465
if err != nil {
14501466
return nil, nil, err
14511467
}

framework/clclient/models.go

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1440,3 +1440,24 @@ type WorkflowDebugEvent struct {
14401440
Message []byte `json:"message"` // protobuf encoded
14411441
Type string `json:"type"` // protobuf type name
14421442
}
1443+
1444+
type WorkflowOrphanEvents struct {
1445+
Data WorkflowOrphanEventsData `json:"data"`
1446+
}
1447+
1448+
type WorkflowOrphanEventsData struct {
1449+
Type string `json:"type"`
1450+
ID string `json:"id"`
1451+
Attributes WorkflowDebugEventsAttributes `json:"attributes"`
1452+
}
1453+
1454+
type WorkflowOrphanEventsAttributes struct {
1455+
Events []WorkflowOrphanEvent `json:"events"`
1456+
}
1457+
1458+
type WorkflowOrphanEvent struct {
1459+
Timestamp time.Time `json:"timestamp"`
1460+
Sequence int64 `json:"sequence"`
1461+
Message []byte `json:"message"` // protobuf encoded
1462+
Type string `json:"type"` // protobuf type name
1463+
}

0 commit comments

Comments
 (0)