-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Dedupe webapi trigger structs (#14733)
* Dedupe webapi trigger structs * Re-generate event trigger to get comments
- Loading branch information
Showing
7 changed files
with
34 additions
and
65 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,6 +3,7 @@ | |
"$id": "https://github.com/smartcontractkit/chainlink/v2/core/capabilities/webapi/webapicap/[email protected]", | ||
"$defs": { | ||
"TriggerConfig": { | ||
"description": "See https://gateway-us-1.chain.link/web-api-trigger", | ||
"type": "object", | ||
"properties": { | ||
"allowedSenders": { | ||
|
@@ -53,24 +54,29 @@ | |
"type": "object", | ||
"properties": { | ||
"trigger_id": { | ||
"type": "string" | ||
"type": "string", | ||
"description": "ID of the trigger corresponding to the capability ID." | ||
}, | ||
"trigger_event_id": { | ||
"type": "string" | ||
"type": "string", | ||
"description": "Uniquely identifies generated event (scoped to trigger_id and sender)." | ||
}, | ||
"timestamp": { | ||
"type": "integer", | ||
"format": "int64" | ||
"format": "int64", | ||
"description": "Timestamp of the event (unix time), needs to be within certain freshness to be processed." | ||
}, | ||
"topics": { | ||
"type": "array", | ||
"items": { | ||
"type": "string" | ||
"type": "string", | ||
"description" : "An array of a single topic (string) to be started by this event." | ||
} | ||
}, | ||
"params": { | ||
"type": "object", | ||
"additionalProperties": true | ||
"additionalProperties": true, | ||
"description": "Key-value pairs for the workflow engine, untranslated." | ||
} | ||
}, | ||
"required": ["trigger_id", "trigger_event_id", "timestamp", "topics", "params"], | ||
|
11 changes: 7 additions & 4 deletions
11
core/capabilities/webapi/webapicap/event_trigger_generated.go
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,5 @@ | ||
package webapicapabilities | ||
|
||
import ( | ||
"github.com/smartcontractkit/chainlink-common/pkg/values" | ||
) | ||
|
||
type TargetRequestPayload struct { | ||
URL string `json:"url"` // URL to query, only http and https protocols are supported. | ||
Method string `json:"method,omitempty"` // HTTP verb, defaults to GET. | ||
|
@@ -20,44 +16,6 @@ type TargetResponsePayload struct { | |
Body []byte `json:"body,omitempty"` // HTTP response body | ||
} | ||
|
||
// https://gateway-us-1.chain.link/web-api-trigger | ||
// | ||
// { | ||
// jsonrpc: "2.0", | ||
// id: "...", | ||
// method: "web-api-trigger", | ||
// params: { | ||
// signature: "...", | ||
// body: { | ||
// don_id: "workflow_123", | ||
// payload: { | ||
// trigger_id: "[email protected]", | ||
// trigger_event_id: "action_1234567890", | ||
// timestamp: 1234567890, | ||
// topics: ["daily_price_update"], | ||
// params: { | ||
// bid: "101", | ||
// ask: "102" | ||
// } | ||
// } | ||
// } | ||
// } | ||
// } | ||
// | ||
// from Web API Trigger Doc, with modifications. | ||
// trigger_id - ID of the trigger corresponding to the capability ID | ||
// trigger_event_id - uniquely identifies generated event (scoped to trigger_id and sender) | ||
// timestamp - timestamp of the event (unix time), needs to be within certain freshness to be processed | ||
// topics - an array of a single topic (string) to be started by this event | ||
// params - key-value pairs for the workflow engine, untranslated. | ||
type TriggerRequestPayload struct { | ||
TriggerID string `json:"trigger_id"` | ||
TriggerEventID string `json:"trigger_event_id"` | ||
Timestamp int64 `json:"timestamp"` | ||
Topics []string `json:"topics"` | ||
Params values.Map `json:"params"` | ||
} | ||
|
||
type TriggerResponsePayload struct { | ||
ErrorMessage string `json:"error_message,omitempty"` | ||
// ERROR, ACCEPTED, PENDING, COMPLETED | ||
|