Skip to content

Commit

Permalink
fix import cycle
Browse files Browse the repository at this point in the history
  • Loading branch information
chrispatrick committed Mar 8, 2024
1 parent 3be5e9c commit f5d821f
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 9 deletions.
20 changes: 20 additions & 0 deletions subscriptions.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package skill

import (
"olympos.io/encoding/edn"
)

func (e *EventContextSubscription) GetResultInMapForm() []map[edn.Keyword]edn.RawMessage {
return decode[[]map[edn.Keyword]edn.RawMessage](e.Result)
}

func (e *EventContextSubscription) GetResultInListForm() [][]edn.RawMessage {
return decode[[][]edn.RawMessage](e.Result)
}

func decode[P interface{}](event edn.RawMessage) P {
ednboby, _ := edn.Marshal(event)
var decoded P
edn.Unmarshal(ednboby, &decoded)
return decoded
}
9 changes: 0 additions & 9 deletions types.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ package skill
import (
"context"

"github.com/atomist-skills/go-skill/util"
"olympos.io/encoding/edn"
)

Expand Down Expand Up @@ -51,14 +50,6 @@ type EventContextSubscription struct {
} `edn:"metadata"`
}

func (e *EventContextSubscription) GetResultInMapForm() []map[edn.Keyword]edn.RawMessage {
return util.Decode[[]map[edn.Keyword]edn.RawMessage](e.Result)
}

func (e *EventContextSubscription) GetResultInListForm() [][]edn.RawMessage {
return util.Decode[[][]edn.RawMessage](e.Result)
}

type EventContextWebhook struct {
Name string `edn:"name"`
Configuration Configuration `edn:"configuration"`
Expand Down

0 comments on commit f5d821f

Please sign in to comment.