Skip to content

Commit d25f478

Browse files
authored
Merge pull request #341 from AgentWorkforce/fix/integration-bind-subscription-flag
fix(cli): add --subscription flag to relayfile integration bind
2 parents 5d94e1d + b1590d5 commit d25f478

1 file changed

Lines changed: 19 additions & 12 deletions

File tree

cmd/relayfile-cli/main.go

Lines changed: 19 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -429,13 +429,14 @@ type integrationConnectionState struct {
429429
}
430430

431431
type relayIntegrationBinding struct {
432-
Provider string `json:"provider"`
433-
PathGlob string `json:"pathGlob"`
434-
Channel string `json:"channel"`
435-
WebhookID string `json:"webhookId"`
436-
WebhookToken string `json:"webhookToken"`
437-
CreatedAt string `json:"createdAt,omitempty"`
438-
UpdatedAt string `json:"updatedAt,omitempty"`
432+
Provider string `json:"provider"`
433+
PathGlob string `json:"pathGlob"`
434+
Channel string `json:"channel"`
435+
WebhookID string `json:"webhookId"`
436+
WebhookToken string `json:"webhookToken"`
437+
SubscriptionID string `json:"subscriptionId,omitempty"`
438+
CreatedAt string `json:"createdAt,omitempty"`
439+
UpdatedAt string `json:"updatedAt,omitempty"`
439440
}
440441

441442
type relayIntegrationBindingStore struct {
@@ -2297,11 +2298,13 @@ func runIntegrationBind(args []string, stdout io.Writer) error {
22972298
channel := fs.String("channel", "", "relay channel to receive provider records")
22982299
webhookID := fs.String("webhook", "", "RelayCast inbound webhook id")
22992300
webhookToken := fs.String("webhook-token", "", "RelayCast inbound webhook token")
2301+
subscriptionID := fs.String("subscription", "", "relay integration subscription id")
23002302
if err := fs.Parse(normalizeFlagArgs(args, map[string]bool{
23012303
"list": false,
23022304
"channel": true,
23032305
"webhook": true,
23042306
"webhook-token": true,
2307+
"subscription": true,
23052308
})); err != nil {
23062309
return err
23072310
}
@@ -2327,11 +2330,12 @@ func runIntegrationBind(args []string, stdout io.Writer) error {
23272330
return errors.New("PATH_GLOB must start with /")
23282331
}
23292332
binding := relayIntegrationBinding{
2330-
Provider: provider,
2331-
PathGlob: pathGlob,
2332-
Channel: strings.TrimSpace(*channel),
2333-
WebhookID: strings.TrimSpace(*webhookID),
2334-
WebhookToken: strings.TrimSpace(*webhookToken),
2333+
Provider: provider,
2334+
PathGlob: pathGlob,
2335+
Channel: strings.TrimSpace(*channel),
2336+
WebhookID: strings.TrimSpace(*webhookID),
2337+
WebhookToken: strings.TrimSpace(*webhookToken),
2338+
SubscriptionID: strings.TrimSpace(*subscriptionID),
23352339
}
23362340
if binding.Channel == "" {
23372341
return errors.New("--channel is required")
@@ -2355,6 +2359,9 @@ func runIntegrationBind(args []string, stdout io.Writer) error {
23552359
if binding.CreatedAt == "" {
23562360
binding.CreatedAt = now
23572361
}
2362+
if binding.SubscriptionID == "" {
2363+
binding.SubscriptionID = bindings[i].SubscriptionID
2364+
}
23582365
bindings[i] = binding
23592366
replaced = true
23602367
break

0 commit comments

Comments
 (0)